xref: /PHP-5.5/ext/standard/flock_compat.h (revision 73c1be26)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 5                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1997-2015 The PHP Group                                |
6    +----------------------------------------------------------------------+
7    | This source file is subject to version 3.01 of the PHP license,      |
8    | that is bundled with this package in the file LICENSE, and is        |
9    | available through the world-wide-web at the following url:           |
10    | http://www.php.net/license/3_01.txt                                  |
11    | If you did not receive a copy of the PHP license and are unable to   |
12    | obtain it through the world-wide-web, please send a note to          |
13    | license@php.net so we can mail you a copy immediately.               |
14    +----------------------------------------------------------------------+
15    | Author: Sascha Schumann <sascha@schumann.cx>                         |
16    +----------------------------------------------------------------------+
17 */
18 
19 /* $Id$ */
20 
21 #ifndef FLOCK_COMPAT_H
22 #define FLOCK_COMPAT_H
23 
24 /* php_flock internally uses fcntl whther or not flock is available
25  * This way our php_flock even works on NFS files.
26  * More info: /usr/src/linux/Documentation
27  */
28 PHPAPI int php_flock(int fd, int operation);
29 
30 #ifndef HAVE_FLOCK
31 #	define LOCK_SH 1
32 #	define LOCK_EX 2
33 #	define LOCK_NB 4
34 #	define LOCK_UN 8
35 PHPAPI int flock(int fd, int operation);
36 #endif
37 
38 /* Userland LOCK_* constants */
39 #define PHP_LOCK_SH 1
40 #define PHP_LOCK_EX 2
41 #define PHP_LOCK_UN 3
42 #define PHP_LOCK_NB 4
43 
44 #ifdef PHP_WIN32
45 # ifdef EWOULDBLOCK
46 #  undef EWOULDBLOCK
47 # endif
48 # define EWOULDBLOCK WSAEWOULDBLOCK
49 # define fsync _commit
50 # define ftruncate(a, b) chsize(a, b)
51 #endif /* defined(PHP_WIN32) */
52 
53 #if !HAVE_INET_ATON
54 #if HAVE_NETINET_IN_H
55 #include <netinet/in.h>
56 #endif
57 #if HAVE_ARPA_INET_H
58 #include <arpa/inet.h>
59 #endif
60 
61 #ifndef PHP_WIN32
62 extern int inet_aton(const char *, struct in_addr *);
63 #endif
64 #endif
65 
66 #endif	/* FLOCK_COMPAT_H */
67