Lines Matching refs:fd
62 /* the fake fd that's seen by the user */
89 * to both protect the fd list and to prevent LogStates from being
117 * Allocate an fd and associate a new LogState with it.
118 * The fd is available via the fakeFd field of the return value.
135 * Translate an fd to a LogState.
137 static LogState *fdToLogState(int fd)
139 if (fd >= FAKE_FD_BASE && fd < FAKE_FD_BASE + MAX_OPEN_LOGS) {
140 return openLogTable[fd - FAKE_FD_BASE];
146 * Unregister the fake fd and free the memory it pointed to.
148 static void deleteFakeFd(int fd)
154 ls = fdToLogState(fd);
156 openLogTable[fd - FAKE_FD_BASE] = NULL;
322 static ssize_t fake_writev(int fd, const struct iovec *iov, int iovcnt) {
326 int w = write(fd, iov->iov_base, iov->iov_len);
542 static ssize_t logWritev(int fd, const struct iovec* vector, int count)
552 state = fdToLogState(fd);
605 static int logClose(int fd)
607 deleteFakeFd(fd);
612 * Open a log output device and return a fake fd.
617 int fd = -1;
624 fd = logState->fakeFd;
631 return fd;
642 static int (*redirectClose)(int fd) = NULL;
643 static ssize_t (*redirectWritev)(int fd, const struct iovec* vector, int count)
675 int fakeLogClose(int fd)
678 return redirectClose(fd);
681 ssize_t fakeLogWritev(int fd, const struct iovec* vector, int count)
684 return redirectWritev(fd, vector, count);