Fanotify.xs

filter: Statementstmt 1.5% 3 / 190 Branchbran 0.6% 1 / 152 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 1.1% 4 / 342 SCAR 0
CC
0
Cov
0%
CRAP 0
« blib/lib/Linux/Fanotify.pm ↑ Summary const-c.inc »
1 /*
2 * Copyright (C) 2014 Bastian Friedrich
3 * <bastian.friedrich@collax.com> / <bastian@friedrich.link>
4 */
5 #include "EXTERN.h"
6 #include "perl.h"
7 #include "XSUB.h"
8 #include <pwd.h>
9 #include <unistd.h>
10 #include <sys/fanotify.h>
11  
12 #include "const-c.inc"
13  
14 /*
15 *******************************************************************************
16 * Code documentation for perl methods and functions can be found in the
17 * module's pod
18 *******************************************************************************
19 */
20  
21 #define PERLCLASS_NOTGRP "Linux::Fanotify::FanotifyGroup"
22 #define PERLCLASS_EVENT "Linux::Fanotify::Event"
23  
24 /*
25 * We don't want to expose functionality to write one event's fd to a
26 * notification group where it did not originate. fanotify_bundle
27 * is the event metadata, plus its originating notification group
28 */
29  
30 struct fanotify_bundle {
31 struct fanotify_event_metadata metadata;
32 int fd; /* Notification group fd */
33 unsigned short int needs_response;
34 };
35  
36 /*
37 * Convert a perl SV for a notification group to a file descriptor
38 */
39 int
40 0 notgrp2fd(SV *notgrp, int *dst) {
41 SV *sv;
42  
43 0 ▶ if (!SvROK(notgrp)) {
Branch: 1 branch
BranchTrueFalseTotal
if (!SvROK(notgrp)) { 0 0 0
44 /* No RV */
45 0 return 0;
46 }
47 0 ▶ if (!sv_isobject(notgrp) || !sv_isa(notgrp, PERLCLASS_NOTGRP)) {
Branch: 2 branches
BranchTrueFalseTotal
if (!sv_isobject(notgrp) || !sv_isa(notgrp, PERLCLASS_NOTGRP)) { 0 0 0
if (!sv_isobject(notgrp) || !sv_isa(notgrp, PERLCLASS_NOTGRP)) { 0 0 0
48 /* No notification group obj */
49 0 return 0;
50 }
51  
52 0 sv = SvRV(notgrp);
53  
54 0 ▶ if (!SvIOK(sv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (!SvIOK(sv)) { 0 0 0
55 /* No int */
56 0 return 0;
57 }
58  
59 0 *dst = SvIV(sv);
60  
61 0 return 1;
62 }
63  
64 /*
65 * Convert a perl SV for a fanotify_bundle (metadata plus fanotify group fd) to
66 * a fanotify_bundle structure
67 */
68 struct fanotify_bundle *
69 0 event2bundle(SV *event) {
70 SV *deref;
71  
72 0 ▶ if (!SvROK(event)) {
Branch: 1 branch
BranchTrueFalseTotal
if (!SvROK(event)) { 0 0 0
73 /* No RV */
74 0 return NULL;
75 }
76 0 ▶ if (!sv_isobject(event) || !sv_isa(event, PERLCLASS_EVENT)) {
Branch: 2 branches
BranchTrueFalseTotal
if (!sv_isobject(event) || !sv_isa(event, PERLCLASS_EVENT)) { 0 0 0
if (!sv_isobject(event) || !sv_isa(event, PERLCLASS_EVENT)) { 0 0 0
77 /* No notification group obj */
78 0 return NULL;
79 }
80  
81 0 deref = SvRV(event);
82  
83 0 ▶ if (!deref) {
Branch: 1 branch
BranchTrueFalseTotal
if (!deref) { 0 0 0
84 0 return NULL;
85 }
86  
87 0 return (struct fanotify_bundle *)SvPV_nolen(deref);
88  
89 }
90  
91 /*
92 * Convert a notification event bundle to a string.
93 * Intended for debugging purposes only.
94 */
95 char *
96 0 event2str(const struct fanotify_bundle *bundle, char *buf, int len) {
97  
98 0 const struct fanotify_event_metadata *event = &(bundle->metadata);
99  
100 0 char *fmt = "event at %p is: event_len = %d, vers = %d, reserved = %d, meta_len = %d, mask = %lld, fd = %d, pid = %d (fanotify group fd %d)";
101  
102 0 if (snprintf(buf, len, fmt,
103 0 ▶ event, event->event_len, event->vers, event->reserved, event->metadata_len, event->mask, event->fd, event->pid, bundle->fd) >= len) {
Branch: 1 branch
BranchTrueFalseTotal
event, event->event_len, event->vers, event->reserved, event->metadata_len, event->mask, event->fd, event->pid, bundle->fd) >= len) { 0 0 0
104 0 buf[len-1] = 0;
105 }
106  
107 0 return buf;
108 }
109  
110 /*
111 * Print an event's contents on the screen
112 */
113 void
114 0 dumpEvent(const struct fanotify_bundle *bundle) {
115 char buf[256];
116  
117 0 event2str(bundle, buf, sizeof(buf));
118 0 printf("%s\n", buf);
119 0 }
120  
121 int
122 0 _event_write_response(SV *event, int response) {
123 struct fanotify_bundle *bundle;
124 struct fanotify_response rsp;
125 int fd;
126 int ret;
127  
128 0 ▶ if (!(bundle = event2bundle(event))) {
Branch: 1 branch
BranchTrueFalseTotal
if (!(bundle = event2bundle(event))) { 0 0 0
129 0 Perl_croak(aTHX_ "Invalid event object");
130 }
131  
132 0 ▶ if (!bundle->needs_response) {
Branch: 1 branch
BranchTrueFalseTotal
if (!bundle->needs_response) { 0 0 0
133 0 Perl_croak(aTHX_ "Event already responded to or non-respondable event");
134 }
135  
136 /* only ALLOW and DENY are available/sensible responses */
137 0 ▶ if ((response != FAN_ALLOW) && (response != FAN_DENY)) {
Branch: 2 branches
BranchTrueFalseTotal
if ((response != FAN_ALLOW) && (response != FAN_DENY)) { 0 0 0
if ((response != FAN_ALLOW) && (response != FAN_DENY)) { 0 0 0
138 0 Perl_croak(aTHX_ "Response is neither FAN_ALLOW nor FAN_DENY; refusing to write invalid response");
139 }
140  
141 0 fd = bundle->fd;
142  
143 0 rsp.fd = bundle->metadata.fd;
144 0 rsp.response = response;
145  
146 0 ret = write(fd, &rsp, sizeof(struct fanotify_response));
147  
148 0 ▶ if (ret >= 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (ret >= 0) { 0 0 0
149 0 bundle->needs_response = 0;
150 }
151  
152 0 return ret;
153 }
154  
155 int
156 0 _event_close(SV *self) {
157 struct fanotify_bundle *bundle;
158 int ret;
159 SV *sv_default_response;
160 0 int default_response = FAN_DENY;
161  
162 0 ▶ if (!(bundle = event2bundle(self))) {
Branch: 1 branch
BranchTrueFalseTotal
if (!(bundle = event2bundle(self))) { 0 0 0
163 0 Perl_croak(aTHX_ "Invalid event object");
164 }
165  
166 0 ▶ if ((sv_default_response = get_sv("Linux::Fanotify::default_response", 0))) {
Branch: 1 branch
BranchTrueFalseTotal
if ((sv_default_response = get_sv("Linux::Fanotify::default_response", 0))) { 0 0 0
167 0 default_response = SvIV(sv_default_response);
168 0 ▶ if (default_response == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if (default_response == -1) { 0 0 0
169 0 default_response = FAN_DENY;
170 }
171 }
172  
173 0 ▶ if (bundle->needs_response) {
Branch: 1 branch
BranchTrueFalseTotal
if (bundle->needs_response) { 0 0 0
174 0 ▶ if (default_response) {
Branch: 1 branch
BranchTrueFalseTotal
if (default_response) { 0 0 0
175 0 _event_write_response(self, default_response);
176 }
177 }
178  
179 0 ▶ if (bundle->metadata.fd > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (bundle->metadata.fd > 0) { 0 0 0
180 0 ret = close(bundle->metadata.fd);
181 0 ▶ if (ret == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (ret == 0) { 0 0 0
182 0 bundle->metadata.fd = -1;
183 }
184 } else {
185 0 errno = EBADF;
186 0 ret = -1;
187 }
188 0 return ret;
189 }
190  
191 /*
192 *******************************************************************************
193 * Main package: Linux::Fanotify
194 */
195 MODULE = Linux::Fanotify PACKAGE = Linux::Fanotify
196 PROTOTYPES: ENABLE
197  
198 INCLUDE: const-xs.inc
199  
200 #
201 #
202 #
203 SV *
204 fanotify_init(flags, event_f_flags)
205 unsigned int flags
206 unsigned int event_f_flags
207 INIT:
208 int fd;
209 SV *notgrp;
210 CODE:
211 3 fd = fanotify_init(flags, event_f_flags);
212  
213 3 ▶ if (fd == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if (fd == -1) { 3 0 3
214 3 XSRETURN_UNDEF;
215 }
216  
217 0 notgrp = newSV(0);
218  
219 0 sv_setref_iv(notgrp, PERLCLASS_NOTGRP, fd);
220  
221 0 SvREADONLY_on(SvRV(notgrp));
222  
223 0 RETVAL = notgrp;
224 OUTPUT:
225 RETVAL
226  
227 #
228 #
229 #
230 int
231 fanotify_mark(notgrp, flags, mask = 0, dirfd = 0, pathname = NULL)
232 SV *notgrp
233 unsigned int flags
234 uint64_t mask
235 int dirfd
236 const char *pathname
237 INIT:
238 int ret;
239 0 int fd = -1;
240 CODE:
241 0 ▶ if (!notgrp2fd(notgrp, &fd)) {
Branch: 1 branch
BranchTrueFalseTotal
if (!notgrp2fd(notgrp, &fd)) { 0 0 0
242 0 Perl_croak(aTHX_ "Invalid fanotify_fd");
243 } else {
244 0 ret = fanotify_mark(fd, flags, mask, dirfd, pathname);
245  
246 0 ▶ if (ret == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if (ret == -1) { 0 0 0
247 0 XSRETURN_UNDEF;
248 }
249 }
250 0 ▶ RETVAL = 1;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = 1; 0 0 0
251 OUTPUT:
252 RETVAL
253  
254 #
255 #
256 #
257 void
258 fanotify_read(notgrp, max = 0)
259 SV *notgrp
260 int max
261 INIT:
262 struct fanotify_event_metadata *buf;
263 const struct fanotify_event_metadata *metadata;
264 struct fanotify_bundle *bundle;
265 ssize_t len;
266 int size;
267 int fd;
268 SV *event;
269 SV *eventref;
270 PPCODE:
271 /*
272 * Check arguments and allocate read buffer
273 */
274 0 ▶ if (max < 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (max < 1) { 0 0 0
275 0 max = 170; // Results in a buffer slightly smaller than 4k
276 }
277 0 ▶ if (max > 4096) { // 4096 results in an almost 100k buffer. Don't allow more.
Branch: 1 branch
BranchTrueFalseTotal
if (max > 4096) { // 4096 results in an almost 100k buffer. Don't allow more. 0 0 0
278 0 Perl_croak(aTHX_ "Maximum buffer size exceeded (max = 4096)");
279 }
280 0 ▶ if (!notgrp2fd(notgrp, &fd)) {
Branch: 1 branch
BranchTrueFalseTotal
if (!notgrp2fd(notgrp, &fd)) { 0 0 0
281 0 Perl_croak(aTHX_ "Invalid notification group object");
282 }
283  
284 0 size = max * sizeof(struct fanotify_event_metadata);
285 0 buf = (struct fanotify_event_metadata *)malloc(size + (sizeof(struct fanotify_bundle) - sizeof(struct fanotify_event_metadata)));
286  
287 0 ▶ if (!buf) {
Branch: 1 branch
BranchTrueFalseTotal
if (!buf) { 0 0 0
288 0 Perl_croak(aTHX_ "Could not allocate memory");
289 }
290  
291 /*
292 * Read from fanotify queue
293 */
294  
295  
296 0 len = read(fd, (void *)buf, size);
297  
298 0 ▶ if (len == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if (len == -1) { 0 0 0
299 /* Read error. errno is already set, we simply return an empty list and expect the user to check errno */
300 0 free(buf);
301 0 XSRETURN_EMPTY;
302 }
303  
304 // printf("Number of event structures: %d\n",
305 // len/sizeof(struct fanotify_event_metadata));
306  
307 0 metadata = buf;
308  
309 0 ▶ while (FAN_EVENT_OK(metadata, len)) {
Branch: 3 branches
BranchTrueFalseTotal
while (FAN_EVENT_OK(metadata, len)) { 0 0 0
while (FAN_EVENT_OK(metadata, len)) { 0 0 0
while (FAN_EVENT_OK(metadata, len)) { 0 0 0
310 0 ▶ if (metadata->vers != FANOTIFY_METADATA_VERSION) {
Branch: 1 branch
BranchTrueFalseTotal
if (metadata->vers != FANOTIFY_METADATA_VERSION) { 0 0 0
311 0 Perl_croak(aTHX_ "Mismatch of fanotify metadata version.");
312 }
313  
314 0 event = newSVpvn((const char *)metadata, sizeof(struct fanotify_bundle));
315 0 sv_2mortal(event);
316  
317 0 bundle = (struct fanotify_bundle *)SvPV_nolen(event);
318 0 bundle->fd = fd;
319 0 ▶ if (metadata->mask & (FAN_ACCESS_PERM | FAN_OPEN_PERM)) {
Branch: 1 branch
BranchTrueFalseTotal
if (metadata->mask & (FAN_ACCESS_PERM | FAN_OPEN_PERM)) { 0 0 0
320 0 bundle->needs_response = 1;
321 } else {
322 0 bundle->needs_response = 0;
323 }
324  
325 0 eventref = newRV_noinc(event);
326 0 sv_bless(eventref, gv_stashpv(PERLCLASS_EVENT, GV_ADD | SVf_UTF8));
327 0 SvREADONLY_on(eventref);
328  
329 0 ▶ XPUSHs(eventref);
Branch: 1 branch
BranchTrueFalseTotal
XPUSHs(eventref); 0 0 0
330  
331 0 metadata = FAN_EVENT_NEXT(metadata, len);
332 }
333  
334 0 free(buf);
335  
336 #
337 #
338 #
339 int
340 fanotify_write(event, response)
341 SV *event
342 int response
343 INIT:
344 int ret;
345 CODE:
346 0 ret = _event_write_response(event, response);
347  
348 0 ▶ if (ret == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if (ret == -1) { 0 0 0
349 0 XSRETURN_UNDEF;
350 }
351  
352 0 ▶ RETVAL = ret;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = ret; 0 0 0
353  
354 OUTPUT:
355 RETVAL
356  
357 # /*
358 # *******************************************************************************
359 # * Main package: Linux::Fanotify::FanotifyGroup
360 # */
361 MODULE = Linux::Fanotify PACKAGE = Linux::Fanotify::FanotifyGroup PREFIX = fanogrp_
362  
363 #
364 #
365 #
366 int
367 fanogrp_getfd(self)
368 SV *self
369 INIT:
370 int fd;
371 CODE:
372 0 ▶ if (!notgrp2fd(self, &fd)) {
Branch: 1 branch
BranchTrueFalseTotal
if (!notgrp2fd(self, &fd)) { 0 0 0
373 0 Perl_croak(aTHX_ "Invalid notification group object");
374 }
375  
376 0 ▶ if (fd > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (fd > 0) { 0 0 0
377 0 RETVAL = fd;
378 } else {
379 0 XSRETURN_UNDEF;
380 }
381 OUTPUT:
382 RETVAL
383  
384 #
385 #
386 #
387 int
388 fanogrp_close(self)
389 SV *self
390 INIT:
391 int fd;
392 SV *deref;
393 int ret;
394 CODE:
395 0 ▶ if (!notgrp2fd(self, &fd)) {
Branch: 1 branch
BranchTrueFalseTotal
if (!notgrp2fd(self, &fd)) { 0 0 0
396 0 Perl_croak(aTHX_ "Invalid notification group object");
397 }
398  
399 0 ▶ if (fd > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (fd > 0) { 0 0 0
400 0 ret = close(fd);
401  
402 0 deref = SvRV(self);
403 0 SvIV_set(deref, -1);
404 } else {
405 0 ret = -1;
406 0 errno = EBADF;
407 }
408  
409 // Convert C style 0/-1 to perl style 1/undef
410 0 ▶ if (ret == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if (ret == -1) { 0 0 0
411 0 XSRETURN_UNDEF;
412 } else {
413 0 ret = 1;
414 }
415 0 ▶ RETVAL = ret;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = ret; 0 0 0
416 OUTPUT:
417 RETVAL
418  
419 #
420 #
421 #
422 void
423 fanogrp_DESTROY(self)
424 SV *self
425 INIT:
426 int fd;
427 0 int autoclose = 1;
428 SV *sv_autoclose;
429 CODE:
430 0 ▶ if (!notgrp2fd(self, &fd)) {
Branch: 1 branch
BranchTrueFalseTotal
if (!notgrp2fd(self, &fd)) { 0 0 0
431 0 Perl_croak(aTHX_ "Invalid notification group object");
432 }
433  
434 0 ▶ if (fd > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (fd > 0) { 0 0 0
435 0 ▶ if ((sv_autoclose = get_sv("Linux::Fanotify::FanotifyGroup::autoclose", 0))) {
Branch: 1 branch
BranchTrueFalseTotal
if ((sv_autoclose = get_sv("Linux::Fanotify::FanotifyGroup::autoclose", 0))) { 0 0 0
436 0 autoclose = SvIV(sv_autoclose);
437 }
438 0 ▶ if (autoclose) {
Branch: 1 branch
BranchTrueFalseTotal
if (autoclose) { 0 0 0
439 0 close(fd);
440 }
441 }
442  
443 # /*
444 # *******************************************************************************
445 # * Main package: Linux::Fanotify::Event
446 # */
447 MODULE = Linux::Fanotify PACKAGE = Linux::Fanotify::Event PREFIX = event_
448  
449 #
450 #
451 #
452 int
453 event_close(self)
454 SV *self
455 INIT:
456 int ret;
457 CODE:
458 0 ret = _event_close(self);
459  
460 0 ▶ if (ret == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if (ret == -1) { 0 0 0
461 0 XSRETURN_UNDEF;
462 } else {
463 0 ret = 1;
464 }
465  
466 0 ▶ RETVAL = ret;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = ret; 0 0 0
467 OUTPUT:
468 RETVAL
469  
470 #
471 #
472 #
473 void
474 event_DESTROY(self)
475 SV *self
476 INIT:
477 0 int autoclose = 1;
478 SV *sv_autoclose;
479 CODE:
480 0 ▶ if ((sv_autoclose = get_sv("Linux::Fanotify::Event::autoclose", 0))) {
Branch: 1 branch
BranchTrueFalseTotal
if ((sv_autoclose = get_sv("Linux::Fanotify::Event::autoclose", 0))) { 0 0 0
481 0 autoclose = SvIV(sv_autoclose);
482 }
483 0 ▶ if (autoclose) {
Branch: 1 branch
BranchTrueFalseTotal
if (autoclose) { 0 0 0
484 0 _event_close(self);
485 }
486  
487 #
488 #
489 #
490 int
491 event_needsResponse(self)
492 SV *self
493 INIT:
494 struct fanotify_bundle *bundle;
495 CODE:
496 0 ▶ if (!(bundle = event2bundle(self))) {
Branch: 1 branch
BranchTrueFalseTotal
if (!(bundle = event2bundle(self))) { 0 0 0
497 0 Perl_croak(aTHX_ "Invalid event object");
498 }
499  
500 0 ▶ RETVAL = bundle->needs_response;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = bundle->needs_response; 0 0 0
501 OUTPUT:
502 RETVAL
503  
504 #
505 #
506 #
507 int
508 event__write(self, response)
509 SV *self
510 int response
511 INIT:
512 int ret;
513 CODE:
514 0 ret = _event_write_response(self, response);
515  
516 0 ▶ if (ret == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if (ret == -1) { 0 0 0
517 0 XSRETURN_UNDEF;
518 }
519  
520 0 ▶ RETVAL = ret;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = ret; 0 0 0
521 OUTPUT:
522 RETVAL
523  
524 #
525 #
526 #
527 int
528 event_allow(self)
529 SV *self
530 INIT:
531 int ret;
532 CODE:
533 0 ret = _event_write_response(self, FAN_ALLOW);
534  
535 0 ▶ if (ret == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if (ret == -1) { 0 0 0
536 0 XSRETURN_UNDEF;
537 }
538  
539 0 ▶ RETVAL = ret;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = ret; 0 0 0
540 OUTPUT:
541 RETVAL
542  
543 #
544 #
545 #
546 int
547 event_deny(self)
548 SV *self
549 INIT:
550 int ret;
551 CODE:
552 0 ret = _event_write_response(self, FAN_DENY);
553  
554 0 ▶ if (ret == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if (ret == -1) { 0 0 0
555 0 XSRETURN_UNDEF;
556 }
557  
558 0 ▶ RETVAL = ret;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = ret; 0 0 0
559 OUTPUT:
560 RETVAL
561  
562 #
563 #
564 #
565 void
566 event__dump(self)
567 SV *self
568 INIT:
569 struct fanotify_bundle *bundle;
570 char buf[256];
571 CODE:
572 0 ▶ if (!(bundle = event2bundle(self))) {
Branch: 1 branch
BranchTrueFalseTotal
if (!(bundle = event2bundle(self))) { 0 0 0
573 0 Perl_croak(aTHX_ "Invalid event object");
574 }
575 0 printf("object dump --\n%s\n",
576 event2str(bundle, buf, sizeof(buf)));
577  
578 #
579 #
580 #
581 SV *
582 event__stringify(self)
583 SV *self
584 INIT:
585 struct fanotify_bundle *bundle;
586 char buf[256];
587 SV *s;
588 CODE:
589 0 ▶ if (!(bundle = event2bundle(self))) {
Branch: 1 branch
BranchTrueFalseTotal
if (!(bundle = event2bundle(self))) { 0 0 0
590 0 Perl_croak(aTHX_ "Invalid event object");
591 }
592  
593 0 event2str(bundle, buf, sizeof(buf));
594  
595 0 s = newSVpvn_utf8(buf, strlen(buf), 1);
596 // sv_2mortal(s); // XXX XXX Needed?
597  
598 0 RETVAL = s;
599 OUTPUT:
600 RETVAL
601  
602 ################################################################################
603 # Accessor methods start here
604 #
605 unsigned int
606 event_event_len(self)
607 SV *self
608 INIT:
609 struct fanotify_bundle *bundle;
610 CODE:
611 0 ▶ if (!(bundle = event2bundle(self))) {
Branch: 1 branch
BranchTrueFalseTotal
if (!(bundle = event2bundle(self))) { 0 0 0
612 0 Perl_croak(aTHX_ "Invalid event object");
613 }
614 0 ▶ RETVAL = bundle->metadata.event_len;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = bundle->metadata.event_len; 0 0 0
615 OUTPUT:
616 RETVAL
617  
618 #
619 #
620 #
621 unsigned int
622 event_vers(self)
623 SV *self
624 INIT:
625 struct fanotify_bundle *bundle;
626 CODE:
627 0 ▶ if (!(bundle = event2bundle(self))) {
Branch: 1 branch
BranchTrueFalseTotal
if (!(bundle = event2bundle(self))) { 0 0 0
628 0 Perl_croak(aTHX_ "Invalid event object");
629 }
630 0 ▶ RETVAL = bundle->metadata.vers;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = bundle->metadata.vers; 0 0 0
631 OUTPUT:
632 RETVAL
633  
634 #
635 #
636 #
637 unsigned int
638 event_reserved(self)
639 SV *self
640 INIT:
641 struct fanotify_bundle *bundle;
642 CODE:
643 0 ▶ if (!(bundle = event2bundle(self))) {
Branch: 1 branch
BranchTrueFalseTotal
if (!(bundle = event2bundle(self))) { 0 0 0
644 0 Perl_croak(aTHX_ "Invalid event object");
645 }
646 0 ▶ RETVAL = bundle->metadata.reserved;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = bundle->metadata.reserved; 0 0 0
647 OUTPUT:
648 RETVAL
649  
650 #
651 #
652 #
653 unsigned int
654 event_metadata_len(self)
655 SV *self
656 INIT:
657 struct fanotify_bundle *bundle;
658 CODE:
659 0 ▶ if (!(bundle = event2bundle(self))) {
Branch: 1 branch
BranchTrueFalseTotal
if (!(bundle = event2bundle(self))) { 0 0 0
660 0 Perl_croak(aTHX_ "Invalid event object");
661 }
662 0 ▶ RETVAL = bundle->metadata.metadata_len;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = bundle->metadata.metadata_len; 0 0 0
663 OUTPUT:
664 RETVAL
665  
666 #
667 #
668 #
669 uint64_t
670 event_mask(self)
671 SV *self
672 INIT:
673 struct fanotify_bundle *bundle;
674 CODE:
675 0 ▶ if (!(bundle = event2bundle(self))) {
Branch: 1 branch
BranchTrueFalseTotal
if (!(bundle = event2bundle(self))) { 0 0 0
676 0 Perl_croak(aTHX_ "Invalid event object");
677 }
678 0 ▶ RETVAL = bundle->metadata.mask;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = bundle->metadata.mask; 0 0 0
679 OUTPUT:
680 RETVAL
681  
682 #
683 #
684 #
685 int
686 event_fd(self)
687 SV *self
688 INIT:
689 struct fanotify_bundle *bundle;
690 CODE:
691 0 ▶ if (!(bundle = event2bundle(self))) {
Branch: 1 branch
BranchTrueFalseTotal
if (!(bundle = event2bundle(self))) { 0 0 0
692 0 Perl_croak(aTHX_ "Invalid event object");
693 }
694 0 ▶ RETVAL = bundle->metadata.fd;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = bundle->metadata.fd; 0 0 0
695 OUTPUT:
696 RETVAL
697  
698 #
699 #
700 #
701 int
702 event_pid(self)
703 SV *self
704 INIT:
705 struct fanotify_bundle *bundle;
706 CODE:
707 0 ▶ if (!(bundle = event2bundle(self))) {
Branch: 1 branch
BranchTrueFalseTotal
if (!(bundle = event2bundle(self))) { 0 0 0
708 0 Perl_croak(aTHX_ "Invalid event object");
709 }
710 0 ▶ RETVAL = bundle->metadata.pid;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = bundle->metadata.pid; 0 0 0
711 OUTPUT:
712 RETVAL
713  
« blib/lib/Linux/Fanotify.pm ↑ Summary const-c.inc »