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