File: inotify.c

package info (click to toggle)
systemtap 2.6-0.2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 21,220 kB
  • ctags: 10,944
  • sloc: cpp: 53,239; ansic: 50,615; exp: 33,694; sh: 9,906; xml: 7,665; perl: 2,089; python: 1,534; tcl: 1,236; makefile: 797; java: 148; lisp: 104; awk: 94; asm: 91; sed: 16
file content (53 lines) | stat: -rw-r--r-- 1,600 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* COVERAGE: inotify_init inotify_init1 inotify_add_watch inotify_rm_watch */

#include <sys/inotify.h>

int main()
{
  int fd = inotify_init();
  //staptest// inotify_init () = NNNN

  int wd = inotify_add_watch(fd, "/tmp", IN_ALL_EVENTS);
  //staptest// inotify_add_watch (NNNN, "/tmp", IN_ACCESS|IN_MODIFY|IN_ATTRIB|IN_CLOSE_WRITE|IN_CLOSE_NOWRITE|IN_OPEN|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF) = NNNN
  
  inotify_rm_watch(fd, wd);
  //staptest// inotify_rm_watch (NNNN, NNNN) = 0

#ifdef IN_CLOEXEC
  inotify_init1(IN_NONBLOCK);
  //staptest// inotify_init1 (IN_NONBLOCK) = NNNN

  inotify_init1(IN_CLOEXEC);
  //staptest// inotify_init1 (IN_CLOEXEC) = NNNN

  inotify_init1(IN_NONBLOCK|IN_CLOEXEC);
  //staptest// inotify_init1 (IN_NONBLOCK|IN_CLOEXEC) = NNNN
#endif

  inotify_init1(-1);
  //staptest// inotify_init1 (IN_[^ ]+|XXXX) = -NNNN

  inotify_add_watch(-1, "/tmp", IN_MODIFY);
  //staptest// inotify_add_watch (-1, "/tmp", IN_MODIFY) = -NNNN

  inotify_add_watch(fd, (char *)-1, IN_MODIFY);
#ifdef __s390__
  //staptest// inotify_add_watch (NNNN, [7]?[f]+, IN_MODIFY) = -NNNN (EFAULT)
#else
  //staptest// inotify_add_watch (NNNN, [f]+, IN_MODIFY) = -NNNN (EFAULT)
#endif

  wd = inotify_add_watch(fd, "/tmp", -1);
  //staptest// inotify_add_watch (NNNN, "/tmp", IN_[^ ]+|XXXX) =

  inotify_rm_watch(fd, wd);
  //staptest// inotify_rm_watch (NNNN, NNNN) =

  inotify_rm_watch(-1, wd);
  //staptest// inotify_rm_watch (-1, NNNN) = -NNNN (EBADF)

  inotify_rm_watch(fd, -1);
  //staptest// inotify_rm_watch (NNNN, -1) = -NNNN (EINVAL)

  return 0;
}