11 #include <sys/ioctl.h>
12 #include <sys/mount.h>
13 #include <sys/socket.h>
46 copy_stat(ubuf, &sbuf);
60 copy_stat(ubuf, &sbuf);
85 err = ioctl(fd, cmd, arg);
161 *mode_out = of_write(*mode_out);
167 *mode_out = of_read(*mode_out);
176 if (flags.
r && flags.
w)
195 fd = open64(file, f, mode);
222 err = connect(fd, (
struct sockaddr *) &sock,
sizeof(sock));
243 unsigned long long actual;
245 actual = lseek64(fd, offset,
SEEK_SET);
246 if (actual != offset)
253 int n =
read(fd, buf, len);
262 int n =
write(fd, (
void *) buf, len);
289 "errno = %d\n", file,
errno);
295 "\"%s\", errno = %d\n", file,
errno);
299 *size_out = ((
long long) blocks) * 512;
334 int os_pipe(
int *fds,
int stream,
int close_on_exec)
338 err = socketpair(
AF_UNIX, type, 0, fds);
372 if (fcntl(fd,
F_SETFL, flags) < 0) {
375 "and O_NONBLOCK on fd # %d, errno = %d\n", fd,
errno);
383 "(or F_SETSIG) fd %d, errno = %d\n", fd,
errno);
399 if (fcntl(fd,
F_SETFL, flags) < 0)
417 if (fcntl(fd,
F_SETFL, flags) < 0)
427 new = accept(fd,
NULL, 0);
474 iov = ((
struct iovec) { .iov_base = helper_pid_out,
475 .iov_len =
sizeof(*helper_pid_out) });
482 n = recvmsg(fd, &msg, 0);
486 *helper_pid_out = -1;
491 "error = %d\n",
errno);
517 "close_on_exec failed, err = %d", -err);
524 err = bind(sock, (
struct sockaddr *) &addr,
sizeof(addr));
545 err = fcntl(fd,
F_SETLK, &lock);
550 err = fcntl(fd,
F_GETLK, &lock);
573 unsigned long long os_makedev(
unsigned major,
unsigned minor)
575 return makedev(major, minor);