Lines Matching refs:fd
37 int os_stat_fd(const int fd, struct uml_stat *ubuf) in os_stat_fd() argument
42 CATCH_EINTR(err = fstat64(fd, &sbuf)); in os_stat_fd()
82 int os_ioctl_generic(int fd, unsigned int cmd, unsigned long arg) in os_ioctl_generic() argument
86 err = ioctl(fd, cmd, arg); in os_ioctl_generic()
94 int os_get_ifname(int fd, char* namebuf) in os_get_ifname() argument
96 if (ioctl(fd, SIOCGIFNAME, namebuf) < 0) in os_get_ifname()
102 int os_set_slip(int fd) in os_set_slip() argument
107 if (ioctl(fd, TIOCSETD, &disc) < 0) in os_set_slip()
111 if (ioctl(fd, SIOCSIFENCAP, &sencap) < 0) in os_set_slip()
117 int os_mode_fd(int fd, int mode) in os_mode_fd() argument
121 CATCH_EINTR(err = fchmod(fd, mode)); in os_mode_fd()
175 int fd, err, f = 0; in os_open_file() local
196 fd = open64(file, f, mode); in os_open_file()
197 if (fd < 0) in os_open_file()
200 if (flags.cl && fcntl(fd, F_SETFD, 1)) { in os_open_file()
202 close(fd); in os_open_file()
206 return fd; in os_open_file()
212 int fd, err; in os_connect_socket() local
217 fd = socket(AF_UNIX, SOCK_STREAM, 0); in os_connect_socket()
218 if (fd < 0) { in os_connect_socket()
223 err = connect(fd, (struct sockaddr *) &sock, sizeof(sock)); in os_connect_socket()
229 return fd; in os_connect_socket()
232 close(fd); in os_connect_socket()
237 void os_close_file(int fd) in os_close_file() argument
239 close(fd); in os_close_file()
241 int os_fsync_file(int fd) in os_fsync_file() argument
243 if (fsync(fd) < 0) in os_fsync_file()
248 int os_seek_file(int fd, unsigned long long offset) in os_seek_file() argument
252 actual = lseek64(fd, offset, SEEK_SET); in os_seek_file()
258 int os_read_file(int fd, void *buf, int len) in os_read_file() argument
260 int n = read(fd, buf, len); in os_read_file()
267 int os_write_file(int fd, const void *buf, int len) in os_write_file() argument
269 int n = write(fd, (void *) buf, len); in os_write_file()
276 int os_sync_file(int fd) in os_sync_file() argument
278 int n = fsync(fd); in os_sync_file()
298 int fd; in os_file_size() local
301 fd = open(file, O_RDONLY, 0); in os_file_size()
302 if (fd < 0) { in os_file_size()
308 if (ioctl(fd, BLKGETSIZE, &blocks) < 0) { in os_file_size()
312 close(fd); in os_file_size()
316 close(fd); in os_file_size()
339 int os_set_exec_close(int fd) in os_set_exec_close() argument
343 CATCH_EINTR(err = fcntl(fd, F_SETFD, FD_CLOEXEC)); in os_set_exec_close()
379 int os_set_fd_async(int fd) in os_set_fd_async() argument
383 flags = fcntl(fd, F_GETFL); in os_set_fd_async()
388 if (fcntl(fd, F_SETFL, flags) < 0) { in os_set_fd_async()
391 "and O_NONBLOCK on fd # %d, errno = %d\n", fd, errno); in os_set_fd_async()
395 if ((fcntl(fd, F_SETSIG, SIGIO) < 0) || in os_set_fd_async()
396 (fcntl(fd, F_SETOWN, os_getpid()) < 0)) { in os_set_fd_async()
399 "(or F_SETSIG) fd %d, errno = %d\n", fd, errno); in os_set_fd_async()
406 int os_clear_fd_async(int fd) in os_clear_fd_async() argument
410 flags = fcntl(fd, F_GETFL); in os_clear_fd_async()
415 if (fcntl(fd, F_SETFL, flags) < 0) in os_clear_fd_async()
420 int os_set_fd_block(int fd, int blocking) in os_set_fd_block() argument
424 flags = fcntl(fd, F_GETFL); in os_set_fd_block()
433 if (fcntl(fd, F_SETFL, flags) < 0) in os_set_fd_block()
439 int os_accept_connection(int fd) in os_accept_connection() argument
443 new = accept(fd, NULL, 0); in os_accept_connection()
461 int os_shutdown_socket(int fd, int r, int w) in os_shutdown_socket() argument
474 err = shutdown(fd, what); in os_shutdown_socket()
480 int os_rcv_fd(int fd, int *helper_pid_out) in os_rcv_fd() argument
498 n = recvmsg(fd, &msg, 0); in os_rcv_fd()
552 int os_lock_file(int fd, int excl) in os_lock_file() argument
561 err = fcntl(fd, F_SETLK, &lock); in os_lock_file()
566 err = fcntl(fd, F_GETLK, &lock); in os_lock_file()