Lines Matching refs:fd

133 	 * the translation mode of the fd in the Borland RTL (heavy
257 int fd = PerlLIO_dup(PerlIO_fileno(f));
258 if (fd >= 0) {
260 int omode = fcntl(fd, F_GETFL);
266 return PerlIO_fdopen(fd, mode);
285 PerlIO_openn(pTHX_ const char *layers, const char *mode, int fd,
297 fd = PerlLIO_open3(name, imode, perm);
298 if (fd >= 0)
299 return PerlIO_fdopen(fd, (char *) mode + 1);
310 return PerlIO_fdopen(fd, (char *) mode);
398 int fd = fileno(stdio);
402 return PerlIO_fdopen(fd, mode);
408 int fd = PerlIO_fileno(pio);
409 FILE *f = fdopen(fd, "r+");
412 f = fdopen(fd, "w");
414 f = fdopen(fd, "r");
1476 PerlIO_openn(pTHX_ const char *layers, const char *mode, int fd,
1532 tab->name, layers, mode, fd, imode, perm,
1535 f = (*tab->Open) (aTHX_ tab, layera, n, mode, fd, imode, perm,
1871 IV n, const char *mode, int fd, int imode, int perm,
1876 return (*tab->Open) (aTHX_ tab, layers, n - 1, mode, fd, imode, perm,
2209 PerlIOUnix_refcnt_inc(int fd)
2211 if (fd >= 0 && fd < PERLIO_MAX_REFCOUNTABLE_FD) {
2215 PerlIO_fd_refcnt[fd]++;
2216 PerlIO_debug("fd %d refcnt=%d\n",fd,PerlIO_fd_refcnt[fd]);
2224 PerlIOUnix_refcnt_dec(int fd)
2227 if (fd >= 0 && fd < PERLIO_MAX_REFCOUNTABLE_FD) {
2231 cnt = --PerlIO_fd_refcnt[fd];
2232 PerlIO_debug("fd %d refcnt=%d\n",fd,cnt);
2276 int fd; /* UNIX like file descriptor */
2339 return PerlIOSelf(f, PerlIOUnix)->fd;
2343 PerlIOUnix_setfd(pTHX_ PerlIO *f, int fd, int imode)
2348 if (PerlLIO_fstat(fd, &st) == 0) {
2350 PerlIO_debug("%d is not regular file\n",fd);
2354 PerlIO_debug("%d _is_ a regular file\n",fd);
2358 s->fd = fd;
2360 PerlIOUnix_refcnt_inc(fd);
2386 int fd = PerlIOSelf(f, PerlIOUnix)->fd;
2396 new = PerlLIO_lseek(fd, offset, whence);
2407 IV n, const char *mode, int fd, int imode,
2423 fd = PerlLIO_open3(path, imode, perm);
2426 if (fd >= 0) {
2437 PerlIOUnix_setfd(aTHX_ f, fd, imode);
2457 int fd = os->fd;
2459 fd = PerlLIO_dup(fd);
2461 if (fd >= 0 && fd < PERLIO_MAX_REFCOUNTABLE_FD) {
2464 /* If all went well overwrite fd in dup'ed lay with the dup()'ed fd */
2465 PerlIOUnix_setfd(aTHX_ f, fd, os->oflags);
2476 int fd = PerlIOSelf(f, PerlIOUnix)->fd;
2482 SSize_t len = PerlLIO_read(fd, vbuf, count);
2502 int fd = PerlIOSelf(f, PerlIOUnix)->fd;
2504 SSize_t len = PerlLIO_write(fd, vbuf, count);
2520 return PerlLIO_lseek(PerlIOSelf(f, PerlIOUnix)->fd, 0, SEEK_CUR);
2527 int fd = PerlIOSelf(f, PerlIOUnix)->fd;
2530 if (PerlIOUnix_refcnt_dec(fd) > 0) {
2539 while (PerlLIO_close(fd) != 0) {
2639 int fd = PerlIO_fileno(n);
2642 if (fd >= 0 && (stdio = PerlSIO_fdopen(fd,
2667 we dup() so that we can fclose without loosing the fd.
2672 int fd = PerlLIO_dup(fileno(stdio));
2673 FILE *f2 = PerlSIO_fdopen(fd, (mode = "r+"));
2675 f2 = PerlSIO_fdopen(fd, (mode = "w"));
2678 f2 = PerlSIO_fdopen(fd, (mode = "r"));
2682 PerlLIO_close(fd);
2697 IV n, const char *mode, int fd, int imode,
2719 fd = PerlLIO_open3(path, imode, perm);
2750 if (fd >= 0) {
2758 switch (fd) {
2771 stdio = PerlSIO_fdopen(fd, mode =
2799 int fd = fileno(stdio);
2813 stdio = PerlSIO_fdopen(fd, PerlIO_modestr(o,mode));
2867 f->fd = PerlLIO_dup(fileno(f));
2896 int fd = fileno(stdio);
2909 if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (void *) &optval, &optlen) == 0) {
2914 if (PerlIOUnix_refcnt_dec(fd) > 0) {
2930 /* Tricky - must fclose(stdio) to free memory but not close(fd)
2937 dupfd = PerlLIO_dup(fd);
2950 result = close(fd);
2953 PerlLIO_dup2(dupfd,fd);
3390 int fd = PerlIO_fileno(f);
3391 if (fd >= 0 && PerlLIO_isatty(fd)) {
3405 IV n, const char *mode, int fd, int imode, int perm,
3414 (*tab->Open)(aTHX_ tab, layers, n - 1, mode, fd, imode, perm,
3430 f = (*tab->Open)(aTHX_ tab, layers, n - 1, mode, fd, imode, perm,
3442 fd = PerlIO_fileno(f);
3443 if (init && fd == 2) {
3451 if (PERLIO_IS_BINMODE_FD(fd))
3458 PerlLIO_setmode(fd, O_BINARY);
4364 int fd = PerlIO_fileno(f);
4366 code = Fstat(fd, &st);
4417 m->mptr = mmap(NULL, len, PROT_READ, MAP_SHARED, fd, posn);
4717 PerlIO_fdopen(int fd, const char *mode)
4720 return PerlIO_openn(aTHX_ Nullch, mode, fd, 0, 0, NULL, 0, NULL);
4847 int fd = -1;
4849 fd = win32_tmpfd();
4850 if (fd >= 0)
4851 f = PerlIO_fdopen(fd, "w+b");
4859 fd = mkstemp(SvPVX(sv));
4860 if (fd >= 0) {
4861 f = PerlIO_fdopen(fd, "w+");
4972 vfprintf(FILE *fd, char *pat, char *args)
4974 _doprnt(pat, args, fd);