pike.git / src / modules / _Stdio / file.c

version» Context lines:

pike.git/src/modules/_Stdio/file.c:138: Inside #if defined(__amigaos__)
  /* Don't try to use socketpair() on AmigaOS, socketpair_ultra works better */   #ifdef __amigaos__   #undef HAVE_SOCKETPAIR   #endif      #ifdef UNIX_SOCKETS_WORK_WITH_SHUTDOWN   #undef UNIX_SOCKET_CAPABILITIES   #define UNIX_SOCKET_CAPABILITIES (fd_INTERPROCESSABLE | fd_BIDIRECTIONAL | fd_CAN_NONBLOCK | fd_CAN_SHUTDOWN | fd_SEND_FD)   #endif    + #ifndef HAVE_DIRFD + #ifdef HAVE_DIR_DD_FD + #define dirfd(dir__) (((DIR*)dir__)->dd_fd) + #define HAVE_DIRFD + #elif defined(HAVE_DIR_D_FD) + #define dirfd(dir__) (((DIR*)dir__)->d_fd) + #define HAVE_DIRFD + #endif + #endif +    /*    * gcc with -O3 generates very bloated code for the functions in this file. One rather extreme example    * is file_open, which ends up having 32 call sites of open(2).    */   #ifdef __GNUC__   #pragma GCC optimize "-Os"   #endif      /* #define SOCKETPAIR_DEBUG */   
pike.git/src/modules/_Stdio/file.c:5771: Inside #if undefined(__NT__)
   THREADS_ALLOW();   #ifndef __NT__    if( (tmp = opendir(   #ifdef HAVE_DARWIN_XATTR    "/dev/fd"   #else    "/proc/self/fd"   #endif    )) )    { + #ifdef HAVE_DIRFD    INT_TYPE dfd = dirfd(tmp); -  + #endif       while(1)    {    INT_TYPE fd;    char *ep;    struct dirent ent, *res;    /* solaris, linux, cygwin, darwin, netbsd et.al. */    res = NULL;    while( UNLIKELY(readdir_r( tmp, &ent, &res ))    && UNLIKELY(errno==EINTR))    ;    if( !res )    break;       fd = strtol(res->d_name, &ep, 10);    -  if( LIKELY(ep != res->d_name) && (fd != dfd) ) +  if( LIKELY(ep != res->d_name) + #ifdef HAVE_DIRFD +  && (fd != dfd) + #endif +  )    {    SET_SVAL_TYPE_SUBTYPE(*sp,PIKE_T_INT,0);    sp++->u.integer = fd;    fds++;    }    }    closedir(tmp);    }    else   #endif /* __NT__ */