Commit c8536ec4 authored by Paul Eggert's avatar Paul Eggert

* inotify.c (uninitialized): Remove. All uses replaced by -1.

(Finotify_add_watch): Simplify, since -1 means uninitialized now.
Touch up doc a bit.
parent 2d848487
2013-07-11 Paul Eggert <eggert@cs.ucla.edu>
* inotify.c (uninitialized): Remove. All uses replaced by -1.
(Finotify_add_watch): Simplify, since -1 means uninitialized now.
Touch up doc a bit.
* eval.c (backtrace_function, backtrace_args): Now EXTERNALLY_VISIBLE.
This is for .gdbinit xbacktrace.
......
......@@ -71,9 +71,8 @@ static Lisp_Object Qunmount; /* IN_UNMOUNT */
# define IN_ONLYDIR 0
#endif
enum { uninitialized = -100 };
/* File handle for inotify. */
static int inotifyfd = uninitialized;
static int inotifyfd = -1;
/* Assoc list of files being watched.
Format:
......@@ -268,8 +267,10 @@ aspect_to_inotifymask (Lisp_Object aspect)
DEFUN ("inotify-add-watch", Finotify_add_watch, Sinotify_add_watch, 3, 3, 0,
doc: /* Add a watch for FILE-NAME to inotify.
A WATCH-DESCRIPTOR is returned on success. ASPECT might be one of the following
symbols or a list of those symbols:
Return a watch descriptor. The watch will look for ASPECT events and
invoke CALLBACK when an event occurs.
ASPECT might be one of the following symbols or a list of those symbols:
access
attrib
......@@ -288,7 +289,7 @@ all-events or t
move
close
The following symbols can also be added to a list of aspects
The following symbols can also be added to a list of aspects:
dont-follow
excl-unlink
......@@ -296,9 +297,8 @@ mask-add
oneshot
onlydir
Watching a directory is not recursive. CALLBACK gets called in case of an
event. It gets passed a single argument EVENT which contains an event structure
of the format
Watching a directory is not recursive. CALLBACK is passed a single argument
EVENT which contains an event structure of the format
(WATCH-DESCRIPTOR ASPECTS NAME COOKIE)
......@@ -331,16 +331,13 @@ is managed internally and there is no corresponding inotify_init. Use
CHECK_STRING (file_name);
if (inotifyfd == uninitialized)
if (inotifyfd < 0)
{
inotifyfd = inotify_init1 (IN_NONBLOCK|IN_CLOEXEC);
if (inotifyfd == -1)
{
inotifyfd = uninitialized;
xsignal1
(Qfile_notify_error,
build_string ("File watching feature (inotify) is not available"));
}
if (inotifyfd < 0)
xsignal1
(Qfile_notify_error,
build_string ("File watching feature (inotify) is not available"));
watch_list = Qnil;
add_read_fd (inotifyfd, &inotify_callback, NULL);
}
......@@ -392,7 +389,7 @@ See inotify_rm_watch(2) for more information.
{
close (inotifyfd);
delete_read_fd (inotifyfd);
inotifyfd = uninitialized;
inotifyfd = -1;
}
return Qt;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment