Changeset 212 for trunk/src/slib.c
- Timestamp:
- Feb 17, 2009, 10:37:42 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/slib.c
r203 r212 2152 2152 } 2153 2153 2154 int sl_lock (SL_TICKET ticket) 2155 { 2156 int fd; 2157 struct flock lock; 2158 int retval; 2159 2160 SL_ENTER(_("sl_lock")); 2161 2162 if (SL_ISERROR(fd = get_the_fd (ticket))) 2163 SL_IRETURN(fd, _("sl_lock")); 2164 2165 lock.l_type = F_WRLCK; 2166 lock.l_whence = SEEK_SET; 2167 lock.l_start = 0; 2168 lock.l_len = 0; 2169 2170 /* F_SETLK returns if the lock cannot be obtained */ 2171 do { 2172 retval = fcntl(fd, F_SETLK, &lock); 2173 } while (retval < 0 && errno == EINTR); 2174 2175 if (retval < 0 && errno == EBADF) 2176 SL_IRETURN(SL_ETICKET, _("sl_lock")); 2177 else if (retval < 0) 2178 SL_IRETURN(SL_EBADFILE, _("sl_lock")); 2179 else 2180 SL_IRETURN(SL_ENONE, _("sl_lock")); 2181 } 2182 2154 2183 int sl_close (SL_TICKET ticket) 2155 2184 {
Note:
See TracChangeset
for help on using the changeset viewer.