Changeset 928 in svn for trunk/lock.c
- Timestamp:
- 2012-06-26T09:03:38Z (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lock.c
r393 r928 9 9 # define INVALID_HANDLE_VALUE -1 10 10 # endif 11 # define CloseHandle(h) close(h) 11 #else 12 # define close(h) CloseHandle(h) 13 # define open(filename, mode, permission) CreateFile(filename, \ 14 GENERIC_READ | GENERIC_WRITE, \ 15 FILE_SHARE_READ | FILE_SHARE_WRITE, \ 16 NULL, \ 17 OPEN_ALWAYS, \ 18 FILE_ATTRIBUTE_NORMAL, \ 19 NULL) 12 20 #endif 13 21 #include "lock.h" … … 50 58 # include <sys/types.h> 51 59 # include <sys/stat.h> 52 # ifndef errno 53 # define errno GetLastError() 54 # endif 60 # undef errno 61 # define errno GetLastError() 55 62 # define getuid() 0 56 63 # define LCK_WR LOCKFILE_EXCLUSIVE_LOCK … … 100 107 } 101 108 102 fd = (HANDLE)open(pathname, O_RDWR|O_CREAT, 0666);109 fd = open(pathname, O_RDWR|O_CREAT, 0666); 103 110 104 111 if (fd != INVALID_HANDLE_VALUE) { … … 114 121 } 115 122 else { 116 fprintf(stderr, "xc_fcntl_create: open(%s, O_RDWR|O_CREAT, 0666) failed:", pathname);123 zend_error(E_ERROR, "xc_fcntl_create: open(%s, O_RDWR|O_CREAT, 0666) failed:", pathname); 117 124 lck = NULL; 118 125 } … … 127 134 void xc_fcntl_destroy(xc_lock_t *lck) /* {{{ */ 128 135 { 129 CloseHandle(lck->fd);136 close(lck->fd); 130 137 #ifdef __CYGWIN__ 131 138 unlink(lck->pathname); … … 138 145 { 139 146 if (dolock(lck, LCK_WR) < 0) { 140 fprintf(stderr, "xc_fcntl_lock failed errno:%d", errno);147 zend_error(E_ERROR, "xc_fcntl_lock failed errno:%d", errno); 141 148 } 142 149 } … … 145 152 { 146 153 if (dolock(lck, LCK_RD) < 0) { 147 fprintf(stderr, "xc_fcntl_lock failed errno:%d", errno);154 zend_error(E_ERROR, "xc_fcntl_lock failed errno:%d", errno); 148 155 } 149 156 } … … 152 159 { 153 160 if (dolock(lck, LCK_UN) < 0) { 154 fprintf(stderr, "xc_fcntl_unlock failed errno:%d", errno);161 zend_error(E_ERROR, "xc_fcntl_unlock failed errno:%d", errno); 155 162 } 156 163 }
Note: See TracChangeset
for help on using the changeset viewer.