/* Remove all watches associated with the watch list element after PREVTAIL, or after the first element if PREVTAIL is t. If INVALID_P is true, the descriptor is already invalid, i.e., it received a IN_IGNORED event. In this case skip calling inotify_rm_watch. */ static void remove_descriptor (Lisp_Object prevtail, bool invalid_p) { Lisp_Object tail = CONSP (prevtail) ? XCDR (prevtail) : watch_list; int inotify_errno = 0; if (! invalid_p) { int wd; CONS_TO_INTEGER (XCAR (XCAR (tail)), int, wd); if (inotify_rm_watch (inotifyfd, wd) != 0) inotify_errno = errno; } if (CONSP (prevtail)) XSETCDR (prevtail, XCDR (tail)); else { watch_list = XCDR (tail); if (NILP (watch_list)) { delete_read_fd (inotifyfd); emacs_close (inotifyfd); inotifyfd = -1; } } if (inotify_errno != 0) { errno = inotify_errno; report_file_notify_error ("Could not rm watch", XCAR (tail)); } }
static void ice_connection_closed (void) { if (ice_fd >= 0) delete_read_fd (ice_fd); ice_fd = -1; }