]> mj.ucw.cz Git - libucw.git/blob - ucw/perl/Filelock/Filelock.xs
make Sherlock compilable on Darwin without hacks due to missing direct IO
[libucw.git] / ucw / perl / Filelock / Filelock.xs
1 /*
2  * PerlXS module for managing file locks
3  *
4  * (c) 2007 Pavel Charvat <pchar@ucw.cz>
5  */
6
7 #include "EXTERN.h"
8 #include "perl.h"
9 #include "XSUB.h"
10
11 #include <unistd.h>
12 #include <fcntl.h>
13
14
15 MODULE = UCW::Filelock          PACKAGE = UCW::Filelock
16
17 PROTOTYPES: ENABLED
18
19 int
20 fcntl_lock(IN int fd, IN int cmd, IN int type, IN int whence, IN int start, IN int len)
21 CODE:
22         struct flock fl;
23         fl.l_type = type;
24         fl.l_whence = whence;
25         fl.l_start = start;
26         fl.l_len = len;
27
28         RETVAL = fcntl(fd, cmd, &fl);
29 OUTPUT:
30         RETVAL