bin/cat/cat.c
126
int fd;
bin/cat/cat.c
134
fd = STDIN_FILENO;
bin/cat/cat.c
137
fd = open(path, O_RDONLY);
bin/cat/cat.c
139
if (fd < 0 && errno == EOPNOTSUPP)
bin/cat/cat.c
140
fd = udom_open(path, O_RDONLY);
bin/cat/cat.c
143
if (fd < 0) {
bin/cat/cat.c
147
if (fd == STDIN_FILENO) {
bin/cat/cat.c
150
fp = fdopen(fd, "r");
bin/cat/cat.c
157
raw_cat(fd);
bin/cat/cat.c
158
if (fd != STDIN_FILENO)
bin/cat/cat.c
159
close(fd);
bin/cat/cat.c
286
int fd;
bin/cat/cat.c
294
fd = socket(AF_UNIX, SOCK_STREAM, 0);
bin/cat/cat.c
295
if (fd >= 0) {
bin/cat/cat.c
304
if (connect(fd, (void *)&sou, len) < 0) {
bin/cat/cat.c
305
close(fd);
bin/cat/cat.c
306
fd = -1;
bin/cat/cat.c
313
if (fd >= 0) {
bin/cat/cat.c
316
if (shutdown(fd, SHUT_WR) == -1)
bin/cat/cat.c
320
if (shutdown(fd, SHUT_RD) == -1)
bin/cat/cat.c
327
return(fd);
bin/cp/utils.c
277
setfile(struct stat *fs, int fd)
bin/cp/utils.c
284
fdval = fd != -1;
bin/cp/utils.c
295
if (fdval ? fstat(fd, &ts) :
bin/cp/utils.c
310
if (fdval ? fchown(fd, fs->st_uid, fs->st_gid) :
bin/cp/utils.c
321
if (fdval ? fchmod(fd, fs->st_mode) :
bin/cp/utils.c
331
fchflags(fd, fs->st_flags) :
bin/cpdup/cpdup.c
1389
int fd;
bin/cpdup/cpdup.c
1404
fd = hc_open(cphost, fpath, O_RDONLY, 0);
bin/cpdup/cpdup.c
1405
if (fd >= 0) {
bin/cpdup/cpdup.c
1407
while ((nread = hc_read(cphost, fd, buf + bufused,
bin/cpdup/cpdup.c
1425
hc_close(cphost, fd);
bin/cpdup/hcproto.c
1001
hc_write(struct HostConf *hc, int fd, const void *buf, size_t bytes)
bin/cpdup/hcproto.c
1013
return(write(fd, buf, bytes));
bin/cpdup/hcproto.c
1015
fdp = hcc_get_descriptor(hc, fd, HC_DESC_FD);
bin/cpdup/hcproto.c
1024
hcc_leaf_int32(trans, LC_DESCRIPTOR, fd);
bin/cpdup/hcproto.c
735
int fd;
bin/cpdup/hcproto.c
772
if ((fd = open(path, flags, mode)) < 0)
bin/cpdup/hcproto.c
775
*fdp = fd;
bin/cpdup/hcproto.c
785
hc_close(struct HostConf *hc, int fd)
bin/cpdup/hcproto.c
791
if (NotForRealOpt && fd == 0x7FFFFFFF)
bin/cpdup/hcproto.c
794
return(close(fd));
bin/cpdup/hcproto.c
796
if (fd == 1 && hc->version >= 4) { /* using HC_READFILE */
bin/cpdup/hcproto.c
806
fdp = hcc_get_descriptor(hc, fd, HC_DESC_FD);
bin/cpdup/hcproto.c
809
hcc_set_descriptor(hc, fd, NULL, HC_DESC_FD);
bin/cpdup/hcproto.c
812
hcc_leaf_int32(trans, LC_DESCRIPTOR, fd);
bin/cpdup/hcproto.c
828
int fd;
bin/cpdup/hcproto.c
839
fd = *fdp;
bin/cpdup/hcproto.c
842
return(close(fd));
bin/cpdup/hcproto.c
855
hc_read(struct HostConf *hc, int fd, void *buf, size_t bytes)
bin/cpdup/hcproto.c
866
return(read(fd, buf, bytes));
bin/cpdup/hcproto.c
868
if (fd == 1 && hc->version >= 4) { /* using HC_READFILE */
bin/cpdup/hcproto.c
898
fdp = hcc_get_descriptor(hc, fd, HC_DESC_FD);
bin/cpdup/hcproto.c
905
hcc_leaf_int32(trans, LC_DESCRIPTOR, fd);
bin/cpdup/hcproto.c
971
int fd;
bin/cpdup/hcproto.c
979
if ((fd = open(path, O_RDONLY)) < 0)
bin/cpdup/hcproto.c
981
while ((n = read(fd, buf, 32768)) >= 0) {
bin/cpdup/hcproto.c
983
close(fd);
bin/cpdup/hcproto.c
991
close(fd);
bin/cpdup/hcproto.c
994
return (close(fd));
bin/cpdup/hcproto.h
102
int hc_close(struct HostConf *hc, int fd);
bin/cpdup/hcproto.h
103
ssize_t hc_read(struct HostConf *hc, int fd, void *buf, size_t bytes);
bin/cpdup/hcproto.h
104
ssize_t hc_write(struct HostConf *hc, int fd, const void *buf, size_t bytes);
bin/cpdup/md5.c
266
int fd, bytes, i;
bin/cpdup/md5.c
268
fd = open(filename, O_RDONLY);
bin/cpdup/md5.c
269
if (fd < 0)
bin/cpdup/md5.c
271
if (fstat(fd, &st) < 0) {
bin/cpdup/md5.c
281
bytes = read(fd, buffer, sizeof(buffer));
bin/cpdup/md5.c
283
bytes = read(fd, buffer, size);
bin/cpdup/md5.c
291
close(fd);
bin/dd/dd.c
118
close(out.fd);
bin/dd/dd.c
139
in.fd = STDIN_FILENO;
bin/dd/dd.c
141
in.fd = open(in.name, O_RDONLY, 0);
bin/dd/dd.c
142
if (in.fd == -1)
bin/dd/dd.c
153
out.fd = STDOUT_FILENO;
bin/dd/dd.c
158
out.fd = open(out.name, O_RDWR | OFLAGS, DEFFILEMODE);
bin/dd/dd.c
164
if (out.fd == -1) {
bin/dd/dd.c
165
out.fd = open(out.name, O_WRONLY | OFLAGS, DEFFILEMODE);
bin/dd/dd.c
168
if (out.fd == -1)
bin/dd/dd.c
203
if (ftruncate(out.fd, out.offset * out.dbsz) == -1)
bin/dd/dd.c
267
if (fstat(io->fd, &sb) == -1)
bin/dd/dd.c
275
if (ioctl(io->fd, FIODTYPE, &type) == -1) {
bin/dd/dd.c
289
if (lseek(io->fd, (off_t)0, SEEK_CUR) == -1 && errno == ESPIPE)
bin/dd/dd.c
366
n = read(in.fd, in.dbp, in.dbsz);
bin/dd/dd.c
390
lseek(in.fd, (off_t)in.dbsz, SEEK_CUR))
bin/dd/dd.c
475
if (ftruncate(out.fd, out.seek_offset) == -1)
bin/dd/dd.c
531
out.seek_offset = lseek(out.fd, pending, SEEK_CUR);
bin/dd/dd.c
538
nw = write(out.fd, outp, cnt);
bin/dd/dd.h
60
int fd; /* file descriptor */
bin/dd/position.c
113
if ((nr = read(in.fd, in.db, bcnt)) > 0) {
bin/dd/position.c
168
if (lseek(out.fd, seek_offset(&out), SEEK_CUR) == -1 &&
bin/dd/position.c
183
if (ioctl(out.fd, MTIOCTOP, &t_op) == -1)
bin/dd/position.c
190
if ((n = read(out.fd, out.db, out.dbsz)) > 0)
bin/dd/position.c
203
if (ioctl(out.fd, MTIOCTOP, &t_op) == -1)
bin/dd/position.c
207
n = write(out.fd, out.db, out.dbsz);
bin/dd/position.c
97
if (lseek(in.fd, seek_offset(&in), SEEK_CUR) == -1 &&
bin/ed/buf.c
194
int fd;
bin/ed/buf.c
200
if ((fd = mkstemp(sfn)) == -1 ||
bin/ed/buf.c
201
(sfp = fdopen(fd, "w+")) == NULL) {
bin/ed/buf.c
202
if (fd != -1)
bin/ed/buf.c
203
close(fd);
bin/mined/mined.h
301
int write_char(int fd, char c);
bin/mined/mined.h
302
int writeline(int fd, const char *text);
bin/mined/mined.h
304
int flush_buffer(int fd);
bin/mined/mined.h
305
void bad_write(int fd);
bin/mined/mined.h
315
int get_line(int fd, char *buffer);
bin/mined/mined.h
375
void file_insert(int fd, FLAG old_pos);
bin/mined/mined1.c
1078
flush_buffer(int fd)
bin/mined/mined1.c
1083
if (fd == STD_OUT) {
bin/mined/mined1.c
1089
if (write(fd, screen, out_count) != out_count) {
bin/mined/mined1.c
1090
bad_write(fd);
bin/mined/mined1.c
1101
bad_write(int fd)
bin/mined/mined1.c
1103
if (fd == STD_OUT) /* Cannot write to terminal? */
bin/mined/mined1.c
1357
int fd = -1; /* Filedescriptor for file */
bin/mined/mined1.c
1367
fd = 0;
bin/mined/mined1.c
1376
else if ((fd = open(file, 0)) < 0)
bin/mined/mined1.c
1385
if (fd >= 0) {
bin/mined/mined1.c
1387
while ((len = get_line(fd, text_buffer)) != ERRORS) {
bin/mined/mined1.c
1396
close(fd); /* Close file */
bin/mined/mined1.c
1416
get_line(int fd, char *buffer)
bin/mined/mined1.c
1426
if ((read_chars = read(fd, screen, SCREEN_SIZE)) <= 0)
bin/mined/mined1.c
507
int fd; /* Filedescriptor of file */
bin/mined/mined1.c
520
if ((fd = creat(file_name, 0644)) < 0) { /* Empty file */
bin/mined/mined1.c
536
if (writeline(fd, line->text) == ERRORS) {
bin/mined/mined1.c
543
if (count > 0L && flush_buffer(fd) == ERRORS)
bin/mined/mined1.c
546
close(fd);
bin/mined/mined1.c
984
write_char(int fd, char c)
bin/mined/mined1.c
988
return flush_buffer(fd);
bin/mined/mined1.c
996
writeline(int fd, const char *text)
bin/mined/mined1.c
999
if (write_char(fd, *text++) == ERRORS)
bin/mined/mined2.c
1053
int fd;
bin/mined/mined2.c
1056
if ((fd = scratch_file(WRITE)) == ERRORS)
bin/mined/mined2.c
1065
if (write_char(fd, *textp) == ERRORS) {
bin/mined/mined2.c
1066
close(fd);
bin/mined/mined2.c
1078
if (flush_buffer(fd) == ERRORS) {
bin/mined/mined2.c
1079
close(fd);
bin/mined/mined2.c
1082
close(fd);
bin/mined/mined2.c
1118
int fd = ERRORS; /* Filedescriptor to buffer */
bin/mined/mined2.c
1130
if (access(yank_file, 0) == 0 || (fd = creat(yank_file, 0644)) < 0) {
bin/mined/mined2.c
1139
else if ((mode == READ && (fd = open(yank_file, 0)) < 0) ||
bin/mined/mined2.c
1140
(mode == WRITE && (fd = creat(yank_file, 0644)) < 0)) {
bin/mined/mined2.c
1146
return fd;
bin/mined/mined2.c
790
int fd; /* File descriptor for buffer */
bin/mined/mined2.c
792
if ((fd = scratch_file(READ)) == ERRORS)
bin/mined/mined2.c
795
file_insert(fd, FALSE);/* Insert the buffer */
bin/mined/mined2.c
796
close(fd);
bin/mined/mined2.c
807
int fd; /* File descriptor of file */
bin/mined/mined2.c
814
if ((fd = open(name, 0)) < 0)
bin/mined/mined2.c
817
file_insert(fd, TRUE); /* Insert the file */
bin/mined/mined2.c
818
close(fd);
bin/mined/mined2.c
827
file_insert(int fd, FLAG old_pos)
bin/mined/mined2.c
836
if (get_line(fd, line_buffer) == ERRORS)
bin/mined/mined2.c
844
while ((ret = get_line(fd, line_buffer)) != ERRORS && ret != NO_LINE)
bin/notty/notty.c
63
int fd;
bin/notty/notty.c
88
fd = open("/dev/tty", O_RDWR);
bin/notty/notty.c
89
if (fd >= 0) {
bin/notty/notty.c
90
ioctl(fd, TIOCNOTTY, 0);
bin/notty/notty.c
91
close(fd);
bin/pax/ar_io.c
1240
ar_start_gzip(int fd, const char *gzip_program, int wr)
bin/pax/ar_io.c
1254
dup2(fds[1], fd);
bin/pax/ar_io.c
1256
dup2(fds[0], fd);
bin/pax/ar_io.c
1262
dup2(fd, STDOUT_FILENO);
bin/pax/ar_io.c
1266
dup2(fd, STDIN_FILENO);
bin/pax/ar_subs.c
151
int fd;
bin/pax/ar_subs.c
304
if ((fd = file_creat(arcn)) < 0) {
bin/pax/ar_subs.c
313
res = (*frmt->rd_data)(arcn, fd, &cnt);
bin/pax/ar_subs.c
314
file_close(arcn, fd);
bin/pax/ar_subs.c
357
int fd = -1;
bin/pax/ar_subs.c
397
fd = -1;
bin/pax/ar_subs.c
425
if ((fd = open(arcn->org_name, O_RDONLY, 0)) < 0) {
bin/pax/ar_subs.c
441
rdfile_close(arcn, &fd);
bin/pax/ar_subs.c
446
if ((res > 0) || (docrc && (set_crc(arcn, fd) < 0))) {
bin/pax/ar_subs.c
451
rdfile_close(arcn, &fd);
bin/pax/ar_subs.c
471
rdfile_close(arcn, &fd);
bin/pax/ar_subs.c
484
rdfile_close(arcn, &fd);
bin/pax/ar_subs.c
496
res = (*frmt->wr_data)(arcn, fd, &cnt);
bin/pax/ar_subs.c
497
rdfile_close(arcn, &fd);
bin/pax/file_subs.c
108
if ((fd = open(arcn->name, O_WRONLY | O_CREAT | O_TRUNC,
bin/pax/file_subs.c
117
return(fd);
bin/pax/file_subs.c
129
file_close(ARCHD *arcn, int fd)
bin/pax/file_subs.c
133
if (fd < 0)
bin/pax/file_subs.c
135
if (close(fd) < 0)
bin/pax/file_subs.c
74
int fd = -1;
bin/pax/file_subs.c
777
file_write(int fd, char *str, int cnt, int *rem, int *isempt, int sz,
bin/pax/file_subs.c
824
if (lseek(fd, (off_t)wcnt, SEEK_CUR) < 0) {
bin/pax/file_subs.c
841
if (write(fd, st, wcnt) != wcnt) {
bin/pax/file_subs.c
858
file_flush(int fd, char *fname, int isempt)
bin/pax/file_subs.c
872
if (lseek(fd, (off_t)-1, SEEK_CUR) < 0) {
bin/pax/file_subs.c
877
if (write(fd, blnk, 1) < 0)
bin/pax/file_subs.c
889
rdfile_close(ARCHD *arcn, int *fd)
bin/pax/file_subs.c
894
if (*fd < 0)
bin/pax/file_subs.c
897
close(*fd);
bin/pax/file_subs.c
898
*fd = -1;
bin/pax/file_subs.c
90
if ((fd = open(arcn->name, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL,
bin/pax/file_subs.c
919
set_crc(ARCHD *arcn, int fd)
bin/pax/file_subs.c
92
return(fd);
bin/pax/file_subs.c
929
if (fd < 0) {
bin/pax/file_subs.c
945
if ((res = read(fd, tbuf, size)) <= 0)
bin/pax/file_subs.c
958
else if (fstat(fd, &sb) < 0)
bin/pax/file_subs.c
962
else if (lseek(fd, (off_t)0L, SEEK_SET) < 0)
bin/rm/rm.c
433
int bsize, fd, wlen;
bin/rm/rm.c
436
fd = -1;
bin/rm/rm.c
451
if ((fd = open(file, O_WRONLY, 0)) == -1)
bin/rm/rm.c
453
if (fstatfs(fd, &fsb) == -1)
bin/rm/rm.c
463
if (write(fd, buf, wlen) != wlen) \
bin/rm/rm.c
468
if (fsync(fd) || lseek(fd, (off_t)0, SEEK_SET))
bin/rm/rm.c
471
if (fsync(fd) || lseek(fd, (off_t)0, SEEK_SET))
bin/rm/rm.c
474
if (!fsync(fd) && !close(fd)) {
bin/rm/rm.c
482
if (fd != -1)
bin/rm/rm.c
483
close(fd);
bin/sh/eval.c
1166
backcmd->fd = pip[0];
bin/sh/eval.c
652
result->fd = -1;
bin/sh/eval.c
702
result->fd = pip[0];
bin/sh/eval.c
707
result->fd, result->buf, result->nleft, result->jp));
bin/sh/eval.h
43
int fd; /* file descriptor to read from */
bin/sh/expand.c
1518
int fd = -1;
bin/sh/expand.c
1524
fd = number(shoptarg);
bin/sh/expand.c
1533
if (fd < 0)
bin/sh/expand.c
1536
setinputfd(fd, 1);
bin/sh/expand.c
489
if (in.fd < 0)
bin/sh/expand.c
491
while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR)
bin/sh/expand.c
521
if (in.fd >= 0)
bin/sh/expand.c
522
close(in.fd);
bin/sh/histedit.c
311
int fd;
bin/sh/histedit.c
314
if ((fd = mkstemp(editfilestr)) < 0)
bin/sh/histedit.c
317
if ((efp = fdopen(fd, "w")) == NULL) {
bin/sh/histedit.c
318
close(fd);
bin/sh/input.c
140
if (parsefile->fd == 0 && el) {
bin/sh/input.c
163
nr = read(parsefile->fd, parsefile->buf, BUFSIZ);
bin/sh/input.c
169
if (parsefile->fd == 0 && errno == EWOULDBLOCK) {
bin/sh/input.c
255
if (parsefile->fd == 0 && hist &&
bin/sh/input.c
363
int fd;
bin/sh/input.c
367
if ((fd = open(fname, O_RDONLY | O_CLOEXEC_MAYBE)) < 0) {
bin/sh/input.c
372
if (fd < 10) {
bin/sh/input.c
373
fd2 = fcntl(fd, F_DUPFD_CLOEXEC_MAYBE, 10);
bin/sh/input.c
374
close(fd);
bin/sh/input.c
377
fd = fd2;
bin/sh/input.c
379
setinputfd(fd, push);
bin/sh/input.c
390
setinputfd(int fd, int push)
bin/sh/input.c
393
fcntl(fd, F_SETFD, FD_CLOEXEC);
bin/sh/input.c
399
if (parsefile->fd > 0)
bin/sh/input.c
400
close(parsefile->fd);
bin/sh/input.c
401
parsefile->fd = fd;
bin/sh/input.c
444
pf->fd = -1;
bin/sh/input.c
457
if (pf->fd >= 0)
bin/sh/input.c
458
close(pf->fd);
bin/sh/input.c
521
if (parsefile->fd > 0) {
bin/sh/input.c
522
close(parsefile->fd);
bin/sh/input.c
523
parsefile->fd = 0;
bin/sh/input.c
85
int fd; /* file descriptor (or -1 if string) */
bin/sh/jobs.c
1371
if (n->nfile.fd != deffd) {
bin/sh/jobs.c
1372
s[0] = n->nfile.fd + '0';
bin/sh/main.c
241
int fd;
bin/sh/main.c
248
if ((fd = open(expandedname, O_RDONLY | O_CLOEXEC_MAYBE)) >= 0)
bin/sh/main.c
249
setinputfd(fd, 1);
bin/sh/main.c
251
if (fd < 0)
bin/sh/miscbltin.c
105
nread = read(fdc->fd, fdc->buf, fdc->buflen);
bin/sh/miscbltin.c
138
(void) lseek(fdc->fd, -residue, SEEK_CUR);
bin/sh/miscbltin.c
71
int fd;
bin/sh/miscbltin.c
86
fdctx_init(int fd, struct fdctx *fdc)
bin/sh/miscbltin.c
91
cur = lseek(fd, 0, SEEK_CUR);
bin/sh/miscbltin.c
93
.fd = fd,
bin/sh/output.c
222
} else if (dest->fd == MEM_OUT) {
bin/sh/output.c
249
if (dest->buf == NULL || dest->nextc == dest->buf || dest->fd < 0)
bin/sh/output.c
251
if (xwrite(dest->fd, dest->buf, dest->nextc - dest->buf) < 0) {
bin/sh/output.c
357
xwrite(int fd, const char *buf, int nbytes)
bin/sh/output.c
366
i = write(fd, buf, n);
bin/sh/output.c
387
pfd.fd = fd;
bin/sh/output.h
49
short fd;
bin/sh/parser.c
1034
char fd = *out;
bin/sh/parser.c
1039
np->nfile.fd = 1;
bin/sh/parser.c
1052
np->nfile.fd = 0;
bin/sh/parser.c
1057
np->nfile.fd = 0;
bin/sh/parser.c
1077
if (fd != '\0')
bin/sh/parser.c
1078
np->nfile.fd = digit_val(fd);
bin/sh/pregenerated/nodes.c
295
new->nfile.fd = n->nfile.fd;
bin/sh/pregenerated/nodes.c
302
new->ndup.fd = n->ndup.fd;
bin/sh/pregenerated/nodes.c
308
new->nhere.fd = n->nhere.fd;
bin/sh/pregenerated/nodes.h
104
int fd;
bin/sh/pregenerated/nodes.h
113
int fd;
bin/sh/pregenerated/nodes.h
122
int fd;
bin/sh/redir.c
116
int fd;
bin/sh/redir.c
137
fd = n->nfile.fd;
bin/sh/redir.c
138
if (fd == 0)
bin/sh/redir.c
141
n->ndup.dupfd == fd)
bin/sh/redir.c
144
if ((flags & REDIR_PUSH) && sv->renamed[fd] == EMPTY) {
bin/sh/redir.c
146
if ((i = fcntl(fd, F_DUPFD_CLOEXEC_MAYBE, 10)) == -1) {
bin/sh/redir.c
153
error("%d: %s", fd, strerror(errno));
bin/sh/redir.c
162
sv->renamed[fd] = i;
bin/sh/redir.c
181
int fd = redir->nfile.fd;
bin/sh/redir.c
186
memory[fd] = 0;
bin/sh/redir.c
232
memory[fd] = 1;
bin/sh/redir.c
234
if (dup2(redir->ndup.dupfd, fd) < 0)
bin/sh/redir.c
239
close(fd);
bin/sh/redir.c
249
if (f != fd) {
bin/sh/redir.c
250
if (dup2(f, fd) == -1) {
bin/sh/redir.c
253
error("%d: %s", fd, strerror(e));
bin/sh/show.c
153
if (np->nfile.fd != dftfd)
bin/sh/show.c
154
fprintf(fp, "%d", np->nfile.fd);
bin/stty/key.c
194
ioctl(ip->fd, TIOCEXT, &tmp);
bin/stty/key.c
197
ioctl(ip->fd, TIOCEXT, &tmp);
bin/stty/key.c
287
if (ioctl(ip->fd, TIOCSETD, &tmp) < 0)
bin/stty/stty.c
137
if (i.set && tcsetattr(i.fd, 0, &i.t) < 0)
bin/stty/stty.c
139
if (i.wset && ioctl(i.fd, TIOCSWINSZ, &i.win) < 0)
bin/stty/stty.c
56
i.fd = STDIN_FILENO;
bin/stty/stty.c
70
if ((i.fd = open(optarg, O_RDONLY | O_NONBLOCK)) < 0)
bin/stty/stty.c
84
if (tcgetattr(i.fd, &i.t) < 0)
bin/stty/stty.c
86
if (ioctl(i.fd, TIOCGETD, &i.ldisc) < 0)
bin/stty/stty.c
88
if (ioctl(i.fd, TIOCGWINSZ, &i.win) < 0)
bin/stty/stty.h
38
int fd; /* file descriptor */
crypto/libressl/apps/nc/atomicio.c
39
atomicio(ssize_t (*f) (int, void *, size_t), int fd, void *_s, size_t n)
crypto/libressl/apps/nc/atomicio.c
46
pfd.fd = fd;
crypto/libressl/apps/nc/atomicio.c
49
res = (f) (fd, s + pos, n - pos);
crypto/libressl/apps/nc/netcat.c
1048
pfd.fd = s;
crypto/libressl/apps/nc/netcat.c
1160
pfd[POLL_STDIN].fd = stdin_fd;
crypto/libressl/apps/nc/netcat.c
1164
pfd[POLL_NETOUT].fd = net_fd;
crypto/libressl/apps/nc/netcat.c
1168
pfd[POLL_NETIN].fd = net_fd;
crypto/libressl/apps/nc/netcat.c
1172
pfd[POLL_STDOUT].fd = stdout_fd;
crypto/libressl/apps/nc/netcat.c
1177
if (pfd[POLL_STDIN].fd == -1 && pfd[POLL_NETIN].fd == -1 &&
crypto/libressl/apps/nc/netcat.c
1181
if (pfd[POLL_NETOUT].fd == -1 && pfd[POLL_STDOUT].fd == -1)
crypto/libressl/apps/nc/netcat.c
1184
if (lflag && pfd[POLL_NETIN].fd == -1 &&
crypto/libressl/apps/nc/netcat.c
1208
pfd[n].fd = -1;
crypto/libressl/apps/nc/netcat.c
1215
pfd[POLL_STDIN].fd = -1;
crypto/libressl/apps/nc/netcat.c
1220
pfd[POLL_NETIN].fd = -1;
crypto/libressl/apps/nc/netcat.c
1224
shutdown(pfd[POLL_NETOUT].fd, SHUT_WR);
crypto/libressl/apps/nc/netcat.c
1225
pfd[POLL_NETOUT].fd = -1;
crypto/libressl/apps/nc/netcat.c
1229
pfd[POLL_STDOUT].fd = -1;
crypto/libressl/apps/nc/netcat.c
1231
if (pfd[POLL_NETOUT].fd == -1)
crypto/libressl/apps/nc/netcat.c
1232
pfd[POLL_STDIN].fd = -1;
crypto/libressl/apps/nc/netcat.c
1234
if (pfd[POLL_STDOUT].fd == -1) {
crypto/libressl/apps/nc/netcat.c
1235
if (pfd[POLL_NETIN].fd != -1)
crypto/libressl/apps/nc/netcat.c
1236
shutdown(pfd[POLL_NETIN].fd, SHUT_RD);
crypto/libressl/apps/nc/netcat.c
1237
pfd[POLL_NETIN].fd = -1;
crypto/libressl/apps/nc/netcat.c
1242
ret = fillbuf(pfd[POLL_STDIN].fd, stdinbuf,
crypto/libressl/apps/nc/netcat.c
1249
pfd[POLL_STDIN].fd = -1;
crypto/libressl/apps/nc/netcat.c
1259
ret = drainbuf(pfd[POLL_NETOUT].fd, stdinbuf,
crypto/libressl/apps/nc/netcat.c
1266
pfd[POLL_NETOUT].fd = -1;
crypto/libressl/apps/nc/netcat.c
1276
ret = fillbuf(pfd[POLL_NETIN].fd, netinbuf,
crypto/libressl/apps/nc/netcat.c
1283
pfd[POLL_NETIN].fd = -1;
crypto/libressl/apps/nc/netcat.c
1286
shutdown(pfd[POLL_NETIN].fd, SHUT_RD);
crypto/libressl/apps/nc/netcat.c
1287
pfd[POLL_NETIN].fd = -1;
crypto/libressl/apps/nc/netcat.c
1290
if (pfd[POLL_NETIN].fd != -1)
crypto/libressl/apps/nc/netcat.c
1291
shutdown(pfd[POLL_NETIN].fd, SHUT_RD);
crypto/libressl/apps/nc/netcat.c
1292
pfd[POLL_NETIN].fd = -1;
crypto/libressl/apps/nc/netcat.c
1293
pfd[POLL_STDIN].fd = -1;
crypto/libressl/apps/nc/netcat.c
1303
atelnet(pfd[POLL_NETIN].fd, netinbuf,
crypto/libressl/apps/nc/netcat.c
1308
ret = drainbuf(pfd[POLL_STDOUT].fd, netinbuf,
crypto/libressl/apps/nc/netcat.c
1315
pfd[POLL_STDOUT].fd = -1;
crypto/libressl/apps/nc/netcat.c
1325
if (pfd[POLL_STDIN].fd == -1 && stdinbufpos == 0) {
crypto/libressl/apps/nc/netcat.c
1326
if (pfd[POLL_NETOUT].fd != -1 && Nflag)
crypto/libressl/apps/nc/netcat.c
1327
shutdown(pfd[POLL_NETOUT].fd, SHUT_WR);
crypto/libressl/apps/nc/netcat.c
1328
pfd[POLL_NETOUT].fd = -1;
crypto/libressl/apps/nc/netcat.c
1331
if (pfd[POLL_NETIN].fd == -1 && netinbufpos == 0) {
crypto/libressl/apps/nc/netcat.c
1332
pfd[POLL_STDOUT].fd = -1;
crypto/libressl/apps/nc/netcat.c
1338
drainbuf(int fd, unsigned char *buf, size_t *bufpos, struct tls *tls)
crypto/libressl/apps/nc/netcat.c
1348
n = write(fd, buf, *bufpos);
crypto/libressl/apps/nc/netcat.c
1364
fillbuf(int fd, unsigned char *buf, size_t *bufpos, struct tls *tls)
crypto/libressl/apps/nc/netcat.c
1374
n = read(fd, buf + *bufpos, num);
crypto/libressl/apps/nc/netcat.c
1425
pfd.fd = STDOUT_FILENO;
crypto/libressl/apps/nc/netcat.c
821
pfd.fd = s;
crypto/libressl/apps/nc/socks.c
91
proxy_read_line(int fd, char *buf, size_t bufsz)
crypto/libressl/apps/nc/socks.c
98
if (atomicio(read, fd, buf + off, 1) != 1)
crypto/libressl/apps/openssl/ocsp.c
1414
int fd;
crypto/libressl/apps/openssl/ocsp.c
1431
if (BIO_get_fd(cbio, &fd) < 0) {
crypto/libressl/apps/openssl/ocsp.c
1436
pfd[0].fd = fd;
crypto/libressl/apps/openssl/ocsp.c
1474
pfd[0].fd = fd;
crypto/libressl/apps/openssl/s_client.c
1394
pfd[0].fd = -1;
crypto/libressl/apps/openssl/s_client.c
1395
pfd[1].fd = -1;
crypto/libressl/apps/openssl/s_client.c
1399
pfd[0].fd = fileno(stdin);
crypto/libressl/apps/openssl/s_client.c
1403
pfd[1].fd = fileno(stdout);
crypto/libressl/apps/openssl/s_client.c
1408
pfd[2].fd = SSL_get_fd(con);
crypto/libressl/apps/openssl/s_server.c
1634
pfd[0].fd = fileno(stdin);
crypto/libressl/apps/openssl/s_server.c
1636
pfd[1].fd = s;
crypto/libressl/apps/openssl/s_time.c
360
pfd[0].fd = SSL_get_fd(scon);
crypto/libressl/apps/openssl/speed.c
2043
int fd[2];
crypto/libressl/apps/openssl/speed.c
2054
if (pipe(fd) == -1) {
crypto/libressl/apps/openssl/speed.c
2061
close(fd[1]);
crypto/libressl/apps/openssl/speed.c
2062
fds[n] = fd[0];
crypto/libressl/apps/openssl/speed.c
2064
close(fd[0]);
crypto/libressl/apps/openssl/speed.c
2066
if (dup(fd[1]) == -1) {
crypto/libressl/apps/openssl/speed.c
2070
close(fd[1]);
crypto/libressl/crypto/bio/b_sock.c
110
BIO_socket_ioctl(int fd, long type, void *arg)
crypto/libressl/crypto/bio/b_sock.c
114
ret = ioctl(fd, type, arg);
crypto/libressl/crypto/bio/bss_dgram.c
124
BIO_new_dgram(int fd, int close_flag)
crypto/libressl/crypto/bio/bss_dgram.c
131
BIO_set_fd(ret, fd, close_flag);
crypto/libressl/crypto/bio/bss_fd.c
104
BIO_set_fd(ret, fd, close_flag);
crypto/libressl/crypto/bio/bss_fd.c
98
BIO_new_fd(int fd, int close_flag)
crypto/libressl/crypto/bio/bss_sock.c
103
BIO_set_fd(ret, fd, close_flag);
crypto/libressl/crypto/bio/bss_sock.c
96
BIO_new_socket(int fd, int close_flag)
crypto/libressl/include/openssl/bio.h
430
#define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd)
crypto/libressl/include/openssl/bio.h
642
int BIO_socket_ioctl(int fd, long type, void *arg);
crypto/libressl/include/openssl/bio.h
643
int BIO_socket_nbio(int fd, int mode);
crypto/libressl/include/openssl/bio.h
653
BIO *BIO_new_dgram(int fd, int close_flag);
crypto/libressl/include/openssl/bio.h
654
BIO *BIO_new_fd(int fd, int close_flag);
crypto/libressl/include/openssl/des.h
181
int DES_enc_read(int fd,void *buf,int len,DES_key_schedule *sched,
crypto/libressl/include/openssl/des.h
183
int DES_enc_write(int fd,const void *buf,int len,DES_key_schedule *sched,
crypto/libressl/include/openssl/ssl.h
1161
int SSL_set_fd(SSL *s, int fd);
crypto/libressl/include/openssl/ssl.h
1162
int SSL_set_rfd(SSL *s, int fd);
crypto/libressl/include/openssl/ssl.h
1163
int SSL_set_wfd(SSL *s, int fd);
crypto/libressl/ssl/ssl_lib.c
664
SSL_set_fd(SSL *s, int fd)
crypto/libressl/ssl/ssl_lib.c
675
BIO_set_fd(bio, fd, BIO_NOCLOSE);
crypto/libressl/ssl/ssl_lib.c
683
SSL_set_wfd(SSL *s, int fd)
crypto/libressl/ssl/ssl_lib.c
689
|| ((int)BIO_get_fd(s->rbio, NULL) != fd)) {
crypto/libressl/ssl/ssl_lib.c
696
BIO_set_fd(bio, fd, BIO_NOCLOSE);
crypto/libressl/ssl/ssl_lib.c
706
SSL_set_rfd(SSL *s, int fd)
crypto/libressl/ssl/ssl_lib.c
712
|| ((int)BIO_get_fd(s->wbio, NULL) != fd)) {
crypto/libressl/ssl/ssl_lib.c
719
BIO_set_fd(bio, fd, BIO_NOCLOSE);
crypto/libressl/tls/tls_config.c
44
int fd = -1;
crypto/libressl/tls/tls_config.c
51
if ((fd = open(filename, O_RDONLY)) == -1) {
crypto/libressl/tls/tls_config.c
56
if (fstat(fd, &st) != 0) {
crypto/libressl/tls/tls_config.c
69
n = read(fd, *buf, *len);
crypto/libressl/tls/tls_config.c
75
close(fd);
crypto/libressl/tls/tls_config.c
79
if (fd != -1)
crypto/libressl/tls/tls_config.c
80
close(fd);
crypto/libressl/tls/tls_util.c
159
int fd = -1;
crypto/libressl/tls/tls_util.c
164
if ((fd = open(name, O_RDONLY)) == -1)
crypto/libressl/tls/tls_util.c
169
if (fstat(fd, &st) != 0)
crypto/libressl/tls/tls_util.c
176
n = read(fd, buf, size);
crypto/libressl/tls/tls_util.c
179
close(fd);
crypto/libressl/tls/tls_util.c
184
if ((fp = fdopen(fd, "r")) == NULL)
crypto/libressl/tls/tls_util.c
186
fd = -1;
crypto/libressl/tls/tls_util.c
212
if (fd != -1)
crypto/libressl/tls/tls_util.c
213
close(fd);
crypto/openssh/atomicio.c
105
atomiciov6(ssize_t (*f) (int, const struct iovec *, int), int fd,
crypto/openssh/atomicio.c
121
pfd.fd = fd;
crypto/openssh/atomicio.c
128
res = (f) (fd, iov, iovcnt);
crypto/openssh/atomicio.c
175
atomiciov(ssize_t (*f) (int, const struct iovec *, int), int fd,
crypto/openssh/atomicio.c
178
return atomiciov6(f, fd, _iov, iovcnt, NULL, NULL);
crypto/openssh/atomicio.c
51
atomicio6(ssize_t (*f) (int, void *, size_t), int fd, void *_s, size_t n,
crypto/openssh/atomicio.c
59
pfd.fd = fd;
crypto/openssh/atomicio.c
66
res = (f) (fd, s + pos, n - pos);
crypto/openssh/atomicio.c
96
atomicio(ssize_t (*f) (int, void *, size_t), int fd, void *_s, size_t n)
crypto/openssh/atomicio.c
98
return atomicio6(f, fd, _s, n, NULL, NULL);
crypto/openssh/atomicio.h
38
atomicio6(ssize_t (*f) (int, void *, size_t), int fd, void *_s, size_t n,
crypto/openssh/atomicio.h
48
atomiciov6(ssize_t (*f) (int, const struct iovec *, int), int fd,
crypto/openssh/auth-rhosts.c
64
int fd;
crypto/openssh/auth-rhosts.c
68
if ((fd = open(filename, O_RDONLY|O_NONBLOCK)) == -1)
crypto/openssh/auth-rhosts.c
70
if (fstat(fd, &st) == -1) {
crypto/openssh/auth-rhosts.c
71
close(fd);
crypto/openssh/auth-rhosts.c
77
close(fd);
crypto/openssh/auth-rhosts.c
80
unset_nonblock(fd);
crypto/openssh/auth-rhosts.c
81
if ((f = fdopen(fd, "r")) == NULL) {
crypto/openssh/auth-rhosts.c
82
close(fd);
crypto/openssh/auth2-pubkeyfile.c
447
int fd;
crypto/openssh/auth2-pubkeyfile.c
450
if ((fd = open(file, O_RDONLY|O_NONBLOCK)) == -1) {
crypto/openssh/auth2-pubkeyfile.c
461
if (fstat(fd, &st) == -1) {
crypto/openssh/auth2-pubkeyfile.c
462
close(fd);
crypto/openssh/auth2-pubkeyfile.c
468
close(fd);
crypto/openssh/auth2-pubkeyfile.c
471
unset_nonblock(fd);
crypto/openssh/auth2-pubkeyfile.c
472
if ((f = fdopen(fd, "r")) == NULL) {
crypto/openssh/auth2-pubkeyfile.c
473
close(fd);
crypto/openssh/auth2.c
111
int fd;
crypto/openssh/auth2.c
113
if ((fd = open(options.banner, O_RDONLY)) == -1)
crypto/openssh/auth2.c
115
if (fstat(fd, &st) == -1) {
crypto/openssh/auth2.c
116
close(fd);
crypto/openssh/auth2.c
120
close(fd);
crypto/openssh/auth2.c
126
n = atomicio(read, fd, banner, len);
crypto/openssh/auth2.c
127
close(fd);
crypto/openssh/authfile.c
121
int fd, r;
crypto/openssh/authfile.c
128
if ((fd = open(filename, O_RDONLY)) == -1)
crypto/openssh/authfile.c
131
r = sshkey_perm_ok(fd, filename);
crypto/openssh/authfile.c
135
r = sshkey_load_private_type_fd(fd, type, passphrase, keyp, commentp);
crypto/openssh/authfile.c
139
close(fd);
crypto/openssh/authfile.c
152
sshkey_load_private_type_fd(int fd, int type, const char *passphrase,
crypto/openssh/authfile.c
160
if ((r = sshbuf_load_fd(fd, &buffer)) != 0 ||
crypto/openssh/authfile.c
178
int r, fd;
crypto/openssh/authfile.c
183
if ((fd = open(filename, O_RDONLY)) == -1)
crypto/openssh/authfile.c
185
if ((r = sshbuf_load_fd(fd, &buffer)) != 0 ||
crypto/openssh/authfile.c
198
close(fd);
crypto/openssh/authfile.c
498
int fd, oerrno;
crypto/openssh/authfile.c
502
if ((fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0644)) == -1)
crypto/openssh/authfile.c
504
if ((f = fdopen(fd, "w")) == NULL) {
crypto/openssh/authfile.c
506
close(fd);
crypto/openssh/authfile.c
90
sshkey_perm_ok(int fd, const char *filename)
crypto/openssh/authfile.c
94
if (fstat(fd, &st) == -1)
crypto/openssh/authfile.h
45
int sshkey_load_private_type_fd(int fd, int type, const char *passphrase,
crypto/openssh/canohost.c
137
get_local_name(int fd)
crypto/openssh/canohost.c
142
if ((host = get_socket_address(fd, 0, NI_NAMEREQD)) != NULL)
crypto/openssh/channels.c
2683
pollfd_offset, pfd->fd, pfd->events, pfd->revents);
crypto/openssh/channels.c
2735
pfd[p].fd = c->rfd;
crypto/openssh/channels.c
2749
pfd[p].fd = c->wfd;
crypto/openssh/channels.c
2765
pfd[p].fd = c->efd;
crypto/openssh/channels.c
2781
pfd[p].fd = c->sock;
crypto/openssh/channels.c
2833
fd_ready(Channel *c, int p, struct pollfd *pfds, u_int npfd, int fd,
crypto/openssh/channels.c
2838
if (fd == -1)
crypto/openssh/channels.c
2843
if (pfd->fd != fd) {
crypto/openssh/channels.c
2845
"r%d w%d e%d s%d", c->self, what, fd, p, pfd->fd,
crypto/openssh/channels.c
2850
c->self, what, p, pfd->fd, c->rfd, c->wfd, c->efd, c->sock);
crypto/openssh/channels.c
2873
p, pfd[p].fd, pfd[p].revents);
crypto/openssh/channels.c
546
int ret, fd = *fdp;
crypto/openssh/channels.c
548
if (fd == -1)
crypto/openssh/channels.c
587
ret = close(fd);
crypto/openssh/clientloop.c
1847
int r, fd;
crypto/openssh/clientloop.c
1856
if ((fd = tun_open(local_tun, tun_mode, &ifname)) == -1) {
crypto/openssh/clientloop.c
1862
c = channel_new(ssh, "tun-connection", SSH_CHANNEL_OPENING, fd, fd, -1,
crypto/openssh/clientloop.c
711
(*pfdp)[0].fd = connection_in;
crypto/openssh/clientloop.c
713
(*pfdp)[1].fd = connection_out;
crypto/openssh/hostfile.c
598
int r, fd, oerrno = 0;
crypto/openssh/hostfile.c
629
if ((fd = mkstemp(temp)) == -1) {
crypto/openssh/hostfile.c
635
if ((ctx.out = fdopen(fd, "w")) == NULL) {
crypto/openssh/hostfile.c
637
close(fd);
crypto/openssh/log.c
309
int fd;
crypto/openssh/log.c
319
if ((fd = open(logfile, O_WRONLY|O_CREAT|O_APPEND, 0600)) == -1) {
crypto/openssh/log.c
324
log_stderr_fd = fd;
crypto/openssh/loginrec.c
1096
int fd, ret = 1;
crypto/openssh/loginrec.c
1098
if ((fd = open(WTMP_FILE, O_WRONLY|O_APPEND, 0)) < 0) {
crypto/openssh/loginrec.c
1103
if (fstat(fd, &buf) == 0)
crypto/openssh/loginrec.c
1104
if (atomicio(vwrite, fd, ut, sizeof(*ut)) != sizeof(*ut)) {
crypto/openssh/loginrec.c
1105
ftruncate(fd, buf.st_size);
crypto/openssh/loginrec.c
1110
close(fd);
crypto/openssh/loginrec.c
1187
int fd, found = 0;
crypto/openssh/loginrec.c
1192
if ((fd = open(WTMP_FILE, O_RDONLY)) < 0) {
crypto/openssh/loginrec.c
1197
if (fstat(fd, &st) != 0) {
crypto/openssh/loginrec.c
1200
close(fd);
crypto/openssh/loginrec.c
1205
if (lseek(fd, -(off_t)sizeof(struct utmp), SEEK_END) == -1) {
crypto/openssh/loginrec.c
1207
close(fd);
crypto/openssh/loginrec.c
1212
if (atomicio(read, fd, &ut, sizeof(ut)) != sizeof(ut)) {
crypto/openssh/loginrec.c
1215
close (fd);
crypto/openssh/loginrec.c
1240
if (lseek(fd, -(off_t)(2 * sizeof(struct utmp)), SEEK_CUR) == -1) {
crypto/openssh/loginrec.c
1242
close(fd);
crypto/openssh/loginrec.c
1248
close(fd);
crypto/openssh/loginrec.c
1268
int fd, ret = 1;
crypto/openssh/loginrec.c
1270
if ((fd = open(WTMPX_FILE, O_WRONLY|O_APPEND, 0)) < 0) {
crypto/openssh/loginrec.c
1276
if (fstat(fd, &buf) == 0)
crypto/openssh/loginrec.c
1277
if (atomicio(vwrite, fd, utx, sizeof(*utx)) != sizeof(*utx)) {
crypto/openssh/loginrec.c
1278
ftruncate(fd, buf.st_size);
crypto/openssh/loginrec.c
1283
close(fd);
crypto/openssh/loginrec.c
1352
int fd, found=0;
crypto/openssh/loginrec.c
1357
if ((fd = open(WTMPX_FILE, O_RDONLY)) < 0) {
crypto/openssh/loginrec.c
1362
if (fstat(fd, &st) != 0) {
crypto/openssh/loginrec.c
1365
close(fd);
crypto/openssh/loginrec.c
1370
if (lseek(fd, -(off_t)sizeof(struct utmpx), SEEK_END) == -1 ) {
crypto/openssh/loginrec.c
1372
close(fd);
crypto/openssh/loginrec.c
1377
if (atomicio(read, fd, &utx, sizeof(utx)) != sizeof(utx)) {
crypto/openssh/loginrec.c
1380
close (fd);
crypto/openssh/loginrec.c
1401
if (lseek(fd, -(off_t)(2 * sizeof(struct utmpx)), SEEK_CUR) == -1) {
crypto/openssh/loginrec.c
1402
close(fd);
crypto/openssh/loginrec.c
1407
close(fd);
crypto/openssh/loginrec.c
1478
lastlog_openseek(struct logininfo *li, int *fd, int filemode)
crypto/openssh/loginrec.c
1500
*fd = open(lastlog_file, filemode, 0600);
crypto/openssh/loginrec.c
1501
if (*fd < 0) {
crypto/openssh/loginrec.c
1511
if (lseek(*fd, offset, SEEK_SET) != offset) {
crypto/openssh/loginrec.c
1514
close(*fd);
crypto/openssh/loginrec.c
1540
int fd;
crypto/openssh/loginrec.c
1551
if (!lastlog_openseek(li, &fd, O_RDWR|O_CREAT))
crypto/openssh/loginrec.c
1555
if (atomicio(vwrite, fd, &last, sizeof(last)) != sizeof(last)) {
crypto/openssh/loginrec.c
1556
close(fd);
crypto/openssh/loginrec.c
1562
close(fd);
crypto/openssh/loginrec.c
1593
int fd, ret;
crypto/openssh/loginrec.c
1595
if (!lastlog_openseek(li, &fd, O_RDONLY))
crypto/openssh/loginrec.c
1598
ret = atomicio(read, fd, &last, sizeof(last));
crypto/openssh/loginrec.c
1599
close(fd);
crypto/openssh/loginrec.c
1665
int fd;
crypto/openssh/loginrec.c
1676
if ((fd = open(_PATH_BTMP, O_WRONLY | O_APPEND)) < 0) {
crypto/openssh/loginrec.c
1681
if (fstat(fd, &fst) < 0) {
crypto/openssh/loginrec.c
1723
if (atomicio(vwrite, fd, &ut, sizeof(ut)) != sizeof(ut))
crypto/openssh/loginrec.c
1728
close(fd);
crypto/openssh/loginrec.c
846
register int fd;
crypto/openssh/loginrec.c
873
if (tty > 0 && (fd = open(UTMP_FILE, O_RDWR|O_CREAT, 0644)) >= 0) {
crypto/openssh/loginrec.c
877
if ((ret = lseek(fd, pos, SEEK_SET)) == -1) {
crypto/openssh/loginrec.c
879
close(fd);
crypto/openssh/loginrec.c
885
close(fd);
crypto/openssh/loginrec.c
893
if (atomicio(read, fd, &old_ut, sizeof(old_ut)) == sizeof(old_ut) &&
crypto/openssh/loginrec.c
899
if ((ret = lseek(fd, pos, SEEK_SET)) == -1) {
crypto/openssh/loginrec.c
901
close(fd);
crypto/openssh/loginrec.c
907
close(fd);
crypto/openssh/loginrec.c
910
if (atomicio(vwrite, fd, ut, sizeof(*ut)) != sizeof(*ut)) {
crypto/openssh/loginrec.c
913
close(fd);
crypto/openssh/loginrec.c
917
close(fd);
crypto/openssh/misc.c
112
set_nonblock(int fd)
crypto/openssh/misc.c
116
val = fcntl(fd, F_GETFL);
crypto/openssh/misc.c
118
error("fcntl(%d, F_GETFL): %s", fd, strerror(errno));
crypto/openssh/misc.c
122
debug3("fd %d is O_NONBLOCK", fd);
crypto/openssh/misc.c
125
debug2("fd %d setting O_NONBLOCK", fd);
crypto/openssh/misc.c
127
if (fcntl(fd, F_SETFL, val) == -1) {
crypto/openssh/misc.c
128
debug("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd,
crypto/openssh/misc.c
136
unset_nonblock(int fd)
crypto/openssh/misc.c
140
val = fcntl(fd, F_GETFL);
crypto/openssh/misc.c
142
error("fcntl(%d, F_GETFL): %s", fd, strerror(errno));
crypto/openssh/misc.c
1439
int fd = -1, sock;
crypto/openssh/misc.c
1451
fd = open(name, O_RDWR);
crypto/openssh/misc.c
1456
if ((fd = open(name, O_RDWR)) >= 0)
crypto/openssh/misc.c
146
debug3("fd %d is not O_NONBLOCK", fd);
crypto/openssh/misc.c
1464
if (fd == -1) {
crypto/openssh/misc.c
1469
debug_f("%s mode %d fd %d", name, mode, fd);
crypto/openssh/misc.c
149
debug("fd %d clearing O_NONBLOCK", fd);
crypto/openssh/misc.c
1495
return fd;
crypto/openssh/misc.c
1498
if (fd >= 0)
crypto/openssh/misc.c
1499
close(fd);
crypto/openssh/misc.c
151
if (fcntl(fd, F_SETFL, val) == -1) {
crypto/openssh/misc.c
153
fd, strerror(errno));
crypto/openssh/misc.c
169
set_nodelay(int fd)
crypto/openssh/misc.c
175
if (getsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, &optlen) == -1) {
crypto/openssh/misc.c
180
debug2("fd %d is TCP_NODELAY", fd);
crypto/openssh/misc.c
184
debug2("fd %d setting TCP_NODELAY", fd);
crypto/openssh/misc.c
185
if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof opt) == -1)
crypto/openssh/misc.c
191
set_reuseaddr(int fd)
crypto/openssh/misc.c
195
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) {
crypto/openssh/misc.c
196
error("setsockopt SO_REUSEADDR fd %d: %s", fd, strerror(errno));
crypto/openssh/misc.c
2024
int fd;
crypto/openssh/misc.c
2026
if ((fd = open(_PATH_TTY, O_RDONLY | O_NOCTTY)) >= 0) {
crypto/openssh/misc.c
2027
close(fd);
crypto/openssh/misc.c
204
get_rdomain(int fd)
crypto/openssh/misc.c
207
return sys_get_rdomain(fd);
crypto/openssh/misc.c
213
if (getsockopt(fd, SOL_SOCKET, SO_RTABLE, &rtable, &len) == -1) {
crypto/openssh/misc.c
215
fd, strerror(errno));
crypto/openssh/misc.c
226
set_rdomain(int fd, const char *name)
crypto/openssh/misc.c
229
return sys_set_rdomain(fd, name);
crypto/openssh/misc.c
2297
safe_path_fd(int fd, const char *file, struct passwd *pw,
crypto/openssh/misc.c
2303
if (fstat(fd, &st) == -1) {
crypto/openssh/misc.c
243
if (setsockopt(fd, SOL_SOCKET, SO_RTABLE,
crypto/openssh/misc.c
246
rtable, fd, strerror(errno));
crypto/openssh/misc.c
257
get_sock_af(int fd)
crypto/openssh/misc.c
263
if (getsockname(fd, (struct sockaddr *)&to, &tolen) == -1)
crypto/openssh/misc.c
274
set_sock_tos(int fd, int tos)
crypto/openssh/misc.c
2741
int fd, devnull, p[2], i;
crypto/openssh/misc.c
279
switch ((af = get_sock_af(fd))) {
crypto/openssh/misc.c
2837
fd = -1;
crypto/openssh/misc.c
2839
fd = p[1];
crypto/openssh/misc.c
2841
fd = devnull;
crypto/openssh/misc.c
2842
if (fd != -1 && dup2(fd, STDOUT_FILENO) == -1) {
crypto/openssh/misc.c
285
debug3_f("set socket %d IP_TOS 0x%02x", fd, tos);
crypto/openssh/misc.c
286
if (setsockopt(fd, IPPROTO_IP, IP_TOS,
crypto/openssh/misc.c
289
fd, tos, strerror(errno));
crypto/openssh/misc.c
295
debug3_f("set socket %d IPV6_TCLASS 0x%02x", fd, tos);
crypto/openssh/misc.c
296
if (setsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS,
crypto/openssh/misc.c
299
fd, tos, strerror(errno));
crypto/openssh/misc.c
3060
int fd, ret = -1;
crypto/openssh/misc.c
3066
if ((fd = open(path, O_RDONLY)) < 0) {
crypto/openssh/misc.c
3070
if (fstat(fd, &st) != 0) {
crypto/openssh/misc.c
3085
if ((m = mmap(NULL, sz, PROT_READ, MAP_PRIVATE, fd, 0)) == MAP_FAILED ||
crypto/openssh/misc.c
3099
close(fd);
crypto/openssh/misc.c
316
waitfd(int fd, int *timeoutp, short events, volatile sig_atomic_t *stop)
crypto/openssh/misc.c
325
pfd.fd = fd;
crypto/openssh/misc.c
367
waitrfd(int fd, int *timeoutp, volatile sig_atomic_t *stop) {
crypto/openssh/misc.c
368
return waitfd(fd, timeoutp, POLLIN, stop);
crypto/openssh/monitor.c
483
pfd[0].fd = pmonitor->m_sendfd;
crypto/openssh/monitor.c
485
pfd[1].fd = pmonitor->m_log_recvfd;
crypto/openssh/monitor.c
486
pfd[1].events = pfd[1].fd == -1 ? 0 : POLLIN;
crypto/openssh/monitor.c
487
if (poll(pfd, pfd[1].fd == -1 ? 1 : 2, -1) == -1) {
crypto/openssh/monitor_fdpass.c
126
int fd;
crypto/openssh/monitor_fdpass.c
135
msg.msg_accrights = (caddr_t)&fd;
crypto/openssh/monitor_fdpass.c
136
msg.msg_accrightslen = sizeof(fd);
crypto/openssh/monitor_fdpass.c
143
pfd.fd = sock;
crypto/openssh/monitor_fdpass.c
161
if (msg.msg_accrightslen != sizeof(fd)) {
crypto/openssh/monitor_fdpass.c
178
fd = (*(int *)CMSG_DATA(cmsg));
crypto/openssh/monitor_fdpass.c
180
return fd;
crypto/openssh/monitor_fdpass.c
52
mm_send_fd(int sock, int fd)
crypto/openssh/monitor_fdpass.c
70
msg.msg_accrights = (caddr_t)&fd;
crypto/openssh/monitor_fdpass.c
71
msg.msg_accrightslen = sizeof(fd);
crypto/openssh/monitor_fdpass.c
80
*(int *)CMSG_DATA(cmsg) = fd;
crypto/openssh/monitor_fdpass.c
88
pfd.fd = sock;
crypto/openssh/monitor_fdpass.c
92
debug3_f("sendmsg(%d): %s", fd, strerror(errno));
crypto/openssh/monitor_fdpass.c
96
error_f("sendmsg(%d): %s", fd, strerror(errno));
crypto/openssh/msg.c
45
ssh_msg_send(int fd, u_char type, struct sshbuf *m)
crypto/openssh/msg.c
54
if (atomicio(vwrite, fd, buf, sizeof(buf)) != sizeof(buf)) {
crypto/openssh/msg.c
58
if (atomicio(vwrite, fd, sshbuf_mutable_ptr(m), mlen) != mlen) {
crypto/openssh/msg.c
67
ssh_msg_recv(int fd, struct sshbuf *m)
crypto/openssh/msg.c
75
if (atomicio(read, fd, buf, sizeof(buf)) != sizeof(buf)) {
crypto/openssh/msg.c
90
if (atomicio(read, fd, p, msg_len) != msg_len) {
crypto/openssh/mux.c
1462
mux_client_read(int fd, struct sshbuf *b, size_t need, int timeout_ms)
crypto/openssh/mux.c
1476
len = read(fd, p + have, need - have);
crypto/openssh/mux.c
1483
if (waitrfd(fd, &timeout_ms,
crypto/openssh/mux.c
1504
mux_client_write_packet(int fd, struct sshbuf *m)
crypto/openssh/mux.c
1512
pfd.fd = fd;
crypto/openssh/mux.c
1528
len = write(fd, ptr + have, need - have);
crypto/openssh/mux.c
1558
mux_client_read_packet_timeout(int fd, struct sshbuf *m, int timeout_ms)
crypto/openssh/mux.c
1567
if (mux_client_read(fd, queue, 4, timeout_ms) != 0) {
crypto/openssh/mux.c
1576
if (mux_client_read(fd, queue, need, timeout_ms) != 0) {
crypto/openssh/mux.c
1591
mux_client_read_packet(int fd, struct sshbuf *m)
crypto/openssh/mux.c
1593
return mux_client_read_packet_timeout(fd, m, -1);
crypto/openssh/mux.c
1597
mux_client_hello_exchange(int fd, int timeout_ms)
crypto/openssh/mux.c
1610
if (mux_client_write_packet(fd, m) != 0) {
crypto/openssh/mux.c
1618
if (mux_client_read_packet_timeout(fd, m, timeout_ms) != 0) {
crypto/openssh/mux.c
1657
mux_client_request_alive(int fd)
crypto/openssh/mux.c
1672
if (mux_client_write_packet(fd, m) != 0)
crypto/openssh/mux.c
1678
if (mux_client_read_packet(fd, m) != 0) {
crypto/openssh/mux.c
1708
mux_client_request_terminate(int fd)
crypto/openssh/mux.c
1723
if (mux_client_write_packet(fd, m) != 0)
crypto/openssh/mux.c
1729
if (mux_client_read_packet(fd, m) != 0) {
crypto/openssh/mux.c
1763
mux_client_forward(int fd, int cancel_flag, u_int ftype, struct Forward *fwd)
crypto/openssh/mux.c
1804
if (mux_client_write_packet(fd, m) != 0)
crypto/openssh/mux.c
1810
if (mux_client_read_packet(fd, m) != 0) {
crypto/openssh/mux.c
1859
mux_client_forwards(int fd, int cancel_flag)
crypto/openssh/mux.c
1869
if (mux_client_forward(fd, cancel_flag,
crypto/openssh/mux.c
1876
if (mux_client_forward(fd, cancel_flag, MUX_FWD_REMOTE,
crypto/openssh/mux.c
1884
mux_client_request_session(int fd)
crypto/openssh/mux.c
1895
if ((muxserver_pid = mux_client_request_alive(fd)) == 0) {
crypto/openssh/mux.c
1941
if (mux_client_write_packet(fd, m) != 0)
crypto/openssh/mux.c
1945
if (mm_send_fd(fd, STDIN_FILENO) == -1 ||
crypto/openssh/mux.c
1946
mm_send_fd(fd, STDOUT_FILENO) == -1 ||
crypto/openssh/mux.c
1947
mm_send_fd(fd, STDERR_FILENO) == -1)
crypto/openssh/mux.c
1954
if (mux_client_read_packet(fd, m) != 0) {
crypto/openssh/mux.c
2020
if (mux_client_read_packet(fd, m) != 0)
crypto/openssh/mux.c
2054
close(fd);
crypto/openssh/mux.c
2074
mux_client_proxy(int fd)
crypto/openssh/mux.c
2086
if (mux_client_write_packet(fd, m) != 0)
crypto/openssh/mux.c
2092
if (mux_client_read_packet(fd, m) != 0) {
crypto/openssh/mux.c
2115
mux_client_request_stdio_fwd(int fd)
crypto/openssh/mux.c
2124
if ((muxserver_pid = mux_client_request_alive(fd)) == 0) {
crypto/openssh/mux.c
2143
if (mux_client_write_packet(fd, m) != 0)
crypto/openssh/mux.c
2147
if (mm_send_fd(fd, STDIN_FILENO) == -1 ||
crypto/openssh/mux.c
2148
mm_send_fd(fd, STDOUT_FILENO) == -1)
crypto/openssh/mux.c
2160
if (mux_client_read_packet(fd, m) != 0) {
crypto/openssh/mux.c
2204
if (mux_client_read_packet(fd, m) != 0) {
crypto/openssh/mux.c
2214
mux_client_request_stop_listening(int fd)
crypto/openssh/mux.c
2229
if (mux_client_write_packet(fd, m) != 0)
crypto/openssh/mux.c
2235
if (mux_client_read_packet(fd, m) != 0)
crypto/openssh/packet.c
1458
pfd.fd = state->connection_in;
crypto/openssh/packet.c
1912
ssh_packet_process_read(struct ssh *ssh, int fd)
crypto/openssh/packet.c
1918
if ((r = sshbuf_read(fd, state->input, PACKET_MAX_SIZE, &rlen)) != 0)
crypto/openssh/packet.c
2138
pfd.fd = state->connection_out;
crypto/openssh/scp.c
1398
int fd = -1, haderr, indx;
crypto/openssh/scp.c
1408
if ((fd = open(name, O_RDONLY|O_NONBLOCK)) == -1)
crypto/openssh/scp.c
1414
if (fstat(fd, &stb) == -1) {
crypto/openssh/scp.c
1422
unset_nonblock(fd);
crypto/openssh/scp.c
1454
if ((bp = allocbuf(&buffer, fd, COPY_BUFLEN)) == NULL) {
crypto/openssh/scp.c
1455
next: if (fd != -1) {
crypto/openssh/scp.c
1456
(void) close(fd);
crypto/openssh/scp.c
1457
fd = -1;
crypto/openssh/scp.c
1469
if ((nr = atomicio(read, fd,
crypto/openssh/scp.c
1487
if (fd != -1) {
crypto/openssh/scp.c
1488
if (close(fd) == -1 && !haderr)
crypto/openssh/scp.c
1490
fd = -1;
crypto/openssh/scp.c
2227
allocbuf(BUF *bp, int fd, int blksize)
crypto/openssh/scp.c
2233
if (fstat(fd, &stb) == -1) {
crypto/openssh/scp.c
736
do_times(int fd, int verb, const struct stat *sb)
crypto/openssh/scp.c
749
(void) atomicio(vwrite, fd, buf, strlen(buf));
crypto/openssh/serverloop.c
205
(*pfdp)[0].fd = connection_in;
crypto/openssh/serverloop.c
207
(*pfdp)[1].fd = connection_out;
crypto/openssh/session.c
273
int fd = -1, success = 0;
crypto/openssh/session.c
280
if ((fd = mkstemp(auth_info_file)) == -1) {
crypto/openssh/session.c
284
if (atomicio(vwrite, fd, sshbuf_mutable_ptr(info),
crypto/openssh/session.c
289
if (close(fd) != 0) {
crypto/openssh/session.c
296
if (fd != -1)
crypto/openssh/session.c
297
close(fd);
crypto/openssh/sftp-client.c
2403
pfd.fd = to->fd_in;
crypto/openssh/sftp-server.c
1037
int handle, fd, r;
crypto/openssh/sftp-server.c
1045
fd = handle_to_fd(handle);
crypto/openssh/sftp-server.c
1046
if (fd < 0)
crypto/openssh/sftp-server.c
1054
r = ftruncate(fd, a.size);
crypto/openssh/sftp-server.c
1061
r = fchmod(fd, a.perm & 07777);
crypto/openssh/sftp-server.c
1076
r = futimes(fd, attrib_to_tv(&a));
crypto/openssh/sftp-server.c
1087
r = fchown(fd, a.uid, a.gid);
crypto/openssh/sftp-server.c
1413
int r, handle, fd;
crypto/openssh/sftp-server.c
1420
if ((fd = handle_to_fd(handle)) < 0) {
crypto/openssh/sftp-server.c
1424
if (fstatvfs(fd, &st) != 0)
crypto/openssh/sftp-server.c
1452
int handle, fd, r, status = SSH2_FX_OP_UNSUPPORTED;
crypto/openssh/sftp-server.c
1458
if ((fd = handle_to_fd(handle)) < 0)
crypto/openssh/sftp-server.c
1461
r = fsync(fd);
crypto/openssh/sftp-server.c
2040
pfd[0].fd = pfd[1].fd = -1;
crypto/openssh/sftp-server.c
2050
pfd[0].fd = in;
crypto/openssh/sftp-server.c
2058
pfd[1].fd = out;
crypto/openssh/sftp-server.c
313
int fd;
crypto/openssh/sftp-server.c
338
handle_new(int use, const char *name, int fd, int flags, DIR *dirp)
crypto/openssh/sftp-server.c
355
handles[i].fd = fd;
crypto/openssh/sftp-server.c
415
return handles[handle].fd;
crypto/openssh/sftp-server.c
463
ret = close(handles[handle].fd);
crypto/openssh/sftp-server.c
747
int r, handle, fd, flags, mode, status = SSH2_FX_FAILURE;
crypto/openssh/sftp-server.c
765
fd = open(name, flags, mode);
crypto/openssh/sftp-server.c
766
if (fd == -1) {
crypto/openssh/sftp-server.c
769
handle = handle_new(HANDLE_FILE, name, fd, flags, NULL);
crypto/openssh/sftp-server.c
771
close(fd);
crypto/openssh/sftp-server.c
804
int r, handle, fd, ret, status = SSH2_FX_FAILURE;
crypto/openssh/sftp-server.c
814
if ((fd = handle_to_fd(handle)) == -1)
crypto/openssh/sftp-server.c
826
if (lseek(fd, off, SEEK_SET) == -1) {
crypto/openssh/sftp-server.c
835
} else if ((ret = read(fd, buf, len)) == -1) {
crypto/openssh/sftp-server.c
858
int r, handle, fd, ret, status;
crypto/openssh/sftp-server.c
868
fd = handle_to_fd(handle);
crypto/openssh/sftp-server.c
870
if (fd < 0)
crypto/openssh/sftp-server.c
874
lseek(fd, off, SEEK_SET) == -1) {
crypto/openssh/sftp-server.c
880
ret = write(fd, data, len);
crypto/openssh/sftp-server.c
941
int fd, r, handle, status = SSH2_FX_FAILURE;
crypto/openssh/sftp-server.c
947
fd = handle_to_fd(handle);
crypto/openssh/sftp-server.c
948
if (fd >= 0) {
crypto/openssh/sftp-server.c
949
r = fstat(fd, &st);
crypto/openssh/ssh-add.c
254
int r, fd, ret = -1;
crypto/openssh/ssh-add.c
261
fd = STDIN_FILENO;
crypto/openssh/ssh-add.c
263
} else if ((fd = open(filename, O_RDONLY)) == -1) {
crypto/openssh/ssh-add.c
272
if (fd != STDIN_FILENO) {
crypto/openssh/ssh-add.c
273
if (sshkey_perm_ok(fd, filename) != 0) {
crypto/openssh/ssh-add.c
274
close(fd);
crypto/openssh/ssh-add.c
278
if ((r = sshbuf_load_fd(fd, &keyblob)) != 0) {
crypto/openssh/ssh-add.c
282
close(fd);
crypto/openssh/ssh-add.c
285
close(fd);
crypto/openssh/ssh-agent.c
126
int fd;
crypto/openssh/ssh-agent.c
1811
socknum, e->fd, msg_len, AGENT_MAX_LEN);
crypto/openssh/ssh-agent.c
1829
debug_f("socket %u (fd=%d) type %d", socknum, e->fd, type);
crypto/openssh/ssh-agent.c
1894
new_socket(sock_type type, int fd)
crypto/openssh/ssh-agent.c
1900
set_nonblock(fd);
crypto/openssh/ssh-agent.c
1902
if (fd > max_fd)
crypto/openssh/ssh-agent.c
1903
max_fd = fd;
crypto/openssh/ssh-agent.c
1907
sockets[i].fd = fd;
crypto/openssh/ssh-agent.c
1922
sockets[old_alloc].fd = fd;
crypto/openssh/ssh-agent.c
1937
int fd;
crypto/openssh/ssh-agent.c
1940
fd = accept(sockets[socknum].fd, (struct sockaddr *)&sunaddr, &slen);
crypto/openssh/ssh-agent.c
1941
if (fd == -1) {
crypto/openssh/ssh-agent.c
1945
if (getpeereid(fd, &euid, &egid) == -1) {
crypto/openssh/ssh-agent.c
1946
error("getpeereid %d failed: %s", fd, strerror(errno));
crypto/openssh/ssh-agent.c
1947
close(fd);
crypto/openssh/ssh-agent.c
1953
close(fd);
crypto/openssh/ssh-agent.c
1956
new_socket(AUTH_CONNECTION, fd);
crypto/openssh/ssh-agent.c
1967
if ((len = read(sockets[socknum].fd, buf, sizeof(buf))) <= 0) {
crypto/openssh/ssh-agent.c
1972
socknum, sockets[socknum].fd, strerror(errno));
crypto/openssh/ssh-agent.c
1996
if ((len = write(sockets[socknum].fd,
crypto/openssh/ssh-agent.c
2003
socknum, sockets[socknum].fd, strerror(errno));
crypto/openssh/ssh-agent.c
2026
if (pfd[i].fd == sockets[socknum].fd)
crypto/openssh/ssh-agent.c
2030
error_f("no socket for fd %d", pfd[i].fd);
crypto/openssh/ssh-agent.c
206
close(e->fd);
crypto/openssh/ssh-agent.c
2102
pfd[j].fd = sockets[i].fd;
crypto/openssh/ssh-agent.c
2108
pfd[j].fd = sockets[i].fd;
crypto/openssh/ssh-agent.c
216
e->fd = -1;
crypto/openssh/ssh-agent.c
510
e->fd, i, hks->forwarded ? "FORWARD" : "AUTH",
crypto/openssh/ssh-keygen.c
1082
int i, type, fd, r;
crypto/openssh/ssh-keygen.c
1119
if ((fd = mkstemp(prv_tmp)) == -1) {
crypto/openssh/ssh-keygen.c
1124
(void)close(fd); /* just using mkstemp() to reserve a name */
crypto/openssh/ssh-keygen.c
1141
if ((fd = mkstemp(pub_tmp)) == -1) {
crypto/openssh/ssh-keygen.c
1146
(void)fchmod(fd, 0644);
crypto/openssh/ssh-keygen.c
1147
(void)close(fd);
crypto/openssh/ssh-keygen.c
1314
int r, fd, oerrno, inplace = 0;
crypto/openssh/ssh-keygen.c
1348
if ((fd = mkstemp(tmp)) == -1)
crypto/openssh/ssh-keygen.c
1350
if ((ctx.out = fdopen(fd, "w")) == NULL) {
crypto/openssh/ssh-keygen.c
1355
(void)fchmod(fd, sb.st_mode & 0644);
crypto/openssh/ssh-keygen.c
2582
sign_one(struct sshkey *signkey, const char *filename, int fd,
crypto/openssh/ssh-keygen.c
2592
if (fd == STDIN_FILENO)
crypto/openssh/ssh-keygen.c
2615
fd, sig_namespace, &sigbuf, signer, signer_ctx)) != 0) {
crypto/openssh/ssh-keygen.c
2629
if (fd == STDIN_FILENO) {
crypto/openssh/ssh-keygen.c
2721
int i, fd = -1, r, ret = -1;
crypto/openssh/ssh-keygen.c
2774
fd = STDIN_FILENO;
crypto/openssh/ssh-keygen.c
2775
else if ((fd = open(argv[i], O_RDONLY)) == -1) {
crypto/openssh/ssh-keygen.c
2780
if ((r = sign_one(signkey, argv[i], fd, sig_namespace,
crypto/openssh/ssh-keygen.c
2783
if (fd != STDIN_FILENO)
crypto/openssh/ssh-keygen.c
2784
close(fd);
crypto/openssh/ssh-keygen.c
2785
fd = -1;
crypto/openssh/ssh-keygen.c
2791
if (fd != -1 && fd != STDIN_FILENO)
crypto/openssh/ssh-keygen.c
2792
close(fd);
crypto/openssh/ssh-keyscan.c
426
read_wait[s].fd = s;
crypto/openssh/ssh-keyscan.c
448
read_wait[s].fd = -1;
crypto/openssh/ssh-keyscan.c
814
read_wait[j].fd = -1;
crypto/openssh/ssh-keysign.c
183
int r, key_fd[NUM_KEYTYPES], i, found, version = 2, fd;
crypto/openssh/ssh-keysign.c
192
if ((fd = open(_PATH_DEVNULL, O_RDWR)) < 2)
crypto/openssh/ssh-keysign.c
195
if (fd > 2)
crypto/openssh/ssh-keysign.c
196
close(fd);
crypto/openssh/ssh-keysign.c
269
if ((r = sshbuf_get_u32(b, (u_int *)&fd)) != 0)
crypto/openssh/ssh-keysign.c
271
if (fd <= STDERR_FILENO)
crypto/openssh/ssh-keysign.c
272
fatal("%s: bad fd = %d", __progname, fd);
crypto/openssh/ssh-keysign.c
273
if ((host = get_local_name(fd)) == NULL)
crypto/openssh/ssh-pkcs11-client.c
163
} else if (helper->fd == -1) {
crypto/openssh/ssh-pkcs11-client.c
169
close(helper->fd);
crypto/openssh/ssh-pkcs11-client.c
171
helper->fd = -1;
crypto/openssh/ssh-pkcs11-client.c
184
send_msg(int fd, struct sshbuf *m)
crypto/openssh/ssh-pkcs11-client.c
190
if (fd == -1)
crypto/openssh/ssh-pkcs11-client.c
193
if (atomicio(vwrite, fd, buf, 4) != 4 ||
crypto/openssh/ssh-pkcs11-client.c
194
atomicio(vwrite, fd, sshbuf_mutable_ptr(m),
crypto/openssh/ssh-pkcs11-client.c
202
recv_msg(int fd, struct sshbuf *m)
crypto/openssh/ssh-pkcs11-client.c
209
if (fd == -1)
crypto/openssh/ssh-pkcs11-client.c
211
if ((len = atomicio(read, fd, buf, 4)) != 4) {
crypto/openssh/ssh-pkcs11-client.c
223
if (atomicio(read, fd, buf, l) != l) {
crypto/openssh/ssh-pkcs11-client.c
262
if ((helper = helper_by_rsa(rsa)) == NULL || helper->fd == -1)
crypto/openssh/ssh-pkcs11-client.c
286
send_msg(helper->fd, msg);
crypto/openssh/ssh-pkcs11-client.c
289
if (recv_msg(helper->fd, msg) == SSH2_AGENT_SIGN_RESPONSE) {
crypto/openssh/ssh-pkcs11-client.c
339
if ((helper = helper_by_ec(ec)) == NULL || helper->fd == -1)
crypto/openssh/ssh-pkcs11-client.c
369
send_msg(helper->fd, msg);
crypto/openssh/ssh-pkcs11-client.c
372
if (recv_msg(helper->fd, msg) == SSH2_AGENT_SIGN_RESPONSE) {
crypto/openssh/ssh-pkcs11-client.c
453
helper->fd == -1)
crypto/openssh/ssh-pkcs11-client.c
463
helper->fd == -1)
crypto/openssh/ssh-pkcs11-client.c
573
helper->fd = pair[0];
crypto/openssh/ssh-pkcs11-client.c
577
helper->path, helper->fd, (long)helper->pid);
crypto/openssh/ssh-pkcs11-client.c
607
send_msg(helper->fd, msg);
crypto/openssh/ssh-pkcs11-client.c
610
type = recv_msg(helper->fd, msg);
crypto/openssh/ssh-pkcs11-client.c
65
int fd;
crypto/openssh/ssh-pkcs11-client.c
82
helpers[i]->fd == -1)
crypto/openssh/ssh-pkcs11-helper.c
364
pfd[0].fd = in;
crypto/openssh/ssh-pkcs11-helper.c
365
pfd[1].fd = out;
crypto/openssh/ssh-sk-client.c
142
int oerrno, fd, r2, ll, r = SSH_ERR_INTERNAL_ERROR;
crypto/openssh/ssh-sk-client.c
150
if ((r = start_helper(&fd, &pid, &osigchld)) != 0)
crypto/openssh/ssh-sk-client.c
166
if ((r = ssh_msg_send(fd, SSH_SK_HELPER_VERSION, req)) != 0) {
crypto/openssh/ssh-sk-client.c
170
if ((r = ssh_msg_recv(fd, resp)) != 0) {
crypto/openssh/ssh-sk-client.c
210
close(fd);
crypto/openssh/sshbuf-io.c
103
int fd, oerrno;
crypto/openssh/sshbuf-io.c
105
if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1)
crypto/openssh/sshbuf-io.c
107
if (atomicio(vwrite, fd, sshbuf_mutable_ptr(buf),
crypto/openssh/sshbuf-io.c
108
sshbuf_len(buf)) != sshbuf_len(buf) || close(fd) != 0) {
crypto/openssh/sshbuf-io.c
110
close(fd);
crypto/openssh/sshbuf-io.c
34
sshbuf_load_fd(int fd, struct sshbuf **blobp)
crypto/openssh/sshbuf-io.c
44
if (fstat(fd, &st) == -1)
crypto/openssh/sshbuf-io.c
52
if ((len = atomicio(read, fd, buf, sizeof(buf))) == 0) {
crypto/openssh/sshbuf-io.c
83
int r, fd, oerrno;
crypto/openssh/sshbuf-io.c
86
if ((fd = open(path, O_RDONLY)) == -1)
crypto/openssh/sshbuf-io.c
88
if ((r = sshbuf_load_fd(fd, bufp)) != 0)
crypto/openssh/sshbuf-io.c
94
close(fd);
crypto/openssh/sshbuf-misc.c
275
sshbuf_read(int fd, struct sshbuf *buf, size_t maxlen, size_t *rlen)
crypto/openssh/sshbuf-misc.c
286
rr = read(fd, d, maxlen);
crypto/openssh/sshd-session.c
734
recv_rexec_state(int fd, struct sshbuf *conf, uint64_t *timing_secretp)
crypto/openssh/sshd-session.c
742
debug3_f("entering fd = %d", fd);
crypto/openssh/sshd-session.c
746
if (ssh_msg_recv(fd, m) == -1)
crypto/openssh/sshd.c
677
send_rexec_state(int fd, struct sshbuf *conf)
crypto/openssh/sshd.c
683
debug3_f("entering fd = %d config len %zu", fd,
crypto/openssh/sshd.c
723
if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &sz, sizeof sz) == -1)
crypto/openssh/sshd.c
726
if (ssh_msg_send(fd, 0, m) == -1)
crypto/openssh/sshd.c
922
pfd[i].fd = listen_socks[i];
crypto/openssh/sshd.c
929
pfd[npfd].fd = children[i].pipefd;
crypto/openssh/sshkey-xmss.c
400
int ret = SSH_ERR_SYSTEM_ERROR, r, fd = -1;
crypto/openssh/sshkey-xmss.c
405
if ((fd = open(filename, O_RDONLY)) >= 0) {
crypto/openssh/sshkey-xmss.c
407
if (atomicio(read, fd, buf, sizeof(buf)) != sizeof(buf)) {
crypto/openssh/sshkey-xmss.c
416
if (atomicio(read, fd, data, len) != len) {
crypto/openssh/sshkey-xmss.c
436
if (fd != -1)
crypto/openssh/sshkey-xmss.c
437
close(fd);
crypto/openssh/sshkey-xmss.c
576
int fd = -1;
crypto/openssh/sshkey-xmss.c
618
if ((fd = open(nstatefile, O_CREAT|O_WRONLY|O_EXCL, 0600)) == -1) {
crypto/openssh/sshkey-xmss.c
624
if (atomicio(vwrite, fd, buf, sizeof(buf)) != sizeof(buf)) {
crypto/openssh/sshkey-xmss.c
627
close(fd);
crypto/openssh/sshkey-xmss.c
630
if (atomicio(vwrite, fd, sshbuf_mutable_ptr(enc), sshbuf_len(enc)) !=
crypto/openssh/sshkey-xmss.c
634
close(fd);
crypto/openssh/sshkey-xmss.c
637
if (fsync(fd) == -1) {
crypto/openssh/sshkey-xmss.c
640
close(fd);
crypto/openssh/sshkey-xmss.c
643
if (close(fd) == -1) {
crypto/openssh/sshpty.c
102
int fd;
crypto/openssh/sshpty.c
106
fd = open(_PATH_TTY, O_RDWR | O_NOCTTY);
crypto/openssh/sshpty.c
107
if (fd >= 0) {
crypto/openssh/sshpty.c
108
(void) ioctl(fd, TIOCNOTTY, NULL);
crypto/openssh/sshpty.c
109
close(fd);
crypto/openssh/sshpty.c
119
fd = open(_PATH_TTY, O_RDWR | O_NOCTTY);
crypto/openssh/sshpty.c
120
if (fd >= 0) {
crypto/openssh/sshpty.c
122
close(fd);
crypto/openssh/sshpty.c
134
fd = open(tty, O_RDWR);
crypto/openssh/sshpty.c
135
if (fd == -1)
crypto/openssh/sshpty.c
138
close(fd);
crypto/openssh/sshpty.c
141
fd = open(_PATH_TTY, O_WRONLY);
crypto/openssh/sshpty.c
142
if (fd == -1)
crypto/openssh/sshpty.c
146
close(fd);
crypto/openssh/sshpty.c
225
int fd;
crypto/openssh/sshpty.c
227
if ((fd = open(_PATH_TTY, O_RDWR | O_NOCTTY)) >= 0) {
crypto/openssh/sshpty.c
228
(void) ioctl(fd, TIOCNOTTY, NULL);
crypto/openssh/sshpty.c
229
close(fd);
crypto/openssh/sshsig.c
501
hash_file(int fd, const char *hashalg, struct sshbuf **bp)
crypto/openssh/sshsig.c
523
if ((n = read(fd, rbuf, sizeof(rbuf))) == -1) {
crypto/openssh/sshsig.c
573
int fd, const char *sig_namespace, struct sshbuf **out,
crypto/openssh/sshsig.c
583
if ((r = hash_file(fd, hashalg, &b)) != 0) {
crypto/openssh/sshsig.c
598
sshsig_verify_fd(struct sshbuf *signature, int fd,
crypto/openssh/sshsig.c
613
if ((r = hash_file(fd, hashalg, &b)) != 0) {
crypto/openssh/sshsig.h
60
int fd, const char *sig_namespace,
crypto/openssh/sshsig.h
68
int sshsig_verify_fd(struct sshbuf *signature, int fd,
crypto/openssh/ttymodes.c
279
ssh_tty_make_modes(struct ssh *ssh, int fd, struct termios *tiop)
crypto/openssh/ttymodes.c
289
if (fd == -1) {
crypto/openssh/ttymodes.c
293
if (tcgetattr(fd, &tio) == -1) {
crypto/openssh/ttymodes.c
343
ssh_tty_parse_modes(struct ssh *ssh, int fd)
crypto/openssh/ttymodes.c
367
if (tcgetattr(fd, &tio) == -1) {
crypto/openssh/ttymodes.c
448
if (tcsetattr(fd, TCSANOW, &tio) == -1)
games/fortune/fortune/fortune.c
1070
if (fp->inf == NULL && (fp->inf = fdopen(fp->fd, "r")) == NULL) {
games/fortune/fortune/fortune.c
1097
int fd;
games/fortune/fortune/fortune.c
1102
if ((fd = open(fp->posfile, O_RDONLY)) < 0 ||
games/fortune/fortune/fortune.c
1103
read(fd, &fp->pos, sizeof fp->pos) != sizeof fp->pos)
games/fortune/fortune/fortune.c
1107
if (fd >= 0)
games/fortune/fortune/fortune.c
1108
close(fd);
games/fortune/fortune/fortune.c
1125
int fd;
games/fortune/fortune/fortune.c
1131
if ((fd = open(fp->datfile, O_RDONLY)) < 0) {
games/fortune/fortune/fortune.c
1135
if (read(fd, (char *) &fp->tbl, sizeof fp->tbl) != sizeof fp->tbl) {
games/fortune/fortune/fortune.c
1145
close(fd);
games/fortune/fortune/fortune.c
161
int fd;
games/fortune/fortune/fortune.c
183
if ((fd = creat(Fortfile->posfile, 0666)) < 0) {
games/fortune/fortune/fortune.c
192
flock(fd, LOCK_EX);
games/fortune/fortune/fortune.c
193
write(fd, (char *) &Fortfile->pos, sizeof Fortfile->pos);
games/fortune/fortune/fortune.c
196
flock(fd, LOCK_UN);
games/fortune/fortune/fortune.c
451
int fd;
games/fortune/fortune/fortune.c
490
if ((fd = open(path, O_RDONLY)) < 0) {
games/fortune/fortune/fortune.c
535
fp->fd = fd;
games/fortune/fortune/fortune.c
596
fp->fd = -1;
games/fortune/fortune/fortune.c
647
int fd;
games/fortune/fortune/fortune.c
654
if ((fd = open(offensive, O_RDONLY)) < 0)
games/fortune/fortune/fortune.c
668
fp->fd = -1;
games/fortune/fortune/fortune.c
671
obscene->fd = fd;
games/fortune/fortune/fortune.c
697
close(fp->fd);
games/fortune/fortune/fortune.c
698
fp->fd = -1;
games/fortune/fortune/fortune.c
75
int fd, datfd;
games/fortune/fortune/fortune.c
85
struct fd *child, *parent;
games/fortune/fortune/fortune.c
86
struct fd *next, *prev;
games/grdc/grdc.c
229
.fd = STDIN_FILENO,
games/grdc/grdc.c
246
read(pfd.fd, &c, 1);
games/hack/hack.bones.c
138
if ((fd = creat(bones, FMASK)) < 0)
games/hack/hack.bones.c
140
savelev(fd, dlevel);
games/hack/hack.bones.c
141
(void) close(fd);
games/hack/hack.bones.c
147
int fd, x, y, ok;
games/hack/hack.bones.c
153
if ((fd = open(bones, O_RDONLY)) < 0)
games/hack/hack.bones.c
155
if ((ok = uptodate(fd)) != 0) {
games/hack/hack.bones.c
156
getlev(fd, 0, dlevel);
games/hack/hack.bones.c
161
(void) close(fd);
games/hack/hack.bones.c
75
int fd;
games/hack/hack.bones.c
86
if ((fd = open(bones, O_RDONLY)) >= 0) {
games/hack/hack.bones.c
87
(void) close(fd);
games/hack/hack.do.c
189
int fd;
games/hack/hack.do.c
200
fd = creat(lock, FMASK);
games/hack/hack.do.c
201
if (fd < 0) {
games/hack/hack.do.c
225
savelev(fd, dlevel);
games/hack/hack.do.c
226
(void) close(fd);
games/hack/hack.do.c
236
if ((fd = open(lock, O_RDONLY)) < 0) {
games/hack/hack.do.c
241
getlev(fd, hackpid, dlevel);
games/hack/hack.do.c
242
(void) close(fd);
games/hack/hack.engrave.c
342
save_engravings(int fd)
games/hack/hack.engrave.c
350
bwrite(fd, &(ep->engr_lth), sizeof(ep->engr_lth));
games/hack/hack.engrave.c
351
bwrite(fd, ep, sizeof(struct engr) + ep->engr_lth);
games/hack/hack.engrave.c
354
bwrite(fd, nul, sizeof(unsigned));
games/hack/hack.engrave.c
359
rest_engravings(int fd)
games/hack/hack.engrave.c
365
mread(fd, <h, sizeof(unsigned));
games/hack/hack.engrave.c
369
mread(fd, ep, sizeof(*ep) + lth);
games/hack/hack.lev.c
100
savemonchn(fd, fmon);
games/hack/hack.lev.c
101
savegoldchn(fd, fgold);
games/hack/hack.lev.c
102
savetrapchn(fd, ftrap);
games/hack/hack.lev.c
103
saveobjchn(fd, fobj);
games/hack/hack.lev.c
104
saveobjchn(fd, billobjs);
games/hack/hack.lev.c
106
save_engravings(fd);
games/hack/hack.lev.c
108
bwrite(fd, rooms, sizeof(rooms));
games/hack/hack.lev.c
109
bwrite(fd, doors, sizeof(doors));
games/hack/hack.lev.c
116
bwrite(fd, wsegs, sizeof(wsegs));
games/hack/hack.lev.c
120
bwrite(fd, wtmp, sizeof(struct wseg));
games/hack/hack.lev.c
124
bwrite(fd, wgrowtime, sizeof(wgrowtime));
games/hack/hack.lev.c
129
bwrite(int fd, const void *loc, size_t num)
games/hack/hack.lev.c
132
if ((size_t)write(fd, loc, num) != num)
games/hack/hack.lev.c
133
panic("cannot write %zu bytes to file #%d", num, fd);
games/hack/hack.lev.c
137
saveobjchn(int fd, struct obj *otmp)
games/hack/hack.lev.c
146
bwrite(fd, &xl, sizeof(int));
games/hack/hack.lev.c
147
bwrite(fd, otmp, xl + sizeof(struct obj));
games/hack/hack.lev.c
151
bwrite(fd, &minusone, sizeof(int));
games/hack/hack.lev.c
155
savemonchn(int fd, struct monst *mtmp)
games/hack/hack.lev.c
162
bwrite(fd, &monbegin, sizeof(monbegin));
games/hack/hack.lev.c
167
bwrite(fd, &xl, sizeof(int));
games/hack/hack.lev.c
168
bwrite(fd, mtmp, xl + sizeof(struct monst));
games/hack/hack.lev.c
170
saveobjchn(fd, mtmp->minvent);
games/hack/hack.lev.c
174
bwrite(fd, &minusone, sizeof(int));
games/hack/hack.lev.c
178
savegoldchn(int fd, struct gold *gold)
games/hack/hack.lev.c
183
bwrite(fd, gold, sizeof(struct gold));
games/hack/hack.lev.c
187
bwrite(fd, nul, sizeof(struct gold));
games/hack/hack.lev.c
191
savetrapchn(int fd, struct trap *trap)
games/hack/hack.lev.c
196
bwrite(fd, trap, sizeof(struct trap));
games/hack/hack.lev.c
200
bwrite(fd, nul, sizeof(struct trap));
games/hack/hack.lev.c
204
getlev(int fd, int pid, xchar lev)
games/hack/hack.lev.c
217
mread(fd, &hpid, sizeof(hpid));
games/hack/hack.lev.c
218
mread(fd, &dlvl, sizeof(dlvl));
games/hack/hack.lev.c
227
mread(fd, levl, sizeof(levl));
games/hack/hack.lev.c
228
mread(fd, &omoves, sizeof(omoves));
games/hack/hack.lev.c
229
mread(fd, &xupstair, sizeof(xupstair));
games/hack/hack.lev.c
230
mread(fd, &yupstair, sizeof(yupstair));
games/hack/hack.lev.c
231
mread(fd, &xdnstair, sizeof(xdnstair));
games/hack/hack.lev.c
232
mread(fd, &ydnstair, sizeof(ydnstair));
games/hack/hack.lev.c
234
fmon = restmonchn(fd);
games/hack/hack.lev.c
264
mread(fd, gold, sizeof(struct gold));
games/hack/hack.lev.c
269
mread(fd, gold, sizeof(struct gold));
games/hack/hack.lev.c
273
mread(fd, trap, sizeof(struct trap));
games/hack/hack.lev.c
278
mread(fd, trap, sizeof(struct trap));
games/hack/hack.lev.c
281
fobj = restobjchn(fd);
games/hack/hack.lev.c
282
billobjs = restobjchn(fd);
games/hack/hack.lev.c
283
rest_engravings(fd);
games/hack/hack.lev.c
285
mread(fd, rooms, sizeof(rooms));
games/hack/hack.lev.c
286
mread(fd, doors, sizeof(doors));
games/hack/hack.lev.c
289
mread(fd, wsegs, sizeof(wsegs));
games/hack/hack.lev.c
294
mread(fd, wtmp, sizeof(struct wseg));
games/hack/hack.lev.c
301
mread(fd, wgrowtime, sizeof(wgrowtime));
games/hack/hack.lev.c
306
mread(int fd, void *buf, size_t len)
games/hack/hack.lev.c
310
rlen = read(fd, buf, len);
games/hack/hack.lev.c
80
savelev(int fd, xchar lev)
games/hack/hack.lev.c
87
if (fd < 0)
games/hack/hack.lev.c
92
bwrite(fd, &hackpid, sizeof(hackpid));
games/hack/hack.lev.c
93
bwrite(fd, &lev, sizeof(lev));
games/hack/hack.lev.c
94
bwrite(fd, levl, sizeof(levl));
games/hack/hack.lev.c
95
bwrite(fd, &moves, sizeof(long));
games/hack/hack.lev.c
96
bwrite(fd, &xupstair, sizeof(xupstair));
games/hack/hack.lev.c
97
bwrite(fd, &yupstair, sizeof(yupstair));
games/hack/hack.lev.c
98
bwrite(fd, &xdnstair, sizeof(xdnstair));
games/hack/hack.lev.c
99
bwrite(fd, &ydnstair, sizeof(ydnstair));
games/hack/hack.main.c
103
fd = open("/dev/null", O_RDONLY);
games/hack/hack.main.c
104
if (fd < 3)
games/hack/hack.main.c
106
close(fd);
games/hack/hack.main.c
308
if ((fd = open(SAVEF, O_RDONLY)) >= 0 &&
games/hack/hack.main.c
309
(uptodate(fd) || unlink(SAVEF) == 666)) {
games/hack/hack.main.c
313
if (!dorecover(fd))
games/hack/hack.main.c
561
int fd;
games/hack/hack.main.c
565
if ((fd = open(RECORD, O_RDWR)) < 0) {
games/hack/hack.main.c
569
(void) close(fd);
games/hack/hack.main.c
97
int fd;
games/hack/hack.o_init.c
175
savenames(int fd)
games/hack/hack.o_init.c
179
bwrite(fd, bases, sizeof bases);
games/hack/hack.o_init.c
180
bwrite(fd, objects, sizeof objects);
games/hack/hack.o_init.c
188
bwrite(fd, &len, sizeof len);
games/hack/hack.o_init.c
189
bwrite(fd, objects[i].oc_uname, len);
games/hack/hack.o_init.c
195
restnames(int fd)
games/hack/hack.o_init.c
199
mread(fd, bases, sizeof bases);
games/hack/hack.o_init.c
200
mread(fd, objects, sizeof objects);
games/hack/hack.o_init.c
203
mread(fd, &len, sizeof len);
games/hack/hack.o_init.c
205
mread(fd, objects[i].oc_uname, len);
games/hack/hack.pager.c
371
int fd = open(fnam, O_RDONLY);
games/hack/hack.pager.c
373
if (fd < 0) {
games/hack/hack.pager.c
386
if (dup(fd)) {
games/hack/hack.pager.c
396
(void) close(fd);
games/hack/hack.save.c
101
if ((fd = creat(SAVEF, FMASK)) < 0) {
games/hack/hack.save.c
109
savelev(fd, dlevel);
games/hack/hack.save.c
110
saveobjchn(fd, invent);
games/hack/hack.save.c
111
saveobjchn(fd, fcobj);
games/hack/hack.save.c
112
savemonchn(fd, fallen_down);
games/hack/hack.save.c
114
bwrite(fd, &tmp, sizeof tmp);
games/hack/hack.save.c
115
bwrite(fd, &flags, sizeof(struct flag));
games/hack/hack.save.c
116
bwrite(fd, &dlevel, sizeof dlevel);
games/hack/hack.save.c
117
bwrite(fd, &maxdlevel, sizeof maxdlevel);
games/hack/hack.save.c
118
bwrite(fd, &moves, sizeof moves);
games/hack/hack.save.c
119
bwrite(fd, &u, sizeof(struct you));
games/hack/hack.save.c
121
bwrite(fd, &(u.ustuck->m_id), sizeof u.ustuck->m_id);
games/hack/hack.save.c
122
bwrite(fd, pl_character, sizeof pl_character);
games/hack/hack.save.c
123
bwrite(fd, genocided, sizeof genocided);
games/hack/hack.save.c
124
bwrite(fd, fut_geno, sizeof fut_geno);
games/hack/hack.save.c
125
savenames(fd);
games/hack/hack.save.c
134
(void) close(fd);
games/hack/hack.save.c
142
bwrite(fd, &tmp, sizeof tmp); /* level number */
games/hack/hack.save.c
143
savelev(fd, tmp); /* actual level */
games/hack/hack.save.c
146
(void) close(fd);
games/hack/hack.save.c
155
dorecover(int fd)
games/hack/hack.save.c
163
getlev(fd, 0, 0);
games/hack/hack.save.c
164
invent = restobjchn(fd);
games/hack/hack.save.c
168
fcobj = restobjchn(fd);
games/hack/hack.save.c
169
fallen_down = restmonchn(fd);
games/hack/hack.save.c
170
mread(fd, &tmp, sizeof tmp);
games/hack/hack.save.c
172
(void) close(fd);
games/hack/hack.save.c
178
mread(fd, &flags, sizeof(struct flag));
games/hack/hack.save.c
179
mread(fd, &dlevel, sizeof dlevel);
games/hack/hack.save.c
180
mread(fd, &maxdlevel, sizeof maxdlevel);
games/hack/hack.save.c
181
mread(fd, &moves, sizeof moves);
games/hack/hack.save.c
182
mread(fd, &u, sizeof(struct you));
games/hack/hack.save.c
184
mread(fd, &mid, sizeof mid);
games/hack/hack.save.c
185
mread(fd, pl_character, sizeof pl_character);
games/hack/hack.save.c
186
mread(fd, genocided, sizeof genocided);
games/hack/hack.save.c
187
mread(fd, fut_geno, sizeof fut_geno);
games/hack/hack.save.c
188
restnames(fd);
games/hack/hack.save.c
190
if (read(fd, &tmp, sizeof tmp) != sizeof tmp)
games/hack/hack.save.c
192
getlev(fd, 0, tmp);
games/hack/hack.save.c
199
(void) lseek(fd, (off_t) 0, SEEK_SET);
games/hack/hack.save.c
200
getlev(fd, 0, 0);
games/hack/hack.save.c
201
(void) close(fd);
games/hack/hack.save.c
239
restobjchn(int fd)
games/hack/hack.save.c
245
mread(fd, &xl, sizeof(xl));
games/hack/hack.save.c
253
mread(fd, otmp, (unsigned) xl + sizeof(struct obj));
games/hack/hack.save.c
266
restmonchn(int fd)
games/hack/hack.save.c
275
mread(fd, &monbegin, sizeof(monbegin));
games/hack/hack.save.c
283
mread(fd, &xl, sizeof(xl));
games/hack/hack.save.c
291
mread(fd, mtmp, (unsigned) xl + sizeof(struct monst));
games/hack/hack.save.c
297
mtmp->minvent = restobjchn(fd);
games/hack/hack.save.c
96
int fd, ofd;
games/hack/hack.unix.c
211
uptodate(int fd)
games/hack/hack.unix.c
213
if (fstat(fd, &buf)) {
games/hack/hack.unix.c
226
veryold(int fd)
games/hack/hack.unix.c
231
if (fstat(fd, &buf))
games/hack/hack.unix.c
240
if (read(fd, &lockedpid, sizeof(lockedpid)) !=
games/hack/hack.unix.c
253
(void) close(fd);
games/hack/hack.unix.c
267
int i = 0, fd;
games/hack/hack.unix.c
303
if ((fd = open(lock, O_RDONLY)) == -1) {
games/hack/hack.unix.c
310
if (veryold(fd))/* if true, this closes fd and unlinks lock */
games/hack/hack.unix.c
312
(void) close(fd);
games/hack/hack.unix.c
319
fd = creat(lock, FMASK);
games/hack/hack.unix.c
322
if (fd == -1) {
games/hack/hack.unix.c
325
if (write(fd, &hackpid, sizeof(hackpid))
games/hack/hack.unix.c
329
if (close(fd) == -1) {
games/hack/makedefs.c
140
int n = read(fd, lp0, (line + LINSZ) - lp0);
games/hack/makedefs.c
74
int fd;
games/hack/makedefs.c
95
if ((fd = open(argv[1], O_RDONLY)) < 0) {
games/hunt/hunt/list.c
220
int fd, inlen = 8192;
games/hunt/hunt/list.c
260
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
games/hunt/hunt/list.c
269
if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) < 0)
games/hunt/hunt/list.c
287
if (ioctl(fd, SIOCGIFFLAGS, (caddr_t)ifr) < 0) {
games/hunt/hunt/list.c
294
if (ioctl(fd, SIOCGIFBRDADDR, (caddr_t)ifr) < 0) {
games/hunt/hunt/list.c
300
if (ioctl(fd, SIOCGIFDSTADDR, (caddr_t)ifr) < 0) {
games/hunt/hunt/list.c
311
close(fd);
games/hunt/hunt/list.c
52
next_driver_fd(int fd)
games/hunt/hunt/list.c
61
if (fd == -1 && numprobes == 0)
games/hunt/hunt/list.c
66
if (fd != -1) {
games/hunt/hunt/list.c
67
FD_SET(fd, &r);
games/hunt/hunt/list.c
68
maxfd = fd;
games/hunt/hunt/list.c
94
if (fd != -1 && FD_ISSET(fd, &r))
games/hunt/huntd/answer.c
120
sp->fd = newsock;
games/hunt/huntd/answer.c
121
FD_SET(sp->fd, &Fds_mask);
games/hunt/huntd/answer.c
122
if (sp->fd >= Num_fds)
games/hunt/huntd/answer.c
123
Num_fds = sp->fd + 1;
games/hunt/huntd/answer.c
147
len = read(sp->fd, sp->msg + sp->msglen,
games/hunt/huntd/answer.c
169
len = read(sp->fd, sp->inbuf + sp->inlen,
games/hunt/huntd/answer.c
214
write(sp->fd, &version, sizeof version);
games/hunt/huntd/answer.c
224
conn = fdopen(sp->fd, "w");
games/hunt/huntd/answer.c
258
pp->p_fd = sp->fd;
games/hunt/huntd/answer.c
283
FD_CLR(sp->fd, &Fds_mask);
games/hunt/huntd/answer.c
284
close(sp->fd);
games/hunt/huntd/answer.c
548
sp->fd, sp->inlen + (sp->reading_msg ? sp->msglen : 0),
games/hunt/huntd/driver.c
1135
handle_wkport(int fd)
games/hunt/huntd/driver.c
1143
request_init(&ri, RQ_DAEMON, "huntd", RQ_FILE, fd, 0);
games/hunt/huntd/driver.c
1146
if (recvfrom(fd, &query, sizeof query, 0, &fromaddr, &fromlen) == -1)
games/hunt/huntd/driver.c
1197
if (sendto(fd, &response, sizeof response, 0,
games/hunt/huntd/driver.c
196
fd = sp->fd;
games/hunt/huntd/driver.c
197
if (FD_ISSET(fd, &Have_inp) && answer_next(sp)) {
games/hunt/huntd/driver.c
208
FD_CLR(fd, &Have_inp);
games/hunt/huntd/driver.c
96
int fd;
games/hunt/huntd/server.h
194
int fd;
games/larn/bill.c
116
int fd;
games/larn/bill.c
124
if ((fd = open(fname, O_WRONLY | O_TRUNC | O_CREAT, 0660)) == -1)
games/larn/bill.c
130
write(fd, buf, strlen(buf));
games/larn/bill.c
133
write(fd, buf, strlen(buf));
games/larn/bill.c
135
write(fd, *cp, strlen(*cp));
games/larn/bill.c
140
close(fd);
games/phantasia/setup.c
101
close(fd); /* close newly created file */
games/phantasia/setup.c
57
int fd; /* file descriptor */
games/phantasia/setup.c
97
if ((fd = creat(*filename, 0666)) < 0)
games/random/random.c
138
if ((fd = open(filename, O_RDONLY, 0)) < 0)
games/random/random.c
140
ret = randomize_fd(fd, random_type, unique_output, denom);
games/random/random.c
57
int ch, fd, random_exit, randomize_lines, random_type, ret,
games/random/randomize_fd.c
117
len = read(fd, buf, buflen);
games/random/randomize_fd.c
137
len = read(fd, &buf[i], buflen - i);
games/random/randomize_fd.c
156
len = read(fd, &buf[i], buflen);
games/random/randomize_fd.c
196
close(fd);
games/random/randomize_fd.c
93
randomize_fd(int fd, int type, int unique, double denom)
games/random/randomize_fd.h
44
int randomize_fd(int fd, int type, int unique, double denom);
games/rogue/machdep.c
477
static int fd;
games/rogue/machdep.c
481
if ((fd = open(_PATH_SCOREFILE, O_RDONLY)) < 1) {
games/rogue/machdep.c
486
if (!flock(fd, LOCK_EX|LOCK_NB))
games/rogue/machdep.c
489
flock(fd, LOCK_NB);
games/rogue/machdep.c
490
close(fd);
games/sail/main.c
63
int fd;
games/sail/main.c
72
fd = open("/dev/null", O_RDONLY);
games/sail/main.c
73
if (fd < 3)
games/sail/main.c
75
close(fd);
games/snake/snscore/snscore.c
59
FILE *fd;
games/snake/snscore/snscore.c
69
fd = fopen(recfile, "r");
games/snake/snscore/snscore.c
70
if (fd == NULL)
games/snake/snscore/snscore.c
73
if (fread(&whoallbest, sizeof(short), 1, fd) == 0) {
games/snake/snscore/snscore.c
77
fread(&allbest, sizeof(short), 1, fd);
games/snake/snscore/snscore.c
80
if(fread(&score, sizeof(short), 1, fd) == 0)
games/tetris/input.c
72
pfd[0].fd = STDIN_FILENO;
games/trek/dumpgame.c
114
int fd;
games/trek/dumpgame.c
117
if ((fd = open("trek.dump", O_RDONLY)) < 0 ||
games/trek/dumpgame.c
118
read(fd, &version, sizeof version) != sizeof version ||
games/trek/dumpgame.c
120
readdump(fd)) {
games/trek/dumpgame.c
122
if (fd >= 0)
games/trek/dumpgame.c
123
close(fd);
games/trek/dumpgame.c
127
close(fd);
games/trek/dumpgame.c
144
int fd;
games/trek/dumpgame.c
149
fd = fd1;
games/trek/dumpgame.c
152
if (read(fd, &junk, sizeof junk) != (sizeof junk))
games/trek/dumpgame.c
157
if (read(fd, d->area, i) != i)
games/trek/dumpgame.c
162
return (read(fd, &junk, 1));
games/trek/dumpgame.c
78
int fd;
games/trek/dumpgame.c
82
if ((fd = creat("trek.dump", 0644)) < 0) {
games/trek/dumpgame.c
87
write(fd, &version, sizeof version);
games/trek/dumpgame.c
91
write(fd, &d->area, sizeof d->area);
games/trek/dumpgame.c
93
write(fd, d->area, i);
games/trek/dumpgame.c
96
close(fd);
games/wump/wump.c
717
int fd;
games/wump/wump.c
741
if ((fd = open(_PATH_WUMPINFO, O_RDONLY)) == -1)
games/wump/wump.c
743
if (dup2(fd, STDIN_FILENO) == -1)
include/db.h
106
int (*fd)(const struct __db *);
include/mpool.h
71
int fd; /* file descriptor */
initrd/oinit/oinit.c
87
int fd;
initrd/oinit/oinit.c
90
if ((fd = open(name, O_RDWR)) == -1) {
initrd/oinit/oinit.c
94
if (login_tty(fd) == -1) {
initrd/oinit/oinit.c
98
return fd;
lib/libc/citrus/citrus_mmap.c
56
int fd, ret;
lib/libc/citrus/citrus_mmap.c
62
if ((fd = _open(path, O_RDONLY | O_CLOEXEC)) == -1)
lib/libc/citrus/citrus_mmap.c
65
if (_fstat(fd, &st) == -1) {
lib/libc/citrus/citrus_mmap.c
75
fd, (off_t)0);
lib/libc/citrus/citrus_mmap.c
83
(void)_close(fd);
lib/libc/db/btree/bt_close.c
102
return (_close(fd) ? RET_ERROR : RET_SUCCESS);
lib/libc/db/btree/bt_close.c
64
int fd;
lib/libc/db/btree/bt_close.c
99
fd = t->bt_fd;
lib/libc/db/btree/bt_open.c
176
dbp->fd = __bt_fd;
lib/libc/db/btree/bt_open.c
396
int fd, len;
lib/libc/db/btree/bt_open.c
411
if ((fd = mkostemp(path, O_CLOEXEC)) != -1)
lib/libc/db/btree/bt_open.c
414
return(fd);
lib/libc/db/db/db.c
132
dbp->fd = __dberr_fd;
lib/libc/db/hash/hash.c
196
dbp->fd = hash_fd;
lib/libc/db/hash/hash_page.c
518
int fd, page, size, rsize;
lib/libc/db/hash/hash_page.c
521
fd = hashp->fp;
lib/libc/db/hash/hash_page.c
524
if ((fd == -1) || !is_disk) {
lib/libc/db/hash/hash_page.c
532
if ((rsize = pread(fd, p, size, (off_t)page << hashp->BSHIFT)) == -1)
lib/libc/db/hash/hash_page.c
572
int fd, page, size, wsize;
lib/libc/db/hash/hash_page.c
577
fd = hashp->fp;
lib/libc/db/hash/hash_page.c
596
if ((wsize = pwrite(fd, p, size, (off_t)page << hashp->BSHIFT)) == -1)
lib/libc/db/mpool/mpool.c
217
if ((nr = pread(mp->fd, bp->page, mp->pagesize, off)) != (ssize_t)mp->pagesize) {
lib/libc/db/mpool/mpool.c
328
return (_fsync(mp->fd) ? RET_ERROR : RET_SUCCESS);
lib/libc/db/mpool/mpool.c
404
if (pwrite(mp->fd, bp->page, mp->pagesize, off) != (ssize_t)mp->pagesize)
lib/libc/db/mpool/mpool.c
60
mpool_open(__unused void *key, int fd, pgno_t pagesize, pgno_t maxcache)
lib/libc/db/mpool/mpool.c
72
if (_fstat(fd, &sb))
lib/libc/db/mpool/mpool.c
88
mp->fd = fd;
lib/libc/db/recno/rec_open.c
184
dbp->fd = __rec_fd;
lib/libc/db/test/dbtest.c
650
int fd;
lib/libc/db/test/dbtest.c
656
if ((fd = open(name, O_RDONLY, 0)) < 0 ||
lib/libc/db/test/dbtest.c
657
fstat(fd, &sb))
lib/libc/db/test/dbtest.c
665
read(fd, p, (int)sb.st_size);
lib/libc/db/test/dbtest.c
667
close(fd);
lib/libc/gen/closedir.c
50
int fd;
lib/libc/gen/closedir.c
55
fd = dirp->dd_fd;
lib/libc/gen/closedir.c
65
return(_close(fd));
lib/libc/gen/daemon.c
47
int fd;
lib/libc/gen/daemon.c
80
if (!noclose && (fd = _open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
lib/libc/gen/daemon.c
81
_dup2(fd, STDIN_FILENO);
lib/libc/gen/daemon.c
82
_dup2(fd, STDOUT_FILENO);
lib/libc/gen/daemon.c
83
_dup2(fd, STDERR_FILENO);
lib/libc/gen/daemon.c
84
if (fd > 2)
lib/libc/gen/daemon.c
85
_close(fd);
lib/libc/gen/dlfcn.c
191
fdlopen(int fd __unused, int mode __unused)
lib/libc/gen/fdevname.c
111
if (((error = fdevname_r(fd, buf, sizeof fdevname_buf))) != 0) {
lib/libc/gen/fdevname.c
60
fdevname_r(int fd, char *buf, size_t len)
lib/libc/gen/fdevname.c
68
if (_fstat(fd, &sb))
lib/libc/gen/fdevname.c
77
if (_ioctl(fd, FIODNAME, &fa) == -1) {
lib/libc/gen/fdevname.c
90
fdevname(int fd)
lib/libc/gen/fts.c
1095
fts_safe_changedir(FTS *sp, FTSENT *p, int fd, const char *path)
lib/libc/gen/fts.c
1100
newfd = fd;
lib/libc/gen/fts.c
1103
if (fd < 0 && (newfd = _open(path, O_RDONLY | O_CLOEXEC, 0)) < 0)
lib/libc/gen/fts.c
1117
if (fd < 0)
lib/libc/gen/fts.c
500
int fd;
lib/libc/gen/fts.c
553
if ((fd = _open(".", O_RDONLY | O_CLOEXEC, 0)) < 0)
lib/libc/gen/fts.c
556
if (fchdir(fd)) {
lib/libc/gen/fts.c
557
_close(fd);
lib/libc/gen/fts.c
560
_close(fd);
lib/libc/gen/fts.c
66
#define FCHDIR(sp, fd) (!ISSET(FTS_NOCHDIR) && fchdir(fd))
lib/libc/gen/getcap.c
185
getent(char **cap, u_int *len, char **db_array, int fd, const char *name,
lib/libc/gen/getcap.c
240
if (fd >= 0) {
lib/libc/gen/getcap.c
241
lseek(fd, (off_t)0, SEEK_SET);
lib/libc/gen/getcap.c
266
fd = _open(*db_p, O_RDONLY | O_CLOEXEC, 0);
lib/libc/gen/getcap.c
267
if (fd < 0)
lib/libc/gen/getcap.c
301
n = _read(fd, buf, sizeof(buf));
lib/libc/gen/getcap.c
304
_close(fd);
lib/libc/gen/getcap.c
309
fd = -1;
lib/libc/gen/getcap.c
343
_close(fd);
lib/libc/gen/getcap.c
427
iret = getent(&icap, &ilen, db_p, fd, tc, depth+1,
lib/libc/gen/getcap.c
435
_close(fd);
lib/libc/gen/getcap.c
485
_close(fd);
lib/libc/gen/getcap.c
517
_close(fd);
lib/libc/gen/isatty.c
39
isatty(int fd)
lib/libc/gen/isatty.c
44
retval = (tcgetattr(fd, &t) != -1);
lib/libc/gen/nlist.c
101
__aout_fdnlist(int fd, struct nlist *list)
lib/libc/gen/nlist.c
112
if ((_fstat(fd, &st) < 0) || (st.st_size < sizeof(struct exec)))
lib/libc/gen/nlist.c
132
a_out_mmap = mmap(NULL, (size_t)st.st_size, PROT_READ, MAP_PRIVATE, fd, (off_t)0);
lib/libc/gen/nlist.c
227
__elf_fdnlist(int fd, struct nlist *list)
lib/libc/gen/nlist.c
245
if (lseek(fd, (off_t)0, SEEK_SET) == -1 ||
lib/libc/gen/nlist.c
246
_read(fd, &ehdr, sizeof(Elf_Ehdr)) != sizeof(Elf_Ehdr) ||
lib/libc/gen/nlist.c
248
_fstat(fd, &st) < 0)
lib/libc/gen/nlist.c
263
base = mmap(NULL, (size_t)shdr_size, PROT_READ, 0, fd,
lib/libc/gen/nlist.c
299
base = mmap(NULL, (size_t)symstrsize, PROT_READ, 0, fd,
lib/libc/gen/nlist.c
328
if (lseek(fd, (off_t) symoff, SEEK_SET) == -1) {
lib/libc/gen/nlist.c
335
if (_read(fd, sbuf, cc) != cc)
lib/libc/gen/nlist.c
62
int fd, n;
lib/libc/gen/nlist.c
64
fd = _open(name, O_RDONLY | O_CLOEXEC, 0);
lib/libc/gen/nlist.c
65
if (fd < 0)
lib/libc/gen/nlist.c
67
n = __fdnlist(fd, list);
lib/libc/gen/nlist.c
68
_close(fd);
lib/libc/gen/nlist.c
73
int (*fn)(int fd, struct nlist *list);
lib/libc/gen/nlist.c
84
__fdnlist(int fd, struct nlist *list)
lib/libc/gen/nlist.c
90
n = (nlist_fn[i].fn)(fd, list);
lib/libc/gen/opendir.c
107
if (_fstat(fd, &statb) != 0)
lib/libc/gen/opendir.c
113
fdflags = _fcntl(fd, F_GETFD, 0);
lib/libc/gen/opendir.c
115
_fcntl(fd, F_SETFD, fdflags | FD_CLOEXEC) == -1) ||
lib/libc/gen/opendir.c
136
dirp->dd_fd = fd;
lib/libc/gen/opendir.c
154
if ((dirp->dd_seek = lseek(fd, 0, SEEK_CUR)) < 0)
lib/libc/gen/opendir.c
63
fdopendir(int fd)
lib/libc/gen/opendir.c
65
return (__fdopendir2(fd, DEFAULT_FLAGS));
lib/libc/gen/opendir.c
71
int fd;
lib/libc/gen/opendir.c
83
fd = _open(name, O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC);
lib/libc/gen/opendir.c
84
if (fd == -1)
lib/libc/gen/opendir.c
86
dirp = __fdopendir2(fd, flags);
lib/libc/gen/opendir.c
89
_close(fd);
lib/libc/gen/opendir.c
97
__fdopendir2(int fd, int flags)
lib/libc/gen/popen.c
166
int fd = (*type == 'r') ? pdes[0] : pdes[1];
lib/libc/gen/popen.c
167
_fcntl(fd, F_SETFD, 0);
lib/libc/gen/posix_spawn.c
138
int fd;
lib/libc/gen/posix_spawn.c
143
fd = _open(fae->fae_path, fae->fae_oflag, fae->fae_mode);
lib/libc/gen/posix_spawn.c
144
if (fd < 0)
lib/libc/gen/posix_spawn.c
146
if (fd != fae->fae_fildes) {
lib/libc/gen/posix_spawn.c
147
if (_dup2(fd, fae->fae_fildes) == -1)
lib/libc/gen/posix_spawn.c
149
if (_close(fd) != 0) {
lib/libc/gen/posixshm.c
50
int fd;
lib/libc/gen/posixshm.c
70
fd = _openat(dfd, path, flags, mode);
lib/libc/gen/posixshm.c
71
if (fd < 0 && errno == ENOENT &&
lib/libc/gen/posixshm.c
74
fd = _openat(dfd, path, flags, mode);
lib/libc/gen/posixshm.c
78
fd = -1;
lib/libc/gen/posixshm.c
81
if (fd != -1) {
lib/libc/gen/posixshm.c
82
if (_fstat(fd, &stab) != 0 || !S_ISREG(stab.st_mode)) {
lib/libc/gen/posixshm.c
83
_close(fd);
lib/libc/gen/posixshm.c
88
if (_fcntl(fd, F_SETFD, FD_CLOEXEC) != 0 ||
lib/libc/gen/posixshm.c
89
_fcntl(fd, F_SETFL, (int)FPOSIXSHM) != 0) {
lib/libc/gen/posixshm.c
90
_close(fd);
lib/libc/gen/posixshm.c
94
return (fd);
lib/libc/gen/syslog.c
134
int cnt, fd, saved_errno, maxtries;
lib/libc/gen/syslog.c
297
(fd = _open(_PATH_CONSOLE, O_WRONLY|O_NONBLOCK|O_CLOEXEC, 0)) >= 0) {
lib/libc/gen/syslog.c
307
_writev(fd, iov, 2);
lib/libc/gen/syslog.c
308
_close(fd);
lib/libc/gen/termios.c
102
tcgetsid(int fd)
lib/libc/gen/termios.c
106
if (_ioctl(fd, TIOCGSID, &s) < 0)
lib/libc/gen/termios.c
113
tcsetsid(int fd, pid_t pid)
lib/libc/gen/termios.c
121
return (_ioctl(fd, TIOCSCTTY, NULL));
lib/libc/gen/termios.c
197
tcsendbreak(int fd, int len __unused)
lib/libc/gen/termios.c
203
if (_ioctl(fd, TIOCSBRK, 0) == -1)
lib/libc/gen/termios.c
206
if (_ioctl(fd, TIOCCBRK, 0) == -1)
lib/libc/gen/termios.c
212
__tcdrain(int fd)
lib/libc/gen/termios.c
214
return (_ioctl(fd, TIOCDRAIN, 0));
lib/libc/gen/termios.c
222
tcflush(int fd, int which)
lib/libc/gen/termios.c
240
return (_ioctl(fd, TIOCFLUSH, &com));
lib/libc/gen/termios.c
244
tcflow(int fd, int action)
lib/libc/gen/termios.c
251
return (_ioctl(fd, TIOCSTOP, 0));
lib/libc/gen/termios.c
253
return (_ioctl(fd, TIOCSTART, 0));
lib/libc/gen/termios.c
256
if (tcgetattr(fd, &term) == -1)
lib/libc/gen/termios.c
259
if (c != _POSIX_VDISABLE && _write(fd, &c, sizeof(c)) == -1)
lib/libc/gen/termios.c
52
tcgetattr(int fd, struct termios *t)
lib/libc/gen/termios.c
55
return (_ioctl(fd, TIOCGETA, t));
lib/libc/gen/termios.c
59
tcsetattr(int fd, int opt, const struct termios *t)
lib/libc/gen/termios.c
70
return (_ioctl(fd, TIOCSETA, t));
lib/libc/gen/termios.c
72
return (_ioctl(fd, TIOCSETAW, t));
lib/libc/gen/termios.c
74
return (_ioctl(fd, TIOCSETAF, t));
lib/libc/gen/termios.c
82
tcsetpgrp(int fd, pid_t pgrp)
lib/libc/gen/termios.c
87
return (_ioctl(fd, TIOCSPGRP, &s));
lib/libc/gen/termios.c
91
tcgetpgrp(int fd)
lib/libc/gen/termios.c
95
if (_ioctl(fd, TIOCGPGRP, &s) < 0)
lib/libc/gen/ttyname.c
104
ttyname(int fd)
lib/libc/gen/ttyname.c
125
if (((error = ttyname_r(fd, buf, sizeof ttyname_buf))) != 0) {
lib/libc/gen/ttyname.c
61
ttyname_r(int fd, char *buf, size_t len)
lib/libc/gen/ttyname.c
70
if (_fstat(fd, &sb))
lib/libc/gen/ttyname.c
76
if (!isatty(fd))
lib/libc/gen/ttyname.c
86
if (_ioctl(fd, FIODNAME, &fa) == -1) {
lib/libc/gen/utmpx.c
375
int fd;
lib/libc/gen/utmpx.c
382
fd = _open(file, O_WRONLY|O_APPEND|O_SHLOCK|O_CLOEXEC);
lib/libc/gen/utmpx.c
384
if (fd == -1) {
lib/libc/gen/utmpx.c
385
if ((fd = _open(file, O_CREAT|O_WRONLY|O_EXLOCK|O_CLOEXEC, 0644)) == -1)
lib/libc/gen/utmpx.c
388
if (_fstat(fd, &st) == -1)
lib/libc/gen/utmpx.c
395
if (_write(fd, &ut, sizeof(ut)) == -1)
lib/libc/gen/utmpx.c
398
if (_write(fd, utx, sizeof(*utx)) == -1)
lib/libc/gen/utmpx.c
400
if (_close(fd) == -1)
lib/libc/gen/utmpx.c
406
(void) _close(fd);
lib/libc/gen/wordexp.c
106
nwritten = _write(fd, buffer + done, len - done);
lib/libc/gen/wordexp.c
81
we_read_fully(int fd, char *buffer, size_t len)
lib/libc/gen/wordexp.c
88
nread = _read(fd, buffer + done, len - done);
lib/libc/gen/wordexp.c
99
we_write_fully(int fd, const char *buffer, size_t len)
lib/libc/gmon/gmon.c
115
int fd;
lib/libc/gmon/gmon.c
152
fd = _open(outname, O_CREAT|O_TRUNC|O_WRONLY|O_CLOEXEC, 0666);
lib/libc/gmon/gmon.c
153
if (fd < 0) {
lib/libc/gmon/gmon.c
174
_write(fd, (char *)hdr, sizeof *hdr);
lib/libc/gmon/gmon.c
175
_write(fd, p->kcount, p->kcountsize);
lib/libc/gmon/gmon.c
195
_write(fd, &rawarc, sizeof rawarc);
lib/libc/gmon/gmon.c
198
_close(fd);
lib/libc/isc/ev_streams.c
106
new->fd = fd;
lib/libc/isc/ev_streams.c
108
if (evSelectFD(opaqueCtx, fd, EV_READ, readable, new, &new->file) < 0)
lib/libc/isc/ev_streams.c
265
writable(evContext opaqueCtx, void *uap, int fd, int evmask) {
lib/libc/isc/ev_streams.c
271
bytes = writev(fd, str->iovCur, str->iovCurCount);
lib/libc/isc/ev_streams.c
288
readable(evContext opaqueCtx, void *uap, int fd, int evmask) {
lib/libc/isc/ev_streams.c
294
bytes = readv(fd, str->iovCur, str->iovCurCount);
lib/libc/isc/ev_streams.c
46
static void writable(evContext opaqueCtx, void *uap, int fd, int evmask);
lib/libc/isc/ev_streams.c
47
static void readable(evContext opaqueCtx, void *uap, int fd, int evmask);
lib/libc/isc/ev_streams.c
62
evWrite(evContext opaqueCtx, int fd, const struct iovec *iov, int iocnt,
lib/libc/isc/ev_streams.c
72
new->fd = fd;
lib/libc/isc/ev_streams.c
74
if (evSelectFD(opaqueCtx, fd, EV_WRITE, writable, new, &new->file) < 0)
lib/libc/isc/ev_streams.c
96
evRead(evContext opaqueCtx, int fd, const struct iovec *iov, int iocnt,
lib/libc/isc/eventlib_p.h
118
int fd;
lib/libc/isc/eventlib_p.h
134
int fd;
lib/libc/isc/eventlib_p.h
195
extern short *__fd_eventfield(int fd, __evEmulMask *maskp);
lib/libc/isc/eventlib_p.h
197
extern void __fd_clr(int fd, __evEmulMask *maskp);
lib/libc/isc/eventlib_p.h
198
extern void __fd_set(int fd, __evEmulMask *maskp);
lib/libc/isc/eventlib_p.h
204
#define FD_SET(fd, maskp) \
lib/libc/isc/eventlib_p.h
205
__fd_set(fd, maskp)
lib/libc/isc/eventlib_p.h
208
#define FD_CLR(fd, maskp) \
lib/libc/isc/eventlib_p.h
209
__fd_clr(fd, maskp)
lib/libc/isc/eventlib_p.h
212
#define FD_ISSET(fd, maskp) \
lib/libc/isc/eventlib_p.h
213
((*__fd_eventfield(fd, maskp) & __poll_event(maskp)) != 0)
lib/libc/isc/eventlib_p.h
270
extern int evPollfdRealloc(evContext_p *ctx, int pollfd_chunk_size, int fd);
lib/libc/isc/eventlib_p.h
81
int fd;
lib/libc/isc/eventlib_p.h
93
int fd;
lib/libc/locale/collate.c
113
int fd;
lib/libc/locale/collate.c
125
if ((fd = _open(buf, O_RDONLY)) < 0)
lib/libc/locale/collate.c
127
if (_fstat(fd, &sbuf) < 0) {
lib/libc/locale/collate.c
128
(void) _close(fd);
lib/libc/locale/collate.c
132
(void) _close(fd);
lib/libc/locale/collate.c
136
map = mmap(NULL, sbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
lib/libc/locale/collate.c
137
(void) _close(fd);
lib/libc/locale/ldpart.c
106
if (_read(fd, p, (size_t) st.st_size) != st.st_size)
lib/libc/locale/ldpart.c
124
(void)_close(fd);
lib/libc/locale/ldpart.c
145
(void)_close(fd);
lib/libc/locale/ldpart.c
56
int saverr, fd, i, num_lines;
lib/libc/locale/ldpart.c
90
if ((fd = _open(filename, O_RDONLY | O_CLOEXEC)) < 0)
lib/libc/locale/ldpart.c
92
if (_fstat(fd, &st) != 0)
lib/libc/locale/rune.c
71
int fd;
lib/libc/locale/rune.c
73
if ((fd = _open(fname, O_RDONLY)) < 0) {
lib/libc/locale/rune.c
78
if (_fstat(fd, &sb) < 0) {
lib/libc/locale/rune.c
79
(void) _close(fd);
lib/libc/locale/rune.c
85
(void) _close(fd);
lib/libc/locale/rune.c
91
fdata = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
lib/libc/locale/rune.c
92
(void) _close(fd);
lib/libc/nls/msgcat.c
384
int fd;
lib/libc/nls/msgcat.c
402
if ((fd = _open(path, O_RDONLY | O_CLOEXEC)) == -1) {
lib/libc/nls/msgcat.c
407
if (_fstat(fd, &st) != 0) {
lib/libc/nls/msgcat.c
408
_close(fd);
lib/libc/nls/msgcat.c
419
_close(fd);
lib/libc/nls/msgcat.c
425
MAP_FILE|MAP_SHARED, fd, (off_t)0)) == MAP_FAILED) {
lib/libc/nls/msgcat.c
427
_close(fd);
lib/libc/nls/msgcat.c
431
_close(fd);
lib/libc/resolv/res_send.c
1004
pollfd.fd = s;
lib/libc/resolv/res_send.c
403
int fd;
lib/libc/resolv/res_send.c
409
fd = EXT(statp).nssocks[0];
lib/libc/resolv/res_send.c
422
EXT(statp).nssocks[lastns] = fd;
lib/libc/rpc/clnt_bcast.c
255
int fd; /* File descriptor */
lib/libc/rpc/clnt_bcast.c
301
int fd;
lib/libc/rpc/clnt_bcast.c
316
fd = _socket(si.si_af, si.si_socktype, si.si_proto);
lib/libc/rpc/clnt_bcast.c
317
if (fd < 0) {
lib/libc/rpc/clnt_bcast.c
323
fdlist[fdlistno].fd = fd;
lib/libc/rpc/clnt_bcast.c
328
pfd[fdlistno].fd = fdlist[fdlistno].fd = fd;
lib/libc/rpc/clnt_bcast.c
339
_close(fd);
lib/libc/rpc/clnt_bcast.c
442
__rpc_broadenable(fdlist[i].af, fdlist[i].fd,
lib/libc/rpc/clnt_bcast.c
450
if (_sendto(fdlist[i].fd, outbuf,
lib/libc/rpc/clnt_bcast.c
475
if (_sendto(fdlist[i].fd, outbuf_pmap,
lib/libc/rpc/clnt_bcast.c
527
pfd[i].fd = -1;
lib/libc/rpc/clnt_bcast.c
537
inlen = _recvfrom(fdlist[i].fd, inbuf, fdlist[i].dsize,
lib/libc/rpc/clnt_bcast.c
637
_close(fdlist[i].fd);
lib/libc/rpc/clnt_dg.c
140
clnt_dg_create(int fd, /* open file descriptor */
lib/libc/rpc/clnt_dg.c
197
if (!__rpc_fd2sockinfo(fd, &si)) {
lib/libc/rpc/clnt_dg.c
250
bindresvport_sa(fd, (struct sockaddr *)svcaddr->buf);
lib/libc/rpc/clnt_dg.c
252
_ioctl(fd, FIONBIO, (char *)(void *)&one);
lib/libc/rpc/clnt_dg.c
260
cu->cu_fd = fd;
lib/libc/rpc/clnt_dg.c
89
#define release_fd_lock(fd, mask) { \
lib/libc/rpc/clnt_dg.c
91
dg_fd_locks[fd] = 0; \
lib/libc/rpc/clnt_dg.c
94
cond_signal(&dg_cv[fd]); \
lib/libc/rpc/clnt_generic.c
345
clnt_tli_create(int fd, const struct netconfig *nconf,
lib/libc/rpc/clnt_generic.c
356
if (fd == RPC_ANYFD) {
lib/libc/rpc/clnt_generic.c
362
fd = __rpc_nconf2fd(nconf);
lib/libc/rpc/clnt_generic.c
364
if (fd == -1)
lib/libc/rpc/clnt_generic.c
366
if (fd < __rpc_minfd)
lib/libc/rpc/clnt_generic.c
367
fd = __rpc_raise_fd(fd);
lib/libc/rpc/clnt_generic.c
370
if (!__rpc_fd2sockinfo(fd, &si))
lib/libc/rpc/clnt_generic.c
372
bindresvport(fd, NULL);
lib/libc/rpc/clnt_generic.c
374
if (!__rpc_fd2sockinfo(fd, &si))
lib/libc/rpc/clnt_generic.c
390
cl = clnt_vc_create(fd, svcaddr, prog, vers, sendsz, recvsz);
lib/libc/rpc/clnt_generic.c
394
_setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &one,
lib/libc/rpc/clnt_generic.c
397
cl = clnt_vc_create(fd, svcaddr, prog, vers, sendsz, recvsz);
lib/libc/rpc/clnt_generic.c
400
cl = clnt_dg_create(fd, svcaddr, prog, vers, sendsz, recvsz);
lib/libc/rpc/clnt_generic.c
426
_close(fd);
lib/libc/rpc/clnt_generic.c
439
__rpc_raise_fd(int fd)
lib/libc/rpc/clnt_generic.c
443
if (fd >= __rpc_minfd)
lib/libc/rpc/clnt_generic.c
444
return (fd);
lib/libc/rpc/clnt_generic.c
446
if ((nfd = _fcntl(fd, F_DUPFD, __rpc_minfd)) == -1)
lib/libc/rpc/clnt_generic.c
447
return (fd);
lib/libc/rpc/clnt_generic.c
451
return (fd);
lib/libc/rpc/clnt_generic.c
454
if (_close(fd) == -1) {
lib/libc/rpc/clnt_generic.c
456
syslog(LOG_ERR, "could not close() fd %d; mem & fd leak", fd);
lib/libc/rpc/clnt_simple.c
147
int fd;
lib/libc/rpc/clnt_simple.c
169
if (CLNT_CONTROL(rcp->client, CLGET_FD, (char *)(void *)&fd))
lib/libc/rpc/clnt_simple.c
170
_fcntl(fd, F_SETFD, 1); /* make it "close on exec" */
lib/libc/rpc/clnt_vc.c
128
#define release_fd_lock(fd, mask) { \
lib/libc/rpc/clnt_vc.c
130
vc_fd_locks[fd] = 0; \
lib/libc/rpc/clnt_vc.c
133
cond_signal(&vc_cv[fd]); \
lib/libc/rpc/clnt_vc.c
152
clnt_vc_create(int fd, /* open file descriptor */
lib/libc/rpc/clnt_vc.c
220
if (_getpeername(fd, (struct sockaddr *)(void *)&ss, &slen) < 0) {
lib/libc/rpc/clnt_vc.c
228
if (_connect(fd, (struct sockaddr *)raddr->buf, raddr->len) < 0){
lib/libc/rpc/clnt_vc.c
238
if (!__rpc_fd2sockinfo(fd, &si))
lib/libc/rpc/clnt_vc.c
246
ct->ct_fd = fd;
lib/libc/rpc/clnt_vc.c
273
_close(fd);
lib/libc/rpc/clnt_vc.c
641
struct pollfd fd;
lib/libc/rpc/clnt_vc.c
647
fd.fd = ct->ct_fd;
lib/libc/rpc/clnt_vc.c
648
fd.events = POLLIN;
lib/libc/rpc/clnt_vc.c
650
switch (_poll(&fd, 1, milliseconds)) {
lib/libc/rpc/getpublickey.c
100
res = fgets(buf, sizeof(buf), fd);
lib/libc/rpc/getpublickey.c
102
fclose(fd);
lib/libc/rpc/getpublickey.c
129
fclose(fd);
lib/libc/rpc/getpublickey.c
156
fclose(fd);
lib/libc/rpc/getpublickey.c
92
FILE *fd;
lib/libc/rpc/getpublickey.c
96
fd = fopen(PKFILE, "r");
lib/libc/rpc/getpublickey.c
97
if (fd == NULL)
lib/libc/rpc/key_call.c
295
int fd;
lib/libc/rpc/key_call.c
394
if (clnt_control(kcp->client, CLGET_FD, (char *)&fd))
lib/libc/rpc/key_call.c
395
_fcntl(fd, F_SETFD, 1); /* make it "close on exec" */
lib/libc/rpc/netnamer.c
242
FILE *fd;
lib/libc/rpc/netnamer.c
250
fd = fopen(NETIDFILE, "r");
lib/libc/rpc/netnamer.c
251
if (fd == NULL) {
lib/libc/rpc/netnamer.c
260
if (fd == NULL)
lib/libc/rpc/netnamer.c
262
res = fgets(buf, sizeof(buf), fd);
lib/libc/rpc/netnamer.c
264
fclose(fd);
lib/libc/rpc/netnamer.c
288
if (fd != NULL)
lib/libc/rpc/netnamer.c
289
fclose(fd);
lib/libc/rpc/netnamer.c
316
fclose(fd);
lib/libc/rpc/rpc_generic.c
457
__rpcgettp(int fd)
lib/libc/rpc/rpc_generic.c
462
if (!__rpc_fd2sockinfo(fd, &si))
lib/libc/rpc/rpc_generic.c
473
__rpc_fd2sockinfo(int fd, struct __rpc_sockinfo *sip)
lib/libc/rpc/rpc_generic.c
480
if (_getsockname(fd, (struct sockaddr *)(void *)&ss, &len) < 0)
lib/libc/rpc/rpc_generic.c
485
if (_getsockopt(fd, SOL_SOCKET, SO_TYPE, &type, &len) < 0)
lib/libc/rpc/rpc_generic.c
803
__rpc_sockisbound(int fd)
lib/libc/rpc/rpc_generic.c
809
if (_getsockname(fd, (struct sockaddr *)(void *)&ss, &slen) < 0)
lib/libc/rpc/rpc_soc.c
100
fd = __rpc_nconf2fd(nconf);
lib/libc/rpc/rpc_soc.c
101
if (fd == -1)
lib/libc/rpc/rpc_soc.c
125
bindresvport(fd, NULL);
lib/libc/rpc/rpc_soc.c
126
cl = clnt_tli_create(fd, nconf, &bindaddr, prog, vers,
lib/libc/rpc/rpc_soc.c
134
*sockp = fd;
lib/libc/rpc/rpc_soc.c
147
_close(fd);
lib/libc/rpc/rpc_soc.c
197
svc_com_create(int fd, u_int sendsize, u_int recvsize, char *netid)
lib/libc/rpc/rpc_soc.c
209
if (fd == RPC_ANYSOCK) {
lib/libc/rpc/rpc_soc.c
210
fd = __rpc_nconf2fd(nconf);
lib/libc/rpc/rpc_soc.c
211
if (fd == -1) {
lib/libc/rpc/rpc_soc.c
222
bindresvport(fd, &sin);
lib/libc/rpc/rpc_soc.c
223
_listen(fd, SOMAXCONN);
lib/libc/rpc/rpc_soc.c
224
svc = svc_tli_create(fd, nconf, NULL, sendsize, recvsize);
lib/libc/rpc/rpc_soc.c
228
_close(fd);
lib/libc/rpc/rpc_soc.c
237
svctcp_create(int fd, u_int sendsize, u_int recvsize)
lib/libc/rpc/rpc_soc.c
240
return svc_com_create(fd, sendsize, recvsize, "tcp");
lib/libc/rpc/rpc_soc.c
244
svcudp_bufcreate(int fd, u_int sendsz, u_int recvsz)
lib/libc/rpc/rpc_soc.c
247
return svc_com_create(fd, sendsz, recvsz, "udp");
lib/libc/rpc/rpc_soc.c
251
svcfd_create(int fd, u_int sendsize, u_int recvsize)
lib/libc/rpc/rpc_soc.c
254
return svc_fd_create(fd, sendsize, recvsize);
lib/libc/rpc/rpc_soc.c
259
svcudp_create(int fd)
lib/libc/rpc/rpc_soc.c
262
return svc_com_create(fd, UDPMSGSIZE, UDPMSGSIZE, "udp");
lib/libc/rpc/rpc_soc.c
507
svcunixfd_create(int fd, u_int sendsize, u_int recvsize)
lib/libc/rpc/rpc_soc.c
509
return (svc_fd_create(fd, sendsize, recvsize));
lib/libc/rpc/rpc_soc.c
89
int fd = *sockp;
lib/libc/rpc/rpc_soc.c
99
if (fd == RPC_ANYSOCK) {
lib/libc/rpc/rpcb_clnt.c
489
int fd;
lib/libc/rpc/rpcb_clnt.c
508
fd = __rpc_nconf2fd(nconf);
lib/libc/rpc/rpcb_clnt.c
513
if (fd < 0)
lib/libc/rpc/rpcb_clnt.c
515
_close(fd);
lib/libc/rpc/svc.c
515
int bit, fd;
lib/libc/rpc/svc.c
526
fd = sock + bit - 1;
lib/libc/rpc/svc.c
527
svc_getreq_common(fd);
lib/libc/rpc/svc.c
533
svc_getreq_common(int fd)
lib/libc/rpc/svc.c
549
xprt = __svc_xports[fd];
lib/libc/rpc/svc.c
605
if (xprt != __svc_xports[fd]) {
lib/libc/rpc/svc.c
644
FD_CLR(p->fd, &svc_fdset);
lib/libc/rpc/svc.c
647
svc_getreq_common(p->fd);
lib/libc/rpc/svc_dg.c
106
if (!__rpc_fd2sockinfo(fd, &si)) {
lib/libc/rpc/svc_dg.c
134
xprt->xp_fd = fd;
lib/libc/rpc/svc_dg.c
141
if (_getsockname(fd, (struct sockaddr *)(void *)&ss, &slen) < 0)
lib/libc/rpc/svc_dg.c
98
svc_dg_create(int fd, u_int sendsize, u_int recvsize)
lib/libc/rpc/svc_generic.c
182
int fd, /* Connection end point */
lib/libc/rpc/svc_generic.c
194
if (fd == RPC_ANYFD) {
lib/libc/rpc/svc_generic.c
199
fd = __rpc_nconf2fd(nconf);
lib/libc/rpc/svc_generic.c
200
if (fd == -1) {
lib/libc/rpc/svc_generic.c
212
if (!__rpc_fd2sockinfo(fd, &si)) {
lib/libc/rpc/svc_generic.c
222
if (madefd || !__rpc_sockisbound(fd)) {
lib/libc/rpc/svc_generic.c
224
if (bindresvport(fd, NULL) < 0) {
lib/libc/rpc/svc_generic.c
228
if (_bind(fd, (struct sockaddr *)(void *)&ss,
lib/libc/rpc/svc_generic.c
235
_listen(fd, SOMAXCONN);
lib/libc/rpc/svc_generic.c
237
if (_bind(fd,
lib/libc/rpc/svc_generic.c
244
_listen(fd, (int)bindaddr->qlen);
lib/libc/rpc/svc_generic.c
254
if (_getpeername(fd, (struct sockaddr *)(void *)&ss, &slen)
lib/libc/rpc/svc_generic.c
257
xprt = svc_fd_create(fd, sendsz, recvsz);
lib/libc/rpc/svc_generic.c
259
xprt = svc_vc_create(fd, sendsz, recvsz);
lib/libc/rpc/svc_generic.c
270
xprt = svc_dg_create(fd, sendsz, recvsz);
lib/libc/rpc/svc_generic.c
295
_close(fd);
lib/libc/rpc/svc_vc.c
122
svc_vc_create(int fd, u_int sendsize, u_int recvsize)
lib/libc/rpc/svc_vc.c
130
if (!__rpc_fd2sockinfo(fd, &si))
lib/libc/rpc/svc_vc.c
153
xprt->xp_fd = fd;
lib/libc/rpc/svc_vc.c
156
if (_getsockname(fd, (struct sockaddr *)(void *)&sslocal, &slen) < 0) {
lib/libc/rpc/svc_vc.c
185
svc_fd_create(int fd, u_int sendsize, u_int recvsize)
lib/libc/rpc/svc_vc.c
191
assert(fd != -1);
lib/libc/rpc/svc_vc.c
193
ret = makefd_xprt(fd, sendsize, recvsize);
lib/libc/rpc/svc_vc.c
198
if (_getsockname(fd, (struct sockaddr *)(void *)&ss, &slen) < 0) {
lib/libc/rpc/svc_vc.c
211
if (_getpeername(fd, (struct sockaddr *)(void *)&ss, &slen) < 0) {
lib/libc/rpc/svc_vc.c
239
makefd_xprt(int fd, u_int sendsize, u_int recvsize)
lib/libc/rpc/svc_vc.c
246
assert(fd != -1);
lib/libc/rpc/svc_vc.c
268
xprt->xp_fd = fd;
lib/libc/rpc/svc_vc.c
269
if (__rpc_fd2sockinfo(fd, &si) && __rpc_sockinfo2netid(&si, &netid))
lib/libc/rpc/svc_vc.c
470
pollfd.fd = sock;
lib/libc/secure/stack_protector.c
50
int fd;
lib/libc/secure/stack_protector.c
55
if ((fd = _open ("/dev/urandom", 0)) >= 0) {
lib/libc/secure/stack_protector.c
56
size = _read (fd, (char*)&__stack_chk_guard, sizeof(__stack_chk_guard));
lib/libc/secure/stack_protector.c
57
_close (fd);
lib/libc/stdio/dprintf.c
35
dprintf(int fd, const char * __restrict fmt, ...)
lib/libc/stdio/dprintf.c
41
ret = vdprintf(fd, fmt, ap);
lib/libc/stdio/fdopen.c
47
fdopen(int fd, const char *mode)
lib/libc/stdio/fdopen.c
56
if ((fdflags = _fcntl(fd, F_GETFL, 0)) < 0)
lib/libc/stdio/fdopen.c
68
((tmp = _fcntl(fd, F_GETFD, 0)) & FD_CLOEXEC) == 0)
lib/libc/stdio/fdopen.c
69
_fcntl(fd, F_SETFD, tmp | FD_CLOEXEC); /* silently ignore err */
lib/libc/stdio/fdopen.c
79
fp->pub._fileno = fd;
lib/libc/stdio/fileno.c
48
int fd;
lib/libc/stdio/fileno.c
51
fd = __sfileno(fp);
lib/libc/stdio/fileno.c
54
return (fd);
lib/libc/stdio/mktemp.c
56
int fd;
lib/libc/stdio/mktemp.c
58
return (_gettemp(path, &fd, 0, slen, 0) ? fd : -1);
lib/libc/stdio/mktemp.c
64
int fd;
lib/libc/stdio/mktemp.c
66
return (_gettemp(path, &fd, 0, slen, oflags) ? fd : -1);
lib/libc/stdio/mktemp.c
72
int fd;
lib/libc/stdio/mktemp.c
74
return (_gettemp(path, &fd, 0, 0, 0) ? fd : -1);
lib/libc/stdio/mktemp.c
80
int fd;
lib/libc/stdio/mktemp.c
82
return (_gettemp(path, &fd, 0, 0, oflags) ? fd : -1);
lib/libc/stdio/tmpfile.c
53
int fd, sverrno;
lib/libc/stdio/tmpfile.c
72
fd = mkstemp(buf);
lib/libc/stdio/tmpfile.c
73
if (fd != -1)
lib/libc/stdio/tmpfile.c
80
if (fd == -1)
lib/libc/stdio/tmpfile.c
83
if ((fp = fdopen(fd, "w+")) == NULL) {
lib/libc/stdio/tmpfile.c
85
_close(fd);
lib/libc/stdio/vdprintf.c
46
vdprintf(int fd, const char * __restrict fmt, va_list ap)
lib/libc/stdio/vdprintf.c
52
if (fd > SHRT_MAX) {
lib/libc/stdio/vdprintf.c
60
f.pub._fileno = fd;
lib/libc/stdlib/posix_fadvise.c
40
posix_fadvise(int fd, off_t offset, off_t len, int advice)
lib/libc/stdlib/posix_fadvise.c
48
if ((ret = _fstat(fd, &buf)) != 0)
lib/libc/stdlib/ptsname.c
109
if (((error = fdevname_r(fd, buf+used, sizeof(ptsname_buf)-used))) != 0) {
lib/libc/stdlib/ptsname.c
126
unlockpt(int fd)
lib/libc/stdlib/ptsname.c
128
return __isptmaster(fd);
lib/libc/stdlib/ptsname.c
132
grantpt(int fd)
lib/libc/stdlib/ptsname.c
134
return __isptmaster(fd);
lib/libc/stdlib/ptsname.c
62
__isptmaster(int fd)
lib/libc/stdlib/ptsname.c
66
error = _ioctl(fd, TIOCISPTMASTER);
lib/libc/stdlib/ptsname.c
80
ptsname(int fd)
lib/libc/stdlib/ptsname.c
86
error = __isptmaster(fd);
lib/libc/stdlib/rand.c
109
int fd, done;
lib/libc/stdlib/rand.c
112
fd = _open("/dev/random", O_RDONLY, 0);
lib/libc/stdlib/rand.c
113
if (fd >= 0) {
lib/libc/stdlib/rand.c
114
if (_read(fd, (void *) &next, sizeof(next)) == sizeof(next))
lib/libc/stdlib/rand.c
116
_close(fd);
lib/libc/stdlib/random.c
275
int fd;
lib/libc/stdlib/random.c
285
fd = _open("/dev/random", O_RDONLY|O_CLOEXEC, 0);
lib/libc/stdlib/random.c
286
if (fd >= 0) {
lib/libc/stdlib/random.c
287
n = _read(fd, (void *)state, len);
lib/libc/stdlib/random.c
288
_close(fd);
lib/libc/sys/ftruncate.c
44
ftruncate(int fd, off_t length)
lib/libc/sys/ftruncate.c
47
return(__syscall((quad_t)SYS_ftruncate, fd, 0, length));
lib/libc/sys/lseek.c
42
lseek(int fd, off_t offset, int whence)
lib/libc/sys/lseek.c
44
return(__syscall((quad_t)SYS_lseek, fd, 0, offset, whence));
lib/libc/sys/mmap.c
43
mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset)
lib/libc/sys/mmap.c
47
fd, 0, offset));
lib/libc/sys/pread.c
42
pread(int fd, void *buf, size_t nbyte, off_t offset)
lib/libc/sys/pread.c
44
return (extpread(fd, buf, nbyte, 0, offset));
lib/libc/sys/preadv.c
43
preadv(int fd, const struct iovec *iovp, int iovcnt, off_t offset)
lib/libc/sys/preadv.c
45
return (extpreadv(fd, iovp, iovcnt, 0, offset));
lib/libc/sys/pwrite.c
42
pwrite(int fd, const void *buf, size_t nbyte, off_t offset)
lib/libc/sys/pwrite.c
44
return (extpwrite(fd, buf, nbyte, 0, offset));
lib/libc/sys/pwritev.c
43
pwritev(int fd, const struct iovec *iovp, int iovcnt, off_t offset)
lib/libc/sys/pwritev.c
45
return (extpwritev(fd, iovp, iovcnt, 0, offset));
lib/libc/sysvipc/ipc.c
62
send_message(int fd, int type, char *data, int size)
lib/libc/sysvipc/ipc.c
64
_write(fd, &type, sizeof(type));
lib/libc/sysvipc/ipc.c
65
return (send_msg_with_cred(fd, data, size));
lib/libc/sysvipc/ipc.c
70
receive_type_message(int fd)
lib/libc/sysvipc/ipc.c
73
int r = _read(fd, &type, sizeof(type));
lib/libc/sysvipc/ipc.c
79
receive_message(int fd, char *data, int size)
lib/libc/sysvipc/ipc.c
81
_read(fd, data, size);
lib/libc/sysvipc/shm.c
144
int shmid, fd;
lib/libc/sysvipc/shm.c
162
fd = receive_fd(daemon_fd);
lib/libc/sysvipc/shm.c
163
if (fd < 0) {
lib/libc/sysvipc/shm.c
168
flags = _fcntl(fd, F_GETFD, 0);
lib/libc/sysvipc/shm.c
169
if (_fcntl(fd, F_SETFD, flags & FD_CLOEXEC) == -1) {
lib/libc/sysvipc/shm.c
191
data->fd = fd;
lib/libc/sysvipc/shm.c
269
addr = mmap(addr, size, prot, flags, data->fd, 0);
lib/libc/sysvipc/shm.c
295
_close(data->fd);
lib/libc/sysvipc/sockets.c
131
send_fd(int sock, int fd)
lib/libc/sysvipc/sockets.c
147
if (fd < 0)
lib/libc/sysvipc/sockets.c
151
msg.msg_accrights = (caddr_t)&fd;
lib/libc/sysvipc/sockets.c
152
msg.msg_accrightslen = sizeof(fd);
lib/libc/sysvipc/sockets.c
160
*(int *)CMSG_DATA(cmsg) = fd;
lib/libc/sysvipc/sockets.c
197
int fd;
lib/libc/sysvipc/sockets.c
206
msg.msg_accrights = (caddr_t)&fd;
lib/libc/sysvipc/sockets.c
207
msg.msg_accrightslen = sizeof(fd);
lib/libc/sysvipc/sockets.c
229
fd = (*(int *)CMSG_DATA(cmsg));
lib/libc/sysvipc/sockets.c
230
return (fd);
lib/libc/sysvipc/sockets.c
85
int fd, flags;
lib/libc/sysvipc/sockets.c
88
fd = accept(sock, NULL, NULL);
lib/libc/sysvipc/sockets.c
89
} while (fd < 0 && errno == EINTR);
lib/libc/sysvipc/sockets.c
91
if (fd < 0) {
lib/libc/sysvipc/sockets.c
96
flags = fcntl(fd, F_GETFL, 0);
lib/libc/sysvipc/sockets.c
97
fcntl(fd, F_SETFL, flags & ~O_NONBLOCK);
lib/libc/sysvipc/sockets.c
99
return (fd);
lib/libc/sysvipc/sysvipc_shm.h
42
int fd; /* The file descriptor of the file used as
lib/libc/upmap/upmap.c
150
int fd;
lib/libc/upmap/upmap.c
154
fd = _open("/dev/upmap", O_RDWR);
lib/libc/upmap/upmap.c
155
if (fd < 0) {
lib/libc/upmap/upmap.c
162
fd, 0);
lib/libc/upmap/upmap.c
163
_close(fd);
lib/libc/upmap/upmap.c
221
int fd;
lib/libc/upmap/upmap.c
225
fd = _open("/dev/lpmap", O_RDWR);
lib/libc/upmap/upmap.c
226
if (fd < 0) {
lib/libc/upmap/upmap.c
233
fd, 0);
lib/libc/upmap/upmap.c
234
_close(fd);
lib/libc/upmap/upmap.c
85
int fd;
lib/libc/upmap/upmap.c
89
fd = _open("/dev/kpmap", O_RDONLY);
lib/libc/upmap/upmap.c
90
if (fd < 0) {
lib/libc/upmap/upmap.c
96
fd, 0);
lib/libc/upmap/upmap.c
97
_close(fd);
lib/libc/yp/yplib.c
303
int clnt_sock, fd;
lib/libc/yp/yplib.c
385
if ((fd = _open(path, O_RDONLY | O_CLOEXEC)) == -1) {
lib/libc/yp/yplib.c
388
_close(fd);
lib/libc/yp/yplib.c
391
if (_flock(fd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK) {
lib/libc/yp/yplib.c
401
r = _readv(fd, iov, 2);
lib/libc/yp/yplib.c
403
_close(fd);
lib/libc/yp/yplib.c
419
_close(fd);
lib/libc/yp/yplib.c
424
_close(fd);
lib/libcam/camlib.c
337
int fd, bufsize;
lib/libcam/camlib.c
339
if ((fd = open(XPT_DEVICE, O_RDWR)) < 0) {
lib/libcam/camlib.c
356
close(fd);
lib/libcam/camlib.c
370
close(fd);
lib/libcam/camlib.c
388
if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) {
lib/libcam/camlib.c
430
close(fd);
lib/libcam/camlib.c
446
close(fd);
lib/libcam/camlib.c
467
int fd;
lib/libcam/camlib.c
477
if ((fd = open(XPT_DEVICE, O_RDWR)) < 0) {
lib/libcam/camlib.c
496
if (ioctl(fd, CAMGETPASSTHRU, &ccb) == -1) {
lib/libcam/camlib.c
516
close(fd);
lib/libcam/camlib.c
520
close(fd);
lib/libcam/camlib.c
552
int fd = -1, malloced_device = 0;
lib/libcam/camlib.c
565
device->fd = -1;
lib/libcam/camlib.c
589
if ((fd = open(path, flags)) < 0) {
lib/libcam/camlib.c
597
device->fd = fd;
lib/libcam/camlib.c
612
if (ioctl(fd, CAMGETPASSTHRU, &ccb) == -1) {
lib/libcam/camlib.c
643
if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) {
lib/libcam/camlib.c
657
if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) {
lib/libcam/camlib.c
680
if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) {
lib/libcam/camlib.c
701
if (fd >= 0)
lib/libcam/camlib.c
702
close(fd);
lib/libcam/camlib.c
71
return(ioctl(device->fd, CAMIOCOMMAND, ccb));
lib/libcam/camlib.c
727
if (dev->fd >= 0)
lib/libcam/camlib.c
728
close(dev->fd);
lib/libdm/dm_task.c
234
int fd;
lib/libdm/dm_task.c
237
if ((fd = open("/dev/mapper/control", O_RDWR)) < -1)
lib/libdm/dm_task.c
263
if ((error = prop_dictionary_sendrecv_ioctl(dmt->dict, fd,
lib/libdm/dm_task.c
280
if ((error = prop_dictionary_sendrecv_ioctl(dmt->dict, fd,
lib/libdm/dm_task.c
316
if ((error = prop_dictionary_sendrecv_ioctl(dmt->dict, fd,
lib/libdm/dm_task.c
326
if (fd >= 0)
lib/libdm/dm_task.c
327
close(fd);
lib/libdmsg/crypto.c
355
int fd;
lib/libdmsg/crypto.c
479
fd = open("/dev/urandom", O_RDONLY);
lib/libdmsg/crypto.c
480
if (fd < 0 ||
lib/libdmsg/crypto.c
481
fstat(fd, &st) < 0 || /* something wrong */
lib/libdmsg/crypto.c
483
read(fd, &handtx, sizeof(handtx)) != sizeof(handtx)) {
lib/libdmsg/crypto.c
485
if (fd >= 0)
lib/libdmsg/crypto.c
486
close(fd);
lib/libdmsg/crypto.c
494
close(fd);
lib/libdmsg/dmsg.h
351
int fd;
lib/libdmsg/msg.c
464
fds[wi].fd = iocom->wakeupfds[0];
lib/libdmsg/msg.c
475
fds[si].fd = iocom->sock_fd;
lib/libdmsg/msg.c
490
fds[ai].fd = iocom->alt_fd;
lib/libdmsg/service.c
58
info->fd,
lib/libdmsg/service.c
76
info->fd, iocom.ioq_rx.error, iocom.ioq_tx.error);
lib/libdmsg/service.c
77
close(info->fd);
lib/libdmsg/service.c
78
info->fd = -1; /* safety */
lib/libdmsg/subs.c
100
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
lib/libdmsg/subs.c
106
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof opt);
lib/libdmsg/subs.c
127
if (connect(fd, (struct sockaddr *)&lsin, sizeof(lsin)) < 0) {
lib/libdmsg/subs.c
128
close(fd);
lib/libdmsg/subs.c
135
return (fd);
lib/libdmsg/subs.c
94
int fd;
lib/libefivar/efivar-dp-xlate.c
106
gpt_close(fd);
lib/libefivar/efivar-dp-xlate.c
113
gpt_close(fd);
lib/libefivar/efivar-dp-xlate.c
431
int fd;
lib/libefivar/efivar-dp-xlate.c
461
fd = gpt_open(disk_path);
lib/libefivar/efivar-dp-xlate.c
462
if (fd == -1)
lib/libefivar/efivar-dp-xlate.c
477
gpt_close(fd);
lib/libefivar/efivar-dp-xlate.c
481
gpt_close(fd);
lib/libefivar/efivar-dp-xlate.c
72
int fd;
lib/libefivar/efivar-dp-xlate.c
90
fd = gpt_open(dev_path);
lib/libefivar/efivar-dp-xlate.c
91
if (fd == -1)
lib/libevtr/evtr.c
1857
int fd;
lib/libevtr/evtr.c
1863
fd = fileno(evtr->f);
lib/libevtr/evtr.c
1864
if (fstat(fd, &st))
lib/libexecinfo/backtrace.c
182
int fd;
lib/libexecinfo/backtrace.c
184
if ((fd = open_self(O_RDONLY)) != -1)
lib/libexecinfo/backtrace.c
185
st = symtab_create(fd, -1, STT_FUNC);
lib/libexecinfo/backtrace.c
216
if (fd != -1)
lib/libexecinfo/backtrace.c
217
(void)close(fd);
lib/libexecinfo/backtrace.c
223
backtrace_symbols_fd_fmt(void *const *trace, size_t len, int fd,
lib/libexecinfo/backtrace.c
230
if (dprintf(fd, "%s\n", s[i]) < 0)
lib/libexecinfo/backtrace.c
245
backtrace_symbols_fd(void *const *trace, size_t len, int fd)
lib/libexecinfo/backtrace.c
247
return backtrace_symbols_fd_fmt(trace, len, fd, fmt);
lib/libexecinfo/private_libelf.h
2782
_libelf_read_special_file(int fd, size_t *fsz)
lib/libexecinfo/private_libelf.h
2810
if ((readsz = read(fd, t, bufsz - datasz)) <= 0)
lib/libexecinfo/private_libelf.h
2851
_libelf_open_object(int fd, Elf_Cmd c, int reporterror)
lib/libexecinfo/private_libelf.h
2862
if (fstat(fd, &sb) < 0) {
lib/libexecinfo/private_libelf.h
2886
e->e_fd = fd;
lib/libexecinfo/private_libelf.h
2921
m = mmap(NULL, fsize, PROT_READ, MAP_PRIVATE, fd, (off_t) 0);
lib/libexecinfo/private_libelf.h
2939
if (read(fd, m, fsize) != (ssize_t) fsize) {
lib/libexecinfo/private_libelf.h
2947
} else if ((m = _libelf_read_special_file(fd, &fsize)) != NULL)
lib/libexecinfo/private_libelf.h
2974
e->e_fd = fd;
lib/libexecinfo/private_libelf.h
3062
elf_begin(int fd, Elf_Cmd c, Elf *a)
lib/libexecinfo/private_libelf.h
3099
((a->e_fd != -1 && a->e_fd != fd) || c != a->e_cmd)) {
lib/libexecinfo/private_libelf.h
3112
e = _libelf_open_object(fd, c, 1);
lib/libexecinfo/symtab.c
86
symtab_create(int fd, int bind, int type)
lib/libexecinfo/symtab.c
97
elf = elf_begin(fd, ELF_C_READ, NULL);
lib/libfetch/common.c
1351
pfd.fd = conn->sd;
lib/libfetch/common.c
1487
pfd.fd = conn->sd;
lib/libfetch/common.c
1661
int fd, serrno;
lib/libfetch/common.c
1680
if ((fd = open(fn, O_RDONLY)) < 0) {
lib/libfetch/common.c
1685
return (fd);
lib/libfsid/libfsid.c
134
int fd;
lib/libfsid/libfsid.c
136
if ((fd = open(dev, O_RDONLY)) < 0)
lib/libfsid/libfsid.c
139
if ((lseek(fd, off, SEEK_SET)) < 0) {
lib/libfsid/libfsid.c
140
close(fd);
lib/libfsid/libfsid.c
145
if ((read(fd, buf, len)) < 0) {
lib/libfsid/libfsid.c
146
close(fd);
lib/libfsid/libfsid.c
150
close(fd);
lib/libftpio/ftpio.c
1048
fd = accept(s, 0, 0);
lib/libftpio/ftpio.c
1049
if (fd < 0) {
lib/libftpio/ftpio.c
1055
*fp = fdopen(fd, mode);
lib/libftpio/ftpio.c
509
int i, fd;
lib/libftpio/ftpio.c
512
fd = n->fd_ctrl;
lib/libftpio/ftpio.c
513
i = (fd >= 0) ? read(fd, buf, nbytes) : EOF;
lib/libftpio/ftpio.c
520
int i, fd;
lib/libftpio/ftpio.c
523
fd = n->fd_ctrl;
lib/libftpio/ftpio.c
524
i = (fd >= 0) ? write(fd, buf, nbytes) : EOF;
lib/libftpio/ftpio.c
58
static int writes(int fd, const char *s);
lib/libftpio/ftpio.c
589
writes(int fd, const char *s)
lib/libftpio/ftpio.c
594
n = write(fd, s, i);
lib/libftpio/ftpio.c
949
int fd,portrange;
lib/libhammer/info.c
125
close (fd);
lib/libhammer/info.c
57
int fd;
lib/libhammer/info.c
59
if ((fd = open(path, O_RDONLY)) < 0)
lib/libhammer/info.c
64
if ((ioctl(fd, HAMMERIOC_GET_INFO, &info)) < 0) {
lib/libhammer/info.c
66
close(fd);
lib/libhammer/info.c
87
error = ioctl(fd, HAMMERIOC_SCAN_PSEUDOFS, &pfs);
lib/libhammer/misc.c
100
close(fd);
lib/libhammer/misc.c
108
close(fd);
lib/libhammer/misc.c
113
close(fd);
lib/libhammer/misc.c
59
int fd;
lib/libhammer/misc.c
98
fd = open(mnt->f_mntonname, O_RDONLY);
lib/libhammer/misc.c
99
if (fd < 0 || (ioctl(fd, HAMMERIOC_GET_PSEUDOFS, &pfs) < 0)) {
lib/libhammer/snapshot.c
115
close(fd);
lib/libhammer/snapshot.c
57
int fd;
lib/libhammer/snapshot.c
81
if (path == NULL || (fd = open(path, O_RDONLY)) < 0) {
lib/libhammer/snapshot.c
96
if (ioctl(fd, HAMMERIOC_GET_SNAPSHOT, &snap) < 0) {
lib/libhammer/snapshot.c
99
close(fd);
lib/libkvm/kvm_proc.c
918
int fd;
lib/libkvm/kvm_proc.c
927
fd = open(procfile, O_RDONLY, 0);
lib/libkvm/kvm_proc.c
928
if (fd < 0) {
lib/libkvm/kvm_proc.c
930
close(fd);
lib/libkvm/kvm_proc.c
937
if (lseek(fd, (off_t)uva, 0) == -1 && errno != 0) {
lib/libkvm/kvm_proc.c
942
amount = read(fd, cp, len);
lib/libkvm/kvm_proc.c
957
close(fd);
lib/libldns/ldns/util.h
313
int ldns_init_random(FILE *fd, unsigned int size);
lib/libnetgraph7/msg.c
240
rfds.fd = cs;
lib/libpam/modules/pam_nologin/pam_nologin.c
100
fd = open(nologin, O_RDONLY, 0);
lib/libpam/modules/pam_nologin/pam_nologin.c
101
if (fd < 0) {
lib/libpam/modules/pam_nologin/pam_nologin.c
108
if (fstat(fd, &st) == 0) {
lib/libpam/modules/pam_nologin/pam_nologin.c
111
ss = read(fd, mtmp, st.st_size);
lib/libpam/modules/pam_nologin/pam_nologin.c
122
close(fd);
lib/libpam/modules/pam_nologin/pam_nologin.c
67
int retval, fd;
lib/libposix1e/acl_get.c
61
acl_get_fd(int fd)
lib/libposix1e/acl_get.c
71
error = __acl_get_fd(fd, ACL_TYPE_ACCESS, aclp);
lib/libposix1e/acl_get.c
81
acl_get_fd_np(int fd, acl_type_t type)
lib/libposix1e/acl_get.c
91
error = __acl_get_fd(fd, type, aclp);
lib/libposix1e/acl_set.c
62
acl_set_fd(int fd, acl_t acl)
lib/libposix1e/acl_set.c
72
return (__acl_set_fd(fd, ACL_TYPE_ACCESS, acl));
lib/libposix1e/acl_set.c
76
acl_set_fd_np(int fd, acl_t acl, acl_type_t type)
lib/libposix1e/acl_set.c
88
return (__acl_set_fd(fd, type, acl));
lib/libposix1e/acl_valid.c
85
acl_valid_fd_np(int fd, acl_type_t type, acl_t acl)
lib/libposix1e/acl_valid.c
97
return (__acl_aclcheck_fd(fd, type, acl));
lib/librt/mq.c
39
extern int __sys_mq_close(int fd);
lib/libssh/openbsd-compat/bsd-misc.c
128
utimensat(int fd, const char *path, const struct timespec times[2],
lib/libssh/openbsd-compat/bsd-misc.c
141
if (fd != AT_FDCWD) {
lib/libssh/openbsd-compat/bsd-misc.c
152
if ((fd = open(path, oflags)) == -1)
lib/libssh/openbsd-compat/bsd-misc.c
154
ret = futimes(fd, tv);
lib/libssh/openbsd-compat/bsd-misc.c
155
close(fd);
lib/libssh/openbsd-compat/bsd-misc.c
168
fchownat(int fd, const char *path, uid_t owner, gid_t group, int flag)
lib/libssh/openbsd-compat/bsd-misc.c
172
if (fd != AT_FDCWD) {
lib/libssh/openbsd-compat/bsd-misc.c
183
if ((fd = open(path, oflags)) == -1)
lib/libssh/openbsd-compat/bsd-misc.c
185
ret = fchown(fd, owner, group);
lib/libssh/openbsd-compat/bsd-misc.c
186
close(fd);
lib/libssh/openbsd-compat/bsd-misc.c
199
fchmodat(int fd, const char *path, mode_t mode, int flag)
lib/libssh/openbsd-compat/bsd-misc.c
203
if (fd != AT_FDCWD) {
lib/libssh/openbsd-compat/bsd-misc.c
214
if ((fd = open(path, oflags)) == -1)
lib/libssh/openbsd-compat/bsd-misc.c
216
ret = fchmod(fd, mode);
lib/libssh/openbsd-compat/bsd-misc.c
217
close(fd);
lib/libssh/openbsd-compat/bsd-misc.c
226
int fd, ret, saverrno;
lib/libssh/openbsd-compat/bsd-misc.c
228
fd = open(path, O_WRONLY);
lib/libssh/openbsd-compat/bsd-misc.c
229
if (fd < 0)
lib/libssh/openbsd-compat/bsd-misc.c
232
ret = ftruncate(fd, length);
lib/libssh/openbsd-compat/bsd-misc.c
234
close(fd);
lib/libssh/openbsd-compat/bsd-misc.c
286
tcgetpgrp(int fd)
lib/libssh/openbsd-compat/bsd-misc.c
290
if (ioctl(fd, TIOCGPGRP, &ctty_pgrp) == -1)
lib/libssh/openbsd-compat/bsd-misc.c
299
tcsendbreak(int fd, int duration)
lib/libssh/openbsd-compat/bsd-misc.c
306
if (ioctl(fd, TIOCSBRK, 0) == -1)
lib/libssh/openbsd-compat/bsd-misc.c
309
if (ioctl(fd, TIOCCBRK, 0) == -1)
lib/libssh/openbsd-compat/port-net.c
100
sys_get_rdomain(int fd)
lib/libssh/openbsd-compat/port-net.c
106
sys_set_rdomain(int fd, const char *name)
lib/libssh/openbsd-compat/port-net.c
147
int fd = -1;
lib/libssh/openbsd-compat/port-net.c
152
if ((fd = open(TUN_CTRL_DEV, O_RDWR)) == -1) {
lib/libssh/openbsd-compat/port-net.c
178
if (ioctl(fd, TUNSETIFF, &ifr) == -1) {
lib/libssh/openbsd-compat/port-net.c
185
debug("%s: tunnel mode %d fd %d", __func__, mode, fd);
lib/libssh/openbsd-compat/port-net.c
187
debug("%s: %s mode %d fd %d", __func__, ifr.ifr_name, mode, fd);
lib/libssh/openbsd-compat/port-net.c
192
return (fd);
lib/libssh/openbsd-compat/port-net.c
195
close(fd);
lib/libssh/openbsd-compat/port-net.c
213
int fd = -1, sock;
lib/libssh/openbsd-compat/port-net.c
234
fd = open(name, O_RDWR);
lib/libssh/openbsd-compat/port-net.c
239
if ((fd = open(name, O_RDWR)) >= 0)
lib/libssh/openbsd-compat/port-net.c
247
if (fd < 0) {
lib/libssh/openbsd-compat/port-net.c
257
ioctl(fd, TUNSIFHEAD, &flag) == -1) {
lib/libssh/openbsd-compat/port-net.c
258
debug("%s: ioctl(%d, TUNSIFHEAD, 1): %s", __func__, fd,
lib/libssh/openbsd-compat/port-net.c
260
close(fd);
lib/libssh/openbsd-compat/port-net.c
264
debug("%s: %s mode %d fd %d", __func__, name, mode, fd);
lib/libssh/openbsd-compat/port-net.c
283
return (fd);
lib/libssh/openbsd-compat/port-net.c
286
if (fd >= 0)
lib/libssh/openbsd-compat/port-net.c
287
close(fd);
lib/libssh/openbsd-compat/port-net.c
51
sys_get_rdomain(int fd)
lib/libssh/openbsd-compat/port-net.c
56
if (getsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, dev, &len) == -1) {
lib/libssh/openbsd-compat/port-net.c
58
__func__, fd, strerror(errno));
lib/libssh/openbsd-compat/port-net.c
66
sys_set_rdomain(int fd, const char *name)
lib/libssh/openbsd-compat/port-net.c
68
if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE,
lib/libssh/openbsd-compat/port-net.c
71
__func__, fd, name, strerror(errno));
lib/libssh/openbsd-compat/port-net.c
80
int fd;
lib/libssh/openbsd-compat/port-net.c
87
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
lib/libssh/openbsd-compat/port-net.c
89
if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE,
lib/libssh/openbsd-compat/port-net.c
91
close(fd);
lib/libssh/openbsd-compat/port-net.c
94
close(fd);
lib/libssh/openbsd-compat/port-net.h
38
char *sys_get_rdomain(int fd);
lib/libssh/openbsd-compat/port-net.h
39
int sys_set_rdomain(int fd, const char *name);
lib/libtcplay/io.c
114
int fd;
lib/libtcplay/io.c
121
if ((fd = open((weak) ? "/dev/urandom" : "/dev/random", O_RDONLY)) < 0) {
lib/libtcplay/io.c
138
if ((r = read(fd, buf+rd, sz)) < 0) {
lib/libtcplay/io.c
140
fd, strerror(errno));
lib/libtcplay/io.c
141
close(fd);
lib/libtcplay/io.c
150
close(fd);
lib/libtcplay/io.c
180
int fd_rand, fd;
lib/libtcplay/io.c
195
if ((fd = open(dev, O_WRONLY)) < 0) {
lib/libtcplay/io.c
215
close(fd);
lib/libtcplay/io.c
225
if ((w = write(fd, buf, r)) < 0) {
lib/libtcplay/io.c
227
close(fd);
lib/libtcplay/io.c
237
close(fd);
lib/libtcplay/io.c
251
int fd;
lib/libtcplay/io.c
253
if ((fd = open(dev, O_RDONLY)) < 0) {
lib/libtcplay/io.c
260
if (ioctl(fd, DIOCGPART, &pinfo) < 0) {
lib/libtcplay/io.c
261
close(fd);
lib/libtcplay/io.c
268
close(fd);
lib/libtcplay/io.c
277
int fd;
lib/libtcplay/io.c
279
if ((fd = open(dev, O_RDONLY)) < 0) {
lib/libtcplay/io.c
284
if ((ioctl(fd, BLKSSZGET, &blocksz)) < 0) {
lib/libtcplay/io.c
285
close(fd);
lib/libtcplay/io.c
289
if ((ioctl(fd, BLKGETSIZE64, &nbytes)) < 0) {
lib/libtcplay/io.c
290
close(fd);
lib/libtcplay/io.c
297
close(fd);
lib/libtcplay/io.c
310
int fd;
lib/libtcplay/io.c
337
if ((fd = open(dev, O_WRONLY)) < 0) {
lib/libtcplay/io.c
342
if ((lseek(fd, offset, (offset >= 0) ? SEEK_SET : SEEK_END) < 0)) {
lib/libtcplay/io.c
344
close(fd);
lib/libtcplay/io.c
348
if ((w = write(fd, (mem_buf != NULL) ? mem_buf : mem, bytes)) <= 0) {
lib/libtcplay/io.c
350
close(fd);
lib/libtcplay/io.c
354
close(fd);
lib/libtcplay/io.c
365
int fd;
lib/libtcplay/io.c
368
if ((fd = open(file, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR)) < 0) {
lib/libtcplay/io.c
373
if ((w = write(fd, mem, bytes)) < 0) {
lib/libtcplay/io.c
375
close(fd);
lib/libtcplay/io.c
379
close(fd);
lib/libtcplay/io.c
400
int fd = STDIN_FILENO, r = 0, nready;
lib/libtcplay/io.c
402
int is_tty = isatty(fd);
lib/libtcplay/io.c
415
tcgetattr(fd, &termios_old);
lib/libtcplay/io.c
423
tty_fd = fd;
lib/libtcplay/io.c
426
tcsetattr(fd, TCSAFLUSH, &termios_new);
lib/libtcplay/io.c
434
FD_SET(fd, &fds);
lib/libtcplay/io.c
435
nready = select(fd + 1, &fds, NULL, NULL, &to);
lib/libtcplay/io.c
442
n = read(fd, pass, bufsz-1);
lib/libtcplay/io.c
459
tcsetattr(fd, TCSAFLUSH, &termios_old);
lib/libtcplay/io.c
56
int fd;
lib/libtcplay/io.c
58
if ((fd = open(file, O_RDONLY)) < 0) {
lib/libtcplay/io.c
68
if ((lseek(fd, offset, (offset >= 0) ? SEEK_SET : SEEK_END) < 0)) {
lib/libtcplay/io.c
73
if ((r = read(fd, mem, *sz)) <= 0) {
lib/libtcplay/io.c
80
close(fd);
lib/libtcplay/io.c
86
close(fd);
lib/libthread_xu/thread/thr_init.c
240
int fd, first = 0;
lib/libthread_xu/thread/thr_init.c
261
if ((fd = __sys_open(_PATH_CONSOLE, O_RDWR)) < 0)
lib/libthread_xu/thread/thr_init.c
265
if (__sys_ioctl(fd, TIOCSCTTY, NULL) == -1)
lib/libthread_xu/thread/thr_printf.c
113
pchar(fd, *s);
lib/libthread_xu/thread/thr_printf.c
117
pchar(fd, c);
lib/libthread_xu/thread/thr_printf.c
125
pchar(int fd, char c)
lib/libthread_xu/thread/thr_printf.c
128
__sys_write(fd, &c, 1);
lib/libthread_xu/thread/thr_printf.c
135
pstr(int fd, const char *s)
lib/libthread_xu/thread/thr_printf.c
138
__sys_write(fd, s, strlen(s));
lib/libthread_xu/thread/thr_printf.c
34
static void pchar(int fd, char c);
lib/libthread_xu/thread/thr_printf.c
35
static void pstr(int fd, const char *s);
lib/libthread_xu/thread/thr_printf.c
49
_thread_printf(int fd, const char *fmt, ...)
lib/libthread_xu/thread/thr_printf.c
54
_thread_vprintf(fd, fmt, ap);
lib/libthread_xu/thread/thr_printf.c
59
_thread_vprintf(int fd, const char *fmt, va_list ap)
lib/libthread_xu/thread/thr_printf.c
77
pchar(fd, va_arg(ap, int));
lib/libthread_xu/thread/thr_printf.c
80
pstr(fd, va_arg(ap, char *));
lib/libthread_xu/thread/thr_printf.c
98
pchar(fd, '-');
lib/libthread_xu/thread/thr_sem.c
101
int fd;
lib/libthread_xu/thread/thr_sem.c
445
if(_fstat(ni->fd, &sbuf) == 0) {
lib/libthread_xu/thread/thr_sem.c
464
sem_add_mapping(ino_t inode, dev_t dev, sem_t sem, int fd)
lib/libthread_xu/thread/thr_sem.c
477
ni->fd = fd;
lib/libthread_xu/thread/thr_sem.c
503
__sys_close(ni->fd);
lib/libthread_xu/thread/thr_sem.c
516
int error, fd, create;
lib/libthread_xu/thread/thr_sem.c
526
fd = -1;
lib/libthread_xu/thread/thr_sem.c
554
fd = __sys_open(path, O_RDWR | O_CLOEXEC);
lib/libthread_xu/thread/thr_sem.c
556
if (fd > 0) {
lib/libthread_xu/thread/thr_sem.c
559
__sys_close(fd);
lib/libthread_xu/thread/thr_sem.c
564
if (_fstat(fd, &sbuf) != 0) {
lib/libthread_xu/thread/thr_sem.c
566
__sys_close(fd);
lib/libthread_xu/thread/thr_sem.c
574
__sys_close(fd);
lib/libthread_xu/thread/thr_sem.c
580
__sys_close(fd);
lib/libthread_xu/thread/thr_sem.c
607
fd = mkstemp(tmppath);
lib/libthread_xu/thread/thr_sem.c
609
if ( fd == -1 ) {
lib/libthread_xu/thread/thr_sem.c
614
error = fchmod(fd, mode);
lib/libthread_xu/thread/thr_sem.c
616
__sys_close(fd);
lib/libthread_xu/thread/thr_sem.c
621
error = __sys_fcntl(fd, F_SETFD, FD_CLOEXEC);
lib/libthread_xu/thread/thr_sem.c
623
__sys_close(fd);
lib/libthread_xu/thread/thr_sem.c
631
if (fd == -1) {
lib/libthread_xu/thread/thr_sem.c
650
MAP_NOSYNC | MAP_SHARED, fd, 0);
lib/libthread_xu/thread/thr_sem.c
659
__sys_close(fd);
lib/libthread_xu/thread/thr_sem.c
664
ftruncate(fd, sizeof(struct sem));
lib/libthread_xu/thread/thr_sem.c
671
__sys_close(fd);
lib/libthread_xu/thread/thr_sem.c
682
if (_fstat(fd, &sbuf) != 0) {
lib/libthread_xu/thread/thr_sem.c
685
__sys_close(fd);
lib/libthread_xu/thread/thr_sem.c
691
sem = sem_add_mapping(sbuf.st_ino, sbuf.st_dev, semtmp, fd);
lib/libthread_xu/thread/thr_sig.c
335
int fd;
lib/libthread_xu/thread/thr_sig.c
339
fd = open(buf, O_RDWR|O_CREAT|O_TRUNC|O_CLOEXEC, 0666);
lib/libthread_xu/thread/thr_sig.c
340
if (fd >= 0) {
lib/libthread_xu/thread/thr_sig.c
343
write(fd, LogBuf, i);
lib/libthread_xu/thread/thr_sig.c
346
write(fd, LogBuf + i, LOGBUF_SIZE - i);
lib/libthread_xu/thread/thr_sig.c
347
write(fd, LogBuf, i);
lib/libthread_xu/thread/thr_sig.c
349
close(fd);
lib/libthread_xu/thread/thr_syscalls.c
137
int __openat(int fd, const char *, int,...);
lib/libthread_xu/thread/thr_syscalls.c
201
__close(int fd)
lib/libthread_xu/thread/thr_syscalls.c
208
ret = __sys_close(fd);
lib/libthread_xu/thread/thr_syscalls.c
217
__connect(int fd, const struct sockaddr *name, socklen_t namelen)
lib/libthread_xu/thread/thr_syscalls.c
224
ret = __sys_connect(fd, name, namelen);
lib/libthread_xu/thread/thr_syscalls.c
249
__fcntl(int fd, int cmd,...)
lib/libthread_xu/thread/thr_syscalls.c
261
ret = __sys_fcntl(fd, cmd, va_arg(ap, int));
lib/libthread_xu/thread/thr_syscalls.c
265
ret = __sys_fcntl(fd, cmd, va_arg(ap, int));
lib/libthread_xu/thread/thr_syscalls.c
269
ret = __sys_fcntl(fd, cmd);
lib/libthread_xu/thread/thr_syscalls.c
272
ret = __sys_fcntl(fd, cmd, va_arg(ap, void *));
lib/libthread_xu/thread/thr_syscalls.c
284
__fsync(int fd)
lib/libthread_xu/thread/thr_syscalls.c
291
ret = __sys_fsync(fd);
lib/libthread_xu/thread/thr_syscalls.c
300
__fdatasync(int fd)
lib/libthread_xu/thread/thr_syscalls.c
307
ret = __sys_fdatasync(fd);
lib/libthread_xu/thread/thr_syscalls.c
395
__openat(int fd, const char *path, int flags,...)
lib/libthread_xu/thread/thr_syscalls.c
413
ret = __sys_openat(fd, path, flags, mode);
lib/libthread_xu/thread/thr_syscalls.c
503
__read(int fd, void *buf, size_t nbytes)
lib/libthread_xu/thread/thr_syscalls.c
510
ret = __sys_read(fd, buf, nbytes);
lib/libthread_xu/thread/thr_syscalls.c
518
__readv(int fd, const struct iovec *iov, int iovcnt)
lib/libthread_xu/thread/thr_syscalls.c
525
ret = __sys_readv(fd, iov, iovcnt);
lib/libthread_xu/thread/thr_syscalls.c
641
_tcdrain(int fd)
lib/libthread_xu/thread/thr_syscalls.c
648
ret = __tcdrain(fd);
lib/libthread_xu/thread/thr_syscalls.c
730
__write(int fd, const void *buf, size_t nbytes)
lib/libthread_xu/thread/thr_syscalls.c
737
ret = __sys_write(fd, buf, nbytes);
lib/libthread_xu/thread/thr_syscalls.c
745
__writev(int fd, const struct iovec *iov, int iovcnt)
lib/libthread_xu/thread/thr_syscalls.c
752
ret = __sys_writev(fd, iov, iovcnt);
lib/libu4bhid/data.c
121
hid_get_report(int fd, enum hid_kind k, unsigned char *data, unsigned int size)
lib/libu4bhid/data.c
129
return (ioctl(fd, USB_GET_REPORT, &ugd));
lib/libu4bhid/data.c
133
hid_set_report(int fd, enum hid_kind k, unsigned char *data, unsigned int size)
lib/libu4bhid/data.c
141
return (ioctl(fd, USB_SET_REPORT, &ugd));
lib/libu4bhid/descr.c
112
if (ioctl(fd, USB_GET_REPORT_DESC, &ugd) < 0) {
lib/libu4bhid/descr.c
46
hid_set_immed(int fd, int enable)
lib/libu4bhid/descr.c
49
ret = ioctl(fd, USB_SET_IMMED, &enable);
lib/libu4bhid/descr.c
54
hid_get_report_id(int fd)
lib/libu4bhid/descr.c
63
if ((rep = hid_get_report_desc(fd)) == NULL)
lib/libu4bhid/descr.c
80
ret = ioctl(fd, USB_GET_REPORT_ID, &temp);
lib/libu4bhid/descr.c
87
hid_get_report_desc(int fd)
lib/libu4bhid/descr.c
98
if (ioctl(fd, USB_GET_REPORT_DESC, &ugd) < 0)
lib/libu4bhid/usbhid.h
108
int hid_get_report(int fd, enum hid_kind k,
lib/libu4bhid/usbhid.h
110
int hid_set_report(int fd, enum hid_kind k,
lib/libu4bhid/usbhid.h
88
int hid_set_immed(int fd, int enable);
lib/libusb/libusb.h
248
int fd;
lib/libusb/libusb.h
265
typedef void (*libusb_pollfd_added_cb) (int fd, short events, void *user_data);
lib/libusb/libusb.h
266
typedef void (*libusb_pollfd_removed_cb) (int fd, void *user_data);
lib/libusb/libusb10.h
131
void libusb10_add_pollfd(libusb_context *ctx, struct libusb_super_pollfd *pollfd, struct libusb20_device *pdev, int fd, short events);
lib/libusb/libusb10_io.c
125
fds[i].fd = pfd->pollfd.fd;
lib/libusb/libusb10_io.c
182
if (read(fds[i].fd, &dummy, 1) != 1)
lib/libusb/libusb10_io.c
52
struct libusb20_device *pdev, int fd, short events)
lib/libusb/libusb10_io.c
60
if (fd < 0)
lib/libusb/libusb10_io.c
64
pollfd->pollfd.fd = fd;
lib/libusb/libusb10_io.c
72
ctx->fd_added_cb(fd, events, ctx->fd_cb_user_data);
lib/libusb/libusb10_io.c
90
ctx->fd_removed_cb(pollfd->pollfd.fd, ctx->fd_cb_user_data);
lib/libusb/libusb20.c
1028
pfd[0].fd = pdev->file;
lib/libutil/auth.c
48
int fd;
lib/libutil/auth.c
51
if ((fd = open(path, O_RDONLY)) < 0) {
lib/libutil/auth.c
55
P = properties_read(fd);
lib/libutil/auth.c
56
close(fd);
lib/libutil/flopen.c
101
return (fd);
lib/libutil/flopen.c
41
int fd, operation, serrno, trunc;
lib/libutil/flopen.c
66
if ((fd = open(path, flags, mode)) == -1)
lib/libutil/flopen.c
69
if (flock(fd, operation) == -1) {
lib/libutil/flopen.c
72
(void)close(fd);
lib/libutil/flopen.c
78
(void)close(fd);
lib/libutil/flopen.c
81
if (fstat(fd, &fsb) == -1) {
lib/libutil/flopen.c
84
(void)close(fd);
lib/libutil/flopen.c
91
(void)close(fd);
lib/libutil/flopen.c
94
if (trunc && ftruncate(fd, 0) != 0) {
lib/libutil/flopen.c
97
(void)close(fd);
lib/libutil/libutil.h
100
properties_read(int fd);
lib/libutil/login_auth.c
83
int fd, count;
lib/libutil/login_auth.c
86
if ((fd = open(file, O_RDONLY | O_CLOEXEC)) < 0)
lib/libutil/login_auth.c
88
while ((count = read(fd, buf, sizeof(buf))) > 0)
lib/libutil/login_auth.c
90
close(fd);
lib/libutil/login_tty.c
41
login_tty(int fd)
lib/libutil/login_tty.c
44
if (ioctl(fd, TIOCSCTTY, NULL) == -1)
lib/libutil/login_tty.c
46
(void) dup2(fd, 0);
lib/libutil/login_tty.c
47
(void) dup2(fd, 1);
lib/libutil/login_tty.c
48
(void) dup2(fd, 2);
lib/libutil/login_tty.c
49
if (fd > 2)
lib/libutil/login_tty.c
50
(void) close(fd);
lib/libutil/pidfile.c
124
fd = flopen(pfh->pf_path,
lib/libutil/pidfile.c
126
if (fd == -1) {
lib/libutil/pidfile.c
155
if (fstat(fd, &sb) == -1) {
lib/libutil/pidfile.c
158
close(fd);
lib/libutil/pidfile.c
164
pfh->pf_fd = fd;
lib/libutil/pidfile.c
175
int error, fd;
lib/libutil/pidfile.c
188
fd = pfh->pf_fd;
lib/libutil/pidfile.c
193
if (ftruncate(fd, 0) == -1) {
lib/libutil/pidfile.c
201
if (pwrite(fd, pidstr, strlen(pidstr), 0) != (ssize_t)strlen(pidstr)) {
lib/libutil/pidfile.c
72
int error, fd, i;
lib/libutil/pidfile.c
74
fd = open(path, O_RDONLY | O_CLOEXEC);
lib/libutil/pidfile.c
75
if (fd == -1)
lib/libutil/pidfile.c
78
i = read(fd, buf, sizeof(buf) - 1);
lib/libutil/pidfile.c
80
close(fd);
lib/libutil/pidfile.c
99
int error, fd, len, count;
lib/libutil/property.c
70
properties_read(int fd)
lib/libutil/property.c
93
if ((max = read(fd, buf, sizeof buf)) < 0) {
lib/libutil/uucplock.c
117
(void)close(fd);
lib/libutil/uucplock.c
129
int fd, err;
lib/libutil/uucplock.c
134
if ((fd = open(lckname, O_RDWR | O_CLOEXEC)) < 0)
lib/libutil/uucplock.c
136
if (get_pid(fd, &err) != getpid())
lib/libutil/uucplock.c
139
lseek(fd, (off_t)0, SEEK_SET);
lib/libutil/uucplock.c
140
err = put_pid(fd, pid) ? 0 : UU_LOCK_WRITE_ERR;
lib/libutil/uucplock.c
142
close(fd);
lib/libutil/uucplock.c
198
put_pid(int fd, pid_t pid)
lib/libutil/uucplock.c
204
return write (fd, buf, (size_t)len) == len;
lib/libutil/uucplock.c
208
get_pid(int fd, int *err)
lib/libutil/uucplock.c
214
bytes_read = read (fd, buf, sizeof (buf) - 1);
lib/libutil/uucplock.c
56
static int put_pid (int fd, pid_t pid);
lib/libutil/uucplock.c
57
static pid_t get_pid (int fd,int *err);
lib/libutil/uucplock.c
66
int fd, tmpfd, i;
lib/libutil/uucplock.c
90
if ((fd = open(lckname, O_RDONLY | O_CLOEXEC)) < 0)
lib/libutil/uucplock.c
93
if ((pid_old = get_pid (fd, &err)) == -1)
lib/libutil/uucplock.c
96
close(fd);
lib/libvgl/text.c
42
FILE *fd;
lib/libvgl/text.c
59
if ((fd=fopen(filename, "r"))==NULL)
lib/libvgl/text.c
61
fread(&VGLTextFont->Width, 1 , 1, fd);
lib/libvgl/text.c
62
fread(&VGLTextFont->Height, 1 , 1, fd);
lib/libvgl/text.c
66
(256*VGLTextFont->Width* VGLTextFont->Height), fd);
lib/libvgl/text.c
67
fclose(fd);
libexec/atrun/atrun.c
91
write_string(int fd, const char* a)
libexec/atrun/atrun.c
93
return write(fd, a, strlen(a));
libexec/bootpd/getether.c
128
int fd, rc = -1;
libexec/bootpd/getether.c
135
fd = socket(AF_INET, SOCK_DGRAM, 0);
libexec/bootpd/getether.c
136
if (fd < 0) {
libexec/bootpd/getether.c
138
return (fd);
libexec/bootpd/getether.c
142
if (ioctl(fd, SIOCGIFCONF, (char *) &ifc) < 0 ||
libexec/bootpd/getether.c
167
close(fd);
libexec/bootpd/getether.c
195
int fd, flags;
libexec/bootpd/getether.c
201
fd = open(devname, 2);
libexec/bootpd/getether.c
202
if (fd < 0) {
libexec/bootpd/getether.c
211
fd = open(devname, 2);
libexec/bootpd/getether.c
212
if (fd < 0) {
libexec/bootpd/getether.c
232
if (putmsg(fd, &cbuf, NULL, 0) < 0) {
libexec/bootpd/getether.c
240
if (getmsg(fd, &cbuf, NULL, &flags) < 0) {
libexec/bootpd/getether.c
274
if (putmsg(fd, &cbuf, NULL, 0) < 0) {
libexec/bootpd/getether.c
282
if (getmsg(fd, &cbuf, NULL, &flags) < 0) {
libexec/bootpd/getether.c
315
close(fd);
libexec/bootpd/getether.c
344
int fd;
libexec/bootpd/getether.c
349
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
libexec/bootpd/getether.c
353
if (ioctl(fd, SIOCGIFHWADDR, &phys) < 0) {
libexec/bootpd/getether.c
359
close(fd);
libexec/bootpd/getether.c
46
int fd;
libexec/bootpd/getether.c
50
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
libexec/bootpd/getether.c
54
if (ioctl(fd, SIOCRPHYSADDR, &phys) < 0) {
libexec/bootpd/getether.c
60
close(fd);
libexec/bootpd/hwaddr.c
160
int fd;
libexec/bootpd/hwaddr.c
163
if ((fd=open("/dev/arp", O_RDWR)) < 0) {
libexec/bootpd/hwaddr.c
170
if (ioctl(fd, I_STR, (caddr_t)&iocb) < 0) {
libexec/bootpd/hwaddr.c
173
close (fd);
libexec/bootpd/tools/bootptest/bootptest.c
354
int fd = open(vendor_file, 0);
libexec/bootpd/tools/bootptest/bootptest.c
355
if (fd < 0) {
libexec/bootpd/tools/bootptest/bootptest.c
361
n = read(fd, bp->bp_vend, n);
libexec/bootpd/tools/bootptest/bootptest.c
362
close(fd);
libexec/dma/crypto.c
105
smtp_init_crypto(int fd, int feature, struct smtp_features* features)
libexec/dma/crypto.c
151
if (perform_server_greeting(fd, features) == 0) {
libexec/dma/crypto.c
152
send_remote_command(fd, "STARTTLS");
libexec/dma/crypto.c
153
if (read_remote(fd, 0, NULL) != 2) {
libexec/dma/crypto.c
183
error = SSL_set_fd(config.ssl, fd);
libexec/dma/crypto.c
296
smtp_auth_md5(int fd, char *login, char *password)
libexec/dma/crypto.c
310
send_remote_command(fd, "AUTH CRAM-MD5");
libexec/dma/crypto.c
311
if (read_remote(fd, sizeof(buffer), buffer) != 3) {
libexec/dma/crypto.c
342
send_remote_command(fd, "%s", temp);
libexec/dma/crypto.c
344
if (read_remote(fd, 0, NULL) != 2) {
libexec/dma/net.c
112
n = write(fd, cmd + pos, len - pos);
libexec/dma/net.c
123
read_remote(int fd, int extbufsize, char *extbuf)
libexec/dma/net.c
158
if ((rlen = read(fd, buff + len, sizeof(buff) - len)) == -1) {
libexec/dma/net.c
252
smtp_login(int fd, char *login, char* password, const struct smtp_features* features)
libexec/dma/net.c
259
res = smtp_auth_md5(fd, login, password);
libexec/dma/net.c
276
send_remote_command(fd, "AUTH LOGIN");
libexec/dma/net.c
277
if (read_remote(fd, 0, NULL) != 3) {
libexec/dma/net.c
291
send_remote_command(fd, "%s", temp);
libexec/dma/net.c
293
res = read_remote(fd, 0, NULL);
libexec/dma/net.c
304
send_remote_command(fd, "%s", temp);
libexec/dma/net.c
306
res = read_remote(fd, 0, NULL);
libexec/dma/net.c
324
int fd;
libexec/dma/net.c
329
fd = socket(h->ai.ai_family, h->ai.ai_socktype, h->ai.ai_protocol);
libexec/dma/net.c
330
if (fd < 0) {
libexec/dma/net.c
336
if (connect(fd, (struct sockaddr *)&h->sa, h->ai.ai_addrlen) < 0) {
libexec/dma/net.c
339
close(fd);
libexec/dma/net.c
343
return (fd);
libexec/dma/net.c
347
close_connection(int fd)
libexec/dma/net.c
356
close(fd);
libexec/dma/net.c
375
int perform_server_greeting(int fd, struct smtp_features* features) {
libexec/dma/net.c
380
send_remote_command(fd, "EHLO %s", hostname());
libexec/dma/net.c
385
int res = read_remote(fd, sizeof(buffer) - 1, buffer);
libexec/dma/net.c
470
int fd, error = 0, do_auth = 0, res = 0;
libexec/dma/net.c
477
fd = open_connection(host);
libexec/dma/net.c
478
if (fd < 0)
libexec/dma/net.c
483
res = read_remote(fd, 0, NULL); \
libexec/dma/net.c
509
error = smtp_init_crypto(fd, config.features, &features);
libexec/dma/net.c
520
if (perform_server_greeting(fd, &features) != 0) {
libexec/dma/net.c
543
error = smtp_login(fd, a->login, a->password, &features);
libexec/dma/net.c
558
send_remote_command(fd, "MAIL FROM:<%s>", it->sender);
libexec/dma/net.c
569
send_remote_command(fd, "RCPT TO:<%s>", to_addr);
libexec/dma/net.c
574
send_remote_command(fd, "DATA");
libexec/dma/net.c
599
if (send_remote_command(fd, "%s", line) != (ssize_t)linelen+1) {
libexec/dma/net.c
606
send_remote_command(fd, ".");
libexec/dma/net.c
609
send_remote_command(fd, "QUIT");
libexec/dma/net.c
610
if (read_remote(fd, 0, NULL) != 2)
libexec/dma/net.c
615
close_connection(fd);
libexec/dma/net.c
78
send_remote_command(int fd, const char* fmt, ...)
libexec/dma/spool.c
100
if (fstat(fd, &st) != 0)
libexec/dma/spool.c
105
queue->mailf = fdopen(fd, "r+");
libexec/dma/spool.c
119
close(fd);
libexec/dma/spool.c
432
int fd;
libexec/dma/spool.c
436
fd = open(flushfn, O_CREAT|O_WRONLY|O_TRUNC, 0660);
libexec/dma/spool.c
438
if (fd < 0) {
libexec/dma/spool.c
442
close(fd);
libexec/dma/spool.c
80
int fd;
libexec/dma/spool.c
85
fd = mkstemp(fn);
libexec/dma/spool.c
86
if (fd < 0)
libexec/dma/spool.c
89
if (fchmod(fd, 0660) < 0)
libexec/dma/spool.c
91
if (flock(fd, LOCK_EX) == -1)
libexec/dma/util.c
312
int fd, save_errno;
libexec/dma/util.c
314
fd = open(fname, flags, mode);
libexec/dma/util.c
315
if (fd < 0)
libexec/dma/util.c
316
return(fd);
libexec/dma/util.c
317
if (flock(fd, LOCK_EX|((flags & O_NONBLOCK)? LOCK_NB: 0)) < 0) {
libexec/dma/util.c
319
close(fd);
libexec/dma/util.c
323
return(fd);
libexec/ftpd/ftpd.c
1056
FILE *fd;
libexec/ftpd/ftpd.c
1061
if ((fd = fopen(fname, "r")) != NULL) {
libexec/ftpd/ftpd.c
1062
while (!found && (line = fgetln(fd, &len)) != NULL) {
libexec/ftpd/ftpd.c
1128
fclose(fd);
libexec/ftpd/ftpd.c
1327
FILE *fd;
libexec/ftpd/ftpd.c
1543
fd = fopen(thishost->loginmsg, "r");
libexec/ftpd/ftpd.c
1545
fd = fopen(_PATH_FTPLOGINMESG, "r");
libexec/ftpd/ftpd.c
1547
if (fd != NULL) {
libexec/ftpd/ftpd.c
1550
while (fgets(line, sizeof(line), fd) != NULL) {
libexec/ftpd/ftpd.c
1556
fclose(fd);
libexec/ftpd/ftpd.c
1706
int fd;
libexec/ftpd/ftpd.c
1735
if ((fd = guniquefd(name, &name)) < 0)
libexec/ftpd/ftpd.c
1737
fout = fdopen(fd, mode);
libexec/ftpd/ftpd.c
251
FILE *fd;
libexec/ftpd/ftpd.c
3032
int fd;
libexec/ftpd/ftpd.c
3067
if ((fd = open(count ? new : local,
libexec/ftpd/ftpd.c
3070
return (fd);
libexec/ftpd/ftpd.c
400
int *ctl_sock, fd, maxfd = -1, nfds, i;
libexec/ftpd/ftpd.c
468
fd = accept(ctl_sock[i],
libexec/ftpd/ftpd.c
471
if (fd == -1) {
libexec/ftpd/ftpd.c
479
dup2(fd, 0);
libexec/ftpd/ftpd.c
480
dup2(fd, 1);
libexec/ftpd/ftpd.c
481
close(fd);
libexec/ftpd/ftpd.c
491
close(fd);
libexec/ftpd/ftpd.c
583
if ((fd = fopen(_PATH_NOLOGIN,"r")) != NULL) {
libexec/ftpd/ftpd.c
584
while (fgets(line, sizeof(line), fd) != NULL) {
libexec/ftpd/ftpd.c
590
fclose(fd);
libexec/ftpd/ftpd.c
595
fd = fopen(thishost->welcome, "r");
libexec/ftpd/ftpd.c
597
fd = fopen(_PATH_FTPWELCOME, "r");
libexec/ftpd/ftpd.c
599
if (fd != NULL) {
libexec/ftpd/ftpd.c
600
while (fgets(line, sizeof(line), fd) != NULL) {
libexec/ftpd/ftpd.c
606
fclose(fd);
libexec/ftpd/site_md5.c
47
int fd, bytes, i, saved_errno;
libexec/ftpd/site_md5.c
52
fd = open(filename, O_RDONLY);
libexec/ftpd/site_md5.c
53
if (fd < 0)
libexec/ftpd/site_md5.c
55
if (fstat(fd, &st) < 0) {
libexec/ftpd/site_md5.c
65
bytes = read(fd, buffer, sizeof(buffer));
libexec/ftpd/site_md5.c
67
bytes = read(fd, buffer, size);
libexec/ftpd/site_md5.c
76
close(fd);
libexec/getty/main.c
305
int fd;
libexec/getty/main.c
307
if ((fd = open(IF, O_RDONLY)) != -1) {
libexec/getty/main.c
310
while ((cp = get_line(fd)) != NULL) {
libexec/getty/main.c
313
close(fd);
libexec/getty/main.c
695
get_line(int fd)
libexec/getty/main.c
704
while (i < (sizeof linebuf - 3) && read(fd, linebuf+i, 1)==1) {
libexec/getty/subr.c
642
set[0].fd = STDIN_FILENO;
libexec/rbootd/bpf.c
210
int fd;
libexec/rbootd/bpf.c
219
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
libexec/rbootd/bpf.c
226
if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) < 0 ||
libexec/rbootd/bpf.c
237
if (ioctl(fd, SIOCGIFFLAGS, (char *)ifrp) < 0) {
libexec/rbootd/bpf.c
263
(void) close(fd);
libexec/rbootd/rbootd.c
201
fd = BpfOpen();
libexec/rbootd/rbootd.c
209
maxfds = fd + 1;
libexec/rbootd/rbootd.c
211
FD_SET(fd, &rset);
libexec/rbootd/rbootd.c
237
if (FD_ISSET(fd, &r)) {
libexec/rbootd/rbootd.c
66
int c, fd, omask, maxfds;
libexec/rpc.rquotad/rquotad.c
227
int qcmd, fd, ret = 0;
libexec/rpc.rquotad/rquotad.c
243
if ((fd = open(fs->qfpathname, O_RDONLY)) < 0) {
libexec/rpc.rquotad/rquotad.c
247
if (lseek(fd, (off_t)(id * sizeof(struct ufs_dqblk)), L_SET) == (off_t)-1) {
libexec/rpc.rquotad/rquotad.c
248
close(fd);
libexec/rpc.rquotad/rquotad.c
251
switch (read(fd, dqblk, sizeof(struct ufs_dqblk))) {
libexec/rpc.rquotad/rquotad.c
265
close(fd);
libexec/rpc.rquotad/rquotad.c
268
close(fd);
libexec/rtld-elf/libmap.c
104
int fd;
libexec/rtld-elf/libmap.c
119
fd = open(rpath, O_RDONLY | O_CLOEXEC);
libexec/rtld-elf/libmap.c
120
if (fd == -1) {
libexec/rtld-elf/libmap.c
126
if (fstat(fd, &st) == -1) {
libexec/rtld-elf/libmap.c
127
close(fd);
libexec/rtld-elf/libmap.c
133
lm_map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
libexec/rtld-elf/libmap.c
135
close(fd);
libexec/rtld-elf/libmap.c
141
close(fd);
libexec/rtld-elf/malloc.c
444
int fd = -1;
libexec/rtld-elf/malloc.c
459
MAP_ANON|MAP_COPY, fd, 0)) == (caddr_t)-1) {
libexec/rtld-elf/map_object.c
225
data_flags, fd, data_offset) == (caddr_t) -1) {
libexec/rtld-elf/map_object.c
336
get_elf_header(int fd, const char *path)
libexec/rtld-elf/map_object.c
341
hdr = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE, fd, 0);
libexec/rtld-elf/map_object.c
53
map_object(int fd, const char *path, const struct stat *sb)
libexec/rtld-elf/map_object.c
91
hdr = get_elf_header(fd, path);
libexec/rtld-elf/rtld.c
112
static Obj_Entry *load_object(const char *, int fd, const Obj_Entry *, int);
libexec/rtld-elf/rtld.c
136
static void *rtld_dlopen(const char *name, int fd, int mode);
libexec/rtld-elf/rtld.c
1702
int fd;
libexec/rtld-elf/rtld.c
1711
if ((fd = open(ld_elf_hints_path, O_RDONLY | O_CLOEXEC)) == -1)
libexec/rtld-elf/rtld.c
1713
if (read(fd, &hdr, sizeof hdr) != sizeof hdr ||
libexec/rtld-elf/rtld.c
1716
close(fd);
libexec/rtld-elf/rtld.c
1720
if (lseek(fd, hdr.strtab + hdr.dirlist, SEEK_SET) == -1 ||
libexec/rtld-elf/rtld.c
1721
read(fd, p, hdr.dirlistlen + 1) !=
libexec/rtld-elf/rtld.c
1724
close(fd);
libexec/rtld-elf/rtld.c
1728
close(fd);
libexec/rtld-elf/rtld.c
2148
int fd;
libexec/rtld-elf/rtld.c
2152
fd = -1;
libexec/rtld-elf/rtld.c
2159
path = find_library(name, refobj, &fd);
libexec/rtld-elf/rtld.c
2165
if (fd >= 0) {
libexec/rtld-elf/rtld.c
2180
if ((fd = open(path, O_RDONLY | O_CLOEXEC)) == -1) {
libexec/rtld-elf/rtld.c
2186
fd = fcntl(fd_u, F_DUPFD_CLOEXEC, 0);
libexec/rtld-elf/rtld.c
2187
if (fd == -1) {
libexec/rtld-elf/rtld.c
2193
if (fstat(fd, &sb) == -1) {
libexec/rtld-elf/rtld.c
2195
close(fd);
libexec/rtld-elf/rtld.c
2205
close(fd);
libexec/rtld-elf/rtld.c
2210
close(fd);
libexec/rtld-elf/rtld.c
2215
obj = do_load_object(fd, name, path, &sb, flags);
libexec/rtld-elf/rtld.c
2218
close(fd);
libexec/rtld-elf/rtld.c
2224
do_load_object(int fd, const char *name, char *path, struct stat *sbp,
libexec/rtld-elf/rtld.c
2235
if (fstatfs(fd, &fs) != 0) {
libexec/rtld-elf/rtld.c
2245
obj = map_object(fd, printable_path(path), sbp);
libexec/rtld-elf/rtld.c
2896
int dirfd, fd;
libexec/rtld-elf/rtld.c
2928
fd = openat(dirfd, name, O_RDONLY | O_CLOEXEC);
libexec/rtld-elf/rtld.c
2929
if (fd >= 0) {
libexec/rtld-elf/rtld.c
2930
*fdp = fd;
libexec/rtld-elf/rtld.c
2938
dbg("open('%s') => %d", found, fd);
libexec/rtld-elf/rtld.c
3003
fdlopen(int fd, int mode)
libexec/rtld-elf/rtld.c
3006
return (rtld_dlopen(NULL, fd, mode));
libexec/rtld-elf/rtld.c
3010
rtld_dlopen(const char *name, int fd, int mode)
libexec/rtld-elf/rtld.c
3032
return (dlopen_object(name, fd, obj_main, lo_flags,
libexec/rtld-elf/rtld.c
3047
dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags,
libexec/rtld-elf/rtld.c
3066
if (name == NULL && fd == -1) {
libexec/rtld-elf/rtld.c
3070
obj = load_object(name, fd, refobj, lo_flags);
libexec/rtld-elf/rtld.c
471
int fd = aux_info[AT_EXECFD]->a_un.a_val;
libexec/rtld-elf/rtld.c
473
obj_main = map_object(fd, argv0, NULL);
libexec/rtld-elf/rtld.c
474
close(fd);
libexec/rtld-elf/rtld.c
5004
int fd;
libexec/rtld-elf/rtld.c
5008
fd = 0;
libexec/rtld-elf/rtld.c
5013
fd *= RADIX;
libexec/rtld-elf/rtld.c
5014
fd += c - '0';
libexec/rtld-elf/rtld.c
5022
return (fd);
libexec/rtld-elf/rtld.c
92
static Obj_Entry *dlopen_object(const char *name, int fd, Obj_Entry *refobj,
libexec/rtld-elf/rtld_printf.c
452
info.fd = -1;
libexec/rtld-elf/rtld_printf.c
460
rtld_vfdprintf(int fd, const char *fmt, va_list ap)
libexec/rtld-elf/rtld_printf.c
469
info.fd = fd;
libexec/rtld-elf/rtld_printf.c
476
rtld_fdprintf(int fd, const char *fmt, ...)
libexec/rtld-elf/rtld_printf.c
482
retval = rtld_vfdprintf(fd, fmt, ap);
libexec/rtld-elf/rtld_printf.c
488
rtld_fdputstr(int fd, const char *str)
libexec/rtld-elf/rtld_printf.c
491
write(fd, str, strlen(str));
libexec/rtld-elf/rtld_printf.c
495
rtld_fdputchar(int fd, int c)
libexec/rtld-elf/rtld_printf.c
500
write(fd, &c1, 1);
libexec/rtld-elf/rtld_printf.c
57
int fd;
libexec/rtld-elf/rtld_printf.c
66
write(info->fd, info->buf, info->buf_total - info->remain);
libexec/rtld-elf/rtld_printf.h
37
int rtld_vfdprintf(int fd, const char *fmt, va_list ap);
libexec/rtld-elf/rtld_printf.h
38
int rtld_fdprintf(int fd, const char *fmt, ...) __printflike(2, 3);
libexec/rtld-elf/rtld_printf.h
39
void rtld_fdputstr(int fd, const char *str);
libexec/rtld-elf/rtld_printf.h
40
void rtld_fdputchar(int fd, int c);
libexec/tftpd/tftpd.c
475
int fd;
libexec/tftpd/tftpd.c
554
fd = open(filename, mode == RRQ ? O_RDONLY : O_WRONLY|O_TRUNC);
libexec/tftpd/tftpd.c
555
if (fd < 0)
libexec/tftpd/tftpd.c
557
file = fdopen(fd, (mode == RRQ)? "r":"w");
libexec/utmp_update/utmp_update.c
127
fd = open(tty, O_RDONLY|O_NONBLOCK, 0);
libexec/utmp_update/utmp_update.c
128
if (fd != -1) {
libexec/utmp_update/utmp_update.c
129
if (fstat(fd, &st) == -1)
libexec/utmp_update/utmp_update.c
133
if (!isatty(fd))
libexec/utmp_update/utmp_update.c
135
(void)close(fd);
libexec/utmp_update/utmp_update.c
77
int fd;
sbin/camcontrol/camcontrol.c
1115
int fd, retval;
sbin/camcontrol/camcontrol.c
1120
if ((fd = open(XPT_DEVICE, O_RDWR)) < 0) {
sbin/camcontrol/camcontrol.c
1136
if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) {
sbin/camcontrol/camcontrol.c
1138
close(fd);
sbin/camcontrol/camcontrol.c
1152
close(fd);
sbin/camcontrol/camcontrol.c
1197
if (ioctl(fd, CAMIOCOMMAND, &matchccb) == -1) {
sbin/camcontrol/camcontrol.c
1238
if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) {
sbin/camcontrol/camcontrol.c
1266
if (fd != -1)
sbin/camcontrol/camcontrol.c
1267
close(fd);
sbin/camcontrol/camcontrol.c
1282
int fd;
sbin/camcontrol/camcontrol.c
1301
fd = -1;
sbin/camcontrol/camcontrol.c
1306
if ((fd = open(XPT_DEVICE, O_RDWR)) < 0) {
sbin/camcontrol/camcontrol.c
1331
if (ioctl(fd, CAMIOCOMMAND, &ccb) < 0) {
sbin/camcontrol/camcontrol.c
1333
close(fd);
sbin/camcontrol/camcontrol.c
1345
close(fd);
sbin/camcontrol/camcontrol.c
2092
int c, fd;
sbin/camcontrol/camcontrol.c
2131
if ((fd = open(XPT_DEVICE, O_RDWR)) < 0) {
sbin/camcontrol/camcontrol.c
2142
close(fd);
sbin/camcontrol/camcontrol.c
2185
if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) {
sbin/camcontrol/camcontrol.c
2214
close(fd);
sbin/camcontrol/camcontrol.c
341
int bufsize, fd;
sbin/camcontrol/camcontrol.c
360
if ((fd = open(XPT_DEVICE, O_RDWR)) == -1) {
sbin/camcontrol/camcontrol.c
377
close(fd);
sbin/camcontrol/camcontrol.c
394
if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) {
sbin/camcontrol/camcontrol.c
517
close(fd);
sbin/camcontrol/modeedit.c
717
int fd;
sbin/camcontrol/modeedit.c
731
if ((fd = mkstemp(edit_path)) == -1)
sbin/camcontrol/modeedit.c
736
if ((edit_file = fdopen(fd, "w")) == NULL)
sbin/ccdconfig/ccdconfig.c
435
int fd;
sbin/ccdconfig/ccdconfig.c
438
if ((fd = open(path, O_RDWR, 0640)) < 0) {
sbin/ccdconfig/ccdconfig.c
443
if (ioctl(fd, cmd, cciop) < 0) {
sbin/clri/clri.c
101
if (lseek(fd, offset, SEEK_SET) < 0)
sbin/clri/clri.c
103
if (read(fd, ibuf, bsize) != bsize)
sbin/clri/clri.c
115
if (lseek(fd, (off_t)-bsize, SEEK_CUR) < 0)
sbin/clri/clri.c
117
if (write(fd, ibuf, bsize) != bsize)
sbin/clri/clri.c
119
fsync(fd);
sbin/clri/clri.c
121
close(fd);
sbin/clri/clri.c
62
int fd;
sbin/clri/clri.c
75
if ((fd = open(fs, O_RDWR, 0)) < 0)
sbin/clri/clri.c
77
if (lseek(fd, (off_t)SBOFF, SEEK_SET) < 0)
sbin/clri/clri.c
79
if (read(fd, sblock, sizeof(sblock)) != sizeof(sblock))
sbin/comcontrol/comcontrol.c
113
if (ioctl(fd, TIOCMSDTRWAIT, &dtrwait) < 0) {
sbin/comcontrol/comcontrol.c
119
if (ioctl(fd, TIOCSDRAINWAIT, &drainwait) < 0) {
sbin/comcontrol/comcontrol.c
126
close(fd);
sbin/comcontrol/comcontrol.c
55
int fd;
sbin/comcontrol/comcontrol.c
64
fd = STDIN_FILENO;
sbin/comcontrol/comcontrol.c
66
fd = open(argv[1], O_RDONLY | O_NONBLOCK, 0);
sbin/comcontrol/comcontrol.c
67
if (fd < 0) {
sbin/comcontrol/comcontrol.c
73
if (ioctl(fd, TIOCMGDTRWAIT, &dtrwait) < 0) {
sbin/comcontrol/comcontrol.c
80
if (ioctl(fd, TIOCGDRAINWAIT, &drainwait) < 0) {
sbin/cryptdisks/cryptdisks.c
195
FILE *fd;
sbin/cryptdisks/cryptdisks.c
242
fd = popen(parameter, "r");
sbin/cryptdisks/cryptdisks.c
243
if (fd == NULL)
sbin/cryptdisks/cryptdisks.c
247
if ((fread(buf, 1, keymem_len, fd)) == 0)
sbin/cryptdisks/cryptdisks.c
250
pclose(fd);
sbin/cryptdisks/cryptdisks.c
445
process_line(FILE* fd, int type)
sbin/cryptdisks/cryptdisks.c
453
while (((c = fgetc(fd)) != EOF) && (c != '\n')) {
sbin/cryptdisks/cryptdisks.c
460
if (feof(fd) || ferror(fd))
sbin/cryptdisks/cryptdisks.c
495
FILE *fd;
sbin/cryptdisks/cryptdisks.c
519
fd = fopen("/etc/crypttab", "r");
sbin/cryptdisks/cryptdisks.c
520
if (fd == NULL)
sbin/cryptdisks/cryptdisks.c
524
while (process_line(fd, (start) ? CRYPTDISKS_START : CRYPTDISKS_STOP) == 0)
sbin/cryptdisks/cryptdisks.c
527
fclose(fd);
sbin/devd/devd.cc
1020
if (FD_ISSET(fd, &fds)) {
sbin/devd/devd.cc
1021
rv = read(fd, buffer, sizeof(buffer) - 1);
sbin/devd/devd.cc
1051
close(fd);
sbin/devd/devd.cc
123
int fd;
sbin/devd/devd.cc
831
int fd, slen;
sbin/devd/devd.cc
834
if ((fd = socket(PF_LOCAL, socktype, 0)) < 0)
sbin/devd/devd.cc
841
if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
sbin/devd/devd.cc
843
if (::bind(fd, (struct sockaddr *) & sun, slen) < 0)
sbin/devd/devd.cc
845
listen(fd, 4);
sbin/devd/devd.cc
848
return (fd);
sbin/devd/devd.cc
875
if (send(i->fd, data, len, flags) != len) {
sbin/devd/devd.cc
877
close(i->fd);
sbin/devd/devd.cc
902
pfd.fd = i->fd;
sbin/devd/devd.cc
907
close(i->fd);
sbin/devd/devd.cc
917
new_client(int fd, int socktype)
sbin/devd/devd.cc
929
s.fd = accept(fd, NULL, NULL);
sbin/devd/devd.cc
930
if (s.fd != -1) {
sbin/devd/devd.cc
932
if (setsockopt(s.fd, SOL_SOCKET, SO_SNDBUF, &sndbuf_size,
sbin/devd/devd.cc
935
shutdown(s.fd, SHUT_RD);
sbin/devd/devd.cc
946
int fd;
sbin/devd/devd.cc
954
fd = open(PATH_DEVCTL, O_RDONLY | O_CLOEXEC);
sbin/devd/devd.cc
955
if (fd == -1)
sbin/devd/devd.cc
960
max_fd = max(fd, max(stream_fd, seqpacket_fd)) + 1;
sbin/devd/devd.cc
967
FD_SET(fd, &fds);
sbin/devd/devd.cc
968
rv = select(fd + 1, &fds, NULL, NULL, &tv);
sbin/devd/devd.cc
988
FD_SET(fd, &fds);
sbin/devfsctl/devfsctl.c
563
FILE *fd;
sbin/devfsctl/devfsctl.c
566
if ((fd = fopen(name, "r")) == NULL) {
sbin/devfsctl/devfsctl.c
572
if (fstat(fileno(fd), &sb) != 0) {
sbin/devfsctl/devfsctl.c
589
while (process_line(fd, ftype) == 0)
sbin/devfsctl/devfsctl.c
592
fclose(fd);
sbin/devfsctl/devfsctl.c
603
process_line(FILE* fd, int ftype)
sbin/devfsctl/devfsctl.c
611
while (((c = fgetc(fd)) != EOF) && (c != '\n')) {
sbin/devfsctl/devfsctl.c
618
if (feof(fd) || ferror(fd))
sbin/dhclient/dhclient.c
102
static int killclient(int fd);
sbin/dhclient/dhclient.c
1873
int fd;
sbin/dhclient/dhclient.c
1886
fd = open(buf, O_RDWR|O_CREAT, 0644);
sbin/dhclient/dhclient.c
1887
if (fd >= 0) {
sbin/dhclient/dhclient.c
1888
if (killclient(fd)) {
sbin/dhclient/dhclient.c
1923
if (fd >= 0) {
sbin/dhclient/dhclient.c
1924
lseek(fd, 0L, SEEK_SET);
sbin/dhclient/dhclient.c
1925
ftruncate(fd, 0);
sbin/dhclient/dhclient.c
1927
write(fd, buf, strlen(buf));
sbin/dhclient/dhclient.c
1928
flock(fd, LOCK_EX);
sbin/dhclient/dhclient.c
2202
fork_privchld(int fd, int fd2)
sbin/dhclient/dhclient.c
2237
pfd[0].fd = fd;
sbin/dhclient/dhclient.c
2254
dispatch_imsg(fd);
sbin/dhclient/dhclient.c
2312
killclient(int fd)
sbin/dhclient/dhclient.c
2319
if (flock(fd, LOCK_EX|LOCK_NB) < 0) {
sbin/dhclient/dhclient.c
2324
lseek(fd, 0L, SEEK_SET);
sbin/dhclient/dhclient.c
2325
n = read(fd, buf, sizeof(buf));
sbin/dhclient/dhclient.c
2334
if (flock(fd, LOCK_EX|LOCK_NB) < 0)
sbin/dhclient/dhclient.c
2336
while (flock(fd, LOCK_EX|LOCK_NB) < 0)
sbin/dhclient/dhclient.c
271
int ch, fd;
sbin/dhclient/dhclient.c
341
fd = open(buf, O_RDWR, 0644);
sbin/dhclient/dhclient.c
342
if (fd < 0 || killclient(fd)) {
sbin/dhclient/dhclient.c
351
if (fd >= 0)
sbin/dhclient/dhclient.c
352
close(fd);
sbin/dhclient/dhclient.c
460
if ((fd = open(path_dhclient_db, O_RDONLY|O_EXLOCK|O_CREAT, 0)) == -1)
sbin/dhclient/dhclient.c
466
close(fd);
sbin/dhclient/dispatch.c
151
fds[0].fd = ifi->rfdesc;
sbin/dhclient/dispatch.c
152
fds[1].fd = routefd; /* Could be -1, which will be ignored. */
sbin/dhclient/privsep.c
105
buf_read(fd, &hdr, sizeof(hdr));
sbin/dhclient/privsep.c
111
buf_read(fd, &reason_len, sizeof(reason_len));
sbin/dhclient/privsep.c
118
buf_read(fd, reason, reason_len);
sbin/dhclient/privsep.c
130
buf_read(fd, &lease, sizeof(lease));
sbin/dhclient/privsep.c
132
buf_read(fd, &filename_len, sizeof(filename_len));
sbin/dhclient/privsep.c
139
buf_read(fd, filename, filename_len);
sbin/dhclient/privsep.c
143
buf_read(fd, &servername_len, sizeof(servername_len));
sbin/dhclient/privsep.c
151
buf_read(fd, servername, servername_len);
sbin/dhclient/privsep.c
155
buf_read(fd, &prefix_len, sizeof(prefix_len));
sbin/dhclient/privsep.c
162
buf_read(fd, prefix, prefix_len);
sbin/dhclient/privsep.c
170
buf_read(fd, &optlen, sizeof(optlen));
sbin/dhclient/privsep.c
181
buf_read(fd, lease.options[i].data, optlen);
sbin/dhclient/privsep.c
208
buf_close(fd, buf);
sbin/dhclient/privsep.c
94
dispatch_imsg(int fd)
sbin/diskinfo/diskinfo.c
59
int fd;
sbin/diskinfo/diskinfo.c
74
if ((fd = open(av[i], O_RDONLY)) < 0) {
sbin/diskinfo/diskinfo.c
80
if (ioctl(fd, DIOCGPART, &dpart) < 0) {
sbin/diskinfo/diskinfo.c
89
close(fd);
sbin/disklabel32/disklabel.c
701
int c, fd;
sbin/disklabel32/disklabel.c
705
if ((fd = mkstemp(tmpfil)) == -1 ||
sbin/disklabel32/disklabel.c
706
(fp = fdopen(fd, "w")) == NULL) {
sbin/disklabel64/disklabel64.c
571
int fd;
sbin/disklabel64/disklabel64.c
613
if ((fd = open(boot1path, O_RDONLY)) < 0)
sbin/disklabel64/disklabel64.c
615
if (fstat(fd, &st) < 0)
sbin/disklabel64/disklabel64.c
619
if (read(fd, boot1buf, boot1size) != boot1size)
sbin/disklabel64/disklabel64.c
621
close(fd);
sbin/disklabel64/disklabel64.c
623
if ((fd = open(boot2path, O_RDONLY)) < 0)
sbin/disklabel64/disklabel64.c
625
if (fstat(fd, &st) < 0)
sbin/disklabel64/disklabel64.c
629
if ((r = read(fd, boot2buf, boot2size)) < 1)
sbin/disklabel64/disklabel64.c
632
close(fd);
sbin/disklabel64/disklabel64.c
751
int c, fd;
sbin/disklabel64/disklabel64.c
755
if ((fd = mkstemp(tmpfil)) == -1 ||
sbin/disklabel64/disklabel64.c
756
(fp = fdopen(fd, "w")) == NULL) {
sbin/dump/cache.c
103
cread(int fd, void *buf, size_t nbytes, off_t offset)
sbin/dump/cache.c
118
return(pread(fd, buf, nbytes, offset));
sbin/dump/cache.c
131
return(pread(fd, buf, nbytes, offset));
sbin/dump/cache.c
152
n = pread(fd, blk->b_Data, BlockSize, blk->b_Offset);
sbin/dump/cache.c
165
return(pread(fd, buf, nbytes, offset));
sbin/dump/itime.c
161
int fd;
sbin/dump/itime.c
168
fd = fileno(df);
sbin/dump/itime.c
169
flock(fd, LOCK_EX);
sbin/dump/itime.c
203
if (ftruncate(fd, ftell(df)))
sbin/dump/tape.c
230
if (atomic_write(slp->fd, slp->req, siz) != siz)
sbin/dump/tape.c
241
if (atomic_read(slp->fd, &got, sizeof got)
sbin/dump/tape.c
258
if (atomic_read(slaves[i].fd,
sbin/dump/tape.c
314
if (atomic_read(slaves[f].fd, &got, sizeof got)
sbin/dump/tape.c
326
close(slaves[f].fd);
sbin/dump/tape.c
431
if (atomic_write(slp->fd, q, size) != size) {
sbin/dump/tape.c
471
if (atomic_read(slp->fd, &got, sizeof got)
sbin/dump/tape.c
689
slaves[i].fd = cmd[1];
sbin/dump/tape.c
693
close(slaves[j].fd);
sbin/dump/tape.c
705
atomic_write(slaves[i].fd, &slaves[(i + 1) % SLAVES].pid,
sbin/dump/tape.c
845
atomic_read(int fd, void *buf, int count)
sbin/dump/tape.c
849
while ((got = read(fd, buf, need)) > 0 && (need -= got) > 0)
sbin/dump/tape.c
855
atomic_write(int fd, const void *buf, int count)
sbin/dump/tape.c
859
while ((got = write(fd, buf, need)) > 0 && (need -= got) > 0)
sbin/dump/tape.c
97
int fd; /* FD for this slave */
sbin/dumpfs/dumpfs.c
109
int fd, c, i, j, k, size;
sbin/dumpfs/dumpfs.c
112
if ((fd = open(name, O_RDONLY, 0)) < 0)
sbin/dumpfs/dumpfs.c
114
if (lseek(fd, (off_t)SBOFF, SEEK_SET) == (off_t)-1)
sbin/dumpfs/dumpfs.c
116
if ((n = read(fd, &afs, SBSIZE)) == -1)
sbin/dumpfs/dumpfs.c
122
close(fd);
sbin/dumpfs/dumpfs.c
127
close(fd);
sbin/dumpfs/dumpfs.c
211
if (lseek(fd,
sbin/dumpfs/dumpfs.c
215
if (read(fd, (char *)afs.fs_csp + i, size) != size)
sbin/dumpfs/dumpfs.c
234
if (dumpcg(name, fd, i))
sbin/dumpfs/dumpfs.c
236
close(fd);
sbin/dumpfs/dumpfs.c
239
err: if (fd != -1)
sbin/dumpfs/dumpfs.c
240
close(fd);
sbin/dumpfs/dumpfs.c
246
dumpcg(char *name, int fd, int c)
sbin/dumpfs/dumpfs.c
253
if ((cur = lseek(fd, (off_t)(fsbtodb(&afs, cgtod(&afs, c))) *
sbin/dumpfs/dumpfs.c
256
if (read(fd, &acg, afs.fs_bsize) != afs.fs_bsize) {
sbin/dumpfs/dumpfs.c
316
int fd;
sbin/dumpfs/dumpfs.c
319
if ((fd = open(name, O_RDONLY, 0)) < 0)
sbin/dumpfs/dumpfs.c
321
if (lseek(fd, (off_t)SBOFF, SEEK_SET) == (off_t)-1)
sbin/dumpfs/dumpfs.c
323
if ((n = read(fd, &afs, SBSIZE)) == -1)
sbin/dumpfs/dumpfs.c
329
close(fd);
sbin/dumpfs/dumpfs.c
334
close(fd);
sbin/dumpfs/dumpfs.c
379
err: if (fd != -1)
sbin/dumpfs/dumpfs.c
380
close(fd);
sbin/fdisk/fdisk.c
767
if (ioctl(fd, DAIOCTRIM, ioarg) < 0) {
sbin/fdisk/fdisk.c
78
static int fd; /* file descriptor of the given disk */
sbin/fdisk/fdisk.c
790
fd = open(disk, (x_flag || a_flag || I_flag || B_flag || u_flag) ?
sbin/fdisk/fdisk.c
792
if (fd == -1) {
sbin/fdisk/fdisk.c
802
return fd;
sbin/fdisk/fdisk.c
810
lseek(fd, sector * 512, 0);
sbin/fdisk/fdisk.c
818
size = read(fd, buf, secsize);
sbin/fdisk/fdisk.c
823
size = read(fd, buf, secsize);
sbin/fdisk/fdisk.c
835
lseek(fd, sector * 512, 0);
sbin/fdisk/fdisk.c
837
return write(fd, buf, secsize);
sbin/fdisk/fdisk.c
853
if (ioctl(fd, DIOCGPART, &partinfo) == -1) {
sbin/fdisk/fdisk.c
854
if (p_flag && fstat(fd, &st) == 0 && st.st_size) {
sbin/fdisk/fdisk.c
928
if (ioctl(fd, DIOCWLABEL, &flag) < 0)
sbin/fdisk/fdisk.c
937
ioctl(fd, DIOCWLABEL, &flag);
sbin/fdisk/fdisk.c
943
ioctl(fd, DIOCWLABEL, &flag);
sbin/fsck/utilities.c
217
flush(int fd, struct bufarea *bp)
sbin/fsck/utilities.c
229
bwrite(fd, bp->b_un.b_buf, bp->b_bno, (long)bp->b_size);
sbin/fsck/utilities.c
304
bread(int fd, char *buf, ufs_daddr_t blk, long size)
sbin/fsck/utilities.c
312
if (lseek(fd, offset, 0) < 0)
sbin/fsck/utilities.c
314
else if (read(fd, buf, (int)size) == size)
sbin/fsck/utilities.c
317
if (lseek(fd, offset, 0) < 0)
sbin/fsck/utilities.c
323
if (read(fd, cp, (int)secsize) != secsize) {
sbin/fsck/utilities.c
324
lseek(fd, offset + i + secsize, 0);
sbin/fsck/utilities.c
341
bwrite(int fd, char *buf, ufs_daddr_t blk, long size)
sbin/fsck/utilities.c
347
if (fd < 0)
sbin/fsck/utilities.c
351
if (lseek(fd, offset, 0) < 0)
sbin/fsck/utilities.c
353
else if (write(fd, buf, (int)size) == size) {
sbin/fsck/utilities.c
359
if (lseek(fd, offset, 0) < 0)
sbin/fsck/utilities.c
363
if (write(fd, cp, (int)dev_bsize) != dev_bsize) {
sbin/fsck/utilities.c
364
lseek(fd, offset + i + dev_bsize, 0);
sbin/fsck_hammer2/destroy.c
117
int fd;
sbin/fsck_hammer2/destroy.c
140
fd = hammer2_get_volume_fd(io_off);
sbin/fsck_hammer2/destroy.c
141
if (lseek(fd, io_base - hammer2_get_volume_offset(io_base), SEEK_SET)
sbin/fsck_hammer2/destroy.c
146
ret = read(fd, media, io_bytes);
sbin/fsck_hammer2/destroy.c
168
int fd;
sbin/fsck_hammer2/destroy.c
188
fd = hammer2_get_volume_fd(io_off);
sbin/fsck_hammer2/destroy.c
189
if (lseek(fd, io_base - hammer2_get_volume_offset(io_base), SEEK_SET)
sbin/fsck_hammer2/destroy.c
194
if (read(fd, buf, io_bytes) != (ssize_t)io_bytes) {
sbin/fsck_hammer2/destroy.c
200
if (lseek(fd, io_base - hammer2_get_volume_offset(io_base), SEEK_SET)
sbin/fsck_hammer2/destroy.c
205
ret = write(fd, buf, io_bytes);
sbin/fsck_hammer2/destroy.c
213
if (fsync(fd) == -1) {
sbin/fsck_hammer2/reconstruct.c
203
int fd = hammer2_get_root_volume_fd();
sbin/fsck_hammer2/reconstruct.c
205
if (lseek(fd, off - hammer2_get_root_volume_offset(), SEEK_SET)
sbin/fsck_hammer2/reconstruct.c
210
ret = write(fd, voldata, HAMMER2_PBUFSIZE);
sbin/fsck_hammer2/reconstruct.c
218
if (fsync(fd) == -1) {
sbin/fsck_hammer2/reconstruct.c
234
int fd;
sbin/fsck_hammer2/reconstruct.c
257
fd = hammer2_get_volume_fd(io_off);
sbin/fsck_hammer2/reconstruct.c
258
if (lseek(fd, io_base - hammer2_get_volume_offset(io_base), SEEK_SET)
sbin/fsck_hammer2/reconstruct.c
263
ret = read(fd, media, io_bytes);
sbin/fsck_hammer2/reconstruct.c
285
int fd;
sbin/fsck_hammer2/reconstruct.c
305
fd = hammer2_get_volume_fd(io_off);
sbin/fsck_hammer2/reconstruct.c
306
if (lseek(fd, io_base - hammer2_get_volume_offset(io_base), SEEK_SET)
sbin/fsck_hammer2/reconstruct.c
311
if (read(fd, buf, io_bytes) != (ssize_t)io_bytes) {
sbin/fsck_hammer2/reconstruct.c
317
if (lseek(fd, io_base - hammer2_get_volume_offset(io_base), SEEK_SET)
sbin/fsck_hammer2/reconstruct.c
322
ret = write(fd, buf, io_bytes);
sbin/fsck_hammer2/reconstruct.c
330
if (fsync(fd) == -1) {
sbin/fsck_hammer2/test.c
709
int fd;
sbin/fsck_hammer2/test.c
730
fd = hammer2_get_volume_fd(io_off);
sbin/fsck_hammer2/test.c
731
if (lseek(fd, io_base - hammer2_get_volume_offset(io_base), SEEK_SET)
sbin/fsck_hammer2/test.c
734
if (read(fd, media, io_bytes) != (ssize_t)io_bytes)
sbin/fsck_msdosfs/dir.c
1010
if (lseek(fd, off, SEEK_SET) != off
sbin/fsck_msdosfs/dir.c
1011
|| write(fd, buffer, iosize) != iosize) {
sbin/fsck_msdosfs/dir.c
1030
if (lseek(fd, off, SEEK_SET) != off
sbin/fsck_msdosfs/dir.c
1031
|| write(fd, buffer, iosize) != iosize) {
sbin/fsck_msdosfs/dir.c
297
int clsz, fd;
sbin/fsck_msdosfs/dir.c
301
fd = fat_get_fd(fat);
sbin/fsck_msdosfs/dir.c
315
if (lseek(fd, off, SEEK_SET) != off) {
sbin/fsck_msdosfs/dir.c
319
if (read(fd, delbuf, clsz) != clsz) {
sbin/fsck_msdosfs/dir.c
327
if (lseek(fd, off, SEEK_SET) != off) {
sbin/fsck_msdosfs/dir.c
331
if (write(fd, delbuf, clsz) != clsz) {
sbin/fsck_msdosfs/dir.c
477
int fd;
sbin/fsck_msdosfs/dir.c
481
fd = fat_get_fd(fat);
sbin/fsck_msdosfs/dir.c
508
if (lseek(fd, off, SEEK_SET) != off ||
sbin/fsck_msdosfs/dir.c
509
read(fd, buf, boot->bpbBytesPerSec) != (ssize_t)boot->bpbBytesPerSec) {
sbin/fsck_msdosfs/dir.c
549
int fd, i, j, k, iosize, entries;
sbin/fsck_msdosfs/dir.c
560
fd = fat_get_fd(fat);
sbin/fsck_msdosfs/dir.c
608
if (lseek(fd, off, SEEK_SET) != off ||
sbin/fsck_msdosfs/dir.c
609
read(fd, buffer, iosize) != iosize) {
sbin/fsck_msdosfs/fat.c
1057
int ret, fd;
sbin/fsck_msdosfs/fat.c
1060
fd = fd_of_(fat);
sbin/fsck_msdosfs/fat.c
1079
if ((lseek(fd, src_off, SEEK_SET) != src_off ||
sbin/fsck_msdosfs/fat.c
1080
(size_t)read(fd, fat->fatbuf, rwsize) != rwsize) &&
sbin/fsck_msdosfs/fat.c
1086
if ((lseek(fd, dst_off, SEEK_SET) != dst_off ||
sbin/fsck_msdosfs/fat.c
1087
(size_t)write(fd, fat->fatbuf, rwsize) != rwsize) &&
sbin/fsck_msdosfs/fat.c
1105
int ret = FSOK, fd;
sbin/fsck_msdosfs/fat.c
1110
fd = fd_of_(fat);
sbin/fsck_msdosfs/fat.c
1141
if ((lseek(fd, dst_base, SEEK_SET) != dst_base ||
sbin/fsck_msdosfs/fat.c
1142
(size_t)write(fd, fat->fatbuf, writesz) != writesz) &&
sbin/fsck_msdosfs/fat.c
167
int fd;
sbin/fsck_msdosfs/fat.c
355
int fd;
sbin/fsck_msdosfs/fat.c
359
fd = fd_of_(fat);
sbin/fsck_msdosfs/fat.c
367
if (lseek(fd, fat_addr, SEEK_SET) != fat_addr ||
sbin/fsck_msdosfs/fat.c
368
(size_t)write(fd, entry->chunk, writesize) != writesize) {
sbin/fsck_msdosfs/fat.c
381
int fd;
sbin/fsck_msdosfs/fat.c
420
fd = fd_of_(fat);
sbin/fsck_msdosfs/fat.c
421
if (lseek(fd, fat_addr, SEEK_SET) != fat_addr ||
sbin/fsck_msdosfs/fat.c
422
(size_t)read(fd, entry->chunk, rwsize) != rwsize) {
sbin/fsck_msdosfs/fat.c
529
return (fat->fd);
sbin/fsck_msdosfs/fat.c
559
int fd, ret = FSERROR;
sbin/fsck_msdosfs/fat.c
566
fd = fd_of_(fat);
sbin/fsck_msdosfs/fat.c
580
if ((size_t)pread(fd, buffer, len, off) != len) {
sbin/fsck_msdosfs/fat.c
591
if ((size_t)pwrite(fd, buffer, len, off) != len) {
sbin/fsck_msdosfs/fat.c
609
int fd;
sbin/fsck_msdosfs/fat.c
617
fd = fd_of_(fat);
sbin/fsck_msdosfs/fat.c
662
if (lseek(fd, off, SEEK_SET) != off) {
sbin/fsck_msdosfs/fat.c
666
if ((size_t)read(fd, fat->fatbuf, readsize) != readsize) {
sbin/fsck_msdosfs/fat.c
735
fat->fd = fs;
sbin/fsdb/fsdb.h
34
extern int bread(int fd, char *buf, daddr_t blk, long size);
sbin/fsdb/fsdb.h
35
extern void bwrite(int fd, char *buf, daddr_t blk, long size);
sbin/gpt/add.c
139
gpt_write(fd, gpt);
sbin/gpt/add.c
140
gpt_write(fd, tbl);
sbin/gpt/add.c
156
gpt_write(fd, lbt);
sbin/gpt/add.c
157
gpt_write(fd, tpg);
sbin/gpt/add.c
163
add_defaults(int fd)
sbin/gpt/add.c
168
add(fd);
sbin/gpt/add.c
173
add(fd);
sbin/gpt/add.c
266
int ch, fd;
sbin/gpt/add.c
322
fd = gpt_open(argv[optind++]);
sbin/gpt/add.c
323
if (fd == -1) {
sbin/gpt/add.c
343
add(fd);
sbin/gpt/add.c
345
gpt_close(fd);
sbin/gpt/add.c
57
add(int fd)
sbin/gpt/boot.c
112
gpt_write(fd, gpt);
sbin/gpt/boot.c
113
gpt_write(fd, tbl);
sbin/gpt/boot.c
130
gpt_write(fd, lbt);
sbin/gpt/boot.c
131
gpt_write(fd, tpg);
sbin/gpt/boot.c
168
gpt_write(fd, map);
sbin/gpt/boot.c
174
int ch, fd;
sbin/gpt/boot.c
188
fd = gpt_open(argv[optind++]);
sbin/gpt/boot.c
189
if (fd == -1) {
sbin/gpt/boot.c
193
bootset(fd);
sbin/gpt/boot.c
194
gpt_close(fd);
sbin/gpt/boot.c
55
bootset(int fd)
sbin/gpt/create.c
108
mbr = gpt_read(fd, 0LL, 1);
sbin/gpt/create.c
128
gpt_write(fd, map);
sbin/gpt/create.c
184
gpt_write(fd, gpt);
sbin/gpt/create.c
185
gpt_write(fd, tbl);
sbin/gpt/create.c
207
gpt_write(fd, lbt);
sbin/gpt/create.c
208
gpt_write(fd, tpg);
sbin/gpt/create.c
234
int ch, fd;
sbin/gpt/create.c
259
fd = gpt_open(argv[optind++]);
sbin/gpt/create.c
260
if (fd == -1) {
sbin/gpt/create.c
265
create(fd);
sbin/gpt/create.c
267
gpt_close(fd);
sbin/gpt/create.c
283
int ch, fd;
sbin/gpt/create.c
331
fd = gpt_open(path);
sbin/gpt/create.c
332
if (fd == -1) {
sbin/gpt/create.c
337
do_erase(fd);
sbin/gpt/create.c
338
gpt_close(fd);
sbin/gpt/create.c
340
fd = gpt_open(path);
sbin/gpt/create.c
341
if (fd == -1) {
sbin/gpt/create.c
346
destroy(fd, true);
sbin/gpt/create.c
347
gpt_close(fd);
sbin/gpt/create.c
350
fd = gpt_open(path);
sbin/gpt/create.c
351
if (fd == -1) {
sbin/gpt/create.c
355
create(fd);
sbin/gpt/create.c
356
add_defaults(fd);
sbin/gpt/create.c
357
gpt_close(fd);
sbin/gpt/create.c
418
do_erase(int fd)
sbin/gpt/create.c
425
if (ioctl(fd, DAIOCTRIM, ioarg) < 0) {
sbin/gpt/create.c
51
static void do_erase(int fd);
sbin/gpt/create.c
73
create(int fd)
sbin/gpt/destroy.c
103
fd = gpt_open(argv[optind++]);
sbin/gpt/destroy.c
104
if (fd == -1) {
sbin/gpt/destroy.c
109
destroy(fd, false);
sbin/gpt/destroy.c
111
gpt_close(fd);
sbin/gpt/destroy.c
52
destroy(int fd, bool quiet)
sbin/gpt/destroy.c
74
gpt_write(fd, pri_hdr);
sbin/gpt/destroy.c
79
gpt_write(fd, sec_hdr);
sbin/gpt/destroy.c
86
int ch, fd;
sbin/gpt/expand.c
238
gpt_write(fd, lbt); /* secondary partition table */
sbin/gpt/expand.c
239
gpt_write(fd, tpg); /* secondary header */
sbin/gpt/expand.c
240
gpt_write(fd, tbl); /* primary partition table */
sbin/gpt/expand.c
241
gpt_write(fd, gpt); /* primary header */
sbin/gpt/expand.c
242
gpt_write(fd, pmbr);
sbin/gpt/expand.c
38
static void expand(int fd);
sbin/gpt/expand.c
50
int ch, fd;
sbin/gpt/expand.c
64
fd = gpt_open(argv[optind++]);
sbin/gpt/expand.c
65
if (fd == -1) {
sbin/gpt/expand.c
70
expand(fd);
sbin/gpt/expand.c
72
gpt_close(fd);
sbin/gpt/expand.c
79
expand(int fd)
sbin/gpt/gpt.c
325
gpt_read(int fd, off_t lba, size_t count)
sbin/gpt/gpt.c
336
if (lseek(fd, ofs, SEEK_SET) != ofs) {
sbin/gpt/gpt.c
341
if (read(fd, buf, count) != (ssize_t)count) {
sbin/gpt/gpt.c
352
gpt_write(int fd, map_t *map)
sbin/gpt/gpt.c
359
if (lseek(fd, ofs, SEEK_SET) == ofs &&
sbin/gpt/gpt.c
360
write(fd, map->map_data, count) == (ssize_t)count)
sbin/gpt/gpt.c
370
gpt_mbr(int fd, off_t lba)
sbin/gpt/gpt.c
377
mbr = gpt_read(fd, lba, 1);
sbin/gpt/gpt.c
452
if (gpt_mbr(fd, start) == -1)
sbin/gpt/gpt.c
461
gpt_gpt(int fd, off_t lba)
sbin/gpt/gpt.c
469
hdr = gpt_read(fd, lba, 1);
sbin/gpt/gpt.c
492
p = gpt_read(fd, le64toh(hdr->hdr_lba_table), blocks);
sbin/gpt/gpt.c
593
int fd, mode, found;
sbin/gpt/gpt.c
600
if ((fd = open(device_path, mode)) != -1)
sbin/gpt/gpt.c
606
if ((fd = open(device_path, mode)) != -1)
sbin/gpt/gpt.c
612
if (fstat(fd, &sb) == -1)
sbin/gpt/gpt.c
618
if (ioctl(fd, DIOCGPART, &partinfo) < 0)
sbin/gpt/gpt.c
653
if ((found = gpt_mbr(fd, 0LL)) == -1)
sbin/gpt/gpt.c
660
if ((found = gpt_gpt(fd, 1LL)) == -1)
sbin/gpt/gpt.c
679
if (gpt_gpt(fd, lba) == -1)
sbin/gpt/gpt.c
686
found = gpt_gpt(fd, mediasz / secsz - 1LL);
sbin/gpt/gpt.c
696
return (fd);
sbin/gpt/gpt.c
699
close(fd);
sbin/gpt/gpt.c
704
gpt_close(int fd)
sbin/gpt/gpt.c
707
close(fd);
sbin/gpt/gpt.h
77
void add_defaults(int fd);
sbin/gpt/gpt.h
78
void destroy(int fd, bool quiet);
sbin/gpt/label.c
121
gpt_write(fd, gpt);
sbin/gpt/label.c
122
gpt_write(fd, tbl);
sbin/gpt/label.c
136
gpt_write(fd, lbt);
sbin/gpt/label.c
137
gpt_write(fd, tpg);
sbin/gpt/label.c
174
int ch, fd;
sbin/gpt/label.c
234
fd = gpt_open(argv[optind++]);
sbin/gpt/label.c
235
if (fd == -1) {
sbin/gpt/label.c
240
label(fd);
sbin/gpt/label.c
242
gpt_close(fd);
sbin/gpt/label.c
60
label(int fd)
sbin/gpt/migrate.c
233
migrate(int fd)
sbin/gpt/migrate.c
359
err = read_disklabel64(fd, start, &dl64);
sbin/gpt/migrate.c
361
err = read_disklabel32(fd, start, &dl32);
sbin/gpt/migrate.c
422
gpt_write(fd, gpt);
sbin/gpt/migrate.c
423
gpt_write(fd, tbl);
sbin/gpt/migrate.c
436
gpt_write(fd, lbt);
sbin/gpt/migrate.c
437
gpt_write(fd, tpg);
sbin/gpt/migrate.c
457
gpt_write(fd, map);
sbin/gpt/migrate.c
464
int ch, fd;
sbin/gpt/migrate.c
490
fd = gpt_open(argv[optind++]);
sbin/gpt/migrate.c
491
if (fd == -1) {
sbin/gpt/migrate.c
496
migrate(fd);
sbin/gpt/migrate.c
498
gpt_close(fd);
sbin/gpt/migrate.c
59
read_disklabel32(int fd, off_t start, struct disklabel32 **dlp)
sbin/gpt/migrate.c
64
buf = gpt_read(fd, start + LABELSECTOR32, 1);
sbin/gpt/migrate.c
83
read_disklabel64(int fd, off_t start, struct disklabel64 **dlp)
sbin/gpt/migrate.c
87
dl = gpt_read(fd, start, roundup2(sizeof(*dl), secsz) / secsz);
sbin/gpt/recover.c
117
gpt_write(fd, tpg);
sbin/gpt/recover.c
135
gpt_write(fd, gpt);
sbin/gpt/recover.c
150
mbr = gpt_read(fd, 0LL, 1);
sbin/gpt/recover.c
171
gpt_write(fd, map);
sbin/gpt/recover.c
179
int ch, fd;
sbin/gpt/recover.c
193
fd = gpt_open(argv[optind++]);
sbin/gpt/recover.c
194
if (fd == -1) {
sbin/gpt/recover.c
199
recover(fd);
sbin/gpt/recover.c
201
gpt_close(fd);
sbin/gpt/recover.c
48
recover(int fd)
sbin/gpt/recover.c
86
gpt_write(fd, lbt);
sbin/gpt/recover.c
97
gpt_write(fd, tbl);
sbin/gpt/remove.c
118
gpt_write(fd, gpt);
sbin/gpt/remove.c
119
gpt_write(fd, tbl);
sbin/gpt/remove.c
133
gpt_write(fd, lbt);
sbin/gpt/remove.c
134
gpt_write(fd, tpg);
sbin/gpt/remove.c
144
int ch, fd;
sbin/gpt/remove.c
194
fd = gpt_open(argv[optind++]);
sbin/gpt/remove.c
195
if (fd == -1) {
sbin/gpt/remove.c
200
rem(fd);
sbin/gpt/remove.c
202
gpt_close(fd);
sbin/gpt/remove.c
57
rem(int fd)
sbin/gpt/show.c
208
int ch, fd;
sbin/gpt/show.c
231
fd = gpt_open(argv[optind++]);
sbin/gpt/show.c
232
if (fd == -1) {
sbin/gpt/show.c
235
show(fd);
sbin/gpt/show.c
236
gpt_close(fd);
sbin/gpt/show.c
76
show(int fd __unused)
sbin/hammer/cmd_cleanup.c
1289
int fd = open("/dev/null", O_RDWR);
sbin/hammer/cmd_cleanup.c
1290
dup2(fd, 1);
sbin/hammer/cmd_cleanup.c
1291
close(fd);
sbin/hammer/cmd_cleanup.c
170
int fd;
sbin/hammer/cmd_cleanup.c
178
fd = open(path, O_RDONLY);
sbin/hammer/cmd_cleanup.c
179
if (fd < 0) {
sbin/hammer/cmd_cleanup.c
183
if (ioctl(fd, HAMMERIOC_GET_PSEUDOFS, &pfs) < 0) {
sbin/hammer/cmd_cleanup.c
185
close(fd);
sbin/hammer/cmd_cleanup.c
190
close(fd);
sbin/hammer/cmd_cleanup.c
194
if (ioctl(fd, HAMMERIOC_GET_VERSION, &version) < 0) {
sbin/hammer/cmd_cleanup.c
196
close(fd);
sbin/hammer/cmd_cleanup.c
203
if (ioctl(fd, HAMMERIOC_GET_CONFIG, &config) == 0 &&
sbin/hammer/cmd_cleanup.c
217
close(fd);
sbin/hammer/cmd_cleanup.c
237
close(fd);
sbin/hammer/cmd_cleanup.c
245
close(fd);
sbin/hammer/cmd_cleanup.c
273
migrate_snapshots(fd, snapshots_path);
sbin/hammer/cmd_cleanup.c
275
if (ioctl(fd, HAMMERIOC_SET_CONFIG, &config) < 0) {
sbin/hammer/cmd_cleanup.c
277
close(fd);
sbin/hammer/cmd_cleanup.c
283
if (ioctl(fd, HAMMERIOC_SET_CONFIG, &config) < 0) {
sbin/hammer/cmd_cleanup.c
285
close(fd);
sbin/hammer/cmd_cleanup.c
299
close(fd);
sbin/hammer/cmd_cleanup.c
360
close(fd);
sbin/hammer/cmd_cleanup.c
376
if (flock(fd, LOCK_EX|LOCK_NB) == -1) {
sbin/hammer/cmd_cleanup.c
381
close(fd);
sbin/hammer/cmd_cleanup.c
429
check_softlinks(fd, new_config,
sbin/hammer/cmd_cleanup.c
433
cleanup_softlinks(fd, new_config,
sbin/hammer/cmd_cleanup.c
443
cleanup_softlinks(fd, new_config,
sbin/hammer/cmd_cleanup.c
542
close(fd);
sbin/hammer/cmd_cleanup.c
596
migrate_snapshots(int fd, const char *snapshots_path)
sbin/hammer/cmd_cleanup.c
612
migrate_one_snapshot(fd, fpath, &snapshot);
sbin/hammer/cmd_cleanup.c
617
migrate_one_snapshot(fd, NULL, &snapshot);
sbin/hammer/cmd_cleanup.c
627
migrate_one_snapshot(int fd, const char *fpath,
sbin/hammer/cmd_cleanup.c
693
if (ioctl(fd, HAMMERIOC_ADD_SNAPSHOT, snapshot) < 0) {
sbin/hammer/cmd_cleanup.c
73
static void migrate_snapshots(int fd, const char *snapshots_path);
sbin/hammer/cmd_cleanup.c
74
static void migrate_one_snapshot(int fd, const char *fpath,
sbin/hammer/cmd_cleanup.c
82
static int check_softlinks(int fd, int new_config, const char *snapshots_path);
sbin/hammer/cmd_cleanup.c
83
static void cleanup_softlinks(int fd, int new_config,
sbin/hammer/cmd_cleanup.c
85
static void delete_snapshots(int fd, struct hammer_ioc_snapshot *dsnapshot);
sbin/hammer/cmd_cleanup.c
859
check_softlinks(int fd, int new_config, const char *snapshots_path)
sbin/hammer/cmd_cleanup.c
891
if (ioctl(fd, HAMMERIOC_GET_SNAPSHOT, &snapshot) < 0) {
sbin/hammer/cmd_cleanup.c
907
cleanup_softlinks(int fd, int new_config,
sbin/hammer/cmd_cleanup.c
956
if (ioctl(fd, HAMMERIOC_GET_SNAPSHOT, &snapshot) < 0) {
sbin/hammer/cmd_cleanup.c
979
delete_snapshots(fd, &dsnapshot);
sbin/hammer/cmd_cleanup.c
984
delete_snapshots(fd, &dsnapshot);
sbin/hammer/cmd_cleanup.c
990
delete_snapshots(int fd, struct hammer_ioc_snapshot *dsnapshot)
sbin/hammer/cmd_cleanup.c
993
if (ioctl(fd, HAMMERIOC_DEL_SNAPSHOT, dsnapshot) < 0) {
sbin/hammer/cmd_config.c
111
int fd;
sbin/hammer/cmd_config.c
152
fd = open(path, O_RDWR|O_CREAT|O_TRUNC, 0600);
sbin/hammer/cmd_config.c
153
if (fd < 0) {
sbin/hammer/cmd_config.c
157
write(fd, config.config.text, strlen(config.config.text));
sbin/hammer/cmd_config.c
158
if (fstat(fd, &st) < 0) {
sbin/hammer/cmd_config.c
165
close(fd);
sbin/hammer/cmd_config.c
187
fd = open(path, O_RDONLY);
sbin/hammer/cmd_config.c
188
if (fd < 0) {
sbin/hammer/cmd_config.c
193
n = read(fd, config.config.text, sizeof(config.config.text) - 1);
sbin/hammer/cmd_config.c
214
int fd;
sbin/hammer/cmd_config.c
217
if ((fd = open(dirpath, O_RDONLY)) < 0) {
sbin/hammer/cmd_config.c
221
if (ioctl(fd, HAMMERIOC_GET_VERSION, &version) < 0) {
sbin/hammer/cmd_config.c
226
if (ioctl(fd, HAMMERIOC_GET_CONFIG, config) < 0) {
sbin/hammer/cmd_config.c
230
close(fd);
sbin/hammer/cmd_config.c
238
int fd;
sbin/hammer/cmd_config.c
241
if ((fd = open(dirpath, O_RDONLY)) < 0) {
sbin/hammer/cmd_config.c
245
if (ioctl(fd, HAMMERIOC_GET_VERSION, &version) < 0) {
sbin/hammer/cmd_config.c
250
if (ioctl(fd, HAMMERIOC_SET_CONFIG, config) < 0) {
sbin/hammer/cmd_config.c
254
close(fd);
sbin/hammer/cmd_config.c
55
int fd;
sbin/hammer/cmd_config.c
82
fd = open(av[1], O_RDONLY);
sbin/hammer/cmd_config.c
83
if (fd < 0) {
sbin/hammer/cmd_config.c
87
n = read(fd, config.config.text, sizeof(config.config.text) - 1);
sbin/hammer/cmd_config.c
95
close(fd);
sbin/hammer/cmd_history.c
104
if (ioctl(fd, HAMMERIOC_GETHISTORY, &hist) < 0) {
sbin/hammer/cmd_history.c
106
close(fd);
sbin/hammer/cmd_history.c
138
if (ioctl(fd, HAMMERIOC_GETHISTORY, &hist) < 0) {
sbin/hammer/cmd_history.c
144
close(fd);
sbin/hammer/cmd_history.c
215
int fd;
sbin/hammer/cmd_history.c
219
fd = open(path, O_RDONLY);
sbin/hammer/cmd_history.c
220
if (fd < 0)
sbin/hammer/cmd_history.c
222
lseek(fd, off, 0);
sbin/hammer/cmd_history.c
225
r = read(fd, buf, n);
sbin/hammer/cmd_history.c
236
close(fd);
sbin/hammer/cmd_history.c
84
int fd;
sbin/hammer/cmd_history.c
88
fd = open(path, O_RDONLY);
sbin/hammer/cmd_history.c
89
if (fd < 0) {
sbin/hammer/cmd_info.c
104
if (ioctl(fd, HAMMERIOC_GET_INFO, &info) < 0) {
sbin/hammer/cmd_info.c
109
close(fd);
sbin/hammer/cmd_info.c
92
int fd;
sbin/hammer/cmd_info.c
94
fd = open(path, O_RDONLY);
sbin/hammer/cmd_info.c
95
if (fd < 0) {
sbin/hammer/cmd_mirror.c
1281
read_mrecords(int fd, char *buf, u_int size, struct hammer_ioc_mrecord_head *pickup)
sbin/hammer/cmd_mirror.c
1299
i = read(fd, (char *)pickup + n,
sbin/hammer/cmd_mirror.c
133
fd = getpfs(&pfs, filesystem);
sbin/hammer/cmd_mirror.c
1349
i = read(fd, buf + count + n, bytes - n);
sbin/hammer/cmd_mirror.c
1505
generate_mrec_header(int fd, int pfs_id,
sbin/hammer/cmd_mirror.c
1513
if (ioctl(fd, HAMMERIOC_GET_PSEUDOFS, &pfs) != 0) {
sbin/hammer/cmd_mirror.c
152
generate_mrec_header(fd, pfs.pfs_id, &mrec_tmp);
sbin/hammer/cmd_mirror.c
1532
validate_mrec_header(int fd, int fdin, int is_target, int pfs_id,
sbin/hammer/cmd_mirror.c
1545
if (ioctl(fd, HAMMERIOC_GET_PSEUDOFS, &pfs) != 0) {
sbin/hammer/cmd_mirror.c
1603
update_pfs_snapshot(int fd, hammer_tid_t snapshot_tid, int pfs_id)
sbin/hammer/cmd_mirror.c
1609
if (ioctl(fd, HAMMERIOC_GET_PSEUDOFS, &pfs) != 0) {
sbin/hammer/cmd_mirror.c
1616
if (ioctl(fd, HAMMERIOC_SET_PSEUDOFS, &pfs) != 0) {
sbin/hammer/cmd_mirror.c
163
n = validate_mrec_header(fd, 0, 0, pfs.pfs_id, &pickup,
sbin/hammer/cmd_mirror.c
1635
writebw(int fd, const void *buf, size_t nbytes,
sbin/hammer/cmd_mirror.c
1652
r = write(fd, buf, n);
sbin/hammer/cmd_mirror.c
166
relpfs(fd, &pfs);
sbin/hammer/cmd_mirror.c
183
generate_mrec_header(fd, pfs.pfs_id, &mrec_tmp);
sbin/hammer/cmd_mirror.c
214
histmax = generate_histogram(fd, filesystem,
sbin/hammer/cmd_mirror.c
291
if (ioctl(fd, HAMMERIOC_MIRROR_READ, &mirror) < 0) {
sbin/hammer/cmd_mirror.c
435
relpfs(fd, &pfs);
sbin/hammer/cmd_mirror.c
453
} else if (ioctl(fd, HAMMERIOC_WAI_PSEUDOFS, &pfs) < 0) {
sbin/hammer/cmd_mirror.c
473
relpfs(fd, &pfs);
sbin/hammer/cmd_mirror.c
479
relpfs(fd, &pfs);
sbin/hammer/cmd_mirror.c
504
generate_histogram(int fd, const char *filesystem,
sbin/hammer/cmd_mirror.c
51
static int read_mrecords(int fd, char *buf, u_int size,
sbin/hammer/cmd_mirror.c
53
static int generate_histogram(int fd, const char *filesystem,
sbin/hammer/cmd_mirror.c
560
if (ioctl(fd, HAMMERIOC_MIRROR_READ, &mirror) < 0) {
sbin/hammer/cmd_mirror.c
61
static void generate_mrec_header(int fd, int pfs_id,
sbin/hammer/cmd_mirror.c
63
static int validate_mrec_header(int fd, int fdin, int is_target, int pfs_id,
sbin/hammer/cmd_mirror.c
66
static void update_pfs_snapshot(int fd, hammer_tid_t snapshot_tid, int pfs_id);
sbin/hammer/cmd_mirror.c
67
static ssize_t writebw(int fd, const void *buf, size_t nbytes,
sbin/hammer/cmd_mirror.c
774
int fd;
sbin/hammer/cmd_mirror.c
829
fd = getpfs(&pfs, filesystem);
sbin/hammer/cmd_mirror.c
838
generate_mrec_header(fd, pfs.pfs_id, &mrec_tmp);
sbin/hammer/cmd_mirror.c
850
n = validate_mrec_header(fd, 0, 1, pfs.pfs_id, &pickup,
sbin/hammer/cmd_mirror.c
853
relpfs(fd, &pfs);
sbin/hammer/cmd_mirror.c
874
if (ioctl(fd, HAMMERIOC_MIRROR_WRITE, &mirror) < 0) {
sbin/hammer/cmd_mirror.c
901
relpfs(fd, &pfs);
sbin/hammer/cmd_mirror.c
922
update_pfs_snapshot(fd, mirror.tid_end, pfs.pfs_id);
sbin/hammer/cmd_mirror.c
926
ioctl(fd, HAMMERIOC_SYNCTID, &synctid);
sbin/hammer/cmd_mirror.c
948
relpfs(fd, &pfs);
sbin/hammer/cmd_mirror.c
99
int fd;
sbin/hammer/cmd_pfs.c
100
int fd;
sbin/hammer/cmd_pfs.c
118
fd = open(path, O_RDONLY);
sbin/hammer/cmd_pfs.c
119
if (fd < 0) {
sbin/hammer/cmd_pfs.c
129
if (ioctl(fd, HAMMERIOC_GET_PSEUDOFS, pfs) < 0) {
sbin/hammer/cmd_pfs.c
136
return(fd);
sbin/hammer/cmd_pfs.c
206
relpfs(int fd, struct hammer_ioc_pseudofs_rw *pfs)
sbin/hammer/cmd_pfs.c
208
if (fd >= 0)
sbin/hammer/cmd_pfs.c
209
close(fd);
sbin/hammer/cmd_pfs.c
221
int fd;
sbin/hammer/cmd_pfs.c
223
fd = getpfs(&pfs, path);
sbin/hammer/cmd_pfs.c
225
if (fd < 0 || ioctl(fd, HAMMERIOC_GET_PSEUDOFS, &pfs) < 0) {
sbin/hammer/cmd_pfs.c
229
dump_pfsd(pfs.ondisk, fd);
sbin/hammer/cmd_pfs.c
232
if (fd >= 0)
sbin/hammer/cmd_pfs.c
233
close(fd);
sbin/hammer/cmd_pfs.c
236
relpfs(fd, &pfs);
sbin/hammer/cmd_pfs.c
265
int fd;
sbin/hammer/cmd_pfs.c
286
fd = open(dirpath, O_RDONLY);
sbin/hammer/cmd_pfs.c
287
if (fd < 0) {
sbin/hammer/cmd_pfs.c
300
ioctl(fd, HAMMERIOC_GET_PSEUDOFS, &pfs);
sbin/hammer/cmd_pfs.c
313
if (ioctl(fd, HAMMERIOC_GET_PSEUDOFS, &pfs) < 0) {
sbin/hammer/cmd_pfs.c
336
if (ioctl(fd, HAMMERIOC_SET_PSEUDOFS, &pfs) < 0) {
sbin/hammer/cmd_pfs.c
351
close(fd);
sbin/hammer/cmd_pfs.c
359
int fd;
sbin/hammer/cmd_pfs.c
366
fd = getpfs(&pfs, av[0]);
sbin/hammer/cmd_pfs.c
409
if (ioctl(fd, HAMMERIOC_RMR_PSEUDOFS, &pfs) == 0) {
sbin/hammer/cmd_pfs.c
423
relpfs(fd, &pfs);
sbin/hammer/cmd_pfs.c
430
int fd;
sbin/hammer/cmd_pfs.c
436
fd = getpfs(&pfs, av[0]);
sbin/hammer/cmd_pfs.c
448
if (ioctl(fd, HAMMERIOC_UPG_PSEUDOFS, &pfs) == 0) {
sbin/hammer/cmd_pfs.c
456
relpfs(fd, &pfs);
sbin/hammer/cmd_pfs.c
463
int fd;
sbin/hammer/cmd_pfs.c
469
fd = getpfs(&pfs, av[0]);
sbin/hammer/cmd_pfs.c
479
if (ioctl(fd, HAMMERIOC_DGD_PSEUDOFS, &pfs) == 0) {
sbin/hammer/cmd_pfs.c
487
relpfs(fd, &pfs);
sbin/hammer/cmd_pfs.c
494
int fd;
sbin/hammer/cmd_pfs.c
500
fd = getpfs(&pfs, av[0]);
sbin/hammer/cmd_pfs.c
505
if (ioctl(fd, HAMMERIOC_GET_PSEUDOFS, &pfs) == 0) {
sbin/hammer/cmd_pfs.c
515
if (ioctl(fd, HAMMERIOC_SET_PSEUDOFS, &pfs) == 0) {
sbin/hammer/cmd_pfs.c
516
if (ioctl(fd, HAMMERIOC_GET_PSEUDOFS, &pfs) == 0) {
sbin/hammer/cmd_pfs.c
517
dump_pfsd(pfs.ondisk, fd);
sbin/hammer/cmd_pfs.c
528
relpfs(fd, &pfs);
sbin/hammer/cmd_pfs.c
547
dump_pfsd(hammer_pseudofs_data_t pfsd, int fd)
sbin/hammer/cmd_pfs.c
589
if (fd >= 0 && pfsd->snapshots[0] == 0) {
sbin/hammer/cmd_pfs.c
591
if (ioctl(fd, HAMMERIOC_GET_VERSION, &version) < 0)
sbin/hammer/cmd_rebalance.c
105
close(fd);
sbin/hammer/cmd_rebalance.c
47
int fd;
sbin/hammer/cmd_rebalance.c
83
fd = open(filesystem, O_RDONLY);
sbin/hammer/cmd_rebalance.c
84
if (fd < 0) {
sbin/hammer/cmd_rebalance.c
89
if (ioctl(fd, HAMMERIOC_REBALANCE, &rebal) < 0) {
sbin/hammer/cmd_reblock.c
113
fd = open(filesystem, O_RDONLY);
sbin/hammer/cmd_reblock.c
114
if (fd < 0) {
sbin/hammer/cmd_reblock.c
119
if (ioctl(fd, HAMMERIOC_REBLOCK, &reblock) < 0) {
sbin/hammer/cmd_reblock.c
134
close(fd);
sbin/hammer/cmd_reblock.c
49
int fd;
sbin/hammer/cmd_recover.c
329
int fd;
sbin/hammer/cmd_recover.c
424
fd = open(path2, O_RDWR|O_CREAT, 0666);
sbin/hammer/cmd_recover.c
425
if (fd > 0)
sbin/hammer/cmd_recover.c
426
close(fd);
sbin/hammer/cmd_recover.c
474
fd = CachedFd;
sbin/hammer/cmd_recover.c
476
fd = open(path1, O_CREAT|O_RDWR, 0666);
sbin/hammer/cmd_recover.c
477
if (fd < 0) {
sbin/hammer/cmd_recover.c
499
lseek(fd, (off_t)file_offset, SEEK_SET);
sbin/hammer/cmd_recover.c
512
write(fd, ondisk, zfill);
sbin/hammer/cmd_recover.c
514
lseek(fd, chunk - zfill, SEEK_CUR);
sbin/hammer/cmd_recover.c
528
ftruncate(fd, dict->size);
sbin/hammer/cmd_recover.c
532
if (fd == CachedFd) {
sbin/hammer/cmd_recover.c
538
CachedFd = fd;
sbin/hammer/cmd_recover.c
541
CachedFd = fd;
sbin/hammer/cmd_snapshot.c
406
int fd = open(filesystem, O_RDONLY);
sbin/hammer/cmd_snapshot.c
407
if (fd < 0) {
sbin/hammer/cmd_snapshot.c
411
if (ioctl(fd, HAMMERIOC_SYNCTID, &synctid) < 0) {
sbin/hammer/cmd_snapshot.c
42
static void snapshot_add(int fd, const char *fsym, const char *tsym,
sbin/hammer/cmd_snapshot.c
437
snapshot_add(fd, from, to, note, synctid.tid);
sbin/hammer/cmd_snapshot.c
439
close(fd);
sbin/hammer/cmd_snapshot.c
449
snapshot_add(int fd, const char *fsym, const char *tsym, const char *label,
sbin/hammer/cmd_snapshot.c
461
if (ioctl(fd, HAMMERIOC_GET_VERSION, &version) == 0 &&
sbin/hammer/cmd_snapshot.c
474
if (ioctl(fd, HAMMERIOC_ADD_SNAPSHOT, &snapshot) < 0) {
sbin/hammer/cmd_snapshot.c
510
int fd;
sbin/hammer/cmd_snapshot.c
513
fd = open(path, O_RDONLY);
sbin/hammer/cmd_snapshot.c
514
if (fd < 0) {
sbin/hammer/cmd_snapshot.c
520
if (ioctl(fd, HAMMERIOC_GET_PSEUDOFS, &pfs) < 0) {
sbin/hammer/cmd_snapshot.c
526
if ((ioctl(fd, HAMMERIOC_GET_INFO, &info)) < 0) {
sbin/hammer/cmd_snapshot.c
536
if (ioctl(fd, HAMMERIOC_GET_SNAPSHOT, &snapshot) < 0) {
sbin/hammer/cmd_softprune.c
155
fd = open(scan->filesystem, O_RDONLY);
sbin/hammer/cmd_softprune.c
156
if (fd < 0) {
sbin/hammer/cmd_softprune.c
162
if (ioctl(fd, HAMMERIOC_GET_PSEUDOFS, &pfs) < 0) {
sbin/hammer/cmd_softprune.c
165
close(fd);
sbin/hammer/cmd_softprune.c
174
if (hammer_softprune_scanmeta(fd, scan, everything_opt) < 0) {
sbin/hammer/cmd_softprune.c
178
close(fd);
sbin/hammer/cmd_softprune.c
215
if (ioctl(fd, HAMMERIOC_PRUNE, &scan->prune) < 0) {
sbin/hammer/cmd_softprune.c
241
close(fd);
sbin/hammer/cmd_softprune.c
327
hammer_softprune_scanmeta(int fd, struct softprune *scan, int delete_all)
sbin/hammer/cmd_softprune.c
340
if (ioctl(fd, HAMMERIOC_GET_VERSION, &version) < 0)
sbin/hammer/cmd_softprune.c
355
if (ioctl(fd, HAMMERIOC_GET_SNAPSHOT, &snapshot) < 0) {
sbin/hammer/cmd_softprune.c
365
hammer_meta_flushdelete(fd, &dsnapshot);
sbin/hammer/cmd_softprune.c
378
hammer_meta_flushdelete(fd, &dsnapshot);
sbin/hammer/cmd_softprune.c
388
hammer_meta_flushdelete(int fd, struct hammer_ioc_snapshot *dsnap)
sbin/hammer/cmd_softprune.c
391
if (ioctl(fd, HAMMERIOC_DEL_SNAPSHOT, dsnap) < 0)
sbin/hammer/cmd_softprune.c
51
static int hammer_softprune_scanmeta(int fd, struct softprune *scan,
sbin/hammer/cmd_softprune.c
53
static void hammer_meta_flushdelete(int fd, struct hammer_ioc_snapshot *dsnap);
sbin/hammer/cmd_softprune.c
74
int fd;
sbin/hammer/cmd_synctid.c
49
int fd;
sbin/hammer/cmd_synctid.c
67
fd = open(filesystem, O_RDONLY);
sbin/hammer/cmd_synctid.c
68
if (fd < 0) {
sbin/hammer/cmd_synctid.c
72
if (ioctl(fd, HAMMERIOC_SYNCTID, &synctid) < 0) {
sbin/hammer/cmd_synctid.c
78
close(fd);
sbin/hammer/cmd_version.c
107
int fd;
sbin/hammer/cmd_version.c
116
fd = open(av[0], O_RDONLY);
sbin/hammer/cmd_version.c
117
if (fd < 0) {
sbin/hammer/cmd_version.c
123
if (ioctl(fd, HAMMERIOC_GET_VERSION, &version) < 0) {
sbin/hammer/cmd_version.c
133
if (ioctl(fd, HAMMERIOC_GET_VERSION, &version) < 0) {
sbin/hammer/cmd_version.c
144
if (ioctl(fd, HAMMERIOC_SET_VERSION, &version) < 0) {
sbin/hammer/cmd_version.c
162
close(fd);
sbin/hammer/cmd_version.c
50
int fd;
sbin/hammer/cmd_version.c
56
fd = open(av[0], O_RDONLY);
sbin/hammer/cmd_version.c
57
if (fd < 0) {
sbin/hammer/cmd_version.c
67
if (ioctl(fd, HAMMERIOC_GET_VERSION, &version) < 0) {
sbin/hammer/cmd_version.c
88
while (ioctl(fd, HAMMERIOC_GET_VERSION, &version) == 0) {
sbin/hammer/cmd_version.c
97
close(fd);
sbin/hammer/cmd_volume.c
109
int fd, retried = 0;
sbin/hammer/cmd_volume.c
120
fd = open(filesystem, O_RDONLY);
sbin/hammer/cmd_volume.c
121
if (fd < 0) {
sbin/hammer/cmd_volume.c
134
if (ioctl(fd, HAMMERIOC_DEL_VOLUME, &ioc) < 0) {
sbin/hammer/cmd_volume.c
148
close(fd);
sbin/hammer/cmd_volume.c
56
int fd;
sbin/hammer/cmd_volume.c
67
fd = open(filesystem, O_RDONLY);
sbin/hammer/cmd_volume.c
68
if (fd < 0) {
sbin/hammer/cmd_volume.c
82
close(volume->fd);
sbin/hammer/cmd_volume.c
93
if (ioctl(fd, HAMMERIOC_ADD_VOLUME, &ioc) < 0) {
sbin/hammer/cmd_volume.c
98
close(fd);
sbin/hammer/cycle.c
43
int fd;
sbin/hammer/cycle.c
45
if (CyclePath && (fd = open(CyclePath, O_RDONLY)) >= 0) {
sbin/hammer/cycle.c
46
if (fstat(fd, &st) < 0) {
sbin/hammer/cycle.c
49
close(fd);
sbin/hammer/cycle.c
55
close(fd);
sbin/hammer/cycle.c
59
if (read(fd, base, sizeof(*base)) != sizeof(*base)) {
sbin/hammer/cycle.c
65
if (read(fd, extra, sizeof(*extra)) != sizeof(*extra)) {
sbin/hammer/cycle.c
70
close(fd);
sbin/hammer/cycle.c
78
int fd;
sbin/hammer/cycle.c
80
if ((fd = open(CyclePath, O_RDWR|O_CREAT|O_TRUNC, 0666)) >= 0) {
sbin/hammer/cycle.c
81
write(fd, base, sizeof(*base));
sbin/hammer/cycle.c
82
write(fd, &extra, sizeof(extra));
sbin/hammer/cycle.c
83
close(fd);
sbin/hammer/hammer.h
125
void relpfs(int fd, struct hammer_ioc_pseudofs_rw *pfs);
sbin/hammer/hammer_util.h
83
int fd;
sbin/hammer/misc.c
112
int fd;
sbin/hammer/misc.c
114
fd = open(fs, O_RDONLY);
sbin/hammer/misc.c
115
if (fd < 0) {
sbin/hammer/misc.c
125
close(fd);
sbin/hammer/misc.c
129
if (ioctl(fd, HAMMERIOC_LIST_VOLUMES, &ioc) < 0) {
sbin/hammer/misc.c
131
close(fd);
sbin/hammer/misc.c
137
close(fd);
sbin/hammer/ondisk.c
120
if (fstat(volume->fd, &st1) != 0) {
sbin/hammer/ondisk.c
132
if (fstat(scan->fd, &st2) != 0) {
sbin/hammer/ondisk.c
244
if (ioctl(volume->fd, DIOCGPART, &pinfo) < 0) {
sbin/hammer/ondisk.c
245
if (fstat(volume->fd, &st) < 0) {
sbin/hammer/ondisk.c
960
n = pread(volume->fd, data, size, offset);
sbin/hammer/ondisk.c
98
volume->fd = open(volume->name, oflags);
sbin/hammer/ondisk.c
99
if (volume->fd < 0) {
sbin/hammer/ondisk.c
990
n = pwrite(volume->fd, data, size, offset);
sbin/hammer2/cmd_bulkfree.c
42
int fd;
sbin/hammer2/cmd_bulkfree.c
59
if ((fd = hammer2_ioctl_handle(sel_path)) < 0)
sbin/hammer2/cmd_bulkfree.c
61
res = ioctl(fd, HAMMER2IOC_BULKFREE_SCAN, &bfi);
sbin/hammer2/cmd_bulkfree.c
75
int fd;
sbin/hammer2/cmd_bulkfree.c
81
if ((fd = hammer2_ioctl_handle(sel_path)) < 0)
sbin/hammer2/cmd_bulkfree.c
83
res = ioctl(fd, HAMMER2IOC_BULKFREE_ASYNC, &bfi);
sbin/hammer2/cmd_debug.c
100
dmsg_iocom_init(&iocom, fd, 0,
sbin/hammer2/cmd_debug.c
112
close(fd);
sbin/hammer2/cmd_debug.c
1322
int fd;
sbin/hammer2/cmd_debug.c
1324
fd = open(path, O_RDONLY);
sbin/hammer2/cmd_debug.c
1325
if (fd >= 0) {
sbin/hammer2/cmd_debug.c
1326
if (ioctl(fd, HAMMER2IOC_DEBUG_DUMP, &dummy) < 0) {
sbin/hammer2/cmd_debug.c
1330
close(fd);
sbin/hammer2/cmd_debug.c
322
int fd;
sbin/hammer2/cmd_debug.c
328
fd = -1;
sbin/hammer2/cmd_debug.c
330
fd = dmsg_connect(hostname);
sbin/hammer2/cmd_debug.c
336
if (fd < 0) {
sbin/hammer2/cmd_debug.c
343
info->fd = fd;
sbin/hammer2/cmd_debug.c
364
int fd;
sbin/hammer2/cmd_debug.c
370
fd = dmsg_connect(hostname);
sbin/hammer2/cmd_debug.c
371
if (fd < 0)
sbin/hammer2/cmd_debug.c
376
dmsg_master_service, (void *)(intptr_t)fd);
sbin/hammer2/cmd_debug.c
427
int fd;
sbin/hammer2/cmd_debug.c
501
fd = hammer2_get_volume_fd(volu_loff);
sbin/hammer2/cmd_debug.c
502
lseek(fd, off, SEEK_SET);
sbin/hammer2/cmd_debug.c
503
if (read(fd, &media, HAMMER2_PBUFSIZE) ==
sbin/hammer2/cmd_debug.c
527
fd = hammer2_get_volume_fd(volu_loff);
sbin/hammer2/cmd_debug.c
528
lseek(fd, off, SEEK_SET);
sbin/hammer2/cmd_debug.c
529
if (read(fd, &media, HAMMER2_PBUFSIZE) ==
sbin/hammer2/cmd_debug.c
62
int fd;
sbin/hammer2/cmd_debug.c
64
fd = dmsg_connect(hostname);
sbin/hammer2/cmd_debug.c
65
if (fd < 0)
sbin/hammer2/cmd_debug.c
70
info->fd = fd;
sbin/hammer2/cmd_debug.c
766
int i, bcount, namelen, failed, obrace, fd;
sbin/hammer2/cmd_debug.c
820
fd = hammer2_get_volume_fd(io_off);
sbin/hammer2/cmd_debug.c
821
lseek(fd, io_base - hammer2_get_volume_offset(io_base),
sbin/hammer2/cmd_debug.c
823
if (read(fd, &media, io_bytes) != (ssize_t)io_bytes) {
sbin/hammer2/cmd_debug.c
87
int fd;
sbin/hammer2/cmd_debug.c
92
fd = dmsg_connect(hostname);
sbin/hammer2/cmd_debug.c
93
if (fd < 0)
sbin/hammer2/cmd_destroy.c
101
fd = hammer2_ioctl_handle(sel_path);
sbin/hammer2/cmd_destroy.c
102
if (fd < 0)
sbin/hammer2/cmd_destroy.c
111
if (ioctl(fd, HAMMER2IOC_DESTROY, &destroy) < 0) {
sbin/hammer2/cmd_destroy.c
118
close(fd);
sbin/hammer2/cmd_destroy.c
42
int fd;
sbin/hammer2/cmd_destroy.c
50
fd = pathdir(av[i], &last);
sbin/hammer2/cmd_destroy.c
51
if (fd >= 0) {
sbin/hammer2/cmd_destroy.c
54
if (ioctl(fd, HAMMER2IOC_DESTROY, &destroy) < 0) {
sbin/hammer2/cmd_destroy.c
60
close(fd);
sbin/hammer2/cmd_destroy.c
75
int fd;
sbin/hammer2/cmd_destroy.c
82
fd = open(".", O_RDONLY);
sbin/hammer2/cmd_destroy.c
86
fd = open(npath, O_RDONLY);
sbin/hammer2/cmd_destroy.c
90
return fd;
sbin/hammer2/cmd_destroy.c
98
int fd;
sbin/hammer2/cmd_emergency.c
41
int fd;
sbin/hammer2/cmd_emergency.c
47
fd = open(av[0], O_RDONLY);
sbin/hammer2/cmd_emergency.c
48
if (fd < 0) {
sbin/hammer2/cmd_emergency.c
52
if (ioctl(fd, HAMMER2IOC_EMERG_MODE, &enable) == 0) {
sbin/hammer2/cmd_emergency.c
61
close(fd);
sbin/hammer2/cmd_growfs.c
40
int fd;
sbin/hammer2/cmd_growfs.c
55
fd = hammer2_ioctl_handle(sel_path);
sbin/hammer2/cmd_growfs.c
56
if (fd < 0) {
sbin/hammer2/cmd_growfs.c
61
if (ioctl(fd, HAMMER2IOC_GROWFS, &growfs) < 0) {
sbin/hammer2/cmd_growfs.c
72
close(fd);
sbin/hammer2/cmd_info.c
156
info_callback1(const void *path, hammer2_blockref_t *bref, int fd)
sbin/hammer2/cmd_info.c
163
h2pfs_check(fd, bref, info_callback2);
sbin/hammer2/cmd_info.c
178
hammer2_blockref_t *bref __unused, int fd __unused)
sbin/hammer2/cmd_info.c
261
mount_callback1(const void *devpath, hammer2_blockref_t *bref, int fd)
sbin/hammer2/cmd_info.c
267
h2pfs_check(fd, bref, mount_callback2);
sbin/hammer2/cmd_info.c
274
hammer2_blockref_t *bref __unused, int fd)
sbin/hammer2/cmd_info.c
283
dup2(tfd, fd);
sbin/hammer2/cmd_info.c
315
int fd;
sbin/hammer2/cmd_info.c
319
fd = open(devpath, O_RDONLY);
sbin/hammer2/cmd_info.c
320
if (fd < 0) {
sbin/hammer2/cmd_info.c
324
if (ioctl(fd, DIOCGPART, &partinfo) == -1) {
sbin/hammer2/cmd_info.c
357
lseek(fd, broot.data_off & ~HAMMER2_OFF_MASK_RADIX, SEEK_SET);
sbin/hammer2/cmd_info.c
358
if (read(fd, &media, HAMMER2_PBUFSIZE) !=
sbin/hammer2/cmd_info.c
374
callback1(devpath, &best, fd);
sbin/hammer2/cmd_info.c
376
close(fd);
sbin/hammer2/cmd_info.c
381
h2pfs_check(int fd, hammer2_blockref_t *bref, cmd_callback callback2)
sbin/hammer2/cmd_info.c
39
static void h2pfs_check(int fd, hammer2_blockref_t *bref,
sbin/hammer2/cmd_info.c
413
lseek(fd, io_base, SEEK_SET);
sbin/hammer2/cmd_info.c
414
if (read(fd, &media, io_bytes) != (ssize_t)io_bytes) {
sbin/hammer2/cmd_info.c
478
callback2(&media.ipdata, bref, fd);
sbin/hammer2/cmd_info.c
499
h2pfs_check(fd, &bscan[i], callback2);
sbin/hammer2/cmd_leaf.c
101
close(fd);
sbin/hammer2/cmd_leaf.c
124
int fd;
sbin/hammer2/cmd_leaf.c
126
fd = (int)(intptr_t)data;
sbin/hammer2/cmd_leaf.c
85
int fd;
sbin/hammer2/cmd_leaf.c
91
if ((fd = hammer2_ioctl_handle(sel_info)) < 0)
sbin/hammer2/cmd_pfs.c
104
close(fd);
sbin/hammer2/cmd_pfs.c
127
int fd;
sbin/hammer2/cmd_pfs.c
130
if ((fd = hammer2_ioctl_handle(sel_path)) < 0)
sbin/hammer2/cmd_pfs.c
135
if (ioctl(fd, HAMMER2IOC_PFS_LOOKUP, &pfs) < 0) {
sbin/hammer2/cmd_pfs.c
147
close(fd);
sbin/hammer2/cmd_pfs.c
158
int fd;
sbin/hammer2/cmd_pfs.c
175
if ((fd = hammer2_ioctl_handle(sel_path)) < 0)
sbin/hammer2/cmd_pfs.c
188
if (ioctl(fd, HAMMER2IOC_PFS_CREATE, &pfs) < 0) {
sbin/hammer2/cmd_pfs.c
211
close(fd);
sbin/hammer2/cmd_pfs.c
220
int fd;
sbin/hammer2/cmd_pfs.c
240
if ((fd = hammer2_ioctl_handle(mnts[n])) < 0) {
sbin/hammer2/cmd_pfs.c
244
if (ioctl(fd, HAMMER2IOC_PFS_LOOKUP, &pfs) < 0) {
sbin/hammer2/cmd_pfs.c
258
use_fd = fd;
sbin/hammer2/cmd_pfs.c
49
int fd;
sbin/hammer2/cmd_pfs.c
63
if ((fd = hammer2_ioctl_handle(av[i])) < 0)
sbin/hammer2/cmd_pfs.c
71
if (ioctl(fd, HAMMER2IOC_PFS_GET, &pfs) < 0) {
sbin/hammer2/cmd_recover.c
1354
if (pread(vol->fd, &data, psize, poff) !=
sbin/hammer2/cmd_recover.c
1418
if (pread(vol->fd, &data, psize, poff) != (ssize_t)psize) {
sbin/hammer2/cmd_recover.c
1630
if (pread(vol->fd, sdc->buf, HAMMER2_PBUFSIZE, pbase) !=
sbin/hammer2/cmd_recover.c
232
int fd;
sbin/hammer2/cmd_recover.c
235
fd = vol->fd;
sbin/hammer2/cmd_recover.c
240
if (pread(fd, &data, sizeof(data), poff) !=
sbin/hammer2/cmd_recover.c
593
vfd = vol->fd;
sbin/hammer2/cmd_remote.c
100
if ((fd = hammer2_ioctl_handle(sel_path)) < 0)
sbin/hammer2/cmd_remote.c
105
if (ioctl(fd, HAMMER2IOC_REMOTE_SCAN, &remote) < 0) {
sbin/hammer2/cmd_remote.c
43
int fd;
sbin/hammer2/cmd_remote.c
45
if ((fd = hammer2_ioctl_handle(sel_path)) < 0)
sbin/hammer2/cmd_remote.c
49
remote.fd = -1;
sbin/hammer2/cmd_remote.c
52
close(fd);
sbin/hammer2/cmd_remote.c
57
if (ioctl(fd, HAMMER2IOC_REMOTE_ADD, &remote) < 0) {
sbin/hammer2/cmd_remote.c
61
close(fd);
sbin/hammer2/cmd_remote.c
70
int fd;
sbin/hammer2/cmd_remote.c
72
if ((fd = hammer2_ioctl_handle(sel_path)) < 0)
sbin/hammer2/cmd_remote.c
76
remote.fd = -1;
sbin/hammer2/cmd_remote.c
79
close(fd);
sbin/hammer2/cmd_remote.c
84
if (ioctl(fd, HAMMER2IOC_REMOTE_DEL, &remote) < 0) {
sbin/hammer2/cmd_remote.c
88
close(fd);
sbin/hammer2/cmd_remote.c
98
int fd;
sbin/hammer2/cmd_service.c
214
int fd;
sbin/hammer2/cmd_service.c
260
fd = accept(lfd, (struct sockaddr *)&asin, &alen);
sbin/hammer2/cmd_service.c
261
if (fd < 0) {
sbin/hammer2/cmd_service.c
267
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof opt);
sbin/hammer2/cmd_service.c
268
fprintf(stderr, "service_thread: accept fd %d\n", fd);
sbin/hammer2/cmd_service.c
271
info->fd = fd;
sbin/hammer2/cmd_service.c
439
conf->fd = dmsg_connect(hostname);
sbin/hammer2/cmd_service.c
440
if (conf->fd < 0) {
sbin/hammer2/cmd_service.c
444
close(conf->fd);
sbin/hammer2/cmd_service.c
451
info->fd = conf->fd;
sbin/hammer2/cmd_service.c
48
int fd;
sbin/hammer2/cmd_service.c
499
int fd;
sbin/hammer2/cmd_service.c
505
if ((fd = open(UDEV_DEVICE_PATH, O_RDWR)) < 0) {
sbin/hammer2/cmd_service.c
511
while (ioctl(fd, UDEVWAIT, &seq) == 0) {
sbin/hammer2/cmd_service.c
699
int fd;
sbin/hammer2/cmd_service.c
706
fd = dmsg_connect(ac->host);
sbin/hammer2/cmd_service.c
707
if (fd < 0) {
sbin/hammer2/cmd_service.c
720
info->fd = fd;
sbin/hammer2/cmd_service.c
808
int fd;
sbin/hammer2/cmd_service.c
811
fd = open(mntpt, O_RDONLY);
sbin/hammer2/cmd_service.c
812
if (fd < 0) {
sbin/hammer2/cmd_service.c
818
close(fd);
sbin/hammer2/cmd_service.c
822
recls.fd = pipefds[0];
sbin/hammer2/cmd_service.c
823
if (ioctl(fd, HAMMER2IOC_RECLUSTER, &recls) < 0) {
sbin/hammer2/cmd_service.c
827
close(fd);
sbin/hammer2/cmd_service.c
831
close(fd);
sbin/hammer2/cmd_service.c
835
info->fd = pipefds[1];
sbin/hammer2/cmd_service.c
853
int fd;
sbin/hammer2/cmd_service.c
884
fd = open(path, O_RDONLY);
sbin/hammer2/cmd_service.c
885
if (fd < 0) {
sbin/hammer2/cmd_service.c
893
close(fd);
sbin/hammer2/cmd_service.c
897
recls.fd = pipefds[0];
sbin/hammer2/cmd_service.c
898
if (ioctl(fd, DIOCRECLUSTER, &recls) < 0) {
sbin/hammer2/cmd_service.c
902
close(fd);
sbin/hammer2/cmd_service.c
906
close(fd);
sbin/hammer2/cmd_service.c
916
info->fd = pipefds[1];
sbin/hammer2/cmd_service.c
976
info->fd = pipefds[1];
sbin/hammer2/cmd_service.c
986
xaioc.fd = pipefds[0];
sbin/hammer2/cmd_setcheck.c
102
fd = hammer2_ioctl_handle(path_str);
sbin/hammer2/cmd_setcheck.c
103
if (fd < 0) {
sbin/hammer2/cmd_setcheck.c
107
res = ioctl(fd, HAMMER2IOC_INODE_GET, &inode);
sbin/hammer2/cmd_setcheck.c
118
res = ioctl(fd, HAMMER2IOC_INODE_SET, &inode);
sbin/hammer2/cmd_setcheck.c
133
if ((dir = fdopendir(fd)) != NULL) {
sbin/hammer2/cmd_setcheck.c
148
close(fd);
sbin/hammer2/cmd_setcheck.c
99
int fd;
sbin/hammer2/cmd_setcomp.c
135
int fd;
sbin/hammer2/cmd_setcomp.c
138
fd = hammer2_ioctl_handle(path_str);
sbin/hammer2/cmd_setcomp.c
139
if (fd < 0) {
sbin/hammer2/cmd_setcomp.c
143
res = ioctl(fd, HAMMER2IOC_INODE_GET, &inode);
sbin/hammer2/cmd_setcomp.c
154
res = ioctl(fd, HAMMER2IOC_INODE_SET, &inode);
sbin/hammer2/cmd_setcomp.c
169
if ((dir = fdopendir(fd)) != NULL) {
sbin/hammer2/cmd_setcomp.c
184
close(fd);
sbin/hammer2/cmd_setcomp.c
222
int fd = hammer2_ioctl_handle(file_string);
sbin/hammer2/cmd_setcomp.c
224
int res = ioctl(fd, HAMMER2IOC_INODE_GET, &inode);
sbin/hammer2/cmd_setcomp.c
236
res = ioctl(fd, HAMMER2IOC_INODE_SET, &inode);
sbin/hammer2/cmd_setcomp.c
243
close(fd);
sbin/hammer2/cmd_setcomp.c
271
int fd = hammer2_ioctl_handle(name);
sbin/hammer2/cmd_setcomp.c
273
int res = ioctl(fd, HAMMER2IOC_INODE_GET, &inode);
sbin/hammer2/cmd_setcomp.c
282
res = ioctl(fd, HAMMER2IOC_INODE_SET, &inode);
sbin/hammer2/cmd_setcomp.c
288
res = ioctl(fd, HAMMER2IOC_INODE_SET, &inode);
sbin/hammer2/cmd_setcomp.c
299
close(fd);
sbin/hammer2/cmd_snapshot.c
100
if (ioctl(fd, HAMMER2IOC_PFS_SNAPSHOT, &pfs) < 0) {
sbin/hammer2/cmd_snapshot.c
60
int fd;
sbin/hammer2/cmd_snapshot.c
66
fd = hammer2_ioctl_handle(sel_path);
sbin/hammer2/cmd_snapshot.c
68
fd = open(path, O_RDONLY);
sbin/hammer2/cmd_snapshot.c
69
if (fd < 0)
sbin/hammer2/cmd_snapshot.c
72
if (fd < 0)
sbin/hammer2/cmd_snapshot.c
80
if (ioctl(fd, HAMMER2IOC_PFS_GET, &pfs) < 0) {
sbin/hammer2/cmd_stat.c
49
int fd;
sbin/hammer2/cmd_stat.c
64
if ((fd = open(av[i], O_RDONLY)) < 0) {
sbin/hammer2/cmd_stat.c
69
if (ioctl(fd, HAMMER2IOC_INODE_GET, &ino) < 0) {
sbin/hammer2/cmd_volume.c
100
close(fd);
sbin/hammer2/cmd_volume.c
44
int fd, i, j, n, w, all = 0, ecode = 0;
sbin/hammer2/cmd_volume.c
57
if ((fd = hammer2_ioctl_handle(av[i])) < 0) {
sbin/hammer2/cmd_volume.c
63
if (ioctl(fd, HAMMER2IOC_VOLUME_LIST, &vollist) < 0) {
sbin/hammer2/cmd_volume.c
65
close(fd);
sbin/hammer2/hammer2_subs.h
51
int fd;
sbin/hammer2/hammer2_subs.h
82
hammer2_off_t check_volume(int fd);
sbin/hammer2/hammer2_subs.h
94
void hammer2_install_volume(hammer2_volume_t *vol, int fd, int id,
sbin/hammer2/ondisk.c
103
hammer2_read_volume_header(int fd, const char *path,
sbin/hammer2/ondisk.c
108
hammer2_off_t size = check_volume(fd);
sbin/hammer2/ondisk.c
117
if (lseek(fd, i * HAMMER2_ZONE_BYTES64, SEEK_SET) == -1)
sbin/hammer2/ondisk.c
119
ret = read(fd, &vd, HAMMER2_VOLUME_BYTES);
sbin/hammer2/ondisk.c
209
int fd, i;
sbin/hammer2/ondisk.c
212
fd = open(path, rdonly ? O_RDONLY : O_RDWR);
sbin/hammer2/ondisk.c
213
if (fd == -1)
sbin/hammer2/ondisk.c
216
if (fstat(fd, &st) == -1)
sbin/hammer2/ondisk.c
221
if (hammer2_read_volume_header(fd, path, &voldata) >= 0) {
sbin/hammer2/ondisk.c
253
hammer2_install_volume(vol, fd, i, path,
sbin/hammer2/ondisk.c
307
if (fstat(vol->fd, &st[i]) != 0)
sbin/hammer2/ondisk.c
308
errx(1, "Failed to fstat %d", vol->fd);
sbin/hammer2/ondisk.c
315
if (vol->fd == -1)
sbin/hammer2/ondisk.c
316
errx(1, "%s has bad fd %d", path, vol->fd);
sbin/hammer2/ondisk.c
324
size = check_volume(vol->fd);
sbin/hammer2/ondisk.c
599
*(int*)data = vol->fd;
sbin/hammer2/ondisk.c
60
vol->fd = -1;
sbin/hammer2/ondisk.c
721
int fd = hammer2_get_root_volume_fd();
sbin/hammer2/ondisk.c
724
if (fd == -1)
sbin/hammer2/ondisk.c
728
if (hammer2_read_volume_header(fd, path, voldata) >= 0)
sbin/hammer2/ondisk.c
78
hammer2_install_volume(hammer2_volume_t *vol, int fd, int id, const char *path,
sbin/hammer2/ondisk.c
82
vol->fd = fd;
sbin/hammer2/ondisk.c
92
fsync(vol->fd);
sbin/hammer2/ondisk.c
93
close(vol->fd);
sbin/hammer2/print_inode.c
64
int fd;
sbin/hammer2/print_inode.c
67
fd = hammer2_ioctl_handle(path);
sbin/hammer2/print_inode.c
68
if (fd == -1)
sbin/hammer2/print_inode.c
71
if (ioctl(fd, HAMMER2IOC_INODE_GET, &inode) == -1) {
sbin/hammer2/subs.c
311
check_volume(int fd)
sbin/hammer2/subs.c
320
if (ioctl(fd, DIOCGPART, &pinfo) < 0) {
sbin/hammer2/subs.c
324
if (fstat(fd, &st) < 0)
sbin/hammer2/subs.c
325
err(1, "Unable to stat fd %d", fd);
sbin/hammer2/subs.c
327
errx(1, "Unsupported file type for fd %d", fd);
sbin/hammer2/subs.c
65
int fd;
sbin/hammer2/subs.c
70
fd = open(sel_path, O_RDONLY, 0);
sbin/hammer2/subs.c
71
if (fd < 0) {
sbin/hammer2/subs.c
76
if (ioctl(fd, HAMMER2IOC_VERSION_GET, &info) < 0) {
sbin/hammer2/subs.c
79
close(fd);
sbin/hammer2/subs.c
82
return (fd);
sbin/ifconfig/ifbridge.c
229
u_int8_t ht, fd, ma;
sbin/ifconfig/ifbridge.c
241
fd = param.ifbrp_fwddelay;
sbin/ifconfig/ifbridge.c
248
pri, ht, fd, ma);
sbin/ifconfig/regdomain.c
625
int fd;
sbin/ifconfig/regdomain.c
629
fd = open(_PATH_REGDOMAIN, O_RDONLY);
sbin/ifconfig/regdomain.c
630
if (fd < 0) {
sbin/ifconfig/regdomain.c
637
if (fstat(fd, &sb) < 0) {
sbin/ifconfig/regdomain.c
641
close(fd);
sbin/ifconfig/regdomain.c
645
xml = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
sbin/ifconfig/regdomain.c
650
close(fd);
sbin/ifconfig/regdomain.c
659
close(fd);
sbin/ifconfig/regdomain.c
664
close(fd);
sbin/init/init.c
1035
int fd;
sbin/init/init.c
1053
if ((fd = open(sp->se_device, O_RDONLY | O_NONBLOCK, 0)) < 0) {
sbin/init/init.c
1059
close(fd);
sbin/init/init.c
1599
int fd;
sbin/init/init.c
1609
if ((fd = open(_PATH_CONSOLE, O_RDWR)) == -1)
sbin/init/init.c
1612
dup2(fd, 0);
sbin/init/init.c
1613
dup2(fd, 1);
sbin/init/init.c
1614
dup2(fd, 2);
sbin/init/init.c
1615
if (fd > 2)
sbin/init/init.c
1616
close(fd);
sbin/init/init.c
620
int fd;
sbin/init/init.c
623
if ((fd = open(name, O_RDWR)) == -1) {
sbin/init/init.c
627
if (login_tty(fd) == -1) {
sbin/iscontrol/auth_subr.c
151
int fd;
sbin/iscontrol/auth_subr.c
157
if((fd = open("/dev/random", O_RDONLY)) != -1) {
sbin/iscontrol/auth_subr.c
158
read(fd, tmp, len);
sbin/iscontrol/auth_subr.c
159
close(fd);
sbin/iscontrol/config.c
205
get_line(FILE *fd)
sbin/iscontrol/config.c
212
sp = fgets(line, sizeof line, fd);
sbin/iscontrol/config.c
227
} while (feof(fd) == 0);
sbin/iscontrol/config.c
232
getConfig(FILE *fd, char *key, char **Ar, int *nargs)
sbin/iscontrol/config.c
243
while((lp = get_line(fd)) != NULL) {
sbin/iscontrol/config.c
363
parseConfig(FILE *fd, char *key, isc_opt_t *op)
sbin/iscontrol/config.c
369
if(getConfig(fd, key, Ar, &cc))
sbin/iscontrol/fsm.c
263
if(ioctl(sess->fd, ISCSISETOPT, &oop)) {
sbin/iscontrol/fsm.c
274
int n, fd, nfd;
sbin/iscontrol/fsm.c
282
if(sess->fd == -1) {
sbin/iscontrol/fsm.c
283
fd = open(iscsidev, O_RDWR);
sbin/iscontrol/fsm.c
284
if(fd < 0) {
sbin/iscontrol/fsm.c
295
if(ioctl(fd, ISCSISETSES, &n)) {
sbin/iscontrol/fsm.c
308
close(fd);
sbin/iscontrol/fsm.c
309
sess->fd = nfd;
sbin/iscontrol/fsm.c
315
if(ioctl(sess->fd, ISCSISETSOC, &sess->soc)) {
sbin/iscontrol/fsm.c
354
if(ioctl(sess->fd, ISCSIGETCAM, &sess->cam) != 0) {
sbin/iscontrol/fsm.c
426
if(ioctl(sess->fd, ISCSISTART)) {
sbin/iscontrol/fsm.c
434
if(ioctl(sess->fd, ISCSIRESTART)) {
sbin/iscontrol/fsm.c
446
if(ioctl(sess->fd, ISCSISIGNAL, &sig)) {
sbin/iscontrol/fsm.c
467
if(ioctl(sess->fd, ISCSISIGNAL, &sig)) {
sbin/iscontrol/fsm.c
473
if(ioctl(sess->fd, ISCSISTOP, &val)) {
sbin/iscontrol/fsm.c
672
sess->fd = -1;
sbin/iscontrol/iscontrol.c
130
FILE *fd;
sbin/iscontrol/iscontrol.c
142
fd = NULL;
sbin/iscontrol/iscontrol.c
156
fd = fopen(optarg, "r");
sbin/iscontrol/iscontrol.c
157
if(fd == NULL) {
sbin/iscontrol/iscontrol.c
177
if(fd == NULL)
sbin/iscontrol/iscontrol.c
178
fd = fopen("/etc/iscsi.conf", "r");
sbin/iscontrol/iscontrol.c
180
if(fd != NULL) {
sbin/iscontrol/iscontrol.c
181
parseConfig(fd, kw, op);
sbin/iscontrol/iscontrol.c
182
fclose(fd);
sbin/iscontrol/iscontrol.h
155
void parseConfig(FILE *fd, char *key, isc_opt_t *op);
sbin/iscontrol/iscontrol.h
71
int fd; // the session fd
sbin/iscontrol/pdu.c
49
if(ioctl(sess->fd, ISCSISEND, pp)) {
sbin/iscontrol/pdu.c
62
if(ioctl(sess->fd, ISCSIRECV, pp)) {
sbin/jscan/dump_mirror.c
416
int fd;
sbin/jscan/dump_mirror.c
441
if ((fd = open(jattr->pathref, O_RDWR)) >= 0) {
sbin/jscan/dump_mirror.c
442
lseek(fd, jattr->seekpos, 0);
sbin/jscan/dump_mirror.c
445
jsreadcallback(js, write, fd, data->off, data->bytes);
sbin/jscan/dump_mirror.c
447
close(fd);
sbin/jscan/dump_mirror.c
460
if ((fd = open(jattr->path1, O_CREAT, jattr->modes)) >= 0) {
sbin/jscan/dump_mirror.c
461
dosetattr(jattr->path1, fd, jattr);
sbin/jscan/dump_mirror.c
462
close(fd);
sbin/jscan/dump_mirror.c
515
int fd;
sbin/jscan/dump_mirror.c
530
if ((fd = open(jattr->pathref, O_RDWR)) >= 0) {
sbin/jscan/dump_mirror.c
531
lseek(fd, jattr->seekpos, 0);
sbin/jscan/dump_mirror.c
534
jsreadcallback(js, write, fd, data->off, data->bytes);
sbin/jscan/dump_mirror.c
536
close(fd);
sbin/jscan/dump_mirror.c
54
static void dosetattr(const char *filename, int fd, struct jattr *jattr);
sbin/jscan/dump_mirror.c
603
int fd;
sbin/jscan/dump_mirror.c
612
if ((fd = open(filename, O_RDWR|O_CREAT|O_TRUNC, 0600)) >= 0) {
sbin/jscan/dump_mirror.c
614
lseek(fd, jattr->seekpos, 0);
sbin/jscan/dump_mirror.c
617
jsreadcallback(js, write, fd, data->off, data->bytes);
sbin/jscan/dump_mirror.c
620
dosetattr(filename, fd, jattr);
sbin/jscan/dump_mirror.c
621
close(fd);
sbin/jscan/dump_mirror.c
648
dosetattr(const char *filename, int fd, struct jattr *jattr)
sbin/jscan/dump_mirror.c
650
if (fd >= 0) {
sbin/jscan/dump_mirror.c
652
fchown(fd, jattr->uid, jattr->gid);
sbin/jscan/dump_mirror.c
654
fchown(fd, jattr->uid, -1);
sbin/jscan/dump_mirror.c
656
fchown(fd, -1, jattr->gid);
sbin/jscan/dump_mirror.c
659
fchmod(fd, jattr->modes);
sbin/jscan/dump_mirror.c
661
fchflags(fd, jattr->fflags);
sbin/jscan/dump_mirror.c
663
ftruncate(fd, jattr->size);
sbin/jscan/jfile.c
125
if ((fd = open(data, O_RDWR|O_CREAT, 0666)) >= 0)
sbin/jscan/jfile.c
126
close(fd);
sbin/jscan/jfile.c
161
int fd;
sbin/jscan/jfile.c
182
fd = open(data, O_RDWR, 0666);
sbin/jscan/jfile.c
184
fd = open(data, O_RDWR|O_CREAT, 0666);
sbin/jscan/jfile.c
187
if (fd < 0)
sbin/jscan/jfile.c
189
if (fstat(fd, &st) == 0 && st.st_size == 0)
sbin/jscan/jfile.c
190
write(fd, "0000000000000000\n", 17); /* starting transid in hex */
sbin/jscan/jfile.c
191
close(fd);
sbin/jscan/jfile.c
50
jopen_fd(int fd)
sbin/jscan/jfile.c
56
jf->jf_fd = fd;
sbin/jscan/jfile.c
85
int fd;
sbin/jscan/jscan.h
174
struct jfile *jopen_fd(int fd);
sbin/jscan/jscan.h
199
int jsreadcallback(struct jstream *js, ssize_t (*func)(int, const void *, size_t), int fd, off_t off, int bytes);
sbin/jscan/jstream.c
424
int fd, off_t off, int bytes)
sbin/jscan/jstream.c
435
r = func(fd, bufp, n);
sbin/jscan/subs.c
351
int fd;
sbin/jscan/subs.c
355
if ((fd = open(path, O_RDONLY)) >= 0) {
sbin/jscan/subs.c
356
n = read(fd, buf, sizeof(buf) - 1);
sbin/jscan/subs.c
361
close(fd);
sbin/ldconfig/elfhints.c
190
int fd;
sbin/ldconfig/elfhints.c
198
if ((fd = open(hintsfile, O_RDONLY)) == -1) {
sbin/ldconfig/elfhints.c
203
if (fstat(fd, &s) == -1)
sbin/ldconfig/elfhints.c
212
MAP_PRIVATE, fd, 0);
sbin/ldconfig/elfhints.c
215
close(fd);
sbin/ldconfig/elfhints.c
257
int fd;
sbin/ldconfig/elfhints.c
263
if ((fd = mkstemp(tempname)) == -1)
sbin/ldconfig/elfhints.c
265
if (fchmod(fd, 0444) == -1)
sbin/ldconfig/elfhints.c
267
if ((fp = fdopen(fd, "wb")) == NULL)
sbin/md5/md5.c
169
int fd;
sbin/md5/md5.c
175
fd = open(fname, O_RDONLY);
sbin/md5/md5.c
176
if (fd == -1) {
sbin/md5/md5.c
183
while ((bytes = read(fd, buffer, sizeof(buffer))) > 0)
sbin/md5/md5.c
193
close(fd);
sbin/md5/md5.c
201
int fd;
sbin/md5/md5.c
209
fd = open(fname, O_RDONLY);
sbin/md5/md5.c
210
if (fd == -1) {
sbin/md5/md5.c
215
if (fstat(fd, &st) == -1) {
sbin/md5/md5.c
257
map = mmap(NULL, size, PROT_READ, MAP_NOCORE, fd, begin);
sbin/md5/md5.c
277
close(fd);
sbin/mount/mount.c
786
iscdmedia(const char *path, int fd __unused)
sbin/mount/mount.c
812
int fd;
sbin/mount/mount.c
823
fd = open(path, O_RDONLY);
sbin/mount/mount.c
824
if (fd < 0)
sbin/mount/mount.c
826
if (ioctl(fd, DIOCGPART, &info) == 0) {
sbin/mount/mount.c
830
} else if (iscdmedia(path, fd)) {
sbin/mount/mount.c
841
close(fd);
sbin/mount_cd9660/mount_cd9660.c
245
int fd, ntocentries, i;
sbin/mount_cd9660/mount_cd9660.c
247
if ((fd = open(dev, O_RDONLY)) == -1)
sbin/mount_cd9660/mount_cd9660.c
249
if (ioctl(fd, CDIOREADTOCHEADER, &h) == -1) {
sbin/mount_cd9660/mount_cd9660.c
250
close(fd);
sbin/mount_cd9660/mount_cd9660.c
257
close(fd);
sbin/mount_cd9660/mount_cd9660.c
265
if (ioctl(fd, CDIOREADTOCENTRYS, (char *) &t) == -1) {
sbin/mount_cd9660/mount_cd9660.c
266
close(fd);
sbin/mount_cd9660/mount_cd9660.c
269
close(fd);
sbin/mount_fuse/mount_fusefs.c
122
int error, c, fd, mntflags;
sbin/mount_fuse/mount_fusefs.c
163
fd = strtol(fdstr, &ep, 10);
sbin/mount_fuse/mount_fusefs.c
164
if (fd <= 0 || *ep != '\0')
sbin/mount_fuse/mount_fusefs.c
167
if (fstat(fd, &st) == -1)
sbin/mount_fuse/mount_fusefs.c
168
err(1, "Failed to stat FUSE fd %d", fd);
sbin/mount_fuse/mount_fusefs.c
176
args.fd = fd;
sbin/mount_hammer2/mount_hammer2.c
219
int fd;
sbin/mount_hammer2/mount_hammer2.c
231
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
sbin/mount_hammer2/mount_hammer2.c
240
if (connect(fd, (struct sockaddr *)&lsin, sizeof(lsin)) < 0) {
sbin/mount_hammer2/mount_hammer2.c
241
close(fd);
sbin/mount_hammer2/mount_hammer2.c
247
return(fd);
sbin/mountctl/mountctl.c
254
if ((fd = open(wopt, O_RDWR|O_CREAT|O_APPEND, 0666)) < 0) {
sbin/mountctl/mountctl.c
259
fd = strtol(xopt, NULL, 0);
sbin/mountctl/mountctl.c
261
fd = 1; /* stdout default for -a */
sbin/mountctl/mountctl.c
263
fd = -1;
sbin/mountctl/mountctl.c
270
mountctl_scan(mountctl_list, keyword, mountpt, fd);
sbin/mountctl/mountctl.c
272
mountctl_add(keyword, mountpt, fd);
sbin/mountctl/mountctl.c
274
ch = mountctl_scan(mountctl_restart, keyword, mountpt, fd);
sbin/mountctl/mountctl.c
288
ch = mountctl_scan(mountctl_modify, keyword, mountpt, fd);
sbin/mountctl/mountctl.c
411
const char *keyword, const char *mountpt, int fd)
sbin/mountctl/mountctl.c
442
func(rstat[i].id, mountpt, fd, &rstat[i]);
sbin/mountctl/mountctl.c
449
calls += mountctl_scan(func, keyword, sfs[i].f_mntonname, fd);
sbin/mountctl/mountctl.c
460
int fd __unused, void *info)
sbin/mountctl/mountctl.c
473
mountctl_add(const char *keyword, const char *mountpt, int fd)
sbin/mountctl/mountctl.c
486
fstat(fd, &st1) == 0 && S_ISREG(st1.st_mode) &&
sbin/mountctl/mountctl.c
508
error = mountctl(mountpt, MOUNTCTL_INSTALL_VFS_JOURNAL, fd,
sbin/mountctl/mountctl.c
520
int fd, void __unused *info)
sbin/mountctl/mountctl.c
535
error = mountctl(mountpt, MOUNTCTL_RESTART_VFS_JOURNAL, fd,
sbin/mountctl/mountctl.c
546
int __unused fd, void __unused *info)
sbin/mountctl/mountctl.c
564
int fd __unused, void *info __unused)
sbin/mountctl/mountctl.c
61
const char *keyword, const char *mountpt, int fd);
sbin/mountctl/mountctl.c
63
int __unused fd, void *info);
sbin/mountctl/mountctl.c
64
static void mountctl_add(const char *keyword, const char *mountpt, int fd);
sbin/mountctl/mountctl.c
66
int fd, void __unused *);
sbin/mountctl/mountctl.c
68
int __unused fd, void __unused *);
sbin/mountctl/mountctl.c
69
static void mountctl_modify(const char *keyword, const char *mountpt, int fd, void __unused *);
sbin/mountctl/mountctl.c
90
int fd;
sbin/mountd/mountd.c
474
int fd;
sbin/mountd/mountd.c
511
if ((fd = __rpc_nconf2fd(nconf)) < 0) {
sbin/mountd/mountd.c
533
close(fd);
sbin/mountd/mountd.c
548
close(fd);
sbin/mountd/mountd.c
558
if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &one,
sbin/mountd/mountd.c
633
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
sbin/mountd/mountd.c
637
r = bindresvport_sa(fd, res->ai_addr);
sbin/mountd/mountd.c
665
listen(fd, SOMAXCONN);
sbin/mountd/mountd.c
668
transp = svc_dg_create(fd, 0, 0);
sbin/mountd/mountd.c
670
transp = svc_vc_create(fd, RPC_MAXDATASIZE,
sbin/natacontrol/natacontrol.c
276
ata_cap_print(int fd)
sbin/natacontrol/natacontrol.c
280
if (ioctl(fd, IOCATAGPARM, ¶ms) < 0)
sbin/natacontrol/natacontrol.c
286
info_print(int fd, int channel, int prchan)
sbin/natacontrol/natacontrol.c
292
if (ioctl(fd, IOCATADEVICES, &devices) < 0) {
sbin/natacontrol/natacontrol.c
316
ata_spindown(int fd, const char *dev, const char *arg)
sbin/natacontrol/natacontrol.c
322
if (ioctl(fd, IOCATASSPINDOWN, &tmo) < 0)
sbin/natacontrol/natacontrol.c
325
if (ioctl(fd, IOCATAGSPINDOWN, &tmo) < 0)
sbin/natacontrol/natacontrol.c
338
int disk, fd;
sbin/natacontrol/natacontrol.c
349
if ((fd = open(device, mode)) < 0)
sbin/natacontrol/natacontrol.c
351
return (fd);
sbin/natacontrol/natacontrol.c
381
int fd, mode, channel, array;
sbin/natacontrol/natacontrol.c
387
fd = open_dev(argv[2], O_RDONLY);
sbin/natacontrol/natacontrol.c
392
if (ioctl(fd, IOCATASMODE, &mode) < 0)
sbin/natacontrol/natacontrol.c
396
if (ioctl(fd, IOCATAGMODE, &mode) < 0)
sbin/natacontrol/natacontrol.c
406
fd = open_dev(argv[2], O_RDONLY);
sbin/natacontrol/natacontrol.c
454
if (ioctl(fd, IOCATAREQUEST, &request) < 0)
sbin/natacontrol/natacontrol.c
466
fd = open_dev(argv[2], O_RDONLY);
sbin/natacontrol/natacontrol.c
467
ata_cap_print(fd);
sbin/natacontrol/natacontrol.c
472
fd = open_dev(argv[2], O_RDONLY);
sbin/natacontrol/natacontrol.c
473
ata_spindown(fd, argv[2], argv[3]);
sbin/natacontrol/natacontrol.c
477
if ((fd = open("/dev/ata", O_RDWR)) < 0)
sbin/natacontrol/natacontrol.c
483
if (ioctl(fd, IOCATAGMAXCHANNEL, &maxchannel) < 0)
sbin/natacontrol/natacontrol.c
486
info_print(fd, channel, 1);
sbin/natacontrol/natacontrol.c
491
info_print(fd, channel, 0);
sbin/natacontrol/natacontrol.c
496
if (ioctl(fd, IOCATADETACH, &channel) < 0)
sbin/natacontrol/natacontrol.c
502
if (ioctl(fd, IOCATAATTACH, &channel) < 0)
sbin/natacontrol/natacontrol.c
504
info_print(fd, channel, 0);
sbin/natacontrol/natacontrol.c
509
if (ioctl(fd, IOCATAREINIT, &channel) < 0)
sbin/natacontrol/natacontrol.c
511
info_print(fd, channel, 0);
sbin/natacontrol/natacontrol.c
579
if (ioctl(fd, IOCATARAIDCREATE, &config) < 0)
sbin/natacontrol/natacontrol.c
587
if (ioctl(fd, IOCATARAIDDELETE, &array) < 0)
sbin/natacontrol/natacontrol.c
600
if (ioctl(fd, IOCATARAIDADDSPARE, &config) < 0)
sbin/natacontrol/natacontrol.c
606
if (ioctl(fd, IOCATARAIDREBUILD, &array) < 0)
sbin/natacontrol/natacontrol.c
641
if (ioctl(fd, IOCATARAIDSTATUS, &status) < 0)
sbin/natd/natd.c
440
DoAliasing(int fd, int direction)
sbin/natd/natd.c
460
origBytes = recvfrom(fd,
sbin/natd/natd.c
558
wrote = sendto(fd,
sbin/natd/natd.c
580
HandleRoutingInfo(int fd)
sbin/natd/natd.c
587
bytes = read(fd, &ifMsg, sizeof ifMsg);
sbin/newfs/fscopy.c
245
int fd;
sbin/newfs/fscopy.c
260
fd = open(".", O_RDONLY);
sbin/newfs/fscopy.c
261
if (fd < 0) {
sbin/newfs/fscopy.c
267
close(fd);
sbin/newfs/fscopy.c
277
if (fchdir(fd) < 0) {
sbin/newfs/fscopy.c
279
close(fd);
sbin/newfs/fscopy.c
282
close(fd);
sbin/newfs/fscopy.c
302
if ((fd = open(path, O_RDWR|O_CREAT|O_TRUNC, 0600)) < 0) {
sbin/newfs/fscopy.c
307
if (write(fd, node->fs_Data, node->fs_Bytes) != node->fs_Bytes) {
sbin/newfs/fscopy.c
310
close(fd);
sbin/newfs/fscopy.c
314
close(fd);
sbin/newfs/mkfs.c
154
int status, fd;
sbin/newfs/mkfs.c
201
fd = open(filename, O_RDWR|O_TRUNC|O_CREAT, 0644);
sbin/newfs/mkfs.c
202
if(fd < 0)
sbin/newfs/mkfs.c
208
w = write(fd, buf, l1);
sbin/newfs/mkfs.c
214
MAP_SHARED, fd, 0);
sbin/newfs/mkfs.c
217
close(fd);
sbin/newfs_hammer/newfs_hammer.c
535
if (ioctl(volume->fd, DAIOCTRIM, ioarg) == -1) {
sbin/newfs_hammer2/mkfs_hammer2.c
277
n = pwrite(vol->fd, buf, HAMMER2_PBUFSIZE, tmp_base);
sbin/newfs_hammer2/mkfs_hammer2.c
300
n = pwrite(vol->fd, buf, HAMMER2_PBUFSIZE, tmp_base);
sbin/newfs_hammer2/mkfs_hammer2.c
486
n = pwrite(vol->fd, buf, HAMMER2_PBUFSIZE,
sbin/newfs_hammer2/mkfs_hammer2.c
529
n = pwrite(vol->fd, buf, HAMMER2_PBUFSIZE,
sbin/newfs_hammer2/mkfs_hammer2.c
621
n = pwrite(vol->fd, buf, HAMMER2_PBUFSIZE,
sbin/newfs_hammer2/mkfs_hammer2.c
628
fsync(vol->fd);
sbin/newfs_hammer2/mkfs_hammer2.c
714
int fd = open(av[i], O_RDWR);
sbin/newfs_hammer2/mkfs_hammer2.c
715
if (fd < 0)
sbin/newfs_hammer2/mkfs_hammer2.c
717
size = check_volume(fd);
sbin/newfs_hammer2/mkfs_hammer2.c
742
hammer2_install_volume(vol, fd, i, av[i], fso.total_size, size);
sbin/newfs_msdos/mkfs_msdos.c
251
int fd, fd1, rv;
sbin/newfs_msdos/mkfs_msdos.c
257
fd = fd1 = -1;
sbin/newfs_msdos/mkfs_msdos.c
272
fd = open(fname, O_RDWR | O_CREAT | O_TRUNC, 0644);
sbin/newfs_msdos/mkfs_msdos.c
273
if (fd == -1) {
sbin/newfs_msdos/mkfs_msdos.c
277
if (ftruncate(fd, o.create_size)) {
sbin/newfs_msdos/mkfs_msdos.c
281
} else if ((fd = open(fname, o.no_create ? O_RDONLY : O_RDWR)) == -1) {
sbin/newfs_msdos/mkfs_msdos.c
285
if (fstat(fd, &sb)) {
sbin/newfs_msdos/mkfs_msdos.c
305
if (o.offset && o.offset != lseek(fd, o.offset, SEEK_SET)) {
sbin/newfs_msdos/mkfs_msdos.c
330
if (getdiskinfo(fd, fname, dtype, o.hidden_sectors_set, &bpb) == -1)
sbin/newfs_msdos/mkfs_msdos.c
760
n = write(fd, physbuf, chunksize);
sbin/newfs_msdos/mkfs_msdos.c
775
n = write(fd, physbuf, tailsize);
sbin/newfs_msdos/mkfs_msdos.c
785
if (fd != -1)
sbin/newfs_msdos/mkfs_msdos.c
786
close(fd);
sbin/newfs_msdos/mkfs_msdos.c
892
compute_geometry_from_file(int fd, const char *fname, struct disklabel32 *lp)
sbin/newfs_msdos/mkfs_msdos.c
897
if (fstat(fd, &st))
sbin/newfs_msdos/mkfs_msdos.c
912
getdiskinfo(int fd, const char *fname, const char *dtype, __unused int oflag,
sbin/newfs_msdos/mkfs_msdos.c
931
if (ioctl(fd, DIOCGPART, &pi) == -1) {
sbin/newfs_msdos/mkfs_msdos.c
933
compute_geometry_from_file(fd, fname, &dlp);
sbin/newfs_msdos/mkfs_msdos.c
935
} else if (ioctl(fd, FD_GTYPE, &type) != -1) {
sbin/newfs_msdos/mkfs_msdos.c
949
if (ioctl(fd, DIOCGPART, &pi) == - 1)
sbin/newfs_msdos/mkfs_msdos.c
965
compute_geometry_from_file(fd, fname, &dlp);
sbin/nvmectl/nvmectl.c
102
int fd;
sbin/nvmectl/nvmectl.c
108
fd = open(path, O_RDWR);
sbin/nvmectl/nvmectl.c
109
if (fd < 0) {
sbin/nvmectl/nvmectl.c
114
rc += cmd(nvmei, av, path + 5, fd);
sbin/nvmectl/nvmectl.c
115
close(fd);
sbin/nvmectl/nvmectl.c
145
cmd_info(int ac __unused, char **av __unused, const char *id, int fd)
sbin/nvmectl/nvmectl.c
156
if (ioctl(fd, NVMEIOCGETLOG, &ioc) < 0) {
sbin/nvmectl/nvmectl.c
243
cmd_errors(int ac __unused, char **av __unused, const char *id, int fd)
sbin/nvmectl/nvmectl.c
253
if (ioctl(fd, NVMEIOCGETLOG, &ioc) < 0) {
sbin/nvmectl/nvmectl.c
37
typedef int (*cmd_t)(int ac, char **av, const char *id, int fd);
sbin/nvmectl/nvmectl.c
40
static int cmd_info(int ac, char **av, const char *id, int fd);
sbin/nvmectl/nvmectl.c
41
static int cmd_errors(int ac, char **av, const char *id, int fd);
sbin/nvmectl/nvmectl.c
84
int fd;
sbin/nvmectl/nvmectl.c
89
fd = open(path, O_RDWR);
sbin/nvmectl/nvmectl.c
91
if (fd < 0)
sbin/nvmectl/nvmectl.c
93
rc += cmd(nvmei, av, path + 5, fd);
sbin/nvmectl/nvmectl.c
94
close(fd);
sbin/ping6/ping6.c
946
fdmaskp[0].fd = s;
sbin/rconfig/server.c
100
if (fd < 0) {
sbin/rconfig/server.c
108
server_connection(fd);
sbin/rconfig/server.c
111
close(fd);
sbin/rconfig/server.c
142
server_connection(int fd)
sbin/rconfig/server.c
151
fi = fdopen(fd, "r");
sbin/rconfig/server.c
152
fo = fdopen(dup(fd), "w");
sbin/rconfig/server.c
239
service_packet_loop(int fd)
sbin/rconfig/server.c
252
n = recvfrom(fd, ibuf, sizeof(ibuf) - 1, 0, (void *)&sain, &sain_len);
sbin/rconfig/server.c
278
sendto(fd, obuf, n, 0, (void *)&sain, sain_len);
sbin/rconfig/server.c
39
static void server_connection(int fd);
sbin/rconfig/server.c
40
static void service_packet_loop(int fd);
sbin/rconfig/server.c
57
int fd;
sbin/rconfig/server.c
99
fd = accept(lfd, (void *)&sain, &slen);
sbin/rconfig/subs.c
103
if ((fd = socket(AF_INET, SOCK_DGRAM, PF_UNSPEC)) < 0) {
sbin/rconfig/subs.c
108
setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
sbin/rconfig/subs.c
109
if (bind(fd, (void *)&lsin, sizeof(lsin)) < 0) {
sbin/rconfig/subs.c
112
close(fd);
sbin/rconfig/subs.c
115
*pfd = fd;
sbin/rconfig/subs.c
121
if (sendto(fd, buf, strlen(buf), 0, (void *)sain, sizeof(*sain)) >= 0) {
sbin/rconfig/subs.c
130
n = recvfrom(fd, buf, sizeof(buf) - 1, 0, (void *)rsin, &rsin_len);
sbin/rconfig/subs.c
168
int fd;
sbin/rconfig/subs.c
170
if ((fd = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) < 0) {
sbin/rconfig/subs.c
175
if (connect(fd, (void *)sain, sizeof(*sain)) < 0) {
sbin/rconfig/subs.c
178
close(fd);
sbin/rconfig/subs.c
181
*pfi = fdopen(fd, "r");
sbin/rconfig/subs.c
182
*pfo = fdopen(dup(fd), "w");
sbin/rconfig/subs.c
83
int fd;
sbin/rconfig/subs.c
97
if ((fd = *pfd) < 0) {
sbin/restore/dirs.c
138
int fd;
sbin/restore/dirs.c
147
fd = mkstemp(dirfile);
sbin/restore/dirs.c
149
fd = open(dirfile, O_RDWR|O_CREAT|O_EXCL, 0666);
sbin/restore/dirs.c
150
if (fd == -1 || (df = fdopen(fd, "w")) == NULL) {
sbin/restore/dirs.c
151
if (fd != -1)
sbin/restore/dirs.c
152
close(fd);
sbin/restore/dirs.c
160
fd = mkstemp(modefile);
sbin/restore/dirs.c
162
fd = open(modefile, O_RDWR|O_CREAT|O_EXCL, 0666);
sbin/restore/dirs.c
163
if (fd == -1 || (mfg = fdopen(fd, "w")) == NULL) {
sbin/restore/dirs.c
164
if (fd != -1)
sbin/restore/dirs.c
165
close(fd);
sbin/restore/dirs.c
552
int fd;
sbin/restore/dirs.c
554
if ((fd = open(name, O_RDONLY)) == -1)
sbin/restore/dirs.c
557
close(fd);
sbin/restore/dirs.c
560
dirpl->dd_fd = fd;
sbin/restore/symtab.c
438
FILE *fd;
sbin/restore/symtab.c
444
if ((fd = fopen(filename, "w")) == NULL) {
sbin/restore/symtab.c
450
clearerr(fd);
sbin/restore/symtab.c
459
(int)allocsize(ep->e_namlen), fd);
sbin/restore/symtab.c
485
fwrite((char *)tep, sizeof(struct entry), 1, fd);
sbin/restore/symtab.c
496
fwrite((char *)&tentry, sizeof(struct entry *), 1, fd);
sbin/restore/symtab.c
505
fwrite((char *)&hdr, sizeof(struct symtableheader), 1, fd);
sbin/restore/symtab.c
506
if (ferror(fd)) {
sbin/restore/symtab.c
511
fclose(fd);
sbin/restore/symtab.c
527
int fd;
sbin/restore/symtab.c
540
if ((fd = open(filename, O_RDONLY, 0)) < 0) {
sbin/restore/symtab.c
544
if (fstat(fd, &stbuf) < 0) {
sbin/restore/symtab.c
552
if (read(fd, base, (int)tblsize) < 0 ||
sbin/restore/symtab.c
553
read(fd, (char *)&hdr, sizeof(struct symtableheader)) < 0) {
sbin/routed/trace.c
180
int fd;
sbin/routed/trace.c
190
fd = open(_PATH_DEVNULL, O_RDWR);
sbin/routed/trace.c
192
dup2(fd, STDIN_FILENO);
sbin/routed/trace.c
194
dup2(fd, STDOUT_FILENO);
sbin/routed/trace.c
196
dup2(fd, STDERR_FILENO);
sbin/routed/trace.c
197
close(fd);
sbin/savecore/savecore.c
232
int fd, fdinfo, fdkernin, error, wl;
sbin/savecore/savecore.c
253
fd = open(device, O_RDWR);
sbin/savecore/savecore.c
254
if (fd < 0) {
sbin/savecore/savecore.c
260
error = ioctl(fd, DIOCGPART, &dpart);
sbin/savecore/savecore.c
275
lseek(fd, lasthd, SEEK_SET);
sbin/savecore/savecore.c
276
error = read(fd, &kdhl, sizeof kdhl);
sbin/savecore/savecore.c
327
lseek(fd, firsthd, SEEK_SET);
sbin/savecore/savecore.c
328
error = read(fd, &kdhf, sizeof kdhf);
sbin/savecore/savecore.c
359
close(fd);
sbin/savecore/savecore.c
467
nr = read(fd, buf, wl);
sbin/savecore/savecore.c
551
lseek(fd, lasthd, SEEK_SET);
sbin/savecore/savecore.c
552
error = write(fd, &kdhl, sizeof kdhl);
sbin/savecore/savecore.c
557
close(fd);
sbin/savecore/savecore.c
564
close(fd);
sbin/slattach/slattach.c
210
if (ioctl(fd, TIOCMGET, &comstate) < 0)
sbin/slattach/slattach.c
237
if (fd >= 0 && ioctl(fd, TIOCSETD, &ttydisc) < 0) {
sbin/slattach/slattach.c
245
if (fd > 2)
sbin/slattach/slattach.c
246
close(fd);
sbin/slattach/slattach.c
278
if ((fd = open(dev, O_RDWR | O_NONBLOCK, 0)) < 0) {
sbin/slattach/slattach.c
283
if ((oflags = fcntl(fd, F_GETFL)) == -1) {
sbin/slattach/slattach.c
287
if (fcntl(fd, F_SETFL, oflags & ~O_NONBLOCK) == -1) {
sbin/slattach/slattach.c
291
dup2(fd, STDIN_FILENO);
sbin/slattach/slattach.c
292
dup2(fd, STDOUT_FILENO);
sbin/slattach/slattach.c
293
dup2(fd, STDERR_FILENO);
sbin/slattach/slattach.c
294
if (fd > 2)
sbin/slattach/slattach.c
295
close (fd);
sbin/slattach/slattach.c
296
fd = STDIN_FILENO;
sbin/slattach/slattach.c
299
if (ioctl(fd, TIOCSCTTY, 0) < 0) {
sbin/slattach/slattach.c
305
if (tcsetpgrp(fd, getpid()) < 0)
sbin/slattach/slattach.c
319
if (tcsetattr(fd, TCSAFLUSH, &tty) < 0) {
sbin/slattach/slattach.c
324
if (ioctl(fd, TIOCSDTR) < 0) {
sbin/slattach/slattach.c
339
if (ioctl(fd, TIOCSETD, &slipdisc) < 0) {
sbin/slattach/slattach.c
344
if (sl_unit >= 0 && ioctl(fd, SLIOCSUNIT, &sl_unit) < 0) {
sbin/slattach/slattach.c
350
if (ioctl(fd, SLIOCGUNIT, (caddr_t)&tmp_unit) < 0) {
sbin/slattach/slattach.c
362
if (ioctl(fd, SLIOCSKEEPAL, &keepal) < 0) {
sbin/slattach/slattach.c
367
if (outfill > 0 && ioctl(fd, SLIOCSOUTFILL, &outfill) < 0) {
sbin/slattach/slattach.c
404
if (ioctl(fd, SLIOCGUNIT, (caddr_t)&new_unit) < 0) {
sbin/slattach/slattach.c
474
if (tcsetattr(fd, TCSAFLUSH, &tty) < 0) {
sbin/slattach/slattach.c
478
ioctl(fd, TIOCMGET, &comstate);
sbin/slattach/slattach.c
501
ioctl(fd, TIOCMGET, &comstate);
sbin/slattach/slattach.c
531
if (ioctl(fd, TIOCSETD, &ttydisc) < 0) {
sbin/slattach/slattach.c
536
if (tcsetattr(fd, TCSANOW, &tty) < 0) {
sbin/slattach/slattach.c
565
if (fd != -1)
sbin/slattach/slattach.c
566
close(fd);
sbin/slattach/slattach.c
69
int fd = -1;
sbin/startslip/startslip.c
232
fd = -1;
sbin/startslip/startslip.c
234
} else if (fd >= 0) {
sbin/startslip/startslip.c
236
close(fd);
sbin/startslip/startslip.c
241
fd = -1;
sbin/startslip/startslip.c
293
if ((fd = open(devicename, O_RDWR | O_NONBLOCK)) < 0) {
sbin/startslip/startslip.c
304
printd(" %d", fd);
sbin/startslip/startslip.c
306
if (ioctl(fd, TIOCSCTTY, 0) < 0) {
sbin/startslip/startslip.c
310
if (tcsetpgrp(fd, getpid()) < 0) {
sbin/startslip/startslip.c
315
if (tcgetattr(fd, &t) < 0) {
sbin/startslip/startslip.c
335
if (tcsetattr(fd, TCSAFLUSH, &t) < 0) {
sbin/startslip/startslip.c
343
wfd = fdopen(fd, "w+");
sbin/startslip/startslip.c
369
if (tcsetattr(fd, TCSANOW, &t) < 0) {
sbin/startslip/startslip.c
381
if (get_line(buf, BUFSIZ, fd, fintimeout) == 0 || hup || terminate)
sbin/startslip/startslip.c
422
if (ioctl(fd, TIOCSETD, &disc) < 0) {
sbin/startslip/startslip.c
427
if (sl_unit >= 0 && ioctl(fd, SLIOCSUNIT, &sl_unit) < 0) {
sbin/startslip/startslip.c
431
if (ioctl(fd, SLIOCGUNIT, &unitnum) < 0) {
sbin/startslip/startslip.c
439
if (ioctl(fd, SLIOCSKEEPAL, &keepal) < 0) {
sbin/startslip/startslip.c
444
if (outfill > 0 && ioctl(fd, SLIOCSOUTFILL, &outfill) < 0) {
sbin/startslip/startslip.c
513
FD_SET(fd, &readfds);
sbin/startslip/startslip.c
556
if (ioctl(fd, TIOCMGET, &comstate) < 0) {
sbin/startslip/startslip.c
567
if (fd > -1)
sbin/startslip/startslip.c
568
close(fd);
sbin/startslip/startslip.c
76
int fd = -1;
sbin/svc/execute.c
703
int fd;
sbin/svc/execute.c
731
fd = open(logfile, O_WRONLY|O_CREAT|O_APPEND, 0640);
sbin/svc/execute.c
732
if (fd >= 0) {
sbin/svc/execute.c
733
InitCmd->logfd = fd;
sbin/svc/remote.c
101
if ((conn->fd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0) {
sbin/svc/remote.c
108
if (connect(conn->fd, (void *)&sou, len) < 0) {
sbin/svc/remote.c
109
close(conn->fd);
sbin/svc/remote.c
110
conn->fd = -1;
sbin/svc/remote.c
113
if (conn->fd >= 0) {
sbin/svc/remote.c
117
conn->fpr = fdopen(conn->fd, "r");
sbin/svc/remote.c
118
conn->fpw = fdopen(dup(conn->fd), "w");
sbin/svc/remote.c
119
conn->fd = -1;
sbin/svc/remote.c
189
if (scan->fd >= 0) {
sbin/svc/remote.c
190
close(scan->fd);
sbin/svc/remote.c
191
scan->fd = -1;
sbin/svc/remote.c
218
conn->fd = lfd;
sbin/svc/remote.c
239
conn->fd = accept(lconn->fd, (void *)&sou, &len);
sbin/svc/remote.c
241
if (conn->fd < 0) {
sbin/svc/remote.c
266
conn->fpr = fdopen(conn->fd, "r");
sbin/svc/remote.c
267
conn->fpw = fdopen(dup(conn->fd), "w");
sbin/svc/remote.c
268
conn->fd = -1;
sbin/svc/remote.c
46
int fd;
sbin/svc/remote.c
74
conn->fd = -1;
sbin/swapon/swapon.c
293
int fd,i,n;
sbin/swapon/swapon.c
332
fd = open(name, O_RDWR);
sbin/swapon/swapon.c
333
if (fd < 0)
sbin/swapon/swapon.c
335
if (ioctl(fd, DIOCGPART, &pinfo) < 0) {
sbin/swapon/swapon.c
346
if (ioctl(fd, DAIOCTRIM, ioarg) < 0) {
sbin/swapon/swapon.c
349
close(fd);
sbin/udevd/udevd.c
161
udev_read_event(int fd)
sbin/udevd/udevd.c
177
if ((n = read(fd, xml, sz)) <= 0) {
sbin/udevd/udevd.c
330
close(fds[UDEV_SOCKET_FD_IDX].fd);
sbin/udevd/udevd.c
336
fds[UDEV_SOCKET_FD_IDX].fd = s;
sbin/udevd/udevd.c
430
fds[UDEV_DEVICE_FD_IDX].fd = udevfd;
sbin/udevd/udevd.c
432
fds[UDEV_SOCKET_FD_IDX].fd = s;
sbin/udevd/udevd.h
68
int fd;
sbin/udevd/udevd_client.c
112
n = read_xml(cli->fd, &xml);
sbin/udevd/udevd_client.c
137
syslog(LOG_DEBUG, "Received command: %s (from fd = %d)\n", prop_string_cstring_nocopy(ps), cli->fd);
sbin/udevd/udevd_client.c
156
close(cli->fd);
sbin/udevd/udevd_client.c
157
cli->fd = -1;
sbin/udevd/udevd_client.c
226
r = send_xml(cli->fd, xml);
sbin/udevd/udevd_client.c
75
int fd;
sbin/udevd/udevd_client.c
78
fd = accept(s, (struct sockaddr *)&addr, &saddr_len);
sbin/udevd/udevd_client.c
79
if (fd < 0) {
sbin/udevd/udevd_client.c
84
block_descriptor(fd);
sbin/udevd/udevd_client.c
88
cli_info->fd = fd;
sbin/udevd/udevd_monitor.c
186
fds[0].fd = cli->fd;
sbin/udevd/udevd_monitor.c
205
ret = recv(fds[0].fd, &dummy, sizeof(dummy), MSG_DONTWAIT);
sbin/udevd/udevd_monitor.c
224
r = send_xml(cli->fd, xml);
sbin/udevd/udevd_monitor.c
234
close(cli->fd);
sbin/umount/umount.c
503
int fd;
sbin/umount/umount.c
518
fd = open(device, O_RDONLY);
sbin/umount/umount.c
519
if (fd < 0) {
sbin/umount/umount.c
525
if (ioctl(fd, VNIOCDETACH, &vnio) < 0) {
sbin/umount/umount.c
527
close(fd);
sbin/umount/umount.c
531
close(fd);
sbin/vinum/list.c
1372
int fd;
sbin/vinum/list.c
1378
fd = open(devicename, O_RDONLY);
sbin/vinum/list.c
1379
if (fd >= 0) {
sbin/vinum/list.c
1380
if (lseek(fd, VINUM_LABEL_OFFSET, SEEK_SET) < 0) {
sbin/vinum/list.c
1386
close(fd);
sbin/vinum/list.c
1389
if (read(fd, vinumlabel, DEV_BSIZE) != DEV_BSIZE) {
sbin/vinum/list.c
1396
close(fd);
sbin/vinum/list.c
1420
if (read(fd, config_text, MAXCONFIG) != MAXCONFIG)
sbin/vinum/list.c
1431
close(fd);
share/examples/ses/srcs/chpmon.c
105
(void) close(fd);
share/examples/ses/srcs/chpmon.c
120
if (ioctl(fd, SESIOC_SETENCSTAT, (caddr_t) &stat) < 0) {
share/examples/ses/srcs/chpmon.c
124
(void) close(fd);
share/examples/ses/srcs/chpmon.c
55
int fd, delay, dev;
share/examples/ses/srcs/chpmon.c
73
fd = open(v[dev], O_RDWR);
share/examples/ses/srcs/chpmon.c
74
if (fd < 0) {
share/examples/ses/srcs/chpmon.c
83
if (ioctl(fd, SESIOC_SETENCSTAT, (caddr_t) &stat) < 0) {
share/examples/ses/srcs/chpmon.c
86
(void) close(fd);
share/examples/ses/srcs/chpmon.c
92
if (ioctl(fd, SESIOC_GETENCSTAT, (caddr_t) &stat) < 0) {
share/examples/ses/srcs/chpmon.c
95
(void) close(fd);
share/examples/ses/srcs/getencstat.c
122
(void) close(fd);
share/examples/ses/srcs/getencstat.c
125
if (ioctl(fd, SESIOC_GETOBJMAP, (caddr_t) objp) < 0) {
share/examples/ses/srcs/getencstat.c
127
(void) close(fd);
share/examples/ses/srcs/getencstat.c
132
if (ioctl(fd, SESIOC_GETOBJSTAT, (caddr_t) &ob) < 0) {
share/examples/ses/srcs/getencstat.c
134
(void) close(fd);
share/examples/ses/srcs/getencstat.c
153
(void) close(fd);
share/examples/ses/srcs/getencstat.c
53
int fd, nobj, f, i, verbose, quiet, errors;
share/examples/ses/srcs/getencstat.c
74
fd = open(*v, O_RDONLY);
share/examples/ses/srcs/getencstat.c
75
if (fd < 0) {
share/examples/ses/srcs/getencstat.c
79
if (ioctl(fd, SESIOC_GETNOBJ, (caddr_t) &nobj) < 0) {
share/examples/ses/srcs/getencstat.c
81
(void) close(fd);
share/examples/ses/srcs/getencstat.c
84
if (ioctl(fd, SESIOC_GETENCSTAT, (caddr_t) &estat) < 0) {
share/examples/ses/srcs/getencstat.c
86
(void) close(fd);
share/examples/ses/srcs/getencstat.c
92
(void) close(fd);
share/examples/ses/srcs/getnobj.c
50
int fd;
share/examples/ses/srcs/getnobj.c
54
fd = open(name, O_RDONLY);
share/examples/ses/srcs/getnobj.c
55
if (fd < 0) {
share/examples/ses/srcs/getnobj.c
59
if (ioctl(fd, SESIOC_GETNOBJ, (caddr_t) &nobj) < 0) {
share/examples/ses/srcs/getnobj.c
64
close (fd);
share/examples/ses/srcs/getobjmap.c
51
int nobj, fd, i;
share/examples/ses/srcs/getobjmap.c
54
fd = open(*v, O_RDONLY);
share/examples/ses/srcs/getobjmap.c
55
if (fd < 0) {
share/examples/ses/srcs/getobjmap.c
59
if (ioctl(fd, SESIOC_GETNOBJ, (caddr_t) &nobj) < 0) {
share/examples/ses/srcs/getobjmap.c
61
(void) close(fd);
share/examples/ses/srcs/getobjmap.c
66
(void) close(fd);
share/examples/ses/srcs/getobjmap.c
72
(void) close(fd);
share/examples/ses/srcs/getobjmap.c
75
if (ioctl(fd, SESIOC_GETOBJMAP, (caddr_t) objp) < 0) {
share/examples/ses/srcs/getobjmap.c
77
(void) close(fd);
share/examples/ses/srcs/getobjmap.c
85
(void) close(fd);
share/examples/ses/srcs/getobjstat.c
47
int fd;
share/examples/ses/srcs/getobjstat.c
58
fd = open(v[1], O_RDONLY);
share/examples/ses/srcs/getobjstat.c
59
if (fd < 0) {
share/examples/ses/srcs/getobjstat.c
69
if (ioctl(fd, SESIOC_GETOBJSTAT, (caddr_t) &obj) < 0) {
share/examples/ses/srcs/getobjstat.c
75
(void) close(fd);
share/examples/ses/srcs/inienc.c
48
int fd;
share/examples/ses/srcs/inienc.c
51
fd = open(*v, O_RDWR);
share/examples/ses/srcs/inienc.c
52
if (fd < 0) {
share/examples/ses/srcs/inienc.c
56
if (ioctl(fd, SESIOC_INIT, NULL) < 0) {
share/examples/ses/srcs/inienc.c
59
(void) close(fd);
share/examples/ses/srcs/sesd.c
100
if (ioctl(fd, SESIOC_INIT, NULL) < 0) {
share/examples/ses/srcs/sesd.c
105
(void) close(fd);
share/examples/ses/srcs/sesd.c
120
fd = open(v[dev], O_RDWR);
share/examples/ses/srcs/sesd.c
121
if (fd < 0) {
share/examples/ses/srcs/sesd.c
129
if (ioctl(fd, SESIOC_GETENCSTAT, (caddr_t) &stat) < 0) {
share/examples/ses/srcs/sesd.c
132
(void) close(fd);
share/examples/ses/srcs/sesd.c
135
(void) close(fd);
share/examples/ses/srcs/sesd.c
59
int fd, polltime, dev, devbase, nodaemon, bpri;
share/examples/ses/srcs/sesd.c
95
fd = open(v[dev], O_RDWR);
share/examples/ses/srcs/sesd.c
96
if (fd < 0) {
share/examples/ses/srcs/setencstat.c
48
int fd;
share/examples/ses/srcs/setencstat.c
56
fd = open(v[1], O_RDWR);
share/examples/ses/srcs/setencstat.c
57
if (fd < 0) {
share/examples/ses/srcs/setencstat.c
64
if (ioctl(fd, SESIOC_SETENCSTAT, (caddr_t) &stat) < 0) {
share/examples/ses/srcs/setencstat.c
67
(void) close(fd);
share/examples/ses/srcs/setobjstat.c
48
int fd;
share/examples/ses/srcs/setobjstat.c
60
fd = open(v[1], O_RDWR);
share/examples/ses/srcs/setobjstat.c
61
if (fd < 0) {
share/examples/ses/srcs/setobjstat.c
79
if (ioctl(fd, SESIOC_SETOBJSTAT, (caddr_t) &obj) < 0) {
share/examples/ses/srcs/setobjstat.c
82
(void) close(fd);
share/syscons/scrnmaps/mkscrfil.c
38
FILE *fd;
share/syscons/scrnmaps/mkscrfil.c
41
if ((fd = fopen(argv[1], "w")) == NULL) {
share/syscons/scrnmaps/mkscrfil.c
45
fwrite(&scrmap, sizeof(scrmap_t), 1, fd);
share/syscons/scrnmaps/mkscrfil.c
46
fclose(fd);
stand/boot/common/boot.c
315
int fd, error;
stand/boot/common/boot.c
321
if ((fd = open(lbuf, O_RDONLY)) < 0)
stand/boot/common/boot.c
326
while (fgetstr(lbuf, sizeof(lbuf), fd) >= 0) {
stand/boot/common/boot.c
366
close(fd);
stand/boot/common/bootstrap.h
311
ssize_t (*arch_readin)(const int fd, vm_offset_t dest,
stand/boot/common/bootstrap.h
91
int kern_pread(int fd, vm_offset_t dest, size_t len, off_t off);
stand/boot/common/bootstrap.h
92
void *alloc_pread(int fd, off_t off, size_t len);
stand/boot/common/commands.c
446
int fd;
stand/boot/common/commands.c
449
if ((fd = rel_open(filename, &fullpath, O_RDONLY)) != -1) {
stand/boot/common/commands.c
450
close(fd);
stand/boot/common/commands.c
63
help_getnext(int fd, char **topic, char **subtopic, char **desc)
stand/boot/common/commands.c
68
if (fgetstr(line, 80, fd) < 0)
stand/boot/common/do_dloader.c
228
int fd, flags, line;
stand/boot/common/do_dloader.c
230
if (((fd = rel_open(filename, NULL, O_RDONLY)) == -1)) {
stand/boot/common/do_dloader.c
243
while (fgets(input, sizeof(input), fd) != NULL) {
stand/boot/common/do_dloader.c
251
skipeol(fd);
stand/boot/common/do_dloader.c
282
close(fd);
stand/boot/common/do_dloader.c
365
skipeol(int fd)
stand/boot/common/do_dloader.c
369
while (read(fd, &c, 1) == 1) {
stand/boot/common/do_dloader.c
40
static void skipeol(int fd);
stand/boot/common/load_elf.c
109
if ((ef.fd = rel_open(filename, NULL, O_RDONLY)) == -1)
stand/boot/common/load_elf.c
113
close(ef.fd);
stand/boot/common/load_elf.c
116
bytes_read = read(ef.fd, ef.firstpage, PAGE_SIZE);
stand/boot/common/load_elf.c
250
close(ef.fd);
stand/boot/common/load_elf.c
332
if (kern_pread(ef->fd, phdr[i].p_vaddr + off + fpcopy,
stand/boot/common/load_elf.c
369
shdr = alloc_pread(ef->fd, ehdr->e_shoff, chunk);
stand/boot/common/load_elf.c
435
if (lseek(ef->fd, (off_t)shdr[i].sh_offset, SEEK_SET) == -1) {
stand/boot/common/load_elf.c
441
result = archsw.arch_readin(ef->fd, lastaddr, shdr[i].sh_size);
stand/boot/common/load_elf.c
66
int fd;
stand/boot/common/load_elf_obj.c
103
bytes_read = read(ef.fd, hdr, sizeof(*hdr));
stand/boot/common/load_elf_obj.c
177
close(ef.fd);
stand/boot/common/load_elf_obj.c
203
shdr = alloc_pread(ef->fd, (off_t)hdr->e_shoff, shdrbytes);
stand/boot/common/load_elf_obj.c
289
if (kern_pread(ef->fd, (vm_offset_t)shdr[i].sh_addr,
stand/boot/common/load_elf_obj.c
59
int fd;
stand/boot/common/load_elf_obj.c
99
if ((ef.fd = rel_open(filename, NULL, O_RDONLY)) == -1)
stand/boot/common/ls.c
123
if (fd != -1)
stand/boot/common/ls.c
124
close(fd);
stand/boot/common/ls.c
138
int fd;
stand/boot/common/ls.c
142
fd = -1;
stand/boot/common/ls.c
155
fd = rel_open(cp, NULL, O_RDONLY);
stand/boot/common/ls.c
156
if (fd < 0) {
stand/boot/common/ls.c
161
if (fstat(fd, &sb) < 0) {
stand/boot/common/ls.c
173
return(fd);
stand/boot/common/ls.c
178
if (fd != -1)
stand/boot/common/ls.c
179
close(fd);
stand/boot/common/ls.c
56
int fd;
stand/boot/common/ls.c
65
fd = -1;
stand/boot/common/ls.c
89
fd = ls_getdir(&path);
stand/boot/common/ls.c
90
if (fd == -1) {
stand/boot/common/ls.c
98
while ((d = readdirfd(fd)) != NULL) {
stand/boot/common/misc.c
119
kern_pread(int fd, vm_offset_t dest, size_t len, off_t off)
stand/boot/common/misc.c
123
if (lseek(fd, off, SEEK_SET) == -1) {
stand/boot/common/misc.c
127
nread = archsw.arch_readin(fd, dest, len);
stand/boot/common/misc.c
140
alloc_pread(int fd, off_t off, size_t len)
stand/boot/common/misc.c
150
if (lseek(fd, off, SEEK_SET) == -1) {
stand/boot/common/misc.c
155
nread = read(fd, buf, len);
stand/boot/common/module.c
1002
size = read(fd, &version, sizeof(version));
stand/boot/common/module.c
1009
if (read(fd, mdp->d_hints, size) != size)
stand/boot/common/module.c
1012
close(fd);
stand/boot/common/module.c
1016
close(fd);
stand/boot/common/module.c
189
int fd, got, tot;
stand/boot/common/module.c
213
if ((fd = rel_open(name, NULL, O_RDONLY)) < 0) {
stand/boot/common/module.c
223
got = read(fd, buf, 8192);
stand/boot/common/module.c
239
close(fd);
stand/boot/common/module.c
391
int fd, got;
stand/boot/common/module.c
409
if ((fd = rel_open(name, NULL, O_RDONLY)) < 0) {
stand/boot/common/module.c
424
close(fd);
stand/boot/common/module.c
428
got = archsw.arch_readin(fd, laddr, 4096);
stand/boot/common/module.c
435
close(fd);
stand/boot/common/module.c
456
close(fd);
stand/boot/common/module.c
989
int fd, size, version;
stand/boot/common/module.c
996
st.st_size > 100 * 1024 || (fd = rel_open(path, NULL, O_RDONLY)) < 0) {
stand/boot/common/rel_open.c
156
int fd;
stand/boot/common/rel_open.c
165
fd = open(ptr, flags);
stand/boot/common/rel_open.c
166
if (abspathp && fd >= 0) {
stand/boot/common/rel_open.c
175
fd = open(path, flags);
stand/boot/common/rel_open.c
176
if (abspathp && fd >= 0) {
stand/boot/common/rel_open.c
182
return(fd);
stand/boot/efi/loader/copy.c
130
efi_readin(const int fd, vm_offset_t dest, const size_t len)
stand/boot/efi/loader/copy.c
137
return (read(fd, (void *)(dest + stage_offset), len));
stand/boot/efi/loader/loader_efi.h
47
ssize_t efi_readin(const int fd, vm_offset_t dest, const size_t len);
stand/boot/pc32/btxld/btxld.c
293
getbtx(int fd, struct btx_hdr * btx)
stand/boot/pc32/btxld/btxld.c
295
if (readx(fd, btx, sizeof(*btx), 0) != sizeof(*btx) ||
stand/boot/pc32/btxld/btxld.c
306
gethdr(int fd, struct hdr *hdr)
stand/boot/pc32/btxld/btxld.c
316
if (fstat(fd, &sb))
stand/boot/pc32/btxld/btxld.c
321
if ((p = mmap(NULL, hdr->size, PROT_READ, MAP_SHARED, fd,
stand/boot/pc32/btxld/btxld.c
381
puthdr(int fd, struct hdr *hdr)
stand/boot/pc32/btxld/btxld.c
395
writex(fd, &ex, sizeof(ex));
stand/boot/pc32/btxld/btxld.c
397
seekx(fd, hdr->size);
stand/boot/pc32/btxld/btxld.c
414
writex(fd, &eh, sizeof(eh));
stand/boot/pc32/btxld/btxld.c
443
readx(int fd, void *buf, size_t nbyte, off_t offset)
stand/boot/pc32/btxld/btxld.c
447
if (offset != -1 && lseek(fd, offset, SEEK_SET) != offset)
stand/boot/pc32/btxld/btxld.c
449
if ((n = read(fd, buf, nbyte)) == -1)
stand/boot/pc32/btxld/btxld.c
458
writex(int fd, const void *buf, size_t nbyte)
stand/boot/pc32/btxld/btxld.c
462
if ((n = write(fd, buf, nbyte)) == -1)
stand/boot/pc32/btxld/btxld.c
472
seekx(int fd, off_t offset)
stand/boot/pc32/btxld/btxld.c
474
if (lseek(fd, offset, SEEK_SET) != offset)
stand/boot/pc32/libi386/i386_copy.c
68
i386_readin(const int fd, vm_offset_t dest, const size_t len)
stand/boot/pc32/libi386/i386_copy.c
84
got = read(fd, buf, get);
stand/boot/pc32/libi386/libi386.h
112
ssize_t i386_readin(const int fd, vm_offset_t dest, const size_t len);
stand/lib/close.c
68
close(int fd)
stand/lib/close.c
70
struct open_file *f = &files[fd];
stand/lib/close.c
73
if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) {
stand/lib/dosfs.c
153
dos_mount(DOS_FS *fs, struct open_file *fd)
stand/lib/dosfs.c
158
fs->fd = fd;
stand/lib/dosfs.c
160
(err = ioget(fs->fd, 0, fs->buf, 1)) ||
stand/lib/dosfs.c
207
dos_open(const char *path, struct open_file *fd)
stand/lib/dosfs.c
218
if ((err = dos_mount(fs, fd)))
stand/lib/dosfs.c
238
fd->f_fsdata = (void *)f;
stand/lib/dosfs.c
248
dos_read(struct open_file *fd, void *buf, size_t nbyte, size_t *resid)
stand/lib/dosfs.c
252
DOS_FILE *f = (DOS_FILE *)fd->f_fsdata;
stand/lib/dosfs.c
302
dos_seek(struct open_file *fd, off_t offset, int whence)
stand/lib/dosfs.c
306
DOS_FILE *f = (DOS_FILE *)fd->f_fsdata;
stand/lib/dosfs.c
334
dos_close(struct open_file *fd)
stand/lib/dosfs.c
336
DOS_FILE *f = (DOS_FILE *)fd->f_fsdata;
stand/lib/dosfs.c
339
fd->f_fsdata = NULL;
stand/lib/dosfs.c
354
dos_stat(struct open_file *fd, struct stat *sb)
stand/lib/dosfs.c
356
DOS_FILE *f = (DOS_FILE *)fd->f_fsdata;
stand/lib/dosfs.c
369
dos_readdir(struct open_file *fd, struct dirent *d)
stand/lib/dosfs.c
382
err = dos_read(fd, &dd, sizeof(dd), &res);
stand/lib/dosfs.c
45
static int dos_open(const char *path, struct open_file *fd);
stand/lib/dosfs.c
46
static int dos_close(struct open_file *fd);
stand/lib/dosfs.c
47
static int dos_read(struct open_file *fd, void *buf, size_t size, size_t *resid);
stand/lib/dosfs.c
48
static off_t dos_seek(struct open_file *fd, off_t offset, int whence);
stand/lib/dosfs.c
49
static int dos_stat(struct open_file *fd, struct stat *sb);
stand/lib/dosfs.c
50
static int dos_readdir(struct open_file *fd, struct dirent *d);
stand/lib/dosfs.c
559
if ((err = ioget(fs->fd, lsec + sec, dir, 1)))
stand/lib/dosfs.c
756
if ((err = ioget(fs->fd, bytsec(offset), s, bytsec(nbyte))))
stand/lib/dosfs.c
778
if ((err = ioget(fs->fd, lsec, fs->buf, 1)))
stand/lib/dosfs.c
789
ioget(struct open_file *fd, u_int lsec, void *buf, u_int nsec)
stand/lib/dosfs.c
794
if ((err = (fd->f_dev->dv_strategy)(fd->f_devdata, F_READ, lsec,
stand/lib/dosfs.h
96
struct open_file *fd; /* file descriptor */
stand/lib/fstat.c
38
fstat(int fd, struct stat *sb)
stand/lib/fstat.c
40
struct open_file *f = &files[fd];
stand/lib/fstat.c
42
if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) {
stand/lib/gets.c
112
fgets(char *buf, int size, int fd)
stand/lib/gets.c
121
err = read(fd, &c, sizeof(c));
stand/lib/gets.c
84
fgetstr(char *buf, int size, int fd)
stand/lib/gets.c
92
err = read(fd, &c, sizeof(c));
stand/lib/hammer1.c
1066
hfs.fd = open(argv[1], O_RDONLY);
stand/lib/hammer1.c
1067
if (hfs.fd == -1)
stand/lib/hammer1.c
126
ssize_t res = pread(hfs->fd, be->data, HAMMER_BUFSIZE,
stand/lib/hammer1.c
91
int fd;
stand/lib/hammer2.c
221
rc = pread(hfs->fd, &media, nbytes, off);
stand/lib/hammer2.c
78
int fd;
stand/lib/ioctl.c
67
ioctl(int fd, u_long cmd, char *arg)
stand/lib/ioctl.c
69
struct open_file *f = &files[fd];
stand/lib/ioctl.c
71
if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) {
stand/lib/lseek.c
68
lseek(int fd, off_t offset, int where)
stand/lib/lseek.c
71
struct open_file *f = &files[fd];
stand/lib/lseek.c
73
if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) {
stand/lib/netif.c
272
int fd;
stand/lib/netif.c
277
for (fd = 0, s = sockets; fd < SOPEN_MAX; fd++, s++)
stand/lib/netif.c
297
return(fd);
stand/lib/open.c
114
return (fd);
stand/lib/open.c
124
return (fd);
stand/lib/open.c
71
int fd;
stand/lib/open.c
73
for (fd = 0; fd < SOPEN_MAX; fd++)
stand/lib/open.c
74
if (files[fd].f_flags == 0)
stand/lib/open.c
75
return(fd);
stand/lib/open.c
91
int fd, i, error, besterror;
stand/lib/open.c
94
if ((fd = o_gethandle()) == -1) {
stand/lib/open.c
99
f = &files[fd];
stand/lib/pager.c
135
int fd;
stand/lib/pager.c
138
if ((fd = open(fname, O_RDONLY)) == -1) {
stand/lib/pager.c
144
hmuch = read(fd, buf, sizeof(buf) - 1);
stand/lib/pager.c
159
close(fd);
stand/lib/read.c
71
read(int fd, void *dest, size_t bcount)
stand/lib/read.c
73
struct open_file *f = &files[fd];
stand/lib/read.c
76
if ((unsigned)fd >= SOPEN_MAX || !(f->f_flags & F_READ)) {
stand/lib/readdir.c
34
readdirfd(int fd)
stand/lib/readdir.c
37
struct open_file *f = &files[fd];
stand/lib/readdir.c
39
if ((unsigned)fd >= SOPEN_MAX || !(f->f_flags & F_READ)) {
stand/lib/splitfs.c
155
int fd;
stand/lib/splitfs.c
161
fd = sf->curfd;
stand/lib/splitfs.c
163
return(close(fd));
stand/lib/stat.c
40
int fd, rv;
stand/lib/stat.c
42
fd = open(str, O_RDONLY);
stand/lib/stat.c
43
if (fd < 0)
stand/lib/stat.c
45
rv = fstat(fd, sb);
stand/lib/stat.c
46
(void)close(fd);
stand/lib/write.c
68
write(int fd, void *dest, size_t bcount)
stand/lib/write.c
70
struct open_file *f = &files[fd];
stand/lib/write.c
73
if ((unsigned)fd >= SOPEN_MAX || !(f->f_flags & F_WRITE)) {
sys/bus/u4b/uvc/uvc_buf.c
733
int error, fd = -1;
sys/bus/u4b/uvc/uvc_buf.c
745
fd = td->td_retval[0];
sys/bus/u4b/uvc/uvc_buf.c
753
error = kern_writev(td, fd, &auio);
sys/bus/u4b/uvc/uvc_buf.c
759
if (fd >= 0)
sys/bus/u4b/uvc/uvc_buf.c
760
kern_close(td, fd);
sys/dev/disk/fd/fd.c
1003
fd->type = FD_360;
sys/dev/disk/fd/fd.c
1007
fd->type = FD_720;
sys/dev/disk/fd/fd.c
1012
fd->ft = fd_types[fd->type - 1];
sys/dev/disk/fd/fd.c
1020
struct fd_data *fd;
sys/dev/disk/fd/fd.c
1023
fd = device_get_softc(dev);
sys/dev/disk/fd/fd.c
1025
disk_create(fd->fdu, &fd->disk, &fd_ops);
sys/dev/disk/fd/fd.c
1026
disk_setdisktype(&fd->disk, "floppy");
sys/dev/disk/fd/fd.c
1036
make_dev(&fd_ops, dkmakeminor(fd->fdu, WHOLE_DISK_SLICE, 128 + 1),
sys/dev/disk/fd/fd.c
1037
UID_ROOT, GID_WHEEL, 0600, "fd%d.1720", fd->fdu);
sys/dev/disk/fd/fd.c
1038
make_dev(&fd_ops, dkmakeminor(fd->fdu, WHOLE_DISK_SLICE, 128 + 2),
sys/dev/disk/fd/fd.c
1039
UID_ROOT, GID_WHEEL, 0600, "fd%d.1480", fd->fdu);
sys/dev/disk/fd/fd.c
1040
make_dev(&fd_ops, dkmakeminor(fd->fdu, WHOLE_DISK_SLICE, 128 + 3),
sys/dev/disk/fd/fd.c
1041
UID_ROOT, GID_WHEEL, 0600, "fd%d.1440", fd->fdu);
sys/dev/disk/fd/fd.c
1042
make_dev(&fd_ops, dkmakeminor(fd->fdu, WHOLE_DISK_SLICE, 128 + 4),
sys/dev/disk/fd/fd.c
1043
UID_ROOT, GID_WHEEL, 0600, "fd%d.1200", fd->fdu);
sys/dev/disk/fd/fd.c
1044
make_dev(&fd_ops, dkmakeminor(fd->fdu, WHOLE_DISK_SLICE, 128 + 5),
sys/dev/disk/fd/fd.c
1045
UID_ROOT, GID_WHEEL, 0600, "fd%d.820", fd->fdu);
sys/dev/disk/fd/fd.c
1046
make_dev(&fd_ops, dkmakeminor(fd->fdu, WHOLE_DISK_SLICE, 128 + 6),
sys/dev/disk/fd/fd.c
1047
UID_ROOT, GID_WHEEL, 0600, "fd%d.800", fd->fdu);
sys/dev/disk/fd/fd.c
1048
make_dev(&fd_ops, dkmakeminor(fd->fdu, WHOLE_DISK_SLICE, 128 + 7),
sys/dev/disk/fd/fd.c
1049
UID_ROOT, GID_WHEEL, 0600, "fd%d.720", fd->fdu);
sys/dev/disk/fd/fd.c
1050
make_dev(&fd_ops, dkmakeminor(fd->fdu, WHOLE_DISK_SLICE, 128 + 8),
sys/dev/disk/fd/fd.c
1051
UID_ROOT, GID_WHEEL, 0600, "fd%d.360", fd->fdu);
sys/dev/disk/fd/fd.c
1052
make_dev(&fd_ops, dkmakeminor(fd->fdu, WHOLE_DISK_SLICE, 128 + 9),
sys/dev/disk/fd/fd.c
1053
UID_ROOT, GID_WHEEL, 0600, "fd%d.640", fd->fdu);
sys/dev/disk/fd/fd.c
1054
make_dev(&fd_ops, dkmakeminor(fd->fdu, WHOLE_DISK_SLICE, 128 + 10),
sys/dev/disk/fd/fd.c
1055
UID_ROOT, GID_WHEEL, 0600, "fd%d.1232", fd->fdu);
sys/dev/disk/fd/fd.c
1057
devstat_add_entry(&fd->device_stats, device_get_name(dev),
sys/dev/disk/fd/fd.c
1062
if (fd->type != NO_TYPE) {
sys/dev/disk/fd/fd.c
1064
ft = &fd_types[fd->type - 1];
sys/dev/disk/fd/fd.c
1072
disk_setdiskinfo(&fd->disk, &info);
sys/dev/disk/fd/fd.c
1080
struct fd_data *fd;
sys/dev/disk/fd/fd.c
1082
fd = device_get_softc(dev);
sys/dev/disk/fd/fd.c
1086
dkmakeminor(fd->fdu, WHOLE_DISK_SLICE, 128));
sys/dev/disk/fd/fd.c
1087
disk_invalidate(&fd->disk);
sys/dev/disk/fd/fd.c
1088
disk_destroy(&fd->disk);
sys/dev/disk/fd/fd.c
1089
devstat_remove_entry(&fd->device_stats);
sys/dev/disk/fd/fd.c
1090
callout_stop(&fd->toffhandle);
sys/dev/disk/fd/fd.c
1091
callout_stop(&fd->motor);
sys/dev/disk/fd/fd.c
1114
DRIVER_MODULE(fd, fdc, fd_driver, fd_devclass, NULL, NULL);
sys/dev/disk/fd/fd.c
1165
fd_p fd = xfd;
sys/dev/disk/fd/fd.c
1167
TRACE1("[fd%d: turnoff]", fd->fdu);
sys/dev/disk/fd/fd.c
1178
if (fd->fdc->state != DEVIDLE && fd->fdc->fdu == fd->fdu) {
sys/dev/disk/fd/fd.c
1179
fdc_intr(fd->fdc);
sys/dev/disk/fd/fd.c
1184
fd->flags &= ~FD_MOTOR;
sys/dev/disk/fd/fd.c
1185
set_motor(fd->fdc, fd->fdsu, TURNOFF);
sys/dev/disk/fd/fd.c
1192
fd_p fd = xfd;
sys/dev/disk/fd/fd.c
1195
fd->flags &= ~FD_MOTOR_WAIT;
sys/dev/disk/fd/fd.c
1196
if((fd->fdc->fd == fd) && (fd->fdc->state == MOTORWAIT))
sys/dev/disk/fd/fd.c
1198
fdc_intr(fd->fdc);
sys/dev/disk/fd/fd.c
1204
fd_turnon(fd_p fd)
sys/dev/disk/fd/fd.c
1206
if(!(fd->flags & FD_MOTOR))
sys/dev/disk/fd/fd.c
1208
fd->flags |= (FD_MOTOR + FD_MOTOR_WAIT);
sys/dev/disk/fd/fd.c
1209
set_motor(fd->fdc, fd->fdsu, TURNON);
sys/dev/disk/fd/fd.c
1210
callout_reset(&fd->motor, hz, fd_motor_on, fd);
sys/dev/disk/fd/fd.c
1315
fd_p fd;
sys/dev/disk/fd/fd.c
1319
if ((fd = devclass_get_softc(fd_devclass, fdu)) == NULL)
sys/dev/disk/fd/fd.c
1321
fdc = fd->fdc;
sys/dev/disk/fd/fd.c
1322
if ((fdc == NULL) || (fd->type == NO_TYPE))
sys/dev/disk/fd/fd.c
1331
type = fd->type; /* do not change selected type data */
sys/dev/disk/fd/fd.c
1337
type = fd->type; /* reset to default */
sys/dev/disk/fd/fd.c
1342
if (type != fd->type) {
sys/dev/disk/fd/fd.c
1347
switch (fd->type) {
sys/dev/disk/fd/fd.c
1406
fd->ft = fd_types[type - 1];
sys/dev/disk/fd/fd.c
1407
fd->flags |= FD_OPEN;
sys/dev/disk/fd/fd.c
1430
ft = &fd->ft;
sys/dev/disk/fd/fd.c
1438
disk_setdiskinfo(&fd->disk, &info);
sys/dev/disk/fd/fd.c
1448
struct fd_data *fd;
sys/dev/disk/fd/fd.c
1450
fd = devclass_get_softc(fd_devclass, fdu);
sys/dev/disk/fd/fd.c
1451
fd->flags &= ~FD_OPEN;
sys/dev/disk/fd/fd.c
1452
fd->options &= ~(FDOPT_NORETRY | FDOPT_NOERRLOG);
sys/dev/disk/fd/fd.c
1469
fd_p fd;
sys/dev/disk/fd/fd.c
1473
fd = devclass_get_softc(fd_devclass, fdu);
sys/dev/disk/fd/fd.c
1474
if (fd == NULL)
sys/dev/disk/fd/fd.c
1477
fdc = fd->fdc;
sys/dev/disk/fd/fd.c
1478
if (fd->type == NO_TYPE) {
sys/dev/disk/fd/fd.c
1484
fdblk = 128 << (fd->ft.secsize);
sys/dev/disk/fd/fd.c
1514
nblocks = fd->ft.size;
sys/dev/disk/fd/fd.c
1531
callout_stop(&fd->toffhandle);
sys/dev/disk/fd/fd.c
1534
devstat_start_transaction(&fd->device_stats);
sys/dev/disk/fd/fd.c
1536
device_busy(fd->dev);
sys/dev/disk/fd/fd.c
1659
fd_p fd;
sys/dev/disk/fd/fd.c
1680
if (fdc->fd) {
sys/dev/disk/fd/fd.c
1683
fdc->fd = (fd_p) 0;
sys/dev/disk/fd/fd.c
1693
fd = devclass_get_softc(fd_devclass, fdu);
sys/dev/disk/fd/fd.c
1694
fdblk = 128 << fd->ft.secsize;
sys/dev/disk/fd/fd.c
1695
if (fdc->fd && (fd != fdc->fd))
sys/dev/disk/fd/fd.c
1696
device_printf(fd->dev, "confused fd pointers\n");
sys/dev/disk/fd/fd.c
1701
fd->skip = (char *)&(finfo->fd_formb_cylno(0))
sys/dev/disk/fd/fd.c
1706
fd->skip /fdblk;
sys/dev/disk/fd/fd.c
1707
b_cylinder = blknum / (fd->ft.sectrac * fd->ft.heads);
sys/dev/disk/fd/fd.c
1711
TRACE1("(0x%x)", fd->flags);
sys/dev/disk/fd/fd.c
1712
callout_reset(&fd->toffhandle, 4 * hz, fd_turnoff, fd);
sys/dev/disk/fd/fd.c
1718
fd->skip = 0;
sys/dev/disk/fd/fd.c
1719
fdc->fd = fd;
sys/dev/disk/fd/fd.c
1721
fdc->fdctl_wr(fdc, fd->ft.trans);
sys/dev/disk/fd/fd.c
1722
TRACE1("[0x%x->FDCTL]", fd->ft.trans);
sys/dev/disk/fd/fd.c
1727
if(fd->flags & FD_MOTOR_WAIT) {
sys/dev/disk/fd/fd.c
1734
if (!(fd->flags & FD_MOTOR))
sys/dev/disk/fd/fd.c
1737
fd_turnon(fd);
sys/dev/disk/fd/fd.c
1742
set_motor(fdc, fd->fdsu, TURNON);
sys/dev/disk/fd/fd.c
1751
if (b_cylinder == (unsigned)fd->track)
sys/dev/disk/fd/fd.c
1757
fd->fdsu, b_cylinder * fd->ft.steptrac,
sys/dev/disk/fd/fd.c
1767
fd->track = FD_NO_TRACK;
sys/dev/disk/fd/fd.c
1778
if(fd->track == FD_NO_TRACK) {
sys/dev/disk/fd/fd.c
1779
int descyl = b_cylinder * fd->ft.steptrac;
sys/dev/disk/fd/fd.c
1842
fd->track = b_cylinder;
sys/dev/disk/fd/fd.c
1845
bp->b_data+fd->skip,
sys/dev/disk/fd/fd.c
1848
sectrac = fd->ft.sectrac;
sys/dev/disk/fd/fd.c
1849
sec = blknum % (sectrac * fd->ft.heads);
sys/dev/disk/fd/fd.c
1852
fd->hddrv = ((head&1)<<2)+fdu;
sys/dev/disk/fd/fd.c
1862
bp->b_data + fd->skip,
sys/dev/disk/fd/fd.c
1880
fdc->status[3] = fd->track;
sys/dev/disk/fd/fd.c
1906
bp->b_data+fd->skip,
sys/dev/disk/fd/fd.c
1919
bp->b_data + fd->skip,
sys/dev/disk/fd/fd.c
1939
bp->b_data+fd->skip,
sys/dev/disk/fd/fd.c
1945
fd->track, /* track */
sys/dev/disk/fd/fd.c
1948
fd->ft.secsize, /* sector size */
sys/dev/disk/fd/fd.c
1950
fd->ft.gap, /* gap size */
sys/dev/disk/fd/fd.c
1951
fd->ft.datalen, /* data length */
sys/dev/disk/fd/fd.c
1956
bp->b_data + fd->skip,
sys/dev/disk/fd/fd.c
1969
bp->b_data+fd->skip,fdblk)) {
sys/dev/disk/fd/fd.c
1970
callout_reset(&fd->tohandle, hz,
sys/dev/disk/fd/fd.c
1980
callout_reset(&fd->tohandle, hz, fd_iotimeout, fdc);
sys/dev/disk/fd/fd.c
1987
(void)fdcpio(fdc,bp->b_cmd,bp->b_data+fd->skip,fdblk);
sys/dev/disk/fd/fd.c
1991
callout_stop(&fd->tohandle);
sys/dev/disk/fd/fd.c
1993
if (fd_read_status(fdc, fd->fdsu)) {
sys/dev/disk/fd/fd.c
1996
bp->b_data + fd->skip,
sys/dev/disk/fd/fd.c
2012
bp->b_data + fd->skip,
sys/dev/disk/fd/fd.c
2047
fd->skip += fdblk;
sys/dev/disk/fd/fd.c
2048
if (!format && fd->skip < bp->b_bcount - bp->b_resid) {
sys/dev/disk/fd/fd.c
2053
fd->skip = 0;
sys/dev/disk/fd/fd.c
2056
device_unbusy(fd->dev);
sys/dev/disk/fd/fd.c
2058
devstat_end_transaction_buf(&fd->device_stats, bp);
sys/dev/disk/fd/fd.c
2060
fdc->fd = (fd_p) 0;
sys/dev/disk/fd/fd.c
2119
fd->track = 0;
sys/dev/disk/fd/fd.c
2124
if(fd->flags & FD_MOTOR_WAIT)
sys/dev/disk/fd/fd.c
2143
if (fd_read_status(fdc, fd->fdsu) == 0)
sys/dev/disk/fd/fd.c
2171
struct fd_data *fd;
sys/dev/disk/fd/fd.c
2181
fd = devclass_get_softc(fd_devclass, fdu);
sys/dev/disk/fd/fd.c
2182
if (fd->options & FDOPT_NORETRY)
sys/dev/disk/fd/fd.c
2200
int printerror = (fd->options & FDOPT_NOERRLOG) == 0;
sys/dev/disk/fd/fd.c
2209
fdc->fd->skip);
sys/dev/disk/fd/fd.c
2226
bp->b_resid += bp->b_bcount - fdc->fd->skip;
sys/dev/disk/fd/fd.c
2228
fdc->fd->skip = 0;
sys/dev/disk/fd/fd.c
2230
device_unbusy(fd->dev);
sys/dev/disk/fd/fd.c
2232
devstat_end_transaction_buf(&fdc->fd->device_stats, bp);
sys/dev/disk/fd/fd.c
2236
fdc->fd = (fd_p) 0;
sys/dev/disk/fd/fd.c
2248
fd_p fd;
sys/dev/disk/fd/fd.c
2254
fd = devclass_get_softc(fd_devclass, fdu);
sys/dev/disk/fd/fd.c
2255
fdblk = 128 << fd->ft.secsize;
sys/dev/disk/fd/fd.c
2266
(fd->ft.sectrac * fd->ft.heads)
sys/dev/disk/fd/fd.c
2267
+ finfo->head * fd->ft.sectrac) * fdblk;
sys/dev/disk/fd/fd.c
2284
device_unbusy(fd->dev);
sys/dev/disk/fd/fd.c
2306
fd_p fd = devclass_get_softc(fd_devclass, fdu);
sys/dev/disk/fd/fd.c
2322
*(struct fd_type *)ap->a_data = fd->ft;
sys/dev/disk/fd/fd.c
2329
fd->ft = *(struct fd_type *)ap->a_data;
sys/dev/disk/fd/fd.c
2333
*(int *)ap->a_data = fd->options;
sys/dev/disk/fd/fd.c
2337
fd->options = *(int *)ap->a_data;
sys/dev/disk/fd/fd.c
2342
if ((fd->fdc->flags & FDC_STAT_VALID) == 0)
sys/dev/disk/fd/fd.c
2344
memcpy(fsp->status, fd->fdc->status, 7 * sizeof(u_int));
sys/dev/disk/fd/fd.c
877
struct fd_data *fd;
sys/dev/disk/fd/fd.c
883
fd = device_get_softc(dev);
sys/dev/disk/fd/fd.c
886
bzero(fd, sizeof *fd);
sys/dev/disk/fd/fd.c
887
fd->dev = dev;
sys/dev/disk/fd/fd.c
888
fd->fdc = fdc;
sys/dev/disk/fd/fd.c
889
fd->fdsu = fdsu;
sys/dev/disk/fd/fd.c
890
fd->fdu = device_get_unit(dev);
sys/dev/disk/fd/fd.c
894
switch (fd->fdu) {
sys/dev/disk/fd/fd.c
975
fd->track = FD_NO_TRACK;
sys/dev/disk/fd/fd.c
976
fd->fdc = fdc;
sys/dev/disk/fd/fd.c
977
fd->fdsu = fdsu;
sys/dev/disk/fd/fd.c
978
fd->options = 0;
sys/dev/disk/fd/fd.c
979
callout_init(&fd->toffhandle);
sys/dev/disk/fd/fd.c
980
callout_init(&fd->tohandle);
sys/dev/disk/fd/fd.c
981
callout_init(&fd->motor);
sys/dev/disk/fd/fd.c
986
fd->type = FD_1200;
sys/dev/disk/fd/fd.c
990
fd->type = FD_1440;
sys/dev/disk/fd/fd.c
994
fd->type = FD_1440;
sys/dev/disk/fd/fd.c
999
fd->type = FD_1440;
sys/dev/disk/fd/fdc.h
55
struct fd_data *fd;
sys/dev/disk/iscsi/initiator/iscsi.c
413
i_setsoc(isc_session_t *sp, int fd, thread_t td)
sys/dev/disk/iscsi/initiator/iscsi.c
427
if ((error = holdsock(td, fd, &fp)) == 0) {
sys/dev/disk/iscsi/initiator/iscsi.c
97
static int i_setsoc(isc_session_t *sp, int fd, struct thread *td);
sys/dev/disk/sbp/sbp.c
1172
htonl(((sdev->target->sbp->fd.fc->nodeid | FWLOCALBUS )<< 16));
sys/dev/disk/sbp/sbp.c
1257
xfer->fc = sdev->target->sbp->fd.fc;
sys/dev/disk/sbp/sbp.c
1289
nid = target->sbp->fd.fc->nodeid | FWLOCALBUS;
sys/dev/disk/sbp/sbp.c
1384
device_get_nameunit(ocb->sdev->target->sbp->fd.dev),
sys/dev/disk/sbp/sbp.c
1579
device_printf(sbp->fd.dev,
sys/dev/disk/sbp/sbp.c
1586
device_printf(sbp->fd.dev,
sys/dev/disk/sbp/sbp.c
1848
sbp->fd.dev = dev;
sys/dev/disk/sbp/sbp.c
1849
sbp->fd.fc = device_get_ivars(dev);
sys/dev/disk/sbp/sbp.c
1852
max_speed = sbp->fd.fc->speed;
sys/dev/disk/sbp/sbp.c
1854
error = bus_dma_tag_create(/*parent*/sbp->fd.fc->dmat,
sys/dev/disk/sbp/sbp.c
1917
xfer->fc = sbp->fd.fc;
sys/dev/disk/sbp/sbp.c
1922
fw_bindadd(sbp->fd.fc, &sbp->fwb);
sys/dev/disk/sbp/sbp.c
1924
sbp->fd.post_busreset = sbp_post_busreset;
sys/dev/disk/sbp/sbp.c
1925
sbp->fd.post_explore = sbp_post_explore;
sys/dev/disk/sbp/sbp.c
1927
if (sbp->fd.fc->status != -1) {
sys/dev/disk/sbp/sbp.c
1988
fwdma_free(sdev->target->sbp->fd.fc, &sdev->dma);
sys/dev/disk/sbp/sbp.c
2020
struct firewire_comm *fc = sbp->fd.fc;
sys/dev/disk/sbp/sbp.c
208
struct firewire_dev_comm fd;
sys/dev/disk/sbp/sbp.c
2223
device_get_nameunit(sbp->fd.dev),
sys/dev/disk/sbp/sbp.c
2244
device_get_nameunit(sbp->fd.dev),
sys/dev/disk/sbp/sbp.c
2273
device_get_nameunit(sbp->fd.dev),
sys/dev/disk/sbp/sbp.c
2319
ocb->orb[2] = htonl(((sbp->fd.fc->nodeid | FWLOCALBUS )<< 16) );
sys/dev/disk/sbp/sbp.c
2378
device_get_nameunit(sbp->fd.dev),
sys/dev/disk/sbp/sbp.c
2409
device_get_nameunit(sbp->fd.dev), cam_sim_path(sbp->sim));
sys/dev/disk/sbp/sbp.c
2422
device_get_nameunit(sbp->fd.dev),
sys/dev/disk/sbp/sbp.c
2467
device_get_nameunit(sbp->fd.dev),
sys/dev/disk/sbp/sbp.c
2563
fc = sbp->fd.fc;
sys/dev/disk/sbp/sbp.c
324
device_get_nameunit(sdev->target->sbp->fd.dev),
sys/dev/disk/sbp/sbp.c
371
bus = device_get_unit(sbp->fd.dev);
sys/dev/disk/sbp/sbp.c
387
device_printf(sbp->fd.dev,
sys/dev/disk/sbp/sbp.c
429
device_get_nameunit(target->sbp->fd.dev),
sys/dev/disk/sbp/sbp.c
499
fwdma_malloc(sbp->fd.fc,
sys/dev/disk/sbp/sbp.c
557
device_printf(sbp->fd.dev, "increase SBP_NUM_TARGETS!\n");
sys/dev/disk/sbp/sbp.c
778
STAILQ_FOREACH(fwdev, &sbp->fd.fc->devices, link)
sys/dev/disk/sbp/sbp.c
788
STAILQ_FOREACH(fwdev, &sbp->fd.fc->devices, link) {
sys/dev/disk/xdisk/xdisk.c
297
fp = holdfp(curthread, xaioc->fd, -1);
sys/dev/drm/amd/amdgpu/amdgpu_cs.c
1425
int fd, r;
sys/dev/drm/amd/amdgpu/amdgpu_cs.c
1451
fd = get_unused_fd_flags(O_CLOEXEC);
sys/dev/drm/amd/amdgpu/amdgpu_cs.c
1452
if (fd < 0) {
sys/dev/drm/amd/amdgpu/amdgpu_cs.c
1454
return fd;
sys/dev/drm/amd/amdgpu/amdgpu_cs.c
1460
put_unused_fd(fd);
sys/dev/drm/amd/amdgpu/amdgpu_cs.c
1464
fd_install(fd, sync_file->file);
sys/dev/drm/amd/amdgpu/amdgpu_cs.c
1465
info->out.handle = fd;
sys/dev/drm/amd/amdgpu/amdgpu_sched.c
54
int fd,
sys/dev/drm/amd/amdgpu/amdgpu_sched.c
60
struct file *filp = fget(fd);
sys/dev/drm/amd/amdgpu/amdgpu_sched.c
97
args->in.fd,
sys/dev/drm/drm_atomic_uapi.c
1042
int fd;
sys/dev/drm/drm_atomic_uapi.c
1048
fence_state->fd = get_unused_fd_flags(O_CLOEXEC);
sys/dev/drm/drm_atomic_uapi.c
1049
if (fence_state->fd < 0)
sys/dev/drm/drm_atomic_uapi.c
1050
return fence_state->fd;
sys/dev/drm/drm_atomic_uapi.c
1052
if (put_user(fence_state->fd, fence_state->out_fence_ptr))
sys/dev/drm/drm_atomic_uapi.c
1199
fd_install(fence_state[i].fd,
sys/dev/drm/drm_atomic_uapi.c
1225
if (fence_state[i].fd >= 0)
sys/dev/drm/drm_atomic_uapi.c
1226
put_unused_fd(fence_state[i].fd);
sys/dev/drm/drm_prime.c
885
args->handle, args->flags, &args->fd);
sys/dev/drm/drm_prime.c
900
args->fd, &args->handle);
sys/dev/drm/drm_syncobj.c
405
int fd;
sys/dev/drm/drm_syncobj.c
407
fd = get_unused_fd_flags(O_CLOEXEC);
sys/dev/drm/drm_syncobj.c
408
if (fd < 0)
sys/dev/drm/drm_syncobj.c
409
return fd;
sys/dev/drm/drm_syncobj.c
416
put_unused_fd(fd);
sys/dev/drm/drm_syncobj.c
424
fd_install(fd, file);
sys/dev/drm/drm_syncobj.c
426
*p_fd = fd;
sys/dev/drm/drm_syncobj.c
446
int fd, u32 *handle)
sys/dev/drm/drm_syncobj.c
455
file = fget(fd);
sys/dev/drm/drm_syncobj.c
486
int fd, int handle)
sys/dev/drm/drm_syncobj.c
488
struct dma_fence *fence = sync_file_get_fence(fd);
sys/dev/drm/drm_syncobj.c
512
int fd = get_unused_fd_flags(O_CLOEXEC);
sys/dev/drm/drm_syncobj.c
514
if (fd < 0)
sys/dev/drm/drm_syncobj.c
515
return fd;
sys/dev/drm/drm_syncobj.c
530
fd_install(fd, sync_file->file);
sys/dev/drm/drm_syncobj.c
532
*p_fd = fd;
sys/dev/drm/drm_syncobj.c
535
put_unused_fd(fd);
sys/dev/drm/drm_syncobj.c
627
&args->fd);
sys/dev/drm/drm_syncobj.c
630
&args->fd);
sys/dev/drm/drm_syncobj.c
651
args->fd,
sys/dev/drm/drm_syncobj.c
654
return drm_syncobj_fd_to_handle(file_private, args->fd,
sys/dev/drm/include/linux/dma-buf.h
123
struct dma_buf *dma_buf_get(int fd);
sys/dev/drm/include/linux/file.h
44
int fd;
sys/dev/drm/include/linux/file.h
46
error = falloc(curthread->td_lwp, &file, &fd);
sys/dev/drm/include/linux/file.h
49
return fd;
sys/dev/drm/include/linux/file.h
53
fd_install(unsigned int fd, struct file *file)
sys/dev/drm/include/linux/file.h
65
put_unused_fd(unsigned int fd)
sys/dev/drm/include/linux/sync_file.h
42
sync_file_get_fence(int fd)
sys/dev/drm/include/uapi/drm/amdgpu_drm.h
279
__u32 fd;
sys/dev/drm/include/uapi/drm/drm.h
708
__s32 fd;
sys/dev/drm/include/uapi/drm/drm.h
742
__s32 fd;
sys/dev/drm/include/uapi/drm/drm_mode.h
839
__u32 fd;
sys/dev/drm/linux_dma-buf.c
142
int fd, error;
sys/dev/drm/linux_dma-buf.c
153
__set_close_on_exec(fd, fdt);
sys/dev/drm/linux_dma-buf.c
155
__clear_close_on_exec(fd, fdt);
sys/dev/drm/linux_dma-buf.c
159
error = fdalloc(curproc, 0, &fd);
sys/dev/drm/linux_dma-buf.c
163
fsetfd(curproc->p_fd, dmabuf->file, fd);
sys/dev/drm/linux_dma-buf.c
165
return fd;
sys/dev/drm/linux_dma-buf.c
169
dma_buf_get(int fd)
sys/dev/drm/linux_dma-buf.c
174
if ((fp = holdfp(curthread, fd, -1)) == NULL)
sys/dev/drm/linux_dma-buf.c
179
dropfp(curthread, fd, fp);
sys/dev/drm/linux_dma-buf.c
184
dropfp(curthread, fd, fp);
sys/dev/misc/dcons/dcons_crom.c
110
src = sc->fd.fc->crom_src;
sys/dev/misc/dcons/dcons_crom.c
111
root = sc->fd.fc->crom_root;
sys/dev/misc/dcons/dcons_crom.c
137
device_printf(sc->fd.dev, "bus_addr 0x%jx\n",
sys/dev/misc/dcons/dcons_crom.c
141
device_printf(sc->fd.dev, "dcons_paddr is already set\n");
sys/dev/misc/dcons/dcons_crom.c
165
sc->fd.fc = device_get_ivars(dev);
sys/dev/misc/dcons/dcons_crom.c
166
sc->fd.dev = dev;
sys/dev/misc/dcons/dcons_crom.c
167
sc->fd.post_explore = NULL;
sys/dev/misc/dcons/dcons_crom.c
168
sc->fd.post_busreset = (void *) dcons_crom_post_busreset;
sys/dev/misc/dcons/dcons_crom.c
172
/*parent*/ sc->fd.fc->dmat,
sys/dev/misc/dcons/dcons_crom.c
196
sc->fd.post_busreset = NULL;
sys/dev/misc/dcons/dcons_crom.c
78
struct firewire_dev_comm fd;
sys/dev/netif/fwe/if_fwe.c
117
fc = fwe->fd.fc;
sys/dev/netif/fwe/if_fwe.c
135
fc = fwe->fd.fc;
sys/dev/netif/fwe/if_fwe.c
189
fwe->fd.fc = device_get_ivars(dev);
sys/dev/netif/fwe/if_fwe.c
191
tx_speed = fwe->fd.fc->speed;
sys/dev/netif/fwe/if_fwe.c
193
fwe->fd.dev = dev;
sys/dev/netif/fwe/if_fwe.c
194
fwe->fd.post_explore = NULL;
sys/dev/netif/fwe/if_fwe.c
205
eui = &fwe->fd.fc->eui;
sys/dev/netif/fwe/if_fwe.c
253
fc = fwe->fd.fc;
sys/dev/netif/fwe/if_fwe.c
313
fc = fwe->fd.fc;
sys/dev/netif/fwe/if_fwe.c
364
xfer->fc = fwe->fd.fc;
sys/dev/netif/fwe/if_fwe.c
492
xferq = fwe->fd.fc->atq;
sys/dev/netif/fwe/if_fwe.c
513
if (fw_asyreq(fwe->fd.fc, -1, xfer) != 0) {
sys/dev/netif/fwe/if_fwe.c
528
xferq->start(fwe->fd.fc);
sys/dev/netif/fwe/if_fwe.c
547
if (fwe->fd.fc->irx_post != NULL)
sys/dev/netif/fwe/if_fwe.c
548
fwe->fd.fc->irx_post(fwe->fd.fc, fp->mode.ld);
sys/dev/netif/fwe/if_fwe.c
590
fwe->fd.fc->irx_enable(fwe->fd.fc, fwe->dma_ch);
sys/dev/netif/fwe/if_fwevar.h
43
struct firewire_dev_comm fd;
sys/dev/smbus/atmel_mxt/test_atmel.c
108
mxt_write_reg(int fd, uint16_t reg, uint8_t val)
sys/dev/smbus/atmel_mxt/test_atmel.c
110
return mxt_write_reg_buf(fd, reg, &val, 1);
sys/dev/smbus/atmel_mxt/test_atmel.c
114
mxt_read_object(int fd, struct mxt_object *obj, void *rbuf, int rbytes)
sys/dev/smbus/atmel_mxt/test_atmel.c
121
return mxt_read_reg(fd, reg, rbuf, bytes);
sys/dev/smbus/atmel_mxt/test_atmel.c
126
mxt_t6_command(int fd, uint16_t t6cmd, uint8_t t6val, int waitforme)
sys/dev/smbus/atmel_mxt/test_atmel.c
130
mxt_write_reg(fd, 6 + t6cmd, t6val);
sys/dev/smbus/atmel_mxt/test_atmel.c
133
if (mxt_read_reg(fd, 6 + t6cmd, &status, 1) != 1)
sys/dev/smbus/atmel_mxt/test_atmel.c
165
int fd;
sys/dev/smbus/atmel_mxt/test_atmel.c
173
fd = open("/dev/smb1-4a", O_RDWR);
sys/dev/smbus/atmel_mxt/test_atmel.c
174
printf("fd = %d\n", fd);
sys/dev/smbus/atmel_mxt/test_atmel.c
176
r = mxt_t6_command(fd, 0/*RESET*/, 0x01, 1);
sys/dev/smbus/atmel_mxt/test_atmel.c
179
n = mxt_read_reg(fd, 0, &rup.info, sizeof(rup.info));
sys/dev/smbus/atmel_mxt/test_atmel.c
190
n = mxt_read_reg(fd, 0, rbuf, totsize);
sys/dev/smbus/atmel_mxt/test_atmel.c
226
n = mxt_read_object(fd, obj, &msg, sizeof(msg));
sys/dev/smbus/atmel_mxt/test_atmel.c
54
mxt_read_reg(int fd, uint16_t reg, void *rbuf, int bytes)
sys/dev/smbus/atmel_mxt/test_atmel.c
70
r = ioctl(fd, SMB_TRANS, &cmd);
sys/dev/smbus/atmel_mxt/test_atmel.c
80
mxt_write_reg_buf(int fd, uint16_t reg, void *xbuf, int bytes)
sys/dev/smbus/atmel_mxt/test_atmel.c
98
r = ioctl(fd, SMB_TRANS, &cmd);
sys/dev/smbus/cyapa/test_cyapa.c
102
r = ioctl(fd, SMB_TRANS, &cmd);
sys/dev/smbus/cyapa/test_cyapa.c
121
r = ioctl(fd, SMB_TRANS, &cmd);
sys/dev/smbus/cyapa/test_cyapa.c
128
r = ioctl(fd, SMB_TRANS, &cmd);
sys/dev/smbus/cyapa/test_cyapa.c
141
r = ioctl(fd, SMB_TRANS, &cmd);
sys/dev/smbus/cyapa/test_cyapa.c
168
r = ioctl(fd, SMB_TRANS, &cmd);
sys/dev/smbus/cyapa/test_cyapa.c
192
close(fd);
sys/dev/smbus/cyapa/test_cyapa.c
85
int fd;
sys/dev/smbus/cyapa/test_cyapa.c
93
fd = open("/dev/smb0-67", O_RDWR);
sys/dev/smbus/cyapa/test_cyapa.c
94
printf("fd = %d\n", fd);
sys/dev/virtual/nvmm/nvmm_netbsd.c
280
int error, fd;
sys/dev/virtual/nvmm/nvmm_netbsd.c
288
error = fd_allocfile(&fp, &fd);
sys/dev/virtual/nvmm/nvmm_netbsd.c
300
return fd_clone(fp, fd, flags, &nvmm_fileops, owner);
sys/dev/virtual/vkernel/cdrom/vcd.c
130
if (fstat(sc->fd, &st) < 0 || st.st_size == 0)
sys/dev/virtual/vkernel/cdrom/vcd.c
156
n = pread(sc->fd, bp->b_data,
sys/dev/virtual/vkernel/cdrom/vcd.c
161
n = pwrite(sc->fd, bp->b_data,
sys/dev/virtual/vkernel/cdrom/vcd.c
60
int fd;
sys/dev/virtual/vkernel/cdrom/vcd.c
89
if (dsk->fd < 0 || fstat(dsk->fd, &st) < 0)
sys/dev/virtual/vkernel/cdrom/vcd.c
95
sc->fd = dsk->fd;
sys/dev/virtual/vkernel/disk/vdisk.c
102
if (dsk->fd < 0 || fstat(dsk->fd, &st) < 0)
sys/dev/virtual/vkernel/disk/vdisk.c
110
st.st_size = lseek(dsk->fd, 0L, SEEK_END);
sys/dev/virtual/vkernel/disk/vdisk.c
118
sc->fd = dsk->fd;
sys/dev/virtual/vkernel/disk/vdisk.c
137
sc->fd, 0);
sys/dev/virtual/vkernel/disk/vdisk.c
188
if (fstat(sc->fd, &st) < 0)
sys/dev/virtual/vkernel/disk/vdisk.c
196
st.st_size = lseek(sc->fd, 0L, SEEK_END);
sys/dev/virtual/vkernel/disk/vdisk.c
316
n = pread(sc->fd, bp->b_data, bp->b_bcount,
sys/dev/virtual/vkernel/disk/vdisk.c
328
n = pwrite(sc->fd, bp->b_data, bp->b_bcount,
sys/dev/virtual/vkernel/disk/vdisk.c
333
if (sc->map_buf == NULL && fsync(sc->fd) < 0)
sys/dev/virtual/vkernel/disk/vdisk.c
66
int fd;
sys/dev/virtual/vkernel/net/if_vke.c
774
int fd;
sys/dev/virtual/vkernel/net/if_vke.c
777
fd = info->tap_fd;
sys/dev/virtual/vkernel/net/if_vke.c
795
if (ioctl(fd, TAPGIFINFO, &tapinfo) < 0) {
sys/dev/virtual/vkernel/net/if_vke.c
801
if (ioctl(fd, SIOCGIFADDR, enaddr) < 0) {
sys/dev/virtual/vkernel/net/if_vke.c
807
int fd = open("/dev/urandom", O_RDONLY);
sys/dev/virtual/vkernel/net/if_vke.c
808
if (fd >= 0) {
sys/dev/virtual/vkernel/net/if_vke.c
809
read(fd, enaddr + 2, 4);
sys/dev/virtual/vkernel/net/if_vke.c
810
close(fd);
sys/dev/virtual/vkernel/net/if_vke.c
826
sc->sc_fd = fd;
sys/kern/kern_checkpoint.c
587
int fd;
sys/kern/kern_checkpoint.c
664
if (fdalloc(lp->lwp_proc, cfi->cfi_index, &fd) != 0) {
sys/kern/kern_checkpoint.c
670
KKASSERT(fd == cfi->cfi_index);
sys/kern/kern_checkpoint.c
671
fsetfd(fdp, tempfp, fd);
sys/kern/kern_checkpoint.c
742
if (uap->fd == -1 && uap->pid == (pid_t)-1)
sys/kern/kern_checkpoint.c
744
else if ((fp = holdfp(td, uap->fd, FWRITE)) == NULL)
sys/kern/kern_checkpoint.c
749
dropfp(td, uap->fd, fp);
sys/kern/kern_checkpoint.c
756
if ((fp = holdfp(td, uap->fd, FREAD)) == NULL) {
sys/kern/kern_checkpoint.c
762
dropfp(td, uap->fd, fp);
sys/kern/kern_descrip.c
104
static void fsetfd_locked(struct filedesc *fdp, struct file *fp, int fd);
sys/kern/kern_descrip.c
106
static struct file *funsetfd_locked (struct filedesc *fdp, int fd);
sys/kern/kern_descrip.c
1405
return(kern_closefrom(uap->fd));
sys/kern/kern_descrip.c
1412
kern_closefrom(int fd)
sys/kern/kern_descrip.c
1423
if (fd < 0)
sys/kern/kern_descrip.c
1437
while (fd <= fdp->fd_lastfile) {
sys/kern/kern_descrip.c
1438
if (fdp->fd_files[fd].fp != NULL) {
sys/kern/kern_descrip.c
1441
e2 = kern_close(fd);
sys/kern/kern_descrip.c
1446
++fd;
sys/kern/kern_descrip.c
1459
return(kern_close(uap->fd));
sys/kern/kern_descrip.c
1466
kern_close(int fd)
sys/kern/kern_descrip.c
1482
if ((fp = funsetfd_locked(fdp, fd)) == NULL) {
sys/kern/kern_descrip.c
1502
knote_fdclose(fp, fdp, fd);
sys/kern/kern_descrip.c
1523
kern_shutdown(int fd, int how)
sys/kern/kern_descrip.c
1529
if ((fp = holdfp(td, fd, -1)) == NULL)
sys/kern/kern_descrip.c
153
fdfixup_locked(struct filedesc *fdp, int fd)
sys/kern/kern_descrip.c
155
if (fd < fdp->fd_freefile) {
sys/kern/kern_descrip.c
1554
kern_fstat(int fd, struct stat *ub)
sys/kern/kern_descrip.c
156
fdp->fd_freefile = fd;
sys/kern/kern_descrip.c
1560
if ((fp = holdfp(td, fd, -1)) == NULL)
sys/kern/kern_descrip.c
1577
error = kern_fstat(uap->fd, &st);
sys/kern/kern_descrip.c
1597
if ((fp = holdfp(td, uap->fd, -1)) == NULL)
sys/kern/kern_descrip.c
1710
fdreserve_locked(struct filedesc *fdp, int fd, int incr)
sys/kern/kern_descrip.c
1712
while (fd >= 0) {
sys/kern/kern_descrip.c
1713
fdp->fd_files[fd].allocated += incr;
sys/kern/kern_descrip.c
1714
KKASSERT(fdp->fd_files[fd].allocated >= 0);
sys/kern/kern_descrip.c
1715
fd = left_ancestor(fd);
sys/kern/kern_descrip.c
1730
int fd, rsize, rsum, node, lim;
sys/kern/kern_descrip.c
1802
for (fd = max(want, fdp->fd_freefile); fd < min(fdp->fd_nfiles, lim);
sys/kern/kern_descrip.c
1803
fd = right_ancestor(fd)) {
sys/kern/kern_descrip.c
1804
if (fdp->fd_files[fd].allocated == 0)
sys/kern/kern_descrip.c
1807
rsize = right_subtree_size(fd);
sys/kern/kern_descrip.c
1808
if (fdp->fd_files[fd].allocated == rsize)
sys/kern/kern_descrip.c
1819
node = fd + rsize;
sys/kern/kern_descrip.c
1821
if (fdp->fd_files[fd].allocated == rsum + rsize) {
sys/kern/kern_descrip.c
1822
fd = node; /* move to the right */
sys/kern/kern_descrip.c
1841
KKASSERT(fd < fdp->fd_nfiles);
sys/kern/kern_descrip.c
1842
if (fd > fdp->fd_lastfile)
sys/kern/kern_descrip.c
1843
fdp->fd_lastfile = fd;
sys/kern/kern_descrip.c
1845
fdp->fd_freefile = fd;
sys/kern/kern_descrip.c
1846
*result = fd;
sys/kern/kern_descrip.c
1847
KKASSERT(fdp->fd_files[fd].fp == NULL);
sys/kern/kern_descrip.c
1848
KKASSERT(fdp->fd_files[fd].reserved == 0);
sys/kern/kern_descrip.c
1849
fdp->fd_files[fd].fileflags = 0;
sys/kern/kern_descrip.c
1850
fdp->fd_files[fd].reserved = 1;
sys/kern/kern_descrip.c
1851
fdreserve_locked(fdp, fd, 1);
sys/kern/kern_descrip.c
2150
checkfdclosed(thread_t td, struct filedesc *fdp, int fd, struct file *fp,
sys/kern/kern_descrip.c
2163
if (fdc->fd == fd && fdc->fp == fp)
sys/kern/kern_descrip.c
2169
if ((unsigned)fd >= fdp->fd_nfiles || fp != fdp->fd_files[fd].fp)
sys/kern/kern_descrip.c
2186
fsetfd_locked(struct filedesc *fdp, struct file *fp, int fd)
sys/kern/kern_descrip.c
2188
KKASSERT((unsigned)fd < fdp->fd_nfiles);
sys/kern/kern_descrip.c
2189
KKASSERT(fdp->fd_files[fd].reserved != 0);
sys/kern/kern_descrip.c
2193
fdp->fd_files[fd].fp = fp;
sys/kern/kern_descrip.c
2194
fdp->fd_files[fd].reserved = 0;
sys/kern/kern_descrip.c
2196
fdp->fd_files[fd].reserved = 0;
sys/kern/kern_descrip.c
2197
fdreserve_locked(fdp, fd, -1);
sys/kern/kern_descrip.c
2198
fdfixup_locked(fdp, fd);
sys/kern/kern_descrip.c
2206
fsetfd(struct filedesc *fdp, struct file *fp, int fd)
sys/kern/kern_descrip.c
2209
fsetfd_locked(fdp, fp, fd);
sys/kern/kern_descrip.c
2218
funsetfd_locked(struct filedesc *fdp, int fd)
sys/kern/kern_descrip.c
2222
if ((unsigned)fd >= fdp->fd_nfiles)
sys/kern/kern_descrip.c
2224
if ((fp = fdp->fd_files[fd].fp) == NULL)
sys/kern/kern_descrip.c
2227
fclearcache(&fdp->fd_files[fd], NULL, 0);
sys/kern/kern_descrip.c
2228
fdp->fd_files[fd].fp = NULL;
sys/kern/kern_descrip.c
2229
fdp->fd_files[fd].fileflags = 0;
sys/kern/kern_descrip.c
2232
fdreserve_locked(fdp, fd, -1);
sys/kern/kern_descrip.c
2233
fdfixup_locked(fdp, fd);
sys/kern/kern_descrip.c
2242
fgetfdflags(struct filedesc *fdp, int fd, int *flagsp)
sys/kern/kern_descrip.c
2247
if (((u_int)fd) >= fdp->fd_nfiles) {
sys/kern/kern_descrip.c
2249
} else if (fdp->fd_files[fd].fp == NULL) {
sys/kern/kern_descrip.c
2252
*flagsp = fdp->fd_files[fd].fileflags;
sys/kern/kern_descrip.c
226
fdc->fd = -1;
sys/kern/kern_descrip.c
2264
faddfdflags(struct filedesc *fdp, int fd, int add_flags)
sys/kern/kern_descrip.c
2269
if (((u_int)fd) >= fdp->fd_nfiles) {
sys/kern/kern_descrip.c
2271
} else if (fdp->fd_files[fd].fp == NULL) {
sys/kern/kern_descrip.c
2274
fdp->fd_files[fd].fileflags |= add_flags;
sys/kern/kern_descrip.c
2286
fsetfdflags(struct filedesc *fdp, int fd, int set_flags)
sys/kern/kern_descrip.c
2291
if (((u_int)fd) >= fdp->fd_nfiles) {
sys/kern/kern_descrip.c
2293
} else if (fdp->fd_files[fd].fp == NULL) {
sys/kern/kern_descrip.c
2297
fdp->fd_files[fd].fileflags = (fileflags_t)set_flags;
sys/kern/kern_descrip.c
2309
fclrfdflags(struct filedesc *fdp, int fd, int rem_flags)
sys/kern/kern_descrip.c
2314
if (((u_int)fd) >= fdp->fd_nfiles) {
sys/kern/kern_descrip.c
2316
} else if (fdp->fd_files[fd].fp == NULL) {
sys/kern/kern_descrip.c
2319
fdp->fd_files[fd].fileflags &= ~rem_flags;
sys/kern/kern_descrip.c
257
fdc->fd = -1;
sys/kern/kern_descrip.c
276
holdfp_fdp(struct filedesc *fdp, int fd, int flag)
sys/kern/kern_descrip.c
2765
holdfp(thread_t td, int fd, int flag)
sys/kern/kern_descrip.c
2769
fp = _holdfp_cache(td, fd);
sys/kern/kern_descrip.c
2787
holdsock(thread_t td, int fd, struct file **fpp)
sys/kern/kern_descrip.c
2795
fp = _holdfp_cache(td, fd);
sys/kern/kern_descrip.c
281
if (((u_int)fd) < fdp->fd_nfiles) {
sys/kern/kern_descrip.c
2818
holdvnode(thread_t td, int fd, struct file **fpp)
sys/kern/kern_descrip.c
282
fp = fdp->fd_files[fd].fp; /* can be NULL */
sys/kern/kern_descrip.c
2823
fp = _holdfp_cache(td, fd);
sys/kern/kern_descrip.c
2846
holdvnode2(thread_t td, int fd, struct file **fpp, char *fflagsp)
sys/kern/kern_descrip.c
2851
fp = _holdfp2(td, fd, fflagsp);
sys/kern/kern_descrip.c
299
holdfp_fdp_locked(struct filedesc *fdp, int fd, int flag)
sys/kern/kern_descrip.c
303
if (((u_int)fd) < fdp->fd_nfiles) {
sys/kern/kern_descrip.c
304
fp = fdp->fd_files[fd].fp; /* can be NULL */
sys/kern/kern_descrip.c
3205
if ((fp = holdfp(td, uap->fd, -1)) == NULL)
sys/kern/kern_descrip.c
326
_holdfp_cache(thread_t td, int fd)
sys/kern/kern_descrip.c
341
if (fdc->fd != fd || fdc->fp == NULL)
sys/kern/kern_descrip.c
3527
int fd;
sys/kern/kern_descrip.c
3529
for (fd = 0; fd < NUMFDESC; fd++) {
sys/kern/kern_descrip.c
3530
make_dev(&fildesc_ops, fd,
sys/kern/kern_descrip.c
3531
UID_BIN, GID_BIN, 0666, "fd/%d", fd);
sys/kern/kern_descrip.c
356
if (fdc->fd != fd || fdc->fp == NULL) {
sys/kern/kern_descrip.c
392
if (((u_int)fd) < fdp->fd_nfiles) {
sys/kern/kern_descrip.c
393
fp = fdp->fd_files[fd].fp; /* can be NULL */
sys/kern/kern_descrip.c
396
if (fdp->fd_files[fd].isfull == 0)
sys/kern/kern_descrip.c
439
KKASSERT(best->fd >= 0);
sys/kern/kern_descrip.c
440
fclearcache(&fdp->fd_files[best->fd], best, status);
sys/kern/kern_descrip.c
447
best->fd = fd;
sys/kern/kern_descrip.c
452
fdn = &fdp->fd_files[fd];
sys/kern/kern_descrip.c
460
best->fd = -1;
sys/kern/kern_descrip.c
475
_holdfp2(thread_t td, int fd, char *fflagsp)
sys/kern/kern_descrip.c
488
if (((u_int)fd) < fdp->fd_nfiles) {
sys/kern/kern_descrip.c
489
fp = fdp->fd_files[fd].fp; /* can be NULL */
sys/kern/kern_descrip.c
491
*fflagsp = fdp->fd_files[fd].fileflags;
sys/kern/kern_descrip.c
510
dropfp(thread_t td, int fd, struct file *fp)
sys/kern/kern_descrip.c
524
if (fdc->fp != fp || fdc->fd != fd)
sys/kern/kern_descrip.c
547
if (fdc->fp == fp && fdc->fd == fd) {
sys/kern/kern_descrip.c
598
KKASSERT(fdc->fd >= 0);
sys/kern/kern_descrip.c
599
fclearcache(&fdp->fd_files[fdc->fd], fdc,
sys/kern/kern_descrip.c
672
int fd = 0;
sys/kern/kern_descrip.c
674
error = kern_dup(DUP_FIXED, uap->from, uap->to, &fd);
sys/kern/kern_descrip.c
675
sysmsg->sysmsg_fds[0] = fd;
sys/kern/kern_descrip.c
687
int fd = 0;
sys/kern/kern_descrip.c
689
error = kern_dup(DUP_VARIABLE, uap->fd, 0, &fd);
sys/kern/kern_descrip.c
690
sysmsg->sysmsg_fds[0] = fd;
sys/kern/kern_descrip.c
699
kern_fcntl(int fd, int cmd, union fcntl_dat *dat, struct ucred *cred)
sys/kern/kern_descrip.c
718
error = fgetfdflags(p->p_fd, fd, &tmp);
sys/kern/kern_descrip.c
725
error = fsetfdflags(p->p_fd, fd,
sys/kern/kern_descrip.c
731
error = kern_dup(DUP_VARIABLE | DUP_FCNTL, fd, newmin,
sys/kern/kern_descrip.c
737
fd, newmin, &dat->fc_fd);
sys/kern/kern_descrip.c
742
fd, newmin, &dat->fc_fd);
sys/kern/kern_descrip.c
746
error = kern_dup(DUP_FIXED, fd, newmin, &dat->fc_fd);
sys/kern/kern_descrip.c
750
error = kern_dup(DUP_FIXED | DUP_CLOEXEC, fd, newmin,
sys/kern/kern_descrip.c
755
error = kern_dup(DUP_FIXED | DUP_CLOFORK, fd, newmin,
sys/kern/kern_descrip.c
771
fd, newmin, &dat->fc_fd);
sys/kern/kern_descrip.c
779
if ((fp = holdfp(td, fd, -1)) == NULL)
sys/kern/kern_descrip.c
877
if (checkfdclosed(td, p->p_fd, fd, fp, closedcounter)) {
sys/kern/kern_descrip.c
984
error = kern_fcntl(uap->fd, uap->cmd, &dat, curthread->td_ucred);
sys/kern/kern_event.c
1071
fp = holdfp(td, uap->fd, -1);
sys/kern/kern_event.c
1090
dropfp(td, uap->fd, fp);
sys/kern/kern_event.c
1944
knote_fdclose(struct file *fp, struct filedesc *fdp, int fd)
sys/kern/kern_event.c
1953
if (kn->kn_kq->kq_fdp == fdp && kn->kn_id == fd) {
sys/kern/kern_event.c
1963
kn->kn_id != fd || kn->kn_kq != kq) {
sys/kern/kern_event.c
728
int fd, error;
sys/kern/kern_event.c
730
error = falloc(td->td_lwp, &fp, &fd);
sys/kern/kern_event.c
741
fsetfd(kq->kq_fdp, fp, fd);
sys/kern/kern_event.c
742
sysmsg->sysmsg_result = fd;
sys/kern/kern_exec.c
725
if ((error = holdvnode2(td, uap->fd, &fp, &fileflags)) != 0)
sys/kern/kern_exec.c
742
ksnprintf(fname, sizeof(fname), "/dev/fd/%d", uap->fd);
sys/kern/kern_ktrace.c
209
ktrgenio(struct lwp *lp, int fd, enum uio_rw rw, struct uio *uio, int error)
sys/kern/kern_ktrace.c
219
ktg.ktr_fd = fd;
sys/kern/subr_diskiocom.c
118
fp = holdfp(curthread, recl->fd, -1);
sys/kern/sys_generic.c
1340
if (pfd->fd == -1) {
sys/kern/sys_generic.c
1378
EV_SET(kev++, pfd->fd, EVFILT_READ, EV_ADD|EV_ENABLE,
sys/kern/sys_generic.c
1391
EV_SET(kev++, pfd->fd, EVFILT_READ, EV_ADD|EV_ENABLE,
sys/kern/sys_generic.c
1400
EV_SET(kev++, pfd->fd, EVFILT_WRITE, EV_ADD|EV_ENABLE,
sys/kern/sys_generic.c
1409
EV_SET(kev++, pfd->fd, EVFILT_EXCEPT, EV_ADD|EV_ENABLE,
sys/kern/sys_generic.c
1418
pfd->fd, pfd->events,
sys/kern/sys_generic.c
143
error = kern_preadv(uap->fd, &auio, 0, &sysmsg->sysmsg_szresult);
sys/kern/sys_generic.c
1471
if (kevp[i].ident == pfd->fd) {
sys/kern/sys_generic.c
1519
(uintmax_t)pi, pfd->fd,
sys/kern/sys_generic.c
1594
pfd->fd, pfd->revents);
sys/kern/sys_generic.c
1610
pfd->fd, pfd->events,
sys/kern/sys_generic.c
1696
int error, fd;
sys/kern/sys_generic.c
1699
if ((error = falloc(td->td_lwp, &fp, &fd)) != 0)
sys/kern/sys_generic.c
1706
fsetfd(td->td_lwp->lwp_proc->p_fd, fp, fd);
sys/kern/sys_generic.c
1707
faddfdflags(td->td_proc->p_fd, fd, UF_EXCLOSE);
sys/kern/sys_generic.c
1711
EV_SET(&kev, fd, EVFILT_READ, EV_ADD|EV_ENABLE, 0, 0, NULL);
sys/kern/sys_generic.c
1721
EV_SET(&kev, fd, EVFILT_READ, EV_DELETE|EV_DISABLE, 0, 0, NULL);
sys/kern/sys_generic.c
178
error = kern_preadv(uap->fd, &auio, flags, &sysmsg->sysmsg_szresult);
sys/kern/sys_generic.c
206
error = kern_preadv(uap->fd, &auio, 0, &sysmsg->sysmsg_szresult);
sys/kern/sys_generic.c
242
error = kern_preadv(uap->fd, &auio, flags, &sysmsg->sysmsg_szresult);
sys/kern/sys_generic.c
252
kern_preadv(int fd, struct uio *auio, int flags, size_t *res)
sys/kern/sys_generic.c
258
fp = holdfp(td, fd, FREAD);
sys/kern/sys_generic.c
264
error = dofileread(fd, fp, auio, flags, res);
sys/kern/sys_generic.c
266
dropfp(td, fd, fp);
sys/kern/sys_generic.c
278
dofileread(int fd, struct file *fp, struct uio *auio, int flags, size_t *res)
sys/kern/sys_generic.c
312
ktrgenio(td->td_lwp, fd, UIO_READ, &ktruio, error);
sys/kern/sys_generic.c
349
error = kern_pwritev(uap->fd, &auio, 0, &sysmsg->sysmsg_szresult);
sys/kern/sys_generic.c
384
error = kern_pwritev(uap->fd, &auio, flags, &sysmsg->sysmsg_szresult);
sys/kern/sys_generic.c
410
error = kern_pwritev(uap->fd, &auio, 0, &sysmsg->sysmsg_szresult);
sys/kern/sys_generic.c
446
error = kern_pwritev(uap->fd, &auio, flags, &sysmsg->sysmsg_szresult);
sys/kern/sys_generic.c
456
kern_pwritev(int fd, struct uio *auio, int flags, size_t *res)
sys/kern/sys_generic.c
462
fp = holdfp(td, fd, FWRITE);
sys/kern/sys_generic.c
468
error = dofilewrite(fd, fp, auio, flags, res);
sys/kern/sys_generic.c
470
dropfp(td, fd, fp);
sys/kern/sys_generic.c
482
dofilewrite(int fd, struct file *fp, struct uio *auio, int flags, size_t *res)
sys/kern/sys_generic.c
520
ktrgenio(lp, fd, UIO_WRITE, &ktruio, error);
sys/kern/sys_generic.c
541
error = mapped_ioctl(uap->fd, uap->com, uap->data, NULL, sysmsg);
sys/kern/sys_generic.c
559
mapped_ioctl(int fd, u_long com, caddr_t uspc_data, struct ioctl_map *map,
sys/kern/sys_generic.c
582
fp = holdfp(td, fd, FREAD|FWRITE);
sys/kern/sys_generic.c
616
map->sys, fd, maskcmd,
sys/kern/sys_generic.c
646
map->sys, fd, maskcmd,
sys/kern/sys_generic.c
657
error = fclrfdflags(p->p_fd, fd, UF_EXCLOSE);
sys/kern/sys_generic.c
660
error = faddfdflags(p->p_fd, fd, UF_EXCLOSE);
sys/kern/sys_generic.c
736
dropfp(td, fd, fp);
sys/kern/sys_generic.c
902
int fd;
sys/kern/sys_generic.c
959
fd = skap->proc_fds;
sys/kern/sys_generic.c
960
if (FD_ISSET(fd, fdp)) {
sys/kern/sys_generic.c
962
EV_SET(kev, fd, filter,
sys/kern/sys_generic.c
967
FD_CLR(fd, fdp);
sys/kern/sys_generic.c
973
"serial %ju\n", fd, filter,
sys/kern/uipc_syscalls.c
100
int fd, error;
sys/kern/uipc_syscalls.c
119
error = falloc(td->td_lwp, &fp, &fd);
sys/kern/uipc_syscalls.c
124
fsetfd(fdp, NULL, fd);
sys/kern/uipc_syscalls.c
131
fdp->fd_files[fd].fileflags |= UF_EXCLOSE;
sys/kern/uipc_syscalls.c
133
fdp->fd_files[fd].fileflags |= UF_FOCLOSE;
sys/kern/uipc_syscalls.c
134
*res = fd;
sys/kern/uipc_syscalls.c
135
fsetfd(fdp, fp, fd);
sys/kern/uipc_syscalls.c
1601
fp = holdfp(td, uap->fd, FREAD);
sys/kern/uipc_syscalls.c
1611
dropfp(td, uap->fd, fp);
sys/kern/uipc_syscalls.c
294
int fd;
sys/kern/uipc_syscalls.c
306
error = falloc(td->td_lwp, &nfp, &fd);
sys/kern/uipc_syscalls.c
421
fsetfd(fdp, NULL, fd);
sys/kern/uipc_syscalls.c
424
fdp->fd_files[fd].fileflags |= UF_EXCLOSE;
sys/kern/uipc_syscalls.c
426
fdp->fd_files[fd].fileflags |= UF_FOCLOSE;
sys/kern/uipc_syscalls.c
427
*res = fd;
sys/kern/uipc_syscalls.c
428
fsetfd(fdp, nfp, fd);
sys/kern/uipc_usrreq.c
1636
unp_fp_externalize(struct lwp *lp, struct file *fp, int fd, int flags)
sys/kern/uipc_usrreq.c
1641
KKASSERT(fd >= 0);
sys/kern/uipc_usrreq.c
1650
fdp->fd_files[fd].fileflags |= UF_EXCLOSE;
sys/kern/uipc_usrreq.c
1652
fdp->fd_files[fd].fileflags |= UF_FOCLOSE;
sys/kern/uipc_usrreq.c
1653
fsetfd(fdp, fx, fd);
sys/kern/uipc_usrreq.c
1656
fsetfd(fdp, NULL, fd);
sys/kern/uipc_usrreq.c
1660
fdp->fd_files[fd].fileflags |= UF_EXCLOSE;
sys/kern/uipc_usrreq.c
1662
fdp->fd_files[fd].fileflags |= UF_FOCLOSE;
sys/kern/uipc_usrreq.c
1663
fsetfd(fdp, fp, fd);
sys/kern/uipc_usrreq.c
167
static void unp_fp_externalize(struct lwp *lp, struct file *fp, int fd,
sys/kern/uipc_usrreq.c
1709
int i, fd, *fdp;
sys/kern/uipc_usrreq.c
1793
fd = *fdp++;
sys/kern/uipc_usrreq.c
1794
if ((unsigned)fd >= fdescp->fd_nfiles ||
sys/kern/uipc_usrreq.c
1795
fdescp->fd_files[fd].fp == NULL) {
sys/kern/uipc_usrreq.c
1799
if (fdescp->fd_files[fd].fp->f_type == DTYPE_KQUEUE) {
sys/kern/vfs_nlookup.c
199
nlookup_init_at(struct nlookupdata *nd, struct file **fpp, int fd,
sys/kern/vfs_nlookup.c
226
} else if (fd == AT_FDCWD) {
sys/kern/vfs_nlookup.c
230
if ((error = holdvnode(td, fd, &fp)) != 0)
sys/kern/vfs_syscalls.c
1317
if (uap->fd >= 0) {
sys/kern/vfs_syscalls.c
1318
fp = holdfp(td, uap->fd, -1);
sys/kern/vfs_syscalls.c
1333
dropfp(td, uap->fd, fp);
sys/kern/vfs_syscalls.c
1476
kern_fstatfs(int fd, struct statfs *buf)
sys/kern/vfs_syscalls.c
1487
if ((error = holdvnode(td, fd, &fp)) != 0)
sys/kern/vfs_syscalls.c
1543
error = kern_fstatfs(uap->fd, &buf);
sys/kern/vfs_syscalls.c
1595
kern_fstatvfs(int fd, struct statvfs *buf)
sys/kern/vfs_syscalls.c
1603
if ((error = holdvnode(td, fd, &fp)) != 0)
sys/kern/vfs_syscalls.c
1643
error = kern_fstatvfs(uap->fd, &buf);
sys/kern/vfs_syscalls.c
1867
if ((error = holdvnode(td, uap->fd, &fp)) != 0)
sys/kern/vfs_syscalls.c
1990
int fd;
sys/kern/vfs_syscalls.c
1992
for (fd = 0; fd < fdp->fd_nfiles ; fd++) {
sys/kern/vfs_syscalls.c
1993
if ((error = holdvnode(td, fd, &fp)) != 0)
sys/kern/vfs_syscalls.c
2319
error = nlookup_init_at(&nd, &fp, uap->fd, uap->path, UIO_USERSPACE, 0);
sys/kern/vfs_syscalls.c
2434
error = nlookup_init_at(&nd, &fp, uap->fd, uap->path, UIO_USERSPACE, 0);
sys/kern/vfs_syscalls.c
2505
error = nlookup_init_at(&nd, &fp, uap->fd, uap->path, UIO_USERSPACE, 0);
sys/kern/vfs_syscalls.c
2756
error = nlookup_init_at(&nd, &fp, uap->fd, uap->path2,
sys/kern/vfs_syscalls.c
2847
error = nlookup_init_at(&nd, &fp, uap->fd, uap->path, UIO_USERSPACE, 0);
sys/kern/vfs_syscalls.c
2859
kern_lseek(int fd, off_t offset, int whence, off_t *res)
sys/kern/vfs_syscalls.c
2865
fp = holdfp(td, fd, -1);
sys/kern/vfs_syscalls.c
2870
dropfp(td, fd, fp);
sys/kern/vfs_syscalls.c
2885
error = kern_lseek(uap->fd, uap->offset, uap->whence,
sys/kern/vfs_syscalls.c
3003
error = nlookup_init_at(&nd, &fp, uap->fd, uap->path, UIO_USERSPACE,
sys/kern/vfs_syscalls.c
3125
error = nlookup_init_at(&nd, &fp, uap->fd, uap->path,
sys/kern/vfs_syscalls.c
3252
error = nlookup_init_at(&nd, &fp, uap->fd, uap->path, UIO_USERSPACE, 0);
sys/kern/vfs_syscalls.c
3362
if ((error = holdvnode(td, uap->fd, &fp)) != 0)
sys/kern/vfs_syscalls.c
3391
error = nlookup_init_at(&nd, &fp, uap->fd, uap->path, UIO_USERSPACE, lookupflags);
sys/kern/vfs_syscalls.c
3492
if ((error = holdvnode(td, uap->fd, &fp)) != 0)
sys/kern/vfs_syscalls.c
3519
error = nlookup_init_at(&nd, &fp, uap->fd, uap->path,
sys/kern/vfs_syscalls.c
3632
if ((error = holdvnode(td, uap->fd, &fp)) != 0)
sys/kern/vfs_syscalls.c
3660
error = nlookup_init_at(&nd, &fp, uap->fd, uap->path,
sys/kern/vfs_syscalls.c
3815
kern_futimens(int fd, struct timespec *ts)
sys/kern/vfs_syscalls.c
3829
if ((error = holdvnode(td, fd, &fp)) != 0)
sys/kern/vfs_syscalls.c
3876
error = kern_futimens(uap->fd, uap->ts ? ts : NULL);
sys/kern/vfs_syscalls.c
3881
kern_futimes(int fd, struct timeval *tptr)
sys/kern/vfs_syscalls.c
3890
error = kern_futimens(fd, tptr ? ts : NULL);
sys/kern/vfs_syscalls.c
3910
error = kern_futimes(uap->fd, uap->tptr ? tv : NULL);
sys/kern/vfs_syscalls.c
3936
error = nlookup_init_at(&nd, &fp, uap->fd, uap->path,
sys/kern/vfs_syscalls.c
4000
error = nlookup_init_at(&nd, &fp, uap->fd, uap->path,
sys/kern/vfs_syscalls.c
4074
kern_ftruncate(int fd, off_t length)
sys/kern/vfs_syscalls.c
4088
if ((error = holdvnode(td, fd, &fp)) != 0)
sys/kern/vfs_syscalls.c
4142
error = kern_ftruncate(uap->fd, uap->length);
sys/kern/vfs_syscalls.c
4148
kern_fsync(int fd, bool fullsync)
sys/kern/vfs_syscalls.c
4156
if ((error = holdvnode(td, fd, &fp)) != 0)
sys/kern/vfs_syscalls.c
4185
return (kern_fsync(uap->fd, true));
sys/kern/vfs_syscalls.c
4196
return (kern_fsync(uap->fd, false));
sys/kern/vfs_syscalls.c
4563
error = nlookup_init_at(&nd, &fp, uap->fd, uap->path, UIO_USERSPACE, 0);
sys/kern/vfs_syscalls.c
4614
kern_getdirentries(int fd, char *buf, u_int count, long *basep, int *res,
sys/kern/vfs_syscalls.c
4625
if ((error = holdvnode(td, fd, &fp)) != 0)
sys/kern/vfs_syscalls.c
4675
error = kern_getdirentries(uap->fd, uap->buf, uap->count, &base,
sys/kern/vfs_syscalls.c
4691
error = kern_getdirentries(uap->fd, uap->buf, uap->count, NULL,
sys/kern/vfs_syscalls.c
5470
return (kern_posix_fallocate(uap->fd, uap->offset, uap->len));
sys/kern/vfs_syscalls.c
5474
kern_posix_fallocate(int fd, off_t offset, off_t len)
sys/kern/vfs_syscalls.c
5487
fp = holdfp(td, fd, -1);
sys/kern/vfs_syscalls.c
5518
dropfp(td, fd, fp);
sys/libprop/prop_kern.c
125
_prop_object_send_ioctl(prop_object_t obj, int fd, unsigned long cmd)
sys/libprop/prop_kern.c
135
if (ioctl(fd, cmd, &pref) == -1)
sys/libprop/prop_kern.c
150
prop_array_send_ioctl(prop_array_t array, int fd, unsigned long cmd)
sys/libprop/prop_kern.c
154
rv = _prop_object_send_ioctl(array, fd, cmd);
sys/libprop/prop_kern.c
167
prop_dictionary_send_ioctl(prop_dictionary_t dict, int fd, unsigned long cmd)
sys/libprop/prop_kern.c
171
rv = _prop_object_send_ioctl(dict, fd, cmd);
sys/libprop/prop_kern.c
286
prop_array_recv_ioctl(int fd, unsigned long cmd, prop_array_t *arrayp)
sys/libprop/prop_kern.c
291
rv = ioctl(fd, cmd, &pref);
sys/libprop/prop_kern.c
309
prop_dictionary_recv_ioctl(int fd, unsigned long cmd, prop_dictionary_t *dictp)
sys/libprop/prop_kern.c
314
rv = ioctl(fd, cmd, &pref);
sys/libprop/prop_kern.c
333
prop_dictionary_sendrecv_ioctl(prop_dictionary_t dict, int fd,
sys/libprop/prop_kern.c
346
if (ioctl(fd, cmd, &pref) == -1)
sys/libprop/prop_object.c
849
int fd;
sys/libprop/prop_object.c
867
if ((fd = mkstemp(tname)) == -1)
sys/libprop/prop_object.c
870
if (write(fd, xml, len) != (ssize_t)len)
sys/libprop/prop_object.c
873
if (fsync(fd) == -1)
sys/libprop/prop_object.c
878
if (fchmod(fd, 0666 & ~myumask) == -1)
sys/libprop/prop_object.c
881
(void) close(fd);
sys/libprop/prop_object.c
882
fd = -1;
sys/libprop/prop_object.c
891
if (fd != -1)
sys/libprop/prop_object.c
892
(void) close(fd);
sys/libprop/prop_object.c
910
int fd;
sys/libprop/prop_object.c
916
fd = open(fname, O_RDONLY, 0400);
sys/libprop/prop_object.c
917
if (fd == -1) {
sys/libprop/prop_object.c
922
if (fstat(fd, &sb) == -1) {
sys/libprop/prop_object.c
923
(void) close(fd);
sys/libprop/prop_object.c
929
(void) close(fd);
sys/libprop/prop_object.c
944
PROT_READ, MAP_FILE|MAP_SHARED, fd, (off_t)0);
sys/libprop/prop_object.c
945
(void) close(fd);
sys/net/netmap/netmap_user.h
126
int fd;
sys/net/netmap/netmap_user.h
140
#define NETMAP_FD(d) (P2NMD(d)->fd)
sys/net/netmap/netmap_user.h
190
d->fd = open("/dev/netmap", O_RDWR);
sys/net/netmap/netmap_user.h
191
if (d->fd < 0)
sys/net/netmap/netmap_user.h
208
if (ioctl(d->fd, NIOCREGIF, &d->req))
sys/net/netmap/netmap_user.h
213
d->fd, 0);
sys/net/netmap/netmap_user.h
247
if (d->fd)
sys/net/netmap/netmap_user.h
248
close(d->fd);
sys/net/zlib.c
186
# define fdopen(fd,mode) NULL /* No fdopen() */
sys/net/zlib.h
885
extern gzFile EXPORT gzdopen OF((int fd, const char *mode));
sys/netgraph/socket/ng_socket.c
593
int fd;
sys/netgraph/socket/ng_socket.c
610
fd = *(int *) (cm + 1);
sys/netgraph/socket/ng_socket.c
611
if ((unsigned) fd >= fdp->fd_nfiles
sys/netgraph/socket/ng_socket.c
612
|| (fp = fdp->fd_files[fd].fp) == NULL) {
sys/netgraph7/socket/ng_socket.c
701
int fd;
sys/netgraph7/socket/ng_socket.c
718
fd = CMSG_DATA(cm);
sys/netgraph7/socket/ng_socket.c
719
if ((error = fget(td, fd, &fp)) != 0)
sys/netproto/smb/smb_dev.c
379
smb_dev2share(int fd, int mode, struct smb_cred *scred,
sys/netproto/smb/smb_dev.c
391
fp = holdfp_fdp(scred->scr_td->td_proc->p_fd, fd, FREAD|FWRITE);
sys/netproto/smb/smb_dev.h
193
int smb_dev2share(int fd, int mode, struct smb_cred *scred,
sys/platform/vkernel64/include/md_var.h
66
int fd;
sys/platform/vkernel64/platform/init.c
1386
int fd;
sys/platform/vkernel64/platform/init.c
1390
fd = open(pid_file, O_RDWR|O_CREAT|O_EXLOCK|O_NONBLOCK, 0666);
sys/platform/vkernel64/platform/init.c
1391
if (fd < 0) {
sys/platform/vkernel64/platform/init.c
1400
ftruncate(fd, 0);
sys/platform/vkernel64/platform/init.c
1401
write(fd, buf, strlen(buf));
sys/platform/vkernel64/platform/init.c
520
int fd;
sys/platform/vkernel64/platform/init.c
557
fd = open(tmpfile, O_RDWR|O_CREAT|O_EXCL, 0600);
sys/platform/vkernel64/platform/init.c
558
if (fd < 0)
sys/platform/vkernel64/platform/init.c
570
if (ftruncate(fd, Maxmem_bytes) < 0) {
sys/platform/vkernel64/platform/init.c
575
MemImageFd = fd;
sys/platform/vkernel64/platform/init.c
867
int fd;
sys/platform/vkernel64/platform/init.c
871
fd = open(fname, O_RDWR|O_DIRECT, 0644);
sys/platform/vkernel64/platform/init.c
873
fd = open(fname, O_RDONLY|O_DIRECT, 0644);
sys/platform/vkernel64/platform/init.c
874
if (fd < 0 || fstat(fd, &st) < 0) {
sys/platform/vkernel64/platform/init.c
879
if (flock(fd, LOCK_EX|LOCK_NB) < 0) {
sys/platform/vkernel64/platform/init.c
890
info->fd = fd;
sys/platform/vkernel64/platform/kqueue.c
106
kqueue_add(int fd, void (*func)(void *, struct intrframe *), void *data)
sys/platform/vkernel64/platform/kqueue.c
115
info->fd = fd;
sys/platform/vkernel64/platform/kqueue.c
116
EV_SET(&kev, fd, EVFILT_READ, EV_ADD|EV_ENABLE|EV_CLEAR, 0, 0, info);
sys/platform/vkernel64/platform/kqueue.c
134
info->fd = (uintptr_t)info;
sys/platform/vkernel64/platform/kqueue.c
147
EV_SET(&kev, info->fd, EVFILT_TIMER,
sys/platform/vkernel64/platform/kqueue.c
163
KKASSERT(info->fd >= 0);
sys/platform/vkernel64/platform/kqueue.c
164
EV_SET(&kev, info->fd, EVFILT_READ, EV_DELETE, 0, 0, NULL);
sys/platform/vkernel64/platform/kqueue.c
166
panic("kevent: failed to delete descriptor %d", info->fd);
sys/platform/vkernel64/platform/kqueue.c
167
info->fd = -1;
sys/platform/vkernel64/platform/kqueue.c
58
int fd;
sys/sys/camlib.h
130
int fd; /* file descriptor for device */
sys/sys/checkpoint.h
56
int sys_checkpoint(int type, int fd, pid_t pid, int retval);
sys/sys/diskslice.h
180
int fd;
sys/sys/filedesc.h
167
void fsetfd (struct filedesc *fdp, struct file *fp, int fd);
sys/sys/filedesc.h
168
int fgetfdflags(struct filedesc *fdp, int fd, int *flagsp);
sys/sys/filedesc.h
169
int faddfdflags(struct filedesc *fdp, int fd, int add_flags);
sys/sys/filedesc.h
170
int fsetfdflags(struct filedesc *fdp, int fd, int set_flags);
sys/sys/filedesc.h
171
int fclrfdflags(struct filedesc *fdp, int fd, int rem_flags);
sys/sys/filedesc.h
182
struct file *holdfp (struct thread *td, int fd, int flag);
sys/sys/filedesc.h
183
struct file *holdfp_fdp (struct filedesc *fdp, int fd, int flag);
sys/sys/filedesc.h
184
struct file *holdfp_fdp_locked (struct filedesc *fdp, int fd, int flag);
sys/sys/filedesc.h
186
int holdvnode (struct thread *td, int fd, struct file **fpp);
sys/sys/filedesc.h
187
int holdvnode2 (struct thread *td, int fd, struct file **fpp,
sys/sys/filedesc.h
189
void dropfp(struct thread *td, int fd, struct file *fp);
sys/sys/kern_syscall.h
142
int kern_fstatfs(int fd, struct statfs *buf);
sys/sys/kern_syscall.h
143
int kern_fstatvfs(int fd, struct statvfs *buf);
sys/sys/kern_syscall.h
144
int kern_ftruncate(int fd, off_t length);
sys/sys/kern_syscall.h
145
int kern_futimens(int fd, struct timespec *ts);
sys/sys/kern_syscall.h
146
int kern_futimes(int fd, struct timeval *tptr);
sys/sys/kern_syscall.h
147
int kern_getdirentries(int fd, char *buf, u_int count, long *basep, int *res,
sys/sys/kern_syscall.h
150
int kern_lseek(int fd, off_t offset, int whence, off_t *res);
sys/sys/kern_syscall.h
158
int kern_close(int fd);
sys/sys/kern_syscall.h
159
int kern_closefrom(int fd);
sys/sys/kern_syscall.h
172
int kern_posix_fallocate(int fd, off_t offset, off_t len);
sys/sys/kern_syscall.h
173
int kern_fsync(int fd, bool fullsync);
sys/sys/kern_syscall.h
191
int prot, int flags, int fd, off_t pos, void **res);
sys/sys/kern_syscall.h
70
int kern_fcntl(int fd, int cmd, union fcntl_dat *dat, struct ucred *cred);
sys/sys/kern_syscall.h
71
int kern_fstat(int fd, struct stat *st);
sys/sys/kern_syscall.h
98
int kern_preadv(int fd, struct uio *auio, int flags, size_t *res);
sys/sys/kern_syscall.h
99
int kern_pwritev(int fd, struct uio *auio, int flags, size_t *res);
sys/sys/mapped_ioctl.h
87
int mapped_ioctl(int fd, u_long com, caddr_t uspc_data,
sys/sys/mountctl.h
275
int mountctl (const char *path, int op, int fd, void *ctl, int ctllen,
sys/sys/poll.h
44
int fd; /* which file descriptor to poll */
sys/sys/sysproto.h
1017
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1024
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1053
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1060
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1072
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1078
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1126
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1190
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1204
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1210
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1216
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1222
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1229
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1234
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1309
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1314
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1319
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1325
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1332
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1364
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1374
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1380
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1442
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1447
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1452
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
1455
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
164
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
178
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
216
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
314
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
326
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
33
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
379
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
38
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
384
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
393
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
398
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
414
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
472
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
48
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
489
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
496
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
519
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
535
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
540
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
551
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
575
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
694
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
70
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
701
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
769
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
951
int fd; char fd_[PAD_(int)];
sys/sys/sysproto.h
973
int fd; char fd_[PAD_(int)];
sys/sys/thread.h
263
int fd; /* descriptor being cached */
sys/sys/time.h
222
int futimesat(int fd, const char *path, const struct timeval times[2]);
sys/sys/xdiskioctl.h
49
int fd;
sys/vfs/dirfs/dirfs_subr.c
336
dirfs_node_stat(int fd, const char *path, dirfs_node_t dnp)
sys/vfs/dirfs/dirfs_subr.c
342
if (fd == DIRFS_NOFD)
sys/vfs/dirfs/dirfs_subr.c
345
error = fstatat(fd, path, &st, AT_SYMLINK_NOFOLLOW);
sys/vfs/dirfs/dirfs_vfsops.c
226
int fd;
sys/vfs/dirfs/dirfs_vfsops.c
258
fd = open(dmp->dm_path, O_DIRECTORY);
sys/vfs/dirfs/dirfs_vfsops.c
259
if (fd == -1) {
sys/vfs/dirfs/dirfs_vfsops.c
265
dnp->dn_fd = fd;
sys/vfs/dirfs/dirfs_vfsops.c
65
dirfs_node_t dnp, struct vnode *vp, char *hostdir, int fd, int error);
sys/vfs/dirfs/dirfs_vnops.c
77
dirfs_node_t dnp, char *name, int fd);
sys/vfs/dirfs/dirfs_vnops.c
81
dirfs_node_t dnp, int fd, int oc, int wc, int error);
sys/vfs/dirfs/dirfs_vnops.c
85
dirfs_node_t dnp, int fd, off_t startoff, off_t uoff);
sys/vfs/fuse/fuse_mount.h
40
int fd;
sys/vfs/fuse/fuse_vfsops.c
162
fuse_dbg("fd=%d\n", args.fd);
sys/vfs/fuse/fuse_vfsops.c
163
file = holdfp_fdp(curthread->td_proc->p_fd, args.fd, FREAD | FWRITE);
sys/vfs/fuse/fuse_vfsops.c
169
dropfp(curthread, args.fd, file);
sys/vfs/hammer2/hammer2_ioctl.c
212
fp = holdfp(curthread, recl->fd, -1);
sys/vfs/hammer2/hammer2_ioctl.h
63
int fd;
sys/vfs/hammer2/hammer2_ioctl.h
76
int fd; /* socket descriptor if applicable */
sys/vm/vm_mmap.c
128
int uprot, int uflags, int fd, off_t upos, void **res)
sys/vm/vm_mmap.c
156
if (((flags & MAP_ANON) && (fd != -1 || pos != 0)))
sys/vm/vm_mmap.c
163
if (fd != -1)
sys/vm/vm_mmap.c
244
fp = holdfp(td, fd, -1);
sys/vm/vm_mmap.c
399
dropfp(td, fd, fp);
sys/vm/vm_mmap.c
430
if (uap->fd != -1)
sys/vm/vm_mmap.c
443
uap->fd, upos, &sysmsg->sysmsg_resultp);
sys/vm/vm_vmspace.c
355
uap->fd, uap->offset, &sysmsg->sysmsg_resultp);
test/bsd/dup_test/dup_test.c
68
int fd;
test/bsd/dup_test/dup_test.c
71
if ((fd = mkstemp(temp)) < 0)
test/bsd/dup_test/dup_test.c
74
if (ftruncate(fd, 1024) != 0)
test/bsd/dup_test/dup_test.c
76
return (fd);
test/debug/evfilt_user.c
18
int fd;
test/debug/evfilt_user.c
24
fd = kqueue();
test/debug/evfilt_user.c
26
r = kevent(fd, &kev, 1, NULL, 0, NULL);
test/debug/evfilt_user.c
28
pthread_create(&td1, NULL, domaster, (void *)(intptr_t)fd);
test/debug/evfilt_user.c
30
pthread_create(&td2, NULL, doslave, (void *)(intptr_t)fd);
test/debug/evfilt_user.c
39
int fd = (int)(intptr_t)arg;
test/debug/evfilt_user.c
45
r = kevent(fd, &kev, 1, NULL, 0, NULL);
test/debug/evfilt_user.c
57
int fd = (int)(intptr_t)arg;
test/debug/evfilt_user.c
62
r = kevent(fd, NULL, 0, &kev, 1, NULL);
test/debug/fdpassing.c
18
void sendfd(int s, int fd);
test/debug/fdpassing.c
26
int fd;
test/debug/fdpassing.c
38
while ((fd = recvfd(fds[0])) >= 0) {
test/debug/fdpassing.c
41
if (fstat(fd, &st) < 0)
test/debug/fdpassing.c
43
else if (read(fd, &dummy, sizeof(dummy)) != sizeof(dummy))
test/debug/fdpassing.c
47
close(fd);
test/debug/fdpassing.c
57
if ((fd = open(av[i], O_RDONLY, 0666)) < 0) {
test/debug/fdpassing.c
60
sendfd(fds[1], fd);
test/debug/fdpassing.c
63
close(fd);
test/debug/fdpassing.c
76
sendfd(int s, int fd)
test/debug/fdpassing.c
99
*(int *)CMSG_DATA(&cmsg) = fd;
test/debug/posixlock.c
105
if (fcntl(fd, F_SETLKW, &lk) == 0) {
test/debug/posixlock.c
113
if (fcntl(fd, F_SETLKW, &lk) == 0) {
test/debug/posixlock.c
55
int fd;
test/debug/posixlock.c
58
if ((fd = open("test", O_CREAT|O_RDWR, 0666)) < 0) {
test/debug/posixlock.c
74
while ((r = fcntl(fd, F_GETLK, &lk)) == 0) {
test/debug/posixlock.c
97
if (fcntl(fd, F_SETLKW, &lk) == 0) {
test/debug/seekbench.c
38
int fd;
test/debug/seekbench.c
45
fd = open(av[1], O_RDONLY);
test/debug/seekbench.c
46
if (fd < 0) {
test/debug/seekbench.c
50
lseek(fd, 0L, 2);
test/debug/seekbench.c
51
bytes = lseek(fd, 0L, 1);
test/debug/seekbench.c
59
lseek(fd, base, 0);
test/debug/seekbench.c
60
read(fd, Buf, BLKSIZE);
test/debug/testvblank.c
20
int fd;
test/debug/testvblank.c
22
fd = open("/dev/dri/card0", O_RDWR);
test/debug/testvblank.c
29
if (ioctl(fd, DRM_IOCTL_WAIT_VBLANK, &vblank) < 0)
test/debug/umtx.c
115
close(fd);
test/debug/umtx.c
47
int fd;
test/debug/umtx.c
81
if ((fd = open(path, O_RDWR|O_CREAT, 0666)) < 0) {
test/debug/umtx.c
85
if (fstat(fd, &st) < 0) {
test/debug/umtx.c
91
lseek(fd, off, 0);
test/debug/umtx.c
92
write(fd, &v, sizeof(v));
test/debug/umtx.c
97
fd, off & ~(off_t)pgmask);
test/debug/vmobjinfo.c
183
int fd;
test/illumos/oclo/oclo.c
1220
int fd;
test/illumos/oclo/oclo.c
1229
fd = open("/dev/zero", flags);
test/illumos/oclo/oclo.c
1230
if (fd < 0) {
test/illumos/oclo/oclo.c
1235
if (fd != oclo_rtdata[i].crt_fd) {
test/illumos/oclo/oclo.c
1238
"algorithm is broken", oclo_rtdata[i].crt_fd, fd);
test/illumos/oclo/oclo.c
185
oclo_record(const clo_create_t *c, int fd, int exp_flags, const char *desc)
test/illumos/oclo/oclo.c
201
if (fd != oclo_nextfd) {
test/illumos/oclo/oclo.c
203
"to record next fd %d, given %d", oclo_nextfd, fd);
test/illumos/oclo/oclo.c
207
oclo_rtdata[oclo_rtdata_next].crt_fd = fd;
test/illumos/oclo/oclo.c
226
int flags = O_RDWR, fd;
test/illumos/oclo/oclo.c
232
fd = open("/dev/null", flags);
test/illumos/oclo/oclo.c
233
if (fd < 0) {
test/illumos/oclo/oclo.c
238
return (fd);
test/illumos/oclo/oclo.c
250
int fd = oclo_file(c);
test/illumos/oclo/oclo.c
251
if (fcntl(fd, F_SETFD, targ_flags) < 0) {
test/illumos/oclo/oclo.c
256
oclo_record(c, fd, targ_flags, NULL);
test/illumos/oclo/oclo.c
290
int dup, fd;
test/illumos/oclo/oclo.c
292
fd = oclo_file(c);
test/illumos/oclo/oclo.c
293
oclo_record(c, fd, c->clo_flags, "base");
test/illumos/oclo/oclo.c
298
dup = fcntl(fd, cmd, fd);
test/illumos/oclo/oclo.c
303
dup = fcntl(fd, cmd, fd + 1);
test/illumos/oclo/oclo.c
306
dup = fcntl(fd, cmd | (targ_flags << F_DUP3FD_SHIFT), fd + 1);
test/illumos/oclo/oclo.c
384
int dup, fd;
test/illumos/oclo/oclo.c
385
fd = oclo_file(c);
test/illumos/oclo/oclo.c
386
oclo_record(c, fd, c->clo_flags, "base");
test/illumos/oclo/oclo.c
393
dup = dup3(fd, fd + 1, dflags);
test/illumos/oclo/oclo.c
395
dup = dup2(fd, fd + 1);
test/illumos/oclo/oclo.c
453
int type = SOCK_DGRAM, fd;
test/illumos/oclo/oclo.c
459
fd = socket(PF_INET, type, 0);
test/illumos/oclo/oclo.c
460
if (fd < 0) {
test/illumos/oclo/oclo.c
465
oclo_record(c, fd, c->clo_flags, NULL);
test/illumos/oclo/oclo_errors.c
124
fd = accept4(sock, NULL, NULL, flags);
test/illumos/oclo/oclo_errors.c
127
return (oclo_check(desc, "accepted", fd, e));
test/illumos/oclo/oclo_errors.c
64
int fd = dup3(STDERR_FILENO, 23, flags);
test/illumos/oclo/oclo_errors.c
65
return (oclo_check(desc, "duplicated", fd, errno));
test/illumos/oclo/oclo_errors.c
71
int fd = fcntl(STDERR_FILENO, F_DUP3FD | (flags << F_DUP3FD_SHIFT), 23);
test/illumos/oclo/oclo_errors.c
72
return (oclo_check(desc, "duplicated", fd, errno));
test/illumos/oclo/oclo_errors.c
89
int fd = socket(PF_UNIX, SOCK_STREAM | type, 0);
test/illumos/oclo/oclo_errors.c
90
return (oclo_check(desc, "created", fd, errno));
test/illumos/oclo/oclo_errors.c
97
int sock, fd, e;
test/illumos/oclo/ocloexec_verify.c
100
"matched\n", fd, exp_flags);
test/illumos/oclo/ocloexec_verify.c
50
verify_flags(int fd, int exp_flags)
test/illumos/oclo/ocloexec_verify.c
53
int flags = fcntl(fd, F_GETFD, NULL);
test/illumos/oclo/ocloexec_verify.c
63
"flags 0x%x: correctly closed\n", fd,
test/illumos/oclo/ocloexec_verify.c
70
"fail with EBADF, but found %s", fd,
test/illumos/oclo/ocloexec_verify.c
76
"unexpectedly failed with %s, expected flags %d", fd,
test/illumos/oclo/ocloexec_verify.c
83
"expected to fail based on flags %d", fd, flags, exp_flags);
test/illumos/oclo/ocloexec_verify.c
89
"FD_CLOFORK, but it should have been cleared", fd, flags);
test/illumos/oclo/ocloexec_verify.c
95
"not match expected flags 0x%x", fd, flags, exp_flags);
test/interbench/hackbench.c
34
struct pollfd pollfd = { .fd = wakefd, .events = POLLIN };
test/interbench/interbench.c
351
inline ssize_t Read(int fd, void *buf, size_t count)
test/interbench/interbench.c
356
retval = read(fd, buf, count);
test/interbench/interbench.c
365
inline ssize_t Write(int fd, const void *buf, size_t count)
test/interbench/interbench.c
370
retval = write(fd, &buf, count);
test/interbench/interbench.h
10
extern inline ssize_t Read(int fd, void *buf, size_t count);
test/lockf/lockf.c
117
ret = fcntl(fd, F_SETLKW, &fl);
test/lockf/lockf.c
128
close (fd);
test/lockf/lockf.c
138
int fd;
test/lockf/lockf.c
142
fd = open (lockfile, O_RDWR|O_CREAT|O_EXCL|O_TRUNC, 0666);
test/lockf/lockf.c
143
if (fd < 0)
test/lockf/lockf.c
146
if (ftruncate(fd, size) < 0)
test/lockf/lockf.c
149
fsync(fd);
test/lockf/lockf.c
150
close(fd);
test/lockf/lockf.c
72
int i, ret, fd;
test/lockf/lockf.c
81
fd = open (lockfile, O_RDWR, 0);
test/lockf/lockf.c
83
if (fd < 0)
test/nvmm/demo/toyvirt/elf.c
104
int fd, ret = -1;
test/nvmm/demo/toyvirt/elf.c
106
fd = open(path, O_RDONLY);
test/nvmm/demo/toyvirt/elf.c
107
if (fstat(fd, &st) == -1)
test/nvmm/demo/toyvirt/elf.c
112
pread(fd, base, st.st_size, 0);
test/nvmm/demo/toyvirt/elf.c
118
close(fd);
test/socket/accept4/cloexec/accept4_cloexec.c
112
char fd[8];
test/socket/accept4/cloexec/accept4_cloexec.c
114
snprintf(fd, sizeof(fd), "%d", s);
test/socket/accept4/cloexec/accept4_cloexec.c
115
execl(CHECKFD_PATH, CHECKFD_CMD, fd, NULL);
test/socket/checkfd/checkfd.c
17
int fd;
test/socket/checkfd/checkfd.c
19
fd = strtol(argv[i], &endptr, 10);
test/socket/checkfd/checkfd.c
23
if (close(fd) < 0) {
test/socket/checkfd/checkfd.c
31
warnx("%d is still valid", fd);
test/socket/recvmsg/cloexec/recvmsg_cloexec.c
102
int fd;
test/socket/recvmsg/cloexec/recvmsg_cloexec.c
127
memmove(&fd, CMSG_DATA(cmsg), sizeof(int));
test/socket/recvmsg/cloexec/recvmsg_cloexec.c
128
return fd;
test/socket/recvmsg/cloexec/recvmsg_cloexec.c
20
int sendfd(int s, int fd);
test/socket/recvmsg/cloexec/recvmsg_cloexec.c
42
char fd[8];
test/socket/recvmsg/cloexec/recvmsg_cloexec.c
43
snprintf(fd, sizeof(fd), "%d", mysecretfd);
test/socket/recvmsg/cloexec/recvmsg_cloexec.c
44
if (execl(CHECKFD_PATH, CHECKFD_CMD, fd, NULL) < 0)
test/socket/recvmsg/cloexec/recvmsg_cloexec.c
68
sendfd(int s, int fd)
test/socket/recvmsg/cloexec/recvmsg_cloexec.c
91
memmove(CMSG_DATA(cmsg), &fd, sizeof(int));
test/socket/socket/cloexec/socket_cloexec.c
31
char fd[8];
test/socket/socket/cloexec/socket_cloexec.c
33
snprintf(fd, sizeof(fd), "%d", s);
test/socket/socket/cloexec/socket_cloexec.c
34
if (execl(CHECKFD_PATH, CHECKFD_CMD, fd, NULL) < 0)
test/stress/fsstress/fsstress.c
1371
int fd;
test/stress/fsstress/fsstress.c
1385
fd = open_path(&f, O_RDWR);
test/stress/fsstress/fsstress.c
1386
e = fd < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
1388
if (fd < 0) {
test/stress/fsstress/fsstress.c
1395
if (fstat64(fd, &stb) < 0) {
test/stress/fsstress/fsstress.c
1400
close(fd);
test/stress/fsstress/fsstress.c
1409
e = ioctl(fd, XFS_IOC_ALLOCSP64, &fl) < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
1414
close(fd);
test/stress/fsstress/fsstress.c
1524
int fd;
test/stress/fsstress/fsstress.c
1534
fd = open(".", O_RDONLY);
test/stress/fsstress/fsstress.c
1542
while (ioctl(fd, XFS_IOC_FSBULKSTAT, &bsr) == 0 && count > 0)
test/stress/fsstress/fsstress.c
1548
close(fd);
test/stress/fsstress/fsstress.c
1556
int fd;
test/stress/fsstress/fsstress.c
1592
fd = open(".", O_RDONLY);
test/stress/fsstress/fsstress.c
1599
e = ioctl(fd, XFS_IOC_FSBULKSTAT_SINGLE, &bsr) < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
1603
close(fd);
test/stress/fsstress/fsstress.c
1637
int fd;
test/stress/fsstress/fsstress.c
1667
fd = creat_path(&f, 0666);
test/stress/fsstress/fsstress.c
1668
e = fd < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
1672
if (fd >= 0) {
test/stress/fsstress/fsstress.c
1675
if (extsize && ioctl(fd, XFS_IOC_FSGETXATTR, &a) >= 0) {
test/stress/fsstress/fsstress.c
1679
if (ioctl(fd, XFS_IOC_FSSETXATTR, &a) < 0)
test/stress/fsstress/fsstress.c
1686
close(fd);
test/stress/fsstress/fsstress.c
1697
setdirect(int fd)
test/stress/fsstress/fsstress.c
1705
flags = fcntl(fd, F_GETFL, 0);
test/stress/fsstress/fsstress.c
1709
if (fcntl(fd, F_SETFL, flags|O_DIRECT) < 0) {
test/stress/fsstress/fsstress.c
1729
int fd;
test/stress/fsstress/fsstress.c
1743
fd = open_path(&f, O_RDONLY);
test/stress/fsstress/fsstress.c
1745
if (!setdirect(fd)) {
test/stress/fsstress/fsstress.c
1749
e = fd < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
1751
if (fd < 0) {
test/stress/fsstress/fsstress.c
1758
if (fstat64(fd, &stb) < 0) {
test/stress/fsstress/fsstress.c
1763
close(fd);
test/stress/fsstress/fsstress.c
1771
close(fd);
test/stress/fsstress/fsstress.c
1781
else if (ioctl(fd, XFS_IOC_DIOINFO, &diob) < 0) {
test/stress/fsstress/fsstress.c
1787
close(fd);
test/stress/fsstress/fsstress.c
1795
lseek64(fd, off, SEEK_SET);
test/stress/fsstress/fsstress.c
1803
e = read(fd, buf, len) < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
1809
close(fd);
test/stress/fsstress/fsstress.c
1820
int fd;
test/stress/fsstress/fsstress.c
1834
fd = open_path(&f, O_WRONLY);
test/stress/fsstress/fsstress.c
1835
e = fd < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
1837
if (fd < 0) {
test/stress/fsstress/fsstress.c
1845
if (!setdirect(fd))
test/stress/fsstress/fsstress.c
1847
if (fstat64(fd, &stb) < 0) {
test/stress/fsstress/fsstress.c
1852
close(fd);
test/stress/fsstress/fsstress.c
1861
else if (ioctl(fd, XFS_IOC_DIOINFO, &diob) < 0) {
test/stress/fsstress/fsstress.c
1867
close(fd);
test/stress/fsstress/fsstress.c
1875
lseek64(fd, off, SEEK_SET);
test/stress/fsstress/fsstress.c
1884
lseek64(fd, off, SEEK_SET);
test/stress/fsstress/fsstress.c
1886
e = write(fd, buf, len) < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
1892
close(fd);
test/stress/fsstress/fsstress.c
1900
int fd;
test/stress/fsstress/fsstress.c
1911
fd = open_path(&f, O_WRONLY);
test/stress/fsstress/fsstress.c
1912
e = fd < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
1914
if (fd < 0) {
test/stress/fsstress/fsstress.c
1921
e = fdatasync(fd) < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
1925
close(fd);
test/stress/fsstress/fsstress.c
1934
int fd;
test/stress/fsstress/fsstress.c
1948
fd = open_path(&f, O_RDWR);
test/stress/fsstress/fsstress.c
1949
e = fd < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
1951
if (fd < 0) {
test/stress/fsstress/fsstress.c
1958
if (fstat64(fd, &stb) < 0) {
test/stress/fsstress/fsstress.c
1963
close(fd);
test/stress/fsstress/fsstress.c
1972
e = ioctl(fd, XFS_IOC_FREESP64, &fl) < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
1977
close(fd);
test/stress/fsstress/fsstress.c
1987
int fd;
test/stress/fsstress/fsstress.c
1997
fd = open_path(&f, O_WRONLY);
test/stress/fsstress/fsstress.c
1998
e = fd < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
2000
if (fd < 0) {
test/stress/fsstress/fsstress.c
2007
e = fsync(fd) < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
2011
close(fd);
test/stress/fsstress/fsstress.c
2168
int fd;
test/stress/fsstress/fsstress.c
2182
fd = open_path(&f, O_RDONLY);
test/stress/fsstress/fsstress.c
2183
e = fd < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
2185
if (fd < 0) {
test/stress/fsstress/fsstress.c
2192
if (fstat64(fd, &stb) < 0) {
test/stress/fsstress/fsstress.c
2197
close(fd);
test/stress/fsstress/fsstress.c
2205
close(fd);
test/stress/fsstress/fsstress.c
2210
lseek64(fd, off, SEEK_SET);
test/stress/fsstress/fsstress.c
2213
e = read(fd, buf, len) < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
2219
close(fd);
test/stress/fsstress/fsstress.c
2307
int fd;
test/stress/fsstress/fsstress.c
2321
fd = open_path(&f, O_RDWR);
test/stress/fsstress/fsstress.c
2322
e = fd < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
2324
if (fd < 0) {
test/stress/fsstress/fsstress.c
2331
if (fstat64(fd, &stb) < 0) {
test/stress/fsstress/fsstress.c
2336
close(fd);
test/stress/fsstress/fsstress.c
2345
e = ioctl(fd, XFS_IOC_RESVSP64, &fl) < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
2351
close(fd);
test/stress/fsstress/fsstress.c
2525
int fd;
test/stress/fsstress/fsstress.c
2539
fd = open_path(&f, O_RDWR);
test/stress/fsstress/fsstress.c
2540
e = fd < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
2542
if (fd < 0) {
test/stress/fsstress/fsstress.c
2549
if (fstat64(fd, &stb) < 0) {
test/stress/fsstress/fsstress.c
2554
close(fd);
test/stress/fsstress/fsstress.c
2563
e = ioctl(fd, XFS_IOC_UNRESVSP64, &fl) < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
2569
close(fd);
test/stress/fsstress/fsstress.c
2579
int fd;
test/stress/fsstress/fsstress.c
2593
fd = open_path(&f, O_WRONLY);
test/stress/fsstress/fsstress.c
2594
e = fd < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
2596
if (fd < 0) {
test/stress/fsstress/fsstress.c
2603
if (fstat64(fd, &stb) < 0) {
test/stress/fsstress/fsstress.c
2608
close(fd);
test/stress/fsstress/fsstress.c
2614
lseek64(fd, off, SEEK_SET);
test/stress/fsstress/fsstress.c
2618
e = write(fd, buf, len) < 0 ? errno : 0;
test/stress/fsstress/fsstress.c
2624
close(fd);
test/stress/fsstress/fsstress.c
285
int fd;
test/stress/fsstress/fsstress.c
394
fd = creat(buf, 0666);
test/stress/fsstress/fsstress.c
395
if (lseek64(fd, (off64_t)(MAXFSIZE32 + 1ULL), SEEK_SET) < 0)
test/stress/fsstress/fsstress.c
409
i = ioctl(fd, XFS_IOC_FSGEOMETRY, &geom);
test/stress/fsstress/fsstress.c
438
err_inj.fd = fd;
test/stress/fsstress/fsstress.c
439
srval = ioctl(fd, XFS_IOC_ERROR_INJECTION, &err_inj);
test/stress/fsstress/fsstress.c
442
close(fd);
test/stress/fsstress/fsstress.c
448
close(fd);
test/stress/fsstress/fsstress.c
467
err_inj.fd = fd;
test/stress/fsstress/fsstress.c
468
if((srval = ioctl(fd, XFS_IOC_ERROR_CLEARALL, &err_inj)) != 0) {
test/stress/fsstress/fsstress.c
469
fprintf(stderr, "Bad ej clear on %d (%d).\n", fd, errno);
test/stress/fsstress/fsstress.c
471
close(fd);
test/stress/fsstress/fsstress.c
474
close(fd);
test/stress/fsx/fsx.c
1126
fd = open(fname, O_RDWR|(lite ? 0 : O_CREAT|O_TRUNC), 0666);
test/stress/fsx/fsx.c
1127
if (fd < 0) {
test/stress/fsx/fsx.c
1147
file_size = maxfilelen = lseek(fd, (off_t)0, SEEK_END);
test/stress/fsx/fsx.c
1153
ret = lseek(fd, (off_t)0, SEEK_SET);
test/stress/fsx/fsx.c
1170
written = write(fd, good_buf, (size_t)maxfilelen);
test/stress/fsx/fsx.c
118
int fd; /* fd for our test file */
test/stress/fsx/fsx.c
1186
if (close(fd)) {
test/stress/fsx/fsx.c
417
if (fstat(fd, &statbuf)) {
test/stress/fsx/fsx.c
421
size_by_seek = lseek(fd, (off_t)0, SEEK_END);
test/stress/fsx/fsx.c
437
ftruncate(fd, (off_t)0);
test/stress/fsx/fsx.c
438
ftruncate(fd, (off_t)100000);
test/stress/fsx/fsx.c
439
fstat(fd, &statbuf);
test/stress/fsx/fsx.c
444
ftruncate(fd, (off_t)0);
test/stress/fsx/fsx.c
481
ret = lseek(fd, (off_t)offset, SEEK_SET);
test/stress/fsx/fsx.c
486
iret = read(fd, temp_buf, size);
test/stress/fsx/fsx.c
565
if ((p = (char *)mmap(0, map_size, PROT_READ, MAP_FILE | MAP_SHARED, fd,
test/stress/fsx/fsx.c
638
ret = lseek(fd, (off_t)offset, SEEK_SET);
test/stress/fsx/fsx.c
643
iret = write(fd, good_buf + offset, size);
test/stress/fsx/fsx.c
698
if (ftruncate(fd, file_size) == -1) {
test/stress/fsx/fsx.c
707
MAP_FILE | MAP_SHARED, fd,
test/stress/fsx/fsx.c
757
if (ftruncate(fd, (off_t)size) == -1) {
test/stress/fsx/fsx.c
770
if (lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) {
test/stress/fsx/fsx.c
774
iret = write(fd, good_buf, file_size);
test/stress/fsx/fsx.c
783
if (lite ? 0 : ftruncate(fd, file_size) == -1) {
test/stress/fsx/fsx.c
79
static void save_buffer(char *buffer, off_t bufferlength, int fd);
test/stress/fsx/fsx.c
799
if (close(fd)) {
test/stress/fsx/fsx.c
803
fd = open(fname, O_RDWR, 0);
test/stress/fsx/fsx.c
804
if (fd < 0) {
test/stress/stress2/testcases/creat/creat.c
114
int fd, i, j;
test/stress/stress2/testcases/creat/creat.c
121
if ((fd = creat(file, 0660)) == -1) {
test/stress/stress2/testcases/creat/creat.c
127
if (fd != -1 && close(fd) == -1)
test/stress/stress2/testcases/link/link.c
110
int fd, i, j;
test/stress/stress2/testcases/link/link.c
119
if ((fd = creat(file, 0660)) == -1) {
test/stress/stress2/testcases/link/link.c
125
if (fd != -1 && close(fd) == -1)
test/stress/stress2/testcases/lockf/lockf.c
100
if (lseek(fd, 0, SEEK_SET) == -1)
test/stress/stress2/testcases/lockf/lockf.c
129
close(fd);
test/stress/stress2/testcases/lockf/lockf.c
44
int fd;
test/stress/stress2/testcases/lockf/lockf.c
50
if (lockf(fd, F_LOCK, 0) == -1)
test/stress/stress2/testcases/lockf/lockf.c
52
if (read(fd, &sem, sizeof(sem)) != sizeof(sem))
test/stress/stress2/testcases/lockf/lockf.c
53
err(1, "get: read(%d)", fd);
test/stress/stress2/testcases/lockf/lockf.c
54
if (lseek(fd, 0, SEEK_SET) == -1)
test/stress/stress2/testcases/lockf/lockf.c
56
if (lockf(fd, F_ULOCK, 0) == -1)
test/stress/stress2/testcases/lockf/lockf.c
64
if (lockf(fd, F_LOCK, 0) == -1)
test/stress/stress2/testcases/lockf/lockf.c
66
if (read(fd, &sem, sizeof(sem)) != sizeof(sem))
test/stress/stress2/testcases/lockf/lockf.c
67
err(1, "incr: read(%d)", fd);
test/stress/stress2/testcases/lockf/lockf.c
68
if (lseek(fd, 0, SEEK_SET) == -1)
test/stress/stress2/testcases/lockf/lockf.c
71
if (write(fd, &sem, sizeof(sem)) != sizeof(sem))
test/stress/stress2/testcases/lockf/lockf.c
73
if (lseek(fd, 0, SEEK_SET) == -1)
test/stress/stress2/testcases/lockf/lockf.c
75
if (lockf(fd, F_ULOCK, 0) == -1)
test/stress/stress2/testcases/lockf/lockf.c
96
if ((fd = open(file,O_CREAT | O_TRUNC | O_RDWR, 0600)) == -1)
test/stress/stress2/testcases/lockf/lockf.c
98
if (write(fd, &sem, sizeof(sem)) != sizeof(sem))
test/stress/stress2/testcases/lockf2/lockf2.c
49
int fd;
test/stress/stress2/testcases/lockf2/lockf2.c
58
if ((fd = open(file,O_CREAT | O_TRUNC | O_RDWR, 0600)) == -1)
test/stress/stress2/testcases/lockf2/lockf2.c
62
if (write(fd, &buf, sizeof(buf)) != sizeof(buf))
test/stress/stress2/testcases/lockf2/lockf2.c
64
close(fd);
test/stress/stress2/testcases/lockf2/lockf2.c
81
if ((fd = open(file, O_RDWR, 0600)) == -1)
test/stress/stress2/testcases/lockf2/lockf2.c
86
if (lseek(fd, pos, SEEK_SET) == -1)
test/stress/stress2/testcases/lockf2/lockf2.c
91
if (lockf(fd, F_LOCK, size) == -1)
test/stress/stress2/testcases/lockf2/lockf2.c
94
if (lockf(fd, F_ULOCK, size) == -1)
test/stress/stress2/testcases/lockf2/lockf2.c
98
close(fd);
test/stress/stress2/testcases/mkfifo/mkfifo.c
49
int fd;
test/stress/stress2/testcases/mkfifo/mkfifo.c
52
if ((fd = open(path, O_RDWR, 0600)) < 0) {
test/stress/stress2/testcases/mkfifo/mkfifo.c
59
if ((n = read(fd, buf, bufsize)) < 0)
test/stress/stress2/testcases/mkfifo/mkfifo.c
63
close(fd);
test/stress/stress2/testcases/mkfifo/mkfifo.c
71
int fd;
test/stress/stress2/testcases/mkfifo/mkfifo.c
73
if ((fd = open(path, O_RDWR, 0600)) < 0) {
test/stress/stress2/testcases/mkfifo/mkfifo.c
83
if (write(fd, buf, bufsize) < 0) {
test/stress/stress2/testcases/mkfifo/mkfifo.c
84
err(1, "write(%d), %s:%d", fd,
test/stress/stress2/testcases/mkfifo/mkfifo.c
88
close(fd);
test/stress/stress2/testcases/openat/openat.c
121
if ((tfd = openat(fd, file, O_RDONLY|O_CREAT, 0660)) == -1)
test/stress/stress2/testcases/openat/openat.c
126
if (renameat(fd, file, fd, file2) == -1)
test/stress/stress2/testcases/openat/openat.c
146
if ((tfd = openat(fd, file, O_RDONLY|O_CREAT, 0660)) == -1)
test/stress/stress2/testcases/openat/openat.c
149
if (unlinkat(fd, file, 0) == -1)
test/stress/stress2/testcases/openat/openat.c
45
static int fd;
test/stress/stress2/testcases/openat/openat.c
68
if ((fd = open(path2, O_RDONLY)) == -1)
test/stress/stress2/testcases/openat/openat.c
99
if ((tfd = openat(fd, file, O_RDONLY|O_CREAT, 0660)) == -1)
test/stress/stress2/testcases/rw/rw.c
130
int fd;
test/stress/stress2/testcases/rw/rw.c
135
if ((fd = creat(file, 0660)) == -1)
test/stress/stress2/testcases/rw/rw.c
148
if (write(fd, buf, to) != to)
test/stress/stress2/testcases/rw/rw.c
151
if (close(fd) == -1)
test/stress/stress2/testcases/rw/rw.c
154
if ((fd = open(file, O_RDONLY)) == -1)
test/stress/stress2/testcases/rw/rw.c
161
if (read(fd, buf, to) != to)
test/stress/stress2/testcases/rw/rw.c
176
if (close(fd) == -1)
test/stress/stress2/tools/fstool.c
54
int fd, j;
test/stress/stress2/tools/fstool.c
68
if ((fd = creat(file, 0660)) == -1) {
test/stress/stress2/tools/fstool.c
74
if (write(fd, buffer, fs) != fs)
test/stress/stress2/tools/fstool.c
77
if (fd != -1 && close(fd) == -1)
test/stress/tuxload.c
161
fd = malloc(opt_nofiles * sizeof(*fd));
test/stress/tuxload.c
179
if ((fd[i] = open(name, O_RDWR)) < 1) {
test/stress/tuxload.c
180
if ((fd[i] = open(name, O_RDWR | O_CREAT, 0644)) < 1) {
test/stress/tuxload.c
184
randomfill(fd[i]);
test/stress/tuxload.c
186
if ((fstat(fd[i], &st[i])) == -1) {
test/stress/tuxload.c
200
randomfill(int fd)
test/stress/tuxload.c
211
write(fd, buf, 32768);
test/stress/tuxload.c
212
fsync(fd);
test/stress/tuxload.c
213
lseek(fd, 0L, 0);
test/stress/tuxload.c
23
static void randomfill(int fd);
test/stress/tuxload.c
35
int *fd;
test/stress/tuxload.c
69
pp[i] = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd[i], 0);
test/stress/tuxload.c
83
printf("fd %d %p\n", fd[i], pp[i]);
test/stress/webstress/webstress.c
299
int fd;
test/stress/webstress/webstress.c
333
if ((fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
test/stress/webstress/webstress.c
337
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one));
test/stress/webstress/webstress.c
339
if (connect(fd, (void *)&node->url_sin, node->url_sin.sin_len) < 0) {
test/stress/webstress/webstress.c
347
close(fd);
test/stress/webstress/webstress.c
350
if ((fp = fdopen(fd, "r+")) == NULL) {
test/sysperf/lockmgr2.c
22
int fd;
test/sysperf/lockmgr2.c
33
fd = open("/tmp/lockmgr2.test", O_RDONLY, 0666);
test/sysperf/lockmgr2.c
34
assert(fd >= 0);
test/sysperf/lockmgr2.c
35
fstat(fd, &st);
test/sysperf/lockmgr2.c
36
close(fd);
test/sysperf/lockmgr2.c
40
close(fd);
test/sysperf/lockmgr2.c
53
fd = open(path, O_RDONLY, 0666);
test/sysperf/lockmgr2.c
54
assert(fd >= 0);
test/sysperf/lockmgr2.c
55
fstat(fd, &st);
test/sysperf/lockmgr2.c
56
close(fd);
test/sysperf/lockmgr3.c
22
int fd;
test/sysperf/lockmgr3.c
30
fd = open("/tmp/lockmgr3.test", O_RDWR|O_CREAT, 0666);
test/sysperf/lockmgr3.c
31
assert(fd >= 0);
test/sysperf/lockmgr3.c
34
fstat(fd, &st);
test/sysperf/lockmgr3.c
35
fstat(fd, &st);
test/sysperf/lockmgr3.c
36
fstat(fd, &st);
test/sysperf/lockmgr3.c
37
fstat(fd, &st);
test/sysperf/lockmgr3.c
41
close(fd);
test/sysperf/lockmgr3.c
52
fd = open(path, O_RDWR|O_CREAT, 0666);
test/sysperf/lockmgr3.c
53
assert(fd >= 0);
test/sysperf/lockmgr3.c
55
fstat(fd, &st);
test/sysperf/lockmgr3.c
56
fstat(fd, &st);
test/sysperf/lockmgr3.c
57
fstat(fd, &st);
test/sysperf/lockmgr3.c
58
fstat(fd, &st);
test/sysperf/loop4.c
22
int fd;
test/sysperf/loop4.c
59
int fd = open("/usr/share/dict/words", O_RDONLY);
test/sysperf/loop4.c
62
if (fd < 0)
test/sysperf/loop4.c
69
close(fd);
test/sysperf/randread.c
104
close(fd);
test/sysperf/randread.c
105
fd = open(av[1], O_RDONLY);
test/sysperf/randread.c
127
lseek(fd, pos, 0);
test/sysperf/randread.c
128
read(fd, buf, bytes);
test/sysperf/randread.c
42
int fd;
test/sysperf/randread.c
86
fd = open(av[1], O_RDONLY);
test/sysperf/randread.c
87
if (fd < 0) {
test/sysperf/randread.c
92
lseek(fd, 0L, 2);
test/sysperf/randread.c
93
limit = lseek(fd, 0L, 1);
test/sysperf/read1.c
20
int fd;
test/sysperf/read1.c
46
fd = open(filename, O_RDWR|O_CREAT|O_TRUNC, 0666);
test/sysperf/read1.c
47
if (fd < 0) {
test/sysperf/read1.c
50
fd = open(filename, O_RDWR|O_CREAT|O_TRUNC, 0666);
test/sysperf/read1.c
52
if (fd < 0) {
test/sysperf/read1.c
59
if (write(fd, Buf, n) != n) {
test/sysperf/read1.c
60
close(fd);
test/sysperf/read1.c
66
fsync(fd);
test/sysperf/read1.c
67
fsync(fd);
test/sysperf/read1.c
69
fsync(fd);
test/sysperf/read1.c
70
lseek(fd, 0L, 0);
test/sysperf/read1.c
77
if (read(fd, &c, 1) != 1)
test/sysperf/read1.c
78
lseek(fd, 0L, 0);
test/sysperf/read1.c
82
lseek(fd, 0L, 0);
test/sysperf/read1.c
85
if (read(fd, &c, 1) != 1)
test/sysperf/read1.c
86
lseek(fd, 0L, 0);
test/testcases/io/poll_1/poll_1.c
18
fds[0].fd = p;
test/testcases/io/select_2/select_2.c
11
int result, fd;
test/testcases/io/select_2/select_2.c
15
if ((fd = mkstemp(tmpstr)) < 0) {
test/testcases/io/select_2/select_2.c
20
lseek(fd, 0, SEEK_END);
test/testcases/io/select_2/select_2.c
23
FD_SET(fd, &rset);
test/testcases/io/select_2/select_2.c
25
result = select(fd + 1, &rset, 0, 0, 0);
test/testcases/io/select_3/select_3.c
16
int fd[MANY+3], i, maxfd;
test/testcases/io/select_3/select_3.c
20
if ((fd[i] = socket(PF_INET, SOCK_DGRAM, 0)) == -1)
test/testcases/io/select_3/select_3.c
23
FD_SET(fd[i], &write_fds);
test/testcases/io/select_3/select_3.c
24
maxfd = fd[i];
test/testcases/io/sendfd_1/sendfd_1.c
32
sendfd(int s, int fd)
test/testcases/io/sendfd_1/sendfd_1.c
55
memmove(CMSG_DATA(cmsg), &fd, sizeof(int));
test/testcases/io/sendfd_1/sendfd_1.c
66
int fd;
test/testcases/io/sendfd_1/sendfd_1.c
91
memmove(&fd, CMSG_DATA(cmsg), sizeof(int));
test/testcases/io/sendfd_1/sendfd_1.c
92
return fd;
test/testcases/mem/mmap_madvise_1/mmap_madvise_1.c
28
int fd;
test/testcases/mem/mmap_madvise_1/mmap_madvise_1.c
39
fd = open(tmpfile, O_RDWR | O_CREAT | O_TRUNC, 0777);
test/testcases/mem/mmap_madvise_1/mmap_madvise_1.c
40
if (fd == -1)
test/testcases/mem/mmap_madvise_1/mmap_madvise_1.c
44
write(fd, teststring, strlen(teststring));
test/testcases/mem/mmap_madvise_1/mmap_madvise_1.c
45
fsync(fd);
test/testcases/mem/mmap_madvise_1/mmap_madvise_1.c
47
mem = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
test/testcases/mem/mmap_madvise_1/mmap_madvise_1.c
92
close(fd);
test/testcases/priv/setreuid/setreuid.c
22
int fd;
test/testcases/priv/setreuid/setreuid.c
29
fd = open("/etc/hosts", O_RDONLY);
test/testcases/priv/setreuid/setreuid.c
31
close(fd), fd = -1; /* move this above the previous line */
test/unix/passdesc/passdesc.c
113
int s[2], fd, status, n, discard, skipfd;
test/unix/passdesc/passdesc.c
166
fd = open(TEST_FILENAME, O_RDWR | O_TRUNC | O_CREAT,
test/unix/passdesc/passdesc.c
168
if (fd < 0)
test/unix/passdesc/passdesc.c
171
n = write(fd, TEST_FILENAME, strlen(TEST_FILENAME));
test/unix/passdesc/passdesc.c
177
ofs = lseek(fd, 0, SEEK_SET);
test/unix/passdesc/passdesc.c
183
test_send_desc(s[0], fd);
test/unix/passdesc/passdesc.c
20
test_send_desc(int s, int fd)
test/unix/passdesc/passdesc.c
45
*((int *)CMSG_DATA(cm)) = fd;
test/unix/passdesc/passdesc.c
52
close(fd);
test/unix/passdesc/passdesc.c
65
int n, fd;
test/unix/passdesc/passdesc.c
93
fd = *((int *)CMSG_DATA(cm));
test/unix/passdesc/passdesc.c
95
n = read(fd, data, sizeof(data) - 1);
tools/multimedia/cxm/extract_fw/cxm_extract_fw.c
118
int fd, i;
tools/multimedia/cxm/extract_fw/cxm_extract_fw.c
130
if ((fd = open(argv[i], O_RDONLY)) < 0)
tools/multimedia/cxm/extract_fw/cxm_extract_fw.c
136
if (fstat(fd, &statbuf) < 0) {
tools/multimedia/cxm/extract_fw/cxm_extract_fw.c
137
close(fd);
tools/multimedia/cxm/extract_fw/cxm_extract_fw.c
145
PROT_READ, MAP_SHARED, fd, (off_t) 0))) {
tools/multimedia/cxm/extract_fw/cxm_extract_fw.c
146
close(fd);
tools/multimedia/cxm/extract_fw/cxm_extract_fw.c
151
close(fd);
tools/regression/nfsmmap/test1/test1.c
12
int fd, fd2;
tools/regression/nfsmmap/test1/test1.c
21
fd = open("test1.data", O_RDWR|O_CREAT, 0666);
tools/regression/nfsmmap/test1/test1.c
22
if (fd < 0)
tools/regression/nfsmmap/test1/test1.c
24
if (write(fd, zeros, sizeof zeros) < 0)
tools/regression/nfsmmap/test1/test1.c
26
close(fd);
tools/regression/nfsmmap/test1/test1.c
29
fd = open("test1.data", O_RDWR);
tools/regression/nfsmmap/test1/test1.c
30
if (fd < 0)
tools/regression/nfsmmap/test1/test1.c
32
if (lseek(fd, 600, SEEK_SET) < 0)
tools/regression/nfsmmap/test1/test1.c
35
if (write(fd, ones, sizeof ones) < 0)
tools/regression/nfsmmap/test1/test1.c
38
fsync(fd);
tools/regression/nfsmmap/test1/test1.c
40
addr = mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
tools/regression/nfsmmap/test2/test2.c
12
int fd, fd2;
tools/regression/nfsmmap/test2/test2.c
21
fd = open("test2.data", O_RDWR|O_CREAT, 0666);
tools/regression/nfsmmap/test2/test2.c
22
if (fd < 0)
tools/regression/nfsmmap/test2/test2.c
24
if (write(fd, zeros, sizeof zeros) < 0)
tools/regression/nfsmmap/test2/test2.c
26
close(fd);
tools/regression/nfsmmap/test2/test2.c
29
fd = open("test2.data", O_RDWR);
tools/regression/nfsmmap/test2/test2.c
30
if (fd < 0)
tools/regression/nfsmmap/test2/test2.c
32
if (lseek(fd, 600, SEEK_SET) < 0)
tools/regression/nfsmmap/test2/test2.c
35
if (write(fd, ones, sizeof ones) < 0)
tools/regression/nfsmmap/test2/test2.c
38
addr = mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
tools/regression/p1003_1b/sched.c
214
int fd;
tools/regression/p1003_1b/sched.c
221
q(__LINE__, (fd = open(nam, O_RDWR|O_CREAT, 0666)),
tools/regression/p1003_1b/sched.c
228
write(fd, &p, sizeof(p));
tools/regression/p1003_1b/sched.c
231
MAP_SHARED, fd, 0)), "mmap");
tools/tools/ath/athdecode/main.c
109
opmark(FILE *fd, int i, const struct athregrec *r)
tools/tools/ath/athdecode/main.c
111
fprintf(fd, "\n%05d: ", i);
tools/tools/ath/athdecode/main.c
114
fprintf(fd, "ar%uReset %s", state.chipnum,
tools/tools/ath/athdecode/main.c
118
fprintf(fd, "ar%u_reset.c; line %u", state.chipnum, r->val);
tools/tools/ath/athdecode/main.c
122
fprintf(fd, "ar%uReset (done), FAIL, error %u",
tools/tools/ath/athdecode/main.c
125
fprintf(fd, "ar%uReset (done), OK", state.chipnum);
tools/tools/ath/athdecode/main.c
128
fprintf(fd, "ar%uChipReset, channel %u MHz", state.chipnum, r->val);
tools/tools/ath/athdecode/main.c
131
fprintf(fd, "ar%uPerCalibration, channel %u MHz", state.chipnum, r->val);
tools/tools/ath/athdecode/main.c
134
fprintf(fd, "ar%uSetChannel, channel %u MHz", state.chipnum, r->val);
tools/tools/ath/athdecode/main.c
139
fprintf(fd, "ar%uAniReset, HAL_M_STA", state.chipnum);
tools/tools/ath/athdecode/main.c
142
fprintf(fd, "ar%uAniReset, HAL_M_IBSS", state.chipnum);
tools/tools/ath/athdecode/main.c
145
fprintf(fd, "ar%uAniReset, HAL_M_HOSTAP", state.chipnum);
tools/tools/ath/athdecode/main.c
148
fprintf(fd, "ar%uAniReset, HAL_M_MONITOR", state.chipnum);
tools/tools/ath/athdecode/main.c
151
fprintf(fd, "ar%uAniReset, opmode %u", state.chipnum, r->val);
tools/tools/ath/athdecode/main.c
156
fprintf(fd, "ar%uAniPoll, listenTime %u", state.chipnum, r->val);
tools/tools/ath/athdecode/main.c
161
fprintf(fd, "ar%uAniControl, PRESENT", state.chipnum);
tools/tools/ath/athdecode/main.c
164
fprintf(fd, "ar%uAniControl, NOISE_IMMUNITY", state.chipnum);
tools/tools/ath/athdecode/main.c
167
fprintf(fd, "ar%uAniControl, OFDM_WEAK_SIGNAL", state.chipnum);
tools/tools/ath/athdecode/main.c
170
fprintf(fd, "ar%uAniControl, CCK_WEAK_SIGNAL", state.chipnum);
tools/tools/ath/athdecode/main.c
173
fprintf(fd, "ar%uAniControl, FIRSTEP_LEVEL", state.chipnum);
tools/tools/ath/athdecode/main.c
176
fprintf(fd, "ar%uAniControl, SPUR_IMMUNITY", state.chipnum);
tools/tools/ath/athdecode/main.c
179
fprintf(fd, "ar%uAniControl, MODE", state.chipnum);
tools/tools/ath/athdecode/main.c
182
fprintf(fd, "ar%uAniControl, PHYERR_RESET", state.chipnum);
tools/tools/ath/athdecode/main.c
185
fprintf(fd, "ar%uAniControl, cmd %u", state.chipnum, r->val);
tools/tools/ath/athdecode/main.c
190
fprintf(fd, "mark #%u value %u/0x%x", r->reg, r->val, r->val);
tools/tools/ath/athdecode/main.c
369
oprw(FILE *fd, int recnum, struct athregrec *r)
tools/tools/ath/athdecode/main.c
376
fprintf(fd, "\n%05d: ", recnum);
tools/tools/ath/athdecode/main.c
404
fprintf(fd, "%-30s %s 0x%x", buf, r->op ? "<=" : "=>", r->val);
tools/tools/ath/athdecode/main.c
412
putc(tmp ? ',' : '<', fd);
tools/tools/ath/athdecode/main.c
414
putc(n, fd);
tools/tools/ath/athdecode/main.c
421
putc('>', fd);
tools/tools/ath/athdecode/main.c
55
static void oprw(FILE *fd, int recnum, struct athregrec *r);
tools/tools/ath/athdecode/main.c
60
int fd, i, nrecs, same;
tools/tools/ath/athdecode/main.c
68
fd = open(filename, O_RDONLY);
tools/tools/ath/athdecode/main.c
69
if (fd < 0)
tools/tools/ath/athdecode/main.c
71
if (fstat(fd, &sb) < 0)
tools/tools/ath/athdecode/main.c
73
addr = mmap(0, sb.st_size, PROT_READ, MAP_PRIVATE|MAP_NOCORE, fd, 0);
tools/tools/ath/athpow/athpow.c
139
printPcdacTable(FILE *fd, u_int16_t pcdac[], u_int n)
tools/tools/ath/athpow/athpow.c
144
fprintf(fd, "[%2u] %04x %04x [%2u] %04x %04x\n",
tools/tools/ath/athpow/athpow.c
150
printPowerPerRate(FILE *fd, u_int16_t ratesArray[], u_int n)
tools/tools/ath/athpow/athpow.c
161
fprintf(fd, " %s %3d.%1d dBm | %s %3d.%1d dBm\n",
tools/tools/ath/athpow/athpow.c
170
printRevs(FILE *fd, const HAL_REVS *revs)
tools/tools/ath/athpow/athpow.c
174
fprintf(fd, "PCI device id 0x%x subvendor id 0x%x\n",
tools/tools/ath/athpow/athpow.c
176
fprintf(fd, "mac %d.%d phy %d.%d"
tools/tools/ath/athpow/athpow.c
185
fprintf(fd, " 5ghz radio %d.%d 2ghz radio %d.%d (%s)\n"
tools/tools/ath/athpow/athpow.c
193
fprintf(fd, " radio %d.%d (%s)\n"
tools/tools/ath/athpow/athpow.c
62
static void printPcdacTable(FILE *fd, u_int16_t pcdac[], u_int n);
tools/tools/ath/athpow/athpow.c
63
static void printPowerPerRate(FILE *fd, u_int16_t ratesArray[], u_int n);
tools/tools/ath/athpow/athpow.c
64
static void printRevs(FILE *fd, const HAL_REVS *revs);
tools/tools/ath/athprom/athprom.c
114
fd = fopen(optarg, "r");
tools/tools/ath/athprom/athprom.c
115
if (fd == NULL)
tools/tools/ath/athprom/athprom.c
162
if (fd == NULL) {
tools/tools/ath/athprom/athprom.c
163
fd = opentemplate(DIR_TEMPLATE);
tools/tools/ath/athprom/athprom.c
164
if (fd == NULL)
tools/tools/ath/athprom/athprom.c
165
fd = opentemplate(".");
tools/tools/ath/athprom/athprom.c
166
if (fd == NULL)
tools/tools/ath/athprom/athprom.c
171
parseTemplate(fd, stdout);
tools/tools/ath/athprom/athprom.c
172
fclose(fd);
tools/tools/ath/athprom/athprom.c
226
token(FILE *fd, char id[], int maxid, const char *what)
tools/tools/ath/athprom/athprom.c
232
c = getc(fd);
tools/tools/ath/athprom/athprom.c
236
ungetc(c, fd);
tools/tools/ath/athprom/athprom.c
252
skipto(FILE *fd, const char *what)
tools/tools/ath/athprom/athprom.c
258
c = getc(fd);
tools/tools/ath/athprom/athprom.c
262
if (token(fd, id, MAXID, ".directive") == EOF)
tools/tools/ath/athprom/athprom.c
269
c = getc(fd);
tools/tools/ath/athprom/athprom.c
284
skipws(FILE *fd)
tools/tools/ath/athprom/athprom.c
289
while ((c = getc(fd)) != EOF && isblank(c))
tools/tools/ath/athprom/athprom.c
292
ungetc(c, fd);
tools/tools/ath/athprom/athprom.c
378
printAntennaControl(FILE *fd, int ant)
tools/tools/ath/athprom/athprom.c
380
fprintf(fd, "0x%02X", eeprom.ee_antennaControl[ant][curmode]);
tools/tools/ath/athprom/athprom.c
384
printEdge(FILE *fd, int edge)
tools/tools/ath/athprom/athprom.c
390
fprintf(fd, " -- ");
tools/tools/ath/athprom/athprom.c
392
fprintf(fd, "%04d", pRdEdgePwrInfo[edge].rdEdge);
tools/tools/ath/athprom/athprom.c
396
printEdgePower(FILE *fd, int edge)
tools/tools/ath/athprom/athprom.c
402
fprintf(fd, " -- ");
tools/tools/ath/athprom/athprom.c
404
fprintf(fd, "%2d.%d",
tools/tools/ath/athprom/athprom.c
410
printEdgeFlag(FILE *fd, int edge)
tools/tools/ath/athprom/athprom.c
416
fprintf(fd, "--");
tools/tools/ath/athprom/athprom.c
418
fprintf(fd, " %1d", pRdEdgePwrInfo[edge].flag);
tools/tools/ath/athprom/athprom.c
436
printQuarterDbmPower(FILE *fd, int16_t power25dBm)
tools/tools/ath/athprom/athprom.c
438
fprintf(fd, "%2d.%02d", power25dBm / 4, (power25dBm % 4) * 25);
tools/tools/ath/athprom/athprom.c
442
printHalfDbmPower(FILE *fd, int16_t power5dBm)
tools/tools/ath/athprom/athprom.c
444
fprintf(fd, "%2d.%d", power5dBm / 2, (power5dBm % 2) * 5);
tools/tools/ath/athprom/athprom.c
448
printVpd(FILE *fd, int vpd)
tools/tools/ath/athprom/athprom.c
450
fprintf(fd, "[%3d]", vpd);
tools/tools/ath/athprom/athprom.c
454
printPcdacValue(FILE *fd, int v)
tools/tools/ath/athprom/athprom.c
456
fprintf(fd, "%2d.%02d", v / EEP_SCALE, v % EEP_SCALE);
tools/tools/ath/athprom/athprom.c
487
eevar(FILE *fd, const char *var)
tools/tools/ath/athprom/athprom.c
492
fprintf(fd, "%s",
tools/tools/ath/athprom/athprom.c
497
fprintf(fd, "%04x", eeprom.ee_version);
tools/tools/ath/athprom/athprom.c
499
fprintf(fd, "%2d", eeprom.ee_version >> 12);
tools/tools/ath/athprom/athprom.c
501
fprintf(fd, "%2d", eeprom.ee_version & 0xfff);
tools/tools/ath/athprom/athprom.c
503
fprintf(fd, "%03x", eeprom.ee_earStart);
tools/tools/ath/athprom/athprom.c
505
fprintf(fd, "%03x", eeprom.ee_targetPowersStart);
tools/tools/ath/athprom/athprom.c
507
fprintf(fd, "%3d", eeprom.ee_eepMap);
tools/tools/ath/athprom/athprom.c
509
fprintf(fd, "%3d", eeprom.ee_exist32kHzCrystal);
tools/tools/ath/athprom/athprom.c
511
fprintf(fd , "%3d", eeprom.ee_eepMap2PowerCalStart);
tools/tools/ath/athprom/athprom.c
513
fprintf(fd , "%1d", eeprom.ee_Amode);
tools/tools/ath/athprom/athprom.c
515
fprintf(fd , "%1d", eeprom.ee_Bmode);
tools/tools/ath/athprom/athprom.c
517
fprintf(fd , "%1d", eeprom.ee_Gmode);
tools/tools/ath/athprom/athprom.c
520
fprintf(fd, "%03X ", eeprom.ee_regdomain >> 15);
tools/tools/ath/athprom/athprom.c
522
fprintf(fd, "%-3dC", eeprom.ee_regdomain & 0xfff);
tools/tools/ath/athprom/athprom.c
524
fprintf(fd, "%1d", eeprom.ee_turbo2Disable);
tools/tools/ath/athprom/athprom.c
526
fprintf(fd, "%1d", eeprom.ee_turbo5Disable);
tools/tools/ath/athprom/athprom.c
528
fprintf(fd, "%1d", eeprom.ee_rfKill);
tools/tools/ath/athprom/athprom.c
530
fprintf(fd, "%1d", eeprom.ee_disableXr5);
tools/tools/ath/athprom/athprom.c
532
fprintf(fd, "%1d", eeprom.ee_disableXr2);
tools/tools/ath/athprom/athprom.c
534
fprintf(fd, "%2d", eeprom.ee_turbo2WMaxPower5);
tools/tools/ath/athprom/athprom.c
536
fprintf(fd, "%2d", eeprom.ee_cckOfdmPwrDelta);
tools/tools/ath/athprom/athprom.c
538
fprintf(fd, "%2d", eeprom.ee_gainI[curmode]);
tools/tools/ath/athprom/athprom.c
540
fprintf(fd, "%1x",
tools/tools/ath/athprom/athprom.c
543
fprintf(fd, "0x%02x", eeprom.ee_falseDetectBackoff[curmode]);
tools/tools/ath/athprom/athprom.c
545
fprintf(fd, "%1x", eeprom.ee_deviceType);
tools/tools/ath/athprom/athprom.c
548
fprintf(fd, "0x%02x", eeprom.ee_switchSettling[curmode]);
tools/tools/ath/athprom/athprom.c
550
fprintf(fd, "%3d", eepromN.modalHeader[curmode].switchSettling);
tools/tools/ath/athprom/athprom.c
553
fprintf(fd, "%2d", eeprom.ee_adcDesiredSize[curmode]);
tools/tools/ath/athprom/athprom.c
555
fprintf(fd, "%3d", eepromN.modalHeader[curmode].adcDesiredSize);
tools/tools/ath/athprom/athprom.c
557
fprintf(fd, "0x%02x", eeprom.ee_xlnaGain[curmode]);
tools/tools/ath/athprom/athprom.c
559
fprintf(fd, "0x%02x", eeprom.ee_txEndToXLNAOn[curmode]);
tools/tools/ath/athprom/athprom.c
562
fprintf(fd, "0x%02x", eeprom.ee_thresh62[curmode]);
tools/tools/ath/athprom/athprom.c
564
fprintf(fd, "%3d", eepromN.modalHeader[curmode].thresh62);
tools/tools/ath/athprom/athprom.c
566
fprintf(fd, "%3d", eepromN.modalHeader[curmode].txEndToRxOn);
tools/tools/ath/athprom/athprom.c
569
fprintf(fd, "0x%02x", eeprom.ee_txEndToXPAOff[curmode]);
tools/tools/ath/athprom/athprom.c
571
fprintf(fd, "%3d", eepromN.modalHeader[curmode].txEndToXpaOff);
tools/tools/ath/athprom/athprom.c
574
fprintf(fd, "0x%02x", eeprom.ee_txFrameToXPAOn[curmode]);
tools/tools/ath/athprom/athprom.c
576
fprintf(fd, "%3d", eepromN.modalHeader[curmode].txEndToRxOn);
tools/tools/ath/athprom/athprom.c
579
fprintf(fd, "%2d", eeprom.ee_pgaDesiredSize[curmode]);
tools/tools/ath/athprom/athprom.c
581
fprintf(fd, "%3d", eepromN.modalHeader[curmode].pgaDesiredSize);
tools/tools/ath/athprom/athprom.c
583
fprintf(fd, "%3d", eeprom.ee_noiseFloorThresh[curmode]);
tools/tools/ath/athprom/athprom.c
585
fprintf(fd, "%3d", eepromN.modalHeader[curmode].noiseFloorThreshCh[atoi(var+18)]);
tools/tools/ath/athprom/athprom.c
587
fprintf(fd, "%3d", eepromN.modalHeader[curmode].xlnaGainCh[atoi(var+10)]);
tools/tools/ath/athprom/athprom.c
589
fprintf(fd, "0x%02x", eeprom.ee_xgain[curmode]);
tools/tools/ath/athprom/athprom.c
592
fprintf(fd, "%1d", eeprom.ee_xpd[curmode]);
tools/tools/ath/athprom/athprom.c
594
fprintf(fd, "%3d", eepromN.modalHeader[curmode].xpd);
tools/tools/ath/athprom/athprom.c
596
fprintf(fd, "0x%02x", eeprom.ee_txrxAtten[curmode]);
tools/tools/ath/athprom/athprom.c
598
fprintf(fd, "0x%04X", eeprom.ee_capField);
tools/tools/ath/athprom/athprom.c
600
fprintf(fd, "0x%02x",
tools/tools/ath/athprom/athprom.c
603
fprintf(fd, "0x%02X",
tools/tools/ath/athprom/athprom.c
606
fprintf(fd, "%2d",
tools/tools/ath/athprom/athprom.c
609
fprintf(fd, "%2d",
tools/tools/ath/athprom/athprom.c
61
static void parseTemplate(FILE *ftemplate, FILE *fd);
tools/tools/ath/athprom/athprom.c
612
fprintf(fd, "0x%02x",
tools/tools/ath/athprom/athprom.c
615
printAntennaControl(fd, atoi(var+14));
tools/tools/ath/athprom/athprom.c
617
fprintf(fd, "0x%08X",
tools/tools/ath/athprom/athprom.c
620
fprintf(fd, "%3d",
tools/tools/ath/athprom/athprom.c
623
fprintf(fd, "%3d",
tools/tools/ath/athprom/athprom.c
626
fprintf(fd, "%3d",
tools/tools/ath/athprom/athprom.c
629
fprintf(fd, "%3d", eepromN.modalHeader[curmode].xpdGain);
tools/tools/ath/athprom/athprom.c
631
fprintf(fd, "%3d",
tools/tools/ath/athprom/athprom.c
634
fprintf(fd, "%3d",
tools/tools/ath/athprom/athprom.c
637
printHalfDbmPower(fd, eepromN.modalHeader[curmode].pdGainOverlap);
tools/tools/ath/athprom/athprom.c
639
fprintf(fd, "%1d", eeprom.ee_ob1);
tools/tools/ath/athprom/athprom.c
641
fprintf(fd, "%1d", eeprom.ee_ob2);
tools/tools/ath/athprom/athprom.c
643
fprintf(fd, "%1d", eeprom.ee_ob3);
tools/tools/ath/athprom/athprom.c
645
fprintf(fd, "%1d", eeprom.ee_ob4);
tools/tools/ath/athprom/athprom.c
647
fprintf(fd, "%1d", eeprom.ee_db1);
tools/tools/ath/athprom/athprom.c
649
fprintf(fd, "%1d", eeprom.ee_db2);
tools/tools/ath/athprom/athprom.c
651
fprintf(fd, "%1d", eeprom.ee_db3);
tools/tools/ath/athprom/athprom.c
653
fprintf(fd, "%1d", eeprom.ee_db4);
tools/tools/ath/athprom/athprom.c
655
fprintf(fd, "%1d", eeprom.ee_obFor24);
tools/tools/ath/athprom/athprom.c
657
fprintf(fd, "%1d", eeprom.ee_ob2GHz[0]);
tools/tools/ath/athprom/athprom.c
659
fprintf(fd, "%1d", eeprom.ee_dbFor24);
tools/tools/ath/athprom/athprom.c
661
fprintf(fd, "%1d", eeprom.ee_db2GHz[0]);
tools/tools/ath/athprom/athprom.c
663
fprintf(fd, "%1d", eeprom.ee_obFor24g);
tools/tools/ath/athprom/athprom.c
665
fprintf(fd, "%1d", eeprom.ee_ob2GHz[1]);
tools/tools/ath/athprom/athprom.c
667
fprintf(fd, "%1d", eeprom.ee_dbFor24g);
tools/tools/ath/athprom/athprom.c
669
fprintf(fd, "%1d", eeprom.ee_db2GHz[1]);
tools/tools/ath/athprom/athprom.c
671
fprintf(fd, "%3d", eepromN.modalHeader[curmode].ob);
tools/tools/ath/athprom/athprom.c
673
fprintf(fd, "%3d", eepromN.modalHeader[curmode].db);
tools/tools/ath/athprom/athprom.c
675
fprintf(fd, "%3d", eepromN.modalHeader[curmode].xpaBiasLvl);
tools/tools/ath/athprom/athprom.c
677
printHalfDbmPower(fd, eepromN.modalHeader[curmode].pwrDecreaseFor2Chain);
tools/tools/ath/athprom/athprom.c
679
printHalfDbmPower(fd, eepromN.modalHeader[curmode].pwrDecreaseFor3Chain);
tools/tools/ath/athprom/athprom.c
681
fprintf(fd, "%3d", eepromN.modalHeader[curmode].txFrameToDataStart);
tools/tools/ath/athprom/athprom.c
683
fprintf(fd, "%3d", eepromN.modalHeader[curmode].txFrameToPaOn);
tools/tools/ath/athprom/athprom.c
685
fprintf(fd, "%3d", eepromN.modalHeader[curmode].ht40PowerIncForPdadc);
tools/tools/ath/athprom/athprom.c
687
fprintf(fd, "0x%04X", eepromN.baseEepHeader.checksum);
tools/tools/ath/athprom/athprom.c
689
fprintf(fd, "0x%04X", eepromN.baseEepHeader.length);
tools/tools/ath/athprom/athprom.c
691
fprintf(fd, "0x%04X", eepromN.baseEepHeader.regDmn[0]);
tools/tools/ath/athprom/athprom.c
693
fprintf(fd, "0x%04X", eepromN.baseEepHeader.regDmn[1]);
tools/tools/ath/athprom/athprom.c
695
fprintf(fd, "0x%04X", eepromN.baseEepHeader.txMask);
tools/tools/ath/athprom/athprom.c
697
fprintf(fd, "0x%04X", eepromN.baseEepHeader.rxMask);
tools/tools/ath/athprom/athprom.c
699
fprintf(fd, "0x%04X", eepromN.baseEepHeader.rfSilent);
tools/tools/ath/athprom/athprom.c
701
fprintf(fd, "0x%04X", eepromN.baseEepHeader.blueToothOptions);
tools/tools/ath/athprom/athprom.c
703
fprintf(fd, "0x%04X", eepromN.baseEepHeader.deviceCap);
tools/tools/ath/athprom/athprom.c
705
fprintf(fd, "%02X",
tools/tools/ath/athprom/athprom.c
708
fprintf(fd, "0x%02X", eepromN.baseEepHeader.opCapFlags);
tools/tools/ath/athprom/athprom.c
710
fprintf(fd, "0x%02X", eepromN.baseEepHeader.eepMisc);
tools/tools/ath/athprom/athprom.c
712
fprintf(fd, "%3d",
tools/tools/ath/athprom/athprom.c
716
fprintf(fd, "%2.2X", eepromN.custData[atoi(var+8)]);
tools/tools/ath/athprom/athprom.c
719
fprintf(fd, "0x%02x", pExpnPower->xpdMask);
tools/tools/ath/athprom/athprom.c
721
fprintf(fd, "0x%02x", pRaw->xpd_mask);
tools/tools/ath/athprom/athprom.c
724
fprintf(fd, "%2d", pExpnPower->numChannels);
tools/tools/ath/athprom/athprom.c
726
fprintf(fd, "%2d", pRaw->numChannels);
tools/tools/ath/athprom/athprom.c
729
fprintf(fd, "%4d", pExpnPower->pChannels[curchan]);
tools/tools/ath/athprom/athprom.c
731
fprintf(fd, "%4d", pRaw->pChannels[curchan]);
tools/tools/ath/athprom/athprom.c
741
printQuarterDbmPower(fd, maxPower_t4);
tools/tools/ath/athprom/athprom.c
743
fprintf(fd, "%4d", pRaw->pDataPerChannel[curchan].
tools/tools/ath/athprom/athprom.c
748
printQuarterDbmPower(fd, pRaw->pDataPerChannel[curchan].
tools/tools/ath/athprom/athprom.c
751
fprintf(fd, " ");
tools/tools/ath/athprom/athprom.c
753
printQuarterDbmPower(fd, pExpnPower->pDataPerChannel[curchan].
tools/tools/ath/athprom/athprom.c
758
printVpd(fd, pRaw->pDataPerChannel[curchan].
tools/tools/ath/athprom/athprom.c
76
FILE *fd;
tools/tools/ath/athprom/athprom.c
761
fprintf(fd, " ");
tools/tools/ath/athprom/athprom.c
763
fprintf(fd, "0x%2x", eeprom.ee_ctl[curctl] & 0xff);
tools/tools/ath/athprom/athprom.c
770
fprintf(fd, "%8s", ctlType[eeprom.ee_ctl[curctl] & CTL_MODE_M]);
tools/tools/ath/athprom/athprom.c
776
fprintf(fd, "%s", ctlRD[(eeprom.ee_ctl[curctl] >> 4) & 7]);
tools/tools/ath/athprom/athprom.c
778
printEdgePower(fd, atoi(var+11));
tools/tools/ath/athprom/athprom.c
780
printEdgeFlag(fd, atoi(var+10));
tools/tools/ath/athprom/athprom.c
782
printEdge(fd, atoi(var+6));
tools/tools/ath/athprom/athprom.c
784
fprintf(fd, "%4d", pPowerInfo[atoi(var+11)].testChannel);
tools/tools/ath/athprom/athprom.c
786
printHalfDbmPower(fd, pPowerInfo[atoi(var+8)].twicePwr6_24);
tools/tools/ath/athprom/athprom.c
788
printHalfDbmPower(fd, pPowerInfo[atoi(var+6)].twicePwr36);
tools/tools/ath/athprom/athprom.c
790
printHalfDbmPower(fd, pPowerInfo[atoi(var+6)].twicePwr48);
tools/tools/ath/athprom/athprom.c
792
printHalfDbmPower(fd, pPowerInfo[atoi(var+6)].twicePwr54);
tools/tools/ath/athprom/athprom.c
794
fprintf(fd, "%4d", pDataPerChannel[atoi(var+12)].channelValue);
tools/tools/ath/athprom/athprom.c
796
fprintf(fd, "%02d", pDataPerChannel[atoi(var+8)].pcdacMin);
tools/tools/ath/athprom/athprom.c
798
fprintf(fd, "%02d", pDataPerChannel[atoi(var+8)].pcdacMax);
tools/tools/ath/athprom/athprom.c
801
fprintf(fd, "%02d", pDataPerChannel[atoi(var+5)].
tools/tools/ath/athprom/athprom.c
804
fprintf(fd, "%02d",
tools/tools/ath/athprom/athprom.c
81
fd = fopen(filename, "r");
tools/tools/ath/athprom/athprom.c
810
printPcdacValue(fd,
tools/tools/ath/athprom/athprom.c
813
fprintf(fd, "%2d", singleXpd);
tools/tools/ath/athprom/athprom.c
82
if (fd == NULL && errno == ENOENT) {
tools/tools/ath/athprom/athprom.c
86
fd = fopen(filename, "r");
tools/tools/ath/athprom/athprom.c
868
parseTemplate(FILE *ftemplate, FILE *fd)
tools/tools/ath/athprom/athprom.c
87
if (fd != NULL) /* XXX verbose */
tools/tools/ath/athprom/athprom.c
90
return fd;
tools/tools/ath/athprom/athprom.c
96
FILE *fd = NULL;
tools/tools/ath/athprom/athprom.c
965
eevar(fd, id);
tools/tools/ath/athprom/athprom.c
973
fputc(c, fd);
tools/tools/ath/athregs/dumpregs.c
434
ath_hal_dumpregs(FILE *fd, int what)
tools/tools/ath/athregs/dumpregs.c
448
fprintf(fd, "%s%-8s", sep, dr->name);
tools/tools/ath/athregs/dumpregs.c
450
fprintf(fd, " [%04x]", dr->addr);
tools/tools/ath/athregs/dumpregs.c
452
fprintf(fd, "%s%04x", sep, dr->addr);
tools/tools/ath/athregs/dumpregs.c
453
fprintf(fd, " %08x", OS_REG_READ(ah, dr->addr));
tools/tools/ath/athregs/dumpregs.c
460
fprintf(fd, "\n");
tools/tools/ath/athregs/dumpregs.c
464
ath_hal_dumprange(FILE *fd, u_int a, u_int b)
tools/tools/ath/athregs/dumpregs.c
469
fprintf(fd,
tools/tools/ath/athregs/dumpregs.c
479
fprintf(fd
tools/tools/ath/athregs/dumpregs.c
488
fprintf(fd, "%04x %08x %04x %08x %04x %08x\n"
tools/tools/ath/athregs/dumpregs.c
495
fprintf(fd, "%04x %08x %04x %08x\n"
tools/tools/ath/athregs/dumpregs.c
501
fprintf(fd, "%04x %08x\n"
tools/tools/ath/athregs/dumpregs.c
509
ath_hal_dumpint(FILE *fd, int what)
tools/tools/ath/athregs/dumpregs.c
514
fprintf(fd, "IMR: %08x S0 %08x S1 %08x S2 %08x S3 %08x S4 %08x\n"
tools/tools/ath/athregs/dumpregs.c
522
fprintf(fd, "ISR: %08x S0 %08x S1 %08x S2 %08x S3 %08x S4 %08x\n"
tools/tools/ath/athregs/dumpregs.c
533
ath_hal_dumpqcu(FILE *fd, int what)
tools/tools/ath/athregs/dumpregs.c
538
fprintf(fd, "%-8s %08x %-8s %08x %-8s %08x\n"
tools/tools/ath/athregs/dumpregs.c
543
fprintf(fd, "Q_ONESHOTARM_SC %08x Q_ONESHOTARM_CC %08x\n"
tools/tools/ath/athregs/dumpregs.c
548
fprintf(fd, "Q[%u] TXDP %08x CBR %08x RDYT %08x MISC %08x STS %08x\n"
tools/tools/ath/athregs/dumpregs.c
559
ath_hal_dumpdcu(FILE *fd, int what)
tools/tools/ath/athregs/dumpregs.c
565
fprintf(fd, "D[%u] MASK %08x IFS %08x RTRY %08x CHNT %08x MISC %06x\n"
tools/tools/ath/athregs/dumpregs.c
576
ath_hal_dumpbb(FILE *fd, int what)
tools/tools/ath/athregs/dumpregs.c
592
ath_hal_dumprange(fd, brun, erun);
tools/tools/ath/athregs/dumpregs.c
597
ath_hal_dumprange(fd, brun, erun);
tools/tools/ath/athregs/dumpregs.c
602
ath_hal_dumprange(fd, brun, erun);
tools/tools/ath/athregs/dumpregs.c
62
static void ath_hal_dumpregs(FILE *fd, int what);
tools/tools/ath/athregs/dumpregs.c
63
static void ath_hal_dumprange(FILE *fd, u_int a, u_int b);
tools/tools/ath/athregs/dumpregs.c
64
static void ath_hal_dumpkeycache(FILE *fd, int nkeys);
tools/tools/ath/athregs/dumpregs.c
648
ath_hal_dumpkeycache(FILE *fd, int nkeys)
tools/tools/ath/athregs/dumpregs.c
65
static void ath_hal_dumpint(FILE *fd, int what);
tools/tools/ath/athregs/dumpregs.c
66
static void ath_hal_dumpqcu(FILE *fd, int what);
tools/tools/ath/athregs/dumpregs.c
67
static void ath_hal_dumpdcu(FILE *fd, int what);
tools/tools/ath/athregs/dumpregs.c
68
static void ath_hal_dumpbb(FILE *fd, int what);
tools/tools/ath/athregs/dumpregs.c
695
fprintf(fd, "\n");
tools/tools/ath/athregs/dumpregs.c
698
fprintf(fd, "KEY[%03u] MAC %s %-7s %02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x\n"
tools/tools/ath/athstats/athstats.c
949
ath_print_verbose(struct statfoo *sf, FILE *fd)
tools/tools/ath/athstats/athstats.c
970
fprintf(fd, "%s%-*s %s\n", indent, width, s, athstats[i].desc);
tools/tools/ath/athstats/athstats.c
973
fprintf(fd, "Antenna profile:\n");
tools/tools/ath/athstats/athstats.c
976
fprintf(fd, "[%u] tx %8u rx %8u\n", i,
tools/tools/ath/athstats/statfoo.c
100
putc('\n', fd);
tools/tools/ath/athstats/statfoo.c
104
statfoo_print_current(struct statfoo *sf, FILE *fd)
tools/tools/ath/athstats/statfoo.c
113
fprintf(fd, "%*s", f->width, buf);
tools/tools/ath/athstats/statfoo.c
115
putc(*cp, fd);
tools/tools/ath/athstats/statfoo.c
117
putc('\n', fd);
tools/tools/ath/athstats/statfoo.c
121
statfoo_print_total(struct statfoo *sf, FILE *fd)
tools/tools/ath/athstats/statfoo.c
130
fprintf(fd, "%*s", f->width, buf);
tools/tools/ath/athstats/statfoo.c
132
putc(*cp, fd);
tools/tools/ath/athstats/statfoo.c
134
putc('\n', fd);
tools/tools/ath/athstats/statfoo.c
138
statfoo_print_verbose(struct statfoo *sf, FILE *fd)
tools/tools/ath/athstats/statfoo.c
153
fprintf(fd, "%-*s %s\n", width, s, f->desc);
tools/tools/ath/athstats/statfoo.c
158
statfoo_print_fields(struct statfoo *sf, FILE *fd)
tools/tools/ath/athstats/statfoo.c
171
fprintf(fd, "%-*s %s\n", width, f->name, f->desc);
tools/tools/ath/athstats/statfoo.c
89
statfoo_print_header(struct statfoo *sf, FILE *fd)
tools/tools/ath/athstats/statfoo.c
96
fprintf(fd, "%*s", f->width, f->label);
tools/tools/ath/athstats/statfoo.c
98
putc(*cp, fd);
tools/tools/ath/athstats/statfoo.h
103
static void _t##_print_header(struct _t *wf, FILE *fd) \
tools/tools/ath/athstats/statfoo.h
104
{ wf->base.print_header(&wf->base, fd); } \
tools/tools/ath/athstats/statfoo.h
105
static void _t##_print_current(struct _t *wf, FILE *fd) \
tools/tools/ath/athstats/statfoo.h
106
{ wf->base.print_current(&wf->base, fd); } \
tools/tools/ath/athstats/statfoo.h
107
static void _t##_print_total(struct _t *wf, FILE *fd) \
tools/tools/ath/athstats/statfoo.h
108
{ wf->base.print_total(&wf->base, fd); } \
tools/tools/ath/athstats/statfoo.h
109
static void _t##_print_verbose(struct _t *wf, FILE *fd) \
tools/tools/ath/athstats/statfoo.h
110
{ wf->base.print_verbose(&wf->base, fd); } \
tools/tools/ath/athstats/statfoo.h
111
static void _t##_print_fields(struct _t *wf, FILE *fd) \
tools/tools/ath/athstats/statfoo.h
112
{ wf->base.print_fields(&wf->base, fd); }
tools/tools/ath/common/diag.h
57
extern void reportstats(FILE *fd, struct statshandler *sh);
tools/tools/ath/common/diag.h
58
extern void runstats(FILE *fd, struct statshandler *sh);
tools/tools/ath/common/diag.h
59
extern void reportcol(FILE *fd, u_int32_t v, const char *def_fmt,
tools/tools/net80211/stumbler/stumbler.c
306
int fd = -1;
tools/tools/net80211/stumbler/stumbler.c
312
fd = open(buf, O_RDWR);
tools/tools/net80211/stumbler/stumbler.c
313
if(fd < 0) {
tools/tools/net80211/stumbler/stumbler.c
322
if(fd < 0)
tools/tools/net80211/stumbler/stumbler.c
328
if(ioctl(fd, BIOCSETIF, &ifr) < 0)
tools/tools/net80211/stumbler/stumbler.c
331
if (ioctl(fd, BIOCSDLT, &dlt) < 0)
tools/tools/net80211/stumbler/stumbler.c
335
if(ioctl(fd, BIOCIMMEDIATE, &i) < 0)
tools/tools/net80211/stumbler/stumbler.c
338
bpf_s = fd;
tools/tools/net80211/w00t/libw00t/w00t.c
108
if(fd == -1)
tools/tools/net80211/w00t/libw00t/w00t.c
114
if(ioctl(fd, BIOCSETIF, &ifr) < 0)
tools/tools/net80211/w00t/libw00t/w00t.c
117
if (ioctl(fd, BIOCSDLT, &dlt) < 0)
tools/tools/net80211/w00t/libw00t/w00t.c
121
if (ioctl(fd, BIOCIMMEDIATE, &i) < 0)
tools/tools/net80211/w00t/libw00t/w00t.c
124
return fd;
tools/tools/net80211/w00t/libw00t/w00t.c
145
int inject(int fd, void *buf, int len)
tools/tools/net80211/w00t/libw00t/w00t.c
147
return inject_params(fd, buf, len, NULL);
tools/tools/net80211/w00t/libw00t/w00t.c
150
int inject_params(int fd, void *buf, int len,
tools/tools/net80211/w00t/libw00t/w00t.c
173
rc = writev(fd, iov, 2);
tools/tools/net80211/w00t/libw00t/w00t.c
181
int sniff(int fd, void *buf, int len)
tools/tools/net80211/w00t/libw00t/w00t.c
183
return read(fd, buf, len);
tools/tools/net80211/w00t/libw00t/w00t.c
228
int send_ack(int fd, char *mac)
tools/tools/net80211/w00t/libw00t/w00t.c
242
rc = inject(fd, buf, sizeof(buf));
tools/tools/net80211/w00t/libw00t/w00t.c
92
int fd = -1;
tools/tools/net80211/w00t/libw00t/w00t.c
98
fd = open(buf, O_RDWR);
tools/tools/net80211/w00t/libw00t/w00t.c
99
if(fd == -1) {
tools/tools/net80211/w00t/libw00t/w00t.h
39
int inject(int fd, void *buf, int len);
tools/tools/net80211/w00t/libw00t/w00t.h
40
int inject_params(int fd, void *buf, int len,
tools/tools/net80211/w00t/libw00t/w00t.h
42
int sniff(int fd, void *buf, int len);
tools/tools/net80211/w00t/libw00t/w00t.h
45
int send_ack(int fd, char *mac);
tools/tools/net80211/w00t/prga/prga.c
104
rd = read(fd, p->iv, 3);
tools/tools/net80211/w00t/prga/prga.c
112
rd = read(fd, p->prga, sizeof(p->prga));
tools/tools/net80211/w00t/prga/prga.c
118
close(fd);
tools/tools/net80211/w00t/prga/prga.c
123
int fd;
tools/tools/net80211/w00t/prga/prga.c
126
fd = open(p->fname, O_WRONLY | O_CREAT, 0644);
tools/tools/net80211/w00t/prga/prga.c
127
if (fd == -1)
tools/tools/net80211/w00t/prga/prga.c
130
rd = write(fd, p->iv, 3);
tools/tools/net80211/w00t/prga/prga.c
138
rd = write(fd, p->prga, p->prga_len);
tools/tools/net80211/w00t/prga/prga.c
145
close(fd);
tools/tools/net80211/w00t/prga/prga.c
95
int fd;
tools/tools/net80211/w00t/prga/prga.c
98
fd = open(p->fname, O_RDONLY);
tools/tools/net80211/w00t/prga/prga.c
99
if (fd == -1) {
tools/tools/net80211/w00t/redir/redir.c
101
int fd;
tools/tools/net80211/w00t/redir/redir.c
104
fd = open(p->fname, O_RDONLY);
tools/tools/net80211/w00t/redir/redir.c
105
if (fd == -1) {
tools/tools/net80211/w00t/redir/redir.c
110
rd = read(fd, p->iv, 3);
tools/tools/net80211/w00t/redir/redir.c
118
rd = read(fd, p->prga, sizeof(p->prga));
tools/tools/net80211/w00t/redir/redir.c
124
close(fd);
tools/tools/net80211/wesside/wesside/wesside.c
1000
close(fd);
tools/tools/net80211/wesside/wesside/wesside.c
114
int fd;
tools/tools/net80211/wesside/wesside/wesside.c
1225
if (write(weplog.fd, &pkh, sizeof(pkh)) != sizeof(pkh))
tools/tools/net80211/wesside/wesside/wesside.c
1228
rd = write(weplog.fd, wh, len);
tools/tools/net80211/wesside/wesside/wesside.c
1240
if (fsync(weplog.fd) == -1) {
tools/tools/net80211/wesside/wesside/wesside.c
1255
int fd, rd;
tools/tools/net80211/wesside/wesside/wesside.c
1272
fd = open(path, O_RDONLY);
tools/tools/net80211/wesside/wesside/wesside.c
1273
if (fd == -1)
tools/tools/net80211/wesside/wesside/wesside.c
1276
rd = read(fd, &packet[6], sizeof(packet)-6);
tools/tools/net80211/wesside/wesside/wesside.c
1281
close(fd);
tools/tools/net80211/wesside/wesside/wesside.c
2089
int fd;
tools/tools/net80211/wesside/wesside/wesside.c
2102
fd = open(KEY_FILE, O_WRONLY | O_CREAT | 0644);
tools/tools/net80211/wesside/wesside/wesside.c
2103
if (fd == -1)
tools/tools/net80211/wesside/wesside/wesside.c
2107
rd = write(fd, k, strlen(k));
tools/tools/net80211/wesside/wesside/wesside.c
2112
close(fd);
tools/tools/net80211/wesside/wesside/wesside.c
2139
if (weplog.fd) {
tools/tools/net80211/wesside/wesside/wesside.c
2140
if (fsync(weplog.fd) == -1)
tools/tools/net80211/wesside/wesside/wesside.c
2361
static int read_packet(int fd, unsigned char *dst, int len)
tools/tools/net80211/wesside/wesside/wesside.c
2373
totlen = read(fd, buf, sizeof(buf));
tools/tools/net80211/wesside/wesside/wesside.c
2403
int fd;
tools/tools/net80211/wesside/wesside/wesside.c
2406
weplog.fd = open(WEP_FILE, O_WRONLY | O_APPEND);
tools/tools/net80211/wesside/wesside/wesside.c
2407
if (weplog.fd == -1) {
tools/tools/net80211/wesside/wesside/wesside.c
2419
weplog.fd = open(WEP_FILE, O_WRONLY | O_CREAT,
tools/tools/net80211/wesside/wesside/wesside.c
2421
if (weplog.fd != -1) {
tools/tools/net80211/wesside/wesside/wesside.c
2422
if (write(weplog.fd, &pfh, sizeof(pfh)) != sizeof(pfh))
tools/tools/net80211/wesside/wesside/wesside.c
2430
if (weplog.fd == -1) {
tools/tools/net80211/wesside/wesside/wesside.c
2435
fd = open(PRGA_FILE, O_RDONLY);
tools/tools/net80211/wesside/wesside/wesside.c
2436
if (fd != -1) {
tools/tools/net80211/wesside/wesside/wesside.c
2438
rd = read(fd, buf, sizeof(buf));
tools/tools/net80211/wesside/wesside/wesside.c
2447
close(fd);
tools/tools/net80211/wesside/wesside/wesside.c
2450
fd = open(DICT_PATH, O_RDONLY);
tools/tools/net80211/wesside/wesside/wesside.c
2451
if (fd == -1) {
tools/tools/net80211/wesside/wesside/wesside.c
2459
close(fd);
tools/tools/net80211/wesside/wesside/wesside.c
2668
int fd;
tools/tools/net80211/wesside/wesside/wesside.c
2672
fd = open_bpf(dev, DLT_IEEE802_11_RADIO);
tools/tools/net80211/wesside/wesside/wesside.c
2678
own(fd);
tools/tools/net80211/wesside/wesside/wesside.c
2695
close(fd);
tools/tools/net80211/wesside/wesside/wesside.c
271
int fd;
tools/tools/net80211/wesside/wesside/wesside.c
275
fd = open(KEY_FILE, O_RDONLY);
tools/tools/net80211/wesside/wesside/wesside.c
277
if (fd == -1) {
tools/tools/net80211/wesside/wesside/wesside.c
281
rd = read(fd, buf, sizeof(buf) -1);
tools/tools/net80211/wesside/wesside/wesside.c
289
close(fd);
tools/tools/net80211/wesside/wesside/wesside.c
326
if (weplog.fd)
tools/tools/net80211/wesside/wesside/wesside.c
327
close(weplog.fd);
tools/tools/net80211/wesside/wesside/wesside.c
430
int fd = -1;
tools/tools/net80211/wesside/wesside/wesside.c
436
fd = open(buf, O_RDWR);
tools/tools/net80211/wesside/wesside/wesside.c
437
if(fd < 0) {
tools/tools/net80211/wesside/wesside/wesside.c
448
if(fd < 0) {
tools/tools/net80211/wesside/wesside/wesside.c
456
if(ioctl(fd, BIOCSETIF, &ifr) < 0) {
tools/tools/net80211/wesside/wesside/wesside.c
461
if (ioctl(fd, BIOCSDLT, &dlt) < 0) {
tools/tools/net80211/wesside/wesside/wesside.c
467
if(ioctl(fd, BIOCIMMEDIATE, &i) < 0) {
tools/tools/net80211/wesside/wesside/wesside.c
472
return fd;
tools/tools/net80211/wesside/wesside/wesside.c
492
void inject(int fd, void *buf, int len)
tools/tools/net80211/wesside/wesside/wesside.c
511
rc = writev(fd, iov, 2);
tools/tools/net80211/wesside/wesside/wesside.c
838
int fd;
tools/tools/net80211/wesside/wesside/wesside.c
864
fd = open(PRGA_FILE, O_WRONLY | O_CREAT,
tools/tools/net80211/wesside/wesside/wesside.c
867
if (fd == -1) {
tools/tools/net80211/wesside/wesside/wesside.c
872
i = write(fd, prgainfo.iv, 3);
tools/tools/net80211/wesside/wesside/wesside.c
882
i = write(fd, prgainfo.prga, prgainfo.len);
tools/tools/net80211/wesside/wesside/wesside.c
892
close(fd);
tools/tools/net80211/wesside/wesside/wesside.c
899
int fd;
tools/tools/net80211/wesside/wesside/wesside.c
924
fd = open(path, O_RDONLY);
tools/tools/net80211/wesside/wesside/wesside.c
925
if (fd == -1) {
tools/tools/net80211/wesside/wesside/wesside.c
937
close(fd);
tools/tools/net80211/wesside/wesside/wesside.c
944
fd = open(path, O_RDWR);
tools/tools/net80211/wesside/wesside/wesside.c
946
if (fd != -1) {
tools/tools/net80211/wesside/wesside/wesside.c
947
rd = read(fd, file_clear, sizeof(file_clear));
tools/tools/net80211/wesside/wesside/wesside.c
971
close(fd);
tools/tools/net80211/wesside/wesside/wesside.c
978
fd = open(path, O_WRONLY | O_CREAT, 0644);
tools/tools/net80211/wesside/wesside/wesside.c
979
if (fd == -1) {
tools/tools/net80211/wesside/wesside/wesside.c
991
rd = write(fd, file_clear, len);
tools/tools/net80211/wlaninject/wlaninject.c
101
if (fd == -1) {
tools/tools/net80211/wlaninject/wlaninject.c
108
if (ioctl(fd, BIOCSETIF, &ifr) == -1)
tools/tools/net80211/wlaninject/wlaninject.c
111
if (ioctl(fd, BIOCSDLT, &dlt) == -1)
tools/tools/net80211/wlaninject/wlaninject.c
115
if (ioctl(fd, BIOCIMMEDIATE, &i) == -1)
tools/tools/net80211/wlaninject/wlaninject.c
118
return fd;
tools/tools/net80211/wlaninject/wlaninject.c
121
void inject(int fd, void *buf, int buflen, struct ieee80211_bpf_params *p)
tools/tools/net80211/wlaninject/wlaninject.c
134
rc = writev(fd, iov, sizeof(iov)/sizeof(struct iovec));
tools/tools/net80211/wlaninject/wlaninject.c
283
int fd;
tools/tools/net80211/wlaninject/wlaninject.c
286
if ((fd = open(fname, O_RDONLY)) == -1)
tools/tools/net80211/wlaninject/wlaninject.c
289
if ((rc = read(fd, buf, len)) == -1)
tools/tools/net80211/wlaninject/wlaninject.c
292
close(fd);
tools/tools/net80211/wlaninject/wlaninject.c
528
int fd, fd2;
tools/tools/net80211/wlaninject/wlaninject.c
756
fd = open_bpf(iface);
tools/tools/net80211/wlaninject/wlaninject.c
763
inject(fd, wh, len, ¶ms);
tools/tools/net80211/wlaninject/wlaninject.c
764
close(fd);
tools/tools/net80211/wlaninject/wlaninject.c
88
int fd;
tools/tools/net80211/wlaninject/wlaninject.c
95
fd = open(buf, O_RDWR);
tools/tools/net80211/wlaninject/wlaninject.c
96
if (fd != -1)
tools/tools/net80211/wlanstats/main.c
105
fprintf(fd, "%s:\n", ether_ntoa((const struct ether_addr*) macaddr));
tools/tools/net80211/wlanstats/main.c
127
fprintf(fd, "\n");
tools/tools/net80211/wlanstats/main.c
138
fprintf(fd, "\n");
tools/tools/net80211/wlanstats/main.c
149
fprintf(fd, "\n");
tools/tools/net80211/wlanstats/main.c
86
print_sta_stats(FILE *fd, const u_int8_t macaddr[IEEE80211_ADDR_LEN])
tools/tools/net80211/wlanstats/main.c
89
if (ns->ns_##x) { fprintf(fd, "%s" #x " " fmt, sep, ns->ns_##x); sep = " "; }
tools/tools/net80211/wlanstats/statfoo.c
103
fprintf(fd, "%*s", f->width, f->label);
tools/tools/net80211/wlanstats/statfoo.c
105
putc(*cp, fd);
tools/tools/net80211/wlanstats/statfoo.c
107
putc('\n', fd);
tools/tools/net80211/wlanstats/statfoo.c
111
statfoo_print_current(struct statfoo *sf, FILE *fd)
tools/tools/net80211/wlanstats/statfoo.c
121
fprintf(fd, "%*s", f->width, buf);
tools/tools/net80211/wlanstats/statfoo.c
123
putc(*cp, fd);
tools/tools/net80211/wlanstats/statfoo.c
125
putc('\n', fd);
tools/tools/net80211/wlanstats/statfoo.c
129
statfoo_print_total(struct statfoo *sf, FILE *fd)
tools/tools/net80211/wlanstats/statfoo.c
139
fprintf(fd, "%*s", f->width, buf);
tools/tools/net80211/wlanstats/statfoo.c
141
putc(*cp, fd);
tools/tools/net80211/wlanstats/statfoo.c
143
putc('\n', fd);
tools/tools/net80211/wlanstats/statfoo.c
147
statfoo_print_verbose(struct statfoo *sf, FILE *fd)
tools/tools/net80211/wlanstats/statfoo.c
162
fprintf(fd, "%-*s %s\n", width, s, f->desc);
tools/tools/net80211/wlanstats/statfoo.c
167
statfoo_print_fields(struct statfoo *sf, FILE *fd)
tools/tools/net80211/wlanstats/statfoo.c
180
fprintf(fd, "%-*s %s\n", width, f->name, f->desc);
tools/tools/net80211/wlanstats/statfoo.c
95
statfoo_print_header(struct statfoo *sf, FILE *fd)
tools/tools/net80211/wlanstats/statfoo.h
104
static void _t##_print_header(struct _t *wf, FILE *fd) \
tools/tools/net80211/wlanstats/statfoo.h
105
{ wf->base.print_header(&wf->base, fd); } \
tools/tools/net80211/wlanstats/statfoo.h
106
static void _t##_print_current(struct _t *wf, FILE *fd) \
tools/tools/net80211/wlanstats/statfoo.h
107
{ wf->base.print_current(&wf->base, fd); } \
tools/tools/net80211/wlanstats/statfoo.h
108
static void _t##_print_total(struct _t *wf, FILE *fd) \
tools/tools/net80211/wlanstats/statfoo.h
109
{ wf->base.print_total(&wf->base, fd); } \
tools/tools/net80211/wlanstats/statfoo.h
110
static void _t##_print_verbose(struct _t *wf, FILE *fd) \
tools/tools/net80211/wlanstats/statfoo.h
111
{ wf->base.print_verbose(&wf->base, fd); } \
tools/tools/net80211/wlanstats/statfoo.h
112
static void _t##_print_fields(struct _t *wf, FILE *fd) \
tools/tools/net80211/wlanstats/statfoo.h
113
{ wf->base.print_fields(&wf->base, fd); }
tools/tools/netrate/kq_sendrecv/kq_sendcli/kq_sendcli.c
619
int nconn = 0, kq, n, fd = -1, buflen;
tools/tools/netrate/kq_sendrecv/kq_sendcli/kq_sendcli.c
633
fd = mkstemp(filename);
tools/tools/netrate/kq_sendrecv/kq_sendcli/kq_sendcli.c
634
if (fd < 0)
tools/tools/netrate/kq_sendrecv/kq_sendcli/kq_sendcli.c
636
if (write(fd, buf, buflen) != buflen)
tools/tools/netrate/kq_sendrecv/kq_sendcli/kq_sendcli.c
789
if (fd >= 0) {
tools/tools/netrate/kq_sendrecv/kq_sendcli/kq_sendcli.c
796
n = sendfile(fd, conn->c_s, off, len, NULL,
tools/tools/netrate/kq_sendrecv/kq_sendcli/kq_sendcli.c
820
if (fd >= 0)
tools/tools/netrate/kq_sendrecv/kq_sendcli/kq_sendcli.c
821
close(fd);
tools/tools/netrate/pktgenctl/pktgenctl.c
101
int fd, c, n, ndst_alloc;
tools/tools/netrate/pktgenctl/pktgenctl.c
214
fd = open(dev, O_RDONLY);
tools/tools/netrate/pktgenctl/pktgenctl.c
215
if (fd < 0)
tools/tools/netrate/pktgenctl/pktgenctl.c
218
if (ioctl(fd, PKTGENSCONF, &conf) < 0)
tools/tools/netrate/pktgenctl/pktgenctl.c
221
if (ioctl(fd, start) < 0) {
tools/tools/netrate/pktgenctl/pktgenctl.c
226
close(fd);
usr.bin/backlight/backlight.c
100
fd = -1;
usr.bin/backlight/backlight.c
149
if ((fd = open(device_name, O_RDWR)) == -1)
usr.bin/backlight/backlight.c
155
if (ioctl(fd, BACKLIGHTGETSTATUS, &props) == -1)
usr.bin/backlight/backlight.c
173
if (ioctl(fd, BACKLIGHTUPDATESTATUS, &props) == -1)
usr.bin/backlight/backlight.c
181
if (ioctl(fd, BACKLIGHTGETSTATUS, &props) == -1)
usr.bin/backlight/backlight.c
190
if (ioctl(fd, BACKLIGHTUPDATESTATUS, &props) == -1)
usr.bin/backlight/backlight.c
194
if (ioctl(fd, BACKLIGHTGETINFO, &info) == -1)
usr.bin/backlight/backlight.c
206
close(fd);
usr.bin/backlight/backlight.c
92
int fd;
usr.bin/brandelf/brandelf.c
115
int fd;
usr.bin/brandelf/brandelf.c
118
if ((fd = open(argv[0], change || force ? O_RDWR : O_RDONLY, 0)) < 0) {
usr.bin/brandelf/brandelf.c
123
if (read(fd, buffer, EI_NIDENT) < EI_NIDENT) {
usr.bin/brandelf/brandelf.c
147
lseek(fd, 0, SEEK_SET);
usr.bin/brandelf/brandelf.c
148
if (write(fd, buffer, EI_NIDENT) != EI_NIDENT) {
usr.bin/brandelf/brandelf.c
149
warn("error writing %s %d", argv[0], fd);
usr.bin/brandelf/brandelf.c
155
close(fd);
usr.bin/checkpt/checkpt.c
52
int fd;
usr.bin/checkpt/checkpt.c
69
fd = open(filename, O_RDONLY);
usr.bin/checkpt/checkpt.c
70
if (fd < 0) {
usr.bin/checkpt/checkpt.c
74
error = sys_checkpoint(CKPT_THAW, fd, -1, 1);
usr.bin/chkey/chkey.c
193
int fd;
usr.bin/chkey/chkey.c
195
fd = open(ROOTKEY, O_WRONLY|O_TRUNC|O_CREAT, 0);
usr.bin/chkey/chkey.c
196
if (fd < 0) {
usr.bin/chkey/chkey.c
201
if (write(fd, secret, strlen(secret)) < 0 ||
usr.bin/chkey/chkey.c
202
write(fd, &newline, sizeof(newline)) < 0)
usr.bin/cksum/cksum.c
103
if ((fd = open(fn, O_RDONLY, 0)) < 0) {
usr.bin/cksum/cksum.c
109
if (cfncn(fd, &val, &len)) {
usr.bin/cksum/cksum.c
114
close(fd);
usr.bin/cksum/cksum.c
54
int ch, fd, rval;
usr.bin/cksum/cksum.c
97
fd = STDIN_FILENO;
usr.bin/cksum/crc.c
108
crc(int fd, uint32_t *cval, off_t *clen)
usr.bin/cksum/crc.c
120
while ((nr = read(fd, buf, sizeof(buf))) > 0)
usr.bin/cksum/crc32.c
101
crc32(int fd, uint32_t *cval, off_t *clen)
usr.bin/cksum/crc32.c
110
while ((nr = read(fd, buf, sizeof(buf))) > 0)
usr.bin/cksum/sum1.c
42
csum1(int fd, uint32_t *cval, off_t *clen)
usr.bin/cksum/sum1.c
55
while ((nr = read(fd, buf, sizeof(buf))) > 0)
usr.bin/cksum/sum2.c
42
csum2(int fd, uint32_t *cval, off_t *clen)
usr.bin/cksum/sum2.c
58
while ((nr = read(fd, buf, sizeof(buf))) > 0)
usr.bin/cmp/regular.c
152
remmap(u_char *mem, int fd, off_t offset)
usr.bin/cmp/regular.c
156
mem = mmap(NULL, MMAP_CHUNK, PROT_READ, MAP_SHARED, fd, offset);
usr.bin/crunch/crunchgen/crunchgen.c
733
int fd, rc;
usr.bin/crunch/crunchgen/crunchgen.c
741
if ((fd = mkstemp(tempfname)) == -1) {
usr.bin/crunch/crunchgen/crunchgen.c
745
if ((f = fdopen(fd, "w")) == NULL) {
usr.bin/crunch/crunchide/crunchide.c
214
int fd, i, n, rv;
usr.bin/crunch/crunchide/crunchide.c
216
fd = open(filename, O_RDWR, 0);
usr.bin/crunch/crunchide/crunchide.c
217
if (fd == -1) {
usr.bin/crunch/crunchide/crunchide.c
226
if (lseek(fd, 0, SEEK_SET) != 0) {
usr.bin/crunch/crunchide/crunchide.c
230
if ((*exec_formats[i].check)(fd, filename) != 0)
usr.bin/crunch/crunchide/crunchide.c
242
if (lseek(fd, 0, SEEK_SET) != 0) {
usr.bin/crunch/crunchide/crunchide.c
246
rv = (*exec_formats[i].hide)(fd, filename);
usr.bin/crunch/crunchide/crunchide.c
249
close (fd);
usr.bin/crunch/crunchide/exec_elf64.c
103
if ((size_t)(rv = write(fd, buf, size)) != size) {
usr.bin/crunch/crunchide/exec_elf64.c
138
ELFNAMEEND(check)(int fd, const char *fn)
usr.bin/crunch/crunchide/exec_elf64.c
148
if (fstat(fd, &sb) == -1)
usr.bin/crunch/crunchide/exec_elf64.c
152
if (read(fd, &eh, sizeof eh) != sizeof eh)
usr.bin/crunch/crunchide/exec_elf64.c
220
ELFNAMEEND(hide)(int fd, const char *fn)
usr.bin/crunch/crunchide/exec_elf64.c
240
if (xreadatoff(fd, &ehdr, 0, sizeof ehdr, fn) != sizeof ehdr)
usr.bin/crunch/crunchide/exec_elf64.c
249
if (xreadatoff(fd, shdrp, xewtoh(ehdr.e_shoff), shdrsize, fn) !=
usr.bin/crunch/crunchide/exec_elf64.c
333
if ((size_t)xreadatoff(fd, shstrtabp, xewtoh(shstrtabshdr->sh_offset),
usr.bin/crunch/crunchide/exec_elf64.c
360
if ((size_t)xreadatoff(fd, layoutp[i].bufp, off, size, fn) !=
usr.bin/crunch/crunchide/exec_elf64.c
455
if ((size_t)xwriteatoff(fd, &ehdr.e_shoff, off, size,
usr.bin/crunch/crunchide/exec_elf64.c
462
if ((size_t)xwriteatoff(fd, buf, off, size, fn) != size)
usr.bin/crunch/crunchide/exec_elf64.c
78
xreadatoff(int fd, void *buf, off_t off, size_t size, const char *fn)
usr.bin/crunch/crunchide/exec_elf64.c
82
if (lseek(fd, off, SEEK_SET) != off) {
usr.bin/crunch/crunchide/exec_elf64.c
86
if ((size_t)(rv = read(fd, buf, size)) != size) {
usr.bin/crunch/crunchide/exec_elf64.c
95
xwriteatoff(int fd, void *buf, off_t off, size_t size, const char *fn)
usr.bin/crunch/crunchide/exec_elf64.c
99
if (lseek(fd, off, SEEK_SET) != off) {
usr.bin/dfregress/kernel.c
103
r = prop_dictionary_send_ioctl(testcase, fd, TBRIDGE_LOADTEST);
usr.bin/dfregress/kernel.c
115
r = prop_dictionary_recv_ioctl(fd, TBRIDGE_GETRESULT, &tkcase);
usr.bin/dfregress/kernel.c
68
int fd, r, kmod_id, ret = 0;
usr.bin/dfregress/kernel.c
91
fd = open("/dev/tbridge", O_RDWR);
usr.bin/dfregress/kernel.c
92
if (fd < 0) {
usr.bin/dfregress/parser.c
150
process_line(FILE* fd, parser_t parser, void *arg)
usr.bin/dfregress/parser.c
157
while (((c = fgetc(fd)) != EOF) && (c != '\n')) {
usr.bin/dfregress/parser.c
164
if (feof(fd) || ferror(fd))
usr.bin/dfregress/parser.c
199
FILE *fd;
usr.bin/dfregress/parser.c
203
fd = fopen(file, "r");
usr.bin/dfregress/parser.c
204
if (fd == NULL)
usr.bin/dfregress/parser.c
208
while (process_line(fd, parser, arg) == 0)
usr.bin/dfregress/parser.c
211
fclose(fd);
usr.bin/diff/diffreg.c
498
prepare(int i, FILE *fd, size_t filesize, int flags)
usr.bin/diff/diffreg.c
504
rewind(fd);
usr.bin/diff/diffreg.c
511
for (j = 0; (h = readhash(fd, flags));) {
usr.bin/diff/diffreg.c
923
preadline(int fd, size_t rlen, off_t off)
usr.bin/diff/diffreg.c
929
if ((nr = pread(fd, line, rlen, off)) == -1)
usr.bin/dsynth/build.c
1952
int fd;
usr.bin/dsynth/build.c
1979
fd = strtol(av[2], NULL, 0); /* master<->slave messaging */
usr.bin/dsynth/build.c
2150
work->fds[0] = fd;
usr.bin/dsynth/build.c
2192
ipcwritemsg(fd, &wmsg);
usr.bin/dsynth/build.c
2193
status = ipcreadmsg(fd, &wmsg);
usr.bin/dsynth/build.c
2204
status = ipcwritemsg(fd, &wmsg);
usr.bin/dsynth/build.c
2339
ipcwritemsg(fd, &wmsg);
usr.bin/dsynth/build.c
2342
ipcwritemsg(fd, &wmsg);
usr.bin/dsynth/build.c
2566
int fd;
usr.bin/dsynth/build.c
2568
fd = open("/dev/null", O_RDWR);
usr.bin/dsynth/build.c
2569
dassert_errno(fd >= 0, "cannot open /dev/null");
usr.bin/dsynth/build.c
2570
if (fd != 0) {
usr.bin/dsynth/build.c
2571
dup2(fd, 0);
usr.bin/dsynth/build.c
2572
close(fd);
usr.bin/dsynth/build.c
3014
pfd.fd = ptyfd;
usr.bin/dsynth/bulk.c
291
readall(int fd, void *buf, size_t bytes)
usr.bin/dsynth/bulk.c
296
r = read(fd, buf, bytes);
usr.bin/dsynth/bulk.c
313
writeall(int fd, const void *buf, size_t bytes)
usr.bin/dsynth/bulk.c
318
r = write(fd, buf, bytes);
usr.bin/dsynth/bulk.c
63
static int readall(int fd, void *buf, size_t bytes);
usr.bin/dsynth/bulk.c
64
static int writeall(int fd, const void *buf, size_t bytes);
usr.bin/dsynth/dsynth.c
316
int fd;
usr.bin/dsynth/dsynth.c
322
fd = open(lkpath, O_RDWR | O_CREAT | O_APPEND, 0644);
usr.bin/dsynth/dsynth.c
323
if (flock(fd, LOCK_EX | LOCK_NB) == 0) {
usr.bin/dsynth/dsynth.c
325
flock(fd, LOCK_UN);
usr.bin/dsynth/dsynth.c
329
write(fd, buf, strlen(buf));
usr.bin/dsynth/dsynth.c
332
close(fd);
usr.bin/dsynth/dsynth.h
504
int fd;
usr.bin/dsynth/dsynth.h
663
int ipcreadmsg(int fd, wmsg_t *msg);
usr.bin/dsynth/dsynth.h
664
int ipcwritemsg(int fd, wmsg_t *msg);
usr.bin/dsynth/mount.c
141
fd = open(goodbuf, O_RDWR|O_CREAT|O_TRUNC, 0644);
usr.bin/dsynth/mount.c
142
dassert_errno(fd >= 0, "could not create %s", goodbuf);
usr.bin/dsynth/mount.c
143
close(fd);
usr.bin/dsynth/mount.c
59
int fd;
usr.bin/dsynth/ncurses.c
145
nclog.fd = dlog00_fd();
usr.bin/dsynth/repo.c
67
int fd;
usr.bin/dsynth/repo.c
93
fd = mkostemps(tpath, 5, 0);
usr.bin/dsynth/repo.c
94
if (fd < 0)
usr.bin/dsynth/repo.c
96
fp = fdopen(fd, "w");
usr.bin/dsynth/subs.c
130
int fd;
usr.bin/dsynth/subs.c
133
if ((fd = DLogFd[which]) > 0)
usr.bin/dsynth/subs.c
134
return fd;
usr.bin/dsynth/subs.c
136
if ((fd = DLogFd[which]) <= 0) {
usr.bin/dsynth/subs.c
138
fd = open(path, modes, 0666);
usr.bin/dsynth/subs.c
139
DLogFd[which] = fd;
usr.bin/dsynth/subs.c
144
return fd;
usr.bin/dsynth/subs.c
170
int fd;
usr.bin/dsynth/subs.c
214
fd = dlogfd(DLOG_ALL, O_RDWR|O_CREAT|O_APPEND);
usr.bin/dsynth/subs.c
215
if (fd > 0)
usr.bin/dsynth/subs.c
216
write(fd, buf, len);
usr.bin/dsynth/subs.c
222
fd = dlogfd(which, O_RDWR|O_CREAT|O_APPEND);
usr.bin/dsynth/subs.c
223
write(fd, buf, len);
usr.bin/dsynth/subs.c
324
ipcreadmsg(int fd, wmsg_t *msg)
usr.bin/dsynth/subs.c
333
r = read(fd, ptr, res);
usr.bin/dsynth/subs.c
346
ipcwritemsg(int fd, wmsg_t *msg)
usr.bin/dsynth/subs.c
355
r = write(fd, ptr, res);
usr.bin/dsynth/subs.c
659
int fd;
usr.bin/dsynth/subs.c
670
fd = EFds[0];
usr.bin/dsynth/subs.c
687
len = recvmsg(fd, &msg, mflags);
usr.bin/dsynth/subs.c
946
r = pread(log->fd,
usr.bin/finger/lprint.c
292
int fd, nr;
usr.bin/finger/lprint.c
297
if ((fd = open(tbuf, O_RDONLY)) < 0 || fstat(fd, &sb) ||
usr.bin/finger/lprint.c
303
nr = read(fd, tbuf, sizeof(tbuf));
usr.bin/finger/lprint.c
305
(void)close(fd);
usr.bin/finger/lprint.c
319
(void)close(fd);
usr.bin/finger/lprint.c
323
(void)lseek(fd, 0L, SEEK_SET);
usr.bin/finger/lprint.c
325
if ((fp = fdopen(fd, "r")) == NULL)
usr.bin/fsync/fsync.c
42
int fd;
usr.bin/fsync/fsync.c
50
if ((fd = open(argv[i], O_RDONLY)) < 0) {
usr.bin/fsync/fsync.c
56
if (fsync(fd) != 0) {
usr.bin/fsync/fsync.c
60
close(fd);
usr.bin/gcore/elfcore.c
122
elf_corehdr(fd, pid, map, seginfo.count, hdr, hdrsize);
usr.bin/gcore/elfcore.c
149
ngot = write(fd, buf, nwant);
usr.bin/gcore/elfcore.c
225
elf_corehdr(int fd, pid_t pid, vm_map_entry_t map, int numsegs, void *hdr,
usr.bin/gcore/elfcore.c
242
if (write(fd, hdr, hdrsize) == -1)
usr.bin/gcore/elfcore.c
377
int fd;
usr.bin/gcore/elfcore.c
397
if ((fd = open(name, O_RDONLY)) == -1)
usr.bin/gcore/elfcore.c
399
if ((n = read(fd, &status->pr_reg, sizeof status->pr_reg)) == -1)
usr.bin/gcore/elfcore.c
404
close(fd);
usr.bin/gcore/elfcore.c
408
if ((fd = open(name, O_RDONLY)) == -1)
usr.bin/gcore/elfcore.c
410
if ((n = read(fd, fpregset, sizeof *fpregset)) == -1)
usr.bin/gcore/elfcore.c
415
close(fd);
usr.bin/gcore/elfcore.c
419
if ((fd = open(name, O_RDONLY)) == -1)
usr.bin/gcore/elfcore.c
421
if ((n = read(fd, line, sizeof line - 1)) == -1)
usr.bin/gcore/elfcore.c
428
close(fd);
usr.bin/gcore/elfcore.c
74
static void elf_corehdr(int fd, pid_t, vm_map_entry_t, int numsegs,
usr.bin/gcore/elfcore.c
88
elf_coredump(int fd, pid_t pid)
usr.bin/gcore/gcore.c
165
fd = open(corefile, O_RDWR|O_CREAT|O_TRUNC, DEFFILEMODE);
usr.bin/gcore/gcore.c
166
if (fd < 0)
usr.bin/gcore/gcore.c
178
elf_coredump(fd, pid);
usr.bin/gcore/gcore.c
180
close(fd);
usr.bin/gcore/gcore.c
80
int ch, cnt, efd, fd, sflag;
usr.bin/gencat/gencat.c
244
get_line(int fd)
usr.bin/gencat/gencat.c
272
buflen = read(fd, buf, BUFSIZ);
usr.bin/gencat/gencat.c
311
getmsg(int fd, char *cptr, char quote)
usr.bin/gencat/gencat.c
347
cptr = get_line(fd);
usr.bin/gencat/gencat.c
399
MCParse(int fd)
usr.bin/gencat/gencat.c
407
while ((cptr = get_line(fd))) {
usr.bin/gencat/gencat.c
468
str = getmsg(fd, cptr, quote);
usr.bin/gencat/gencat.c
485
MCWriteCat(int fd)
usr.bin/gencat/gencat.c
586
write(fd, msgcat, msgcat_size);
usr.bin/gzip/gzip.c
1029
copymodes(int fd, const struct stat *sbp, const char *file)
usr.bin/gzip/gzip.c
1041
(void)fchmod(fd, DEFFILEMODE & ~mask);
usr.bin/gzip/gzip.c
1048
if (fchown(fd, sb.st_uid, sb.st_gid) < 0) {
usr.bin/gzip/gzip.c
1056
if (fchmod(fd, sb.st_mode) < 0)
usr.bin/gzip/gzip.c
1061
if (futimes(fd, times) < 0)
usr.bin/gzip/gzip.c
1066
if (sb.st_flags != 0 && fchflags(fd, sb.st_flags) < 0)
usr.bin/gzip/gzip.c
1289
int fd, ofd, zfd = -1;
usr.bin/gzip/gzip.c
1298
fd = open(file, O_RDONLY);
usr.bin/gzip/gzip.c
1299
if (fd < 0) {
usr.bin/gzip/gzip.c
1311
rbytes = read(fd, header1, sizeof header1);
usr.bin/gzip/gzip.c
1339
rv = pread(fd, ts, sizeof ts, GZIP_TIMESTAMP);
usr.bin/gzip/gzip.c
1350
rbytes = pread(fd, name, sizeof name, GZIP_ORIGNAME);
usr.bin/gzip/gzip.c
1369
lseek(fd, 0, SEEK_SET);
usr.bin/gzip/gzip.c
1372
if (fstat(fd, &isb) != 0)
usr.bin/gzip/gzip.c
1410
size = unbzip2(fd, zfd, NULL, 0, NULL);
usr.bin/gzip/gzip.c
1424
if ((in = zdopen(fd)) == NULL) {
usr.bin/gzip/gzip.c
1458
size = unpack(fd, zfd, NULL, 0, NULL);
usr.bin/gzip/gzip.c
1468
size = cat_fd(NULL, 0, NULL, fd);
usr.bin/gzip/gzip.c
1473
print_list(fd, isb.st_size, outfile, isb.st_mtime);
usr.bin/gzip/gzip.c
1474
close(fd);
usr.bin/gzip/gzip.c
1478
size = gz_uncompress(fd, zfd, NULL, 0, NULL, file);
usr.bin/gzip/gzip.c
1481
if (close(fd) != 0)
usr.bin/gzip/gzip.c
1539
if (fd != -1)
usr.bin/gzip/gzip.c
1540
close(fd);
usr.bin/gzip/gzip.c
1542
close(fd);
usr.bin/gzip/gzip.c
1548
cat_fd(unsigned char * prepend, size_t count, off_t *gsizep, int fd)
usr.bin/gzip/gzip.c
1563
rv = read(fd, buf, sizeof buf);
usr.bin/gzip/gzip.c
1567
maybe_warn("read from fd %d", fd);
usr.bin/gzip/gzip.c
1912
print_list(int fd, off_t out, const char *outfile, time_t ts)
usr.bin/gzip/gzip.c
1934
if (fd == -1) {
usr.bin/gzip/gzip.c
1941
rv = lseek(fd, (off_t)(-8), SEEK_END);
usr.bin/gzip/gzip.c
1946
rv = read(fd, (char *)buf, sizeof(buf));
usr.bin/gzip/gzip.c
1965
if (vflag && fd == -1)
usr.bin/gzip/gzip.c
197
static void print_list(int fd, off_t, const char *, time_t);
usr.bin/gzip/gzip.c
2039
read_retry(int fd, void *buf, size_t sz)
usr.bin/gzip/gzip.c
2047
ret = read(fd, cp, left);
usr.bin/gzip/gzip.c
206
static off_t cat_fd(unsigned char *, size_t, off_t *, int fd);
usr.bin/gzip/gzip.c
211
static void copymodes(int fd, const struct stat *, const char *file);
usr.bin/gzip/zuncompress.c
172
zdopen(int fd)
usr.bin/gzip/zuncompress.c
197
if ((zs->zs_fp = fdopen(fd, "r")) == NULL) {
usr.bin/ktrace/ktrace.c
129
if ((fd = open(tracefile, O_CREAT | O_WRONLY, DEFFILEMODE)) < 0)
usr.bin/ktrace/ktrace.c
131
if (fstat(fd, &sb) != 0 || sb.st_uid != getuid())
usr.bin/ktrace/ktrace.c
137
if ((fd = open(tracefile, O_CREAT | O_EXCL | O_WRONLY,
usr.bin/ktrace/ktrace.c
142
close(fd);
usr.bin/ktrace/ktrace.c
56
int append, ch, fd, inherit, ops, pid, pidset, trpoints;
usr.bin/ldd/ldd.c
104
int fd;
usr.bin/ldd/ldd.c
113
if ((fd = open(*argv, O_RDONLY, 0)) < 0) {
usr.bin/ldd/ldd.c
118
if ((n = read(fd, &hdr, sizeof hdr)) == -1) {
usr.bin/ldd/ldd.c
120
close(fd);
usr.bin/ldd/ldd.c
132
if (lseek(fd, 0, SEEK_SET) == -1 ||
usr.bin/ldd/ldd.c
133
read(fd, &ehdr, sizeof ehdr) != sizeof ehdr ||
usr.bin/ldd/ldd.c
134
lseek(fd, ehdr.e_phoff, SEEK_SET) == -1
usr.bin/ldd/ldd.c
140
if (read(fd, &phdr, ehdr.e_phentsize)
usr.bin/ldd/ldd.c
161
close(fd);
usr.bin/locate/locate/locate.c
270
int fd;
usr.bin/locate/locate/locate.c
276
if ((fd = open(path_fcodes, O_RDONLY)) == -1 ||
usr.bin/locate/locate/locate.c
277
fstat(fd, &sb) == -1)
usr.bin/locate/locate/locate.c
283
fd, (off_t)0)) == MAP_FAILED)
usr.bin/locate/locate/locate.c
304
(void)close(fd);
usr.bin/lockf/lockf.c
158
int fd;
usr.bin/lockf/lockf.c
160
if ((fd = open(name, O_RDONLY|O_CREAT|O_EXLOCK|O_NONBLOCK, 0666)) == -1) {
usr.bin/lockf/lockf.c
165
return fd;
usr.bin/lockf/lockf.c
216
int fd;
usr.bin/lockf/lockf.c
218
if ((fd = open(name, O_RDONLY|O_EXLOCK)) == -1) {
usr.bin/lockf/lockf.c
223
close(fd);
usr.bin/look/look.c
138
if ((fd = open(file, O_RDONLY, 0)) < 0 || fstat(fd, &sb))
usr.bin/look/look.c
143
close(fd);
usr.bin/look/look.c
146
if ((front = mmap(NULL, (size_t)sb.st_size, PROT_READ, MAP_SHARED, fd, (off_t)0)) == MAP_FAILED)
usr.bin/look/look.c
150
close(fd);
usr.bin/look/look.c
94
int ch, fd, match;
usr.bin/m4/eval.c
384
int fd;
usr.bin/m4/eval.c
389
fd = mkstemp(temp);
usr.bin/m4/eval.c
390
if (fd == -1)
usr.bin/m4/eval.c
394
close(fd);
usr.bin/m4/eval.c
807
int fd;
usr.bin/m4/eval.c
822
if ((fd = mkstemp(fname)) < 0 ||
usr.bin/m4/eval.c
823
(outfile[n] = fdopen(fd, "w+")) == NULL)
usr.bin/mail/collect.c
102
if ((fd = mkstemp(tempname)) == -1 ||
usr.bin/mail/collect.c
103
(collf = Fdopen(fd, "w+")) == NULL) {
usr.bin/mail/collect.c
559
int fd;
usr.bin/mail/collect.c
564
if ((fd = mkstemp(tempname)) == -1 ||
usr.bin/mail/collect.c
565
(nf = Fdopen(fd, "w+")) == NULL) {
usr.bin/mail/collect.c
72
int lc, cc, escape, eofcount, fd, c, t;
usr.bin/mail/lex.c
127
if ((fd = mkstemp(tempname)) == -1 || (otf = fdopen(fd, "w")) == NULL)
usr.bin/mail/lex.c
63
int checkmode, i, fd;
usr.bin/mail/names.c
306
int fd;
usr.bin/mail/names.c
311
if ((fd = mkstemp(tempname)) == -1 ||
usr.bin/mail/names.c
312
(fout = Fdopen(fd, "a")) == NULL) {
usr.bin/mail/popen.c
75
Fdopen(int fd, const char *mode)
usr.bin/mail/popen.c
79
if ((fp = fdopen(fd, mode)) != NULL) {
usr.bin/mail/quit.c
111
if ((fd = mkstemp(tempname)) == -1 ||
usr.bin/mail/quit.c
112
(rbuf = Fdopen(fd, "w")) == NULL)
usr.bin/mail/quit.c
203
if ((fd = mkstemp(tempname)) == -1 ||
usr.bin/mail/quit.c
204
(obuf = Fdopen(fd, "w")) == NULL) {
usr.bin/mail/quit.c
422
int fd;
usr.bin/mail/quit.c
426
if ((fd = mkstemp(tempname)) == -1 ||
usr.bin/mail/quit.c
427
(obuf = Fdopen(fd, "w")) == NULL) {
usr.bin/mail/quit.c
73
int c, fd;
usr.bin/mail/send.c
452
int c, fd;
usr.bin/mail/send.c
456
if ((fd = mkstemp(tempname)) == -1 ||
usr.bin/mail/send.c
457
(nfo = Fdopen(fd, "w")) == NULL) {
usr.bin/mktemp/mktemp.c
126
fd = mkstemp(name);
usr.bin/mktemp/mktemp.c
127
if (fd < 0) {
usr.bin/mktemp/mktemp.c
132
close(fd);
usr.bin/mktemp/mktemp.c
51
int c, fd, ret;
usr.bin/monitor/monitor.c
128
elm->fd = open(path, O_RDONLY);
usr.bin/monitor/monitor.c
129
if (elm->fd < 0) {
usr.bin/monitor/monitor.c
133
EV_SET(&kev, elm->fd, EVFILT_VNODE, EV_ADD|EV_ENABLE|EV_CLEAR,
usr.bin/monitor/monitor.c
143
if (elm->fd >= NumFiles) {
usr.bin/monitor/monitor.c
144
MaxFiles = (elm->fd + 16) * 3 / 2;
usr.bin/monitor/monitor.c
149
Elms[elm->fd] = elm;
usr.bin/monitor/monitor.c
48
int fd;
usr.bin/msgs/msgs.c
717
int n, cmsg, fd;
usr.bin/msgs/msgs.c
761
fd = open(fname, O_RDWR|O_EXCL|O_CREAT|O_APPEND);
usr.bin/msgs/msgs.c
765
fd = mkstemp(fname);
usr.bin/msgs/msgs.c
766
if (fd != -1) {
usr.bin/msgs/msgs.c
772
if (fd == -1 || (cpto = fdopen(fd, "a")) == NULL) {
usr.bin/msgs/msgs.c
773
if (fd != -1)
usr.bin/msgs/msgs.c
774
close(fd);
usr.bin/nohup/nohup.c
100
if (fd != -1)
usr.bin/nohup/nohup.c
105
fd = open(p = path, O_RDWR | O_CREAT | O_APPEND,
usr.bin/nohup/nohup.c
107
if (fd != -1)
usr.bin/nohup/nohup.c
113
if (dup2(fd, STDOUT_FILENO) == -1)
usr.bin/nohup/nohup.c
87
int fd;
usr.bin/nohup/nohup.c
99
fd = open(p, O_RDWR | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
usr.bin/patch/patch.c
153
int error = 0, hunk, failed, i, fd;
usr.bin/patch/patch.c
178
if ((fd = mkstemp(TMPOUTNAME)) < 0)
usr.bin/patch/patch.c
180
close(fd);
usr.bin/patch/patch.c
184
if ((fd = mkstemp(TMPINNAME)) < 0)
usr.bin/patch/patch.c
186
close(fd);
usr.bin/patch/patch.c
190
if ((fd = mkstemp(TMPREJNAME)) < 0)
usr.bin/patch/patch.c
192
close(fd);
usr.bin/patch/patch.c
196
if ((fd = mkstemp(TMPPATNAME)) < 0)
usr.bin/patch/patch.c
198
close(fd);
usr.bin/quota/quota.c
526
int fd, qcmd;
usr.bin/quota/quota.c
533
if ((fd = open(qfpathname, O_RDONLY)) < 0) {
usr.bin/quota/quota.c
537
lseek(fd, (off_t)(id * sizeof(struct ufs_dqblk)), L_SET);
usr.bin/quota/quota.c
538
switch (read(fd, &qup->dqblk, sizeof(struct ufs_dqblk))) {
usr.bin/quota/quota.c
550
close(fd);
usr.bin/quota/quota.c
553
close(fd);
usr.bin/rfcomm_sppd/rfcomm_sppd.c
332
int fd;
usr.bin/rfcomm_sppd/rfcomm_sppd.c
357
fd = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
usr.bin/rfcomm_sppd/rfcomm_sppd.c
358
if (fd < 0)
usr.bin/rfcomm_sppd/rfcomm_sppd.c
361
if (bind(fd, (struct sockaddr *)&sa, sizeof(sa)) < 0)
usr.bin/rfcomm_sppd/rfcomm_sppd.c
367
if (setsockopt(fd, SOL_SOCKET, SO_LINGER, &l, sizeof(l)) < 0)
usr.bin/rfcomm_sppd/rfcomm_sppd.c
370
if (setsockopt(fd, BTPROTO_RFCOMM, SO_RFCOMM_LM, &lm, sizeof(lm)) < 0)
usr.bin/rfcomm_sppd/rfcomm_sppd.c
376
if (connect(fd, (struct sockaddr *)&sa, sizeof(sa)) < 0)
usr.bin/rfcomm_sppd/rfcomm_sppd.c
380
return fd;
usr.bin/rfcomm_sppd/rfcomm_sppd.c
398
int sv, fd, n;
usr.bin/rfcomm_sppd/rfcomm_sppd.c
444
fd = accept(sv, (struct sockaddr *)&sa, &len);
usr.bin/rfcomm_sppd/rfcomm_sppd.c
445
if (fd < 0)
usr.bin/rfcomm_sppd/rfcomm_sppd.c
451
if (setsockopt(fd, SOL_SOCKET, SO_LINGER, &l, sizeof(l)) < 0)
usr.bin/rfcomm_sppd/rfcomm_sppd.c
455
return fd;
usr.bin/rpcinfo/rpcinfo.c
1227
static int fd = RPC_ANYFD;
usr.bin/rpcinfo/rpcinfo.c
1229
if (fd == RPC_ANYFD) {
usr.bin/rpcinfo/rpcinfo.c
1230
if ((fd = __rpc_nconf2fd(nconf)) == -1) {
usr.bin/rpcinfo/rpcinfo.c
1240
client = clnt_tli_create(fd, nconf, nbuf, prog, vers, 0, 0);
usr.bin/rpcinfo/rpcinfo.c
1264
int fd;
usr.bin/rpcinfo/rpcinfo.c
1297
CLNT_CONTROL(client, CLGET_FD, (char *)&fd);
usr.bin/rpcinfo/rpcinfo.c
1341
close(fd);
usr.bin/rpcinfo/rpcinfo.c
367
int fd = RPC_ANYFD;
usr.bin/rpcinfo/rpcinfo.c
391
client = clnt_com_create(&addr, prognum, vers, &fd, trans);
usr.bin/rpcinfo/rpcinfo.c
414
client = clnt_com_create(&addr, prognum, MAX_VERS, &fd, trans);
usr.bin/rpcinfo/rpcinfo.c
441
client = clnt_com_create(&addr, prognum, vers, &fd, trans);
usr.bin/rpcinfo/rpcinfo.c
450
close(fd);
usr.bin/ruptime/ruptime.c
118
if ((fd = open(dp->d_name, O_RDONLY, 0)) < 0) {
usr.bin/ruptime/ruptime.c
122
cc = read(fd, buf, sizeof(struct whod));
usr.bin/ruptime/ruptime.c
123
(void)close(fd);
usr.bin/ruptime/ruptime.c
78
int aflg, ch, fd, maxloadav;
usr.bin/rwall/rwall.c
132
int fd;
usr.bin/rwall/rwall.c
138
if ((fd = mkstemp(tmpname)) == -1 || (fp = fdopen(fd, "r+")) == NULL)
usr.bin/rwall/rwall.c
173
if (fstat(fd, &sbuf))
usr.bin/rwall/rwall.c
180
if (close(fd))
usr.bin/sdiff/edit.c
143
if ((fd = mkstemp(filename)) == -1)
usr.bin/sdiff/edit.c
150
if ((nwritten = write(fd, text, len)) == -1 ||
usr.bin/sdiff/edit.c
156
close(fd);
usr.bin/sdiff/edit.c
88
int fd;
usr.bin/sdiff/sdiff.c
212
int ch, fd[2], i, ret, status;
usr.bin/sdiff/sdiff.c
379
if (pipe(fd))
usr.bin/sdiff/sdiff.c
387
close(fd[0]);
usr.bin/sdiff/sdiff.c
388
if (dup2(fd[1], STDOUT_FILENO) != STDOUT_FILENO)
usr.bin/sdiff/sdiff.c
391
close(fd[1]);
usr.bin/sdiff/sdiff.c
398
close(fd[1]);
usr.bin/sdiff/sdiff.c
401
if ((diffpipe = fdopen(fd[0], "r")) == NULL)
usr.bin/sed/compile.c
286
cmd->u.fd = -1;
usr.bin/sed/compile.c
287
else if ((cmd->u.fd = open(p,
usr.bin/sed/defs.h
103
int fd; /* File descriptor for w */
usr.bin/sed/process.c
243
if (cp->u.fd == -1 && (cp->u.fd = open(cp->t,
usr.bin/sed/process.c
247
if (write(cp->u.fd, ps, psl) != (ssize_t)psl ||
usr.bin/sed/process.c
248
write(cp->u.fd, "\n", 1) != 1)
usr.bin/sed/process.c
781
if (cp->u.fd != -1 && close(cp->u.fd))
usr.bin/sed/process.c
783
cp->u.fd = -1;
usr.bin/shlock/shlock.c
107
int fd, ret;
usr.bin/shlock/shlock.c
127
while ((fd = open(tmpf, O_RDWR | O_CREAT | O_EXCL, 0644)) == -1){
usr.bin/shlock/shlock.c
139
if ((uucpstyle && write(fd, &pid, sizeof(pid)) != sizeof(pid)) ||
usr.bin/shlock/shlock.c
140
(!uucpstyle && write(fd, buf, strlen(buf)) != (int)strlen(buf))) {
usr.bin/shlock/shlock.c
142
close(fd);
usr.bin/shlock/shlock.c
150
close(fd);
usr.bin/shlock/shlock.c
193
int fd;
usr.bin/shlock/shlock.c
197
if ((fd = open(file, O_RDONLY)) == -1) {
usr.bin/shlock/shlock.c
210
len = read(fd, buf, uucpstyle ? sizeof(pid_t) : sizeof(buf));
usr.bin/shlock/shlock.c
211
close(fd);
usr.bin/sort/file.c
631
int fd, flags;
usr.bin/sort/file.c
636
fd = open(fsrc, O_RDONLY);
usr.bin/sort/file.c
637
if (fd < 0)
usr.bin/sort/file.c
640
if (fstat(fd, &stat_buf) < 0) {
usr.bin/sort/file.c
641
close(fd);
usr.bin/sort/file.c
651
addr = mmap(NULL, sz, PROT_READ, flags, fd, 0);
usr.bin/sort/file.c
653
close(fd);
usr.bin/sort/file.c
657
ret->fd = fd;
usr.bin/sort/file.c
805
if (fr->fd)
usr.bin/sort/file.c
806
close(fr->fd);
usr.bin/sort/file.c
83
int fd;
usr.bin/systat/pftop.c
239
int fd;
usr.bin/systat/pftop.c
241
fd = open("/dev/pf", O_RDONLY);
usr.bin/systat/pftop.c
242
if (fd < 0)
usr.bin/systat/pftop.c
249
if (ioctl(fd, DIOCGETSTATES, &ps) < 0) {
usr.bin/systat/pftop.c
250
close(fd);
usr.bin/systat/pftop.c
255
if (ioctl(fd, DIOCGETSTATES, &ps) < 0) {
usr.bin/systat/pftop.c
257
close(fd);
usr.bin/systat/pftop.c
270
close(fd);
usr.bin/systat/pftop.c
272
fd = -1;
usr.bin/tail/extern.h
50
int fd;
usr.bin/tail/forward.c
207
map.fd = fileno(fp);
usr.bin/tail/misc.c
105
mip->fd, mip->mapoff)) == MAP_FAILED)
usr.bin/tail/reverse.c
112
map.fd = fileno(fp);
usr.bin/tcopy/tcopy.c
297
writeop(int fd, int type)
usr.bin/tcopy/tcopy.c
303
if (ioctl(fd, MTIOCTOP, (char *)&op) < 0)
usr.bin/tcopy/tcopy.c
315
rewind_tape(int fd)
usr.bin/tcopy/tcopy.c
319
if(fstat(fd, &sp))
usr.bin/tcopy/tcopy.c
326
if( lseek(fd, 0, SEEK_SET) == -1 )
usr.bin/tcopy/tcopy.c
330
writeop(fd, MTREW);
usr.bin/tee/tee.c
105
if ((wval = write(p->fd, bp, n)) == -1) {
usr.bin/tee/tee.c
127
add(int fd, const char *name)
usr.bin/tee/tee.c
134
p->fd = fd;
usr.bin/tee/tee.c
48
int fd;
usr.bin/tee/tee.c
60
int n, fd, rval, wval, flags;
usr.bin/tee/tee.c
92
if ((fd = open(*argv, flags, DEFFILEMODE)) < 0) {
usr.bin/tee/tee.c
96
add(fd, *argv);
usr.bin/telnet/sys_bsd.c
788
NetClose(int fd)
usr.bin/telnet/sys_bsd.c
790
return close(fd);
usr.bin/telnet/sys_bsd.c
794
NetNonblockingIO(int fd, int onoff)
usr.bin/telnet/sys_bsd.c
796
ioctl(fd, FIONBIO, (char *)&onoff);
usr.bin/telnet/telnet.c
653
setupterm(char *tname, int fd, int *errp)
usr.bin/telnet/utilities.c
90
SetSockOpt(int fd, int level, int option, int yesno)
usr.bin/telnet/utilities.c
92
return setsockopt(fd, level, option,
usr.bin/tftp/main.c
324
int fd;
usr.bin/tftp/main.c
362
fd = open(cp, O_RDONLY);
usr.bin/tftp/main.c
363
if (fd < 0) {
usr.bin/tftp/main.c
370
xmitfile(fd, targ, mode);
usr.bin/tftp/main.c
379
fd = open(argv[n], O_RDONLY);
usr.bin/tftp/main.c
380
if (fd < 0) {
usr.bin/tftp/main.c
387
xmitfile(fd, targ, mode);
usr.bin/tftp/main.c
404
int fd;
usr.bin/tftp/main.c
445
fd = creat(cp, 0644);
usr.bin/tftp/main.c
446
if (fd < 0) {
usr.bin/tftp/main.c
453
recvfile(fd, src, mode);
usr.bin/tftp/main.c
457
fd = creat(cp, 0644);
usr.bin/tftp/main.c
458
if (fd < 0) {
usr.bin/tftp/main.c
465
recvfile(fd, src, mode);
usr.bin/tftp/tftp.c
103
file = fdopen(fd, "r");
usr.bin/tftp/tftp.c
201
recvfile(int fd, char *name, char *mode)
usr.bin/tftp/tftp.c
219
file = fdopen(fd, "w");
usr.bin/tftp/tftp.c
86
xmitfile(int fd, char *name, char *mode)
usr.bin/tip/acu.c
113
if ((fd = fopen(PH, "r")) == NULL) {
usr.bin/tip/acu.c
117
while (fgets(string, sizeof(string), fd) != NULL) {
usr.bin/tip/acu.c
121
fclose(fd);
usr.bin/tip/acu.c
130
fclose(fd);
usr.bin/tip/acu.c
139
fclose(fd);
usr.bin/tip/acu.c
150
fclose(fd);
usr.bin/tip/acu.c
63
FILE *fd;
usr.bin/tip/cmds.c
129
int fd, argc;
usr.bin/tip/cmds.c
141
if ((fd = creat(cp, 0666)) < 0) {
usr.bin/tip/cmds.c
146
xfer(line, fd, "\n___tip_end_of_file_marker___\n");
usr.bin/tip/cmds.c
152
xfer(char *buf, int fd, char *eofchars)
usr.bin/tip/cmds.c
164
if ((ff = fdopen (fd, "w")) == NULL) {
usr.bin/tip/cmds.c
237
transfer(char *buf, int fd, char *eofchars)
usr.bin/tip/cmds.c
249
if ((ff = fdopen (fd, "w")) == NULL) {
usr.bin/tip/cmds.c
366
FILE *fd;
usr.bin/tip/cmds.c
380
if ((fd = fopen(fnamex, "r")) == NULL) {
usr.bin/tip/cmds.c
384
transmit(fd, value(EOFWRITE), NULL);
usr.bin/tip/cmds.c
395
transmit(FILE *fd, char *eofchars, char *command)
usr.bin/tip/cmds.c
423
c = getc(fd);
usr.bin/tip/cmds.c
474
fclose(fd);
usr.bin/tip/cmds.c
492
FILE *fd;
usr.bin/tip/cmds.c
506
if ((fd = fopen(copynamex, "r")) == NULL) {
usr.bin/tip/cmds.c
514
transmit(fd, "\04", line);
usr.bin/tip/cmds.c
645
int fd;
usr.bin/tip/cmds.c
649
for (fd = 3; fd < 20; fd++)
usr.bin/tip/cmds.c
650
close (fd);
usr.bin/tip/tip.c
568
xpwrite(int fd, char *buf, int n)
usr.bin/tip/tip.c
579
if (write(fd, buf, n) < 0) {
usr.bin/tip/unidialer.c
709
static void unidialer_modem_cmd (int fd, const char *cmd)
usr.bin/tip/unidialer.c
731
unidialer_write_str (fd, cmd);
usr.bin/tip/unidialer.c
738
static void unidialer_write_str (int fd, const char *cp)
usr.bin/tip/unidialer.c
743
unidialer_write (fd, cp, strlen (cp));
usr.bin/tip/unidialer.c
746
static void unidialer_write (int fd, const char *cp, int n)
usr.bin/tip/unidialer.c
750
write (fd, cp, 1);
usr.bin/tip/unidialer.c
96
static void unidialer_modem_cmd(int fd, const char *cmd);
usr.bin/tip/unidialer.c
97
static void unidialer_write(int fd, const char *cp, int n);
usr.bin/tip/unidialer.c
98
static void unidialer_write_str(int fd, const char *cp);
usr.bin/touch/touch.c
164
fd = open(*argv,
usr.bin/touch/touch.c
166
if (fd == -1 || fstat(fd, &sb) || close(fd)) {
usr.bin/touch/touch.c
63
int Aflag, aflag, cflag, mflag, ch, fd, len, rval, timeset;
usr.bin/truncate/truncate.c
107
if ((fd = open(fname, oflags, omode)) == -1) {
usr.bin/truncate/truncate.c
115
if (fstat(fd, &sb) == -1) {
usr.bin/truncate/truncate.c
132
if (ftruncate(fd, tsize) == -1) {
usr.bin/truncate/truncate.c
138
close(fd);
usr.bin/truncate/truncate.c
53
int ch, error, fd, oflags;
usr.bin/truss/main.c
100
int fd;
usr.bin/truss/main.c
105
if ((fd = open(etype, O_RDONLY)) == -1) {
usr.bin/truss/main.c
108
int len = read(fd, progt, sizeof(progt));
usr.bin/truss/main.c
110
close(fd);
usr.bin/truss/setup.c
104
fd = open(buf, O_RDWR);
usr.bin/truss/setup.c
105
} while(fd == -1 && errno == EAGAIN);
usr.bin/truss/setup.c
107
if (fd == -1)
usr.bin/truss/setup.c
109
if (ioctl(fd, PIOCWAIT, &pfs) == -1)
usr.bin/truss/setup.c
113
ioctl(fd, PIOCCONT, 0);
usr.bin/truss/setup.c
117
close(fd);
usr.bin/truss/setup.c
129
int fd;
usr.bin/truss/setup.c
137
fd = open(buf, O_RDWR);
usr.bin/truss/setup.c
138
} while(fd == -1 && errno == EAGAIN);
usr.bin/truss/setup.c
140
if (fd == -1) {
usr.bin/truss/setup.c
151
if (ioctl(fd, PIOCSTATUS, &tmp) == -1) {
usr.bin/truss/setup.c
156
if (ioctl(fd, PIOCBIS, flags) == -1)
usr.bin/truss/setup.c
165
if (ioctl(fd, PIOCSFL, 0) == -1)
usr.bin/truss/setup.c
168
return fd;
usr.bin/truss/setup.c
70
int fd;
usr.bin/truss/setup.c
81
fd = open(buf, O_WRONLY);
usr.bin/truss/setup.c
83
if (fd == -1)
usr.bin/truss/setup.c
85
fcntl(fd, F_SETFD, FD_CLOEXEC);
usr.bin/truss/setup.c
86
if (ioctl(fd, PIOCBIS, S_EXEC | S_EXIT) == -1)
usr.bin/truss/setup.c
93
if (ioctl(fd, PIOCSFL, PF_LINGER) == -1)
usr.bin/truss/syscalls.c
175
print_arg(int fd, struct syscall_args *sc, unsigned long *args) {
usr.bin/truss/syscalls.c
196
tmp2 = get_string(fd, (off_t)args[sc->offset], 0);
usr.bin/truss/syscalls.c
241
if (get_struct(fd, (off_t)args[sc->offset], &ss,
usr.bin/truss/syscalls.c
246
if (get_struct(fd, (off_t)args[sc->offset], &ss,
usr.bin/truss/syscalls.c
251
if (get_struct(fd, (off_t)args[sc->offset], &ss,
usr.bin/truss/x86_64-fbsd.c
117
if (fd == -1 || trussinfo->pid != cpid) {
usr.bin/truss/x86_64-fbsd.c
121
fd = open(buf, O_RDWR);
usr.bin/truss/x86_64-fbsd.c
123
if (fd == -1) {
usr.bin/truss/x86_64-fbsd.c
131
i = pread(fd, ®s, sizeof(regs), 0L);
usr.bin/truss/x86_64-fbsd.c
270
if (fd == -1 || trussinfo->pid != cpid) {
usr.bin/truss/x86_64-fbsd.c
274
fd = open(buf, O_RDONLY);
usr.bin/truss/x86_64-fbsd.c
276
if (fd == -1) {
usr.bin/truss/x86_64-fbsd.c
283
if (pread(fd, ®s, sizeof(regs), 0L) != sizeof(regs)) {
usr.bin/truss/x86_64-fbsd.c
63
static int fd = -1;
usr.bin/tset/misc.c
45
int fd, nr, nw;
usr.bin/tset/misc.c
48
if ((fd = open(file, O_RDONLY, 0)) < 0)
usr.bin/tset/misc.c
51
while ((nr = read(fd, buf, sizeof(buf))) > 0)
usr.bin/tset/misc.c
56
(void)close(fd);
usr.bin/undo/undo.c
106
static void runcmd(int fd, const char *cmd, ...);
usr.bin/undo/undo.c
553
__collect_history(int fd, int *errorp, struct undo_hist_entry_rb_tree *tse_tree)
usr.bin/undo/undo.c
576
fstat(fd, &st);
usr.bin/undo/undo.c
581
if (ioctl(fd, HAMMERIOC_GETHISTORY, &hist) < 0) {
usr.bin/undo/undo.c
602
if (ioctl(fd, HAMMERIOC_GETHISTORY, &hist) < 0) {
usr.bin/undo/undo.c
614
int fd;
usr.bin/undo/undo.c
616
fd = open(filename, O_RDONLY);
usr.bin/undo/undo.c
617
if (fd == -1) {
usr.bin/undo/undo.c
621
__collect_history(fd, errorp, dir_tree);
usr.bin/undo/undo.c
622
close(fd);
usr.bin/undo/undo.c
670
runcmd(int fd, const char *cmd, ...)
usr.bin/undo/undo.c
693
if (fd != 1) {
usr.bin/undo/undo.c
694
dup2(fd, 1);
usr.bin/undo/undo.c
695
close(fd);
usr.bin/undo/undo.c
96
static void __collect_history(int fd, int *error,
usr.bin/unifdef/unifdef.h
46
int fd = mkstemp(tmp);
usr.bin/unifdef/unifdef.h
47
if (fd < 0) return (NULL);
usr.bin/unifdef/unifdef.h
48
fchmod(fd, mode & (S_IRWXU|S_IRWXG|S_IRWXO));
usr.bin/unifdef/unifdef.h
49
return (fdopen(fd, "wb"));
usr.bin/unzip/unzip.c
496
extract2fd(struct archive *a, char *pathname, int fd)
usr.bin/unzip/unzip.c
508
if (fd != STDOUT_FILENO)
usr.bin/unzip/unzip.c
520
if (write(fd, "\r", 1) != 1)
usr.bin/unzip/unzip.c
547
if (write(fd, buffer, len) != len)
usr.bin/unzip/unzip.c
570
if (write(fd, p, q - p) != q - p)
usr.bin/unzip/unzip.c
588
int fd, check, text;
usr.bin/unzip/unzip.c
644
if ((fd = open(*path, O_RDWR|O_CREAT|O_TRUNC, mode)) < 0)
usr.bin/unzip/unzip.c
649
text = extract2fd(a, *path, fd);
usr.bin/unzip/unzip.c
658
if (futimens(fd, ts) != 0)
usr.bin/unzip/unzip.c
660
if (close(fd) != 0)
usr.bin/usbhidaction/usbhidaction.c
149
fd = open(dev, O_RDWR);
usr.bin/usbhidaction/usbhidaction.c
150
if (fd < 0)
usr.bin/usbhidaction/usbhidaction.c
152
repd = hid_get_report_desc(fd);
usr.bin/usbhidaction/usbhidaction.c
184
n = read(fd, buf, sz);
usr.bin/usbhidaction/usbhidaction.c
88
int fd, fp, ch, n, val, i;
usr.bin/uudecode/uudecode.c
167
int flags, fd;
usr.bin/uudecode/uudecode.c
284
if ((fd = open(outfile, flags, mode)) < 0 ||
usr.bin/uudecode/uudecode.c
285
(outfp = fdopen(fd, "w")) == NULL) {
usr.bin/wall/ttymsg.c
122
(void) close(fd);
usr.bin/wall/ttymsg.c
129
(void) close(fd);
usr.bin/wall/ttymsg.c
133
(void) close(fd);
usr.bin/wall/ttymsg.c
142
(void) fcntl(fd, F_SETFL, 0); /* clear O_NONBLOCK */
usr.bin/wall/ttymsg.c
151
(void) close(fd);
usr.bin/wall/ttymsg.c
159
(void) close(fd);
usr.bin/wall/ttymsg.c
60
int cnt, fd;
usr.bin/wall/ttymsg.c
85
if ((fd = open(device, O_WRONLY|O_NONBLOCK, 0)) < 0) {
usr.bin/wall/ttymsg.c
97
wret = writev(fd, iov, iovcnt);
usr.bin/wall/wall.c
173
int fd;
usr.bin/wall/wall.c
180
if ((fd = mkstemp(tmpname)) == -1 || !(fp = fdopen(fd, "r+")))
usr.bin/wall/wall.c
268
if (fstat(fd, &sbuf))
usr.bin/wall/wall.c
275
(void)close(fd);
usr.bin/wc/wc.c
168
int fd, len, warned;
usr.bin/wc/wc.c
178
fd = STDIN_FILENO;
usr.bin/wc/wc.c
180
if ((fd = open(file, O_RDONLY)) < 0) {
usr.bin/wc/wc.c
192
while ((len = read(fd, buf, MAXBSIZE))) {
usr.bin/wc/wc.c
195
close(fd);
usr.bin/wc/wc.c
222
close(fd);
usr.bin/wc/wc.c
230
if (fstat(fd, &sb)) {
usr.bin/wc/wc.c
232
close(fd);
usr.bin/wc/wc.c
241
close(fd);
usr.bin/wc/wc.c
251
while ((len = read(fd, buf, MAXBSIZE)) != 0) {
usr.bin/wc/wc.c
254
close(fd);
usr.bin/wc/wc.c
313
close(fd);
usr.bin/window/wwiomux.c
108
pfd[nfd].fd = w->ww_pty;
usr.bin/window/wwiomux.c
117
pfd[nfd].fd = 0;
usr.bin/window/wwiomux.c
159
if (w->ww_pty != pfd[nfd].fd)
usr.bin/xargs/xargs.c
570
int fd;
usr.bin/xargs/xargs.c
616
if ((fd = open(_PATH_TTY, O_RDONLY)) == -1)
usr.bin/xargs/xargs.c
619
fd = open(_PATH_DEVNULL, O_RDONLY);
usr.bin/xargs/xargs.c
621
if (fd > STDIN_FILENO) {
usr.bin/xargs/xargs.c
622
if (dup2(fd, STDIN_FILENO) != 0)
usr.bin/xargs/xargs.c
624
close(fd);
usr.bin/xinstall/xinstall.c
1165
trymmap(int fd)
usr.bin/xinstall/xinstall.c
1174
if (nommap || fstatfs(fd, &stfs) != 0)
usr.bin/xinstall/xinstall.c
352
int fd;
usr.bin/xinstall/xinstall.c
354
if ((fd = mkstemp(template)) == -1)
usr.bin/xinstall/xinstall.c
356
close (fd);
usr.sbin/acpi/acpicall/acpicall.c
174
fd = open(dev_path, O_RDWR);
usr.sbin/acpi/acpicall/acpicall.c
175
if (fd < 0) {
usr.sbin/acpi/acpicall/acpicall.c
179
if (ioctl(fd, ACPIIO_DO_MCALL, ¶ms) == -1) {
usr.sbin/acpi/acpicall/acpicall.c
65
int i, fd, status;
usr.sbin/autofs/common.c
1168
int error, fd;
usr.sbin/autofs/common.c
1174
fd = open(_PATH_DEVNULL, O_RDWR, 0);
usr.sbin/autofs/common.c
1175
if (fd < 0) {
usr.sbin/autofs/common.c
1180
error = dup2(fd, STDIN_FILENO);
usr.sbin/autofs/common.c
1184
error = close(fd);
usr.sbin/boot0cfg/boot0cfg.c
219
int mbr_size, fd;
usr.sbin/boot0cfg/boot0cfg.c
222
if ((fd = open(disk, O_RDONLY)) == -1)
usr.sbin/boot0cfg/boot0cfg.c
224
if ((n = read(fd, buf, MBRSIZE)) == -1)
usr.sbin/boot0cfg/boot0cfg.c
238
if (lseek(fd, 0, SEEK_SET) == -1 ||
usr.sbin/boot0cfg/boot0cfg.c
239
(n = read(fd, *mbr, mbr_size)) == -1)
usr.sbin/boot0cfg/boot0cfg.c
243
close(fd);
usr.sbin/boot0cfg/boot0cfg.c
250
close(fd);
usr.sbin/boot0cfg/boot0cfg.c
260
int fd;
usr.sbin/boot0cfg/boot0cfg.c
263
fd = open(fname, O_WRONLY | flags, 0666);
usr.sbin/boot0cfg/boot0cfg.c
264
if (fd != -1) {
usr.sbin/boot0cfg/boot0cfg.c
265
n = write(fd, mbr, mbr_size);
usr.sbin/boot0cfg/boot0cfg.c
266
close(fd);
usr.sbin/bthcid/client.c
137
int fd;
usr.sbin/bthcid/client.c
141
fd = accept(sock, (struct sockaddr *)&un, &n);
usr.sbin/bthcid/client.c
142
if (fd < 0) {
usr.sbin/bthcid/client.c
148
if (ioctl(fd, FIONBIO, &n) < 0) {
usr.sbin/bthcid/client.c
150
close(fd);
usr.sbin/bthcid/client.c
157
close(fd);
usr.sbin/bthcid/client.c
162
cl->fd = fd;
usr.sbin/bthcid/client.c
164
EV_SET(&change, cl->fd, EVFILT_READ, EV_ADD, 0, 0, cl);
usr.sbin/bthcid/client.c
168
close(fd);
usr.sbin/bthcid/client.c
266
if (send(cl->fd, &cp, sizeof(cp), 0) != sizeof(cp))
usr.sbin/bthcid/client.c
55
int fd; /* client descriptor */
usr.sbin/burncd/burncd.c
138
if ((fd = open(dev, O_RDWR, 0)) < 0)
usr.sbin/burncd/burncd.c
141
if (ioctl(fd, CDRIOCGETBLOCKSIZE, &saved_block_size) < 0)
usr.sbin/burncd/burncd.c
144
if (ioctl(fd, CDRIOCWRITESPEED, &speed) < 0)
usr.sbin/burncd/burncd.c
158
if (ioctl(fd, CDIOREADTOCHEADER, &header) < 0)
usr.sbin/burncd/burncd.c
163
if (ioctl(fd, CDIOREADTOCENTRY, &entry) < 0)
usr.sbin/burncd/burncd.c
165
if (ioctl(fd, CDRIOCNEXTWRITEABLEADDR, &addr) < 0)
usr.sbin/burncd/burncd.c
183
if (ioctl(fd, CDRIOCBLANK, &blank) < 0)
usr.sbin/burncd/burncd.c
187
error = ioctl(fd, CDRIOCGETPROGRESS, &percent);
usr.sbin/burncd/burncd.c
257
if (ioctl(fd, CDIOCSTART, 0) < 0)
usr.sbin/burncd/burncd.c
260
if (ioctl(fd, CDRIOCINITWRITER, &test_write) < 0)
usr.sbin/burncd/burncd.c
272
if (ioctl(fd, CDRIOCFIXATE, &multi) < 0)
usr.sbin/burncd/burncd.c
276
if (ioctl(fd, CDRIOCSETBLOCKSIZE, &saved_block_size) < 0) {
usr.sbin/burncd/burncd.c
282
if (ioctl(fd, CDIOCEJECT) < 0)
usr.sbin/burncd/burncd.c
284
close(fd);
usr.sbin/burncd/burncd.c
354
if (ioctl(fd, CDRIOCNEXTWRITEABLEADDR, &addr) < 0)
usr.sbin/burncd/burncd.c
429
if (ioctl(fd, CDRIOCSENDCUE, &sheet) < 0)
usr.sbin/burncd/burncd.c
437
ioctl(fd, CDRIOCFLUSH);
usr.sbin/burncd/burncd.c
450
if (ioctl(fd, CDRIOCINITTRACK, &track) < 0)
usr.sbin/burncd/burncd.c
453
if (ioctl(fd, CDRIOCNEXTWRITEABLEADDR, &tracks[i].addr) < 0)
usr.sbin/burncd/burncd.c
460
if (ioctl(fd, CDRIOCFLUSH) < 0)
usr.sbin/burncd/burncd.c
474
if (ioctl(fd, CDRIOCSETBLOCKSIZE, &track_info->block_size) < 0)
usr.sbin/burncd/burncd.c
478
lseek(fd, track_info->addr * track_info->block_size, SEEK_SET);
usr.sbin/burncd/burncd.c
507
if ((res = write(fd, buf, count)) != count) {
usr.sbin/burncd/burncd.c
559
if (ioctl(fd, CDRIOCSETBLOCKSIZE, &saved_block_size) < 0)
usr.sbin/burncd/burncd.c
57
static int fd, quiet, verbose, saved_block_size, notracks;
usr.sbin/cdcontrol/cdcontrol.c
1048
return ioctl (fd, CDIOCPLAYTRACKS, &t);
usr.sbin/cdcontrol/cdcontrol.c
1059
return ioctl (fd, CDIOCPLAYBLOCKS, &t);
usr.sbin/cdcontrol/cdcontrol.c
1072
return ioctl (fd, CDIOCSETVOL, &v);
usr.sbin/cdcontrol/cdcontrol.c
1085
return (ioctl (fd, CDIOREADTOCENTRYS, (char *) &t));
usr.sbin/cdcontrol/cdcontrol.c
1101
return ioctl (fd, CDIOCPLAYMSF, (char *) &a);
usr.sbin/cdcontrol/cdcontrol.c
1117
if (ioctl (fd, CDIOCREADSUBCHANNEL, (char *) &s) < 0)
usr.sbin/cdcontrol/cdcontrol.c
115
static int fd = -1;
usr.sbin/cdcontrol/cdcontrol.c
1261
if (fd > -1)
usr.sbin/cdcontrol/cdcontrol.c
1270
fd = open (devbuf, O_RDONLY);
usr.sbin/cdcontrol/cdcontrol.c
1272
if (fd < 0 && errno == ENOENT) {
usr.sbin/cdcontrol/cdcontrol.c
1274
fd = open (devbuf, O_RDONLY);
usr.sbin/cdcontrol/cdcontrol.c
1277
if (fd < 0) {
usr.sbin/cdcontrol/cdcontrol.c
275
close (fd);
usr.sbin/cdcontrol/cdcontrol.c
276
fd = -1;
usr.sbin/cdcontrol/cdcontrol.c
294
if (fd < 0 && ! open_cd ())
usr.sbin/cdcontrol/cdcontrol.c
300
if (fd < 0 && ! open_cd ())
usr.sbin/cdcontrol/cdcontrol.c
306
if (fd < 0 && ! open_cd ())
usr.sbin/cdcontrol/cdcontrol.c
313
if (fd < 0 && ! open_cd ())
usr.sbin/cdcontrol/cdcontrol.c
322
if (fd < 0 && ! open_cd ())
usr.sbin/cdcontrol/cdcontrol.c
325
return ioctl (fd, CDIOCPAUSE);
usr.sbin/cdcontrol/cdcontrol.c
328
if (fd < 0 && ! open_cd ())
usr.sbin/cdcontrol/cdcontrol.c
331
return ioctl (fd, CDIOCRESUME);
usr.sbin/cdcontrol/cdcontrol.c
334
if (fd < 0 && ! open_cd ())
usr.sbin/cdcontrol/cdcontrol.c
337
rc = ioctl (fd, CDIOCSTOP);
usr.sbin/cdcontrol/cdcontrol.c
339
ioctl (fd, CDIOCALLOW);
usr.sbin/cdcontrol/cdcontrol.c
344
if (fd < 0 && ! open_cd ())
usr.sbin/cdcontrol/cdcontrol.c
347
rc = ioctl (fd, CDIOCRESET);
usr.sbin/cdcontrol/cdcontrol.c
350
close(fd);
usr.sbin/cdcontrol/cdcontrol.c
351
fd = -1;
usr.sbin/cdcontrol/cdcontrol.c
355
if (fd < 0 && ! open_cd ())
usr.sbin/cdcontrol/cdcontrol.c
359
return ioctl (fd, CDIOCSETDEBUG);
usr.sbin/cdcontrol/cdcontrol.c
362
return ioctl (fd, CDIOCCLRDEBUG);
usr.sbin/cdcontrol/cdcontrol.c
369
if (fd < 0 && ! open_cd ())
usr.sbin/cdcontrol/cdcontrol.c
372
ioctl (fd, CDIOCALLOW);
usr.sbin/cdcontrol/cdcontrol.c
373
rc = ioctl (fd, CDIOCEJECT);
usr.sbin/cdcontrol/cdcontrol.c
379
if (fd < 0 && ! open_cd ())
usr.sbin/cdcontrol/cdcontrol.c
382
ioctl (fd, CDIOCALLOW);
usr.sbin/cdcontrol/cdcontrol.c
383
rc = ioctl (fd, CDIOCCLOSE);
usr.sbin/cdcontrol/cdcontrol.c
386
close(fd);
usr.sbin/cdcontrol/cdcontrol.c
387
fd = -1;
usr.sbin/cdcontrol/cdcontrol.c
391
if (fd < 0 && ! open_cd ())
usr.sbin/cdcontrol/cdcontrol.c
409
if (fd < 0 && !open_cd ())
usr.sbin/cdcontrol/cdcontrol.c
413
return ioctl (fd, CDIOCSETLEFT);
usr.sbin/cdcontrol/cdcontrol.c
416
return ioctl (fd, CDIOCSETRIGHT);
usr.sbin/cdcontrol/cdcontrol.c
419
return ioctl (fd, CDIOCSETMONO);
usr.sbin/cdcontrol/cdcontrol.c
422
return ioctl (fd, CDIOCSETSTEREO);
usr.sbin/cdcontrol/cdcontrol.c
425
return ioctl (fd, CDIOCSETMUTE);
usr.sbin/cdcontrol/cdcontrol.c
435
if (fd < 0 && ! open_cd ())
usr.sbin/cdcontrol/cdcontrol.c
447
return ioctl(fd, CDRIOCREADSPEED, &speed);
usr.sbin/cdcontrol/cdcontrol.c
464
rc = ioctl (fd, CDIOREADTOCHEADER, &h);
usr.sbin/cdcontrol/cdcontrol.c
748
rc = ioctl (fd, CDIOREADTOCHEADER, &h);
usr.sbin/cdcontrol/cdcontrol.c
828
rc = ioctl (fd, CDIOCREADSUBCHANNEL, (char *) &ss);
usr.sbin/cdcontrol/cdcontrol.c
844
rc = ioctl (fd, CDIOCGETVOL, &v);
usr.sbin/cdcontrol/cdcontrol.c
906
rc = ioctl (fd, CDIOREADTOCHEADER, &h);
usr.sbin/cdcontrol/cdcontrol.c
950
rc = ioctl (fd, CDIOREADTOCHEADER, &h);
usr.sbin/ckdist/ckdist.c
228
int fd, bytes, i;
usr.sbin/ckdist/ckdist.c
233
fd = open(filename, O_RDONLY);
usr.sbin/ckdist/ckdist.c
234
if (fd < 0)
usr.sbin/ckdist/ckdist.c
236
if (fstat(fd, &st) < 0) {
usr.sbin/ckdist/ckdist.c
246
bytes = read(fd, buffer, sizeof(buffer));
usr.sbin/ckdist/ckdist.c
248
bytes = read(fd, buffer, size);
usr.sbin/ckdist/ckdist.c
256
close(fd);
usr.sbin/ckdist/ckdist.c
278
int rval, error, c, fd;
usr.sbin/ckdist/ckdist.c
296
if ((fd = open(dname, O_RDONLY)) == -1)
usr.sbin/ckdist/ckdist.c
298
else if (close(fd))
usr.sbin/ckdist/ckdist.c
326
int rval, error, c, pieces, cnt, fd;
usr.sbin/ckdist/ckdist.c
331
fd = -1;
usr.sbin/ckdist/ckdist.c
346
else if ((fd = open(dname, O_RDONLY)) == -1)
usr.sbin/ckdist/ckdist.c
348
else if (fstat(fd, &sb))
usr.sbin/ckdist/ckdist.c
353
if (crc(fd, &chk, &len))
usr.sbin/ckdist/ckdist.c
358
if (fd != -1 && close(fd))
usr.sbin/ckdist/ckdist.c
46
extern int crc(int fd, uint32_t *cval, off_t *clen);
usr.sbin/clog/clog.c
124
int fd;
usr.sbin/clog/clog.c
134
pfd.fd = -1;
usr.sbin/clog/clog.c
136
fd = open(lname,O_RDONLY);
usr.sbin/clog/clog.c
137
if (fd==-1) {
usr.sbin/clog/clog.c
142
if (fstat(fd,&sb)==-1) {
usr.sbin/clog/clog.c
146
pbuffer = mmap(NULL,sb.st_size,PROT_READ,MAP_SHARED,fd,0);
usr.sbin/clog/clog.c
178
close(fd);
usr.sbin/clog/clog.c
187
int fd;
usr.sbin/clog/clog.c
197
fd = open(lname,O_RDWR|O_CREAT,0666);
usr.sbin/clog/clog.c
198
if (fd==-1) {
usr.sbin/clog/clog.c
202
if (ftruncate(fd,(off_t)0)==-1) {
usr.sbin/clog/clog.c
208
if (write(fd,buffer,BUFFER_SIZE)==-1){
usr.sbin/clog/clog.c
216
if (write(fd,buffer,fill)==-1) {
usr.sbin/clog/clog.c
221
if (lseek(fd,-(off_t)(sizeof(struct clog_footer)),SEEK_END)==-1) {
usr.sbin/clog/clog.c
225
if (write(fd,&cf,sizeof(cf))==-1) {
usr.sbin/clog/clog.c
229
close(fd);
usr.sbin/cpucontrol/amd.c
118
fd = open(path, O_RDONLY, 0);
usr.sbin/cpucontrol/amd.c
119
if (fd < 0) {
usr.sbin/cpucontrol/amd.c
123
error = fstat(fd, &st);
usr.sbin/cpucontrol/amd.c
136
MAP_PRIVATE, fd, 0);
usr.sbin/cpucontrol/amd.c
175
if (fd >= 0)
usr.sbin/cpucontrol/amd.c
176
close(fd);
usr.sbin/cpucontrol/amd.c
53
amd_probe(int fd)
usr.sbin/cpucontrol/amd.c
61
error = ioctl(fd, CPUCTL_CPUID, &idargs);
usr.sbin/cpucontrol/amd.c
78
int fd, devfd;
usr.sbin/cpucontrol/amd.c
96
fd = -1;
usr.sbin/cpucontrol/amd10h.c
110
int fd, devfd;
usr.sbin/cpucontrol/amd10h.c
117
fd = -1;
usr.sbin/cpucontrol/amd10h.c
150
fd = open(path, O_RDONLY, 0);
usr.sbin/cpucontrol/amd10h.c
151
if (fd < 0) {
usr.sbin/cpucontrol/amd10h.c
155
error = fstat(fd, &st);
usr.sbin/cpucontrol/amd10h.c
171
MAP_PRIVATE, fd, 0);
usr.sbin/cpucontrol/amd10h.c
300
if (fd >= 0)
usr.sbin/cpucontrol/amd10h.c
301
close(fd);
usr.sbin/cpucontrol/amd10h.c
51
amd10h_probe(int fd)
usr.sbin/cpucontrol/amd10h.c
60
error = ioctl(fd, CPUCTL_CPUID, &idargs);
usr.sbin/cpucontrol/amd10h.c
73
error = ioctl(fd, CPUCTL_CPUID, &idargs);
usr.sbin/cpucontrol/cpucontrol.c
137
int fd, error;
usr.sbin/cpucontrol/cpucontrol.c
154
fd = open(dev, O_RDONLY);
usr.sbin/cpucontrol/cpucontrol.c
155
if (fd < 0) {
usr.sbin/cpucontrol/cpucontrol.c
159
error = ioctl(fd, CPUCTL_CPUID, &args);
usr.sbin/cpucontrol/cpucontrol.c
162
close(fd);
usr.sbin/cpucontrol/cpucontrol.c
167
close(fd);
usr.sbin/cpucontrol/cpucontrol.c
177
int fd, error;
usr.sbin/cpucontrol/cpucontrol.c
204
fd = open(dev, O_RDONLY);
usr.sbin/cpucontrol/cpucontrol.c
205
if (fd < 0) {
usr.sbin/cpucontrol/cpucontrol.c
209
error = ioctl(fd, CPUCTL_CPUID_COUNT, &args);
usr.sbin/cpucontrol/cpucontrol.c
212
close(fd);
usr.sbin/cpucontrol/cpucontrol.c
218
close(fd);
usr.sbin/cpucontrol/cpucontrol.c
231
int fd, error;
usr.sbin/cpucontrol/cpucontrol.c
318
fd = open(dev, op == OP_READ ? O_RDONLY : O_WRONLY);
usr.sbin/cpucontrol/cpucontrol.c
319
if (fd < 0) {
usr.sbin/cpucontrol/cpucontrol.c
324
error = ioctl(fd, command, &args);
usr.sbin/cpucontrol/cpucontrol.c
327
close(fd);
usr.sbin/cpucontrol/cpucontrol.c
333
close(fd);
usr.sbin/cpucontrol/cpucontrol.c
340
int fd, error;
usr.sbin/cpucontrol/cpucontrol.c
344
fd = open(dev, O_RDWR);
usr.sbin/cpucontrol/cpucontrol.c
345
if (fd < 0) {
usr.sbin/cpucontrol/cpucontrol.c
352
error = ioctl(fd, CPUCTL_EVAL_CPU_FEATURES, NULL);
usr.sbin/cpucontrol/cpucontrol.c
356
close(fd);
usr.sbin/cpucontrol/cpucontrol.c
363
int fd;
usr.sbin/cpucontrol/cpucontrol.c
372
fd = open(dev, O_RDONLY);
usr.sbin/cpucontrol/cpucontrol.c
373
if (fd < 0) {
usr.sbin/cpucontrol/cpucontrol.c
382
if (handlers[i].probe(fd) == 0)
usr.sbin/cpucontrol/cpucontrol.c
388
close(fd);
usr.sbin/cpucontrol/cpucontrol.c
391
close(fd);
usr.sbin/cpucontrol/cpucontrol.h
33
typedef int ucode_probe_t(int fd);
usr.sbin/cpucontrol/intel.c
109
fd = -1;
usr.sbin/cpucontrol/intel.c
147
fd = open(path, O_RDONLY, 0);
usr.sbin/cpucontrol/intel.c
148
if (fd < 0) {
usr.sbin/cpucontrol/intel.c
152
error = fstat(fd, &st);
usr.sbin/cpucontrol/intel.c
166
MAP_PRIVATE, fd, 0);
usr.sbin/cpucontrol/intel.c
287
if (fd >= 0)
usr.sbin/cpucontrol/intel.c
288
close(fd);
usr.sbin/cpucontrol/intel.c
56
intel_probe(int fd)
usr.sbin/cpucontrol/intel.c
64
error = ioctl(fd, CPUCTL_CPUID, &idargs);
usr.sbin/cpucontrol/intel.c
81
int fd, devfd;
usr.sbin/cpucontrol/via.c
104
fd = -1;
usr.sbin/cpucontrol/via.c
140
fd = open(path, O_RDONLY, 0);
usr.sbin/cpucontrol/via.c
141
if (fd < 0) {
usr.sbin/cpucontrol/via.c
145
error = fstat(fd, &st);
usr.sbin/cpucontrol/via.c
159
MAP_PRIVATE, fd, 0);
usr.sbin/cpucontrol/via.c
223
if (fd >= 0)
usr.sbin/cpucontrol/via.c
224
close(fd);
usr.sbin/cpucontrol/via.c
54
via_probe(int fd)
usr.sbin/cpucontrol/via.c
62
error = ioctl(fd, CPUCTL_CPUID, &idargs);
usr.sbin/cpucontrol/via.c
81
int fd, devfd;
usr.sbin/cron/lib/compat.c
103
int fd;
usr.sbin/cron/lib/compat.c
109
if ((fd = open(_PATH_TTY, 2)) >= 0)
usr.sbin/cron/lib/compat.c
111
ioctl(fd, TIOCNOTTY, NULL);
usr.sbin/cron/lib/compat.c
112
close(fd);
usr.sbin/cron/lib/compat.c
180
flock(int fd, int operation)
usr.sbin/cron/lib/compat.c
187
i = lockf (fd, F_LOCK, 0);
usr.sbin/cron/lib/compat.c
192
i = lockf (fd, F_TLOCK, 0);
usr.sbin/cron/lib/compat.c
199
i = lockf (fd, F_ULOCK, 0);
usr.sbin/cron/lib/misc.c
240
int fd, otherpid;
usr.sbin/cron/lib/misc.c
243
if ((-1 == (fd = open(pidfile, O_RDWR|O_CREAT, 0644)))
usr.sbin/cron/lib/misc.c
244
|| (NULL == (fp = fdopen(fd, "r+")))
usr.sbin/cron/lib/misc.c
252
if (flock(fd, LOCK_EX|LOCK_NB) < OK) {
usr.sbin/cron/lib/misc.c
262
fcntl(fd, F_SETFD, 1);
usr.sbin/daemon/daemon.c
505
listen_child(int fd, struct log_params *logpar)
usr.sbin/daemon/daemon.c
514
rv = read(fd, buf + bytes_read, LBUF_SIZE - bytes_read - 1);
usr.sbin/dconschat/dconschat.c
131
return (pread(dc->fd, buf, n, offset));
usr.sbin/dconschat/dconschat.c
146
return (pwrite(dc->fd, buf, n, offset));
usr.sbin/dconschat/dconschat.c
489
dconschat_write_socket(int fd, char *buf, int len)
usr.sbin/dconschat/dconschat.c
491
write(fd, buf, len);
usr.sbin/dconschat/dconschat.c
908
dc->fd = open(devicename, O_RDWR);
usr.sbin/dconschat/dconschat.c
909
if (dc->fd >= 0)
usr.sbin/dconschat/dconschat.c
914
error = ioctl(dc->fd, FW_SDEUI64, &eui);
usr.sbin/dconschat/dconschat.c
92
int fd;
usr.sbin/dntpd/client.c
202
if (info->fd < 0) {
usr.sbin/dntpd/client.c
209
if (udp_ntptimereq(info->fd, &rtv, <v, &lbtv) < 0) {
usr.sbin/dntpd/client.c
391
if (info->fd < 0) {
usr.sbin/dntpd/client.c
395
if (info->fd < 0) {
usr.sbin/dntpd/client.c
585
if (info1->fd < 0 || info1->server_state != 0)
usr.sbin/dntpd/client.c
590
if (i == j || info2->fd < 0)
usr.sbin/dntpd/client.c
592
if (info1->fd < 0 || /* info1 was lost in previous reconnect */
usr.sbin/dntpd/client.h
36
int fd; /* udp descriptor */
usr.sbin/dntpd/defs.h
83
int udp_ntptimereq(int fd, struct timeval *rtvp,
usr.sbin/dntpd/main.c
301
info.fd = udp_socket(target, 123, info.sam, LOG_DNS_ERROR);
usr.sbin/dntpd/main.c
302
if (info.fd < 0) {
usr.sbin/dntpd/main.c
358
info->fd = -1;
usr.sbin/dntpd/main.c
366
if (info->fd >= 0)
usr.sbin/dntpd/main.c
367
close(info->fd);
usr.sbin/dntpd/main.c
368
info->fd = -1;
usr.sbin/dntpd/main.c
386
if (info->fd >= 0) {
usr.sbin/dntpd/main.c
387
close(info->fd);
usr.sbin/dntpd/main.c
395
info->fd = udp_socket(info->target, 123, info->sam, policy);
usr.sbin/dntpd/main.c
396
if (info->fd >= 0) {
usr.sbin/dntpd/ntp.h
119
int fd;
usr.sbin/dntpd/ntpreq.c
124
n = write(fd, &wmsg, NTP_MSGSIZE_NOAUTH);
usr.sbin/dntpd/ntpreq.c
135
FD_SET(fd, &rfds);
usr.sbin/dntpd/ntpreq.c
136
select(fd + 1, &rfds, NULL, NULL, &seltv);
usr.sbin/dntpd/ntpreq.c
144
while ((n = read(fd, &rmsg, sizeof(rmsg))) >= 0) {
usr.sbin/dntpd/ntpreq.c
95
udp_ntptimereq(int fd, struct timeval *rtvp, struct timeval *ltvp,
usr.sbin/dntpd/socket.c
102
setsockopt(fd, IPPROTO_IP, IP_PORTRANGE, &tos, sizeof(tos));
usr.sbin/dntpd/socket.c
105
return(fd);
usr.sbin/dntpd/socket.c
47
int fd;
usr.sbin/dntpd/socket.c
62
fd = -1;
usr.sbin/dntpd/socket.c
64
fd = socket(res->ai_family, res->ai_socktype,
usr.sbin/dntpd/socket.c
66
if (fd < 0) {
usr.sbin/dntpd/socket.c
71
if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) {
usr.sbin/dntpd/socket.c
73
close(fd);
usr.sbin/dntpd/socket.c
74
fd = -1;
usr.sbin/dntpd/socket.c
78
if (connect(fd, res->ai_addr, res->ai_addrlen) < 0) {
usr.sbin/dntpd/socket.c
80
close(fd);
usr.sbin/dntpd/socket.c
81
fd = -1;
usr.sbin/dntpd/socket.c
88
if (fd < 0) {
usr.sbin/dntpd/socket.c
97
setsockopt(fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos));
usr.sbin/edquota/edquota.c
324
int qcmd, qupsize, fd;
usr.sbin/edquota/edquota.c
348
if ((fd = open(qfpathname, O_RDONLY)) < 0) {
usr.sbin/edquota/edquota.c
349
fd = open(qfpathname, O_RDWR|O_CREAT, 0640);
usr.sbin/edquota/edquota.c
350
if (fd < 0 && errno != ENOENT) {
usr.sbin/edquota/edquota.c
357
fchown(fd, getuid(),
usr.sbin/edquota/edquota.c
359
fchmod(fd, 0640);
usr.sbin/edquota/edquota.c
361
lseek(fd, (long)(id * sizeof(struct ufs_dqblk)), L_SET);
usr.sbin/edquota/edquota.c
362
switch (read(fd, &qup->dqblk, sizeof(struct ufs_dqblk))) {
usr.sbin/edquota/edquota.c
377
close(fd);
usr.sbin/edquota/edquota.c
381
close(fd);
usr.sbin/edquota/edquota.c
403
int qcmd, fd;
usr.sbin/edquota/edquota.c
409
if ((fd = open(qup->qfname, O_WRONLY)) < 0) {
usr.sbin/edquota/edquota.c
412
lseek(fd, (long)id * (long)sizeof(struct ufs_dqblk), 0);
usr.sbin/edquota/edquota.c
413
if (write(fd, &qup->dqblk, sizeof(struct ufs_dqblk)) !=
usr.sbin/edquota/edquota.c
417
close(fd);
usr.sbin/edquota/edquota.c
471
FILE *fd;
usr.sbin/edquota/edquota.c
475
if ((fd = fdopen(dup(outfd), "w")) == NULL)
usr.sbin/edquota/edquota.c
477
fprintf(fd, "Quotas for %s %s:\n", qfextension[quotatype], name);
usr.sbin/edquota/edquota.c
479
fprintf(fd, "%s: %s %lu, limits (soft = %lu, hard = %lu)\n",
usr.sbin/edquota/edquota.c
484
fprintf(fd, "%s %lu, limits (soft = %lu, hard = %lu)\n",
usr.sbin/edquota/edquota.c
490
fclose(fd);
usr.sbin/edquota/edquota.c
501
FILE *fd;
usr.sbin/edquota/edquota.c
509
fd = fopen(inname, "r");
usr.sbin/edquota/edquota.c
510
if (fd == NULL) {
usr.sbin/edquota/edquota.c
517
fgets(line1, sizeof(line1), fd);
usr.sbin/edquota/edquota.c
518
while (fgets(line1, sizeof(line1), fd) != NULL &&
usr.sbin/edquota/edquota.c
519
fgets(line2, sizeof(line2), fd) != NULL) {
usr.sbin/edquota/edquota.c
585
fclose(fd);
usr.sbin/edquota/edquota.c
609
FILE *fd;
usr.sbin/edquota/edquota.c
613
if ((fd = fdopen(dup(outfd), "w")) == NULL)
usr.sbin/edquota/edquota.c
615
fprintf(fd, "Time units may be: days, hours, minutes, or seconds\n");
usr.sbin/edquota/edquota.c
616
fprintf(fd, "Grace period before enforcing soft limits for %ss:\n",
usr.sbin/edquota/edquota.c
619
fprintf(fd, "%s: block grace period: %s, ",
usr.sbin/edquota/edquota.c
621
fprintf(fd, "file grace period: %s\n",
usr.sbin/edquota/edquota.c
624
fclose(fd);
usr.sbin/edquota/edquota.c
635
FILE *fd;
usr.sbin/edquota/edquota.c
642
fd = fopen(inname, "r");
usr.sbin/edquota/edquota.c
643
if (fd == NULL) {
usr.sbin/edquota/edquota.c
650
fgets(line1, sizeof(line1), fd);
usr.sbin/edquota/edquota.c
651
fgets(line1, sizeof(line1), fd);
usr.sbin/edquota/edquota.c
652
while (fgets(line1, sizeof(line1), fd) != NULL) {
usr.sbin/edquota/edquota.c
683
fclose(fd);
usr.sbin/efidp/efidp.c
61
read_file(int fd, void **rv)
usr.sbin/efidp/efidp.c
72
red = read(fd, retval + off, len - off);
usr.sbin/efivar/efivar.c
193
int fd;
usr.sbin/efivar/efivar.c
195
fd = open(fromfile, O_RDONLY);
usr.sbin/efivar/efivar.c
196
if (fd < 0)
usr.sbin/efivar/efivar.c
201
datalen = read(fd, data, 64 * 1024);
usr.sbin/efivar/efivar.c
204
close(fd);
usr.sbin/fdcontrol/fdcontrol.c
69
int fd, i;
usr.sbin/fdcontrol/fdcontrol.c
74
if ((fd = open(argv[1], 0)) < 0) {
usr.sbin/fdcontrol/fdcontrol.c
79
if (ioctl(fd, FD_GTYPE, &ft) < 0) {
usr.sbin/fdcontrol/fdcontrol.c
96
if(ioctl(fd, FD_STYPE, &ft) < 0) {
usr.sbin/fdformat/fdformat.c
102
ioctl(fd, FD_SOPTS, &fdopts);
usr.sbin/fdformat/fdformat.c
115
if (lseek(fd, (long)track * tracksize, 0) < 0)
usr.sbin/fdformat/fdformat.c
118
else if (read(fd, buf, tracksize) != tracksize
usr.sbin/fdformat/fdformat.c
119
&& read(fd, buf, tracksize) != tracksize)
usr.sbin/fdformat/fdformat.c
122
ioctl(fd, FD_SOPTS, &ofdopts);
usr.sbin/fdformat/fdformat.c
232
int fd, c, i, track, error, tracks_per_dot, bytes_per_track, errs;
usr.sbin/fdformat/fdformat.c
323
if ((fd = open(dev_name, O_RDWR)) < 0)
usr.sbin/fdformat/fdformat.c
326
if (ioctl(fd, FD_GTYPE, &fdt) < 0)
usr.sbin/fdformat/fdformat.c
329
if (ioctl(fd, FD_SOPTS, &fdopts) == -1)
usr.sbin/fdformat/fdformat.c
387
format_track(fd, track / fdt.heads, fdt.sectrac,
usr.sbin/fdformat/fdformat.c
396
if (verify_track(fd, track, bytes_per_track) < 0) {
usr.sbin/fdformat/fdformat.c
399
if (ioctl(fd, FD_GSTAT, fdcs + errs) ==
usr.sbin/fdformat/fdformat.c
56
format_track(int fd, int cyl, int secs, int head, int rate,
usr.sbin/fdformat/fdformat.c
86
if (ioctl(fd, FD_FORM, (caddr_t)&f) < 0)
usr.sbin/fdformat/fdformat.c
91
verify_track(int fd, int track, int tracksize)
usr.sbin/fdformat/fdformat.c
97
if (ioctl(fd, FD_GOPTS, &fdopts) < 0)
usr.sbin/fdwrite/fdwrite.c
132
if((fd = open(device, O_RDWR)) < 0)
usr.sbin/fdwrite/fdwrite.c
135
if(ioctl(fd, FD_GTYPE, &fdt) < 0)
usr.sbin/fdwrite/fdwrite.c
138
if (ioctl(fd, FD_SOPTS, &fdopts) == -1)
usr.sbin/fdwrite/fdwrite.c
171
format_track(fd, track / fdt.heads, fdt.sectrac, track % fdt.heads,
usr.sbin/fdwrite/fdwrite.c
176
if (lseek (fd, (long) track*bpt, 0) < 0) err(1, "lseek");
usr.sbin/fdwrite/fdwrite.c
177
if (write (fd, trackbuf, bpt) != bpt) err(1, "write");
usr.sbin/fdwrite/fdwrite.c
180
if (lseek (fd, (long) track*bpt, 0) < 0) err(1, "lseek");
usr.sbin/fdwrite/fdwrite.c
181
if (read (fd, vrfybuf, bpt) != bpt) err(1, "read");
usr.sbin/fdwrite/fdwrite.c
197
close(fd);
usr.sbin/fdwrite/fdwrite.c
29
format_track(int fd, int cyl, int secs, int head, int rate,
usr.sbin/fdwrite/fdwrite.c
58
return ioctl(fd, FD_FORM, (caddr_t)&f);
usr.sbin/fdwrite/fdwrite.c
71
int inputfd = -1, c, fdn = 0, i,j,fd;
usr.sbin/fstyp/fstyp.c
157
int error, fd;
usr.sbin/fstyp/fstyp.c
161
fd = fileno(fp);
usr.sbin/fstyp/fstyp.c
163
error = fstat(fd, &sb);
usr.sbin/fstyp/fstyp.c
170
error = ioctl(fd, DIOCGPART, &pinfo);
usr.sbin/fwcontrol/fwcontrol.c
112
read_write_quad(int fd, struct fw_eui64 eui, u_int32_t addr_lo, int readmode, u_int32_t data)
usr.sbin/fwcontrol/fwcontrol.c
139
if (ioctl(fd, FW_ASYREQ, asyreq) < 0) {
usr.sbin/fwcontrol/fwcontrol.c
151
send_phy_config(int fd, int root_node, int gap_count)
usr.sbin/fwcontrol/fwcontrol.c
170
if (ioctl(fd, FW_ASYREQ, asyreq) < 0)
usr.sbin/fwcontrol/fwcontrol.c
176
send_link_on(int fd, int node)
usr.sbin/fwcontrol/fwcontrol.c
189
if (ioctl(fd, FW_ASYREQ, asyreq) < 0)
usr.sbin/fwcontrol/fwcontrol.c
195
reset_start(int fd, int node)
usr.sbin/fwcontrol/fwcontrol.c
211
if (ioctl(fd, FW_ASYREQ, asyreq) < 0)
usr.sbin/fwcontrol/fwcontrol.c
217
set_pri_req(int fd, u_int32_t pri_req)
usr.sbin/fwcontrol/fwcontrol.c
224
data = get_dev(fd);
usr.sbin/fwcontrol/fwcontrol.c
230
reg = read_write_quad(fd, devinfo->eui, BUGET_REG, 1, 0);
usr.sbin/fwcontrol/fwcontrol.c
239
read_write_quad(fd, devinfo->eui, BUGET_REG, 0, pri_req);
usr.sbin/fwcontrol/fwcontrol.c
258
get_crom(int fd, int node, void *crom_buf, int len)
usr.sbin/fwcontrol/fwcontrol.c
264
data = get_dev(fd);
usr.sbin/fwcontrol/fwcontrol.c
280
if ((error = ioctl(fd, FW_GCROM, &buf)) < 0) {
usr.sbin/fwcontrol/fwcontrol.c
372
show_topology_map(int fd)
usr.sbin/fwcontrol/fwcontrol.c
384
if (ioctl(fd, FW_GTPMAP, tmap) < 0) {
usr.sbin/fwcontrol/fwcontrol.c
422
int fd, i, tmp, ch, len=1024;
usr.sbin/fwcontrol/fwcontrol.c
426
if ((fd = open(devicename, O_RDWR)) >= 0)
usr.sbin/fwcontrol/fwcontrol.c
429
if (fd < 0)
usr.sbin/fwcontrol/fwcontrol.c
433
list_dev(fd);
usr.sbin/fwcontrol/fwcontrol.c
440
send_phy_config(fd, -1, tmp);
usr.sbin/fwcontrol/fwcontrol.c
444
send_link_on(fd, tmp);
usr.sbin/fwcontrol/fwcontrol.c
448
reset_start(fd, tmp);
usr.sbin/fwcontrol/fwcontrol.c
452
set_pri_req(fd, tmp);
usr.sbin/fwcontrol/fwcontrol.c
455
if(ioctl(fd, FW_IBUSRST, &tmp) < 0)
usr.sbin/fwcontrol/fwcontrol.c
459
show_topology_map(fd);
usr.sbin/fwcontrol/fwcontrol.c
463
get_crom(fd, tmp, crom_buf, len);
usr.sbin/fwcontrol/fwcontrol.c
468
get_crom(fd, tmp, crom_buf, len);
usr.sbin/fwcontrol/fwcontrol.c
478
dvrecv(fd, optarg, TAG | CHANNEL, -1);
usr.sbin/fwcontrol/fwcontrol.c
481
dvsend(fd, optarg, TAG | CHANNEL, -1);
usr.sbin/fwcontrol/fwcontrol.c
76
get_dev(int fd)
usr.sbin/fwcontrol/fwcontrol.c
83
if( ioctl(fd, FW_GDEVLST, data) < 0) {
usr.sbin/fwcontrol/fwcontrol.c
90
list_dev(int fd)
usr.sbin/fwcontrol/fwcontrol.c
96
data = get_dev(fd);
usr.sbin/fwcontrol/fwdv.c
101
int len, tlen, npad, fd, k, m, vec, systype = -1, nb;
usr.sbin/fwcontrol/fwdv.c
105
fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, 0660);
usr.sbin/fwcontrol/fwdv.c
210
writev(fd, wbuf, vec);
usr.sbin/fwcontrol/fwdv.c
229
writev(fd, wbuf, vec);
usr.sbin/fwcontrol/fwdv.c
238
writev(fd, wbuf, vec);
usr.sbin/fwcontrol/fwdv.c
240
close(fd);
usr.sbin/fwcontrol/fwdv.c
253
int len, tlen, header, fd, frames, packets, vec, offset, nhdr, i;
usr.sbin/fwcontrol/fwdv.c
265
fd = open(filename, O_RDONLY);
usr.sbin/fwcontrol/fwdv.c
319
len = read(fd, pbuf + tlen, DSIZE * TNBUF - tlen);
usr.sbin/fwcontrol/fwdv.c
406
close(fd);
usr.sbin/inetd/builtins.c
731
#define strwrite(fd, buf) write(fd, buf, sizeof(buf)-1)
usr.sbin/inetd/builtins.c
734
get_line(int fd, char *buf, int len)
usr.sbin/inetd/builtins.c
745
n = read(fd, buf, len-count);
usr.sbin/inetd/inetd.c
1178
#define turnon(fd, opt) \
usr.sbin/inetd/inetd.c
1179
setsockopt(fd, SOL_SOCKET, opt, (char *)&on, sizeof (on))
usr.sbin/inetd/inetd.c
1845
nextline(FILE *fd)
usr.sbin/inetd/inetd.c
1849
if (fgets(line, sizeof (line), fd) == NULL)
usr.sbin/installer/dfuibe_installer/fn_configure.c
341
int fd;
usr.sbin/installer/dfuibe_installer/fn_configure.c
421
fd = open("/tmp/t1", O_RDWR | O_CREAT | O_TRUNC,
usr.sbin/installer/dfuibe_installer/fn_configure.c
423
if (fd != -1) {
usr.sbin/installer/dfuibe_installer/fn_configure.c
424
write(fd, passphrase_1, strlen(passphrase_1));
usr.sbin/installer/dfuibe_installer/fn_configure.c
425
close(fd);
usr.sbin/installer/libinstaller/survey.c
158
int fd;
usr.sbin/installer/libinstaller/survey.c
219
if ((fd = open(diskpath, O_RDONLY)) < 0)
usr.sbin/installer/libinstaller/survey.c
221
if (ioctl(fd, DIOCGPART, &diskpart) < 0)
usr.sbin/installer/libinstaller/survey.c
242
close(fd);
usr.sbin/kbdcontrol/kbdcontrol.c
1000
fd = open(device, O_RDONLY);
usr.sbin/kbdcontrol/kbdcontrol.c
1001
if (fd < 0) {
usr.sbin/kbdcontrol/kbdcontrol.c
1005
if (ioctl(fd, KDGKBINFO, &info) == -1) {
usr.sbin/kbdcontrol/kbdcontrol.c
1007
close(fd);
usr.sbin/kbdcontrol/kbdcontrol.c
1015
ioctl(fd, CONS_RELKBD, 0);
usr.sbin/kbdcontrol/kbdcontrol.c
1016
close(fd);
usr.sbin/kbdcontrol/kbdcontrol.c
234
get_definition_line(FILE *fd, keymap_t *keymap, accentmap_t *accentmap)
usr.sbin/kbdcontrol/kbdcontrol.c
238
yyin = fd;
usr.sbin/kbdcontrol/kbdcontrol.c
745
FILE *fd = NULL;
usr.sbin/kbdcontrol/kbdcontrol.c
753
if ((fd = fopen(name, "r")))
usr.sbin/kbdcontrol/kbdcontrol.c
756
if (fd == NULL) {
usr.sbin/kbdcontrol/kbdcontrol.c
764
if (get_definition_line(fd, &keymap, &accentmap) < 0)
usr.sbin/kbdcontrol/kbdcontrol.c
781
fclose(fd);
usr.sbin/kbdcontrol/kbdcontrol.c
787
fclose(fd);
usr.sbin/kbdcontrol/kbdcontrol.c
998
int fd;
usr.sbin/kbdmap/kbdmap.c
329
int fd, i, size;
usr.sbin/kbdmap/kbdmap.c
331
fd = mkstemp(tmp_name);
usr.sbin/kbdmap/kbdmap.c
332
if (fd == -1) {
usr.sbin/kbdmap/kbdmap.c
406
close(fd);
usr.sbin/keyserv/keyserv.c
240
int fd;
usr.sbin/keyserv/keyserv.c
246
fd = open(ROOTKEY, O_RDONLY, 0);
usr.sbin/keyserv/keyserv.c
247
if (fd < 0) {
usr.sbin/keyserv/keyserv.c
251
if (read(fd, secret, HEXKEYBYTES) < HEXKEYBYTES) {
usr.sbin/keyserv/keyserv.c
253
close(fd);
usr.sbin/keyserv/keyserv.c
256
close(fd);
usr.sbin/keyserv/keyserv.c
289
fd = open(ROOTKEY, O_WRONLY|O_TRUNC|O_CREAT, 0);
usr.sbin/keyserv/keyserv.c
290
if (fd > 0) {
usr.sbin/keyserv/keyserv.c
293
write(fd, secret, strlen(secret));
usr.sbin/keyserv/keyserv.c
294
write(fd, &newline, sizeof (newline));
usr.sbin/keyserv/keyserv.c
295
close(fd);
usr.sbin/lpr/common_source/common.c
273
int chres, errsav, fd, res, statres;
usr.sbin/lpr/common_source/common.c
364
fd = open(lfname, O_WRONLY|O_CREAT, newbits);
usr.sbin/lpr/common_source/common.c
369
if (fd >= 0) {
usr.sbin/lpr/common_source/common.c
371
close(fd);
usr.sbin/lpr/common_source/displayq.c
125
fd = open(pp->status_file, O_RDONLY|O_SHLOCK);
usr.sbin/lpr/common_source/displayq.c
127
if (fd >= 0) {
usr.sbin/lpr/common_source/displayq.c
128
while ((i = read(fd, line, sizeof(line))) > 0)
usr.sbin/lpr/common_source/displayq.c
130
close(fd); /* unlocks as well */
usr.sbin/lpr/common_source/displayq.c
182
fd = open(pp->status_file, O_RDONLY|O_SHLOCK);
usr.sbin/lpr/common_source/displayq.c
184
if (fd >= 0) {
usr.sbin/lpr/common_source/displayq.c
185
while ((i = read(fd, line,
usr.sbin/lpr/common_source/displayq.c
188
close(fd); /* unlocks as well */
usr.sbin/lpr/common_source/displayq.c
235
fd = getport(pp, pp->remote_host, 0);
usr.sbin/lpr/common_source/displayq.c
238
if (fd < 0) {
usr.sbin/lpr/common_source/displayq.c
245
if (write(fd, line, i) != i)
usr.sbin/lpr/common_source/displayq.c
247
while ((i = read(fd, line, sizeof(line))) > 0)
usr.sbin/lpr/common_source/displayq.c
249
close(fd);
usr.sbin/lpr/common_source/displayq.c
89
int i, nitems, fd, ret;
usr.sbin/lpr/lpc/cmds.c
1032
int fd, i;
usr.sbin/lpr/lpc/cmds.c
1066
fd = open(file, O_RDONLY);
usr.sbin/lpr/lpc/cmds.c
1067
if (fd < 0 || flock(fd, LOCK_SH|LOCK_NB) == 0) {
usr.sbin/lpr/lpc/cmds.c
1068
close(fd); /* unlocks as well */
usr.sbin/lpr/lpc/cmds.c
1072
close(fd);
usr.sbin/lpr/lpc/cmds.c
1075
fd = open(file, O_RDONLY|O_SHLOCK);
usr.sbin/lpr/lpc/cmds.c
1076
if (fd >= 0) {
usr.sbin/lpr/lpc/cmds.c
1077
fstat(fd, &stbuf);
usr.sbin/lpr/lpc/cmds.c
1080
while ((i = read(fd, line, sizeof(line))) > 0)
usr.sbin/lpr/lpc/cmds.c
1083
close(fd); /* unlocks as well */
usr.sbin/lpr/lpc/cmds.c
355
int fd;
usr.sbin/lpr/lpc/cmds.c
361
fd = open(statfile, O_WRONLY|O_CREAT|O_EXLOCK, STAT_FILE_MODE);
usr.sbin/lpr/lpc/cmds.c
363
if (fd < 0) {
usr.sbin/lpr/lpc/cmds.c
367
ftruncate(fd, 0);
usr.sbin/lpr/lpc/cmds.c
369
write(fd, "\n", 1);
usr.sbin/lpr/lpc/cmds.c
371
write(fd, msg, strlen(msg));
usr.sbin/lpr/lpc/cmds.c
372
close(fd);
usr.sbin/lpr/lpd/printjob.c
1850
int fd;
usr.sbin/lpr/lpd/printjob.c
1856
fd = open(pp->status_file, O_WRONLY|O_CREAT|O_EXLOCK, STAT_FILE_MODE);
usr.sbin/lpr/lpd/printjob.c
1857
if (fd < 0) {
usr.sbin/lpr/lpd/printjob.c
1862
ftruncate(fd, 0);
usr.sbin/lpr/lpd/printjob.c
1865
writel(fd, buf, "\n", NULL);
usr.sbin/lpr/lpd/printjob.c
1866
close(fd);
usr.sbin/lpr/lpd/recvjob.c
246
int err, fd, j;
usr.sbin/lpr/lpd/recvjob.c
248
fd = open(file, O_CREAT|O_EXCL|O_WRONLY, FILMOD);
usr.sbin/lpr/lpd/recvjob.c
249
if (fd < 0) {
usr.sbin/lpr/lpd/recvjob.c
273
if (write(fd, buf, amt) != (ssize_t)amt) {
usr.sbin/lpr/lpd/recvjob.c
278
close(fd);
usr.sbin/lpr/lpr/lpr.c
531
int fd, i, nr, nc;
usr.sbin/lpr/lpr/lpr.c
540
fd = nfile(dfname);
usr.sbin/lpr/lpr/lpr.c
543
if (write(fd, buf, i) != i) {
usr.sbin/lpr/lpr/lpr.c
558
close(fd);
usr.sbin/lpr/lpr/lpr.c
698
int fd;
usr.sbin/lpr/lpr/lpr.c
717
if ((fd = open(file, O_RDONLY)) < 0) {
usr.sbin/lpr/lpr/lpr.c
724
if (read(fd, &execb, sizeof(execb)) == sizeof(execb) &&
usr.sbin/lpr/lpr/lpr.c
729
close(fd);
usr.sbin/lpr/lpr/lpr.c
741
fd = checkwriteperm(file,"/");
usr.sbin/lpr/lpr/lpr.c
747
fd = checkwriteperm(file, dirpath);
usr.sbin/lpr/lpr/lpr.c
750
if (fd == 0)
usr.sbin/lpr/lpr/lpr.c
759
close(fd);
usr.sbin/lpr/lpr/lpr.c
836
int len, fd, n;
usr.sbin/lpr/lpr/lpr.c
842
if ((fd = open(buf, O_RDWR|O_CREAT, 0661)) < 0) {
usr.sbin/lpr/lpr/lpr.c
846
if (flock(fd, LOCK_EX)) {
usr.sbin/lpr/lpr/lpr.c
852
if ((len = read(fd, buf, sizeof(buf))) > 0) {
usr.sbin/lpr/lpr/lpr.c
865
lseek(fd, (off_t)0, 0);
usr.sbin/lpr/lpr/lpr.c
867
write(fd, buf, strlen(buf));
usr.sbin/lpr/lpr/lpr.c
868
close(fd); /* unlocks as well */
usr.sbin/lptcontrol/lptcontrol.c
61
int fd;
usr.sbin/lptcontrol/lptcontrol.c
92
if ((fd = open(device, O_WRONLY)) < 0)
usr.sbin/lptcontrol/lptcontrol.c
95
if (ioctl(fd, LPT_IRQ, &irq_status) < 0)
usr.sbin/lptcontrol/lptcontrol.c
98
close(fd);
usr.sbin/makefs/cd9660/cd9660_debug.c
193
debug_dump_to_xml_path_table(FILE *fd, off_t sector, int size, int mode)
usr.sbin/makefs/cd9660/cd9660_debug.c
199
if (fseeko(fd, CD9660_SECTOR_SIZE * sector, SEEK_SET) == -1)
usr.sbin/makefs/cd9660/cd9660_debug.c
204
fread(&pttemp, 1, 8, fd);
usr.sbin/makefs/cd9660/cd9660_debug.c
207
fread(((unsigned char*)&pttemp) + 8, 1, pttemp.length[0], fd);
usr.sbin/makefs/cd9660/cd9660_debug.c
222
debug_dump_to_xml(FILE *fd)
usr.sbin/makefs/cd9660/cd9660_debug.c
235
if (fseeko(fd, CD9660_SECTOR_SIZE * sector, SEEK_SET) == -1)
usr.sbin/makefs/cd9660/cd9660_debug.c
237
fread(buf, 1, CD9660_SECTOR_SIZE, fd);
usr.sbin/makefs/cd9660/cd9660_debug.c
256
debug_dump_to_xml_path_table(fd, t, t2, 721);
usr.sbin/makefs/cd9660/cd9660_debug.c
260
debug_dump_to_xml_path_table(fd, t, t2, 722);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
549
cd9660_write_mbr_partition_entry(FILE *fd, int idx, off_t sector_start,
usr.sbin/makefs/cd9660/cd9660_eltorito.c
555
if (fseeko(fd, (off_t)(idx) * 16 + 0x1be, SEEK_SET) == -1)
usr.sbin/makefs/cd9660/cd9660_eltorito.c
559
fwrite(&val, sizeof(val), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
562
fwrite(&val, sizeof(val), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
563
fwrite(&val, sizeof(val), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
564
fwrite(&val, sizeof(val), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
567
fwrite(&val, sizeof(val), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
570
fwrite(&val, sizeof(val), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
571
fwrite(&val, sizeof(val), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
572
fwrite(&val, sizeof(val), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
576
fwrite(&lba, sizeof(lba), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
578
fwrite(&lba, sizeof(lba), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
584
cd9660_write_apm_partition_entry(FILE *fd, int idx, int total_partitions,
usr.sbin/makefs/cd9660/cd9660_eltorito.c
594
if (fseeko(fd, (off_t)(idx + 1) * sector_size, SEEK_SET) == -1)
usr.sbin/makefs/cd9660/cd9660_eltorito.c
599
fwrite(&apm16, sizeof(apm16), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
601
fwrite(&apm16, sizeof(apm16), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
605
fwrite(&apm32, sizeof(apm32), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
608
fwrite(&apm32, sizeof(apm32), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
610
fwrite(&apm32, sizeof(apm32), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
612
fwrite(part_name, strlen(part_name) + 1, 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
613
fseek(fd, 32 - strlen(part_name) - 1, SEEK_CUR);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
614
fwrite(part_type, strlen(part_type) + 1, 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
615
fseek(fd, 32 - strlen(part_type) - 1, SEEK_CUR);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
619
fwrite(&apm32, sizeof(apm32), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
622
fwrite(&apm32, sizeof(apm32), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
625
fwrite(&apm32, sizeof(apm32), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
631
cd9660_write_boot(iso9660_disk *diskStructure, FILE *fd)
usr.sbin/makefs/cd9660/cd9660_eltorito.c
639
if (fseeko(fd, (off_t)diskStructure->boot_catalog_sector *
usr.sbin/makefs/cd9660/cd9660_eltorito.c
656
fwrite(&(e->entry_data.VE), 1, 32, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
667
cd9660_copy_file(diskStructure, fd, t->sector, t->filename);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
679
fseek(fd, 0x1fe, SEEK_SET);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
681
fwrite(&sig, sizeof(sig), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
687
cd9660_write_mbr_partition_entry(fd, mbr_partitions++,
usr.sbin/makefs/cd9660/cd9660_eltorito.c
695
cd9660_write_mbr_partition_entry(fd, mbr_partitions++,
usr.sbin/makefs/cd9660/cd9660_eltorito.c
708
fseek(fd, 0, SEEK_SET);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
710
fwrite(&apm16, sizeof(apm16), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
713
fwrite(&apm16, sizeof(apm16), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
717
fwrite(&apm32, sizeof(apm32), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
720
fwrite(&apm16, sizeof(apm16), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
721
fwrite(&apm16, sizeof(apm16), 1, fd);
usr.sbin/makefs/cd9660/cd9660_eltorito.c
727
cd9660_write_apm_partition_entry(fd, 0, total_parts, 1,
usr.sbin/makefs/cd9660/cd9660_eltorito.c
736
cd9660_write_apm_partition_entry(fd,
usr.sbin/makefs/cd9660/cd9660_eltorito.c
744
cd9660_write_apm_partition_entry(fd, 2 + apm_partitions,
usr.sbin/makefs/cd9660/cd9660_write.c
100
status = cd9660_write_path_tables(diskStructure, fd);
usr.sbin/makefs/cd9660/cd9660_write.c
110
status = cd9660_write_file(diskStructure, fd, diskStructure->rootNode);
usr.sbin/makefs/cd9660/cd9660_write.c
117
cd9660_write_boot(diskStructure, fd);
usr.sbin/makefs/cd9660/cd9660_write.c
122
cd9660_write_filedata(diskStructure, fd,
usr.sbin/makefs/cd9660/cd9660_write.c
127
fclose(fd);
usr.sbin/makefs/cd9660/cd9660_write.c
134
fclose(fd);
usr.sbin/makefs/cd9660/cd9660_write.c
143
cd9660_write_volume_descriptors(iso9660_disk *diskStructure, FILE *fd)
usr.sbin/makefs/cd9660/cd9660_write.c
148
cd9660_write_filedata(diskStructure, fd, vd_temp->sector,
usr.sbin/makefs/cd9660/cd9660_write.c
164
cd9660_write_path_table(iso9660_disk *diskStructure, FILE *fd, off_t sector,
usr.sbin/makefs/cd9660/cd9660_write.c
213
ret = cd9660_write_filedata(diskStructure, fd, sector, buffer_head,
usr.sbin/makefs/cd9660/cd9660_write.c
235
cd9660_write_path_tables(iso9660_disk *diskStructure, FILE *fd)
usr.sbin/makefs/cd9660/cd9660_write.c
237
if (cd9660_write_path_table(diskStructure, fd,
usr.sbin/makefs/cd9660/cd9660_write.c
241
if (cd9660_write_path_table(diskStructure, fd,
usr.sbin/makefs/cd9660/cd9660_write.c
261
cd9660_write_file(iso9660_disk *diskStructure, FILE *fd, cd9660node *writenode)
usr.sbin/makefs/cd9660/cd9660_write.c
290
ret = cd9660_copy_file(diskStructure, fd,
usr.sbin/makefs/cd9660/cd9660_write.c
310
if (fseeko(fd, working_sector * diskStructure->sectorSize,
usr.sbin/makefs/cd9660/cd9660_write.c
335
if (fseeko(fd, working_sector *
usr.sbin/makefs/cd9660/cd9660_write.c
341
temp->isoDirRecord->length[0], fd);
usr.sbin/makefs/cd9660/cd9660_write.c
343
cd9660_write_rr(diskStructure, fd, temp,
usr.sbin/makefs/cd9660/cd9660_write.c
346
if (fseeko(fd, working_sector *
usr.sbin/makefs/cd9660/cd9660_write.c
353
temp->su_tail_size, fd);
usr.sbin/makefs/cd9660/cd9660_write.c
354
if (ferror(fd)) {
usr.sbin/makefs/cd9660/cd9660_write.c
366
if ((ret = cd9660_write_file(diskStructure, fd, temp)) == 0)
usr.sbin/makefs/cd9660/cd9660_write.c
391
cd9660_write_filedata(iso9660_disk *diskStructure, FILE *fd, off_t sector,
usr.sbin/makefs/cd9660/cd9660_write.c
397
curpos = ftello(fd);
usr.sbin/makefs/cd9660/cd9660_write.c
399
if (fseeko(fd, sector * diskStructure->sectorSize, SEEK_SET) == -1)
usr.sbin/makefs/cd9660/cd9660_write.c
402
success = fwrite(buf, diskStructure->sectorSize * numsecs, 1, fd);
usr.sbin/makefs/cd9660/cd9660_write.c
404
if (fseeko(fd, curpos, SEEK_SET) == -1)
usr.sbin/makefs/cd9660/cd9660_write.c
414
cd9660_write_buffered(FILE *fd, off_t offset, int buff_len,
usr.sbin/makefs/cd9660/cd9660_write.c
425
cd9660_copy_file(iso9660_disk *diskStructure, FILE *fd, off_t start_sector,
usr.sbin/makefs/cd9660/cd9660_write.c
443
if (fseeko(fd, start_sector * diskStructure->sectorSize, SEEK_SET) == -1)
usr.sbin/makefs/cd9660/cd9660_write.c
455
fwrite(buf,1,bytes_read,fd);
usr.sbin/makefs/cd9660/cd9660_write.c
456
if (ferror(fd)) {
usr.sbin/makefs/cd9660/cd9660_write.c
470
cd9660_write_rr(iso9660_disk *diskStructure, FILE *fd, cd9660node *writenode,
usr.sbin/makefs/cd9660/cd9660_write.c
477
if (fseeko(fd, sector * diskStructure->sectorSize + offset, SEEK_SET) ==
usr.sbin/makefs/cd9660/cd9660_write.c
482
fwrite(&(myattr->attr), CD9660_SUSP_ENTRY_SIZE(myattr), 1, fd);
usr.sbin/makefs/cd9660/cd9660_write.c
491
if (fseeko(fd, ((off_t)diskStructure->
usr.sbin/makefs/cd9660/cd9660_write.c
507
if (fseeko(fd, sector * diskStructure->sectorSize + offset,
usr.sbin/makefs/cd9660/cd9660_write.c
63
FILE *fd;
usr.sbin/makefs/cd9660/cd9660_write.c
67
if ((fd = fopen(image, "w+")) == NULL) {
usr.sbin/makefs/cd9660/cd9660_write.c
76
status = cd9660_copy_file(diskStructure, fd, 0,
usr.sbin/makefs/cd9660/cd9660_write.c
86
status = cd9660_write_volume_descriptors(diskStructure, fd);
usr.sbin/makefs/ffs.c
332
if (close(fsopts->fd) == -1)
usr.sbin/makefs/ffs.c
334
fsopts->fd = -1;
usr.sbin/makefs/ffs.c
522
if ((fsopts->fd = open(image, oflags, 0666)) == -1) {
usr.sbin/makefs/ffs.c
529
if (fstatvfs(fsopts->fd, &sfs) == -1) {
usr.sbin/makefs/ffs.c
540
if (ftruncate(fsopts->fd, bufrem) == -1) {
usr.sbin/makefs/ffs.c
558
if (lseek(fsopts->fd, fsopts->offset, SEEK_SET) == -1) {
usr.sbin/makefs/ffs.c
565
i = write(fsopts->fd, buf, MIN(bufsize, bufrem));
usr.sbin/makefs/ffs.c
611
return (fsopts->fd);
usr.sbin/makefs/ffs/buf.c
142
if (lseek(bp->b_fs->fd, offset, SEEK_SET) == -1) {
usr.sbin/makefs/ffs/buf.c
146
rv = write(bp->b_fs->fd, bp->b_data, bytes);
usr.sbin/makefs/ffs/buf.c
78
if (lseek((*bpp)->b_fs->fd, offset, SEEK_SET) == -1)
usr.sbin/makefs/ffs/buf.c
81
rv = read((*bpp)->b_fs->fd, (*bpp)->b_data, (size_t)(*bpp)->b_bcount);
usr.sbin/makefs/ffs/mkfs.c
878
if (lseek(fsopts->fd, offset, SEEK_SET) < 0)
usr.sbin/makefs/ffs/mkfs.c
881
n = read(fsopts->fd, bf, size);
usr.sbin/makefs/ffs/mkfs.c
902
if (lseek(fsopts->fd, offset, SEEK_SET) < 0)
usr.sbin/makefs/ffs/mkfs.c
905
n = write(fsopts->fd, bf, size);
usr.sbin/makefs/hammer2.c
1238
int fd, error;
usr.sbin/makefs/hammer2.c
1246
fd = open(path, O_RDONLY);
usr.sbin/makefs/hammer2.c
1247
if (fd < 0)
usr.sbin/makefs/hammer2.c
1250
p = mmap(0, nsize, PROT_READ, MAP_FILE|MAP_PRIVATE, fd, 0);
usr.sbin/makefs/hammer2.c
1253
close(fd);
usr.sbin/makefs/hammer2.c
2232
int fd, error;
usr.sbin/makefs/hammer2.c
2252
fd = open(out, O_WRONLY | O_CREAT | O_TRUNC, 0666);
usr.sbin/makefs/hammer2.c
2253
if (fd == -1)
usr.sbin/makefs/hammer2.c
2267
error = write(fd, buf, n);
usr.sbin/makefs/hammer2.c
2276
fsync(fd);
usr.sbin/makefs/hammer2.c
2277
close(fd);
usr.sbin/makefs/hammer2.c
320
fsopts->fd = open(image, O_RDWR);
usr.sbin/makefs/hammer2.c
321
if (fsopts->fd < 0)
usr.sbin/makefs/hammer2.c
330
assert(fsopts->fd > 0);
usr.sbin/makefs/hammer2.c
528
if (close(fsopts->fd) == -1)
usr.sbin/makefs/hammer2.c
530
fsopts->fd = -1;
usr.sbin/makefs/hammer2.c
843
if ((fsopts->fd = open(image, O_RDWR)) == -1) {
usr.sbin/makefs/hammer2.c
848
size = check_volume(fsopts->fd);
usr.sbin/makefs/hammer2.c
885
if ((fsopts->fd = open(image, oflags, 0666)) == -1) {
usr.sbin/makefs/hammer2.c
894
if (ftruncate(fsopts->fd, bufrem) == -1) {
usr.sbin/makefs/hammer2.c
912
if (lseek(fsopts->fd, fsopts->offset, SEEK_SET) == -1) {
usr.sbin/makefs/hammer2.c
920
i = write(fsopts->fd, buf, MIN(bufsize, bufrem));
usr.sbin/makefs/hammer2.c
937
return fsopts->fd;
usr.sbin/makefs/hammer2/hammer2_buf.c
79
if (lseek(bp->b_fs->fd, bp->b_loffset, SEEK_SET) == -1)
usr.sbin/makefs/hammer2/hammer2_buf.c
83
ret = read(bp->b_fs->fd, bp->b_data, bp->b_bcount);
usr.sbin/makefs/hammer2/hammer2_ioctl.c
1294
if (ioctl(hmp->devvp->fs->fd, DIOCGPART, &part) == 0) {
usr.sbin/makefs/hammer2/hammer2_ioctl.c
1298
} else if (fstat(hmp->devvp->fs->fd, &st) == 0) {
usr.sbin/makefs/hammer2/hammer2_ioctl.c
219
fp = holdfp(curthread, recl->fd, -1);
usr.sbin/makefs/hammer2/hammer2_ondisk.c
258
if (ioctl(vol->dev->devvp->fs->fd, DIOCGPART, &part) == 0) {
usr.sbin/makefs/hammer2/hammer2_ondisk.c
268
} else if (fstat(vol->dev->devvp->fs->fd, &st) == 0) {
usr.sbin/makefs/hammer2/hammer2_ondisk.c
479
hammer2_off_t size = check_volume(devvp->fs->fd);
usr.sbin/makefs/makefs.c
112
fsoptions.fd = -1;
usr.sbin/makefs/makefs.h
147
int fd; /* file descriptor of image */
usr.sbin/makefs/msdos.c
183
fsopts->fd = open(image, O_RDWR);
usr.sbin/makefs/msdos/msdosfs_vnops.c
437
int error, fd;
usr.sbin/makefs/msdos/msdosfs_vnops.c
466
if ((fd = open(path, O_RDONLY)) == -1) {
usr.sbin/makefs/msdos/msdosfs_vnops.c
472
if ((dat = mmap(0, nsize, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0))
usr.sbin/makefs/msdos/msdosfs_vnops.c
477
close(fd);
usr.sbin/makefs/msdos/msdosfs_vnops.c
480
close(fd);
usr.sbin/mfiutil/mfi_cmd.c
168
mfi_query_disk(int fd, uint8_t target_id, struct mfi_query_disk *info)
usr.sbin/mfiutil/mfi_cmd.c
173
if (ioctl(fd, MFIIO_QUERY_DISK, info) < 0)
usr.sbin/mfiutil/mfi_cmd.c
183
mfi_volume_name(int fd, uint8_t target_id)
usr.sbin/mfiutil/mfi_cmd.c
188
if (mfi_query_disk(fd, target_id, &info) < 0) {
usr.sbin/mfiutil/mfi_cmd.c
196
mfi_volume_busy(int fd, uint8_t target_id)
usr.sbin/mfiutil/mfi_cmd.c
201
if (mfi_query_disk(fd, target_id, &info) < 0)
usr.sbin/mfiutil/mfi_cmd.c
224
mfi_lookup_volume(int fd, const char *name, uint8_t *target_id)
usr.sbin/mfiutil/mfi_cmd.c
239
if (mfi_dcmd_command(fd, MFI_DCMD_LD_GET_LIST, &list, sizeof(list),
usr.sbin/mfiutil/mfi_cmd.c
244
if (mfi_query_disk(fd, list.ld_list[i].ld.v.target_id,
usr.sbin/mfiutil/mfi_cmd.c
257
mfi_dcmd_command(int fd, uint32_t opcode, void *buf, size_t bufsize,
usr.sbin/mfiutil/mfi_cmd.c
282
r = ioctl(fd, MFIIO_PASSTHRU, &ioc);
usr.sbin/mfiutil/mfi_cmd.c
298
mfi_ctrl_get_info(int fd, struct mfi_ctrl_info *info, uint8_t *statusp)
usr.sbin/mfiutil/mfi_cmd.c
301
return (mfi_dcmd_command(fd, MFI_DCMD_CTRL_GETINFO, info,
usr.sbin/mfiutil/mfi_config.c
1010
if (mfi_dcmd_command(fd, MFI_DCMD_CFG_MAKE_SPARE, spare,
usr.sbin/mfiutil/mfi_config.c
1021
close(fd);
usr.sbin/mfiutil/mfi_config.c
1031
int error, fd;
usr.sbin/mfiutil/mfi_config.c
1040
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_config.c
1041
if (fd < 0) {
usr.sbin/mfiutil/mfi_config.c
1047
error = mfi_lookup_drive(fd, av[1], &device_id);
usr.sbin/mfiutil/mfi_config.c
1049
close(fd);
usr.sbin/mfiutil/mfi_config.c
1054
if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
usr.sbin/mfiutil/mfi_config.c
1057
close(fd);
usr.sbin/mfiutil/mfi_config.c
1063
close(fd);
usr.sbin/mfiutil/mfi_config.c
1068
if (mfi_dcmd_command(fd, MFI_DCMD_CFG_REMOVE_SPARE, NULL, 0, mbox,
usr.sbin/mfiutil/mfi_config.c
1072
close(fd);
usr.sbin/mfiutil/mfi_config.c
1076
close(fd);
usr.sbin/mfiutil/mfi_config.c
1084
dump_config(int fd, struct mfi_config_data *config, const char *msg_prefix)
usr.sbin/mfiutil/mfi_config.c
1118
if (mfi_pd_get_info(fd, device_id, &pinfo,
usr.sbin/mfiutil/mfi_config.c
1135
mfi_volume_name(fd, ld->properties.ld.v.target_id));
usr.sbin/mfiutil/mfi_config.c
1182
int error, fd;
usr.sbin/mfiutil/mfi_config.c
1189
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_config.c
1190
if (fd < 0) {
usr.sbin/mfiutil/mfi_config.c
1197
if (mfi_config_read(fd, &config) < 0) {
usr.sbin/mfiutil/mfi_config.c
1200
close(fd);
usr.sbin/mfiutil/mfi_config.c
1205
dump_config(fd, config, NULL);
usr.sbin/mfiutil/mfi_config.c
1207
close(fd);
usr.sbin/mfiutil/mfi_config.c
1219
int error, fd;
usr.sbin/mfiutil/mfi_config.c
1226
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_config.c
1227
if (fd < 0) {
usr.sbin/mfiutil/mfi_config.c
1240
close(fd);
usr.sbin/mfiutil/mfi_config.c
1247
close(fd);
usr.sbin/mfiutil/mfi_config.c
1254
close(fd);
usr.sbin/mfiutil/mfi_config.c
1257
dump_config(fd, config, NULL);
usr.sbin/mfiutil/mfi_config.c
1259
close(fd);
usr.sbin/mfiutil/mfi_config.c
130
int ch, error, fd;
usr.sbin/mfiutil/mfi_config.c
133
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_config.c
134
if (fd < 0) {
usr.sbin/mfiutil/mfi_config.c
143
close(fd);
usr.sbin/mfiutil/mfi_config.c
147
if (mfi_ld_get_list(fd, &list, NULL) < 0) {
usr.sbin/mfiutil/mfi_config.c
150
close(fd);
usr.sbin/mfiutil/mfi_config.c
155
if (mfi_volume_busy(fd, list.ld_list[i].ld.v.target_id)) {
usr.sbin/mfiutil/mfi_config.c
157
mfi_volume_name(fd, list.ld_list[i].ld.v.target_id));
usr.sbin/mfiutil/mfi_config.c
158
close(fd);
usr.sbin/mfiutil/mfi_config.c
169
close(fd);
usr.sbin/mfiutil/mfi_config.c
173
if (mfi_dcmd_command(fd, MFI_DCMD_CFG_CLEAR, NULL, 0, NULL, 0, NULL) < 0) {
usr.sbin/mfiutil/mfi_config.c
176
close(fd);
usr.sbin/mfiutil/mfi_config.c
181
close(fd);
usr.sbin/mfiutil/mfi_config.c
259
parse_array(int fd, int raid_type, char *array_str, struct array_info *info)
usr.sbin/mfiutil/mfi_config.c
321
error = mfi_lookup_drive(fd, cp, &device_id);
usr.sbin/mfiutil/mfi_config.c
328
if (mfi_pd_get_info(fd, device_id, pinfo, NULL) < 0) {
usr.sbin/mfiutil/mfi_config.c
394
build_array(__unused int fd, char *arrayp, struct array_info *array_info,
usr.sbin/mfiutil/mfi_config.c
50
mfi_config_read(int fd, struct mfi_config_data **configp)
usr.sbin/mfiutil/mfi_config.c
52
return mfi_config_read_opcode(fd, MFI_DCMD_CFG_READ, configp, NULL, 0);
usr.sbin/mfiutil/mfi_config.c
524
int error, fd, i, raid_type;
usr.sbin/mfiutil/mfi_config.c
559
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_config.c
56
mfi_config_read_opcode(int fd, uint32_t opcode,
usr.sbin/mfiutil/mfi_config.c
560
if (fd < 0) {
usr.sbin/mfiutil/mfi_config.c
668
error = parse_array(fd, raid_type, av[i], &arrays[i]);
usr.sbin/mfiutil/mfi_config.c
692
if (mfi_config_read(fd, &config) < 0) {
usr.sbin/mfiutil/mfi_config.c
73
if (mfi_dcmd_command(fd, opcode, config,
usr.sbin/mfiutil/mfi_config.c
778
build_array(fd, cfg_arrays, &arrays[i], &state, verbose);
usr.sbin/mfiutil/mfi_config.c
793
dump_config(fd, config, NULL);
usr.sbin/mfiutil/mfi_config.c
797
if (mfi_dcmd_command(fd, MFI_DCMD_CFG_ADD, config, config_size,
usr.sbin/mfiutil/mfi_config.c
814
close(fd);
usr.sbin/mfiutil/mfi_config.c
824
int error, fd;
usr.sbin/mfiutil/mfi_config.c
847
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_config.c
848
if (fd < 0) {
usr.sbin/mfiutil/mfi_config.c
857
close(fd);
usr.sbin/mfiutil/mfi_config.c
861
if (mfi_lookup_volume(fd, av[1], &target_id) < 0) {
usr.sbin/mfiutil/mfi_config.c
864
close(fd);
usr.sbin/mfiutil/mfi_config.c
868
if (mfi_ld_get_info(fd, target_id, &info, NULL) < 0) {
usr.sbin/mfiutil/mfi_config.c
871
close(fd);
usr.sbin/mfiutil/mfi_config.c
875
if (mfi_volume_busy(fd, target_id)) {
usr.sbin/mfiutil/mfi_config.c
877
mfi_volume_name(fd, target_id));
usr.sbin/mfiutil/mfi_config.c
878
close(fd);
usr.sbin/mfiutil/mfi_config.c
883
if (mfi_dcmd_command(fd, MFI_DCMD_LD_DELETE, NULL, 0, mbox,
usr.sbin/mfiutil/mfi_config.c
887
close(fd);
usr.sbin/mfiutil/mfi_config.c
891
close(fd);
usr.sbin/mfiutil/mfi_config.c
908
int error, fd, i;
usr.sbin/mfiutil/mfi_config.c
915
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_config.c
916
if (fd < 0) {
usr.sbin/mfiutil/mfi_config.c
924
error = mfi_lookup_drive(fd, av[1], &device_id);
usr.sbin/mfiutil/mfi_config.c
928
if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
usr.sbin/mfiutil/mfi_config.c
941
if (mfi_lookup_volume(fd, av[2], &target_id) < 0) {
usr.sbin/mfiutil/mfi_config.c
948
if (mfi_config_read(fd, &config) < 0) {
usr.sbin/mfiutil/mfi_drive.c
160
mfi_lookup_drive(int fd, char *drive, uint16_t *device_id)
usr.sbin/mfiutil/mfi_drive.c
202
if (mfi_pd_get_list(fd, &list, NULL) < 0) {
usr.sbin/mfiutil/mfi_drive.c
250
mfi_pd_get_list(int fd, struct mfi_pd_list **listp, uint8_t *statusp)
usr.sbin/mfiutil/mfi_drive.c
265
if (mfi_dcmd_command(fd, MFI_DCMD_PD_GET_LIST, list, list_size, NULL,
usr.sbin/mfiutil/mfi_drive.c
281
mfi_pd_get_info(int fd, uint16_t device_id, struct mfi_pd_info *info,
usr.sbin/mfiutil/mfi_drive.c
287
return (mfi_dcmd_command(fd, MFI_DCMD_PD_GET_INFO, info,
usr.sbin/mfiutil/mfi_drive.c
384
int error, fd;
usr.sbin/mfiutil/mfi_drive.c
386
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_drive.c
387
if (fd < 0) {
usr.sbin/mfiutil/mfi_drive.c
393
error = mfi_lookup_drive(fd, drive, &device_id);
usr.sbin/mfiutil/mfi_drive.c
395
close(fd);
usr.sbin/mfiutil/mfi_drive.c
400
if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
usr.sbin/mfiutil/mfi_drive.c
403
close(fd);
usr.sbin/mfiutil/mfi_drive.c
410
close(fd);
usr.sbin/mfiutil/mfi_drive.c
417
if (mfi_dcmd_command(fd, MFI_DCMD_PD_STATE_SET, NULL, 0, mbox, 6,
usr.sbin/mfiutil/mfi_drive.c
422
close(fd);
usr.sbin/mfiutil/mfi_drive.c
426
close(fd);
usr.sbin/mfiutil/mfi_drive.c
479
int error, fd;
usr.sbin/mfiutil/mfi_drive.c
487
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_drive.c
488
if (fd < 0) {
usr.sbin/mfiutil/mfi_drive.c
494
error = mfi_lookup_drive(fd, av[1], &device_id);
usr.sbin/mfiutil/mfi_drive.c
496
close(fd);
usr.sbin/mfiutil/mfi_drive.c
501
if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
usr.sbin/mfiutil/mfi_drive.c
504
close(fd);
usr.sbin/mfiutil/mfi_drive.c
511
close(fd);
usr.sbin/mfiutil/mfi_drive.c
517
if (mfi_dcmd_command(fd, MFI_DCMD_PD_REBUILD_START, NULL, 0, mbox, 4,
usr.sbin/mfiutil/mfi_drive.c
521
close(fd);
usr.sbin/mfiutil/mfi_drive.c
524
close(fd);
usr.sbin/mfiutil/mfi_drive.c
536
int error, fd;
usr.sbin/mfiutil/mfi_drive.c
544
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_drive.c
545
if (fd < 0) {
usr.sbin/mfiutil/mfi_drive.c
551
error = mfi_lookup_drive(fd, av[1], &device_id);
usr.sbin/mfiutil/mfi_drive.c
553
close(fd);
usr.sbin/mfiutil/mfi_drive.c
558
if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
usr.sbin/mfiutil/mfi_drive.c
561
close(fd);
usr.sbin/mfiutil/mfi_drive.c
568
close(fd);
usr.sbin/mfiutil/mfi_drive.c
574
if (mfi_dcmd_command(fd, MFI_DCMD_PD_REBUILD_ABORT, NULL, 0, mbox, 4,
usr.sbin/mfiutil/mfi_drive.c
578
close(fd);
usr.sbin/mfiutil/mfi_drive.c
581
close(fd);
usr.sbin/mfiutil/mfi_drive.c
592
int error, fd;
usr.sbin/mfiutil/mfi_drive.c
60
int error, fd, len;
usr.sbin/mfiutil/mfi_drive.c
600
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_drive.c
601
if (fd < 0) {
usr.sbin/mfiutil/mfi_drive.c
607
error = mfi_lookup_drive(fd, av[1], &device_id);
usr.sbin/mfiutil/mfi_drive.c
609
close(fd);
usr.sbin/mfiutil/mfi_drive.c
614
if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
usr.sbin/mfiutil/mfi_drive.c
617
close(fd);
usr.sbin/mfiutil/mfi_drive.c
620
close(fd);
usr.sbin/mfiutil/mfi_drive.c
647
int error, fd;
usr.sbin/mfiutil/mfi_drive.c
666
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_drive.c
667
if (fd < 0) {
usr.sbin/mfiutil/mfi_drive.c
673
error = mfi_lookup_drive(fd, av[1], &device_id);
usr.sbin/mfiutil/mfi_drive.c
675
close(fd);
usr.sbin/mfiutil/mfi_drive.c
680
if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
usr.sbin/mfiutil/mfi_drive.c
683
close(fd);
usr.sbin/mfiutil/mfi_drive.c
688
if (mfi_dcmd_command(fd, opcode, NULL, 0, mbox, 4, NULL) < 0) {
usr.sbin/mfiutil/mfi_drive.c
693
close(fd);
usr.sbin/mfiutil/mfi_drive.c
697
close(fd);
usr.sbin/mfiutil/mfi_drive.c
707
int error, fd;
usr.sbin/mfiutil/mfi_drive.c
726
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_drive.c
727
if (fd < 0) {
usr.sbin/mfiutil/mfi_drive.c
733
error = mfi_lookup_drive(fd, av[1], &device_id);
usr.sbin/mfiutil/mfi_drive.c
735
close(fd);
usr.sbin/mfiutil/mfi_drive.c
74
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_drive.c
743
if (mfi_dcmd_command(fd, opcode, NULL, 0, mbox, 4, NULL) < 0) {
usr.sbin/mfiutil/mfi_drive.c
748
close(fd);
usr.sbin/mfiutil/mfi_drive.c
75
if (fd < 0) {
usr.sbin/mfiutil/mfi_drive.c
751
close(fd);
usr.sbin/mfiutil/mfi_drive.c
81
if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
usr.sbin/mfiutil/mfi_drive.c
83
close(fd);
usr.sbin/mfiutil/mfi_drive.c
87
close(fd);
usr.sbin/mfiutil/mfi_evt.c
353
volume_name(int fd, struct mfi_evt_ld *ld)
usr.sbin/mfiutil/mfi_evt.c
356
return (mfi_volume_name(fd, ld->target_id));
usr.sbin/mfiutil/mfi_evt.c
361
mfi_decode_evt(int fd, struct mfi_evt_detail *detail, int verbose)
usr.sbin/mfiutil/mfi_evt.c
384
printf("VOL %s event: ", volume_name(fd, &detail->args.ld));
usr.sbin/mfiutil/mfi_evt.c
387
printf("VOL %s", volume_name(fd, &detail->args.ld_count.ld));
usr.sbin/mfiutil/mfi_evt.c
395
printf("VOL %s", volume_name(fd, &detail->args.ld_count.ld));
usr.sbin/mfiutil/mfi_evt.c
403
printf("VOL %s", volume_name(fd, &detail->args.ld_count.ld));
usr.sbin/mfiutil/mfi_evt.c
412
printf("VOL %s", volume_name(fd, &detail->args.ld_count.ld));
usr.sbin/mfiutil/mfi_evt.c
422
printf("VOL %s", volume_name(fd, &detail->args.ld_prog.ld));
usr.sbin/mfiutil/mfi_evt.c
43
mfi_event_get_info(int fd, struct mfi_evt_log_state *info, uint8_t *statusp)
usr.sbin/mfiutil/mfi_evt.c
431
printf("VOL %s", volume_name(fd, &detail->args.ld_prog.ld));
usr.sbin/mfiutil/mfi_evt.c
440
printf("VOL %s", volume_name(fd, &detail->args.ld_strip.ld));
usr.sbin/mfiutil/mfi_evt.c
46
return (mfi_dcmd_command(fd, MFI_DCMD_CTRL_EVENT_GETINFO, info,
usr.sbin/mfiutil/mfi_evt.c
472
volume_name(fd, &detail->args.pd_lba_ld.ld));
usr.sbin/mfiutil/mfi_evt.c
51
mfi_get_events(int fd, struct mfi_evt_list *list, int num_events,
usr.sbin/mfiutil/mfi_evt.c
540
int ch, error, fd, num_events, verbose;
usr.sbin/mfiutil/mfi_evt.c
543
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_evt.c
544
if (fd < 0) {
usr.sbin/mfiutil/mfi_evt.c
550
if (mfi_event_get_info(fd, &info, NULL) < 0) {
usr.sbin/mfiutil/mfi_evt.c
553
close(fd);
usr.sbin/mfiutil/mfi_evt.c
574
close(fd);
usr.sbin/mfiutil/mfi_evt.c
582
close(fd);
usr.sbin/mfiutil/mfi_evt.c
590
close(fd);
usr.sbin/mfiutil/mfi_evt.c
600
close(fd);
usr.sbin/mfiutil/mfi_evt.c
61
return (mfi_dcmd_command(fd, MFI_DCMD_CTRL_EVENT_GET, list, size,
usr.sbin/mfiutil/mfi_evt.c
612
close(fd);
usr.sbin/mfiutil/mfi_evt.c
619
close(fd);
usr.sbin/mfiutil/mfi_evt.c
625
close(fd);
usr.sbin/mfiutil/mfi_evt.c
631
close(fd);
usr.sbin/mfiutil/mfi_evt.c
638
close(fd);
usr.sbin/mfiutil/mfi_evt.c
642
if (mfi_get_events(fd, list, num_events, filter, seq,
usr.sbin/mfiutil/mfi_evt.c
647
close(fd);
usr.sbin/mfiutil/mfi_evt.c
658
close(fd);
usr.sbin/mfiutil/mfi_evt.c
676
mfi_decode_evt(fd, &list->event[i], verbose);
usr.sbin/mfiutil/mfi_evt.c
689
close(fd);
usr.sbin/mfiutil/mfi_evt.c
69
int error, fd;
usr.sbin/mfiutil/mfi_evt.c
76
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_evt.c
77
if (fd < 0) {
usr.sbin/mfiutil/mfi_evt.c
83
if (mfi_event_get_info(fd, &info, NULL) < 0) {
usr.sbin/mfiutil/mfi_evt.c
86
close(fd);
usr.sbin/mfiutil/mfi_evt.c
97
close(fd);
usr.sbin/mfiutil/mfi_flash.c
110
fd = -1;
usr.sbin/mfiutil/mfi_flash.c
123
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_flash.c
124
if (fd < 0) {
usr.sbin/mfiutil/mfi_flash.c
132
mfi_dcmd_command(fd, MFI_DCMD_FLASH_FW_OPEN, NULL, 0, mbox, 4, &status);
usr.sbin/mfiutil/mfi_flash.c
151
mfi_dcmd_command(fd, MFI_DCMD_FLASH_FW_CLOSE, NULL, 0,
usr.sbin/mfiutil/mfi_flash.c
158
mfi_dcmd_command(fd, MFI_DCMD_FLASH_FW_DOWNLOAD, buf, nread,
usr.sbin/mfiutil/mfi_flash.c
162
mfi_dcmd_command(fd, MFI_DCMD_FLASH_FW_CLOSE, NULL, 0,
usr.sbin/mfiutil/mfi_flash.c
174
mfi_dcmd_command(fd, MFI_DCMD_FLASH_FW_FLASH, &dummy, sizeof(dummy),
usr.sbin/mfiutil/mfi_flash.c
182
error = display_pending_firmware(fd);
usr.sbin/mfiutil/mfi_flash.c
186
if (fd >= 0)
usr.sbin/mfiutil/mfi_flash.c
187
close(fd);
usr.sbin/mfiutil/mfi_flash.c
46
display_pending_firmware(int fd)
usr.sbin/mfiutil/mfi_flash.c
53
if (mfi_ctrl_get_info(fd, &info, NULL) < 0) {
usr.sbin/mfiutil/mfi_flash.c
94
int error, fd, flash;
usr.sbin/mfiutil/mfi_foreign.c
108
int ch, error, fd;
usr.sbin/mfiutil/mfi_foreign.c
110
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_foreign.c
111
if (fd < 0) {
usr.sbin/mfiutil/mfi_foreign.c
124
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
128
if (mfi_dcmd_command(fd, MFI_DCMD_CFG_FOREIGN_CLEAR, NULL, 0, NULL,
usr.sbin/mfiutil/mfi_foreign.c
132
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
137
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
146
int error, fd;
usr.sbin/mfiutil/mfi_foreign.c
148
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_foreign.c
149
if (fd < 0) {
usr.sbin/mfiutil/mfi_foreign.c
155
if (mfi_dcmd_command(fd, MFI_DCMD_CFG_FOREIGN_SCAN, &info,
usr.sbin/mfiutil/mfi_foreign.c
159
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
165
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
171
foreign_show_cfg(int fd, uint32_t opcode, uint8_t cfgidx)
usr.sbin/mfiutil/mfi_foreign.c
180
if (mfi_config_read_opcode(fd, opcode, &config, mbox, sizeof(mbox))
usr.sbin/mfiutil/mfi_foreign.c
184
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
198
dump_config(fd, config, prefix);
usr.sbin/mfiutil/mfi_foreign.c
210
int error, fd;
usr.sbin/mfiutil/mfi_foreign.c
217
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_foreign.c
218
if (fd < 0) {
usr.sbin/mfiutil/mfi_foreign.c
224
if (mfi_dcmd_command(fd, MFI_DCMD_CFG_FOREIGN_SCAN, &info,
usr.sbin/mfiutil/mfi_foreign.c
228
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
234
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
240
error = foreign_show_cfg(fd,
usr.sbin/mfiutil/mfi_foreign.c
243
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
250
error = foreign_show_cfg(fd,
usr.sbin/mfiutil/mfi_foreign.c
253
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
258
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
268
int error, fd;
usr.sbin/mfiutil/mfi_foreign.c
275
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_foreign.c
276
if (fd < 0) {
usr.sbin/mfiutil/mfi_foreign.c
282
if (mfi_dcmd_command(fd, MFI_DCMD_CFG_FOREIGN_SCAN, &info,
usr.sbin/mfiutil/mfi_foreign.c
286
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
292
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
298
error = foreign_show_cfg(fd,
usr.sbin/mfiutil/mfi_foreign.c
301
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
308
error = foreign_show_cfg(fd,
usr.sbin/mfiutil/mfi_foreign.c
311
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
316
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
325
int ch, error, fd;
usr.sbin/mfiutil/mfi_foreign.c
334
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_foreign.c
335
if (fd < 0) {
usr.sbin/mfiutil/mfi_foreign.c
341
if (mfi_dcmd_command(fd, MFI_DCMD_CFG_FOREIGN_SCAN, &info,
usr.sbin/mfiutil/mfi_foreign.c
345
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
351
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
370
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
380
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
386
if (mfi_dcmd_command(fd, MFI_DCMD_CFG_FOREIGN_IMPORT, NULL, 0, mbox,
usr.sbin/mfiutil/mfi_foreign.c
390
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
400
close(fd);
usr.sbin/mfiutil/mfi_foreign.c
57
int error, fd;
usr.sbin/mfiutil/mfi_foreign.c
59
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_foreign.c
60
if (fd < 0) {
usr.sbin/mfiutil/mfi_foreign.c
67
if (mfi_pd_get_list(fd, &list, NULL) < 0) {
usr.sbin/mfiutil/mfi_foreign.c
79
if (mfi_pd_get_info(fd, list->addr[i].device_id, &info,
usr.sbin/mfiutil/mfi_foreign.c
99
close(fd);
usr.sbin/mfiutil/mfi_patrol.c
100
close(fd);
usr.sbin/mfiutil/mfi_patrol.c
129
if (mfi_dcmd_command(fd, MFI_DCMD_PR_GET_STATUS, &status,
usr.sbin/mfiutil/mfi_patrol.c
133
close(fd);
usr.sbin/mfiutil/mfi_patrol.c
156
if (mfi_pd_get_list(fd, &list, NULL) < 0) {
usr.sbin/mfiutil/mfi_patrol.c
159
close(fd);
usr.sbin/mfiutil/mfi_patrol.c
167
if (mfi_pd_get_info(fd, list->addr[i].device_id, &info,
usr.sbin/mfiutil/mfi_patrol.c
173
close(fd);
usr.sbin/mfiutil/mfi_patrol.c
188
close(fd);
usr.sbin/mfiutil/mfi_patrol.c
197
int error, fd;
usr.sbin/mfiutil/mfi_patrol.c
199
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_patrol.c
200
if (fd < 0) {
usr.sbin/mfiutil/mfi_patrol.c
206
if (mfi_dcmd_command(fd, MFI_DCMD_PR_START, NULL, 0, NULL, 0, NULL) <
usr.sbin/mfiutil/mfi_patrol.c
210
close(fd);
usr.sbin/mfiutil/mfi_patrol.c
214
close(fd);
usr.sbin/mfiutil/mfi_patrol.c
223
int error, fd;
usr.sbin/mfiutil/mfi_patrol.c
225
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_patrol.c
226
if (fd < 0) {
usr.sbin/mfiutil/mfi_patrol.c
232
if (mfi_dcmd_command(fd, MFI_DCMD_PR_STOP, NULL, 0, NULL, 0, NULL) <
usr.sbin/mfiutil/mfi_patrol.c
236
close(fd);
usr.sbin/mfiutil/mfi_patrol.c
240
close(fd);
usr.sbin/mfiutil/mfi_patrol.c
252
int error, fd;
usr.sbin/mfiutil/mfi_patrol.c
295
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_patrol.c
296
if (fd < 0) {
usr.sbin/mfiutil/mfi_patrol.c
302
error = patrol_get_props(fd, &prop);
usr.sbin/mfiutil/mfi_patrol.c
304
close(fd);
usr.sbin/mfiutil/mfi_patrol.c
313
mfi_get_time(fd, &at);
usr.sbin/mfiutil/mfi_patrol.c
315
close(fd);
usr.sbin/mfiutil/mfi_patrol.c
323
if (mfi_dcmd_command(fd, MFI_DCMD_PR_SET_PROPERTIES, &prop,
usr.sbin/mfiutil/mfi_patrol.c
327
close(fd);
usr.sbin/mfiutil/mfi_patrol.c
331
close(fd);
usr.sbin/mfiutil/mfi_patrol.c
52
mfi_get_time(int fd, uint32_t *at)
usr.sbin/mfiutil/mfi_patrol.c
55
if (mfi_dcmd_command(fd, MFI_DCMD_TIME_SECS_GET, at, sizeof(*at), NULL,
usr.sbin/mfiutil/mfi_patrol.c
63
patrol_get_props(int fd, struct mfi_pr_properties *prop)
usr.sbin/mfiutil/mfi_patrol.c
67
if (mfi_dcmd_command(fd, MFI_DCMD_PR_GET_PROPERTIES, prop,
usr.sbin/mfiutil/mfi_patrol.c
86
int error, fd;
usr.sbin/mfiutil/mfi_patrol.c
89
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_patrol.c
90
if (fd < 0) {
usr.sbin/mfiutil/mfi_patrol.c
97
mfi_get_time(fd, &at);
usr.sbin/mfiutil/mfi_patrol.c
98
error = patrol_get_props(fd, &prop);
usr.sbin/mfiutil/mfi_show.c
133
close(fd);
usr.sbin/mfiutil/mfi_show.c
146
int comma, error, fd, show_capacity;
usr.sbin/mfiutil/mfi_show.c
153
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_show.c
154
if (fd < 0) {
usr.sbin/mfiutil/mfi_show.c
160
if (mfi_dcmd_command(fd, MFI_DCMD_BBU_GET_CAPACITY_INFO, &cap,
usr.sbin/mfiutil/mfi_show.c
164
close(fd);
usr.sbin/mfiutil/mfi_show.c
169
close(fd);
usr.sbin/mfiutil/mfi_show.c
174
if (mfi_dcmd_command(fd, MFI_DCMD_BBU_GET_DESIGN_INFO, &design,
usr.sbin/mfiutil/mfi_show.c
178
close(fd);
usr.sbin/mfiutil/mfi_show.c
182
if (mfi_dcmd_command(fd, MFI_DCMD_BBU_GET_STATUS, &stat, sizeof(stat),
usr.sbin/mfiutil/mfi_show.c
186
close(fd);
usr.sbin/mfiutil/mfi_show.c
240
close(fd);
usr.sbin/mfiutil/mfi_show.c
301
int error, fd, i, j;
usr.sbin/mfiutil/mfi_show.c
308
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_show.c
309
if (fd < 0) {
usr.sbin/mfiutil/mfi_show.c
316
if (mfi_config_read(fd, &config) < 0) {
usr.sbin/mfiutil/mfi_show.c
319
close(fd);
usr.sbin/mfiutil/mfi_show.c
339
if (mfi_pd_get_info(fd, device_id, &pinfo,
usr.sbin/mfiutil/mfi_show.c
354
mfi_volume_name(fd, ld->properties.ld.v.target_id));
usr.sbin/mfiutil/mfi_show.c
355
if (mfi_ld_get_info(fd, ld->properties.ld.v.target_id, &linfo,
usr.sbin/mfiutil/mfi_show.c
377
if (mfi_pd_get_info(fd, sp->ref.v.device_id, &pinfo, NULL) < 0)
usr.sbin/mfiutil/mfi_show.c
390
close(fd);
usr.sbin/mfiutil/mfi_show.c
401
int error, fd;
usr.sbin/mfiutil/mfi_show.c
409
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_show.c
410
if (fd < 0) {
usr.sbin/mfiutil/mfi_show.c
417
if (mfi_ld_get_list(fd, &list, NULL) < 0) {
usr.sbin/mfiutil/mfi_show.c
420
close(fd);
usr.sbin/mfiutil/mfi_show.c
441
if (mfi_ld_get_info(fd, list.ld_list[i].ld.v.target_id, &info,
usr.sbin/mfiutil/mfi_show.c
446
close(fd);
usr.sbin/mfiutil/mfi_show.c
450
mfi_volume_name(fd, list.ld_list[i].ld.v.target_id));
usr.sbin/mfiutil/mfi_show.c
473
close(fd);
usr.sbin/mfiutil/mfi_show.c
485
int error, fd;
usr.sbin/mfiutil/mfi_show.c
492
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_show.c
493
if (fd < 0) {
usr.sbin/mfiutil/mfi_show.c
500
if (mfi_pd_get_list(fd, &list, NULL) < 0) {
usr.sbin/mfiutil/mfi_show.c
512
if (mfi_pd_get_info(fd, list->addr[i].device_id, &info,
usr.sbin/mfiutil/mfi_show.c
535
if (mfi_pd_get_info(fd, list->addr[i].device_id, &info,
usr.sbin/mfiutil/mfi_show.c
553
close(fd);
usr.sbin/mfiutil/mfi_show.c
564
int error, fd;
usr.sbin/mfiutil/mfi_show.c
572
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_show.c
573
if (fd < 0) {
usr.sbin/mfiutil/mfi_show.c
579
if (mfi_ctrl_get_info(fd, &info, NULL) < 0) {
usr.sbin/mfiutil/mfi_show.c
582
close(fd);
usr.sbin/mfiutil/mfi_show.c
59
int error, fd, comma;
usr.sbin/mfiutil/mfi_show.c
609
close(fd);
usr.sbin/mfiutil/mfi_show.c
622
int busy, error, fd;
usr.sbin/mfiutil/mfi_show.c
632
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_show.c
633
if (fd < 0) {
usr.sbin/mfiutil/mfi_show.c
639
if (mfi_ld_get_list(fd, &llist, NULL) < 0) {
usr.sbin/mfiutil/mfi_show.c
642
close(fd);
usr.sbin/mfiutil/mfi_show.c
645
if (mfi_pd_get_list(fd, &plist, NULL) < 0) {
usr.sbin/mfiutil/mfi_show.c
648
close(fd);
usr.sbin/mfiutil/mfi_show.c
655
if (mfi_ld_get_info(fd, target_id, &linfo, NULL) < 0) {
usr.sbin/mfiutil/mfi_show.c
658
mfi_volume_name(fd, target_id));
usr.sbin/mfiutil/mfi_show.c
66
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_show.c
660
close(fd);
usr.sbin/mfiutil/mfi_show.c
664
printf("volume %s ", mfi_volume_name(fd, target_id));
usr.sbin/mfiutil/mfi_show.c
67
if (fd < 0) {
usr.sbin/mfiutil/mfi_show.c
670
printf("volume %s ", mfi_volume_name(fd, target_id));
usr.sbin/mfiutil/mfi_show.c
676
printf("volume %s ", mfi_volume_name(fd, target_id));
usr.sbin/mfiutil/mfi_show.c
682
printf("volume %s ", mfi_volume_name(fd, target_id));
usr.sbin/mfiutil/mfi_show.c
694
if (mfi_pd_get_info(fd, device_id, &pinfo, NULL) < 0) {
usr.sbin/mfiutil/mfi_show.c
698
close(fd);
usr.sbin/mfiutil/mfi_show.c
724
close(fd);
usr.sbin/mfiutil/mfi_show.c
73
if (mfi_ctrl_get_info(fd, &info, NULL) < 0) {
usr.sbin/mfiutil/mfi_show.c
76
close(fd);
usr.sbin/mfiutil/mfi_volume.c
104
mfi_ld_set_props(int fd, struct mfi_ld_props *props)
usr.sbin/mfiutil/mfi_volume.c
109
return (mfi_dcmd_command(fd, MFI_DCMD_LD_SET_PROP, props,
usr.sbin/mfiutil/mfi_volume.c
114
update_cache_policy(int fd, struct mfi_ld_props *old, struct mfi_ld_props *new)
usr.sbin/mfiutil/mfi_volume.c
159
if (mfi_ld_set_props(fd, new) < 0) {
usr.sbin/mfiutil/mfi_volume.c
289
int error, fd, consumed;
usr.sbin/mfiutil/mfi_volume.c
297
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_volume.c
298
if (fd < 0) {
usr.sbin/mfiutil/mfi_volume.c
304
if (mfi_lookup_volume(fd, av[1], &target_id) < 0) {
usr.sbin/mfiutil/mfi_volume.c
307
close(fd);
usr.sbin/mfiutil/mfi_volume.c
311
if (mfi_ld_get_props(fd, target_id, &props) < 0) {
usr.sbin/mfiutil/mfi_volume.c
314
close(fd);
usr.sbin/mfiutil/mfi_volume.c
320
mfi_volume_name(fd, target_id));
usr.sbin/mfiutil/mfi_volume.c
374
close(fd);
usr.sbin/mfiutil/mfi_volume.c
380
error = update_cache_policy(fd, &props, &new);
usr.sbin/mfiutil/mfi_volume.c
382
close(fd);
usr.sbin/mfiutil/mfi_volume.c
392
int error, fd;
usr.sbin/mfiutil/mfi_volume.c
405
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_volume.c
406
if (fd < 0) {
usr.sbin/mfiutil/mfi_volume.c
412
if (mfi_lookup_volume(fd, av[1], &target_id) < 0) {
usr.sbin/mfiutil/mfi_volume.c
415
close(fd);
usr.sbin/mfiutil/mfi_volume.c
419
if (mfi_ld_get_props(fd, target_id, &props) < 0) {
usr.sbin/mfiutil/mfi_volume.c
422
close(fd);
usr.sbin/mfiutil/mfi_volume.c
427
mfi_volume_name(fd, target_id), props.name, av[2]);
usr.sbin/mfiutil/mfi_volume.c
430
if (mfi_ld_set_props(fd, &props) < 0) {
usr.sbin/mfiutil/mfi_volume.c
433
close(fd);
usr.sbin/mfiutil/mfi_volume.c
437
close(fd);
usr.sbin/mfiutil/mfi_volume.c
447
int error, fd;
usr.sbin/mfiutil/mfi_volume.c
456
fd = mfi_open(mfi_unit);
usr.sbin/mfiutil/mfi_volume.c
457
if (fd < 0) {
usr.sbin/mfiutil/mfi_volume.c
463
if (mfi_lookup_volume(fd, av[1], &target_id) < 0) {
usr.sbin/mfiutil/mfi_volume.c
466
close(fd);
usr.sbin/mfiutil/mfi_volume.c
471
if (mfi_ld_get_info(fd, target_id, &info, NULL) < 0) {
usr.sbin/mfiutil/mfi_volume.c
474
mfi_volume_name(fd, target_id));
usr.sbin/mfiutil/mfi_volume.c
475
close(fd);
usr.sbin/mfiutil/mfi_volume.c
491
mfi_volume_name(fd, target_id));
usr.sbin/mfiutil/mfi_volume.c
492
close(fd);
usr.sbin/mfiutil/mfi_volume.c
75
mfi_ld_get_list(int fd, struct mfi_ld_list *list, uint8_t *statusp)
usr.sbin/mfiutil/mfi_volume.c
78
return (mfi_dcmd_command(fd, MFI_DCMD_LD_GET_LIST, list,
usr.sbin/mfiutil/mfi_volume.c
83
mfi_ld_get_info(int fd, uint8_t target_id, struct mfi_ld_info *info,
usr.sbin/mfiutil/mfi_volume.c
89
return (mfi_dcmd_command(fd, MFI_DCMD_LD_GET_INFO, info,
usr.sbin/mfiutil/mfi_volume.c
94
mfi_ld_get_props(int fd, uint8_t target_id, struct mfi_ld_props *props)
usr.sbin/mfiutil/mfi_volume.c
99
return (mfi_dcmd_command(fd, MFI_DCMD_LD_GET_PROP, props,
usr.sbin/mfiutil/mfiutil.h
101
int mfi_ctrl_get_info(int fd, struct mfi_ctrl_info *info, uint8_t *statusp);
usr.sbin/mfiutil/mfiutil.h
102
int mfi_ld_get_info(int fd, uint8_t target_id, struct mfi_ld_info *info,
usr.sbin/mfiutil/mfiutil.h
104
int mfi_ld_get_list(int fd, struct mfi_ld_list *list, uint8_t *statusp);
usr.sbin/mfiutil/mfiutil.h
105
int mfi_pd_get_info(int fd, uint16_t device_id, struct mfi_pd_info *info,
usr.sbin/mfiutil/mfiutil.h
107
int mfi_pd_get_list(int fd, struct mfi_pd_list **listp, uint8_t *statusp);
usr.sbin/mfiutil/mfiutil.h
115
void dump_config(int fd, struct mfi_config_data *config, const char* msg_prefix);
usr.sbin/mfiutil/mfiutil.h
91
const char *mfi_volume_name(int fd, uint8_t target_id);
usr.sbin/mfiutil/mfiutil.h
92
int mfi_volume_busy(int fd, uint8_t target_id);
usr.sbin/mfiutil/mfiutil.h
93
int mfi_config_read(int fd, struct mfi_config_data **configp);
usr.sbin/mfiutil/mfiutil.h
94
int mfi_config_read_opcode(int fd, uint32_t opcode,
usr.sbin/mfiutil/mfiutil.h
96
int mfi_lookup_drive(int fd, char *drive, uint16_t *device_id);
usr.sbin/mfiutil/mfiutil.h
97
int mfi_lookup_volume(int fd, const char *name, uint8_t *target_id);
usr.sbin/mfiutil/mfiutil.h
98
int mfi_dcmd_command(int fd, uint32_t opcode, void *buf, size_t bufsize,
usr.sbin/mlxcontrol/command.c
188
int fd, result, statvalid;
usr.sbin/mlxcontrol/command.c
200
if ((fd = open(ctrlrpath(ctrlr), 0)) < 0) {
usr.sbin/mlxcontrol/command.c
203
if (ioctl(fd, MLX_REBUILDSTAT, &rs) < 0) {
usr.sbin/mlxcontrol/command.c
209
close(fd);
usr.sbin/mlxcontrol/command.c
215
if ((fd = open(drivepath(unit), 0)) < 0) {
usr.sbin/mlxcontrol/command.c
221
if (ioctl(fd, MLXD_STATUS, &result) < 0) {
usr.sbin/mlxcontrol/command.c
270
close(fd);
usr.sbin/mlxcontrol/command.c
506
int fd;
usr.sbin/mlxcontrol/command.c
509
if ((fd = open(ctrlrpath(unit), 0)) < 0) {
usr.sbin/mlxcontrol/command.c
514
if (ioctl(fd, MLX_RESCAN_DRIVES) < 0)
usr.sbin/mlxcontrol/command.c
516
close(fd);
usr.sbin/mlxcontrol/command.c
564
int fd;
usr.sbin/mlxcontrol/command.c
567
if ((fd = open(ctrlrpath(unit), 0)) < 0) {
usr.sbin/mlxcontrol/command.c
572
if (ioctl(fd, MLX_DETACH_DRIVE, &unit) < 0)
usr.sbin/mlxcontrol/command.c
574
close(fd);
usr.sbin/mlxcontrol/command.c
629
int unit, fd, result;
usr.sbin/mlxcontrol/command.c
639
if ((fd = open(drivepath(unit), 0)) < 0) {
usr.sbin/mlxcontrol/command.c
643
if ((ioctl(fd, MLXD_CHECKASYNC, &result)) < 0) {
usr.sbin/mlxcontrol/command.c
674
int unit, fd;
usr.sbin/mlxcontrol/command.c
691
if ((fd = open(ctrlrpath(unit), 0)) < 0) {
usr.sbin/mlxcontrol/command.c
696
if ((ioctl(fd, MLX_REBUILDASYNC, &rb)) < 0) {
usr.sbin/mlxcontrol/command.c
765
int unit, i, ch, fd, cancel = 0;
usr.sbin/mlxcontrol/command.c
801
if ((fd = open(ctrlrpath(unit), 0)) < 0) {
usr.sbin/mlxcontrol/command.c
820
if ((ioctl(fd, MLX_PAUSE_CHANNEL, &mp)) < 0)
usr.sbin/mlxcontrol/command.c
822
close(fd);
usr.sbin/mlxcontrol/interface.c
129
int i, fd;
usr.sbin/mlxcontrol/interface.c
132
if ((fd = open(ctrlrpath(unit), 0)) >= 0) {
usr.sbin/mlxcontrol/interface.c
135
if (ioctl(fd, MLX_NEXT_CHILD, &i) < 0)
usr.sbin/mlxcontrol/interface.c
141
if (ioctl(fd, MLX_GET_SYSDRIVE, &i) == 0)
usr.sbin/mlxcontrol/interface.c
145
close(fd);
usr.sbin/mlxcontrol/interface.c
171
mlx_command(int fd, void *arg)
usr.sbin/mlxcontrol/interface.c
176
error = ioctl(fd, MLX_COMMAND, cmd);
usr.sbin/mlxcontrol/interface.c
47
int i, fd;
usr.sbin/mlxcontrol/interface.c
52
if ((fd = open(ctrlrpath(i), 0)) >= 0)
usr.sbin/mlxcontrol/interface.c
53
close(fd);
usr.sbin/mlxcontrol/interface.c
55
if (fd >= 0) {
usr.sbin/mlxcontrol/interface.c
65
mlx_perform(int unit, void (*func)(int fd, void *arg), void *arg)
usr.sbin/mlxcontrol/interface.c
67
int fd;
usr.sbin/mlxcontrol/interface.c
69
if ((fd = open(ctrlrpath(unit), 0)) >= 0) {
usr.sbin/mlxcontrol/interface.c
70
func(fd, arg);
usr.sbin/mlxcontrol/interface.c
71
close(fd);
usr.sbin/mlxcontrol/interface.c
82
int i, fd, ctrlfd;
usr.sbin/mlxcontrol/interface.c
96
if ((fd = open(drivepath(i), 0)) >= 0)
usr.sbin/mlxcontrol/interface.c
97
close(fd);
usr.sbin/mlxcontrol/interface.c
99
if (fd >= 0) {
usr.sbin/mlxcontrol/mlxcontrol.h
43
extern void mlx_perform(int unit, void (*func)(int fd, void *arg), void *arg);
usr.sbin/mlxcontrol/mlxcontrol.h
44
extern void mlx_command(int fd, void *arg);
usr.sbin/mlxcontrol/mlxcontrol.h
48
extern int mlx_get_device_state(int fd, int channel, int target, struct mlx_phys_drv *drv);
usr.sbin/moused/moused.c
3096
int ad_len, fd;
usr.sbin/moused/moused.c
3104
fd = accept(rodent.mremsfd, (struct sockaddr *) &ad, &ad_len);
usr.sbin/moused/moused.c
3105
if (fd < 0)
usr.sbin/moused/moused.c
3109
rodent.mremcfd = fd;
usr.sbin/moused/moused.c
3113
close(fd);
usr.sbin/mpsutil/mps_cmd.c
264
mps_map_btdh(int fd, uint16_t *devhandle, uint16_t *bus, uint16_t *target)
usr.sbin/mpsutil/mps_cmd.c
273
if ((error = ioctl(fd, MPTIOCTL_BTDH_MAPPING, &map)) != 0) {
usr.sbin/mpsutil/mps_cmd.c
287
mps_read_config_page_header(int fd, U8 PageType, U8 PageNumber, U32 PageAddress,
usr.sbin/mpsutil/mps_cmd.c
300
if (mps_pass_command(fd, &req, sizeof(req), &reply, sizeof(reply),
usr.sbin/mpsutil/mps_cmd.c
316
mps_read_ext_config_page_header(int fd, U8 ExtPageType, U8 PageNumber, U32 PageAddress, MPI2_CONFIG_PAGE_HEADER *header, U16 *ExtPageLength, U16 *IOCStatus)
usr.sbin/mpsutil/mps_cmd.c
329
if (mps_pass_command(fd, &req, sizeof(req), &reply, sizeof(reply),
usr.sbin/mpsutil/mps_cmd.c
346
mps_read_config_page(int fd, U8 PageType, U8 PageNumber, U32 PageAddress,
usr.sbin/mpsutil/mps_cmd.c
356
error = mps_read_config_page_header(fd, PageType, PageNumber,
usr.sbin/mpsutil/mps_cmd.c
373
if (mps_pass_command(fd, &req, sizeof(req), &reply, sizeof(reply),
usr.sbin/mpsutil/mps_cmd.c
394
mps_read_extended_config_page(int fd, U8 ExtPageType, U8 PageVersion,
usr.sbin/mpsutil/mps_cmd.c
407
error = mps_read_ext_config_page_header(fd, ExtPageType, PageNumber,
usr.sbin/mpsutil/mps_cmd.c
426
if (mps_pass_command(fd, &req, sizeof(req), &reply, sizeof(reply),
usr.sbin/mpsutil/mps_cmd.c
447
mps_firmware_send(int fd, unsigned char *fw, uint32_t len, bool bios)
usr.sbin/mpsutil/mps_cmd.c
459
if (mps_user_command(fd, &req, sizeof(req), &reply, sizeof(reply),
usr.sbin/mpsutil/mps_cmd.c
467
mps_firmware_get(int fd, unsigned char **firmware, bool bios)
usr.sbin/mpsutil/mps_cmd.c
479
if (mps_user_command(fd, &req, sizeof(req), &reply, sizeof(reply),
usr.sbin/mpsutil/mps_cmd.c
493
if (mps_user_command(fd, &req, sizeof(req), &reply, sizeof(reply),
usr.sbin/mpsutil/mps_cmd.c
505
mps_read_config_page_header(int fd, U8 PageType, U8 PageNumber, U32 PageAddress,
usr.sbin/mpsutil/mps_cmd.c
518
if (ioctl(fd, MPSIO_READ_CFG_HEADER, &req) < 0)
usr.sbin/mpsutil/mps_cmd.c
530
mps_read_config_page(int fd, U8 PageType, U8 PageNumber, U32 PageAddress,
usr.sbin/mpsutil/mps_cmd.c
537
error = mps_read_config_page_header(fd, PageType, PageNumber,
usr.sbin/mpsutil/mps_cmd.c
550
if (ioctl(fd, MPSIO_READ_CFG_PAGE, &req) < 0) {
usr.sbin/mpsutil/mps_cmd.c
570
mps_read_extended_config_page(int fd, U8 ExtPageType, U8 PageVersion,
usr.sbin/mpsutil/mps_cmd.c
584
if (ioctl(fd, MPSIO_READ_EXT_CFG_HEADER, &req) < 0)
usr.sbin/mpsutil/mps_cmd.c
599
if (ioctl(fd, MPSIO_READ_EXT_CFG_PAGE, &req) < 0) {
usr.sbin/mpsutil/mps_cmd.c
629
mps_user_command(int fd, void *req, uint32_t req_len, void *reply,
usr.sbin/mpsutil/mps_cmd.c
643
if (ioctl(fd, is_mps ? MPSIO_MPS_COMMAND : MPRIO_MPR_COMMAND, &cmd) < 0)
usr.sbin/mpsutil/mps_cmd.c
649
mps_pass_command(int fd, void *req, uint32_t req_len, void *reply,
usr.sbin/mpsutil/mps_cmd.c
690
if (ioctl(fd, MPTIOCTL_PASS_THRU, &pass) < 0)
usr.sbin/mpsutil/mps_cmd.c
696
mps_get_iocfacts(int fd)
usr.sbin/mpsutil/mps_cmd.c
712
error = mps_pass_command(fd, &req, sizeof(MPI2_IOC_FACTS_REQUEST),
usr.sbin/mpsutil/mps_cmd.c
715
error = mps_user_command(fd, &req, sizeof(MPI2_IOC_FACTS_REQUEST),
usr.sbin/mpsutil/mps_flash.c
100
if ((ret = write(fd, firmware_buffer + written, size - written)) <0) {
usr.sbin/mpsutil/mps_flash.c
104
close(fd);
usr.sbin/mpsutil/mps_flash.c
109
close(fd);
usr.sbin/mpsutil/mps_flash.c
122
int error, fd;
usr.sbin/mpsutil/mps_flash.c
157
fd = open(argv[2], O_RDONLY);
usr.sbin/mpsutil/mps_flash.c
158
if (fd < 0) {
usr.sbin/mpsutil/mps_flash.c
164
mem = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
usr.sbin/mpsutil/mps_flash.c
168
close(fd);
usr.sbin/mpsutil/mps_flash.c
171
close(fd);
usr.sbin/mpsutil/mps_flash.c
173
fd = mps_open(mps_unit);
usr.sbin/mpsutil/mps_flash.c
174
if (fd < 0) {
usr.sbin/mpsutil/mps_flash.c
181
if ((facts = mps_get_iocfacts(fd)) == NULL) {
usr.sbin/mpsutil/mps_flash.c
184
close(fd);
usr.sbin/mpsutil/mps_flash.c
193
close(fd);
usr.sbin/mpsutil/mps_flash.c
200
close(fd);
usr.sbin/mpsutil/mps_flash.c
212
close(fd);
usr.sbin/mpsutil/mps_flash.c
222
close(fd);
usr.sbin/mpsutil/mps_flash.c
229
if (mps_firmware_send(fd, mem, st.st_size, bios) < 0) {
usr.sbin/mpsutil/mps_flash.c
232
close(fd);
usr.sbin/mpsutil/mps_flash.c
238
close(fd);
usr.sbin/mpsutil/mps_flash.c
51
int error, fd, size;
usr.sbin/mpsutil/mps_flash.c
77
fd = mps_open(mps_unit);
usr.sbin/mpsutil/mps_flash.c
78
if (fd < 0) {
usr.sbin/mpsutil/mps_flash.c
84
if ((size = mps_firmware_get(fd, &firmware_buffer, bios)) < 0) {
usr.sbin/mpsutil/mps_flash.c
86
close(fd);
usr.sbin/mpsutil/mps_flash.c
90
close(fd);
usr.sbin/mpsutil/mps_flash.c
92
fd = open(firmware_file, O_CREAT | O_TRUNC | O_RDWR, 0644);
usr.sbin/mpsutil/mps_flash.c
93
if (fd <0) {
usr.sbin/mpsutil/mps_show.c
103
bios3 = mps_read_config_page(fd, MPI2_CONFIG_PAGETYPE_BIOS, 3, 0, NULL);
usr.sbin/mpsutil/mps_show.c
115
if ((facts = mps_get_iocfacts(fd)) == NULL) {
usr.sbin/mpsutil/mps_show.c
117
close(fd);
usr.sbin/mpsutil/mps_show.c
129
fd = mps_open(mps_unit);
usr.sbin/mpsutil/mps_show.c
130
if (fd < 0) {
usr.sbin/mpsutil/mps_show.c
136
sas0 = mps_read_extended_config_page(fd,
usr.sbin/mpsutil/mps_show.c
143
close(fd);
usr.sbin/mpsutil/mps_show.c
147
sas1 = mps_read_extended_config_page(fd,
usr.sbin/mpsutil/mps_show.c
154
close(fd);
usr.sbin/mpsutil/mps_show.c
195
close(fd);
usr.sbin/mpsutil/mps_show.c
206
int error, fd;
usr.sbin/mpsutil/mps_show.c
208
fd = mps_open(mps_unit);
usr.sbin/mpsutil/mps_show.c
209
if (fd < 0) {
usr.sbin/mpsutil/mps_show.c
215
if ((facts = mps_get_iocfacts(fd)) == NULL) {
usr.sbin/mpsutil/mps_show.c
217
close(fd);
usr.sbin/mpsutil/mps_show.c
281
int unit, fd, error;
usr.sbin/mpsutil/mps_show.c
285
fd = mps_open(unit);
usr.sbin/mpsutil/mps_show.c
286
if (fd < 0)
usr.sbin/mpsutil/mps_show.c
288
facts = mps_get_iocfacts(fd);
usr.sbin/mpsutil/mps_show.c
292
close(fd);
usr.sbin/mpsutil/mps_show.c
295
man0 = mps_read_man_page(fd, 0, NULL);
usr.sbin/mpsutil/mps_show.c
299
close(fd);
usr.sbin/mpsutil/mps_show.c
305
close(fd);
usr.sbin/mpsutil/mps_show.c
315
close(fd);
usr.sbin/mpsutil/mps_show.c
478
int fd, error, nphys;
usr.sbin/mpsutil/mps_show.c
480
fd = mps_open(mps_unit);
usr.sbin/mpsutil/mps_show.c
481
if (fd < 0) {
usr.sbin/mpsutil/mps_show.c
487
sas0 = mps_read_extended_config_page(fd,
usr.sbin/mpsutil/mps_show.c
502
device = mps_read_extended_config_page(fd,
usr.sbin/mpsutil/mps_show.c
512
close(fd);
usr.sbin/mpsutil/mps_show.c
524
error = mps_map_btdh(fd, &handle, &bus, &target);
usr.sbin/mpsutil/mps_show.c
540
exp1 = mps_read_extended_config_page(fd,
usr.sbin/mpsutil/mps_show.c
552
close(fd);
usr.sbin/mpsutil/mps_show.c
585
close(fd);
usr.sbin/mpsutil/mps_show.c
596
int fd, error, issep;
usr.sbin/mpsutil/mps_show.c
598
fd = mps_open(mps_unit);
usr.sbin/mpsutil/mps_show.c
599
if (fd < 0) {
usr.sbin/mpsutil/mps_show.c
608
enc = mps_read_extended_config_page(fd,
usr.sbin/mpsutil/mps_show.c
618
close(fd);
usr.sbin/mpsutil/mps_show.c
634
close(fd);
usr.sbin/mpsutil/mps_show.c
647
int fd, error, nphys, i;
usr.sbin/mpsutil/mps_show.c
649
fd = mps_open(mps_unit);
usr.sbin/mpsutil/mps_show.c
650
if (fd < 0) {
usr.sbin/mpsutil/mps_show.c
659
exp0 = mps_read_extended_config_page(fd,
usr.sbin/mpsutil/mps_show.c
669
close(fd);
usr.sbin/mpsutil/mps_show.c
691
exp1 = mps_read_extended_config_page(fd,
usr.sbin/mpsutil/mps_show.c
72
int error, fd, v, i;
usr.sbin/mpsutil/mps_show.c
726
close(fd);
usr.sbin/mpsutil/mps_show.c
741
int fd, error, len, attrs;
usr.sbin/mpsutil/mps_show.c
744
fd = mps_open(mps_unit);
usr.sbin/mpsutil/mps_show.c
745
if (fd < 0) {
usr.sbin/mpsutil/mps_show.c
770
data = mps_read_extended_config_page(fd, page, 0, num, addr,
usr.sbin/mpsutil/mps_show.c
773
data = mps_read_config_page(fd, page, num, addr, &IOCStatus);
usr.sbin/mpsutil/mps_show.c
79
fd = mps_open(mps_unit);
usr.sbin/mpsutil/mps_show.c
80
if (fd < 0) {
usr.sbin/mpsutil/mps_show.c
807
close(fd);
usr.sbin/mpsutil/mps_show.c
86
man0 = mps_read_man_page(fd, 0, NULL);
usr.sbin/mpsutil/mpsutil.h
112
int mps_user_command(int fd, void *req, uint32_t req_len, void *reply,
usr.sbin/mpsutil/mpsutil.h
114
int mps_pass_command(int fd, void *req, uint32_t req_len, void *reply,
usr.sbin/mpsutil/mpsutil.h
117
int mps_read_config_page_header(int fd, U8 PageType, U8 PageNumber,
usr.sbin/mpsutil/mpsutil.h
119
int mps_read_ext_config_page_header(int fd, U8 ExtPageType, U8 PageNumber,
usr.sbin/mpsutil/mpsutil.h
122
void *mps_read_config_page(int fd, U8 PageType, U8 PageNumber,
usr.sbin/mpsutil/mpsutil.h
124
void *mps_read_extended_config_page(int fd, U8 ExtPageType, U8 PageVersion,
usr.sbin/mpsutil/mpsutil.h
126
int mps_map_btdh(int fd, uint16_t *devhandle, uint16_t *bus,
usr.sbin/mpsutil/mpsutil.h
129
int mps_firmware_send(int fd, unsigned char *buf, uint32_t len, bool bios);
usr.sbin/mpsutil/mpsutil.h
130
int mps_firmware_get(int fd, unsigned char **buf, bool bios);
usr.sbin/mpsutil/mpsutil.h
133
mps_read_man_page(int fd, U8 PageNumber, U16 *IOCStatus)
usr.sbin/mpsutil/mpsutil.h
136
return (mps_read_config_page(fd, MPI2_CONFIG_PAGETYPE_MANUFACTURING,
usr.sbin/mpsutil/mpsutil.h
141
mps_read_ioc_page(int fd, U8 PageNumber, U16 *IOCStatus)
usr.sbin/mpsutil/mpsutil.h
144
return (mps_read_config_page(fd, MPI2_CONFIG_PAGETYPE_IOC, PageNumber,
usr.sbin/mpsutil/mpsutil.h
155
MPI2_IOC_FACTS_REPLY * mps_get_iocfacts(int fd);
usr.sbin/mptutil/mpt_cam.c
391
mpt_fetch_disks(int fd, int *ndisks, struct mpt_standalone_disk **disksp)
usr.sbin/mptutil/mpt_cam.c
484
ioc2 = mpt_read_ioc_page(fd, 2, NULL);
usr.sbin/mptutil/mpt_cmd.c
294
mpt_lookup_volume(int fd, const char *name, U8 *VolumeBus, U8 *VolumeID)
usr.sbin/mptutil/mpt_cmd.c
326
ioc2 = mpt_read_ioc_page(fd, 2, NULL);
usr.sbin/mptutil/mpt_cmd.c
346
mpt_read_config_page_header(int fd, U8 PageType, U8 PageNumber, U32 PageAddress,
usr.sbin/mptutil/mpt_cmd.c
357
if (ioctl(fd, MPTIO_READ_CFG_HEADER, &req) < 0)
usr.sbin/mptutil/mpt_cmd.c
372
mpt_read_config_page(int fd, U8 PageType, U8 PageNumber, U32 PageAddress,
usr.sbin/mptutil/mpt_cmd.c
385
if (ioctl(fd, MPTIO_READ_CFG_HEADER, &req) < 0)
usr.sbin/mptutil/mpt_cmd.c
400
if (ioctl(fd, MPTIO_READ_CFG_PAGE, &req) < 0) {
usr.sbin/mptutil/mpt_cmd.c
420
mpt_read_extended_config_page(int fd, U8 ExtPageType, U8 PageVersion,
usr.sbin/mptutil/mpt_cmd.c
434
if (ioctl(fd, MPTIO_READ_EXT_CFG_HEADER, &req) < 0)
usr.sbin/mptutil/mpt_cmd.c
449
if (ioctl(fd, MPTIO_READ_EXT_CFG_PAGE, &req) < 0) {
usr.sbin/mptutil/mpt_cmd.c
469
mpt_write_config_page(int fd, void *buf, U16 *IOCStatus)
usr.sbin/mptutil/mpt_cmd.c
480
if (ioctl(fd, MPTIO_WRITE_CFG_PAGE, &req) < 0)
usr.sbin/mptutil/mpt_cmd.c
495
mpt_raid_action(int fd, U8 Action, U8 VolumeBus, U8 VolumeID, U8 PhysDiskNum,
usr.sbin/mptutil/mpt_cmd.c
517
if (ioctl(fd, MPTIO_RAID_ACTION, &raid_act) < 0)
usr.sbin/mptutil/mpt_config.c
1004
int error, fd, i, ndisks;
usr.sbin/mptutil/mpt_config.c
1012
fd = mpt_open(mpt_unit);
usr.sbin/mptutil/mpt_config.c
1013
if (fd < 0) {
usr.sbin/mptutil/mpt_config.c
1019
error = mpt_fetch_disks(fd, &ndisks, &disks);
usr.sbin/mptutil/mpt_config.c
1034
if (mpt_create_physdisk(fd, &disks[i], &PhysDiskNum) < 0) {
usr.sbin/mptutil/mpt_config.c
1043
close(fd);
usr.sbin/mptutil/mpt_config.c
1054
int error, fd;
usr.sbin/mptutil/mpt_config.c
1062
fd = mpt_open(mpt_unit);
usr.sbin/mptutil/mpt_config.c
1063
if (fd < 0) {
usr.sbin/mptutil/mpt_config.c
1069
list = mpt_pd_list(fd);
usr.sbin/mptutil/mpt_config.c
1080
info = mpt_pd_info(fd, PhysDiskNum, NULL);
usr.sbin/mptutil/mpt_config.c
1087
if (mpt_delete_physdisk(fd, PhysDiskNum) < 0) {
usr.sbin/mptutil/mpt_config.c
1095
close(fd);
usr.sbin/mptutil/mpt_config.c
1136
int error, fd;
usr.sbin/mptutil/mpt_config.c
1143
fd = mpt_open(mpt_unit);
usr.sbin/mptutil/mpt_config.c
1144
if (fd < 0) {
usr.sbin/mptutil/mpt_config.c
1150
error = mpt_lookup_volume(fd, av[1], &VolumeBus, &VolumeID);
usr.sbin/mptutil/mpt_config.c
1156
vol = mpt_vol_info(fd, VolumeBus, VolumeID, NULL);
usr.sbin/mptutil/mpt_config.c
1165
close(fd);
usr.sbin/mptutil/mpt_config.c
146
mpt_create_physdisk(int fd, struct mpt_standalone_disk *disk, U8 *PhysDiskNum)
usr.sbin/mptutil/mpt_config.c
153
error = mpt_read_config_page_header(fd, MPI_CONFIG_PAGETYPE_RAID_PHYSDISK,
usr.sbin/mptutil/mpt_config.c
172
error = mpt_raid_action(fd, MPI_RAID_ACTION_CREATE_PHYSDISK, 0, 0, 0, 0,
usr.sbin/mptutil/mpt_config.c
182
mpt_delete_physdisk(int fd, U8 PhysDiskNum)
usr.sbin/mptutil/mpt_config.c
185
return (mpt_raid_action(fd, MPI_RAID_ACTION_DELETE_PHYSDISK, 0, 0,
usr.sbin/mptutil/mpt_config.c
202
int ch, error, fd, i;
usr.sbin/mptutil/mpt_config.c
204
fd = mpt_open(mpt_unit);
usr.sbin/mptutil/mpt_config.c
205
if (fd < 0) {
usr.sbin/mptutil/mpt_config.c
211
ioc2 = mpt_read_ioc_page(fd, 2, NULL);
usr.sbin/mptutil/mpt_config.c
240
error = mpt_raid_action(fd, MPI_RAID_ACTION_DELETE_VOLUME,
usr.sbin/mptutil/mpt_config.c
252
ioc5 = mpt_read_ioc_page(fd, 5, NULL);
usr.sbin/mptutil/mpt_config.c
258
if (mpt_delete_physdisk(fd, spare->PhysDiskNum) < 0)
usr.sbin/mptutil/mpt_config.c
265
ioc3 = mpt_read_ioc_page(fd, 3, NULL);
usr.sbin/mptutil/mpt_config.c
271
if (mpt_delete_physdisk(fd, disk->PhysDiskNum) < 0)
usr.sbin/mptutil/mpt_config.c
279
close(fd);
usr.sbin/mptutil/mpt_config.c
323
parse_volume(int fd, int raid_type, struct config_id_state *state,
usr.sbin/mptutil/mpt_config.c
376
dinfo->info = mpt_pd_info(fd, PhysDiskNum, NULL);
usr.sbin/mptutil/mpt_config.c
404
add_drives(int fd, struct volume_info *info, int verbose)
usr.sbin/mptutil/mpt_config.c
413
if (mpt_create_physdisk(fd, dinfo->sdisk,
usr.sbin/mptutil/mpt_config.c
425
dinfo->info = mpt_pd_info(fd, PhysDiskNum, NULL);
usr.sbin/mptutil/mpt_config.c
466
build_volume(int fd, struct volume_info *info, int raid_type, long stripe_size,
usr.sbin/mptutil/mpt_config.c
478
error = mpt_read_config_page_header(fd, MPI_CONFIG_PAGETYPE_RAID_VOLUME,
usr.sbin/mptutil/mpt_config.c
589
int ch, error, fd, i, quick, raid_type, verbose;
usr.sbin/mptutil/mpt_config.c
599
fd = mpt_open(mpt_unit);
usr.sbin/mptutil/mpt_config.c
600
if (fd < 0) {
usr.sbin/mptutil/mpt_config.c
658
state.ioc2 = mpt_read_ioc_page(fd, 2, NULL);
usr.sbin/mptutil/mpt_config.c
664
state.list = mpt_pd_list(fd);
usr.sbin/mptutil/mpt_config.c
667
error = mpt_fetch_disks(fd, &state.nsdisks, &state.sdisks);
usr.sbin/mptutil/mpt_config.c
682
error = parse_volume(fd, raid_type, &state, av[0], info);
usr.sbin/mptutil/mpt_config.c
687
error = add_drives(fd, info, verbose);
usr.sbin/mptutil/mpt_config.c
692
vol = build_volume(fd, info, raid_type, stripe_size, &state, verbose);
usr.sbin/mptutil/mpt_config.c
704
error = mpt_raid_action(fd, MPI_RAID_ACTION_CREATE_VOLUME, vol->VolumeBus,
usr.sbin/mptutil/mpt_config.c
724
close(fd);
usr.sbin/mptutil/mpt_config.c
734
int error, fd;
usr.sbin/mptutil/mpt_config.c
741
fd = mpt_open(mpt_unit);
usr.sbin/mptutil/mpt_config.c
742
if (fd < 0) {
usr.sbin/mptutil/mpt_config.c
748
error = mpt_lookup_volume(fd, av[1], &VolumeBus, &VolumeID);
usr.sbin/mptutil/mpt_config.c
757
error = mpt_raid_action(fd, MPI_RAID_ACTION_DELETE_VOLUME, VolumeBus,
usr.sbin/mptutil/mpt_config.c
767
close(fd);
usr.sbin/mptutil/mpt_config.c
774
find_volume_spare_pool(int fd, const char *name, int *pool)
usr.sbin/mptutil/mpt_config.c
782
error = mpt_lookup_volume(fd, name, &VolumeBus, &VolumeID);
usr.sbin/mptutil/mpt_config.c
788
info = mpt_vol_info(fd, VolumeBus, VolumeID, NULL);
usr.sbin/mptutil/mpt_config.c
808
ioc2 = mpt_read_ioc_page(fd, 2, NULL);
usr.sbin/mptutil/mpt_config.c
817
info = mpt_vol_info(fd, vol->VolumeBus, vol->VolumeID, NULL);
usr.sbin/mptutil/mpt_config.c
835
info = mpt_vol_info(fd, VolumeBus, VolumeID, NULL);
usr.sbin/mptutil/mpt_config.c
839
error = mpt_raid_action(fd, MPI_RAID_ACTION_CHANGE_VOLUME_SETTINGS,
usr.sbin/mptutil/mpt_config.c
860
int error, fd, i, nsdisks, pool = 0;
usr.sbin/mptutil/mpt_config.c
871
fd = mpt_open(mpt_unit);
usr.sbin/mptutil/mpt_config.c
872
if (fd < 0) {
usr.sbin/mptutil/mpt_config.c
879
error = find_volume_spare_pool(fd, av[2], &pool);
usr.sbin/mptutil/mpt_config.c
885
list = mpt_pd_list(fd);
usr.sbin/mptutil/mpt_config.c
891
error = mpt_fetch_disks(fd, &nsdisks, &sdisks);
usr.sbin/mptutil/mpt_config.c
907
if (mpt_create_physdisk(fd, &sdisks[i], &PhysDiskNum) < 0) {
usr.sbin/mptutil/mpt_config.c
916
info = mpt_pd_info(fd, PhysDiskNum, NULL);
usr.sbin/mptutil/mpt_config.c
924
error = mpt_raid_action(fd, MPI_RAID_ACTION_CHANGE_PHYSDISK_SETTINGS, 0,
usr.sbin/mptutil/mpt_config.c
933
close(fd);
usr.sbin/mptutil/mpt_config.c
945
int error, fd;
usr.sbin/mptutil/mpt_config.c
952
fd = mpt_open(mpt_unit);
usr.sbin/mptutil/mpt_config.c
953
if (fd < 0) {
usr.sbin/mptutil/mpt_config.c
959
list = mpt_pd_list(fd);
usr.sbin/mptutil/mpt_config.c
971
info = mpt_pd_info(fd, PhysDiskNum, NULL);
usr.sbin/mptutil/mpt_config.c
983
if (mpt_delete_physdisk(fd, PhysDiskNum) < 0) {
usr.sbin/mptutil/mpt_config.c
991
close(fd);
usr.sbin/mptutil/mpt_drive.c
108
mpt_pd_insert(int fd, struct mpt_drive_list *list, U8 PhysDiskNum)
usr.sbin/mptutil/mpt_drive.c
129
list->drives[i] = mpt_pd_info(fd, PhysDiskNum, NULL);
usr.sbin/mptutil/mpt_drive.c
137
mpt_pd_list(int fd)
usr.sbin/mptutil/mpt_drive.c
150
ioc2 = mpt_read_ioc_page(fd, 2, NULL);
usr.sbin/mptutil/mpt_drive.c
158
ioc3 = mpt_read_ioc_page(fd, 3, NULL);
usr.sbin/mptutil/mpt_drive.c
167
ioc5 = mpt_read_ioc_page(fd, 5, NULL);
usr.sbin/mptutil/mpt_drive.c
185
volumes[i] = mpt_vol_info(fd, vol->VolumeBus, vol->VolumeID,
usr.sbin/mptutil/mpt_drive.c
206
if (mpt_pd_insert(fd, list, rdisk->PhysDiskNum) < 0)
usr.sbin/mptutil/mpt_drive.c
215
if (mpt_pd_insert(fd, list, spare->PhysDiskNum) < 0)
usr.sbin/mptutil/mpt_drive.c
221
if (mpt_pd_insert(fd, list, disk->PhysDiskNum) < 0)
usr.sbin/mptutil/mpt_drive.c
314
int error, fd;
usr.sbin/mptutil/mpt_drive.c
316
fd = mpt_open(mpt_unit);
usr.sbin/mptutil/mpt_drive.c
317
if (fd < 0) {
usr.sbin/mptutil/mpt_drive.c
323
list = mpt_pd_list(fd);
usr.sbin/mptutil/mpt_drive.c
335
info = mpt_pd_info(fd, PhysDiskNum, NULL);
usr.sbin/mptutil/mpt_drive.c
348
error = mpt_raid_action(fd, Action, 0, 0, PhysDiskNum, 0, NULL, 0, NULL,
usr.sbin/mptutil/mpt_drive.c
356
close(fd);
usr.sbin/mptutil/mpt_evt.c
105
log = mpt_get_events(fd, NULL);
usr.sbin/mptutil/mpt_evt.c
154
close(fd);
usr.sbin/mptutil/mpt_evt.c
43
mpt_get_events(int fd, U16 *IOCStatus)
usr.sbin/mptutil/mpt_evt.c
46
return (mpt_read_extended_config_page(fd, MPI_CONFIG_EXTPAGETYPE_LOG,
usr.sbin/mptutil/mpt_evt.c
96
int ch, error, fd, i, num_events, verbose;
usr.sbin/mptutil/mpt_evt.c
98
fd = mpt_open(mpt_unit);
usr.sbin/mptutil/mpt_evt.c
99
if (fd < 0) {
usr.sbin/mptutil/mpt_show.c
113
ioc2 = mpt_read_ioc_page(fd, 2, &IOCStatus);
usr.sbin/mptutil/mpt_show.c
160
ioc6 = mpt_read_ioc_page(fd, 6, &IOCStatus);
usr.sbin/mptutil/mpt_show.c
185
close(fd);
usr.sbin/mptutil/mpt_show.c
287
int error, fd, i, j, nsdisks;
usr.sbin/mptutil/mpt_show.c
294
fd = mpt_open(mpt_unit);
usr.sbin/mptutil/mpt_show.c
295
if (fd < 0) {
usr.sbin/mptutil/mpt_show.c
302
ioc2 = mpt_read_ioc_page(fd, 2, NULL);
usr.sbin/mptutil/mpt_show.c
303
ioc5 = mpt_read_ioc_page(fd, 5, NULL);
usr.sbin/mptutil/mpt_show.c
309
if (mpt_fetch_disks(fd, &nsdisks, &sdisks) < 0) {
usr.sbin/mptutil/mpt_show.c
323
vinfo = mpt_vol_info(fd, vol->VolumeBus, vol->VolumeID, NULL);
usr.sbin/mptutil/mpt_show.c
328
vnames = mpt_vol_names(fd, vol->VolumeBus, vol->VolumeID, NULL);
usr.sbin/mptutil/mpt_show.c
342
pinfo = mpt_pd_info(fd, disk->PhysDiskNum, NULL);
usr.sbin/mptutil/mpt_show.c
360
pinfo = mpt_pd_info(fd, spare->PhysDiskNum, NULL);
usr.sbin/mptutil/mpt_show.c
375
close(fd);
usr.sbin/mptutil/mpt_show.c
388
int error, fd, i, len, state_len;
usr.sbin/mptutil/mpt_show.c
395
fd = mpt_open(mpt_unit);
usr.sbin/mptutil/mpt_show.c
396
if (fd < 0) {
usr.sbin/mptutil/mpt_show.c
403
ioc2 = mpt_read_ioc_page(fd, 2, NULL);
usr.sbin/mptutil/mpt_show.c
418
volumes[i] = mpt_vol_info(fd, vol->VolumeBus, vol->VolumeID,
usr.sbin/mptutil/mpt_show.c
455
vnames = mpt_vol_names(fd, vol->VolumeBus, vol->VolumeID, NULL);
usr.sbin/mptutil/mpt_show.c
464
close(fd);
usr.sbin/mptutil/mpt_show.c
475
int error, fd, i, len, nsdisks, state_len;
usr.sbin/mptutil/mpt_show.c
482
fd = mpt_open(mpt_unit);
usr.sbin/mptutil/mpt_show.c
483
if (fd < 0) {
usr.sbin/mptutil/mpt_show.c
490
list = mpt_pd_list(fd);
usr.sbin/mptutil/mpt_show.c
499
if (mpt_fetch_disks(fd, &nsdisks, &sdisks) != 0) {
usr.sbin/mptutil/mpt_show.c
528
close(fd);
usr.sbin/mptutil/mpt_show.c
540
int fd, i;
usr.sbin/mptutil/mpt_show.c
547
fd = mpt_open(mpt_unit);
usr.sbin/mptutil/mpt_show.c
548
if (fd < 0) {
usr.sbin/mptutil/mpt_show.c
556
pinfo = mpt_pd_info(fd, i, &IOCStatus);
usr.sbin/mptutil/mpt_show.c
569
close(fd);
usr.sbin/mptutil/mpt_show.c
81
int comma, error, fd;
usr.sbin/mptutil/mpt_show.c
88
fd = mpt_open(mpt_unit);
usr.sbin/mptutil/mpt_show.c
89
if (fd < 0) {
usr.sbin/mptutil/mpt_show.c
95
man0 = mpt_read_man_page(fd, 0, NULL);
usr.sbin/mptutil/mpt_volume.c
113
if (mpt_write_config_page(fd, vnames, NULL) < 0) {
usr.sbin/mptutil/mpt_volume.c
120
close(fd);
usr.sbin/mptutil/mpt_volume.c
134
int error, fd;
usr.sbin/mptutil/mpt_volume.c
142
fd = mpt_open(mpt_unit);
usr.sbin/mptutil/mpt_volume.c
143
if (fd < 0) {
usr.sbin/mptutil/mpt_volume.c
149
error = mpt_lookup_volume(fd, av[1], &VolumeBus, &VolumeID);
usr.sbin/mptutil/mpt_volume.c
155
error = mpt_raid_action(fd, MPI_RAID_ACTION_INDICATOR_STRUCT, VolumeBus,
usr.sbin/mptutil/mpt_volume.c
188
close(fd);
usr.sbin/mptutil/mpt_volume.c
200
int error, fd;
usr.sbin/mptutil/mpt_volume.c
216
fd = mpt_open(mpt_unit);
usr.sbin/mptutil/mpt_volume.c
217
if (fd < 0) {
usr.sbin/mptutil/mpt_volume.c
223
error = mpt_lookup_volume(fd, av[1], &VolumeBus, &VolumeID);
usr.sbin/mptutil/mpt_volume.c
229
volume = mpt_vol_info(fd, VolumeBus, VolumeID, NULL);
usr.sbin/mptutil/mpt_volume.c
243
close(fd);
usr.sbin/mptutil/mpt_volume.c
248
error = mpt_raid_action(fd, MPI_RAID_ACTION_CHANGE_VOLUME_SETTINGS,
usr.sbin/mptutil/mpt_volume.c
254
close(fd);
usr.sbin/mptutil/mpt_volume.c
71
int error, fd;
usr.sbin/mptutil/mpt_volume.c
83
fd = mpt_open(mpt_unit);
usr.sbin/mptutil/mpt_volume.c
84
if (fd < 0) {
usr.sbin/mptutil/mpt_volume.c
90
error = mpt_lookup_volume(fd, av[1], &VolumeBus, &VolumeID);
usr.sbin/mptutil/mpt_volume.c
96
vnames = mpt_vol_names(fd, VolumeBus, VolumeID, NULL);
usr.sbin/mptutil/mptutil.h
101
void *mpt_read_config_page(int fd, U8 PageType, U8 PageNumber,
usr.sbin/mptutil/mptutil.h
103
void *mpt_read_extended_config_page(int fd, U8 ExtPageType, U8 PageVersion,
usr.sbin/mptutil/mptutil.h
105
int mpt_write_config_page(int fd, void *buf, U16 *IOCStatus);
usr.sbin/mptutil/mptutil.h
107
int mpt_raid_action(int fd, U8 Action, U8 VolumeBus, U8 VolumeID,
usr.sbin/mptutil/mptutil.h
117
struct mpt_drive_list *mpt_pd_list(int fd);
usr.sbin/mptutil/mptutil.h
121
int mpt_fetch_disks(int fd, int *ndisks,
usr.sbin/mptutil/mptutil.h
126
int mpt_lookup_volume(int fd, const char *name, U8 *VolumeBus,
usr.sbin/mptutil/mptutil.h
131
mpt_read_man_page(int fd, U8 PageNumber, U16 *IOCStatus)
usr.sbin/mptutil/mptutil.h
134
return (mpt_read_config_page(fd, MPI_CONFIG_PAGETYPE_MANUFACTURING,
usr.sbin/mptutil/mptutil.h
139
mpt_read_ioc_page(int fd, U8 PageNumber, U16 *IOCStatus)
usr.sbin/mptutil/mptutil.h
142
return (mpt_read_config_page(fd, MPI_CONFIG_PAGETYPE_IOC, PageNumber,
usr.sbin/mptutil/mptutil.h
154
mpt_vol_info(int fd, U8 VolumeBus, U8 VolumeID, U16 *IOCStatus)
usr.sbin/mptutil/mptutil.h
157
return (mpt_read_config_page(fd, MPI_CONFIG_PAGETYPE_RAID_VOLUME, 0,
usr.sbin/mptutil/mptutil.h
162
mpt_vol_names(int fd, U8 VolumeBus, U8 VolumeID, U16 *IOCStatus)
usr.sbin/mptutil/mptutil.h
165
return (mpt_read_config_page(fd, MPI_CONFIG_PAGETYPE_RAID_VOLUME, 1,
usr.sbin/mptutil/mptutil.h
170
mpt_pd_info(int fd, U8 PhysDiskNum, U16 *IOCStatus)
usr.sbin/mptutil/mptutil.h
173
return (mpt_read_config_page(fd, MPI_CONFIG_PAGETYPE_RAID_PHYSDISK, 0,
usr.sbin/mptutil/mptutil.h
99
int mpt_read_config_page_header(int fd, U8 PageType, U8 PageNumber,
usr.sbin/mtree/compare.c
128
int fd, label;
usr.sbin/mtree/compare.c
393
if ((fd = open(p->fts_accpath, O_RDONLY, 0)) < 0) {
usr.sbin/mtree/compare.c
398
} else if (crc(fd, &val, &len)) {
usr.sbin/mtree/compare.c
399
close(fd);
usr.sbin/mtree/compare.c
405
close(fd);
usr.sbin/mtree/crc.c
108
crc(int fd, u_int32_t *cval, u_int32_t *clen)
usr.sbin/mtree/crc.c
121
while ((nr = read(fd, buf, sizeof(buf))) > 0)
usr.sbin/mtree/create.c
197
int fd, e;
usr.sbin/mtree/create.c
199
if ((fd = open(fname, O_RDONLY)) == -1)
usr.sbin/mtree/create.c
202
e = crc(fd, &val, &len);
usr.sbin/mtree/create.c
203
close(fd);
usr.sbin/mtree/hash.c
112
bytes = read(fd, buffer, sizeof(buffer));
usr.sbin/mtree/hash.c
114
bytes = read(fd, buffer, size);
usr.sbin/mtree/hash.c
135
close(fd);
usr.sbin/mtree/hash.c
64
int fd, bytes, i, digest_len;
usr.sbin/mtree/hash.c
87
fd = open(filename, O_RDONLY);
usr.sbin/mtree/hash.c
88
if (fd < 0)
usr.sbin/mtree/hash.c
90
if (fstat(fd, &st) < 0) {
usr.sbin/newsyslog/newsyslog.c
1478
validate_old_timelog(int fd, const struct dirent *dp, const char *logfname,
usr.sbin/newsyslog/newsyslog.c
1495
fstatat(fd, dp->d_name, &sb, AT_SYMLINK_NOFOLLOW) != 0 ||
usr.sbin/newsyslog/newsyslog.c
2613
int fd, failed;
usr.sbin/newsyslog/newsyslog.c
2617
fd = -1;
usr.sbin/newsyslog/newsyslog.c
2652
fd = mkstemp(tempfile);
usr.sbin/newsyslog/newsyslog.c
2653
if (fd < 0)
usr.sbin/newsyslog/newsyslog.c
2671
failed = fchown(fd, ent->uid, ent->gid);
usr.sbin/newsyslog/newsyslog.c
2682
failed = fchflags(fd, UF_NODUMP);
usr.sbin/newsyslog/newsyslog.c
2703
failed = fchmod(fd, ent->permissions);
usr.sbin/newsyslog/newsyslog.c
2711
if (fd >= 0)
usr.sbin/newsyslog/newsyslog.c
2712
close(fd);
usr.sbin/nscd/nscd.c
231
int fd;
usr.sbin/nscd/nscd.c
238
fd = accept(event_data->ident, NULL, NULL);
usr.sbin/nscd/nscd.c
239
if (fd == -1) {
usr.sbin/nscd/nscd.c
246
if (getpeereid(fd, &euid, &egid) != 0) {
usr.sbin/nscd/nscd.c
253
qstate = init_query_state(fd, sizeof(int), euid, egid);
usr.sbin/nscd/nscd.c
261
EV_SET(&eventlist[0], fd, EVFILT_TIMER, EV_ADD | EV_ONESHOT,
usr.sbin/nscd/nscd.c
263
EV_SET(&eventlist[1], fd, EVFILT_READ, EV_ADD | EV_ONESHOT,
usr.sbin/pciconf/cap.c
119
cap_vpd(int fd __unused, struct pci_conf *p __unused, uint8_t ptr __unused)
usr.sbin/pciconf/cap.c
126
cap_msi(int fd, struct pci_conf *p, uint8_t ptr)
usr.sbin/pciconf/cap.c
131
ctrl = read_config(fd, &p->pc_sel, ptr + PCIR_MSI_CTRL, 2);
usr.sbin/pciconf/cap.c
145
cap_pcix(int fd, struct pci_conf *p, uint8_t ptr)
usr.sbin/pciconf/cap.c
150
status = read_config(fd, &p->pc_sel, ptr + PCIXR_STATUS, 4);
usr.sbin/pciconf/cap.c
219
cap_ht(int fd, struct pci_conf *p, uint8_t ptr)
usr.sbin/pciconf/cap.c
224
command = read_config(fd, &p->pc_sel, ptr + PCIR_HT_COMMAND, 2);
usr.sbin/pciconf/cap.c
258
reg = read_config(fd, &p->pc_sel,
usr.sbin/pciconf/cap.c
262
reg = read_config(fd, &p->pc_sel,
usr.sbin/pciconf/cap.c
286
cap_vendor(int fd, struct pci_conf *p, uint8_t ptr)
usr.sbin/pciconf/cap.c
290
length = read_config(fd, &p->pc_sel, ptr + PCIR_VENDOR_LENGTH, 1);
usr.sbin/pciconf/cap.c
296
version = read_config(fd, &p->pc_sel, ptr + PCIR_VENDOR_DATA,
usr.sbin/pciconf/cap.c
305
fvec = read_config(fd, &p->pc_sel, ptr +
usr.sbin/pciconf/cap.c
312
fvec = read_config(fd, &p->pc_sel, ptr +
usr.sbin/pciconf/cap.c
346
cap_debug(int fd, struct pci_conf *p, uint8_t ptr)
usr.sbin/pciconf/cap.c
350
debug_port = read_config(fd, &p->pc_sel, ptr + PCIR_DEBUG_PORT, 2);
usr.sbin/pciconf/cap.c
356
cap_subvendor(int fd, struct pci_conf *p, uint8_t ptr)
usr.sbin/pciconf/cap.c
360
id = read_config(fd, &p->pc_sel, ptr + PCIR_SUBVENDCAP_ID, 4);
usr.sbin/pciconf/cap.c
367
cap_express(int fd, struct pci_conf *p, uint8_t ptr)
usr.sbin/pciconf/cap.c
373
flags = read_config(fd, &p->pc_sel, ptr + PCIER_CAPABILITY, 2);
usr.sbin/pciconf/cap.c
410
cap = read_config(fd, &p->pc_sel, ptr + PCIER_DEVCAP, 4);
usr.sbin/pciconf/cap.c
411
ctl = read_config(fd, &p->pc_sel, ptr + PCIER_DEVCTRL, 2);
usr.sbin/pciconf/cap.c
430
cap = read_config(fd, &p->pc_sel, ptr + PCIER_DEVCAP2, 4);
usr.sbin/pciconf/cap.c
432
ctl = read_config(fd, &p->pc_sel,
usr.sbin/pciconf/cap.c
446
cap = read_config(fd, &p->pc_sel, ptr + PCIER_LINKCAP, 4);
usr.sbin/pciconf/cap.c
447
sta = read_config(fd, &p->pc_sel, ptr+ PCIER_LINKSTAT, 2);
usr.sbin/pciconf/cap.c
453
ctl = read_config(fd, &p->pc_sel, ptr + PCIER_LINKCTRL, 2);
usr.sbin/pciconf/cap.c
459
cap = read_config(fd, &p->pc_sel, ptr + PCIER_SLOTCAP, 4);
usr.sbin/pciconf/cap.c
46
static void list_ecaps(int fd, struct pci_conf *p);
usr.sbin/pciconf/cap.c
460
sta = read_config(fd, &p->pc_sel, ptr + PCIER_SLOTSTA, 2);
usr.sbin/pciconf/cap.c
461
ctl = read_config(fd, &p->pc_sel, ptr + PCIER_SLOTCTL, 2);
usr.sbin/pciconf/cap.c
485
cap_msix(int fd, struct pci_conf *p, uint8_t ptr)
usr.sbin/pciconf/cap.c
491
ctrl = read_config(fd, &p->pc_sel, ptr + PCIR_MSIX_CTRL, 2);
usr.sbin/pciconf/cap.c
493
val = read_config(fd, &p->pc_sel, ptr + PCIR_MSIX_TABLE, 4);
usr.sbin/pciconf/cap.c
495
val = read_config(fd, &p->pc_sel, ptr + PCIR_MSIX_PBA, 4);
usr.sbin/pciconf/cap.c
508
cap_sata(__unused int fd, __unused struct pci_conf *p, __unused uint8_t ptr)
usr.sbin/pciconf/cap.c
51
cap_power(int fd, struct pci_conf *p, uint8_t ptr)
usr.sbin/pciconf/cap.c
515
cap_pciaf(int fd, struct pci_conf *p, uint8_t ptr)
usr.sbin/pciconf/cap.c
519
cap = read_config(fd, &p->pc_sel, ptr + PCIR_PCIAF_CAP, 1);
usr.sbin/pciconf/cap.c
526
list_caps(int fd, struct pci_conf *p)
usr.sbin/pciconf/cap.c
533
sta = read_config(fd, &p->pc_sel, PCIR_STATUS, 2);
usr.sbin/pciconf/cap.c
55
cap = read_config(fd, &p->pc_sel, ptr + PCIR_POWER_CAP, 2);
usr.sbin/pciconf/cap.c
551
ptr = read_config(fd, &p->pc_sel, ptr, 1);
usr.sbin/pciconf/cap.c
553
cap = read_config(fd, &p->pc_sel, ptr + PCICAP_ID, 1);
usr.sbin/pciconf/cap.c
557
cap_power(fd, p, ptr);
usr.sbin/pciconf/cap.c
56
status = read_config(fd, &p->pc_sel, ptr + PCIR_POWER_STATUS, 2);
usr.sbin/pciconf/cap.c
560
cap_agp(fd, p, ptr);
usr.sbin/pciconf/cap.c
563
cap_vpd(fd, p, ptr);
usr.sbin/pciconf/cap.c
566
cap_msi(fd, p, ptr);
usr.sbin/pciconf/cap.c
569
cap_pcix(fd, p, ptr);
usr.sbin/pciconf/cap.c
572
cap_ht(fd, p, ptr);
usr.sbin/pciconf/cap.c
575
cap_vendor(fd, p, ptr);
usr.sbin/pciconf/cap.c
578
cap_debug(fd, p, ptr);
usr.sbin/pciconf/cap.c
581
cap_subvendor(fd, p, ptr);
usr.sbin/pciconf/cap.c
585
cap_express(fd, p, ptr);
usr.sbin/pciconf/cap.c
588
cap_msix(fd, p, ptr);
usr.sbin/pciconf/cap.c
591
cap_sata(fd, p, ptr);
usr.sbin/pciconf/cap.c
594
cap_pciaf(fd, p, ptr);
usr.sbin/pciconf/cap.c
601
ptr = read_config(fd, &p->pc_sel, ptr + PCICAP_NEXTPTR, 1);
usr.sbin/pciconf/cap.c
605
list_ecaps(fd, p);
usr.sbin/pciconf/cap.c
622
ecap_aer(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver)
usr.sbin/pciconf/cap.c
629
sta = read_config(fd, &p->pc_sel, ptr + PCIR_AER_UC_STATUS, 4);
usr.sbin/pciconf/cap.c
630
mask = read_config(fd, &p->pc_sel, ptr + PCIR_AER_UC_SEVERITY, 4);
usr.sbin/pciconf/cap.c
633
sta = read_config(fd, &p->pc_sel, ptr + PCIR_AER_COR_STATUS, 4);
usr.sbin/pciconf/cap.c
638
ecap_vc(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver)
usr.sbin/pciconf/cap.c
645
cap1 = read_config(fd, &p->pc_sel, ptr + PCIR_VC_CAP1, 4);
usr.sbin/pciconf/cap.c
65
cap_agp(int fd, struct pci_conf *p, uint8_t ptr)
usr.sbin/pciconf/cap.c
653
ecap_sernum(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver)
usr.sbin/pciconf/cap.c
660
low = read_config(fd, &p->pc_sel, ptr + PCIR_SERIAL_LOW, 4);
usr.sbin/pciconf/cap.c
661
high = read_config(fd, &p->pc_sel, ptr + PCIR_SERIAL_HIGH, 4);
usr.sbin/pciconf/cap.c
666
list_ecaps(int fd, struct pci_conf *p)
usr.sbin/pciconf/cap.c
672
ecap = read_config(fd, &p->pc_sel, ptr, 4);
usr.sbin/pciconf/cap.c
679
ecap_aer(fd, p, ptr, PCI_EXTCAP_VER(ecap));
usr.sbin/pciconf/cap.c
682
ecap_vc(fd, p, ptr, PCI_EXTCAP_VER(ecap));
usr.sbin/pciconf/cap.c
685
ecap_sernum(fd, p, ptr, PCI_EXTCAP_VER(ecap));
usr.sbin/pciconf/cap.c
69
status = read_config(fd, &p->pc_sel, ptr + AGP_STATUS, 4);
usr.sbin/pciconf/cap.c
695
ecap = read_config(fd, &p->pc_sel, ptr, 4);
usr.sbin/pciconf/cap.c
70
command = read_config(fd, &p->pc_sel, ptr + AGP_CAPID, 4);
usr.sbin/pciconf/cap.c
738
pci_find_cap(int fd, struct pci_conf *p, uint8_t id)
usr.sbin/pciconf/cap.c
744
sta = read_config(fd, &p->pc_sel, PCIR_STATUS, 2);
usr.sbin/pciconf/cap.c
760
ptr = read_config(fd, &p->pc_sel, ptr, 1);
usr.sbin/pciconf/cap.c
762
cap = read_config(fd, &p->pc_sel, ptr + PCICAP_ID, 1);
usr.sbin/pciconf/cap.c
765
ptr = read_config(fd, &p->pc_sel, ptr + PCICAP_NEXTPTR, 1);
usr.sbin/pciconf/cap.c
772
pcie_find_cap(int fd, struct pci_conf *p, uint16_t id)
usr.sbin/pciconf/cap.c
778
ecap = read_config(fd, &p->pc_sel, ptr, 4);
usr.sbin/pciconf/cap.c
787
ecap = read_config(fd, &p->pc_sel, ptr, 4);
usr.sbin/pciconf/err.c
137
list_errors(int fd, struct pci_conf *p)
usr.sbin/pciconf/err.c
144
sta = read_config(fd, &p->pc_sel, PCIR_STATUS, 2);
usr.sbin/pciconf/err.c
148
pcie = pci_find_cap(fd, p, PCIY_EXPRESS);
usr.sbin/pciconf/err.c
153
sta = read_config(fd, &p->pc_sel, pcie + PCIER_DEVSTS, 2);
usr.sbin/pciconf/err.c
157
aer = pcie_find_cap(fd, p, PCIZ_AER);
usr.sbin/pciconf/err.c
162
mask = read_config(fd, &p->pc_sel, aer + PCIR_AER_UC_STATUS, 4);
usr.sbin/pciconf/err.c
163
severity = read_config(fd, &p->pc_sel, aer + PCIR_AER_UC_SEVERITY, 4);
usr.sbin/pciconf/err.c
168
mask = read_config(fd, &p->pc_sel, aer + PCIR_AER_COR_STATUS, 4);
usr.sbin/pciconf/pciconf.c
177
int fd;
usr.sbin/pciconf/pciconf.c
185
fd = open(_PATH_DEVPCI, (bridge || caps || errors) ?
usr.sbin/pciconf/pciconf.c
187
if (fd < 0)
usr.sbin/pciconf/pciconf.c
195
if (ioctl(fd, PCIOCGETCONF, &pc) == -1)
usr.sbin/pciconf/pciconf.c
209
close(fd);
usr.sbin/pciconf/pciconf.c
214
close(fd);
usr.sbin/pciconf/pciconf.c
233
list_bars(fd, p);
usr.sbin/pciconf/pciconf.c
235
list_bridge(fd, p);
usr.sbin/pciconf/pciconf.c
237
list_caps(fd, p);
usr.sbin/pciconf/pciconf.c
239
list_errors(fd, p);
usr.sbin/pciconf/pciconf.c
243
close(fd);
usr.sbin/pciconf/pciconf.c
247
print_bus_range(int fd, struct pci_conf *p, int secreg, int subreg)
usr.sbin/pciconf/pciconf.c
251
secbus = read_config(fd, &p->pc_sel, secreg, 1);
usr.sbin/pciconf/pciconf.c
252
subbus = read_config(fd, &p->pc_sel, subreg, 1);
usr.sbin/pciconf/pciconf.c
289
print_bridge_windows(int fd, struct pci_conf *p)
usr.sbin/pciconf/pciconf.c
303
val = read_config(fd, &p->pc_sel, PCIR_IOBASEL_1, 1);
usr.sbin/pciconf/pciconf.c
304
if (val != 0 || read_config(fd, &p->pc_sel, PCIR_IOLIMITL_1, 1) != 0) {
usr.sbin/pciconf/pciconf.c
307
read_config(fd, &p->pc_sel, PCIR_IOBASEH_1, 2),
usr.sbin/pciconf/pciconf.c
310
read_config(fd, &p->pc_sel, PCIR_IOLIMITH_1, 2),
usr.sbin/pciconf/pciconf.c
311
read_config(fd, &p->pc_sel, PCIR_IOLIMITL_1, 1));
usr.sbin/pciconf/pciconf.c
316
read_config(fd, &p->pc_sel, PCIR_IOLIMITL_1, 1));
usr.sbin/pciconf/pciconf.c
323
read_config(fd, &p->pc_sel, PCIR_MEMBASE_1, 2));
usr.sbin/pciconf/pciconf.c
325
read_config(fd, &p->pc_sel, PCIR_MEMLIMIT_1, 2));
usr.sbin/pciconf/pciconf.c
328
val = read_config(fd, &p->pc_sel, PCIR_PMBASEL_1, 2);
usr.sbin/pciconf/pciconf.c
329
if (val != 0 || read_config(fd, &p->pc_sel, PCIR_PMLIMITL_1, 2) != 0) {
usr.sbin/pciconf/pciconf.c
332
read_config(fd, &p->pc_sel, PCIR_PMBASEH_1, 4),
usr.sbin/pciconf/pciconf.c
335
read_config(fd, &p->pc_sel, PCIR_PMLIMITH_1, 4),
usr.sbin/pciconf/pciconf.c
336
read_config(fd, &p->pc_sel, PCIR_PMLIMITL_1, 2));
usr.sbin/pciconf/pciconf.c
341
read_config(fd, &p->pc_sel, PCIR_PMLIMITL_1, 2));
usr.sbin/pciconf/pciconf.c
362
bctl = read_config(fd, &p->pc_sel, PCIR_BRIDGECTL_1, 2);
usr.sbin/pciconf/pciconf.c
368
print_cardbus_mem_window(int fd, struct pci_conf *p, int basereg, int limitreg,
usr.sbin/pciconf/pciconf.c
373
PCI_CBBMEMBASE(read_config(fd, &p->pc_sel, basereg, 4)),
usr.sbin/pciconf/pciconf.c
374
PCI_CBBMEMLIMIT(read_config(fd, &p->pc_sel, limitreg, 4)));
usr.sbin/pciconf/pciconf.c
378
print_cardbus_io_window(int fd, struct pci_conf *p, int basereg, int limitreg)
usr.sbin/pciconf/pciconf.c
384
val = read_config(fd, &p->pc_sel, basereg, 2);
usr.sbin/pciconf/pciconf.c
386
base = PCI_CBBIOBASE(read_config(fd, &p->pc_sel, basereg, 4));
usr.sbin/pciconf/pciconf.c
387
limit = PCI_CBBIOBASE(read_config(fd, &p->pc_sel, limitreg, 4));
usr.sbin/pciconf/pciconf.c
391
limit = PCI_CBBIOBASE(read_config(fd, &p->pc_sel, limitreg, 2));
usr.sbin/pciconf/pciconf.c
398
print_cardbus_windows(int fd, struct pci_conf *p)
usr.sbin/pciconf/pciconf.c
402
bctl = read_config(fd, &p->pc_sel, PCIR_BRIDGECTL_2, 2);
usr.sbin/pciconf/pciconf.c
403
print_cardbus_mem_window(fd, p, PCIR_MEMBASE0_2, PCIR_MEMLIMIT0_2,
usr.sbin/pciconf/pciconf.c
405
print_cardbus_mem_window(fd, p, PCIR_MEMBASE1_2, PCIR_MEMLIMIT1_2,
usr.sbin/pciconf/pciconf.c
407
print_cardbus_io_window(fd, p, PCIR_IOBASE0_2, PCIR_IOLIMIT0_2);
usr.sbin/pciconf/pciconf.c
408
print_cardbus_io_window(fd, p, PCIR_IOBASE1_2, PCIR_IOLIMIT1_2);
usr.sbin/pciconf/pciconf.c
414
list_bridge(int fd, struct pci_conf *p)
usr.sbin/pciconf/pciconf.c
419
print_bus_range(fd, p, PCIR_SECBUS_1, PCIR_SUBBUS_1);
usr.sbin/pciconf/pciconf.c
420
print_bridge_windows(fd, p);
usr.sbin/pciconf/pciconf.c
423
print_bus_range(fd, p, PCIR_SECBUS_2, PCIR_SUBBUS_2);
usr.sbin/pciconf/pciconf.c
424
print_cardbus_windows(fd, p);
usr.sbin/pciconf/pciconf.c
430
list_bars(int fd, struct pci_conf *p)
usr.sbin/pciconf/pciconf.c
454
if (ioctl(fd, PCIOCGETBAR, &bar) < 0)
usr.sbin/pciconf/pciconf.c
66
static void list_bars(int fd, struct pci_conf *p);
usr.sbin/pciconf/pciconf.c
67
static void list_bridge(int fd, struct pci_conf *p);
usr.sbin/pciconf/pciconf.c
733
read_config(int fd, struct pcisel *sel, long reg, int width)
usr.sbin/pciconf/pciconf.c
741
if (ioctl(fd, PCIOCREAD, &pi) < 0)
usr.sbin/pciconf/pciconf.c
787
readone(int fd, struct pcisel *sel, long reg, int width)
usr.sbin/pciconf/pciconf.c
790
printf("%0*x", width*2, read_config(fd, sel, reg, width));
usr.sbin/pciconf/pciconf.c
801
int fd;
usr.sbin/pciconf/pciconf.c
804
fd = open(_PATH_DEVPCI, O_RDWR, 0);
usr.sbin/pciconf/pciconf.c
805
if (fd < 0)
usr.sbin/pciconf/pciconf.c
815
readone(fd, &sel, r, width);
usr.sbin/pciconf/pciconf.c
822
close(fd);
usr.sbin/pciconf/pciconf.c
828
int fd;
usr.sbin/pciconf/pciconf.c
836
fd = open(_PATH_DEVPCI, O_RDWR, 0);
usr.sbin/pciconf/pciconf.c
837
if (fd < 0)
usr.sbin/pciconf/pciconf.c
840
if (ioctl(fd, PCIOCWRITE, &pi) < 0)
usr.sbin/pciconf/pciconf.c
847
int fd;
usr.sbin/pciconf/pciconf.c
852
fd = open(_PATH_DEVPCI, O_RDWR, 0);
usr.sbin/pciconf/pciconf.c
853
if (fd < 0)
usr.sbin/pciconf/pciconf.c
856
if (ioctl(fd, PCIOCATTACHED, &pi) < 0)
usr.sbin/pciconf/pciconf.h
36
void list_caps(int fd, struct pci_conf *p);
usr.sbin/pciconf/pciconf.h
37
void list_errors(int fd, struct pci_conf *p);
usr.sbin/pciconf/pciconf.h
38
uint32_t read_config(int fd, struct pcisel *sel, long reg, int width);
usr.sbin/pciconf/pciconf.h
39
uint8_t pci_find_cap(int fd, struct pci_conf *p, uint8_t id);
usr.sbin/pciconf/pciconf.h
40
uint16_t pcie_find_cap(int fd, struct pci_conf *p, uint16_t id);
usr.sbin/pfctl/parse.y
5695
check_file_secrecy(int fd, const char *fname)
usr.sbin/pfctl/parse.y
5699
if (fstat(fd, &st)) {
usr.sbin/pflogd/pflogd.c
298
int fd;
usr.sbin/pflogd/pflogd.c
314
fd = priv_open_log();
usr.sbin/pflogd/pflogd.c
315
if (fd < 0)
usr.sbin/pflogd/pflogd.c
318
fp = fdopen(fd, "a+");
usr.sbin/pflogd/pflogd.c
322
close(fd);
usr.sbin/pflogd/pflogd.h
41
pcap_t *pcap_open_live_fd(int fd, int snaplen, char *ebuf);
usr.sbin/pflogd/privsep.c
144
fd = open(filename,
usr.sbin/pflogd/privsep.c
148
send_fd(socks[0], fd);
usr.sbin/pflogd/privsep.c
149
if (fd < 0)
usr.sbin/pflogd/privsep.c
154
close(fd);
usr.sbin/pflogd/privsep.c
194
int fd;
usr.sbin/pflogd/privsep.c
204
fd = open(ren, O_CREAT|O_EXCL, 0);
usr.sbin/pflogd/privsep.c
205
if (fd >= 0) {
usr.sbin/pflogd/privsep.c
206
close(fd);
usr.sbin/pflogd/privsep.c
258
int cmd, fd;
usr.sbin/pflogd/privsep.c
265
fd = receive_fd(priv_fd);
usr.sbin/pflogd/privsep.c
267
return (fd);
usr.sbin/pflogd/privsep.c
305
may_read(int fd, void *buf, size_t n)
usr.sbin/pflogd/privsep.c
312
res = read(fd, s + pos, n - pos);
usr.sbin/pflogd/privsep.c
330
must_read(int fd, void *buf, size_t n)
usr.sbin/pflogd/privsep.c
337
res = read(fd, s + pos, n - pos);
usr.sbin/pflogd/privsep.c
354
must_write(int fd, void *buf, size_t n)
usr.sbin/pflogd/privsep.c
361
res = write(fd, s + pos, n - pos);
usr.sbin/pflogd/privsep.c
68
int i, fd, socks[2], cmd;
usr.sbin/pflogd/privsep_fdpass.c
118
fd = (*(int *)CMSG_DATA(cmsg));
usr.sbin/pflogd/privsep_fdpass.c
119
return fd;
usr.sbin/pflogd/privsep_fdpass.c
50
send_fd(int sock, int fd)
usr.sbin/pflogd/privsep_fdpass.c
61
if (fd >= 0) {
usr.sbin/pflogd/privsep_fdpass.c
68
*(int *)CMSG_DATA(cmsg) = fd;
usr.sbin/pflogd/privsep_fdpass.c
94
int fd;
usr.sbin/powerd/powerd.c
746
int fd;
usr.sbin/powerd/powerd.c
755
fd = open("/dev/dsp", O_WRONLY);
usr.sbin/powerd/powerd.c
756
if (fd < 0)
usr.sbin/powerd/powerd.c
760
if (ioctl(fd, SNDCTL_DSP_SETFMT, &fmt, sizeof(fmt)) < 0)
usr.sbin/powerd/powerd.c
764
if (ioctl(fd, SNDCTL_DSP_STEREO, &stereo, sizeof(stereo)) < 0)
usr.sbin/powerd/powerd.c
768
if (ioctl(fd, SNDCTL_DSP_SPEED, &freq, sizeof(freq)) < 0)
usr.sbin/powerd/powerd.c
771
write(fd, alert1, sizeof(alert1));
usr.sbin/powerd/powerd.c
772
write(fd, alert1, sizeof(alert1));
usr.sbin/powerd/powerd.c
775
close(fd);
usr.sbin/ppp/bundle.c
1086
prompt_Printf(arg->prompt, "%s\n", server.fd == -1 ? " (not open)" : "");
usr.sbin/ppp/bundle.c
1089
server.fd == -1 ? " (not open)" : "");
usr.sbin/ppp/bundle.c
1372
int niov, expect, f, *fd, nfd, onfd;
usr.sbin/ppp/bundle.c
1440
fd = (int *)CMSG_DATA(cmsg);
usr.sbin/ppp/bundle.c
1441
nfd = ((caddr_t)cmsg + cmsg->cmsg_len - (caddr_t)fd) / sizeof(int);
usr.sbin/ppp/bundle.c
1447
close(fd[nfd]);
usr.sbin/ppp/bundle.c
1463
close(fd[nfd]);
usr.sbin/ppp/bundle.c
1475
if ((got = write(fd[1], &pid, sizeof pid)) != sizeof pid) {
usr.sbin/ppp/bundle.c
1482
close(fd[nfd]);
usr.sbin/ppp/bundle.c
1488
if ((got = readv(fd[1], iov + 1, niov - 1)) != expect) {
usr.sbin/ppp/bundle.c
1494
close(fd[nfd]);
usr.sbin/ppp/bundle.c
1499
close(fd[1]);
usr.sbin/ppp/bundle.c
1504
dl = iov2datalink(bundle, iov, &niov, NELEM(iov), fd[0],
usr.sbin/ppp/bundle.c
1505
fd + 2, &nfd);
usr.sbin/ppp/bundle.c
1513
close(fd[onfd--]);
usr.sbin/ppp/bundle.c
1514
close(fd[0]);
usr.sbin/ppp/bundle.c
1522
close(fd[onfd--]);
usr.sbin/ppp/bundle.c
1523
close(fd[0]);
usr.sbin/ppp/bundle.c
1524
close(fd[1]);
usr.sbin/ppp/bundle.c
1539
int niov, f, expect, newsid, fd[SEND_MAXFD], nfd, reply[2];
usr.sbin/ppp/bundle.c
1562
fd[0] = datalink2iov(dl, iov, &niov, SCATTER_SEGMENTS, fd + 2, &nfd);
usr.sbin/ppp/bundle.c
1564
if (fd[0] != -1 && socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, reply) != -1) {
usr.sbin/ppp/bundle.c
1569
fd[1] = reply[1];
usr.sbin/ppp/bundle.c
1593
*((int *)CMSG_DATA(cmsg) + f) = fd[f];
usr.sbin/ppp/bundle.c
1646
tcgetpgrp(fd[0]) == getpgrp();
usr.sbin/ppp/bundle.c
1648
close(fd[--nfd]);
usr.sbin/ppp/bundle.c
176
if (bundle->notify.fd != -1) {
usr.sbin/ppp/bundle.c
1787
int fd, status;
usr.sbin/ppp/bundle.c
179
ret = write(bundle->notify.fd, &c, 1);
usr.sbin/ppp/bundle.c
1796
for (fd = getdtablesize(); fd >= 0; fd--)
usr.sbin/ppp/bundle.c
1797
close(fd);
usr.sbin/ppp/bundle.c
1837
bundle_Exception(struct bundle *bundle, int fd)
usr.sbin/ppp/bundle.c
1842
if (dl->physical->fd == fd) {
usr.sbin/ppp/bundle.c
186
close(bundle->notify.fd);
usr.sbin/ppp/bundle.c
187
bundle->notify.fd = -1;
usr.sbin/ppp/bundle.c
1999
ioctl(bundle->dev.fd, TUNSIFPID, 0);
usr.sbin/ppp/bundle.c
477
FD_SET(bundle->dev.fd, r);
usr.sbin/ppp/bundle.c
478
if (*n < bundle->dev.fd + 1)
usr.sbin/ppp/bundle.c
479
*n = bundle->dev.fd + 1;
usr.sbin/ppp/bundle.c
480
log_Printf(LogTIMER, "%s: fdset(r) %d\n", TUN_NAME, bundle->dev.fd);
usr.sbin/ppp/bundle.c
528
return FD_ISSET(bundle->dev.fd, fdset);
usr.sbin/ppp/bundle.c
551
if (FD_ISSET(bundle->dev.fd, fdset)) {
usr.sbin/ppp/bundle.c
567
n = read(bundle->dev.fd, data, sz);
usr.sbin/ppp/bundle.c
599
write(bundle->dev.fd, data, n);
usr.sbin/ppp/bundle.c
727
bundle.dev.fd = ID0open(bundle.dev.Name, O_RDWR);
usr.sbin/ppp/bundle.c
728
if (bundle.dev.fd >= 0)
usr.sbin/ppp/bundle.c
750
if (bundle.dev.fd < 0) {
usr.sbin/ppp/bundle.c
769
close(bundle.dev.fd);
usr.sbin/ppp/bundle.c
776
if (ID0ioctl(bundle.dev.fd, TUNSIFMODE, &iff) < 0)
usr.sbin/ppp/bundle.c
784
if (ID0ioctl(bundle.dev.fd, TUNSLMODE, &iff) < 0)
usr.sbin/ppp/bundle.c
792
if (ID0ioctl(bundle.dev.fd, TUNSIFHEAD, &iff) < 0) {
usr.sbin/ppp/bundle.c
849
close(bundle.dev.fd);
usr.sbin/ppp/bundle.c
881
bundle.notify.fd = -1;
usr.sbin/ppp/bundle.c
930
close(bundle->dev.fd);
usr.sbin/ppp/bundle.h
139
int fd; /* write status here */
usr.sbin/ppp/bundle.h
76
int fd; /* The /dev/XXXX descriptor */
usr.sbin/ppp/chap.c
259
int argc, fd;
usr.sbin/ppp/chap.c
263
if (chap->child.fd != -1) {
usr.sbin/ppp/chap.c
314
for (fd = getdtablesize(); fd > STDERR_FILENO; fd--)
usr.sbin/ppp/chap.c
315
fcntl(fd, F_SETFD, 1);
usr.sbin/ppp/chap.c
328
chap->child.fd = out[0];
usr.sbin/ppp/chap.c
347
close(chap->child.fd);
usr.sbin/ppp/chap.c
348
chap->child.fd = -1;
usr.sbin/ppp/chap.c
401
if (r && chap && chap->child.fd != -1) {
usr.sbin/ppp/chap.c
402
FD_SET(chap->child.fd, r);
usr.sbin/ppp/chap.c
403
if (*n < chap->child.fd + 1)
usr.sbin/ppp/chap.c
404
*n = chap->child.fd + 1;
usr.sbin/ppp/chap.c
405
log_Printf(LogTIMER, "Chap: fdset(r) %d\n", chap->child.fd);
usr.sbin/ppp/chap.c
417
return chap && chap->child.fd != -1 && FD_ISSET(chap->child.fd, fdset);
usr.sbin/ppp/chap.c
427
got = read(chap->child.fd, chap->child.buf.ptr + chap->child.buf.len,
usr.sbin/ppp/chap.c
672
chap->child.fd = -1;
usr.sbin/ppp/chap.h
43
int fd;
usr.sbin/ppp/chat.c
737
dup2(physical->fd, STDIN_FILENO);
usr.sbin/ppp/command.c
626
int i, fd;
usr.sbin/ppp/command.c
634
fd = arg->prompt->fd_out;
usr.sbin/ppp/command.c
635
else if ((fd = open(_PATH_DEVNULL, O_RDWR)) == -1) {
usr.sbin/ppp/command.c
640
dup2(fd, STDIN_FILENO);
usr.sbin/ppp/command.c
641
dup2(fd, STDOUT_FILENO);
usr.sbin/ppp/command.c
642
dup2(fd, STDERR_FILENO);
usr.sbin/ppp/datalink.c
117
dl->physical->fd != -1) {
usr.sbin/ppp/datalink.c
1291
int fd, int *auxfd, int *nauxfd)
usr.sbin/ppp/datalink.c
1352
dl->physical = iov2physical(dl, iov, niov, maxiov, fd, auxfd, nauxfd);
usr.sbin/ppp/defs.c
77
fullread(int fd, void *v, size_t n)
usr.sbin/ppp/defs.c
82
switch ((got = read(fd, (char *)v + total, n - total))) {
usr.sbin/ppp/ether.c
132
return NgSendData(p->fd, dev->hook, v, n) == -1 ? -1 : (ssize_t)n;
usr.sbin/ppp/ether.c
140
return NgRecvData(p->fd, v, n, hook);
usr.sbin/ppp/ether.c
439
close(p->fd);
usr.sbin/ppp/ether.c
440
p->fd = -2; /* Nobody else need try.. */
usr.sbin/ppp/ether.c
461
if (p->fd < 0 && !strncasecmp(p->name.full, NG_PPPOE_NODE_TYPE,
usr.sbin/ppp/ether.c
473
p->fd--; /* We own the device - change fd */
usr.sbin/ppp/ether.c
516
if (ID0NgMkSockNode(NULL, &dev->cs, &p->fd) == -1) {
usr.sbin/ppp/ether.c
520
p->fd = -2;
usr.sbin/ppp/ether.c
677
if (fstat(p->fd, &st) != -1 && (st.st_mode & S_IFSOCK)) {
usr.sbin/ppp/ether.c
683
if (getsockname(p->fd, sock, &sz) == -1) {
usr.sbin/ppp/ether.c
685
close(p->fd);
usr.sbin/ppp/ether.c
686
p->fd = -1;
usr.sbin/ppp/exec.c
107
if (p->fd < 0 && *p->name.full == '!') {
usr.sbin/ppp/exec.c
110
p->fd--; /* We own the device but maybe can't use it - change fd */
usr.sbin/ppp/exec.c
223
p->fd = fids[0];
usr.sbin/ppp/exec.c
224
log_Printf(LogDEBUG, "Using descriptor %d for child\n", p->fd);
usr.sbin/ppp/id.c
156
ID0write(int fd, const void *data, size_t len)
usr.sbin/ppp/id.c
161
ret = write(fd, data, len);
usr.sbin/ppp/id.c
162
log_Printf(LogID0, "%d = write(%d, data, %ld)\n", ret, fd, (long)len);
usr.sbin/ppp/id.c
93
ID0ioctl(int fd, unsigned long req, void *arg)
usr.sbin/ppp/id.c
98
ret = ioctl(fd, req, arg);
usr.sbin/ppp/id.c
99
log_Printf(LogID0, "%d = ioctl(%d, %lu, %p)\n", ret, fd, req, arg);
usr.sbin/ppp/ip.c
916
nw = write(bundle->dev.fd, data, nb);
usr.sbin/ppp/ipcp.c
175
int fd;
usr.sbin/ppp/ipcp.c
189
if ((fd = open(_PATH_RESCONF, O_RDONLY)) != -1) {
usr.sbin/ppp/ipcp.c
192
if (fstat(fd, &st) == 0) {
usr.sbin/ppp/ipcp.c
203
} else if ((got = read(fd, ipcp->ns.resolv, st.st_size)) != st.st_size) {
usr.sbin/ppp/ipcp.c
269
close(fd);
usr.sbin/ppp/ipcp.c
323
int fd;
usr.sbin/ppp/ipcp.c
325
if ((fd = ID0open(_PATH_RESCONF, O_WRONLY|O_TRUNC, 0644)) != -1) {
usr.sbin/ppp/ipcp.c
327
if ((got = write(fd, ipcp->ns.resolv, len)) != len) {
usr.sbin/ppp/ipcp.c
335
close(fd);
usr.sbin/ppp/libradius/radlib.c
1055
return rad_continue_send_request(h, 0, fd, tv);
usr.sbin/ppp/libradius/radlib.c
1071
h->fd = -1;
usr.sbin/ppp/libradius/radlib.c
1100
rad_server_open(int fd)
usr.sbin/ppp/libradius/radlib.c
1107
h->fd = fd;
usr.sbin/ppp/libradius/radlib.c
1225
int fd;
usr.sbin/ppp/libradius/radlib.c
1228
n = rad_init_send_request(h, &fd, &tv);
usr.sbin/ppp/libradius/radlib.c
1240
FD_SET(fd, &readfds);
usr.sbin/ppp/libradius/radlib.c
1242
n = select(fd + 1, &readfds, NULL, NULL, &tv);
usr.sbin/ppp/libradius/radlib.c
1249
if (!FD_ISSET(fd, &readfds)) {
usr.sbin/ppp/libradius/radlib.c
1258
n = rad_continue_send_request(h, n, &fd, &tv);
usr.sbin/ppp/libradius/radlib.c
459
if (h->fd != -1)
usr.sbin/ppp/libradius/radlib.c
460
close(h->fd);
usr.sbin/ppp/libradius/radlib.c
670
rad_continue_send_request(struct rad_handle *h, int selected, int *fd,
usr.sbin/ppp/libradius/radlib.c
686
h->in_len = recvfrom(h->fd, h->in,
usr.sbin/ppp/libradius/radlib.c
737
close(h->fd);
usr.sbin/ppp/libradius/radlib.c
738
if ((h->fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
usr.sbin/ppp/libradius/radlib.c
747
if (bind(h->fd, (const struct sockaddr *)&sin,
usr.sbin/ppp/libradius/radlib.c
750
close(h->fd);
usr.sbin/ppp/libradius/radlib.c
751
h->fd = -1;
usr.sbin/ppp/libradius/radlib.c
770
n = sendto(h->fd, h->out, h->out_len, 0,
usr.sbin/ppp/libradius/radlib.c
779
*fd = h->fd;
usr.sbin/ppp/libradius/radlib.c
797
h->in_len = recvfrom(h->fd, h->in,
usr.sbin/ppp/libradius/radlib.c
839
n = sendto(h->fd, h->out, h->out_len, 0,
usr.sbin/ppp/libradius/radlib.c
973
rad_init_send_request(struct rad_handle *h, int *fd, struct timeval *tv)
usr.sbin/ppp/libradius/radlib.c
984
if (h->fd == -1) {
usr.sbin/ppp/libradius/radlib.c
985
if ((h->fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
usr.sbin/ppp/libradius/radlib.c
994
if (bind(h->fd, (const struct sockaddr *)&sin,
usr.sbin/ppp/libradius/radlib.c
997
close(h->fd);
usr.sbin/ppp/libradius/radlib.c
998
h->fd = -1;
usr.sbin/ppp/libradius/radlib.h
230
struct rad_handle *rad_server_open(int fd);
usr.sbin/ppp/libradius/radlib_private.h
79
int fd; /* Socket file descriptor */
usr.sbin/ppp/main.c
496
bundle->notify.fd = bgpipe[1];
usr.sbin/ppp/mp.c
1054
bundle_SendDatalink(s->send.dl, s->fd, &s->socket);
usr.sbin/ppp/mp.c
1056
s->fd = -1;
usr.sbin/ppp/mp.c
1060
} else if (r && s->fd >= 0) {
usr.sbin/ppp/mp.c
1061
if (*n < s->fd + 1)
usr.sbin/ppp/mp.c
1062
*n = s->fd + 1;
usr.sbin/ppp/mp.c
1063
FD_SET(s->fd, r);
usr.sbin/ppp/mp.c
1064
log_Printf(LogTIMER, "mp: fdset(r) %d\n", s->fd);
usr.sbin/ppp/mp.c
1074
return s->fd >= 0 && FD_ISSET(s->fd, fdset);
usr.sbin/ppp/mp.c
1083
bundle_ReceiveDatalink(bundle, s->fd);
usr.sbin/ppp/mp.c
1104
s->fd = -1;
usr.sbin/ppp/mp.c
1114
if (s->fd != -1) {
usr.sbin/ppp/mp.c
1136
s->fd = ID0socket(PF_LOCAL, SOCK_DGRAM, 0);
usr.sbin/ppp/mp.c
1137
if (s->fd < 0) {
usr.sbin/ppp/mp.c
1142
setsockopt(s->fd, SOL_SOCKET, SO_REUSEADDR, (struct sockaddr *)&s->socket,
usr.sbin/ppp/mp.c
1151
if (ID0bind_un(s->fd, &s->socket) < 0) {
usr.sbin/ppp/mp.c
1156
close(s->fd);
usr.sbin/ppp/mp.c
1157
s->fd = -1;
usr.sbin/ppp/mp.c
1163
if (ID0connect_un(s->fd, &s->socket) < 0) {
usr.sbin/ppp/mp.c
1168
close(s->fd);
usr.sbin/ppp/mp.c
1169
s->fd = -1;
usr.sbin/ppp/mp.c
1184
bundle_SendDatalink(s->send.dl, s->fd, &s->socket);
usr.sbin/ppp/mp.c
1186
s->fd = -1;
usr.sbin/ppp/mp.c
1187
} else if (s->fd >= 0) {
usr.sbin/ppp/mp.c
1188
close(s->fd);
usr.sbin/ppp/mp.c
1193
s->fd = -1;
usr.sbin/ppp/mp.h
126
#define mpserver_IsOpen(s) ((s)->fd != -1)
usr.sbin/ppp/mp.h
65
int fd; /* listen()ing or connect()ing here */
usr.sbin/ppp/netgraph.c
237
return NgSendData(p->fd, dev->hook, v, n) == -1 ? -1 : (ssize_t)n;
usr.sbin/ppp/netgraph.c
252
return NgRecvData(p->fd, v, n, hook);
usr.sbin/ppp/netgraph.c
417
close(p->fd);
usr.sbin/ppp/netgraph.c
418
p->fd = -2; /* Nobody else need try.. */
usr.sbin/ppp/netgraph.c
483
if (p->fd < 0 && !strncasecmp(p->name.full, NETGRAPH_PREFIX,
usr.sbin/ppp/netgraph.c
485
p->fd--; /* We own the device - change fd */
usr.sbin/ppp/netgraph.c
493
if (ID0NgMkSockNode(NULL, &dev->cs, &p->fd) == -1) {
usr.sbin/ppp/netgraph.c
497
p->fd = -2;
usr.sbin/ppp/netgraph.c
725
if (getsockname(p->fd, sock, &sz) != -1 && sock->sa_family == AF_NETGRAPH) {
usr.sbin/ppp/physical.c
1000
if (p->fd >= 0) {
usr.sbin/ppp/physical.c
1010
while (devno < p->cfg.ndev && p->fd < 0) {
usr.sbin/ppp/physical.c
1016
p->fd = ID0open(p->name.full, O_RDWR | O_NONBLOCK);
usr.sbin/ppp/physical.c
1017
if (p->fd < 0)
usr.sbin/ppp/physical.c
1021
wasfd = p->fd;
usr.sbin/ppp/physical.c
1023
if ((p->handler = (*devices[h].create)(p)) == NULL && wasfd != p->fd)
usr.sbin/ppp/physical.c
1026
if (p->fd < 0) {
usr.sbin/ppp/physical.c
1045
return p->fd;
usr.sbin/ppp/physical.c
184
p->fd = -1;
usr.sbin/ppp/physical.c
243
if (p->fd >= 0) {
usr.sbin/ppp/physical.c
244
tcgetattr(p->fd, &rstio);
usr.sbin/ppp/physical.c
247
tcsetattr(p->fd, TCSADRAIN, &rstio);
usr.sbin/ppp/physical.c
326
if (p->fd < 0)
usr.sbin/ppp/physical.c
343
newsid = tcgetpgrp(p->fd) == getpgrp();
usr.sbin/ppp/physical.c
344
close(p->fd);
usr.sbin/ppp/physical.c
345
p->fd = -1;
usr.sbin/ppp/physical.c
396
p->link.name, nw, (unsigned long)p->out->m_len, p->fd);
usr.sbin/ppp/physical.c
408
p->fd, strerror(errno));
usr.sbin/ppp/physical.c
428
if (p->fd < 0)
usr.sbin/ppp/physical.c
453
if (p->fd >= 0 && ioctl(p->fd, TIOCOUTQ, &n) >= 0)
usr.sbin/ppp/physical.c
528
p->link.name, n, (int)(sizeof p->input.buf - p->input.sz), p->fd);
usr.sbin/ppp/physical.c
531
log_Printf(LogPHASE, "%s: read (%d): %s\n", p->link.name, p->fd,
usr.sbin/ppp/physical.c
535
p->link.name, p->fd);
usr.sbin/ppp/physical.c
570
int fd, int *auxfd, int *nauxfd)
usr.sbin/ppp/physical.c
614
p->fd = fd;
usr.sbin/ppp/physical.c
683
tcgetpgrp(p->fd) == getpgrp())
usr.sbin/ppp/physical.c
726
return p ? p->fd : 0;
usr.sbin/ppp/physical.c
732
if (p->fd >= 0 && *p->name.full == '/' && p->type != PHYS_DIRECT)
usr.sbin/ppp/physical.c
804
ret = read(p->fd, buf, nbytes);
usr.sbin/ppp/physical.c
819
return write(p->fd, buf, nbytes);
usr.sbin/ppp/physical.c
830
if (p->fd >= 0) {
usr.sbin/ppp/physical.c
832
FD_SET(p->fd, r);
usr.sbin/ppp/physical.c
833
log_Printf(LogTIMER, "%s: fdset(r) %d\n", p->link.name, p->fd);
usr.sbin/ppp/physical.c
837
FD_SET(p->fd, e);
usr.sbin/ppp/physical.c
838
log_Printf(LogTIMER, "%s: fdset(e) %d\n", p->link.name, p->fd);
usr.sbin/ppp/physical.c
842
FD_SET(p->fd, w);
usr.sbin/ppp/physical.c
843
log_Printf(LogTIMER, "%s: fdset(w) %d\n", p->link.name, p->fd);
usr.sbin/ppp/physical.c
846
if (sets && *n < p->fd + 1)
usr.sbin/ppp/physical.c
847
*n = p->fd + 1;
usr.sbin/ppp/physical.c
862
if (p->fd >= 0) {
usr.sbin/ppp/physical.c
863
if (r && FD_ISSET(p->fd, r)) {
usr.sbin/ppp/physical.c
864
FD_CLR(p->fd, r);
usr.sbin/ppp/physical.c
865
log_Printf(LogTIMER, "%s: fdunset(r) %d\n", p->link.name, p->fd);
usr.sbin/ppp/physical.c
868
if (e && FD_ISSET(p->fd, e)) {
usr.sbin/ppp/physical.c
869
FD_CLR(p->fd, e);
usr.sbin/ppp/physical.c
870
log_Printf(LogTIMER, "%s: fdunset(e) %d\n", p->link.name, p->fd);
usr.sbin/ppp/physical.c
873
if (w && FD_ISSET(p->fd, w)) {
usr.sbin/ppp/physical.c
874
FD_CLR(p->fd, w);
usr.sbin/ppp/physical.c
875
log_Printf(LogTIMER, "%s: fdunset(w) %d\n", p->link.name, p->fd);
usr.sbin/ppp/physical.c
888
return p->fd >= 0 && FD_ISSET(p->fd, fdset);
usr.sbin/ppp/physical.c
992
if (p->fd >= 0)
usr.sbin/ppp/physical.c
997
p->fd = STDIN_FILENO;
usr.sbin/ppp/physical.c
998
for (h = 0; h < NDEVICES && p->handler == NULL && p->fd >= 0; h++)
usr.sbin/ppp/physical.h
84
int fd; /* File descriptor for this device */
usr.sbin/ppp/prompt.c
312
prompt_Create(struct server *s, struct bundle *bundle, int fd)
usr.sbin/ppp/prompt.c
323
if (fd == PROMPT_STD) {
usr.sbin/ppp/prompt.c
340
p->fd_in = p->fd_out = fd;
usr.sbin/ppp/prompt.c
341
p->Term = fdopen(fd, "a+");
usr.sbin/ppp/prompt.c
418
int stat, fd = p ? p->fd_in : STDIN_FILENO;
usr.sbin/ppp/prompt.c
421
stat = fcntl(fd, F_GETFL, 0);
usr.sbin/ppp/prompt.c
424
fcntl(fd, F_SETFL, stat);
usr.sbin/ppp/prompt.c
430
tcgetattr(fd, &newtio);
usr.sbin/ppp/prompt.c
440
tcsetattr(fd, TCSANOW, &newtio);
usr.sbin/ppp/radius.c
1011
if ((got = rad_init_send_request(r->cx.rad, &r->cx.fd, &tv)))
usr.sbin/ppp/radius.c
235
r->cx.fd = -1; /* Stop select()ing */
usr.sbin/ppp/radius.c
539
if ((got = rad_continue_send_request(r->cx.rad, sel, &r->cx.fd, &tv)) == 0) {
usr.sbin/ppp/radius.c
575
if (r && rad->cx.fd != -1) {
usr.sbin/ppp/radius.c
576
FD_SET(rad->cx.fd, r);
usr.sbin/ppp/radius.c
577
if (*n < rad->cx.fd + 1)
usr.sbin/ppp/radius.c
578
*n = rad->cx.fd + 1;
usr.sbin/ppp/radius.c
579
log_Printf(LogTIMER, "Radius: fdset(r) %d\n", rad->cx.fd);
usr.sbin/ppp/radius.c
594
return r && r->cx.fd != -1 && FD_ISSET(r->cx.fd, fdset);
usr.sbin/ppp/radius.c
619
r->cx.fd = -1;
usr.sbin/ppp/radius.c
666
if (r->cx.fd != -1) {
usr.sbin/ppp/radius.c
667
r->cx.fd = -1;
usr.sbin/ppp/radius.c
737
if (r->cx.fd != -1)
usr.sbin/ppp/radius.c
867
if ((got = rad_init_send_request(r->cx.rad, &r->cx.fd, &tv)))
usr.sbin/ppp/radius.c
901
if (r->cx.fd != -1)
usr.sbin/ppp/radius.h
39
int fd; /* We're selecting on this */
usr.sbin/ppp/server.c
103
if (s->fd >= 0 && FD_ISSET(s->fd, fdset)) {
usr.sbin/ppp/server.c
104
wfd = accept(s->fd, sa, &ssize);
usr.sbin/ppp/server.c
288
server.fd = s;
usr.sbin/ppp/server.c
298
if (server.fd == -1) {
usr.sbin/ppp/server.c
299
server.fd = -1;
usr.sbin/ppp/server.c
362
server.fd = s;
usr.sbin/ppp/server.c
370
if (server.fd == -1) {
usr.sbin/ppp/server.c
371
server.fd = -1;
usr.sbin/ppp/server.c
382
if (server.fd >= 0) {
usr.sbin/ppp/server.c
387
if (getsockname(server.fd, (struct sockaddr *)&un, &sz) == 0 &&
usr.sbin/ppp/server.c
391
close(server.fd);
usr.sbin/ppp/server.c
392
server.fd = -1;
usr.sbin/ppp/server.c
409
server.fd = -1;
usr.sbin/ppp/server.c
59
if (r && s->fd >= 0) {
usr.sbin/ppp/server.c
60
if (*n < s->fd + 1)
usr.sbin/ppp/server.c
61
*n = s->fd + 1;
usr.sbin/ppp/server.c
62
FD_SET(s->fd, r);
usr.sbin/ppp/server.c
63
log_Printf(LogTIMER, "server: fdset(r) %d\n", s->fd);
usr.sbin/ppp/server.c
79
if (s->fd >= 0 && FD_ISSET(s->fd, fdset))
usr.sbin/ppp/server.h
34
int fd;
usr.sbin/ppp/tcp.c
139
if (p->fd < 0) {
usr.sbin/ppp/tcp.c
150
p->fd--; /* We own the device but maybe can't use it - change fd */
usr.sbin/ppp/tcp.c
154
p->fd = tcp_OpenConnection(p->link.name, host, port);
usr.sbin/ppp/tcp.c
158
if (p->fd >= 0)
usr.sbin/ppp/tcp.c
169
if (p->fd >= 0) {
usr.sbin/ppp/tcp.c
173
if (fstat(p->fd, &st) != -1 && (st.st_mode & S_IFSOCK)) {
usr.sbin/ppp/tcp.c
177
if (getsockopt(p->fd, SOL_SOCKET, SO_TYPE, &type, &sz) == -1) {
usr.sbin/ppp/tcp.c
179
close(p->fd);
usr.sbin/ppp/tcp.c
180
p->fd = -1;
usr.sbin/ppp/tcp.c
190
if (getpeername(p->fd, sockp, &sz) != 0 ||
usr.sbin/ppp/tty.c
103
int fd; /* Pre-line-discipline fd */
usr.sbin/ppp/tty.c
136
if (p->fd >= 0) {
usr.sbin/ppp/tty.c
137
if (ioctl(p->fd, TIOCMGET, &dev->mbits) < 0) {
usr.sbin/ppp/tty.c
231
return dev->real.fd != -1;
usr.sbin/ppp/tty.c
288
if (ioctl(p->fd, TIOCGETD, &dev->real.disc) < 0) {
usr.sbin/ppp/tty.c
294
if (ID0ioctl(p->fd, TIOCSETD, &ldisc) < 0) {
usr.sbin/ppp/tty.c
301
if (ioctl(p->fd, NGIOCGINFO, info) < 0) {
usr.sbin/ppp/tty.c
304
ID0ioctl(p->fd, TIOCSETD, &dev->real.disc);
usr.sbin/ppp/tty.c
313
ID0ioctl(p->fd, TIOCSETD, &dev->real.disc);
usr.sbin/ppp/tty.c
368
dev->real.fd = p->fd;
usr.sbin/ppp/tty.c
369
p->fd = ds;
usr.sbin/ppp/tty.c
381
ID0ioctl(p->fd, TIOCSETD, &dev->real.disc);
usr.sbin/ppp/tty.c
398
close(p->fd);
usr.sbin/ppp/tty.c
399
p->fd = dev->real.fd;
usr.sbin/ppp/tty.c
400
dev->real.fd = -1;
usr.sbin/ppp/tty.c
404
if (ID0ioctl(p->fd, TIOCSETD, &dev->real.disc) == 0) {
usr.sbin/ppp/tty.c
420
return NgSendData(p->fd, dev->hook, v, n) == -1 ? -1 : (ssize_t)n;
usr.sbin/ppp/tty.c
422
return write(p->fd, v, n);
usr.sbin/ppp/tty.c
432
return NgRecvData(p->fd, v, n, hook);
usr.sbin/ppp/tty.c
434
return read(p->fd, v, n);
usr.sbin/ppp/tty.c
448
if (p->type != PHYS_DIRECT && p->fd >= 0 && !Online(dev))
usr.sbin/ppp/tty.c
450
p->link.name, p->fd, dev->mbits);
usr.sbin/ppp/tty.c
457
tcgetattr(p->fd, &ios);
usr.sbin/ppp/tty.c
467
if (tcsetattr(p->fd, TCSANOW, &ios) == -1)
usr.sbin/ppp/tty.c
473
oldflag = fcntl(p->fd, F_GETFL, 0);
usr.sbin/ppp/tty.c
476
fcntl(p->fd, F_SETFL, oldflag | O_NONBLOCK);
usr.sbin/ppp/tty.c
486
if (p->fd >= 0) {
usr.sbin/ppp/tty.c
492
tcgetattr(p->fd, &tio);
usr.sbin/ppp/tty.c
493
if (cfsetspeed(&tio, B0) == -1 || tcsetattr(p->fd, TCSANOW, &tio) == -1)
usr.sbin/ppp/tty.c
508
tcflush(p->fd, TCIOFLUSH);
usr.sbin/ppp/tty.c
510
if (!physical_IsSync(p) && tcsetattr(p->fd, TCSAFLUSH, &dev->ios) == -1)
usr.sbin/ppp/tty.c
518
if ((oldflag = fcntl(p->fd, F_GETFL, 0)) != -1)
usr.sbin/ppp/tty.c
519
fcntl(p->fd, F_SETFL, oldflag & ~O_NONBLOCK);
usr.sbin/ppp/tty.c
544
if (tcgetattr(p->fd, &ios) == -1)
usr.sbin/ppp/tty.c
675
if (p->fd < 0 || !isatty(p->fd))
usr.sbin/ppp/tty.c
680
physical_SetDevice(p, ttyname(p->fd));
usr.sbin/ppp/tty.c
690
close(p->fd);
usr.sbin/ppp/tty.c
691
p->fd = -1;
usr.sbin/ppp/tty.c
700
dev->real.fd = -1;
usr.sbin/ppp/tty.c
704
tcgetattr(p->fd, &ios);
usr.sbin/ppp/tty.c
712
" iflag = %lx, oflag = %lx, cflag = %lx\n", p->link.name, p->fd,
usr.sbin/ppp/tty.c
735
if (tcsetattr(p->fd, TCSADRAIN, &ios) == -1) {
usr.sbin/ppp/tty.c
747
oldflag = fcntl(p->fd, F_GETFL, 0);
usr.sbin/ppp/tty.c
754
close(p->fd);
usr.sbin/ppp/tty.c
755
p->fd = -1;
usr.sbin/ppp/tty.c
759
fcntl(p->fd, F_SETFL, oldflag & ~O_NONBLOCK);
usr.sbin/ppp/tun.c
116
if (ID0ioctl(bundle->dev.fd, TUNSIFINFO, &info) < 0)
usr.sbin/ppp/udp.c
103
ret = write(p->fd, v, n);
usr.sbin/ppp/udp.c
118
return read(p->fd, v, n);
usr.sbin/ppp/udp.c
121
ret = recvfrom(p->fd, v, n, 0, (struct sockaddr *)&dev->sock, &sz);
usr.sbin/ppp/udp.c
234
p->fd = socket(PF_INET, SOCK_DGRAM, 0);
usr.sbin/ppp/udp.c
235
if (p->fd >= 0) {
usr.sbin/ppp/udp.c
238
if (connect(p->fd, (struct sockaddr *)&dev->sock, sizeof dev->sock) == 0) {
usr.sbin/ppp/udp.c
246
close(p->fd);
usr.sbin/ppp/udp.c
247
p->fd = -1;
usr.sbin/ppp/udp.c
260
if (p->fd < 0) {
usr.sbin/ppp/udp.c
271
p->fd--; /* We own the device but maybe can't use it - change fd */
usr.sbin/ppp/udp.c
286
if (fstat(p->fd, &st) != -1 && (st.st_mode & S_IFSOCK)) {
usr.sbin/ppp/udp.c
290
if (getsockopt(p->fd, SOL_SOCKET, SO_TYPE, &type, &sz) == -1) {
usr.sbin/ppp/udp.c
292
close(p->fd);
usr.sbin/ppp/udp.c
293
p->fd = -1;
usr.sbin/ppp/udp.c
307
if (getpeername(p->fd, sockp, &sz) == 0) {
usr.sbin/ppp/udp.c
91
ret = write(p->fd, v, n);
usr.sbin/ppp/udp.c
96
ret = sendto(p->fd, v, n, 0, (struct sockaddr *)&dev->sock,
usr.sbin/pppctl/pppctl.c
129
write(fd, Buffer, strlen(Buffer));
usr.sbin/pppctl/pppctl.c
131
return Receive(fd, display & ~REC_PASSWD);
usr.sbin/pppctl/pppctl.c
181
smartgets(EditLine *e, int *count, int fd)
usr.sbin/pppctl/pppctl.c
185
data = fd;
usr.sbin/pppctl/pppctl.c
204
int n, socksz, arg, fd, len, verbose, save_errno, hide1, hide1off, hide2;
usr.sbin/pppctl/pppctl.c
290
if (fd = socket(AF_LOCAL, SOCK_STREAM, 0), fd < 0) {
usr.sbin/pppctl/pppctl.c
339
if (fd = socket(AF_INET, SOCK_STREAM, 0), fd < 0) {
usr.sbin/pppctl/pppctl.c
354
if (connect(fd, sock, socksz) < 0) {
usr.sbin/pppctl/pppctl.c
369
close(fd);
usr.sbin/pppctl/pppctl.c
387
switch (Receive(fd, verbose | REC_PASSWD))
usr.sbin/pppctl/pppctl.c
420
while ((l = smartgets(edit, &len, fd))) {
usr.sbin/pppctl/pppctl.c
423
write(fd, l, len);
usr.sbin/pppctl/pppctl.c
424
if (Receive(fd, REC_SHOW) != 0)
usr.sbin/pppctl/pppctl.c
443
write(fd, Buffer, strlen(Buffer));
usr.sbin/pppctl/pppctl.c
444
if (Receive(fd, verbose | REC_SHOW) != 0) {
usr.sbin/pppctl/pppctl.c
461
close(fd);
usr.sbin/pppctl/pppctl.c
88
Receive(int fd, int display)
usr.sbin/pppctl/pppctl.c
97
while (Result = read(fd, Buffer+len, sizeof(Buffer)-len-1), Result != -1) {
usr.sbin/procctl/procctl.c
101
close(fd);
usr.sbin/procctl/procctl.c
61
int c, vflag, fd;
usr.sbin/procctl/procctl.c
84
fd = open(buf, O_RDWR);
usr.sbin/procctl/procctl.c
85
if (fd == -1) {
usr.sbin/procctl/procctl.c
92
if (ioctl(fd, PIOCBIC, ~0) == -1)
usr.sbin/procctl/procctl.c
97
if (ioctl(fd, PIOCCONT, 0) == -1 && errno != EINVAL)
usr.sbin/pw/pw_conf.c
378
int fd;
usr.sbin/pw/pw_conf.c
383
if ((fd = open(file, O_CREAT | O_RDWR | O_TRUNC | O_EXLOCK, 0644)) != -1) {
usr.sbin/pw/pw_conf.c
386
if ((fp = fdopen(fd, "w")) == NULL)
usr.sbin/pw/pw_conf.c
387
close(fd);
usr.sbin/pw/pw_group.c
179
int fd = atoi(arg->val);
usr.sbin/pw/pw_group.c
182
int istty = isatty(fd);
usr.sbin/pw/pw_group.c
187
if (tcgetattr(fd, &t) == -1)
usr.sbin/pw/pw_group.c
194
tcsetattr(fd, TCSANOW, &n);
usr.sbin/pw/pw_group.c
199
b = read(fd, line, sizeof(line) - 1);
usr.sbin/pw/pw_group.c
201
tcsetattr(fd, TCSANOW, &t);
usr.sbin/pw/pw_group.c
213
errx(EX_DATAERR, "empty password read on file descriptor %d", fd);
usr.sbin/pw/pw_log.c
40
int fd = open(cnf->logfile, O_WRONLY | O_CREAT | O_APPEND, 0600);
usr.sbin/pw/pw_log.c
42
if (fd != -1)
usr.sbin/pw/pw_log.c
43
logfile = fdopen(fd, "a");
usr.sbin/pw/pw_user.c
611
int fd = atoi(arg->val);
usr.sbin/pw/pw_user.c
614
int istty = isatty(fd);
usr.sbin/pw/pw_user.c
619
if (tcgetattr(fd, &t) == -1)
usr.sbin/pw/pw_user.c
626
tcsetattr(fd, TCSANOW, &n);
usr.sbin/pw/pw_user.c
634
b = read(fd, line, sizeof(line) - 1);
usr.sbin/pw/pw_user.c
636
tcsetattr(fd, TCSANOW, &t);
usr.sbin/pw/pw_user.c
649
errx(EX_DATAERR, "empty password read on file descriptor %d", fd);
usr.sbin/quot/quot.c
100
get_inode(int fd, struct fs *super, ino_t ino)
usr.sbin/quot/quot.c
105
if (fd < 0) { /* flush cache */
usr.sbin/quot/quot.c
118
if (lseek(fd, (off_t)ino_to_fsba(super, last) << super->fs_fshift, 0) < (off_t)0
usr.sbin/quot/quot.c
119
|| read(fd,ip,INOSZ(super)) != (ssize_t)INOSZ(super))
usr.sbin/quot/quot.c
332
dofsizes(int fd, struct fs *super, char *name)
usr.sbin/quot/quot.c
347
if ((ip = get_inode(fd,super,inode))
usr.sbin/quot/quot.c
403
douser(int fd, struct fs *super, char *name)
usr.sbin/quot/quot.c
413
if ((ip = get_inode(fd,super,inode))
usr.sbin/quot/quot.c
443
donames(int fd, struct fs *super, char *name)
usr.sbin/quot/quot.c
461
if ((ip = get_inode(fd,super,inode))
usr.sbin/quot/quot.c
500
int fd;
usr.sbin/quot/quot.c
505
if ((fd = open(name,0)) < 0
usr.sbin/quot/quot.c
506
|| lseek(fd,SBOFF,0) != SBOFF
usr.sbin/quot/quot.c
507
|| read(fd,superblock,SBSIZE) != SBSIZE) {
usr.sbin/quot/quot.c
509
close(fd);
usr.sbin/quot/quot.c
514
close(fd);
usr.sbin/quot/quot.c
521
(*func)(fd,(struct fs *)superblock,name);
usr.sbin/quot/quot.c
522
close(fd);
usr.sbin/rarpd/rarpd.c
343
int fd;
usr.sbin/rarpd/rarpd.c
352
fd = open(device, O_RDWR);
usr.sbin/rarpd/rarpd.c
353
} while ((fd == -1) && (errno == EBUSY));
usr.sbin/rarpd/rarpd.c
355
if (fd == -1) {
usr.sbin/rarpd/rarpd.c
359
return fd;
usr.sbin/rarpd/rarpd.c
369
int fd;
usr.sbin/rarpd/rarpd.c
388
fd = bpf_open();
usr.sbin/rarpd/rarpd.c
393
if (ioctl(fd, BIOCIMMEDIATE, &immediate) == -1) {
usr.sbin/rarpd/rarpd.c
398
if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) == -1) {
usr.sbin/rarpd/rarpd.c
406
if (ioctl(fd, BIOCGDLT, (caddr_t)&dlt) == -1) {
usr.sbin/rarpd/rarpd.c
417
if (ioctl(fd, BIOCSETF, (caddr_t)&filter) == -1) {
usr.sbin/rarpd/rarpd.c
421
return fd;
usr.sbin/rarpd/rarpd.c
469
int cc, fd;
usr.sbin/rarpd/rarpd.c
508
fd = ii->ii_fd;
usr.sbin/rarpd/rarpd.c
509
if (!FD_ISSET(fd, &listeners))
usr.sbin/rarpd/rarpd.c
512
cc = read(fd, (char *)buf, bufsize);
usr.sbin/resident/resident.c
158
int fd;
usr.sbin/resident/resident.c
170
if ((fd = open(*argv, O_RDONLY, 0)) < 0) {
usr.sbin/resident/resident.c
175
if ((n = read(fd, &hdr, sizeof hdr)) == -1) {
usr.sbin/resident/resident.c
177
close(fd);
usr.sbin/resident/resident.c
189
if (lseek(fd, 0, SEEK_SET) == -1 ||
usr.sbin/resident/resident.c
190
read(fd, &ehdr, sizeof ehdr) != sizeof ehdr ||
usr.sbin/resident/resident.c
191
lseek(fd, ehdr.e_phoff, SEEK_SET) == -1
usr.sbin/resident/resident.c
197
if (read(fd, &phdr, ehdr.e_phentsize)
usr.sbin/resident/resident.c
224
close(fd);
usr.sbin/rndcontrol/rndcontrol.c
49
int verbose, ch, fd, result, i;
usr.sbin/rndcontrol/rndcontrol.c
54
fd = open("/dev/random", O_RDONLY, 0);
usr.sbin/rndcontrol/rndcontrol.c
55
if (fd == -1) {
usr.sbin/rndcontrol/rndcontrol.c
69
result = ioctl(fd, MEM_SETIRQ, (char *)&irq);
usr.sbin/rndcontrol/rndcontrol.c
79
result = ioctl(fd, MEM_CLEARIRQ, (char *)&irq);
usr.sbin/rndcontrol/rndcontrol.c
94
result = ioctl(fd, MEM_FINDIRQ, (char *)&irq);
usr.sbin/rpc.lockd/lockd.c
280
int fd;
usr.sbin/rpc.lockd/lockd.c
317
if ((fd = __rpc_nconf2fd(nconf)) < 0) {
usr.sbin/rpc.lockd/lockd.c
334
close(fd);
usr.sbin/rpc.lockd/lockd.c
349
close(fd);
usr.sbin/rpc.lockd/lockd.c
414
r = bindresvport_sa(fd, res->ai_addr);
usr.sbin/rpc.lockd/lockd.c
420
transp = svc_tli_create(fd, nconf, NULL,
usr.sbin/rpc.lockd/lockd_lock.c
410
fl->fd = fhopen(&fl->filehandle, O_RDWR);
usr.sbin/rpc.lockd/lockd_lock.c
411
if (fl->fd < 0) {
usr.sbin/rpc.lockd/lockd_lock.c
429
if (fstat(fl->fd, &st) < 0) {
usr.sbin/rpc.lockd/lockd_lock.c
443
error = flock(fl->fd, lflags);
usr.sbin/rpc.lockd/lockd_lock.c
449
close(fl->fd);
usr.sbin/rpc.lockd/lockd_lock.c
459
if(flock(fl->fd, lflags) != 0) {
usr.sbin/rpc.lockd/lockd_lock.c
497
close(fl->fd);
usr.sbin/rpc.lockd/lockd_lock.c
589
if (close(rfl->fd) < 0) {
usr.sbin/rpc.lockd/lockd_lock.c
69
int fd; /* file descriptor for this lock */
usr.sbin/rpcbind/check_bound.c
56
int fd;
usr.sbin/rpcbind/check_bound.c
76
int fd;
usr.sbin/rpcbind/check_bound.c
87
fd = __rpc_nconf2fd(fdl->nconf);
usr.sbin/rpcbind/check_bound.c
88
if (fd < 0) {
usr.sbin/rpcbind/check_bound.c
94
ans = bind(fd, (struct sockaddr *)na->buf, na->len);
usr.sbin/rpcbind/check_bound.c
96
close(fd);
usr.sbin/rpcbind/rpcb_svc_com.c
1111
p->fd = n;
usr.sbin/rpcbind/rpcb_svc_com.c
1123
fprintf(stderr, "%d ", p->fd);
usr.sbin/rpcbind/rpcb_svc_com.c
1144
fprintf(stderr, "%d ", p->fd);
usr.sbin/rpcbind/rpcb_svc_com.c
1179
if ((xprt = find_rmtcallxprt_by_fd(pfds[j].fd)) != NULL) {
usr.sbin/rpcbind/rpcb_svc_com.c
1186
pfds[j].fd, xprt->xp_netid);
usr.sbin/rpcbind/rpcb_svc_com.c
1188
handle_reply(pfds[j].fd, xprt);
usr.sbin/rpcbind/rpcb_svc_com.c
1223
handle_reply(int fd, SVCXPRT *xprt)
usr.sbin/rpcbind/rpcb_svc_com.c
1243
inlen = recvfrom(fd, buffer, RPC_BUF_MAX, 0,
usr.sbin/rpcbind/rpcb_svc_com.c
401
int fd;
usr.sbin/rpcbind/rpcb_svc_com.c
403
if ((fd = open("/dev/null", O_RDONLY)) == -1) {
usr.sbin/rpcbind/rpcb_svc_com.c
493
int fd;
usr.sbin/rpcbind/rpcb_svc_com.c
497
if ((fd = __rpc_nconf2fd(nconf)) == -1) {
usr.sbin/rpcbind/rpcb_svc_com.c
504
xprt = svc_tli_create(fd, 0, NULL, 0, 0);
usr.sbin/rpcbind/rpcb_svc_com.c
519
rmt->fd = fd;
usr.sbin/rpcbind/rpcb_svc_com.c
529
if (fd > svc_maxfd)
usr.sbin/rpcbind/rpcb_svc_com.c
530
svc_maxfd = fd;
usr.sbin/rpcbind/rpcb_svc_com.c
531
FD_SET(fd, &svc_fdset);
usr.sbin/rpcbind/rpcb_svc_com.c
532
return (fd);
usr.sbin/rpcbind/rpcb_svc_com.c
542
return (rmt->fd);
usr.sbin/rpcbind/rpcb_svc_com.c
549
find_rmtcallxprt_by_fd(int fd)
usr.sbin/rpcbind/rpcb_svc_com.c
554
if (fd == rmt->fd) {
usr.sbin/rpcbind/rpcb_svc_com.c
617
int fd = -1;
usr.sbin/rpcbind/rpcb_svc_com.c
71
int fd;
usr.sbin/rpcbind/rpcb_svc_com.c
764
if ((fd = find_rmtcallfd_by_netid(nconf->nc_netid)) == -1) {
usr.sbin/rpcbind/rpcb_svc_com.c
770
switch (forward_register(*xidp, caller, fd, m_uaddr, reply_type,
usr.sbin/rpcbind/rpcb_svc_com.c
897
if (sendto(fd, outbufp, outlen, 0, (struct sockaddr *)na->buf, na->len)
usr.sbin/rpcbind/rpcbind.c
230
int fd;
usr.sbin/rpcbind/rpcbind.c
271
if ((fd = __rpc_nconf2fd(nconf)) < 0) {
usr.sbin/rpcbind/rpcbind.c
335
if ((fd = __rpc_nconf2fd(nconf)) < 0) {
usr.sbin/rpcbind/rpcbind.c
355
close(fd);
usr.sbin/rpcbind/rpcbind.c
370
close(fd);
usr.sbin/rpcbind/rpcbind.c
374
if (setsockopt(fd, IPPROTO_IPV6,
usr.sbin/rpcbind/rpcbind.c
404
if (bind(fd, sa, addrlen) != 0) {
usr.sbin/rpcbind/rpcbind.c
445
listen(fd, SOMAXCONN);
usr.sbin/rpcbind/rpcbind.c
447
my_xprt = (SVCXPRT *)svc_tli_create(fd, nconf, &taddr,
usr.sbin/rpcbind/rpcbind.c
459
if (bind(fd, sa, addrlen) < 0) {
usr.sbin/rpcbind/rpcbind.c
493
listen(fd, SOMAXCONN);
usr.sbin/rpcbind/rpcbind.c
495
my_xprt = (SVCXPRT *)svc_tli_create(fd, nconf, &taddr,
usr.sbin/rpcbind/rpcbind.c
640
close(fd);
usr.sbin/rtadvd/control.c
147
n = read(fd, msg, msglen);
usr.sbin/rtadvd/control.c
167
close(fd);
usr.sbin/rtadvd/control.c
172
cm_send(int fd, char *buf)
usr.sbin/rtadvd/control.c
199
len = writev(fd, iov, iovcnt);
usr.sbin/rtadvd/control.c
207
close(fd);
usr.sbin/rtadvd/control.c
217
close(fd);
usr.sbin/rtadvd/control.c
229
int fd;
usr.sbin/rtadvd/control.c
232
if ((fd = accept(s->si_fd, (struct sockaddr *)&sun,
usr.sbin/rtadvd/control.c
239
if ((flags = fcntl(fd, F_GETFL, 0)) == -1) {
usr.sbin/rtadvd/control.c
244
if ((flags = fcntl(fd, F_SETFL, flags | O_NONBLOCK)) == -1) {
usr.sbin/rtadvd/control.c
249
fd, s->si_fd);
usr.sbin/rtadvd/control.c
251
return (fd);
usr.sbin/rtadvd/control.c
60
cm_recv(int fd, char *buf)
usr.sbin/rtadvd/control.c
68
syslog(LOG_DEBUG, "<%s> enter, fd=%d", __func__, fd);
usr.sbin/rtadvd/control.c
74
pfds[0].fd = fd;
usr.sbin/rtadvd/control.c
91
n = read(fd, cm, sizeof(*cm));
usr.sbin/rtadvd/control_client.c
101
error = cm_recv(fd, buf);
usr.sbin/rtadvd/control_client.c
105
close(fd);
usr.sbin/rtadvd/control_client.c
116
close(fd);
usr.sbin/rtadvd/control_client.c
121
close(fd);
usr.sbin/rtadvd/control_client.c
129
close(fd);
usr.sbin/rtadvd/control_client.c
58
cm_handler_client(int fd, int state, char *buf_orig)
usr.sbin/rtadvd/control_client.c
77
close(fd);
usr.sbin/rtadvd/control_client.c
94
error = cm_send(fd, buf);
usr.sbin/rtadvd/control_server.c
630
cm_handler_server(int fd)
usr.sbin/rtadvd/control_server.c
657
error = cm_send(fd, buf);
usr.sbin/rtadvd/control_server.c
664
error = cm_recv(fd, buf);
usr.sbin/rtadvd/control_server.c
668
close(fd);
usr.sbin/rtadvd/control_server.c
678
close(fd);
usr.sbin/rtadvd/control_server.c
683
close(fd);
usr.sbin/rtadvd/control_server.c
689
error = cm_recv(fd, buf);
usr.sbin/rtadvd/control_server.c
694
close(fd);
usr.sbin/rtadvd/rtadvd.c
277
set[PFD_RAWSOCK].fd = sock.si_fd;
usr.sbin/rtadvd/rtadvd.c
281
set[PFD_RTSOCK].fd = rtsock.si_fd;
usr.sbin/rtadvd/rtadvd.c
284
set[PFD_RTSOCK].fd = -1;
usr.sbin/rtadvd/rtadvd.c
285
set[PFD_CSOCK].fd = ctrlsock.si_fd;
usr.sbin/rtadvd/rtadvd.c
353
int fd;
usr.sbin/rtadvd/rtadvd.c
355
fd = csock_accept(&ctrlsock);
usr.sbin/rtadvd/rtadvd.c
356
if (fd == -1)
usr.sbin/rtadvd/rtadvd.c
361
cm_handler_server(fd);
usr.sbin/rtadvd/rtadvd.c
362
close(fd);
usr.sbin/rwhod/rwhod.c
280
pfd[0].fd = s;
usr.sbin/sa/main.c
196
int fd;
usr.sbin/sa/main.c
202
fd = acct_load(argv[0], sflag);
usr.sbin/sa/main.c
203
if (fd < 0)
usr.sbin/sa/main.c
234
if (ftruncate(fd, 0) == -1) {
usr.sbin/sa/main.c
261
if (close(fd) == -1) {
usr.sbin/sa/main.c
300
int fd, i;
usr.sbin/sa/main.c
305
fd = open(pn, wr ? O_RDWR : O_RDONLY, 0);
usr.sbin/sa/main.c
306
if (fd == -1) {
usr.sbin/sa/main.c
317
rv = read(fd, &ac, sizeof(struct acct));
usr.sbin/sa/main.c
362
return (fd);
usr.sbin/sdpd/provider.c
115
provider->fd = fd;
usr.sbin/sdpd/provider.c
54
provider_register_sd(int32_t fd)
usr.sbin/sdpd/provider.c
74
sd->fd = fd;
usr.sbin/sdpd/provider.c
79
sd->fd = fd;
usr.sbin/sdpd/provider.c
92
provider_register(profile_p const profile, bdaddr_t const *bdaddr, int32_t fd,
usr.sbin/sdpd/provider.h
78
int32_t fd; /* session descriptor */
usr.sbin/sdpd/provider.h
89
int32_t provider_register_sd (int32_t fd);
usr.sbin/sdpd/provider.h
92
int32_t fd,
usr.sbin/sdpd/sar.c
145
server_prepare_service_attribute_response(server_p srv, int32_t fd)
usr.sbin/sdpd/sar.c
149
uint8_t *rsp = srv->fdidx[fd].rsp;
usr.sbin/sdpd/sar.c
211
if (srv->fdidx[fd].rsp_cs != cs)
usr.sbin/sdpd/sar.c
213
if (srv->fdidx[fd].rsp_size > 0)
usr.sbin/sdpd/sar.c
234
srv->fdidx[fd].rsp_limit = srv->fdidx[fd].omtu - sizeof(sdp_pdu_t) - 2;
usr.sbin/sdpd/sar.c
235
if (srv->fdidx[fd].rsp_limit > rsp_limit)
usr.sbin/sdpd/sar.c
236
srv->fdidx[fd].rsp_limit = rsp_limit;
usr.sbin/sdpd/sar.c
238
srv->fdidx[fd].rsp_size = cs;
usr.sbin/sdpd/sar.c
239
srv->fdidx[fd].rsp_cs = 0;
usr.sbin/sdpd/sar.c
249
server_send_service_attribute_response(server_p srv, int32_t fd)
usr.sbin/sdpd/sar.c
251
uint8_t *rsp = srv->fdidx[fd].rsp + srv->fdidx[fd].rsp_cs;
usr.sbin/sdpd/sar.c
252
uint8_t *rsp_end = srv->fdidx[fd].rsp + srv->fdidx[fd].rsp_size;
usr.sbin/sdpd/sar.c
262
srv->fdidx[fd].rsp_cs += size;
usr.sbin/sdpd/sar.c
264
if (size + 1 > srv->fdidx[fd].rsp_limit) {
usr.sbin/sdpd/sar.c
270
while ((rsp_end - rsp) + 3 > srv->fdidx[fd].rsp_limit) {
usr.sbin/sdpd/sar.c
272
srv->fdidx[fd].rsp_cs --;
usr.sbin/sdpd/sar.c
276
cs[1] = srv->fdidx[fd].rsp_cs >> 8;
usr.sbin/sdpd/sar.c
277
cs[2] = srv->fdidx[fd].rsp_cs & 0xff;
usr.sbin/sdpd/sar.c
308
size = writev(fd, (struct iovec const *) &iov, sizeof(iov)/sizeof(iov[0]));
usr.sbin/sdpd/sar.c
312
if (srv->fdidx[fd].rsp_cs == srv->fdidx[fd].rsp_size) {
usr.sbin/sdpd/sar.c
313
srv->fdidx[fd].rsp_cs = 0;
usr.sbin/sdpd/sar.c
314
srv->fdidx[fd].rsp_size = 0;
usr.sbin/sdpd/sar.c
315
srv->fdidx[fd].rsp_limit = 0;
usr.sbin/sdpd/scr.c
50
server_prepare_service_change_response(server_p srv, int32_t fd)
usr.sbin/sdpd/scr.c
54
uint8_t *rsp = srv->fdidx[fd].rsp;
usr.sbin/sdpd/scr.c
65
if (!srv->fdidx[fd].control ||
usr.sbin/sdpd/scr.c
66
!srv->fdidx[fd].priv || req_end - req < 4)
usr.sbin/sdpd/scr.c
74
if (provider == NULL || provider->fd != fd)
usr.sbin/sdpd/scr.c
90
srv->fdidx[fd].rsp_limit = srv->fdidx[fd].omtu - sizeof(sdp_pdu_t);
usr.sbin/sdpd/scr.c
91
srv->fdidx[fd].rsp_size = rsp - srv->fdidx[fd].rsp;
usr.sbin/sdpd/scr.c
92
srv->fdidx[fd].rsp_cs = 0;
usr.sbin/sdpd/server.c
271
int fd;
usr.sbin/sdpd/server.c
275
for (fd = 0; fd < srv->maxfd + 1; fd ++)
usr.sbin/sdpd/server.c
276
if (srv->fdidx[fd].valid)
usr.sbin/sdpd/server.c
277
server_close_fd(srv, fd);
usr.sbin/sdpd/server.c
293
int32_t n, fd;
usr.sbin/sdpd/server.c
311
for (fd = 0; fd < srv->maxfd + 1 && n > 0; fd ++) {
usr.sbin/sdpd/server.c
312
if (!FD_ISSET(fd, &fdset))
usr.sbin/sdpd/server.c
315
assert(srv->fdidx[fd].valid);
usr.sbin/sdpd/server.c
318
if (srv->fdidx[fd].server)
usr.sbin/sdpd/server.c
319
server_accept_client(srv, fd);
usr.sbin/sdpd/server.c
320
else if (server_process_request(srv, fd) != 0)
usr.sbin/sdpd/server.c
321
server_close_fd(srv, fd);
usr.sbin/sdpd/server.c
333
server_accept_client(server_p srv, int32_t fd)
usr.sbin/sdpd/server.c
341
cfd = accept(fd, NULL, NULL);
usr.sbin/sdpd/server.c
346
srv->fdidx[fd].control? "control" : "L2CAP",
usr.sbin/sdpd/server.c
354
if (!srv->fdidx[fd].control) {
usr.sbin/sdpd/server.c
388
omtu = srv->fdidx[fd].omtu;
usr.sbin/sdpd/server.c
409
srv->fdidx[cfd].control = srv->fdidx[fd].control;
usr.sbin/sdpd/server.c
423
server_process_request(server_p srv, int32_t fd)
usr.sbin/sdpd/server.c
436
assert(FD_ISSET(fd, &srv->fdset));
usr.sbin/sdpd/server.c
437
assert(srv->fdidx[fd].valid);
usr.sbin/sdpd/server.c
438
assert(!srv->fdidx[fd].server);
usr.sbin/sdpd/server.c
439
assert(srv->fdidx[fd].rsp != NULL);
usr.sbin/sdpd/server.c
440
assert(srv->fdidx[fd].omtu >= L2CAP_MTU_MINIMUM);
usr.sbin/sdpd/server.c
454
len = recvmsg(fd, &msg, 0);
usr.sbin/sdpd/server.c
459
srv->fdidx[fd].control? "control" : "L2CAP",
usr.sbin/sdpd/server.c
465
srv->fdidx[fd].control? "control" : "L2CAP");
usr.sbin/sdpd/server.c
477
srv->fdidx[fd].priv =
usr.sbin/sdpd/server.c
483
srv->fdidx[fd].priv = 1;
usr.sbin/sdpd/server.c
490
error = server_prepare_service_search_response(srv, fd);
usr.sbin/sdpd/server.c
494
error = server_prepare_service_attribute_response(srv, fd);
usr.sbin/sdpd/server.c
498
error = server_prepare_service_search_attribute_response(srv, fd);
usr.sbin/sdpd/server.c
502
error = server_prepare_service_register_response(srv, fd);
usr.sbin/sdpd/server.c
506
error = server_prepare_service_unregister_response(srv, fd);
usr.sbin/sdpd/server.c
510
error = server_prepare_service_change_response(srv, fd);
usr.sbin/sdpd/server.c
523
error = server_send_service_search_response(srv, fd);
usr.sbin/sdpd/server.c
527
error = server_send_service_attribute_response(srv, fd);
usr.sbin/sdpd/server.c
531
error = server_send_service_search_attribute_response(srv, fd);
usr.sbin/sdpd/server.c
535
error = server_send_service_register_response(srv, fd);
usr.sbin/sdpd/server.c
539
error = server_send_service_unregister_response(srv, fd);
usr.sbin/sdpd/server.c
543
error = server_send_service_change_response(srv, fd);
usr.sbin/sdpd/server.c
554
srv->fdidx[fd].control? "control" : "L2CAP",
usr.sbin/sdpd/server.c
560
srv->fdidx[fd].control? "control" : "L2CAP",
usr.sbin/sdpd/server.c
563
error = server_send_error_response(srv, fd, error);
usr.sbin/sdpd/server.c
567
srv->fdidx[fd].control? "control" : "L2CAP",
usr.sbin/sdpd/server.c
573
srv->fdidx[fd].rsp_cs = 0;
usr.sbin/sdpd/server.c
574
srv->fdidx[fd].rsp_size = 0;
usr.sbin/sdpd/server.c
575
srv->fdidx[fd].rsp_limit = 0;
usr.sbin/sdpd/server.c
586
server_send_error_response(server_p srv, int32_t fd, uint16_t error)
usr.sbin/sdpd/server.c
602
size = write(fd, &rsp, sizeof(rsp));
usr.sbin/sdpd/server.c
613
server_close_fd(server_p srv, int32_t fd)
usr.sbin/sdpd/server.c
617
assert(FD_ISSET(fd, &srv->fdset));
usr.sbin/sdpd/server.c
618
assert(srv->fdidx[fd].valid);
usr.sbin/sdpd/server.c
620
close(fd);
usr.sbin/sdpd/server.c
622
FD_CLR(fd, &srv->fdset);
usr.sbin/sdpd/server.c
623
if (fd == srv->maxfd)
usr.sbin/sdpd/server.c
626
if (srv->fdidx[fd].rsp != NULL)
usr.sbin/sdpd/server.c
627
free(srv->fdidx[fd].rsp);
usr.sbin/sdpd/server.c
629
memset(&srv->fdidx[fd], 0, sizeof(srv->fdidx[fd]));
usr.sbin/sdpd/server.c
636
if (provider->fd == fd)
usr.sbin/sdpd/server.c
86
static void server_accept_client (server_p srv, int32_t fd);
usr.sbin/sdpd/server.c
87
static int32_t server_process_request (server_p srv, int32_t fd);
usr.sbin/sdpd/server.c
88
static int32_t server_send_error_response (server_p srv, int32_t fd,
usr.sbin/sdpd/server.c
90
static void server_close_fd (server_p srv, int32_t fd);
usr.sbin/sdpd/server.h
115
int32_t server_prepare_service_search_response(server_p srv, int32_t fd);
usr.sbin/sdpd/server.h
116
int32_t server_send_service_search_response(server_p srv, int32_t fd);
usr.sbin/sdpd/server.h
118
int32_t server_prepare_service_attribute_response(server_p srv, int32_t fd);
usr.sbin/sdpd/server.h
119
int32_t server_send_service_attribute_response(server_p srv, int32_t fd);
usr.sbin/sdpd/server.h
121
int32_t server_prepare_service_search_attribute_response(server_p srv, int32_t fd);
usr.sbin/sdpd/server.h
125
int32_t server_prepare_service_register_response(server_p srv, int32_t fd);
usr.sbin/sdpd/server.h
126
int32_t server_send_service_register_response(server_p srv, int32_t fd);
usr.sbin/sdpd/server.h
128
int32_t server_prepare_service_unregister_response(server_p srv, int32_t fd);
usr.sbin/sdpd/server.h
132
int32_t server_prepare_service_change_response(server_p srv, int32_t fd);
usr.sbin/sdpd/srr.c
102
srv->fdidx[fd].rsp_limit = srv->fdidx[fd].omtu - sizeof(sdp_pdu_t);
usr.sbin/sdpd/srr.c
103
srv->fdidx[fd].rsp_size = rsp - srv->fdidx[fd].rsp;
usr.sbin/sdpd/srr.c
104
srv->fdidx[fd].rsp_cs = 0;
usr.sbin/sdpd/srr.c
114
server_send_service_register_response(server_p srv, int32_t fd)
usr.sbin/sdpd/srr.c
120
assert(srv->fdidx[fd].rsp_size < srv->fdidx[fd].rsp_limit);
usr.sbin/sdpd/srr.c
124
pdu.len = htons(srv->fdidx[fd].rsp_size);
usr.sbin/sdpd/srr.c
129
iov[1].iov_base = srv->fdidx[fd].rsp;
usr.sbin/sdpd/srr.c
130
iov[1].iov_len = srv->fdidx[fd].rsp_size;
usr.sbin/sdpd/srr.c
133
size = writev(fd, (struct iovec const *) &iov, sizeof(iov)/sizeof(iov[0]));
usr.sbin/sdpd/srr.c
136
srv->fdidx[fd].rsp_cs = 0;
usr.sbin/sdpd/srr.c
137
srv->fdidx[fd].rsp_size = 0;
usr.sbin/sdpd/srr.c
138
srv->fdidx[fd].rsp_limit = 0;
usr.sbin/sdpd/srr.c
53
server_prepare_service_register_response(server_p srv, int32_t fd)
usr.sbin/sdpd/srr.c
57
uint8_t *rsp = srv->fdidx[fd].rsp;
usr.sbin/sdpd/srr.c
71
if (!srv->fdidx[fd].control ||
usr.sbin/sdpd/srr.c
72
!srv->fdidx[fd].priv || req_end - req < 8)
usr.sbin/sdpd/srr.c
94
provider = provider_register(profile, bdaddr, fd, req, req_end - req);
usr.sbin/sdpd/ssar.c
134
if (srv->fdidx[fd].rsp_cs != cs)
usr.sbin/sdpd/ssar.c
136
if (srv->fdidx[fd].rsp_size > 0)
usr.sbin/sdpd/ssar.c
168
srv->fdidx[fd].rsp_limit = srv->fdidx[fd].omtu - sizeof(sdp_pdu_t) - 2;
usr.sbin/sdpd/ssar.c
169
if (srv->fdidx[fd].rsp_limit > rsp_limit)
usr.sbin/sdpd/ssar.c
170
srv->fdidx[fd].rsp_limit = rsp_limit;
usr.sbin/sdpd/ssar.c
172
srv->fdidx[fd].rsp_size = rsp - srv->fdidx[fd].rsp;
usr.sbin/sdpd/ssar.c
173
srv->fdidx[fd].rsp_cs = 0;
usr.sbin/sdpd/ssar.c
176
rsp = srv->fdidx[fd].rsp;
usr.sbin/sdpd/ssar.c
178
SDP_PUT16(srv->fdidx[fd].rsp_size - 3, rsp);
usr.sbin/sdpd/ssar.c
50
server_prepare_service_search_attribute_response(server_p srv, int32_t fd)
usr.sbin/sdpd/ssar.c
54
uint8_t *rsp = srv->fdidx[fd].rsp;
usr.sbin/sdpd/ssr.c
152
server_prepare_service_search_response(server_p srv, int32_t fd)
usr.sbin/sdpd/ssr.c
156
uint8_t *rsp = srv->fdidx[fd].rsp;
usr.sbin/sdpd/ssr.c
198
if (srv->fdidx[fd].rsp_cs != cs)
usr.sbin/sdpd/ssr.c
200
if (srv->fdidx[fd].rsp_size > 0)
usr.sbin/sdpd/ssr.c
229
srv->fdidx[fd].rsp_limit = srv->fdidx[fd].omtu - sizeof(sdp_pdu_t) - 4;
usr.sbin/sdpd/ssr.c
230
srv->fdidx[fd].rsp_size = rsp - srv->fdidx[fd].rsp;
usr.sbin/sdpd/ssr.c
231
srv->fdidx[fd].rsp_cs = 0;
usr.sbin/sdpd/ssr.c
241
server_send_service_search_response(server_p srv, int32_t fd)
usr.sbin/sdpd/ssr.c
243
uint8_t *rsp = srv->fdidx[fd].rsp + srv->fdidx[fd].rsp_cs;
usr.sbin/sdpd/ssr.c
244
uint8_t *rsp_end = srv->fdidx[fd].rsp + srv->fdidx[fd].rsp_size;
usr.sbin/sdpd/ssr.c
254
srv->fdidx[fd].rsp_cs += size;
usr.sbin/sdpd/ssr.c
256
if (size + 1 > srv->fdidx[fd].rsp_limit) {
usr.sbin/sdpd/ssr.c
262
while ((rsp_end - rsp) + 3 > srv->fdidx[fd].rsp_limit) {
usr.sbin/sdpd/ssr.c
264
srv->fdidx[fd].rsp_cs -= 4;
usr.sbin/sdpd/ssr.c
268
cs[1] = srv->fdidx[fd].rsp_cs >> 8;
usr.sbin/sdpd/ssr.c
269
cs[2] = srv->fdidx[fd].rsp_cs & 0xff;
usr.sbin/sdpd/ssr.c
275
rcounts[0] = srv->fdidx[fd].rsp_size / 4; /* TotalServiceRecordCount */
usr.sbin/sdpd/ssr.c
298
size = writev(fd, (struct iovec const *) &iov, sizeof(iov)/sizeof(iov[0]));
usr.sbin/sdpd/ssr.c
302
if (srv->fdidx[fd].rsp_cs == srv->fdidx[fd].rsp_size) {
usr.sbin/sdpd/ssr.c
303
srv->fdidx[fd].rsp_cs = 0;
usr.sbin/sdpd/ssr.c
304
srv->fdidx[fd].rsp_size = 0;
usr.sbin/sdpd/ssr.c
305
srv->fdidx[fd].rsp_limit = 0;
usr.sbin/sdpd/sur.c
50
server_prepare_service_unregister_response(server_p srv, int32_t fd)
usr.sbin/sdpd/sur.c
54
uint8_t *rsp = srv->fdidx[fd].rsp;
usr.sbin/sdpd/sur.c
65
if (!srv->fdidx[fd].control ||
usr.sbin/sdpd/sur.c
66
!srv->fdidx[fd].priv || req_end - req < 4)
usr.sbin/sdpd/sur.c
74
if (provider == NULL || provider->fd != fd)
usr.sbin/sdpd/sur.c
81
srv->fdidx[fd].rsp_limit = srv->fdidx[fd].omtu - sizeof(sdp_pdu_t);
usr.sbin/sdpd/sur.c
82
srv->fdidx[fd].rsp_size = rsp - srv->fdidx[fd].rsp;
usr.sbin/sdpd/sur.c
83
srv->fdidx[fd].rsp_cs = 0;
usr.sbin/sliplogin/sliplogin.c
352
int fd, s, ldisc;
usr.sbin/sliplogin/sliplogin.c
366
for (fd = 3 ; fd < s ; fd++)
usr.sbin/sliplogin/sliplogin.c
367
close(fd);
usr.sbin/sliplogin/sliplogin.c
382
if ((fd = open(argv[2], O_RDWR)) == -1) {
usr.sbin/sliplogin/sliplogin.c
386
dup2(fd, 0);
usr.sbin/sliplogin/sliplogin.c
387
if (fd > 2)
usr.sbin/sliplogin/sliplogin.c
388
close(fd);
usr.sbin/sliplogin/sliplogin.c
493
if ((fd = open(_PATH_DEVNULL, O_WRONLY)) != 1) {
usr.sbin/sliplogin/sliplogin.c
494
if (fd < 0) {
usr.sbin/sliplogin/sliplogin.c
498
dup2(fd, 1);
usr.sbin/sliplogin/sliplogin.c
499
close(fd);
usr.sbin/syslogd/syslogd.c
2109
int fd;
usr.sbin/syslogd/syslogd.c
2142
if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
usr.sbin/syslogd/syslogd.c
2143
(void)dup2(fd, STDIN_FILENO);
usr.sbin/syslogd/syslogd.c
2144
(void)dup2(fd, STDOUT_FILENO);
usr.sbin/syslogd/syslogd.c
2145
(void)dup2(fd, STDERR_FILENO);
usr.sbin/syslogd/syslogd.c
2146
if (fd > 2)
usr.sbin/syslogd/syslogd.c
2147
(void)close (fd);
usr.sbin/syslogd/syslogd.c
2733
increase_rcvbuf(int fd)
usr.sbin/syslogd/syslogd.c
2739
if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &len, &slen) == 0) {
usr.sbin/syslogd/syslogd.c
2742
setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &len, sizeof(len));
usr.sbin/sysvipcd/shmd.c
106
fd = open(filename, O_RDWR | O_CREAT, 0666);
usr.sbin/sysvipcd/shmd.c
107
if (fd < 0) {
usr.sbin/sysvipcd/shmd.c
112
ftruncate(fd, size);
usr.sbin/sysvipcd/shmd.c
117
addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
usr.sbin/sysvipcd/shmd.c
160
addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
usr.sbin/sysvipcd/shmd.c
220
return (fd);
usr.sbin/sysvipcd/shmd.c
222
close(fd);
usr.sbin/sysvipcd/shmd.c
228
install_fd_client(pid_t pid, int fd) {
usr.sbin/sysvipcd/shmd.c
236
ret = send_fd(cl->sock, fd);
usr.sbin/sysvipcd/shmd.c
304
close(internal->fd);
usr.sbin/sysvipcd/shmd.c
460
handle->fd = create_sysv_file(shmget_msg, size, shmseg);
usr.sbin/sysvipcd/shmd.c
461
if (handle->fd == -1) {
usr.sbin/sysvipcd/shmd.c
472
if (handle->fd < 0) {
usr.sbin/sysvipcd/shmd.c
567
if (install_fd_client(pid, handle->fd) != 0)
usr.sbin/sysvipcd/shmd.c
579
int fd;
usr.sbin/sysvipcd/shmd.c
610
fd = ((struct shm_handle*)shmseg->shm_internal)->fd;
usr.sbin/sysvipcd/shmd.c
611
ftruncate(fd, round_page(new_size));
usr.sbin/sysvipcd/shmd.c
789
int fd;
usr.sbin/sysvipcd/shmd.c
79
int fd;
usr.sbin/sysvipcd/shmd.c
807
fd = internal->fd;
usr.sbin/sysvipcd/shmd.c
811
addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
usr.sbin/sysvipcd/sysvipcd.c
114
poll_fds[SOCKET_FD_IDX].fd = socket_fd;
usr.sbin/sysvipcd/sysvipcd.c
149
cl->sock = handle_new_connection(poll_fds[SOCKET_FD_IDX].fd);
usr.sbin/sysvipcd/sysvipcd.c
151
poll_fds[nr_poll_fds].fd = cl->sock;
usr.sbin/sysvipcd/utilsd.h
76
int fd;
usr.sbin/traceroute6/traceroute6.c
812
pfd[0].fd = sock;
usr.sbin/trpt/trpt.c
454
klseek(int fd, off_t base, int off)
usr.sbin/trpt/trpt.c
456
lseek(fd, base, off);
usr.sbin/tzsetup/tzsetup.c
1026
fd = open(path_wall_cmos_clock,
usr.sbin/tzsetup/tzsetup.c
1029
if (fd < 0) {
usr.sbin/tzsetup/tzsetup.c
1034
close(fd);
usr.sbin/tzsetup/tzsetup.c
899
int fd;
usr.sbin/uefisign/child.c
54
int error, fd;
usr.sbin/uefisign/child.c
59
fd = fileno(x->x_fp);
usr.sbin/uefisign/child.c
61
error = fstat(fd, &sb);
usr.sbin/usbdump/usbdump.c
686
cc = read(p->fd, (uint8_t *)p->buffer, p->bufsize);
usr.sbin/usbdump/usbdump.c
78
int fd; /* fd for /dev/usbpf */
usr.sbin/usbdump/usbdump.c
810
int fd;
usr.sbin/usbdump/usbdump.c
893
p->fd = fd = open("/dev/bpf", O_RDONLY);
usr.sbin/usbdump/usbdump.c
894
if (p->fd < 0)
usr.sbin/usbdump/usbdump.c
897
if (ioctl(fd, BIOCVERSION, (caddr_t)&bv) < 0)
usr.sbin/usbdump/usbdump.c
922
(void)ioctl(fd, BIOCSBLEN, (caddr_t)&v);
usr.sbin/usbdump/usbdump.c
924
if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) >= 0)
usr.sbin/usbdump/usbdump.c
930
if (ioctl(fd, BIOCGBLEN, (caddr_t)&v) < 0)
usr.sbin/usbdump/usbdump.c
940
if (ioctl(p->fd, BIOCSETF, (caddr_t)&total_prog) < 0)
usr.sbin/usbdump/usbdump.c
948
if (ioctl(p->fd, BIOCSRTIMEOUT, (caddr_t)&tv) < 0)
usr.sbin/usbdump/usbdump.c
955
if (ioctl(fd, BIOCGSTATS, (caddr_t)&us) < 0)
usr.sbin/usbdump/usbdump.c
975
if (p->fd > 0)
usr.sbin/usbdump/usbdump.c
976
close(p->fd);
usr.sbin/vidcontrol/decode.c
37
decode(FILE *fd, char *buffer, int len)
usr.sbin/vidcontrol/decode.c
47
if (!fgets(temp, sizeof(temp), fd))
usr.sbin/vidcontrol/decode.c
53
if (!fgets(p = temp, sizeof(temp), fd))
usr.sbin/vidcontrol/decode.c
95
if (!fgets(temp, sizeof(temp), fd) || strcmp(temp, "end\n"))
usr.sbin/vidcontrol/decode.h
4
int decode(FILE *fd, char *buffer, int len);
usr.sbin/vidcontrol/vidcontrol.c
246
FILE *fd;
usr.sbin/vidcontrol/vidcontrol.c
255
fd = openguess(a, b, c, d, &name);
usr.sbin/vidcontrol/vidcontrol.c
257
if (fd == NULL) {
usr.sbin/vidcontrol/vidcontrol.c
264
if (decode(fd, (char *)&scrnmap, size) != size) {
usr.sbin/vidcontrol/vidcontrol.c
265
rewind(fd);
usr.sbin/vidcontrol/vidcontrol.c
267
if (fread(&scrnmap, 1, size, fd) != (size_t)size) {
usr.sbin/vidcontrol/vidcontrol.c
268
fclose(fd);
usr.sbin/vidcontrol/vidcontrol.c
279
fclose(fd);
usr.sbin/vidcontrol/vidcontrol.c
355
FILE *fd;
usr.sbin/vidcontrol/vidcontrol.c
383
fd = openguess(a, b, c, d, &name);
usr.sbin/vidcontrol/vidcontrol.c
385
if (fd == NULL) {
usr.sbin/vidcontrol/vidcontrol.c
402
fclose(fd);
usr.sbin/vidcontrol/vidcontrol.c
414
dsize[0] = decode(fd, fontmap, size);
usr.sbin/vidcontrol/vidcontrol.c
415
dsize[1] = fsize(fd);
usr.sbin/vidcontrol/vidcontrol.c
432
fclose(fd);
usr.sbin/vidcontrol/vidcontrol.c
437
rewind(fd);
usr.sbin/vidcontrol/vidcontrol.c
442
if (decode(fd, fontmap, size) != size) {
usr.sbin/vidcontrol/vidcontrol.c
443
rewind(fd);
usr.sbin/vidcontrol/vidcontrol.c
444
if (fsize(fd) != size ||
usr.sbin/vidcontrol/vidcontrol.c
445
fread(fontmap, 1, size, fd) != (size_t)size) {
usr.sbin/vidcontrol/vidcontrol.c
446
fclose(fd);
usr.sbin/vidcontrol/vidcontrol.c
458
fclose(fd);
usr.sbin/vknetd/bridge.c
105
write(scan->io->fd, pkt, bytes);
usr.sbin/vknetd/bridge.c
99
write(mac->bridge->io->fd, pkt, bytes);
usr.sbin/vknetd/vknetd.c
178
if (tap_info && tap_info->fd >= 0) {
usr.sbin/vknetd/vknetd.c
180
ioctl(tap_info->fd, FIOSETOWN, &pid);
usr.sbin/vknetd/vknetd.c
319
info->fd = tap_fd;
usr.sbin/vknetd/vknetd.c
393
info->fd = rfd;
usr.sbin/vknetd/vknetd.c
423
while ((bytes = read(info->fd, pkt, MAXPKT)) > 0) {
usr.sbin/vknetd/vknetd.c
436
close(info->fd);
usr.sbin/vknetd/vknetd.h
92
int fd;
usr.sbin/vnconfig/vnconfig.c
372
int fd;
usr.sbin/vnconfig/vnconfig.c
376
fd = open(file, O_RDWR|O_CREAT|O_TRUNC, 0600);
usr.sbin/vnconfig/vnconfig.c
378
fd = open(file, O_RDWR);
usr.sbin/vnconfig/vnconfig.c
379
if (fd >= 0 && fstat(fd, &st) == 0 && S_ISREG(st.st_mode)) {
usr.sbin/vnconfig/vnconfig.c
381
ftruncate(fd, vnp->size * pgsize);
usr.sbin/vnconfig/vnconfig.c
391
if (write(fd, buf, n) != n) {
usr.sbin/vnconfig/vnconfig.c
392
ftruncate(fd, 0);
usr.sbin/vnconfig/vnconfig.c
400
close(fd);
usr.sbin/watchdogd/watchdogd.c
136
if ((fd = open("/dev/wdog", O_RDWR)) == -1) {
usr.sbin/watchdogd/watchdogd.c
159
if (ioctl(fd, WDIOCRESET, &period, sizeof(period)) == -1)
usr.sbin/watchdogd/watchdogd.c
164
close(fd);
usr.sbin/watchdogd/watchdogd.c
62
int fd, ch, trigauto, sauto, speriod;
usr.sbin/ypbind/ypbind.c
811
int fd;
usr.sbin/ypbind/ypbind.c
904
if ((fd = open(path, O_CREAT|O_SHLOCK|O_RDWR|O_TRUNC, 0644)) == -1) {
usr.sbin/ypbind/ypbind.c
906
if ((fd = open(path, O_CREAT|O_SHLOCK|O_RDWR|O_TRUNC, 0644)) == -1)
usr.sbin/ypbind/ypbind.c
910
if ((fd = open(path, O_CREAT|O_RDWR|O_TRUNC, 0644)) == -1) {
usr.sbin/ypbind/ypbind.c
912
if ((fd = open(path, O_CREAT|O_RDWR|O_TRUNC, 0644)) == -1)
usr.sbin/ypbind/ypbind.c
915
flock(fd, LOCK_SH);
usr.sbin/ypbind/ypbind.c
922
ypdb->dom_lockfd = fd;