X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=miscutils%2Finotifyd.c;h=0060797edec5c1a4c003c043c792be8ee9e1cce9;hb=73af705628ddaedc4c6f7f78b9658d6c01310309;hp=908d657fd2f01b11163e77154971beda81c5dcfb;hpb=7849ccb61c376e4704ce1c3e5a0d12fd7d743200;p=oweals%2Fbusybox.git diff --git a/miscutils/inotifyd.c b/miscutils/inotifyd.c index 908d657fd..0060797ed 100644 --- a/miscutils/inotifyd.c +++ b/miscutils/inotifyd.c @@ -12,7 +12,7 @@ * Use as follows: * # inotifyd /user/space/agent dir/or/file/being/watched[:mask] ... * - * When a filesystem event matching the specified mask is occured on specified file (or directory) + * When a filesystem event matching the specified mask is occurred on specified file (or directory) * a userspace agent is spawned and given the following parameters: * $1. actual event(s) * $2. file (or directory) name @@ -26,6 +26,16 @@ * * See below for mask names explanation. */ +//config:config INOTIFYD +//config: bool "inotifyd (3.5 kb)" +//config: default n # doesn't build on Knoppix 5 +//config: help +//config: Simple inotify daemon. Reports filesystem changes. Requires +//config: kernel >= 2.6.13 + +//applet:IF_INOTIFYD(APPLET(inotifyd, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_INOTIFYD) += inotifyd.o //usage:#define inotifyd_trivial_usage //usage: "PROG FILE1[:MASK]..." @@ -56,6 +66,7 @@ //usage: "\nWhen x event happens for all FILEs, inotifyd exits." #include "libbb.h" +#include "common_bufsiz.h" #include static const char mask_names[] ALIGN1 = @@ -161,9 +172,10 @@ int inotifyd_main(int argc, char **argv) // read out all pending events // (NB: len must be int, not ssize_t or long!) - xioctl(pfd.fd, FIONREAD, &len); #define eventbuf bb_common_bufsiz1 - ie = buf = (len <= sizeof(eventbuf)) ? eventbuf : xmalloc(len); + setup_common_bufsiz(); + xioctl(pfd.fd, FIONREAD, &len); + ie = buf = (len <= COMMON_BUFSIZE) ? eventbuf : xmalloc(len); len = full_read(pfd.fd, buf, len); // process events. N.B. events may vary in length while (len > 0) {