Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 92573 | Differences between
and this patch

Collapse All | Expand All

(-)server/gam_inotify.c (-8 / +18 lines)
Lines 168-177 Link Here
168
	    GAM_DEBUG(DEBUG_INFO, "Removing %s from inotify\n", path);
168
	    GAM_DEBUG(DEBUG_INFO, "Removing %s from inotify\n", path);
169
	    break;
169
	    break;
170
	case GAMIN_FLOWCONTROLSTART:
170
	case GAMIN_FLOWCONTROLSTART:
171
	    GAM_DEBUG(DEBUG_INFO, "Start flow control for %s\n", path);
171
	    GAM_DEBUG(DEBUG_INFO, "inotify: Start flow control for %s\n", path);
172
	    break;
172
	    break;
173
	case GAMIN_FLOWCONTROLSTOP:
173
	case GAMIN_FLOWCONTROLSTOP:
174
	    GAM_DEBUG(DEBUG_INFO, "Stop flow control for %s\n", path);
174
	    GAM_DEBUG(DEBUG_INFO, "inotify: Stop flow control for %s\n", path);
175
	    break;
175
	    break;
176
	default:
176
	default:
177
	    gam_error(DEBUG_INFO, "Unknown inotify operation %d for %s\n",
177
	    gam_error(DEBUG_INFO, "Unknown inotify operation %d for %s\n",
Lines 281-288 Link Here
281
            }
281
            }
282
            GAM_DEBUG(DEBUG_INFO, "  not found using parent\n");
282
            GAM_DEBUG(DEBUG_INFO, "  not found using parent\n");
283
        }
283
        }
284
#if 0
284
        if (data != NULL) {
285
        if (data != NULL) {
285
	    if (mode == GAMIN_FLOWCONTROLSTART) {
286
	    if (mode == GAMIN_FLOWCONTROLSTART) {
287
		GAM_DEBUG(DEBUG_INFO, "inotify: GAMIN_FLOWCONTROLSTART for %s\n", data->path);
286
		if (data->wd >= 0) {
288
		if (data->wd >= 0) {
287
		    if (ioctl (inotify_device_fd, INOTIFY_IGNORE, &data->wd) < 0) {
289
		    if (ioctl (inotify_device_fd, INOTIFY_IGNORE, &data->wd) < 0) {
288
			GAM_DEBUG (DEBUG_INFO, "INOTIFY_IGNORE failed for %s (wd = %d)\n", data->path, data->wd);
290
			GAM_DEBUG (DEBUG_INFO, "INOTIFY_IGNORE failed for %s (wd = %d)\n", data->path, data->wd);
Lines 296-309 Link Here
296
		}
298
		}
297
		data->busy++;
299
		data->busy++;
298
	    } else {
300
	    } else {
301
		GAM_DEBUG(DEBUG_INFO, "inotify: GAMIN_FLOWCONTROLSTOP for %s\n", data->path);
299
	        if (data->busy > 0) {
302
	        if (data->busy > 0) {
303
		    GAM_DEBUG(DEBUG_INFO, "inotify: data->busy > 0 for %s\n", data->path);
300
		    data->busy--;
304
		    data->busy--;
301
		    if (data->busy == 0) {
305
		    if (data->busy == 0) {
306
			GAM_DEBUG(DEBUG_INFO, "inotify: data->busy == 0 for %s\n", data->path);
302
			path_fd = open(data->path, O_RDONLY);
307
			path_fd = open(data->path, O_RDONLY);
303
			if (path_fd < 0) {
308
			if (path_fd < 0) {
304
			    G_UNLOCK(inotify);
309
			    G_UNLOCK(inotify);
305
			    GAM_DEBUG(DEBUG_INFO,
310
			    GAM_DEBUG(DEBUG_INFO,
306
			              "Failed to reactivate inotify for %s\n",
311
			              "failed to reactivate inotify for %s\n",
307
				      data->path);
312
				      data->path);
308
313
309
                            if ((dir != path) && (dir != NULL))
314
                            if ((dir != path) && (dir != NULL))
Lines 317-323 Link Here
317
			close (path_fd);
322
			close (path_fd);
318
323
319
			/* Remove the old wd from the hash table */
324
			/* Remove the old wd from the hash table */
320
		    g_hash_table_remove(wd_hash, GINT_TO_POINTER(data->wd));
325
			g_hash_table_remove(wd_hash, GINT_TO_POINTER(data->wd));
321
326
322
			data->wd = path_wd;
327
			data->wd = path_wd;
323
			data->deactivated = FALSE;
328
			data->deactivated = FALSE;
Lines 325-331 Link Here
325
			/* Insert the new wd into the hash table */
330
			/* Insert the new wd into the hash table */
326
			g_hash_table_insert(wd_hash, GINT_TO_POINTER(data->wd),
331
			g_hash_table_insert(wd_hash, GINT_TO_POINTER(data->wd),
327
			                    data);
332
			                    data);
328
			GAM_DEBUG(DEBUG_INFO, "Reactivated inotify for %s\n",
333
			GAM_DEBUG(DEBUG_INFO, "reactivated inotify for %s\n",
329
			          data->path);
334
			          data->path);
330
#ifdef GAMIN_DEBUG_API
335
#ifdef GAMIN_DEBUG_API
331
			gam_debug_report(GAMinotifyFlowOff, path, 0);
336
			gam_debug_report(GAMinotifyFlowOff, path, 0);
Lines 334-339 Link Here
334
		}
339
		}
335
	    }
340
	    }
336
	}
341
	}
342
#endif
337
        if ((dir != path) && (dir != NULL))
343
        if ((dir != path) && (dir != NULL))
338
            g_free(dir);
344
            g_free(dir);
339
    } else {
345
    } else {
Lines 420-431 Link Here
420
426
421
	data = g_hash_table_lookup (wd_hash, GINT_TO_POINTER(event->wd));
427
	data = g_hash_table_lookup (wd_hash, GINT_TO_POINTER(event->wd));
422
	if (!data) {
428
	if (!data) {
423
	    GAM_DEBUG(DEBUG_INFO, "inotify can't find wd %d\n", event->wd);
429
	    GAM_DEBUG(DEBUG_INFO, "processing event: inotify can't find wd %d\n", event->wd);
430
	} else if (data->deactivated) {
431
	    GAM_DEBUG(DEBUG_INFO, "inotify: ignoring event on temporarily deactivated watch %s\n", data->path);
424
	} else {
432
	} else {
425
	    if (event->mask == IN_IGNORED) {
433
	    if (event->mask == IN_IGNORED) {
426
		GList *l;
434
		GList *l;
427
435
428
		GAM_DEBUG(DEBUG_INFO, "inotify ignoring wd %d\n", event->wd);
436
		GAM_DEBUG(DEBUG_INFO, "inotify: IN_IGNORE on wd=%d\n", event->wd);
437
		GAM_DEBUG(DEBUG_INFO, "inotify: removing all subscriptions for %s\n", data->path);
429
438
430
		l = data->subs;
439
		l = data->subs;
431
		data->subs = NULL;
440
		data->subs = NULL;
Lines 441-447 Link Here
441
		    gam_poll_scan_directory (data->path);
450
		    gam_poll_scan_directory (data->path);
442
		}
451
		}
443
	    } else if (event->mask == IN_Q_OVERFLOW) {
452
	    } else if (event->mask == IN_Q_OVERFLOW) {
444
		GAM_DEBUG(DEBUG_INFO, "inotify queue over flowed\n");
453
		    GAM_DEBUG(DEBUG_INFO, "inotify queue over flowed\n");
454
		    GAM_DEBUG(DEBUG_INFO, "FIXME, should request poll for all paths here\n");
445
	    }
455
	    }
446
	}
456
	}
447
457
(-)server/gam_server.c (+2 lines)
Lines 99-104 Link Here
99
	if (gam_inotify_init()) {
99
	if (gam_inotify_init()) {
100
	    GAM_DEBUG(DEBUG_INFO, "Using INotify as backend\n");
100
	    GAM_DEBUG(DEBUG_INFO, "Using INotify as backend\n");
101
	    return(TRUE);
101
	    return(TRUE);
102
	} else {
103
		printf("Not using inotify backend\n");
102
	}
104
	}
103
#endif
105
#endif
104
#ifdef ENABLE_DNOTIFY
106
#ifdef ENABLE_DNOTIFY

Return to bug 92573