Home
last modified time | relevance | path

Searched refs:fd (Results 1 – 25 of 2355) sorted by relevance

12345678910>>...95

/NextBSD/tools/regression/capsicum/syscalls/
HDcap_fcntls_limit.c48 fcntl_tests_0(int fd) in fcntl_tests_0() argument
53 CHECK(cap_fcntls_get(fd, &fcntlrights) == 0); in fcntl_tests_0()
56 CHECK(fcntl(fd, F_GETFD) == 0); in fcntl_tests_0()
57 CHECK(fcntl(fd, F_SETFD, FD_CLOEXEC) == 0); in fcntl_tests_0()
58 CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC); in fcntl_tests_0()
59 CHECK(fcntl(fd, F_SETFD, 0) == 0); in fcntl_tests_0()
60 CHECK(fcntl(fd, F_GETFD) == 0); in fcntl_tests_0()
62 CHECK(fcntl(fd, F_GETFL) == O_RDWR); in fcntl_tests_0()
63 CHECK(fcntl(fd, F_SETFL, O_NONBLOCK) == 0); in fcntl_tests_0()
64 CHECK(fcntl(fd, F_GETFL) == (O_RDWR | O_NONBLOCK)); in fcntl_tests_0()
[all …]
HDcap_ioctls_limit.c50 ioctl_tests_0(int fd) in ioctl_tests_0() argument
54 CHECK(cap_ioctls_get(fd, NULL, 0) == CAP_IOCTLS_ALL); in ioctl_tests_0()
56 CHECK(fcntl(fd, F_GETFD) == 0); in ioctl_tests_0()
57 CHECK(ioctl(fd, FIOCLEX) == 0); in ioctl_tests_0()
58 CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC); in ioctl_tests_0()
59 CHECK(ioctl(fd, FIONCLEX) == 0); in ioctl_tests_0()
60 CHECK(fcntl(fd, F_GETFD) == 0); in ioctl_tests_0()
64 CHECK(cap_ioctls_limit(fd, cmds, nitems(cmds)) == 0); in ioctl_tests_0()
66 CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == nitems(cmds)); in ioctl_tests_0()
71 CHECK(cap_ioctls_limit(fd, cmds, nitems(cmds)) == 0); in ioctl_tests_0()
[all …]
/NextBSD/lib/libgeom/
HDgeom_util.c54 int fd; in g_open() local
56 path = g_device_path_open(name, &fd, dowrite); in g_open()
59 if (fd == -1) in g_open()
61 return (fd); in g_open()
65 g_close(int fd) in g_close() argument
68 return (close(fd)); in g_close()
72 g_ioctl_arg(int fd, unsigned long cmd, void *arg) in g_ioctl_arg() argument
77 ret = ioctl(fd, cmd, arg); in g_ioctl_arg()
79 ret = ioctl(fd, cmd); in g_ioctl_arg()
84 g_ioctl(int fd, unsigned long cmd) in g_ioctl() argument
[all …]
/NextBSD/tools/regression/poll/
HDpipeselect.c20 #define SETUP(fd, rfds, tv) do { \ argument
22 FD_SET((fd), &(rfds)); \
60 child(int fd, int num) in child() argument
68 fd = open(FIFONAME, O_RDONLY | O_NONBLOCK); in child()
69 if (fd < 0) in child()
72 if (fd >= FD_SETSIZE) in child()
73 errx(1, "fd = %d too large for select()", fd); in child()
76 SETUP(fd, rfds, tv); in child()
77 if (select(fd + 1, &rfds, NULL, NULL, &tv) < 0) in child()
91 report(num++, "0", 1, FD_ISSET(fd, &rfds)); in child()
[all …]
/NextBSD/sys/dev/fdc/
HDfdc.c368 fdsettype(struct fd_data *fd, struct fd_type *ft) in fdsettype() argument
370 fd->ft = ft; in fdsettype()
372 fd->sectorsize = 128 << fd->ft->secsize; in fdsettype()
573 static void fd_motor(struct fd_data *fd, int turnon);
589 pc98_fd_check_ready(struct fd_data *fd) in pc98_fd_check_ready() argument
591 struct fdc_data *fdc = fd->fdc; in pc98_fd_check_ready()
593 int fdu = device_get_unit(fd->dev); in pc98_fd_check_ready()
596 fd_motor(fd, 1); in pc98_fd_check_ready()
611 pc98_fd_check_type(struct fd_data *fd, int unit) in pc98_fd_check_type() argument
615 if (fd->type != FDT_NONE || unit < 0 || unit > 3) in pc98_fd_check_type()
[all …]
/NextBSD/tools/tools/ath/athprom/
HDathprom.c62 static void parseTemplate(FILE *ftemplate, FILE *fd);
77 FILE *fd; in opentemplate() local
82 fd = fopen(filename, "r"); in opentemplate()
83 if (fd == NULL && errno == ENOENT) { in opentemplate()
87 fd = fopen(filename, "r"); in opentemplate()
88 if (fd != NULL) /* XXX verbose */ in opentemplate()
91 return fd; in opentemplate()
97 FILE *fd = NULL; in main() local
115 fd = fopen(optarg, "r"); in main()
116 if (fd == NULL) in main()
[all …]
/NextBSD/sbin/sconfig/
HDsconfig.c240 print_modems (int fd, int need_header) in print_modems() argument
244 if (ioctl (fd, TIOCMGET, &status) < 0) { in print_modems()
261 print_ifconfig (int fd) in print_ifconfig() argument
263 print_ifconfig (int fd __unused) in print_ifconfig()
270 if (ioctl (fd, SERIAL_GETPROTO, &protocol) >= 0 && in print_ifconfig()
305 print_stats (int fd, int need_header) in print_stats() argument
311 if (ioctl (fd, SERIAL_GETSTAT, &st) < 0) { in print_stats()
351 clear_stats (int fd) in clear_stats() argument
353 if (ioctl (fd, SERIAL_CLRSTAT, 0) < 0) { in clear_stats()
417 print_e1_stats (int fd, int need_header) in print_e1_stats() argument
[all …]
/NextBSD/tests/sys/kern/
HDunix_passfd_test.c74 int fd; in devnull() local
76 fd = open("/dev/null", O_RDONLY); in devnull()
77 ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); in devnull()
78 *fdp = fd; in devnull()
85 int fd; in tempfile() local
89 fd = mkstemp(path); in tempfile()
90 ATF_REQUIRE_MSG(fd != -1, "mkstemp(%s) failed", path); in tempfile()
92 *fdp = fd; in tempfile()
96 dofstat(int fd, struct stat *sb) in dofstat() argument
99 ATF_REQUIRE_MSG(fstat(fd, sb) == 0, in dofstat()
[all …]
/NextBSD/tools/tools/nxge/
HDxge_log.h49 #define XGE_PRINT_HEADER(fd, maxSize, pOffset) { \ argument
50 XGE_PRINT_LINE(fd); \
53 XGE_PRINT(fd, "PARAMETER%*s\tOFFSET\tVALUE", spaceCount, " "); \
56 XGE_PRINT(fd, "PARAMETER%*s\tVALUE", spaceCount, " "); \
58 XGE_PRINT_LINE(fd); \
61 #define XGE_PRINT_READ_HEADER(fd, maxSize, pOffset) { \ argument
62 XGE_PRINT_LINE(fd); \
65 XGE_PRINT(fd, "OFFSET\t\tVALUE", spaceCount, " "); \
68 XGE_PRINT(fd, "VALUE", spaceCount, " "); \
70 XGE_PRINT_LINE(fd); \
[all …]
/NextBSD/contrib/compiler-rt/lib/tsan/rtl/
HDtsan_fd.cc45 static bool bogusfd(int fd) { in bogusfd() argument
47 return fd < 0 || fd >= kTableSize; in bogusfd()
74 static FdDesc *fddesc(ThreadState *thr, uptr pc, int fd) { in fddesc() argument
75 CHECK_GE(fd, 0); in fddesc()
76 CHECK_LT(fd, kTableSize); in fddesc()
77 atomic_uintptr_t *pl1 = &fdctx.tab[fd / kTableSizeL2]; in fddesc()
90 return &((FdDesc*)l1)[fd % kTableSizeL2]; // NOLINT in fddesc()
94 static void init(ThreadState *thr, uptr pc, int fd, FdSync *s, in init() argument
96 FdDesc *d = fddesc(thr, pc, fd); in init()
143 bool FdLocation(uptr addr, int *fd, int *tid, u32 *stack) { in FdLocation() argument
[all …]
/NextBSD/contrib/netbsd-tests/fs/vfs/
HDt_io.c53 int fd; in holywrite() local
57 RL(fd = rump_sys_open("file", O_RDWR|O_CREAT|O_TRUNC, 0666)); in holywrite()
60 RL(rump_sys_pwrite(fd, buf, 1, getpagesize())); in holywrite()
63 RL(rump_sys_pwrite(fd, buf, 2, getpagesize()-1)); in holywrite()
68 RL(rump_sys_pread(fd, b2, therange, 0)); in holywrite()
75 rump_sys_close(fd); in holywrite()
84 int fd; in extendbody() local
87 RL(fd = rump_sys_open("testfile", in extendbody()
89 RL(rump_sys_ftruncate(fd, seekcnt)); in extendbody()
90 RL(rump_sys_fstat(fd, &sb)); in extendbody()
[all …]
/NextBSD/lib/libfigpar/
HDfigpar.c107 int fd; in parse_config() local
142 if ((fd = open(rpath, O_RDONLY)) < 0) in parse_config()
147 r = read(fd, p, 1); in parse_config()
158 r = read(fd, p, 1); in parse_config()
162 close(fd); in parse_config()
167 curpos = lseek(fd, 0, SEEK_CUR) - 1; in parse_config()
169 close(fd); in parse_config()
183 r = read(fd, p, 1); in parse_config()
188 close(fd); in parse_config()
193 error = (int)lseek(fd, curpos, SEEK_SET); in parse_config()
[all …]
/NextBSD/usr.sbin/pciconf/
HDcap.c49 static void list_ecaps(int fd, struct pci_conf *p);
52 cap_power(int fd, struct pci_conf *p, uint8_t ptr) in cap_power() argument
56 cap = read_config(fd, &p->pc_sel, ptr + PCIR_POWER_CAP, 2); in cap_power()
57 status = read_config(fd, &p->pc_sel, ptr + PCIR_POWER_STATUS, 2); in cap_power()
66 cap_agp(int fd, struct pci_conf *p, uint8_t ptr) in cap_agp() argument
70 status = read_config(fd, &p->pc_sel, ptr + AGP_STATUS, 4); in cap_agp()
71 command = read_config(fd, &p->pc_sel, ptr + AGP_CAPID, 4); in cap_agp()
120 cap_vpd(int fd, struct pci_conf *p, uint8_t ptr) in cap_vpd() argument
127 cap_msi(int fd, struct pci_conf *p, uint8_t ptr) in cap_msi() argument
132 ctrl = read_config(fd, &p->pc_sel, ptr + PCIR_MSI_CTRL, 2); in cap_msi()
[all …]
/NextBSD/contrib/ofed/libsdp/src/
HDport.c101 typedef int (*ioctl_func_t) (int fd,
109 typedef int (*fcntl_func_t) (int fd, int cmd, ...);
127 typedef int (*close_func_t) (int fd);
129 typedef int (*dup_func_t) (int fd);
133 typedef int (*getsockname_func_t) (int fd,
136 typedef int (*getpeername_func_t) (int fd,
139 typedef int (*accept_func_t) (int fd,
161 int op, int fd, struct epoll_event * event);
268 static void init_extra_attribute(int fd) in init_extra_attribute() argument
270 if ((0 <= fd) && (max_file_descriptors > fd)) { in init_extra_attribute()
[all …]
/NextBSD/tests/sys/file/
HDclosefrom_test.c134 int fd; in devnull() local
136 fd = open(_PATH_DEVNULL, O_RDONLY); in devnull()
137 if (fd < 0) in devnull()
139 return (fd); in devnull()
147 int fd, i, start; in main() local
158 fd = highest_fd(); in main()
159 if (start != fd) in main()
160 fail("highest_fd", "bad descriptor %d != %d", start, fd); in main()
165 fd = highest_fd(); in main()
166 if (fd != start) in main()
[all …]
/NextBSD/tools/regression/security/open_to_operation/
HDopen_to_operation.c206 int dfd, fd, i, mode; in check_dup() local
213 fd = open(path, mode); in check_dup()
214 if (fd < 0) { in check_dup()
218 dfd = dup(fd); in check_dup()
224 close(fd); in check_dup()
232 int dfd, fd, i, mode; in check_dup2() local
239 fd = open(path, mode); in check_dup2()
240 if (fd < 0) { in check_dup2()
244 dfd = dup2(fd, 500); /* Arbitrary but high number. */ in check_dup2()
250 close(fd); in check_dup2()
[all …]
/NextBSD/tests/sys/posixshm/
HDposixshm_test.c72 int fd; in shm_open_should_fail() local
74 fd = shm_open(path, flags, mode); in shm_open_should_fail()
75 ATF_CHECK_MSG(fd == -1, "shm_open didn't fail"); in shm_open_should_fail()
102 int fd; in scribble_object() local
106 fd = shm_open(test_path, O_CREAT|O_EXCL|O_RDWR, 0777); in scribble_object()
107 if (fd < 0 && errno == EEXIST) { in scribble_object()
110 fd = shm_open(test_path, O_CREAT | O_EXCL | O_RDWR, 0777); in scribble_object()
112 if (fd < 0) in scribble_object()
114 if (ftruncate(fd, getpagesize()) < 0) in scribble_object()
117 page = mmap(0, getpagesize(), PROT_READ | PROT_WRITE, MAP_SHARED, fd, in scribble_object()
[all …]
/NextBSD/sys/kern/
HDsys_capability.c210 cap_rights(struct filedesc *fdp, int fd) in cap_rights() argument
213 return (cap_rights_fde(&fdp->fd_ofiles[fd])); in cap_rights()
217 kern_cap_rights_limit(struct thread *td, int fd, cap_rights_t *rights) in kern_cap_rights_limit() argument
224 if (fget_locked(fdp, fd) == NULL) { in kern_cap_rights_limit()
228 error = _cap_check(cap_rights(fdp, fd), rights, CAPFAIL_INCREASE); in kern_cap_rights_limit()
230 fdp->fd_ofiles[fd].fde_rights = *rights; in kern_cap_rights_limit()
232 free(fdp->fd_ofiles[fd].fde_ioctls, M_FILECAPS); in kern_cap_rights_limit()
233 fdp->fd_ofiles[fd].fde_ioctls = NULL; in kern_cap_rights_limit()
234 fdp->fd_ofiles[fd].fde_nioctls = 0; in kern_cap_rights_limit()
237 fdp->fd_ofiles[fd].fde_fcntls = 0; in kern_cap_rights_limit()
[all …]
/NextBSD/usr.sbin/mfiutil/
HDmfi_patrol.c53 mfi_get_time(int fd, uint32_t *at) in mfi_get_time() argument
56 if (mfi_dcmd_command(fd, MFI_DCMD_TIME_SECS_GET, at, sizeof(*at), NULL, in mfi_get_time()
64 patrol_get_props(int fd, struct mfi_pr_properties *prop) in patrol_get_props() argument
68 if (mfi_dcmd_command(fd, MFI_DCMD_PR_GET_PROPERTIES, prop, in patrol_get_props()
87 int error, fd; in show_patrol() local
90 fd = mfi_open(mfi_unit, O_RDWR); in show_patrol()
91 if (fd < 0) { in show_patrol()
98 mfi_get_time(fd, &at); in show_patrol()
99 error = patrol_get_props(fd, &prop); in show_patrol()
101 close(fd); in show_patrol()
[all …]
HDmfi_drive.c61 int error, fd, len; in mfi_drive_name() local
75 fd = mfi_open(mfi_unit, O_RDWR); in mfi_drive_name()
76 if (fd < 0) { in mfi_drive_name()
82 if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) { in mfi_drive_name()
84 close(fd); in mfi_drive_name()
88 close(fd); in mfi_drive_name()
161 mfi_lookup_drive(int fd, char *drive, uint16_t *device_id) in mfi_lookup_drive() argument
203 if (mfi_pd_get_list(fd, &list, NULL) < 0) { in mfi_lookup_drive()
251 mfi_pd_get_list(int fd, struct mfi_pd_list **listp, uint8_t *statusp) in mfi_pd_get_list() argument
266 if (mfi_dcmd_command(fd, MFI_DCMD_PD_GET_LIST, list, list_size, NULL, in mfi_pd_get_list()
[all …]
HDmfi_foreign.c47 int ch, error, fd; in foreign_clear() local
49 fd = mfi_open(mfi_unit, O_RDWR); in foreign_clear()
50 if (fd < 0) { in foreign_clear()
63 close(fd); in foreign_clear()
67 if (mfi_dcmd_command(fd, MFI_DCMD_CFG_FOREIGN_CLEAR, NULL, 0, NULL, in foreign_clear()
71 close(fd); in foreign_clear()
76 close(fd); in foreign_clear()
85 int error, fd; in foreign_scan() local
87 fd = mfi_open(mfi_unit, O_RDONLY); in foreign_scan()
88 if (fd < 0) { in foreign_scan()
[all …]
/NextBSD/usr.sbin/bluetooth/sdpd/
HDserver.c55 static void server_accept_client (server_p srv, int32_t fd);
56 static int32_t server_process_request (server_p srv, int32_t fd);
57 static int32_t server_send_error_response (server_p srv, int32_t fd,
59 static void server_close_fd (server_p srv, int32_t fd);
229 int fd; in server_shutdown() local
233 for (fd = 0; fd < srv->maxfd + 1; fd ++) in server_shutdown()
234 if (srv->fdidx[fd].valid) in server_shutdown()
235 server_close_fd(srv, fd); in server_shutdown()
251 int32_t n, fd; in server_do() local
269 for (fd = 0; fd < srv->maxfd + 1 && n > 0; fd ++) { in server_do()
[all …]
/NextBSD/contrib/ntp/libntp/
HDsocket.c21 #define ioctl(fd, opt, val) ioctlsocket(fd, opt, (u_long *)(val)) argument
55 SOCKET fd in move_fd() argument
81 REQUIRE((int)fd >= 0); in move_fd()
100 if (fd >= 0 && fd < socket_boundary) { in move_fd()
102 newfd = fcntl(fd, F_DUPFD, socket_boundary); in move_fd()
106 close(fd); in move_fd()
111 return fd; in move_fd()
118 ENSURE((int)fd >= 0); in move_fd()
120 return fd; in move_fd()
129 SOCKET fd in make_socket_nonblocking() argument
[all …]
/NextBSD/usr.sbin/diskinfo/
HDdiskinfo.c55 static void speeddisk(int fd, off_t mediasize, u_int sectorsize);
56 static void commandtime(int fd, off_t mediasize, u_int sectorsize);
61 int i, ch, fd, error, exitval = 0; in main() local
90 fd = open(argv[i], O_RDONLY); in main()
91 if (fd < 0 && errno == ENOENT && *argv[i] != '/') { in main()
93 fd = open(buf, O_RDONLY); in main()
95 if (fd < 0) { in main()
100 error = ioctl(fd, DIOCGMEDIASIZE, &mediasize); in main()
106 error = ioctl(fd, DIOCGSECTORSIZE, &sectorsize); in main()
112 error = ioctl(fd, DIOCGFWSECTORS, &fwsectors); in main()
[all …]
/NextBSD/usr.sbin/eeprom/
HDofw_options.c84 ofwo_oemlogo(const struct ofwo_extabent *exent, int fd, const void *buf, in ofwo_oemlogo() argument
92 ofw_setprop(fd, ofw_optnode(fd), exent->ex_prop, "", 1); in ofwo_oemlogo()
106 if (ofw_setprop(fd, ofw_optnode(fd), exent->ex_prop, in ofwo_oemlogo()
120 ofwo_secmode(const struct ofwo_extabent *exent, int fd, const void *buf, in ofwo_secmode() argument
127 if ((res = ofwo_setpass(fd)) != EX_OK) in ofwo_secmode()
129 if ((res = ofwo_setstr(fd, buf, buflen, exent->ex_prop, in ofwo_secmode()
131 ofw_setprop(fd, ofw_optnode(fd), in ofwo_secmode()
136 ofw_setprop(fd, ofw_optnode(fd), "security-password", in ofwo_secmode()
138 return (ofwo_setstr(fd, buf, buflen, exent->ex_prop, in ofwo_secmode()
148 ofwo_secpwd(const struct ofwo_extabent *exent, int fd, const void *buf, in ofwo_secpwd() argument
[all …]

12345678910>>...95