From 04e8da5200f5b643b520f1b8acb8976d771d3723 Mon Sep 17 00:00:00 2001 From: dakkar Date: Fri, 19 Oct 2012 17:56:54 +0100 Subject: broken into two files --- lib/Linux/FANotify/LowLevel.pm | 111 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 lib/Linux/FANotify/LowLevel.pm (limited to 'lib/Linux/FANotify/LowLevel.pm') diff --git a/lib/Linux/FANotify/LowLevel.pm b/lib/Linux/FANotify/LowLevel.pm new file mode 100644 index 0000000..90d8568 --- /dev/null +++ b/lib/Linux/FANotify/LowLevel.pm @@ -0,0 +1,111 @@ +package Linux::FANotify::LowLevel; +use 5.014; +use strict; +use warnings; +my $ccode;my @exports; +BEGIN { +my @constants=qw( + FAN_ACCESS + FAN_MODIFY + FAN_CLOSE_WRITE + FAN_CLOSE_NOWRITE + FAN_OPEN + FAN_Q_OVERFLOW + FAN_OPEN_PERM + FAN_ACCESS_PERM + FAN_ONDIR + FAN_EVENT_ON_CHILD + FAN_CLOSE + FAN_CLOEXEC + FAN_NONBLOCK + FAN_CLASS_NOTIF + FAN_CLASS_CONTENT + FAN_CLASS_PRE_CONTENT + FAN_ALL_CLASS_BITS + FAN_UNLIMITED_QUEUE + FAN_UNLIMITED_MARKS + FAN_ALL_INIT_FLAGS + FAN_MARK_ADD + FAN_MARK_REMOVE + FAN_MARK_DONT_FOLLOW + FAN_MARK_ONLYDIR + FAN_MARK_MOUNT + FAN_MARK_IGNORED_MASK + FAN_MARK_IGNORED_SURV_MODIFY + FAN_MARK_FLUSH + FAN_ALL_MARK_FLAGS + FAN_ALL_EVENTS + FAN_ALL_PERM_EVENTS + FAN_ALL_OUTGOING_EVENTS + FANOTIFY_METADATA_VERSION + FAN_ALLOW + FAN_DENY + FAN_NOFD + ); +$ccode=< +#include +#include +EOC +for my $c (@constants) { + my $sub_name = lc($c =~ s{^.*?_}{}r); + $ccode .= "long CONST_${sub_name}() { return $c; }\n"; + push @exports,"CONST_${sub_name}"; +} +$ccode.=<mask),0); + hv_store(event,"fd",2,newSViv(data->fd),0); + hv_store(event,"pid",3,newSViv(data->pid),0); + buffer = FAN_EVENT_NEXT(data,len); + } + + return ret; +} +EOC +} +use Inline C => $ccode; +use Sub::Exporter -setup => { + exports => [ + @exports, + qw(perl_fanotify_init perl_fanotify_mark perl_memalign unpack_events) + ], + groups => { + constants => \@exports, + functions => [qw(perl_fanotify_init perl_fanotify_mark unpack_events)], + }, +}; + +1; -- cgit v1.2.3