Server IP : 103.119.228.120 / Your IP : 13.59.73.248 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/local/ssl/local/ssl/local/share/man/man3/ |
Upload File : |
.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Inotify2 3" .TH Inotify2 3 "2011-06-14" "perl v5.16.3" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Linux::Inotify2 \- scalable directory/file change notification .SH "SYNOPSIS" .IX Header "SYNOPSIS" .SS "Callback Interface" .IX Subsection "Callback Interface" .Vb 1 \& use Linux::Inotify2; \& \& # create a new object \& my $inotify = new Linux::Inotify2 \& or die "unable to create new inotify object: $!"; \& \& # add watchers \& $inotify\->watch ("/etc/passwd", IN_ACCESS, sub { \& my $e = shift; \& my $name = $e\->fullname; \& print "$name was accessed\en" if $e\->IN_ACCESS; \& print "$name is no longer mounted\en" if $e\->IN_UNMOUNT; \& print "$name is gone\en" if $e\->IN_IGNORED; \& print "events for $name have been lost\en" if $e\->IN_Q_OVERFLOW; \& \& # cancel this watcher: remove no further events \& $e\->w\->cancel; \& }); \& \& # integration into AnyEvent (works with EV, Glib, Tk, POE...) \& my $inotify_w = AnyEvent\->io ( \& fh => $inofity\->fileno, poll => \*(Aqr\*(Aq, cb => sub { $inotify\->poll } \& ); \& \& # manual event loop \& 1 while $inotify\->poll; .Ve .SS "Streaming Interface" .IX Subsection "Streaming Interface" .Vb 1 \& use Linux::Inotify2 ; \& \& # create a new object \& my $inotify = new Linux::Inotify2 \& or die "Unable to create new inotify object: $!" ; \& \& # create watch \& $inotify\->watch ("/etc/passwd", IN_ACCESS) \& or die "watch creation failed" ; \& \& while () { \& my @events = $inotify\->read; \& unless (@events > 0) { \& print "read error: $!"; \& last ; \& } \& printf "mask\et%d\en", $_\->mask foreach @events ; \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module implements an interface to the Linux 2.6.13 and later Inotify file/directory change notification system. .PP It has a number of advantages over the Linux::Inotify module: .PP .Vb 5 \& \- it is portable (Linux::Inotify only works on x86) \& \- the equivalent of fullname works correctly \& \- it is better documented \& \- it has callback\-style interface, which is better suited for \& integration. .Ve .SS "The Linux::Inotify2 Class" .IX Subsection "The Linux::Inotify2 Class" .ie n .IP "my $inotify = new Linux::Inotify2" 4 .el .IP "my \f(CW$inotify\fR = new Linux::Inotify2" 4 .IX Item "my $inotify = new Linux::Inotify2" Create a new notify object and return it. A notify object is kind of a container that stores watches on file system names and is responsible for handling event data. .Sp On error, \f(CW\*(C`undef\*(C'\fR is returned and \f(CW$!\fR will be set accordingly. The following errors are documented: .Sp .Vb 3 \& ENFILE The system limit on the total number of file descriptors has been reached. \& EMFILE The user limit on the total number of inotify instances has been reached. \& ENOMEM Insufficient kernel memory is available. .Ve .Sp Example: .Sp .Vb 2 \& my $inotify = new Linux::Inotify2 \& or die "Unable to create new inotify object: $!"; .Ve .ie n .IP "$watch = $inotify\->watch ($name, $mask[, $cb])" 4 .el .IP "\f(CW$watch\fR = \f(CW$inotify\fR\->watch ($name, \f(CW$mask\fR[, \f(CW$cb\fR])" 4 .IX Item "$watch = $inotify->watch ($name, $mask[, $cb])" Add a new watcher to the given notifier. The watcher will create events on the pathname \f(CW$name\fR as given in \f(CW$mask\fR, which can be any of the following constants (all exported by default) ORed together. .Sp \&\*(L"file\*(R" refers to any file system object in the watched object (always a directory), that is files, directories, symlinks, device nodes etc., while \&\*(L"object\*(R" refers to the object the watcher has been set on itself: .Sp .Vb 10 \& IN_ACCESS object was accessed \& IN_MODIFY object was modified \& IN_ATTRIB object metadata changed \& IN_CLOSE_WRITE writable fd to file / to object was closed \& IN_CLOSE_NOWRITE readonly fd to file / to object closed \& IN_OPEN object was opened \& IN_MOVED_FROM file was moved from this object (directory) \& IN_MOVED_TO file was moved to this object (directory) \& IN_CREATE file was created in this object (directory) \& IN_DELETE file was deleted from this object (directory) \& IN_DELETE_SELF object itself was deleted \& IN_MOVE_SELF object itself was moved \& IN_ALL_EVENTS all of the above events \& \& IN_ONESHOT only send event once \& IN_ONLYDIR only watch the path if it is a directory \& IN_DONT_FOLLOW don\*(Aqt follow a sym link \& IN_MASK_ADD not supported with the current version of this module \& \& IN_CLOSE same as IN_CLOSE_WRITE | IN_CLOSE_NOWRITE \& IN_MOVE same as IN_MOVED_FROM | IN_MOVED_TO .Ve .Sp \&\f(CW$cb\fR is a perl code reference that, if given, is called for each event. It receives a \f(CW\*(C`Linux::Inotify2::Event\*(C'\fR object. .Sp The returned \f(CW$watch\fR object is of class \f(CW\*(C`Linux::Inotify2::Watch\*(C'\fR. .Sp On error, \f(CW\*(C`undef\*(C'\fR is returned and \f(CW$!\fR will be set accordingly. The following errors are documented: .Sp .Vb 5 \& EBADF The given file descriptor is not valid. \& EINVAL The given event mask contains no legal events. \& ENOMEM Insufficient kernel memory was available. \& ENOSPC The user limit on the total number of inotify watches was reached or the kernel failed to allocate a needed resource. \& EACCESS Read access to the given file is not permitted. .Ve .Sp Example, show when \f(CW\*(C`/etc/passwd\*(C'\fR gets accessed and/or modified once: .Sp .Vb 6 \& $inotify\->watch ("/etc/passwd", IN_ACCESS | IN_MODIFY, sub { \& my $e = shift; \& print "$e\->{w}{name} was accessed\en" if $e\->IN_ACCESS; \& print "$e\->{w}{name} was modified\en" if $e\->IN_MODIFY; \& print "$e\->{w}{name} is no longer mounted\en" if $e\->IN_UNMOUNT; \& print "events for $e\->{w}{name} have been lost\en" if $e\->IN_Q_OVERFLOW; \& \& $e\->w\->cancel; \& }); .Ve .ie n .IP "$inotify\->fileno" 4 .el .IP "\f(CW$inotify\fR\->fileno" 4 .IX Item "$inotify->fileno" Returns the file descriptor for this notify object. When in non-blocking mode, you are responsible for calling the \f(CW\*(C`poll\*(C'\fR method when this file descriptor becomes ready for reading. .ie n .IP "$inotify\->blocking ($blocking)" 4 .el .IP "\f(CW$inotify\fR\->blocking ($blocking)" 4 .IX Item "$inotify->blocking ($blocking)" Clears ($blocking true) or sets ($blocking false) the \f(CW\*(C`O_NONBLOCK\*(C'\fR flag on the file descriptor. .ie n .IP "$count = $inotify\->poll" 4 .el .IP "\f(CW$count\fR = \f(CW$inotify\fR\->poll" 4 .IX Item "$count = $inotify->poll" Reads events from the kernel and handles them. If the notify file descriptor is blocking (the default), then this method waits for at least one event (and thus returns true unless an error occurs). Otherwise it returns immediately when no pending events could be read. .Sp Returns the count of events that have been handled. .ie n .IP "@events = $inotify\->read" 4 .el .IP "\f(CW@events\fR = \f(CW$inotify\fR\->read" 4 .IX Item "@events = $inotify->read" Reads events from the kernel. Blocks when the file descriptor is in blocking mode (default) until any event arrives. Returns list of \&\f(CW\*(C`Linux::Inotify2::Event\*(C'\fR objects or empty list if none (non-blocking mode) or error occurred ($! should be checked). .Sp Normally you shouldn't use this function, but instead use watcher callbacks and call \f(CW\*(C`\->poll\*(C'\fR. .SS "The Linux::Inotify2::Event Class" .IX Subsection "The Linux::Inotify2::Event Class" Objects of this class are handed as first argument to the watcher callback. It has the following members and methods: .ie n .IP "$event\->w" 4 .el .IP "\f(CW$event\fR\->w" 4 .IX Item "$event->w" .PD 0 .ie n .IP "$event\->{w}" 4 .el .IP "\f(CW$event\fR\->{w}" 4 .IX Item "$event->{w}" .PD The watcher object for this event. .ie n .IP "$event\->name" 4 .el .IP "\f(CW$event\fR\->name" 4 .IX Item "$event->name" .PD 0 .ie n .IP "$event\->{name}" 4 .el .IP "\f(CW$event\fR\->{name}" 4 .IX Item "$event->{name}" .PD The path of the file system object, relative to the watched name. .ie n .IP "$event\->fullname" 4 .el .IP "\f(CW$event\fR\->fullname" 4 .IX Item "$event->fullname" Returns the \*(L"full\*(R" name of the relevant object, i.e. including the \f(CW\*(C`name\*(C'\fR member of the watcher (if the watch object is on a directory and a directory entry is affected), or simply the \f(CW\*(C`name\*(C'\fR member itself when the object is the watch object itself. .ie n .IP "$event\->mask" 4 .el .IP "\f(CW$event\fR\->mask" 4 .IX Item "$event->mask" .PD 0 .ie n .IP "$event\->{mask}" 4 .el .IP "\f(CW$event\fR\->{mask}" 4 .IX Item "$event->{mask}" .PD The received event mask. In addition to the events described for \f(CW\*(C`$inotify\->watch\*(C'\fR, the following flags (exported by default) can be set: .Sp .Vb 2 \& IN_ISDIR event object is a directory \& IN_Q_OVERFLOW event queue overflowed \& \& # when any of the following flags are set, \& # then watchers for this event are automatically canceled \& IN_UNMOUNT filesystem for watched object was unmounted \& IN_IGNORED file was ignored/is gone (no more events are delivered) \& IN_ONESHOT only one event was generated .Ve .ie n .IP "$event\->IN_xxx" 4 .el .IP "\f(CW$event\fR\->IN_xxx" 4 .IX Item "$event->IN_xxx" Returns a boolean that returns true if the event mask contains any events specified by the mask. All of the \f(CW\*(C`IN_xxx\*(C'\fR constants can be used as methods. .ie n .IP "$event\->cookie" 4 .el .IP "\f(CW$event\fR\->cookie" 4 .IX Item "$event->cookie" .PD 0 .ie n .IP "$event\->{cookie}" 4 .el .IP "\f(CW$event\fR\->{cookie}" 4 .IX Item "$event->{cookie}" .PD The event cookie to \*(L"synchronize two events\*(R". Normally zero, this value is set when two events relating to the same file are generated. As far as I know, this only happens for \f(CW\*(C`IN_MOVED_FROM\*(C'\fR and \f(CW\*(C`IN_MOVED_TO\*(C'\fR events, to identify the old and new name of a file. .SS "The Linux::Inotify2::Watch Class" .IX Subsection "The Linux::Inotify2::Watch Class" Watcher objects are created by calling the \f(CW\*(C`watch\*(C'\fR method of a notifier. .PP It has the following members and methods: .ie n .IP "$watch\->name" 4 .el .IP "\f(CW$watch\fR\->name" 4 .IX Item "$watch->name" .PD 0 .ie n .IP "$watch\->{name}" 4 .el .IP "\f(CW$watch\fR\->{name}" 4 .IX Item "$watch->{name}" .PD The name as specified in the \f(CW\*(C`watch\*(C'\fR call. For the object itself, this is the empty string. For directory watches, this is the name of the entry without leading path elements. .ie n .IP "$watch\->mask" 4 .el .IP "\f(CW$watch\fR\->mask" 4 .IX Item "$watch->mask" .PD 0 .ie n .IP "$watch\->{mask}" 4 .el .IP "\f(CW$watch\fR\->{mask}" 4 .IX Item "$watch->{mask}" .PD The mask as specified in the \f(CW\*(C`watch\*(C'\fR call. .ie n .IP "$watch\->cb ([new callback])" 4 .el .IP "\f(CW$watch\fR\->cb ([new callback])" 4 .IX Item "$watch->cb ([new callback])" .PD 0 .ie n .IP "$watch\->{cb}" 4 .el .IP "\f(CW$watch\fR\->{cb}" 4 .IX Item "$watch->{cb}" .PD The callback as specified in the \f(CW\*(C`watch\*(C'\fR call. Can optionally be changed. .ie n .IP "$watch\->cancel" 4 .el .IP "\f(CW$watch\fR\->cancel" 4 .IX Item "$watch->cancel" Cancels/removes this watcher. Future events, even if already queued queued, will not be handled and resources will be freed. .SH "SEE ALSO" .IX Header "SEE ALSO" AnyEvent, Linux::Inotify. .SH "AUTHOR" .IX Header "AUTHOR" .Vb 2 \& Marc Lehmann <schmorp@schmorp.de> \& http://home.schmorp.de/ .Ve