Lines Matching refs:fd
57 static int put_pid (int fd, pid_t pid);
58 static pid_t get_pid (int fd,int *err);
67 int fd, tmpfd, i; in uu_lock() local
91 if ((fd = open(lckname, O_RDONLY | O_CLOEXEC)) < 0) in uu_lock()
94 if ((pid_old = get_pid (fd, &err)) == -1) in uu_lock()
97 close(fd); in uu_lock()
118 (void)close(fd); in uu_lock()
130 int fd, err; in uu_lock_txfr() local
135 if ((fd = open(lckname, O_RDWR | O_CLOEXEC)) < 0) in uu_lock_txfr()
137 if (get_pid(fd, &err) != getpid()) in uu_lock_txfr()
140 lseek(fd, (off_t)0, SEEK_SET); in uu_lock_txfr()
141 err = put_pid(fd, pid) ? 0 : UU_LOCK_WRITE_ERR; in uu_lock_txfr()
143 close(fd); in uu_lock_txfr()
199 put_pid(int fd, pid_t pid) in put_pid() argument
205 return write (fd, buf, (size_t)len) == len; in put_pid()
209 get_pid(int fd, int *err) in get_pid() argument
215 bytes_read = read (fd, buf, sizeof (buf) - 1); in get_pid()