Sourceware Bugzilla – Attachment 6770 Details for
Bug 14906
inotify failed when /etc/hosts file change
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
The test program
bug-779531_inotify-try.c (text/x-csrc), 844 bytes, created by
Bin Li
on 2012-12-03 10:36:26 UTC
(
hide
)
Description:
The test program
Filename:
MIME Type:
Creator:
Bin Li
Created:
2012-12-03 10:36:26 UTC
Size:
844 bytes
patch
obsolete
>#include <sys/inotify.h> >#include <stdlib.h> >#include <stdio.h> >#include <unistd.h> >#include <errno.h> > >void bark (const char *s) >{ > perror (s); > exit (1); >} > >int main () >{ > int fd; > int watch; > struct inotify_event buf; > ssize_t len; > fd = inotify_init (); > if (fd < 0) > bark ("inotify_init"); > watch = inotify_add_watch (fd, "/etc/hosts", IN_DELETE_SELF | IN_MODIFY /* | IN_MOVE */); > if (watch < 0) > bark ("inotify_add_watch"); > printf ("Added watch on /etc/hosts, as watch %d\n", watch); > while ((len = read (fd, &buf, sizeof buf)) > 0) > { > char c; > while (len != sizeof buf) > len += read (fd, ((char *)&buf) + len, sizeof buf - len); > while (buf.len--) > read (fd, &c, 1); > printf ("got event: watch %d, mask %x, cookie %d\n", > buf.wd, buf.mask, buf.cookie); > } > close (fd); > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 14906
: 6770 |
6771
|
8137