Searched refs:fd (Results 1 - 25 of 289) sorted by relevance

1234567891011>>

/ast/src/lib/libast/stdio/
H A D_stdopen.c29 _stdopen(int fd, const char* mode) argument
31 return fdopen(fd, mode);
H A Dfdopen.c27 fdopen(int fd, const char* mode) argument
31 if (fd < 0 || !(flags = _sftype(mode, NiL, NiL, NiL)))
33 return sfnew(NiL, NiL, (size_t)SF_UNBOUND, fd, flags);
/ast/src/lib/libcs/
H A Dcscontrol.c25 * output control mark on fd
31 cscontrol(register Cs_t* state, int fd) argument
34 return send(fd, "", 1, MSG_OOB) == 1 ? 0 : -1;
40 return putmsg(fd, NiL, &buf, RS_HIPRI);
42 return write(fd, "", 1) == 1 ? 0 : -1;
48 _cs_control(int fd) argument
50 return cscontrol(&cs, fd);
H A Dcspeek.c33 * peek up to siz chars from fd into buf
34 * -1 returned if fd not peekable
36 * NOTE: cspeek() caches the peek state of fd
41 cspeek(register Cs_t* state, int fd, void* buf, size_t siz) argument
48 if (fd == -1)
59 if (fd != state->nostream)
68 if ((n = ioctl(fd, I_PEEK, &pk)) >= 0)
74 messagef((state->id, NiL, -1, "peek: %d: ioctl I_PEEK error", fd));
75 state->nostream = fd;
79 if (fd !
95 _cs_peek(int fd, void* buf, size_t siz) argument
[all...]
H A Dcsping.c36 register int fd; local
40 if ((fd = csopen(state, state->temp, 0)) < 0) return -1;
41 n = (cswrite(state, fd, M, N) != N || csread(state, fd, state->temp, N, CS_LINE) != N || strncmp(M, state->temp, N)) ? -1 : 0;
42 close(fd);
/ast/src/cmd/3d/
H A Dfchdir3d.c29 fchdir3d(int fd) argument
34 if (fd >= 0 && fd < elementsof(state.file) && (dp = state.file[fd].dir) && !FSTAT(fd, &st) && dp->dev == st.st_dev && dp->ino == st.st_ino)
36 else if (FCHDIR(fd))
H A Dclose3d.c27 close3d(int fd) argument
30 if (fd >= 0 && fd < elementsof(state.file))
39 if (state.file[fd].dir)
41 free(state.file[fd].dir);
42 state.file[fd].dir = 0;
45 if (rp = state.file[fd].reserved)
47 if ((nfd = FCNTL(fd, F_DUPFD, fd + 1)) < 0)
55 state.file[fd]
[all...]
H A Dfsync3d.c29 fsync3d(int fd) argument
34 if (!fscall(NiL, MSG_fsync, 0, fd))
38 if (FSYNC(fd))
42 fscall(mp, MSG_fsync, 0, fd);
45 fscall(mp, MSG_fsync, 0, fd);
H A Dfchmod3d.c29 fchmod3d(int fd, mode_t mode) argument
34 if (!fscall(NiL, MSG_fchmod, 0, fd, mode))
38 if (FCHMOD(fd, mode))
42 fscall(mp, MSG_fchmod, 0, fd, mode);
45 fscall(mp, MSG_fchmod, 0, fd, mode);
H A Dfchown3d.c29 fchown3d(int fd, uid_t uid, gid_t gid) argument
34 if (!fscall(NiL, MSG_fchown, 0, fd, uid, gid))
38 if (FCHOWN(fd, uid, gid))
42 fscall(mp, MSG_fchown, 0, fd, uid, gid);
45 fscall(mp, MSG_fchown, 0, fd, uid, gid);
H A Dfpathconf3d.c29 fpathconf3d(int fd, int op) argument
36 if (!fscall(NiL, MSG_fpathconf, 0, fd, op))
42 r = FPATHCONF(fd, op);
48 fscall(mp, MSG_fpathconf, 0, fd, op);
51 fscall(mp, MSG_fpathconf, 0, fd, op);
H A Dfstatvfs3d.c31 fstatvfs3d(int fd, struct statvfs* fs) argument
36 if (!fscall(NiL, MSG_fstatfs, 0, fd, fs))
40 if (FSTATVFS(fd, fs))
44 fscall(mp, MSG_fstatfs, 0, fd, fs);
47 fscall(mp, MSG_fstatfs, 0, fd, fs);
H A Dfcntl3d.c31 fcntl3d(int fd, int op, ...) argument
45 r = FCNTL(fd, op, arg);
51 fs3d_dup(fd, r);
57 state.file[fd].flags &= ~FILE_CLOEXEC;
58 else if (!(state.file[fd].flags & FILE_OPEN))
59 fileinit(fd, NiL, NiL, 1);
61 state.file[fd].flags |= FILE_CLOEXEC;
H A Dread3d.c29 read3d(int fd, void* buf, size_t n) argument
37 if (!fscall(NiL, MSG_read, 0, fd, buf, n))
41 r = READ(fd, buf, n);
50 off = LSEEK(fd, 0, SEEK_CUR) - r;
52 fscall(mp, r, MSG_read3d, fd, buf, n, off);
60 off = LSEEK(fd, 0, SEEK_CUR) - r;
62 fscall(mp, MSG_read3d, r, fd, buf, n, off);
H A Dwrite3d.c29 write3d(int fd, const void* buf, size_t n) argument
37 if (!fscall(NiL, MSG_write, 0, fd, buf, n))
41 r = WRITE(fd, buf, n);
50 off = LSEEK(fd, 0, SEEK_CUR) - r;
52 fscall(mp, MSG_write3d, r, fd, buf, n, off);
60 off = LSEEK(fd, 0, SEEK_CUR) - r;
62 fscall(mp, MSG_write3d, r, fd, buf, n, off);
/ast/src/lib/libast/comp/
H A Dsetsid.c44 int fd;
63 if ((fd = open("/dev/tty", O_RDONLY|O_cloexec)) >= 0)
65 ioctl(fd, TIOCNOTTY, 0);
66 close(fd);
H A Dfsync.c39 fsync(int fd)
41 NoP(fd);
H A Dcloselog.c40 if (log.fd >= 0)
42 close(log.fd);
43 log.fd = -1;
H A Dreadlink.c43 int fd;
48 if ((fd = open(path, O_RDONLY|O_cloexec)) < 0)
50 if (read(fd, buf, sizeof(FAKELINK_MAGIC)) == sizeof(FAKELINK_MAGIC) && !strcmp(buf, FAKELINK_MAGIC) && (n = read(fd, buf, siz)) > 0 && !buf[n - 1])
52 close(fd);
55 close(fd);
/ast/src/lib/libcoshell/
H A Dcosync.c25 * sync all outstanding file operations for file opened on fd
26 * if file==0 then fd used
27 * if fd<0 then file used
28 * if mode<0 then fd not created
40 cosync(Coshell_t* co, const char* file, int fd, int mode) argument
73 if (fd >= 0 && mode >= 0)
77 close(fd);
78 dup2(td, fd);
88 if (fd < 0)
90 if (!file || mode < 0 || (fd
[all...]
/ast/src/cmd/tests/sfio/
H A Dtsetbuf.c29 int n, fd; local
46 if((fd = creat(tstfile("sf", 0),0666)) < 0)
49 if(write(fd,buf,sizeof(buf)) != sizeof(buf))
51 if(lseek(fd, (off_t)0, 0) < 0)
54 if(!(f = sfnew((Sfio_t*)0,buf,sizeof(buf),fd,SF_WRITE)))
62 if((fd+NEXTFD) < (sizeof(fdv)/sizeof(fdv[0])) )
65 for(i = 0; i < fd+NEXTFD; ++i)
68 if((n = sfsetfd(f,fd+NEXTFD)) != fd+NEXTFD)
69 terror("Try to set file descriptor to %d but get %d",fd
[all...]
H A Dtsetfd.c25 int fd; local
30 fd = sffileno(f);
37 if(sfsetfd(f,fd) != fd)
49 if((sk = lseek(fd, (off_t)0, 1)) != (off_t)1)
54 if(sfsetfd(f,fd) != fd)
/ast/src/lib/libast/vec/
H A Dvecfile.c44 int fd; local
48 if ((fd = open(file, O_RDONLY|O_cloexec)) >= 0)
50 if (!fstat(fd, &st) && S_ISREG(st.st_mode) && (n = st.st_size) > 0 && (buf = newof(0, char, n + 1, 0)))
52 if (read(fd, buf, n) == n)
59 close(fd);
/ast/src/lib/libast/aso/
H A Daso-fcntl.c38 int fd;
52 int fd;
65 if (fcntl(apl->fd, F_SETLKW, &lock) >= 0)
67 if (lseek(apl->fd, apl->size, SEEK_SET) != apl->size)
69 else if (read(apl->fd, &references, sizeof(references)) != sizeof(references))
74 if (lseek(apl->fd, apl->size, SEEK_SET) != apl->size)
76 else if (write(apl->fd, &references, sizeof(references)) != sizeof(references))
80 fcntl(apl->fd, F_SETLK, &lock);
84 close(apl->fd);
88 fd
[all...]
/ast/src/lib/libast/port/
H A Dastwinsize.c72 astwinsize(int fd, register int* rows, register int* cols) argument
78 if (!ttctl(fd, TIOCGWINSZ, &ws) && ws.ws_col > 0 && ws.ws_row > 0)
89 if (!ttctl(fd, TIOCGSIZE, &ts) && ts.ts_lines > 0 && ts.ts_cols > 0)
100 if (!ttctl(fd, JWINSIZE, &ws) && ws.bytesx > 0 && ws.bytesy > 0)
124 ttctl(register int fd, int op, void* tt) argument
128 if (fd < 0)
130 for (fd = 0; fd <= 2; fd++)
131 if (!ioctl(fd, o
[all...]

Completed in 67 milliseconds

1234567891011>>