Lines Matching refs:fd
2117 int fd;
2120 fd = open(dest, O_RDWR|O_NONBLOCK);
2121 if (fd == -1) {
2128 if ((fstat(fd, &buf) == -1) || !S_ISREG(buf.st_mode)) {
2130 (void) close(fd);
2136 if (ftruncate(fd, 0) == -1) {
2137 (void) close(fd);
2143 (void) close(fd);
2182 int fd;
2187 if ((fd = open(newpath, O_CREAT|O_EXCL|O_WRONLY|O_NONBLOCK,
2195 if (fstat(fd, &buf) == -1) {
2209 if ((newfile = fdopen(fd, "w")) == NULL) {
2240 if (fd != -1)
2241 (void) close(fd);
2260 int fd;
2265 if ((fd = open(file, O_RDONLY|O_NONBLOCK)) == -1) {
2271 if (fstat(fd, &buf) == -1) {
2283 if ((newfile = fdopen(fd, "r")) == NULL) {
2298 if (fd != -1)
2299 (void) close(fd);
2309 file_lock(int fd, int type, int wait)
2319 if (file_lock_test(fd, type)) {
2328 return (fcntl(fd, F_SETLKW, &lock));
2336 file_lock_test(int fd, int type)
2345 if (fcntl(fd, F_GETLK, &lock) != -1) {
2365 file_unlock(int fd)
2374 return (fcntl(fd, F_SETLK, &lock));