Searched refs:fd (Results 1 - 25 of 2839) sorted by path

1234567891011>>

/freebsd-current/bin/cat/
H A Dcat.c234 int fd, i; local
241 fd = -1;
245 fd = STDIN_FILENO;
248 fd = fileargs_open(fa, path);
250 if (fd < 0 && errno == EOPNOTSUPP)
251 fd = udom_open(path, O_RDONLY);
254 if (fd < 0) {
259 if (fd == STDIN_FILENO)
262 fp = fdopen(fd, "r");
269 if (in_kernel_copy(fd) !
441 int error, fd, serrno; local
[all...]
/freebsd-current/bin/cp/tests/
H A Dsparse.c26 int fd; local
28 if ((fd = open(filename, O_RDONLY)) < 0 ||
29 (hole = lseek(fd, 0, SEEK_HOLE)) < 0 ||
30 (end = lseek(fd, 0, SEEK_END)) < 0)
32 close(fd);
/freebsd-current/bin/cp/
H A Dutils.c122 * like /proc/X/fd/Y which stat(2) reports as S_IFREG but
313 setfile(struct stat *fs, int fd) argument
320 fdval = fd != -1;
327 if (fdval ? futimens(fd, tspec) : utimensat(AT_FDCWD, to.p_path, tspec,
332 if (fdval ? fstat(fd, &ts) :
347 if (fdval ? fchown(fd, fs->st_uid, fs->st_gid) :
358 if (fdval ? fchmod(fd, fs->st_mode) :
367 fchflags(fd, fs->st_flags) :
/freebsd-current/bin/dd/
H A Ddd.c116 if (close(out.fd) == -1 && errno != EINTR)
141 in.fd = STDIN_FILENO;
147 in.fd = open(in.name, O_RDONLY | iflags, 0);
149 if (in.fd == -1)
156 if (caph_rights_limit(in.fd, &rights) == -1)
167 out.fd = STDOUT_FILENO;
170 oflags = fcntl(out.fd, F_GETFL);
172 err(1, "unable to get fd flags for stdout");
174 if (fcntl(out.fd, F_SETFL, oflags) == -1)
175 err(1, "unable to set fd flag
[all...]
H A Ddd.h53 int fd; /* file descriptor */ member in struct:__anon2
H A Dposition.c94 if (lseek(in.fd, seek_offset(&in), SEEK_CUR) == -1 &&
110 if ((nr = read(in.fd, in.db, bcnt)) > 0) {
164 if (lseek(out.fd, seek_offset(&out), SEEK_CUR) == -1 &&
179 if (ioctl(out.fd, MTIOCTOP, &t_op) == -1)
187 n = read(out.fd, out.db, out.dbsz);
201 if (ioctl(out.fd, MTIOCTOP, &t_op) == -1)
206 n = write(out.fd, out.db, out.dbsz);
/freebsd-current/bin/ed/
H A Dbuf.c192 int fd; local
198 if ((fd = mkstemp(sfn)) == -1 ||
199 (sfp = fdopen(fd, "w+")) == NULL) {
200 if (fd != -1)
201 close(fd);
/freebsd-current/bin/pax/
H A Dar_io.c1233 * to keep the fd the same in the calling function (parent).
1236 ar_start_gzip(int fd, const char *gzip_prog, int wr) argument
1250 dup2(fds[1], fd);
1252 dup2(fds[0], fd);
1258 dup2(fd, STDOUT_FILENO);
1262 dup2(fd, STDIN_FILENO);
H A Dar_subs.c151 int fd; local
304 if ((fd = file_creat(arcn)) < 0) {
313 res = (*frmt->rd_data)(arcn, fd, &cnt);
314 file_close(arcn, fd);
357 int fd = -1; local
400 fd = -1;
428 if ((fd = open(arcn->org_name, O_RDONLY, 0)) < 0) {
444 rdfile_close(arcn, &fd);
449 if ((res > 0) || (docrc && (set_crc(arcn, fd) < 0))) {
454 rdfile_close(arcn, &fd);
[all...]
H A Dfile_subs.c71 int fd = -1; local
87 if ((fd = open(arcn->name, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL,
89 return(fd);
105 if ((fd = open(arcn->name, O_WRONLY | O_CREAT | O_TRUNC,
114 return(fd);
126 file_close(ARCHD *arcn, int fd) argument
130 if (fd < 0)
132 if (close(fd) < 0)
742 file_write(int fd, char *str, int cnt, int *rem, int *isempt, int sz, argument
789 if (lseek(fd, (off_
823 file_flush(int fd, char *fname, int isempt) argument
854 rdfile_close(ARCHD *arcn, int *fd) argument
884 set_crc(ARCHD *arcn, int fd) argument
[all...]
/freebsd-current/bin/pax/tests/
H A Dlegacy_test.pl16 open my $fd, ">", $fn or die "$fn: $!";
17 print $fd "file $n\n";
/freebsd-current/bin/pkill/tests/
H A Dspin_helper.c94 int fd; local
101 fd = open(argv[2], O_RDWR | O_CREAT, 0755);
102 if (fd < 0)
104 close(fd);
/freebsd-current/bin/sh/
H A Deval.c644 result->fd = -1;
694 result->fd = pip[0];
698 TRACE(("evalbackcmd done: fd=%d buf=%p nleft=%d jp=%p\n",
699 result->fd, result->buf, result->nleft, result->jp));
1158 backcmd->fd = pip[0];
H A Deval.h40 int fd; /* file descriptor to read from */ member in struct:backcmd
H A Dexpand.c481 if (in.fd < 0)
483 while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR)
513 if (in.fd >= 0)
514 close(in.fd);
1506 int fd = -1; local
1512 fd = number(shoptarg);
1521 if (fd < 0)
1522 error("missing fd");
1524 setinputfd(fd, 1);
1527 popfile(); /* will also close fd */
[all...]
H A Dhistedit.c102 int fd; local
113 fd = mkstemp(histtmpname);
114 if (fd == -1 || (f = fdopen(fd, "w")) == NULL) {
380 int fd; local
383 if ((fd = mkstemp(editfilestr)) < 0)
386 if ((efp = fdopen(fd, "w")) == NULL) {
387 close(fd);
H A Dinput.c77 int fd; /* file descriptor (or -1 if string) */ member in struct:parsefile
132 if (parsefile->fd == 0 && el) {
155 nr = read(parsefile->fd, parsefile->buf, BUFSIZ);
161 if (parsefile->fd == 0 && errno == EWOULDBLOCK) {
247 if (parsefile->fd == 0 && hist &&
359 int fd; local
367 if ((fd = open(fname, oflags)) < 0) {
372 if (fd < 10) {
373 fd2 = fcntl(fd, F_DUPFD_CLOEXEC, 10);
374 close(fd);
390 setinputfd(int fd, int push) argument
[all...]
H A Djobs.c1360 if (n->nfile.fd != deffd) {
1361 s[0] = n->nfile.fd + '0';
H A Dmain.c246 int fd; local
257 if ((fd = open(expandedname, oflags)) >= 0)
258 setinputfd(fd, 1);
260 if (fd < 0)
H A Dmiscbltin.c63 int fd; member in struct:fdctx
78 fdctx_init(int fd, struct fdctx *fdc) argument
82 /* Check if fd is seekable. */
83 cur = lseek(fd, 0, SEEK_CUR);
85 .fd = fd,
97 nread = read(fdc->fd, fdc->buf, fdc->buflen);
130 (void) lseek(fdc->fd, -residue, SEEK_CUR);
H A Doutput.h46 short fd; member in struct:output
50 extern struct output output; /* to fd 1 */
51 extern struct output errout; /* to fd 2 */
H A Dparser.c740 synerror("Bad fd number");
1021 * specifying the fd to be redirected. The variable "c" contains the
1028 char fd = *out; local
1033 np->nfile.fd = 1;
1046 np->nfile.fd = 0;
1051 np->nfile.fd = 0;
1071 if (fd != '\0')
1072 np->nfile.fd = digit_val(fd);
H A Dredir.c60 #define CLOSED -1 /* fd was not open before redir */
108 int fd; local
129 fd = n->nfile.fd;
130 if (fd == 0)
133 n->ndup.dupfd == fd)
136 if ((flags & REDIR_PUSH) && sv->renamed[fd] == EMPTY) {
138 if ((i = fcntl(fd, F_DUPFD_CLOEXEC, 10)) == -1) {
145 error("%d: %s", fd, strerror(errno));
149 sv->renamed[fd]
168 int fd = redir->nfile.fd; local
[all...]
H A Dshow.c145 if (np->nfile.fd != dftfd)
146 fprintf(fp, "%d", np->nfile.fd);
/freebsd-current/bin/stty/
H A Dkey.c189 (void)ioctl(ip->fd, TIOCEXT, &tmp);
192 (void)ioctl(ip->fd, TIOCEXT, &tmp);
283 if (ioctl(ip->fd, TIOCSETD, &tmp) < 0)

Completed in 413 milliseconds

1234567891011>>