/bionic/libc/private/ |
H A D | ScopedFd.h | 23 // A smart pointer that closes the given fd on going out of scope. 24 // Use this when the fd is incidental to the purpose of your function, 28 explicit ScopedFd(int fd) : fd(fd) { argument 36 return fd; 40 int localFd = fd; 41 fd = -1; 46 if (fd != -1) { 47 TEMP_FAILURE_RETRY(close(fd)); 53 int fd; member in class:ScopedFd [all...] |
/bionic/libc/bionic/ |
H A D | daemon.c | 41 int fd = open("/dev/null", O_RDWR); local 43 if ( fd < 0 ) 46 if ( dup2( fd, 0 ) < 0 || 47 dup2( fd, 1 ) < 0 || 48 dup2( fd, 2 ) < 0 ) 50 close(fd); 53 close(fd);
|
H A D | __FD_chk.cpp | 33 extern "C" int __FD_ISSET_chk(int fd, fd_set* set, size_t set_size) { argument 34 if (__predict_false(fd < 0)) { 37 if (__predict_false(fd >= FD_SETSIZE)) { 43 return FD_ISSET(fd, set); 46 extern "C" void __FD_CLR_chk(int fd, fd_set* set, size_t set_size) { argument 47 if (__predict_false(fd < 0)) { 50 if (__predict_false(fd >= FD_SETSIZE)) { 56 FD_CLR(fd, set); 59 extern "C" void __FD_SET_chk(int fd, fd_set* set, size_t set_size) { argument 60 if (__predict_false(fd < [all...] |
H A D | eventfd_read.cpp | 32 int eventfd_read(int fd, eventfd_t* value) { argument 33 return (read(fd, value, sizeof(*value)) == sizeof(*value)) ? 0 : -1;
|
H A D | eventfd_write.cpp | 32 int eventfd_write(int fd, eventfd_t value) { argument 33 return (write(fd, &value, sizeof(value)) == sizeof(value)) ? 0 : -1;
|
H A D | futimens.cpp | 32 int futimens(int fd, const struct timespec times[2]) { argument 33 return utimensat(fd, NULL, times, 0);
|
H A D | isatty.c | 34 isatty (int fd) argument 38 return tcgetattr (fd, &term) == 0;
|
H A D | posix_fallocate.cpp | 33 int posix_fallocate(int fd, off_t offset, off_t length) { argument 35 return (fallocate(fd, 0, offset, length) == 0) ? 0 : errno; 38 int posix_fallocate64(int fd, off64_t offset, off64_t length) { argument 40 return (fallocate64(fd, 0, offset, length) == 0) ? 0 : errno;
|
H A D | termios.cpp | 66 int tcdrain(int fd) { argument 69 return ioctl(fd, TCSBRK, static_cast<unsigned long>(1)); 72 int tcflow(int fd, int action) { argument 73 return ioctl(fd, TCXONC, static_cast<unsigned long>(action)); 76 int tcflush(int fd, int queue) { argument 77 return ioctl(fd, TCFLSH, static_cast<unsigned long>(queue)); 80 int tcgetattr(int fd, termios* s) { argument 81 return ioctl(fd, TCGETS, s); 84 pid_t tcgetsid(int fd) { argument 86 if (ioctl(fd, TIOCGSI 92 tcsendbreak(int fd, int duration) argument 96 tcsetattr(int fd, int optional_actions, const termios* s) argument 107 tcgetpgrp(int fd) argument 115 tcsetpgrp(int fd, pid_t pid) argument [all...] |
H A D | posix_fadvise.cpp | 37 int posix_fadvise(int fd, off_t offset, off_t length, int advice) { argument 38 return posix_fadvise64(fd, offset, length, advice); 42 int posix_fadvise64(int fd, off64_t offset, off64_t length, int advice) { argument 44 return (__arm_fadvise64_64(fd, advice, offset, length) == 0) ? 0 : errno; 47 int posix_fadvise64(int fd, off64_t offset, off64_t length, int advice) { argument 49 return (__fadvise64(fd, offset, length, advice) == 0) ? 0 : errno;
|
H A D | epoll_wait.cpp | 31 int epoll_wait(int fd, struct epoll_event* events, int max_events, int timeout) { argument 32 return epoll_pwait(fd, events, max_events, timeout, NULL);
|
H A D | signalfd.cpp | 33 extern "C" int __signalfd4(int fd, kernel_sigset_t* mask, size_t sizemask, int flags); 35 int signalfd(int fd, const sigset_t* mask, int flags) { argument 37 return __signalfd4(fd, &in_set, sizeof(in_set), flags);
|
H A D | pty.cpp | 49 char* ptsname(int fd) { argument 51 return ptsname_r(fd, buf, sizeof(buf)) == 0 ? buf : NULL; 54 int ptsname_r(int fd, char* buf, size_t len) { argument 61 if (ioctl(fd, TIOCGPTN, &pty_num) != 0) { 74 char* ttyname(int fd) { argument 76 return ttyname_r(fd, buf, sizeof(buf)) == 0 ? buf : NULL; 79 int ttyname_r(int fd, char* buf, size_t len) { argument 85 if (!isatty(fd)) { 90 snprintf(path, sizeof(path), "/proc/self/fd/%d", fd); 104 unlockpt(int fd) argument [all...] |
H A D | legacy_32_bit_support.cpp | 48 int fcntl(int fd, int cmd, ...) { argument 55 return __fcntl64(fd, cmd, arg); 59 int fstatfs(int fd, struct statfs* stat) { argument 60 return __fstatfs64(fd, sizeof(*stat), stat); 72 off64_t lseek64(int fd, off64_t off, int whence) { argument 76 if (__llseek(fd, off_hi, off_lo, &result, whence) < 0) { 83 ssize_t pread(int fd, void* buf, size_t byte_count, off_t offset) { argument 84 return pread64(fd, buf, byte_count, static_cast<off64_t>(offset)); 88 ssize_t pwrite(int fd, const void* buf, size_t byte_count, off_t offset) { argument 89 return pwrite64(fd, bu 93 fallocate(int fd, int mode, off_t offset, off_t length) argument [all...] |
H A D | __read_chk.cpp | 33 extern "C" ssize_t __read_chk(int fd, void* buf, size_t count, size_t buf_size) { argument 42 return read(fd, buf, count);
|
H A D | ioctl.c | 32 int ioctl(int fd, int request, ...) argument 41 return __ioctl(fd, request, arg);
|
/bionic/libc/include/sys/ |
H A D | select.h | 48 #define __FDELT(fd) ((fd) / NFDBITS) 49 #define __FDMASK(fd) (1UL << ((fd) % NFDBITS)) 58 #define FD_CLR(fd, set) __FD_CLR_chk(fd, set, __bos(set)) 59 #define FD_SET(fd, set) __FD_SET_chk(fd, set, __bos(set)) 60 #define FD_ISSET(fd, set) __FD_ISSET_chk(fd, se [all...] |
H A D | eventfd.h | 45 extern int eventfd_read(int fd, eventfd_t* value); 46 extern int eventfd_write(int fd, eventfd_t value);
|
/bionic/tests/ |
H A D | eventfd_test.cpp | 39 int fd = eventfd(initial_value, O_NONBLOCK); local 40 ASSERT_NE(fd, -1); 43 ASSERT_EQ(0, eventfd_read(fd, &value)); 47 ASSERT_EQ(-1, eventfd_read(fd, &value)); 51 ASSERT_EQ(0, eventfd_write(fd, 1)); 52 ASSERT_EQ(0, eventfd_write(fd, 1)); 53 ASSERT_EQ(0, eventfd_write(fd, 1)); 55 ASSERT_EQ(0, eventfd_read(fd, &value)); 58 close(fd);
|
H A D | fcntl_test.cpp | 25 int fd = open("/proc/version", O_RDONLY); local 26 ASSERT_TRUE(fd != -1); 28 int flags = fcntl(fd, F_GETFD); 32 int rc = fcntl(fd, F_SETFD, FD_CLOEXEC); 35 flags = fcntl(fd, F_GETFD); 39 close(fd); 43 int fd; local 45 fd = open("/proc/version", O_RDONLY); 46 ASSERT_TRUE(fd != -1); 47 close(fd); 55 int fd; local 142 int fd = open64("/proc/version", O_RDONLY); local [all...] |
H A D | sys_sendfile_test.cpp | 28 ASSERT_EQ(5, TEMP_FAILURE_RETRY(write(src_file.fd, "hello", 5))); 34 ssize_t rc = sendfile(dst_file.fd, src_file.fd, &offset, count); 38 ASSERT_EQ(0, lseek(dst_file.fd, 0, SEEK_SET)); 41 ASSERT_EQ(2, TEMP_FAILURE_RETRY(read(dst_file.fd, &buf, 2))); 47 ASSERT_EQ(5, TEMP_FAILURE_RETRY(write(src_file.fd, "hello", 5))); 53 ssize_t rc = sendfile64(dst_file.fd, src_file.fd, &offset, count); 57 ASSERT_EQ(0, lseek(dst_file.fd, 0, SEEK_SET)); 60 ASSERT_EQ(2, TEMP_FAILURE_RETRY(read(dst_file.fd, [all...] |
H A D | TemporaryFile.h | 32 if (fd == -1) { 39 close(fd); 44 close(fd); 45 fd = open(filename, O_RDWR); 48 int fd; member in class:GenericTemporaryFile 54 fd = mk_fn(filename);
|
H A D | sys_mman_test.cpp | 40 void* map = mmap(NULL, 100, PROT_READ, MAP_SHARED, tf.fd, 1); 47 void* map = mmap64(NULL, 100, PROT_READ, MAP_SHARED, tf.fd, 1); 59 ASSERT_EQ(STR_SSIZE(STRING_MSG), write(tf.fd, STRING_MSG, sizeof(STRING_MSG))); 61 void* map = mmap(NULL, sizeof(STRING_MSG), PROT_READ, MAP_SHARED, tf.fd, 0); 73 ASSERT_EQ(STR_SSIZE(INITIAL_MSG), write(tf.fd, INITIAL_MSG, sizeof(INITIAL_MSG))); 74 lseek(tf.fd, 0, SEEK_SET); 76 void* map = mmap(NULL, sizeof(STRING_MSG), PROT_WRITE, MAP_SHARED, tf.fd, 0); 78 close(tf.fd); 87 ASSERT_EQ(STR_SSIZE(STRING_MSG), read(tf.fd, buf, sizeof(STRING_MSG))); 102 ASSERT_EQ(STR_SSIZE(PAGE0_MSG), write(tf.fd, PAGE0_MS [all...] |
H A D | stdlib_test.cpp | 168 ASSERT_EQ(0, fstat(tf.fd, &sb)); 174 ASSERT_EQ(0, fstat64(tf.fd, &sb)); 175 ASSERT_EQ(O_LARGEFILE, fcntl(tf.fd, F_GETFL) & O_LARGEFILE); 268 int fd = getpt(); local 269 ASSERT_NE(-1, fd); 272 ASSERT_EQ(0, grantpt(fd)); 276 ASSERT_EQ(0, ptsname_r(fd, name_r, sizeof(name_r))); 280 close(fd); 284 int fd = posix_openpt(O_RDWR|O_NOCTTY|O_CLOEXEC); local 285 ASSERT_NE(-1, fd); 297 int fd = getpt(); local 307 int fd = getpt(); local 317 int fd = getpt(); local 329 int fd = open("/dev/null", O_WRONLY); local 338 int fd = getpt(); local 348 int fd = getpt(); local 358 int fd = open("/dev/null", O_WRONLY); local [all...] |
/bionic/libc/upstream-openbsd/lib/libc/stdio/ |
H A D | dprintf.c | 39 dprintf(int fd, const char * __restrict fmt, ...) argument 45 ret = vdprintf(fd, fmt, ap);
|