1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 7 | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) 1997-2018 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 #ifndef FLOCK_COMPAT_H 20 #define FLOCK_COMPAT_H 21 22 /* php_flock internally uses fcntl whether or not flock is available 23 * This way our php_flock even works on NFS files. 24 * More info: /usr/src/linux/Documentation 25 */ 26 PHPAPI int php_flock(int fd, int operation); 27 28 #ifndef HAVE_FLOCK 29 # define LOCK_SH 1 30 # define LOCK_EX 2 31 # define LOCK_NB 4 32 # define LOCK_UN 8 33 PHPAPI int flock(int fd, int operation); 34 #endif 35 36 /* Userland LOCK_* constants */ 37 #define PHP_LOCK_SH 1 38 #define PHP_LOCK_EX 2 39 #define PHP_LOCK_UN 3 40 #define PHP_LOCK_NB 4 41 42 #ifdef PHP_WIN32 43 # ifdef EWOULDBLOCK 44 # undef EWOULDBLOCK 45 # endif 46 # define EWOULDBLOCK WSAEWOULDBLOCK 47 # define fsync _commit 48 # define ftruncate(a, b) chsize(a, b) 49 #endif /* defined(PHP_WIN32) */ 50 51 #if !HAVE_INET_ATON 52 #if HAVE_NETINET_IN_H 53 #include <netinet/in.h> 54 #endif 55 #if HAVE_ARPA_INET_H 56 #include <arpa/inet.h> 57 #endif 58 59 #ifndef PHP_WIN32 60 extern int inet_aton(const char *, struct in_addr *); 61 #endif 62 #endif 63 64 #endif /* FLOCK_COMPAT_H */ 65