Home
last modified time | relevance | path

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

12345678910>>...114

/freebsd/tools/regression/capsicum/syscalls/
H A Dcap_fcntls_limit.c44 fcntl_tests_0(int fd)
49 CHECK(cap_fcntls_get(fd, &fcntlrights) == 0); in fcntl_tests_0()
52 CHECK(fcntl(fd, F_GETFD) == 0); in fcntl_tests_0()
53 CHECK(fcntl(fd, F_SETFD, FD_CLOEXEC) == 0); in fcntl_tests_0()
54 CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC); in fcntl_tests_0()
55 CHECK(fcntl(fd, F_SETFD, 0) == 0); in fcntl_tests_0()
56 CHECK(fcntl(fd, F_GETFD) == 0); in fcntl_tests_0()
58 CHECK(fcntl(fd, F_GETFL) == O_RDWR); in fcntl_tests_0()
59 CHECK(fcntl(fd, F_SETFL, O_NONBLOCK) == 0); in fcntl_tests_0()
60 CHECK(fcntl(fd, F_GETF in fcntl_tests_0()
45 fcntl_tests_0(int fd) fcntl_tests_0() argument
154 fcntl_tests_1(int fd) fcntl_tests_1() argument
206 fcntl_tests_2(int fd) fcntl_tests_2() argument
255 int fd; fcntl_tests_send_0() local
281 int fd; fcntl_tests_recv_0() local
410 int fd, pfd, sp[2]; main() local
[all...]
H A Dcap_ioctls_limit.c46 ioctl_tests_0(int fd)
50 CHECK(cap_ioctls_get(fd, NULL, 0) == CAP_IOCTLS_ALL); in ioctl_tests_0()
52 CHECK(fcntl(fd, F_GETFD) == 0); in ioctl_tests_0()
53 CHECK(ioctl(fd, FIOCLEX) == 0); in ioctl_tests_0()
54 CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC); in ioctl_tests_0()
55 CHECK(ioctl(fd, FIONCLEX) == 0); in ioctl_tests_0()
56 CHECK(fcntl(fd, F_GETFD) == 0); in ioctl_tests_0()
60 CHECK(cap_ioctls_limit(fd, cmds, nitems(cmds)) == 0); in ioctl_tests_0()
62 CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == nitems(cmds)); in ioctl_tests_0()
67 CHECK(cap_ioctls_limit(fd, cmd in ioctl_tests_0()
47 ioctl_tests_0(int fd) ioctl_tests_0() argument
128 ioctl_tests_1(int fd) ioctl_tests_1() argument
174 ioctl_tests_2(int fd) ioctl_tests_2() argument
216 int fd; ioctl_tests_send_0() local
245 int fd; ioctl_tests_recv_0() local
316 int fd, pfd, sp[2]; main() local
[all...]
/freebsd/sys/net/route/
H A Dfib_algo.c195 static bool rebuild_fd(struct fib_data *fd, const char *reason);
196 static bool rebuild_fd_flm(struct fib_data *fd, struct fib_lookup_module *flm_new);
199 static bool is_idx_free(struct fib_data *fd, uint32_t index);
203 static uint32_t fib_ref_nhop(struct fib_data *fd, struct nhop_object *nh);
204 static void fib_unref_nhop(struct fib_data *fd, struct nhop_object *nh);
415 fib_printf(int level, struct fib_data *fd, const char *func, char *fmt, ...) in fib_printf() argument
427 _ALGO_PRINTF(fd->fd_fibnum, fd->fd_family, fd->fd_flm->flm_name, in fib_printf()
428 fd->fd_gen, func, "%s", buf); in fib_printf()
486 callout_calc_delay_ms(struct fib_data *fd) in callout_calc_delay_ms() argument
490 if (fd->fd_failed_rebuilds > 10) in callout_calc_delay_ms()
[all …]
/freebsd/tools/regression/poll/
H A Dpipeselect.c19 #define SETUP(fd, rfds, tv) do { \ argument
21 FD_SET((fd), &(rfds)); \
59 child(int fd, int num) in child() argument
67 fd = open(FIFONAME, O_RDONLY | O_NONBLOCK); in child()
68 if (fd < 0) in child()
71 if (fd >= FD_SETSIZE) in child()
72 errx(1, "fd = %d too large for select()", fd); in child()
75 SETUP(fd, rfds, tv); in child()
76 if (select(fd + 1, &rfds, NULL, NULL, &tv) < 0) in child()
90 report(num++, "0", 1, FD_ISSET(fd, &rfds)); in child()
[all …]
/freebsd/tests/sys/kern/
H A Dkcov.c61 int fd; in open_kcov() local
63 fd = open("/dev/kcov", O_RDWR); in open_kcov()
64 if (fd == -1) in open_kcov()
67 return (fd); in open_kcov()
78 int fd; in ATF_TC_BODY() local
80 fd = open_kcov(); in ATF_TC_BODY()
82 ATF_CHECK(ioctl(fd, KIOSETBUFSIZE, 0) == -1); in ATF_TC_BODY()
83 ATF_CHECK(ioctl(fd, KIOSETBUFSIZE, 1) == -1); in ATF_TC_BODY()
84 ATF_CHECK(ioctl(fd, KIOSETBUFSIZE, 2) == 0); in ATF_TC_BODY()
85 ATF_CHECK(ioctl(fd, KIOSETBUFSIZE, 2) == -1); in ATF_TC_BODY()
[all …]
H A Dunix_passfd_test.c79 int fd; in devnull() local
81 fd = open("/dev/null", O_RDONLY); in devnull()
82 ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); in devnull()
83 *fdp = fd; in devnull()
90 int fd; in tempfile() local
94 fd = mkstemp(path); in tempfile()
95 ATF_REQUIRE_MSG(fd != -1, "mkstemp(%s) failed", path); in tempfile()
97 *fdp = fd; in tempfile()
101 dofstat(int fd, struct stat *sb) in dofstat() argument
104 ATF_REQUIRE_MSG(fstat(fd, sb) == 0, in dofstat()
[all …]
/freebsd/lib/libgeom/
H A Dgeom_util.c53 int fd; in g_open() local
55 path = g_device_path_open(name, &fd, dowrite); in g_open()
58 return (fd); in g_open()
62 g_close(int fd) in g_close() argument
65 return (close(fd)); in g_close()
69 g_ioctl_arg(int fd, unsigned long cmd, void *arg) in g_ioctl_arg() argument
74 ret = ioctl(fd, cmd, arg); in g_ioctl_arg()
76 ret = ioctl(fd, cmd); in g_ioctl_arg()
81 g_ioctl(int fd, unsigned long cmd) in g_ioctl() argument
84 return (g_ioctl_arg(fd, cmd, NULL)); in g_ioctl()
[all …]
/freebsd/sys/dev/fdc/
H A Dfdc.c308 fdsettype(struct fd_data *fd, struct fd_type *ft) in fdsettype() argument
310 fd->ft = ft; in fdsettype()
312 fd->sectorsize = 128 << fd->ft->secsize; in fdsettype()
559 if (fdc_cmd(fdc, 2, NE7CMD_SENSED, fdc->fd->fdsu, 1, &st3)) in fdc_sense_drive()
620 fd_select(struct fd_data *fd) in fd_select() argument
625 fdc = fd->fdc; in fd_select()
627 fdc->fdout |= FDO_FDMAEN | FDO_FRST | fd->fdsu; in fd_select()
634 struct fd_data *fd; in fd_turnon() local
638 fd = arg; in fd_turnon()
639 mtx_assert(&fd->fdc->fdc_mtx, MA_OWNED); in fd_turnon()
[all …]
/freebsd/tests/sys/posixshm/
H A Dmemfd_test.c41 int fd; in ATF_TC_BODY() local
44 ATF_REQUIRE((fd = memfd_create("...", 0)) != -1); in ATF_TC_BODY()
47 ATF_REQUIRE(write(fd, buf, sizeof(buf)) == sizeof(buf)); in ATF_TC_BODY()
48 ATF_REQUIRE(fstat(fd, &sb) == 0); in ATF_TC_BODY()
52 ATF_REQUIRE(ftruncate(fd, 2 * (sizeof(buf) - 1)) == 0); in ATF_TC_BODY()
55 ATF_REQUIRE(write(fd, buf, sizeof(buf)) == sizeof(buf)); in ATF_TC_BODY()
58 ATF_REQUIRE(fstat(fd, &sb) == 0); in ATF_TC_BODY()
61 close(fd); in ATF_TC_BODY()
82 int fd; in ATF_TC_BODY() local
84 ATF_REQUIRE((fd = memfd_create("...", 0)) != -1); in ATF_TC_BODY()
[all …]
H A Dposixshm_test.c90 int fd; in shm_open_should_fail() local
92 fd = shm_open(path, flags, mode); in shm_open_should_fail()
93 ATF_CHECK_MSG(fd == -1, "shm_open didn't fail"); in shm_open_should_fail()
120 int fd, pagesize; in scribble_object() local
124 fd = shm_open(path, O_CREAT|O_EXCL|O_RDWR, 0777); in scribble_object()
125 if (fd < 0 && errno == EEXIST) { in scribble_object()
128 fd = shm_open(test_path, O_CREAT | O_EXCL | O_RDWR, 0777); in scribble_object()
130 if (fd < 0) in scribble_object()
132 if (ftruncate(fd, pagesize) < 0) in scribble_object()
135 page = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); in scribble_object()
[all …]
/freebsd/tools/tools/ath/athprom/
H A Dathprom.c61 static void parseTemplate(FILE *ftemplate, FILE *fd);
76 FILE *fd; in opentemplate() local
81 fd = fopen(filename, "r"); in opentemplate()
82 if (fd == NULL && errno == ENOENT) { in opentemplate()
86 fd = fopen(filename, "r"); in opentemplate()
87 if (fd != NULL) /* XXX verbose */ in opentemplate()
90 return fd; in opentemplate()
96 FILE *fd = NULL; in main() local
114 fd = fopen(optarg, "r"); in main()
115 if (fd == NULL) in main()
[all …]
/freebsd/contrib/capsicum-test/
H A Dioctl.cc19 int fd = open("/etc/passwd", O_RDONLY); in TEST() local
20 EXPECT_OK(fd); in TEST()
21 int fd_no = dup(fd); in TEST()
23 EXPECT_OK(cap_rights_limit(fd, &rights_ioctl)); in TEST()
28 EXPECT_OK(ioctl(fd, FIONREAD, &bytes)); in TEST()
32 EXPECT_OK(ioctl(fd, FIOCLEX, &one)); in TEST()
35 close(fd); in TEST()
41 int fd = open("/etc/passwd", O_RDONLY); in TEST() local
42 EXPECT_OK(fd); in TEST()
46 EXPECT_OK(cap_ioctls_limit(fd, &ioctl_nread, 1)); in TEST()
[all …]
/freebsd/contrib/netbsd-tests/fs/vfs/
H A Dt_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 …]
/freebsd/libexec/tftpd/tests/
H A Dfunctional.c433 write_all(int fd, const void *buf, size_t nbytes) in write_all() argument
438 r = write(fd, buf, nbytes); in write_all()
455 int fd; variable
467 fd = open("abspath.txt", O_CREAT | O_RDONLY, 0644);
468 ATF_REQUIRE(fd >= 0);
469 close(fd);
499 int fd; variable
502 fd = open("small.txt", O_RDWR | O_CREAT, 0644);
503 ATF_REQUIRE(fd >= 0);
504 write_all(fd, contents, strlen(contents) + 1);
[all …]
/freebsd/tests/sys/fs/fusefs/
H A Dwrite.cc242 int fd; in TEST_F() local
250 fd = open(FULLPATH, O_WRONLY); in TEST_F()
251 ASSERT_LE(0, fd) << strerror(errno); in TEST_F()
254 iocb.aio_fildes = fd; in TEST_F()
260 leak(fd); in TEST_F()
285 int fd; in TEST_F() local
292 fd = open(FULLPATH, O_RDWR | O_APPEND); in TEST_F()
293 ASSERT_LE(0, fd) << strerror(errno); in TEST_F()
295 ASSERT_EQ(BUFSIZE, write(fd, CONTENTS, BUFSIZE)) << strerror(errno); in TEST_F()
296 leak(fd); in TEST_F()
[all …]
H A Dlseek.cc62 int fd; in TEST_F() local
73 fd = open(FULLPATH, O_RDONLY); in TEST_F()
74 ASSERT_LE(0, fd); in TEST_F()
76 EXPECT_EQ(offset_in, lseek(fd, offset_in, SEEK_DATA)); in TEST_F()
77 EXPECT_EQ(-1, fpathconf(fd, _PC_MIN_HOLE_SIZE)); in TEST_F()
80 leak(fd); in TEST_F()
95 int fd; in TEST_F() local
108 fd = open(FULLPATH, O_RDONLY); in TEST_F()
109 ASSERT_LE(0, fd); in TEST_F()
110 EXPECT_EQ(offset, lseek(fd, offset, SEEK_DATA)); in TEST_F()
[all …]
/freebsd/sys/contrib/openzfs/tests/zfs-tests/cmd/
H A Dmmap_seek.c49 seek_data(int fd, off_t offset, off_t expected) in seek_data() argument
51 off_t data_offset = lseek(fd, offset, SEEK_DATA); in seek_data()
60 seek_hole(int fd, off_t offset, off_t expected) in seek_hole() argument
62 off_t hole_offset = lseek(fd, offset, SEEK_HOLE); in seek_hole()
84 int fd = open(file_path, O_RDWR | O_CREAT, 0666); in main() local
85 if (fd == -1) { in main()
100 err = ftruncate(fd, file_size); in main()
107 MAP_SHARED, fd, 0)) == MAP_FAILED) { in main()
113 seek_data(fd, 0, -1); in main()
116 seek_hole(fd, 0, 0); in main()
[all …]
/freebsd/lib/libfigpar/
H A Dfigpar.c103 int fd; in parse_config() local
138 if ((fd = open(rpath, O_RDONLY)) < 0) in parse_config()
143 r = read(fd, p, 1); in parse_config()
154 r = read(fd, p, 1); in parse_config()
158 close(fd); in parse_config()
163 if ((curpos = lseek(fd, 0, SEEK_CUR)) == -1) { in parse_config()
164 close(fd); in parse_config()
179 r = read(fd, p, 1); in parse_config()
184 close(fd); in parse_config()
189 if (lseek(fd, curpos, SEEK_SET) == -1) { in parse_config()
[all …]
/freebsd/tests/sys/file/
H A Dclosefrom_test.c132 int fd; in devnull() local
134 fd = open(_PATH_DEVNULL, O_RDONLY); in devnull()
135 if (fd < 0) in devnull()
137 return (fd); in devnull()
145 int fd, flags, i, start; in main() local
156 fd = highest_fd(); in main()
157 if (start != fd) in main()
158 fail("highest_fd", "bad descriptor %d != %d", start, fd); in main()
163 fd = highest_fd(); in main()
164 if (fd != start) in main()
[all …]
/freebsd/sys/contrib/openzfs/lib/libspl/
H A Dbacktrace.c39 #define spl_bt_write_n(fd, s, n) \ argument
40 do { ssize_t r __maybe_unused = write(fd, s, n); } while (0)
41 #define spl_bt_write(fd, s) spl_bt_write_n(fd, s, sizeof (s)-1) argument
76 libspl_backtrace(int fd) in libspl_backtrace() argument
98 spl_bt_write(fd, "Registers:\n"); in libspl_backtrace()
153 spl_bt_write_n(fd, " ", 5-MIN(n, 3)); in libspl_backtrace()
156 spl_bt_write_n(fd, name, n); in libspl_backtrace()
157 spl_bt_write(fd, ": 0x"); in libspl_backtrace()
168 spl_bt_write_n(fd, buf, n); in libspl_backtrace()
172 spl_bt_write(fd, "\n"); in libspl_backtrace()
[all …]
/freebsd/contrib/llvm-project/compiler-rt/lib/tsan/rtl/
H A Dtsan_fd.cpp51 static bool bogusfd(int fd) { in bogusfd() argument
53 return fd < 0 || fd >= kTableSize; in bogusfd()
80 static FdDesc *fddesc(ThreadState *thr, uptr pc, int fd) { in fddesc() argument
81 CHECK_GE(fd, 0); in fddesc()
82 CHECK_LT(fd, kTableSize); in fddesc()
83 atomic_uintptr_t *pl1 = &fdctx.tab[fd / kTableSizeL2]; in fddesc()
97 return &fds[fd % kTableSizeL2]; in fddesc()
101 static void init(ThreadState *thr, uptr pc, int fd, FdSync *s, in init() argument
103 FdDesc *d = fddesc(thr, pc, fd); in init()
160 bool FdLocation(uptr addr, int *fd, Tid *tid, StackID *stack, bool *closed) { in FdLocation() argument
[all …]
/freebsd/usr.sbin/diskinfo/
H A Ddiskinfo.c70 static bool candelete(int fd);
71 static void speeddisk(int fd, off_t mediasize, u_int sectorsize);
72 static void commandtime(int fd, off_t mediasize, u_int sectorsize);
73 static void iopsbench(int fd, off_t mediasize, u_int sectorsize);
74 static void rotationrate(int fd, char *buf, size_t buflen);
75 static void slogbench(int fd, int isreg, off_t mediasize, u_int sectorsize);
76 static int zonecheck(int fd, uint32_t *zone_mode, char *zone_str,
85 int i, ch, fd, error, exitval = 0; in main() local
150 fd = open(argv[i], (opt_w ? O_RDWR : O_RDONLY) | O_DIRECT); in main()
151 if (fd < 0 && errno == ENOENT && *argv[i] != '/') { in main()
[all …]
/freebsd/tools/regression/security/open_to_operation/
H A Dopen_to_operation.c203 int dfd, fd, i, mode; in check_dup() local
210 fd = open(path, mode); in check_dup()
211 if (fd < 0) { in check_dup()
215 dfd = dup(fd); in check_dup()
221 close(fd); in check_dup()
229 int dfd, fd, i, mode; in check_dup2() local
236 fd = open(path, mode); in check_dup2()
237 if (fd < 0) { in check_dup2()
241 dfd = dup2(fd, 500); /* Arbitrary but high number. */ in check_dup2()
247 close(fd); in check_dup2()
[all …]
/freebsd/contrib/ofed/librdmacm/
H A Dpreload.c90 int (*fxstat)(int ver, int fd, struct stat *buf);
120 int fd; member
285 static void fd_store(int index, int fd, enum fd_type type, enum fd_fork_state state) in fd_store() argument
290 fdi->fd = fd; in fd_store()
295 static inline enum fd_type fd_get(int index, int *fd) in fd_get() argument
301 *fd = fdi->fd; in fd_get()
305 *fd = index; in fd_get()
315 return fdi ? fdi->fd : index; in fd_getd()
334 static enum fd_type fd_close(int index, int *fd) in fd_close() argument
342 *fd = fdi->fd; in fd_close()
[all …]
/freebsd/usr.sbin/pciconf/
H A Dcap.c46 static void list_ecaps(int fd, struct pci_conf *p);
51 cap_power(int fd, struct pci_conf *p, uint8_t ptr) in cap_power() argument
55 cap = read_config(fd, &p->pc_sel, ptr + PCIR_POWER_CAP, 2); in cap_power()
56 status = read_config(fd, &p->pc_sel, ptr + PCIR_POWER_STATUS, 2); in cap_power()
65 cap_agp(int fd, struct pci_conf *p, uint8_t ptr) in cap_agp() argument
69 status = read_config(fd, &p->pc_sel, ptr + AGP_STATUS, 4); in cap_agp()
70 command = read_config(fd, &p->pc_sel, ptr + AGP_CAPID, 4); in cap_agp()
119 cap_vpd(int fd __unused, struct pci_conf *p __unused, uint8_t ptr __unused) in cap_vpd()
126 cap_msi(int fd, struct pci_conf *p, uint8_t ptr) in cap_msi() argument
131 ctrl = read_config(fd, in cap_msi()
145 cap_pcix(int fd,struct pci_conf * p,uint8_t ptr) cap_pcix() argument
221 cap_ht(int fd,struct pci_conf * p,uint8_t ptr) cap_ht() argument
300 cap_vendor(int fd,struct pci_conf * p,uint8_t ptr) cap_vendor() argument
358 cap_debug(int fd,struct pci_conf * p,uint8_t ptr) cap_debug() argument
368 cap_subvendor(int fd,struct pci_conf * p,uint8_t ptr) cap_subvendor() argument
464 cap_express(int fd,struct pci_conf * p,uint8_t ptr) cap_express() argument
577 cap_msix(int fd,struct pci_conf * p,uint8_t ptr) cap_msix() argument
611 cap_pciaf(int fd,struct pci_conf * p,uint8_t ptr) cap_pciaf() argument
682 cap_ea(int fd,struct pci_conf * p,uint8_t ptr) cap_ea() argument
757 list_caps(int fd,struct pci_conf * p,int level) list_caps() argument
858 ecap_aer(int fd,struct pci_conf * p,uint16_t ptr,uint8_t ver) ecap_aer() argument
876 ecap_vc(int fd,struct pci_conf * p,uint16_t ptr,uint8_t ver) ecap_vc() argument
894 ecap_sernum(int fd,struct pci_conf * p,uint16_t ptr,uint8_t ver) ecap_sernum() argument
909 ecap_vendor(int fd,struct pci_conf * p,uint16_t ptr,uint8_t ver) ecap_vendor() argument
943 ecap_sec_pcie(int fd,struct pci_conf * p,uint16_t ptr,uint8_t ver) ecap_sec_pcie() argument
964 ecap_sriov(int fd,struct pci_conf * p,uint16_t ptr,uint8_t ver) ecap_sriov() argument
1029 ecap_acs(int fd,struct pci_conf * p,uint16_t ptr,uint8_t ver) ecap_acs() argument
1127 list_ecaps(int fd,struct pci_conf * p) list_ecaps() argument
1181 pci_find_cap(int fd,struct pci_conf * p,uint8_t id) pci_find_cap() argument
1215 pcie_find_cap(int fd,struct pci_conf * p,uint16_t id) pcie_find_cap() argument
[all...]

12345678910>>...114