ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Linux-Inotify2/Inotify2.xs
(Generate patch)

Comparing Linux-Inotify2/Inotify2.xs (file contents):
Revision 1.3 by root, Mon Dec 19 16:50:27 2005 UTC vs.
Revision 1.7 by root, Sat Jul 7 13:44:51 2018 UTC

5#include "XSUB.h" 5#include "XSUB.h"
6 6
7#include <unistd.h> 7#include <unistd.h>
8#include <fcntl.h> 8#include <fcntl.h>
9 9
10#include "inotify.h" 10#include <sys/inotify.h>
11#include "inotify-syscalls.h"
12 11
13MODULE = Linux::Inotify2 PACKAGE = Linux::Inotify2 12MODULE = Linux::Inotify2 PACKAGE = Linux::Inotify2
14 13
15PROTOTYPES: ENABLE 14PROTOTYPES: ENABLE
16 15
17BOOT: 16BOOT:
18{ 17{
19 HV *stash = gv_stashpv ("Linux::Inotify2", 0); 18 HV *stash = GvSTASH (CvGV (cv));
20 19
21 newCONSTSUB (stash, "IN_ACCESS" , newSViv (IN_ACCESS)); 20 static const struct civ { const char *name; IV iv; } *civ, const_iv[] = {
22 newCONSTSUB (stash, "IN_MODIFY" , newSViv (IN_MODIFY)); 21 { "IN_ACCESS" , IN_ACCESS },
23 newCONSTSUB (stash, "IN_ATTRIB" , newSViv (IN_ATTRIB)); 22 { "IN_MODIFY" , IN_MODIFY },
24 newCONSTSUB (stash, "IN_CLOSE_WRITE" , newSViv (IN_CLOSE_WRITE )); 23 { "IN_ATTRIB" , IN_ATTRIB },
25 newCONSTSUB (stash, "IN_CLOSE_NOWRITE", newSViv (IN_CLOSE_NOWRITE)); 24 { "IN_CLOSE_WRITE" , IN_CLOSE_WRITE },
26 newCONSTSUB (stash, "IN_OPEN" , newSViv (IN_OPEN)); 25 { "IN_CLOSE_NOWRITE", IN_CLOSE_NOWRITE },
27 newCONSTSUB (stash, "IN_MOVED_FROM" , newSViv (IN_MOVED_FROM)); 26 { "IN_OPEN" , IN_OPEN },
28 newCONSTSUB (stash, "IN_MOVED_TO" , newSViv (IN_MOVED_TO)); 27 { "IN_MOVED_FROM" , IN_MOVED_FROM },
29 newCONSTSUB (stash, "IN_CREATE" , newSViv (IN_CREATE)); 28 { "IN_MOVED_TO" , IN_MOVED_TO },
30 newCONSTSUB (stash, "IN_DELETE" , newSViv (IN_DELETE)); 29 { "IN_CREATE" , IN_CREATE },
31 newCONSTSUB (stash, "IN_DELETE_SELF" , newSViv (IN_DELETE_SELF)); 30 { "IN_DELETE" , IN_DELETE },
32 newCONSTSUB (stash, "IN_MOVE_SELF" , newSViv (IN_MOVE_SELF)); 31 { "IN_DELETE_SELF" , IN_DELETE_SELF },
33 newCONSTSUB (stash, "IN_UNMOUNT" , newSViv (IN_UNMOUNT)); 32 { "IN_MOVE_SELF" , IN_MOVE_SELF },
34 newCONSTSUB (stash, "IN_Q_OVERFLOW" , newSViv (IN_Q_OVERFLOW)); 33 { "IN_UNMOUNT" , IN_UNMOUNT },
35 newCONSTSUB (stash, "IN_IGNORED" , newSViv (IN_IGNORED)); 34 { "IN_Q_OVERFLOW" , IN_Q_OVERFLOW },
36 newCONSTSUB (stash, "IN_CLOSE" , newSViv (IN_CLOSE)); 35 { "IN_IGNORED" , IN_IGNORED },
37 newCONSTSUB (stash, "IN_MOVE" , newSViv (IN_MOVE)); 36 { "IN_CLOSE" , IN_CLOSE },
38 newCONSTSUB (stash, "IN_ISDIR" , newSViv (IN_ISDIR)); 37 { "IN_MOVE" , IN_MOVE },
39 newCONSTSUB (stash, "IN_ONESHOT" , newSViv (IN_ONESHOT)); 38 { "IN_ONLYDIR" , IN_ONLYDIR },
40 newCONSTSUB (stash, "IN_ALL_EVENTS" , newSViv (IN_ALL_EVENTS)); 39 { "IN_DONT_FOLLOW" , IN_DONT_FOLLOW },
40 { "IN_MASK_ADD" , IN_MASK_ADD },
41 { "IN_ISDIR" , IN_ISDIR },
42 { "IN_ONESHOT" , IN_ONESHOT },
43 { "IN_ALL_EVENTS" , IN_ALL_EVENTS },
44 };
45
46 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--)
47 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv));
41} 48}
42 49
43int 50int
44inotify_init () 51inotify_init ()
45 52
54int 61int
55inotify_rm_watch (int fd, U32 wd) 62inotify_rm_watch (int fd, U32 wd)
56 63
57int 64int
58inotify_blocking (int fd, I32 blocking) 65inotify_blocking (int fd, I32 blocking)
59 CODE: 66 CODE:
60 fcntl (fd, F_SETFL, blocking ? 0 : O_NONBLOCK); 67 fcntl (fd, F_SETFL, blocking ? 0 : O_NONBLOCK);
61 68
62void 69void
63inotify_read (int fd, int size = 8192) 70inotify_read (int fd, int size = 8192)
64 PPCODE: 71 PPCODE:
91 98
92 XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); 99 XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv)));
93 } 100 }
94} 101}
95 102
96

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines