flock_compat.h 2.1 KB

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