Plan 9 from Bell Labs’s /usr/web/sources/contrib/maht/limbo/inotify.m

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.



Inotify : module {
	Watcher : adt {
		path : string;
		ctl : ref Iobuf;
		events : chan of ref Event;
		watch : fn(w : self ref Watcher, log : chan of string);
		kill : fn(w : self ref Watcher);
	};
	Event : adt {
		filename : string;
		mask : big;
		target : string;
		matches : fn(e : self ref Event, m : big) : int;
	};
	new_watcher :fn(path : string, log : chan of string) : ref Watcher;
# taken from inotify.h
ACCESS : con big 16r00000001; # File was accessed 
MODIFY : con big 16r00000002;	# File was modified 
ATTRIB : con big 16r00000004;	# Metadata changed 
CLOSE_WRITE : con big 16r00000008;	# Writable file was closed 
CLOSE_NOWRITE : con big 16r00000010;	# Unwritable file closed 
OPEN : con big 16r00000020;	# File was opened 
MOVED_FROM : con big 16r00000040;	# File was moved from X 
MOVED_TO : con big 16r00000080;	# File was moved to Y 
CREATE : con big 16r00000100;	# Subfile was created 
DELETE : con big 16r00000200;	# Subfile was deleted 
DELETE_SELF : con big 16r00000400;	# Self was deleted 
MOVE_SELF : con big 16r00000800;	# Self was moved 

# the following are legal events.  they are sent as needed to any watch 
UNMOUNT : con big 16r00002000;	# Backing fs was unmounted 
Q_OVERFLOW : con big 16r00004000;	# Event queued overflowed 
IGNORED : con big 16r00008000;	# File was ignored 

# special flags 
ONLYDIR : con big 16r01000000;	# only watch the path if it is a directory 
DONT_FOLLOW : con big 16r02000000;	# don't follow a sym link 
MASK_ADD : con big 16r20000000;	# add to the mask of an already existing watch 
ISDIR : con big 16r40000000;	# event occurred against dir 
ONESHOT : con big 16r80000000;	# only send event once 
};



Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].