Lines Matching defs:fd

87 static Obj_Entry *dlopen_object(const char *name, int fd, Obj_Entry *refobj,
112 static Obj_Entry *load_object(const char *, int fd, const Obj_Entry *, int);
142 static void *rtld_dlopen(const char *name, int fd, int mode);
369 int argc, fd, i, mib[4], old_osrel, osrel, phnum, rtld_argc;
434 fd = -1;
436 fd = aux_info[AT_EXECFD]->a_un.a_val;
463 rtld_argc = parse_args(argv, argc, &search_in_path, &fd);
465 explicit_fd = (fd != -1);
468 fd = open_binary_fd(argv0, search_in_path, &binpath);
469 if (fstat(fd, &st) == -1) {
470 _rtld_error("failed to fstat FD %d (%s): %s", fd,
606 if (fd != -1) { /* Load the main program. */
608 obj_main = map_object(fd, argv0, NULL);
609 close(fd);
627 if (aux_info[AT_EXECPATH] != NULL && fd == -1) {
1858 int fd;
1868 if ((fd = open(ld_elf_hints_path, O_RDONLY | O_CLOEXEC)) == -1)
1877 if (read(fd, &hdr, sizeof hdr) != sizeof hdr ||
1880 fstat(fd, &hint_stat) == -1) {
1882 close(fd);
1896 if (pread(fd, p, hdr.dirlistlen + 1,
1903 close(fd);
2463 int fd;
2467 fd = -1;
2476 path = find_library(name, refobj, &fd);
2482 if (fd >= 0) {
2497 if ((fd = open(path, O_RDONLY | O_CLOEXEC | O_VERIFY)) == -1) {
2503 fd = fcntl(fd_u, F_DUPFD_CLOEXEC, 0);
2504 if (fd == -1) {
2505 _rtld_error("Cannot dup fd");
2510 if (fstat(fd, &sb) == -1) {
2512 close(fd);
2525 close(fd);
2530 close(fd);
2535 obj = do_load_object(fd, name, path, &sb, flags);
2538 close(fd);
2544 do_load_object(int fd, const char *name, char *path, struct stat *sbp,
2555 if (fstatfs(fd, &fs) != 0) {
2565 obj = map_object(fd, printable_path(path), sbp);
3136 int fd;
3143 int fd;
3158 fd = open(pathname, O_RDONLY | O_CLOEXEC | O_VERIFY);
3159 if (fd >= 0) {
3160 dbg(" Opened \"%s\", fd %d", pathname, fd);
3163 arg->fd = fd;
3187 arg.fd = -1;
3190 *fdp = arg.fd;
3210 int dirfd, fd;
3243 fd = __sys_openat(dirfd, name, O_RDONLY | O_CLOEXEC | O_VERIFY);
3244 if (fd >= 0) {
3245 *fdp = fd;
3253 dbg("open('%s') => %d", found, fd);
3347 fdlopen(int fd, int mode)
3350 return (rtld_dlopen(NULL, fd, mode));
3354 rtld_dlopen(const char *name, int fd, int mode)
3378 return (dlopen_object(name, fd, obj_main, lo_flags,
3393 dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags,
3402 dbg("dlopen_object name \"%s\" fd %d refobj \"%s\" lo_flags %#x mode %#x",
3403 name != NULL ? name : "<null>", fd, refobj == NULL ? "<null>" :
3415 if (name == NULL && fd == -1) {
3419 obj = load_object(name, fd, refobj, lo_flags);
5503 int fd;
5517 fd = -1;
5527 fd = open(binpath, O_RDONLY | O_CLOEXEC | O_VERIFY);
5528 if (fd != -1 || errno != ENOENT) {
5535 fd = open(argv0, O_RDONLY | O_CLOEXEC | O_VERIFY);
5540 if (fd == -1) {
5545 return (fd);
5555 int fd, i, j, arglen;
5600 fd = parse_integer(argv[i]);
5601 if (fd == -1) {
5606 *fdp = fd;