]> gitweb.factorcode.org Git - factor.git/blob - basis/unix/linux/inotify/inotify.factor
use radix literals
[factor.git] / basis / unix / linux / inotify / inotify.factor
1 ! Copyright (C) 2008 Slava Pestov.\r
2 ! See http://factorcode.org/license.txt for BSD license.\r
3 USING: alien.c-types alien.syntax math math.bitwise classes.struct\r
4 literals ;\r
5 IN: unix.linux.inotify\r
6 \r
7 STRUCT: inotify-event\r
8     { wd int }\r
9     { mask uint }\r
10     { cookie uint }\r
11     { len uint }\r
12     { name char[0] } ;\r
13 \r
14 CONSTANT: IN_ACCESS 0x1         ! File was accessed\r
15 CONSTANT: IN_MODIFY 0x2         ! File was modified\r
16 CONSTANT: IN_ATTRIB 0x4         ! Metadata changed\r
17 CONSTANT: IN_CLOSE_WRITE 0x8    ! Writtable file was closed\r
18 CONSTANT: IN_CLOSE_NOWRITE 0x10 ! Unwrittable file closed\r
19 CONSTANT: IN_OPEN 0x20          ! File was opened\r
20 CONSTANT: IN_MOVED_FROM 0x40    ! File was moved from X\r
21 CONSTANT: IN_MOVED_TO 0x80      ! File was moved to Y\r
22 CONSTANT: IN_CREATE 0x100       ! Subfile was created\r
23 CONSTANT: IN_DELETE 0x200       ! Subfile was deleted\r
24 CONSTANT: IN_DELETE_SELF 0x400  ! Self was deleted\r
25 CONSTANT: IN_MOVE_SELF 0x800    ! Self was moved\r
26 \r
27 CONSTANT: IN_UNMOUNT 0x2000     ! Backing fs was unmounted\r
28 CONSTANT: IN_Q_OVERFLOW 0x4000  ! Event queued overflowed\r
29 CONSTANT: IN_IGNORED 0x8000     ! File was ignored\r
30 \r
31 CONSTANT: IN_CLOSE flags{ IN_CLOSE_WRITE IN_CLOSE_NOWRITE }\r
32 CONSTANT: IN_MOVE flags{ IN_MOVED_FROM IN_MOVED_TO }\r
33 \r
34 CONSTANT: IN_ONLYDIR 0x1000000     ! only watch the path if it is a directory\r
35 CONSTANT: IN_DONT_FOLLOW 0x2000000 ! don't follow a sym link\r
36 CONSTANT: IN_MASK_ADD 0x20000000   ! add to the mask of an already existing watch\r
37 CONSTANT: IN_ISDIR 0x40000000      ! event occurred against dir\r
38 CONSTANT: IN_ONESHOT 0x80000000    ! only send event once\r
39 \r
40 CONSTANT: IN_CHANGE_EVENTS \r
41     flags{\r
42         IN_MODIFY IN_ATTRIB IN_MOVED_FROM\r
43         IN_MOVED_TO IN_DELETE IN_CREATE IN_DELETE_SELF\r
44         IN_MOVE_SELF\r
45     }\r
46 \r
47 CONSTANT: IN_ALL_EVENTS\r
48     flags{\r
49         IN_ACCESS IN_MODIFY IN_ATTRIB IN_CLOSE_WRITE\r
50         IN_CLOSE_NOWRITE IN_OPEN IN_MOVED_FROM\r
51         IN_MOVED_TO IN_DELETE IN_CREATE IN_DELETE_SELF\r
52         IN_MOVE_SELF\r
53     }\r
54 \r
55 FUNCTION: int inotify_init ( ) ;\r
56 FUNCTION: int inotify_add_watch ( int fd, c-string name, uint mask  ) ;\r
57 FUNCTION: int inotify_rm_watch ( int fd, uint wd ) ;\r