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

version» Context lines:

pike.git/src/modules/_Stdio/file.c:435: Inside #if defined(PIKE_DEBUG)
   /* Don't cause a fatal when opening fds by number    * if the fd belongs to a backend... */    if ((fd >= 0) && !(flags & FILE_NOT_OPENED))    debug_check_fd_not_in_use (fd);   #endif    change_fd_for_box(&THIS->box, fd);   }      /* Use ptrdiff_t for the fd since we're passed a void * and should    * read it as an integer of the same size. */ - static int do_close_fd(ptrdiff_t fd) + static void do_close_fd(void *_fd)   {    int ret; -  int preve; -  if (fd < 0) return 0; +  ptrdiff_t fd = (ptrdiff_t)_fd; +  +  if (fd < 0) return;    errno = 0;    do { -  preve = errno; +     ret = fd_close(fd);    } while ((ret == -1) && (errno == EINTR)); -  if ((ret == -1) && preve) return 0; -  return ret; +    }      #ifdef HAVE_PIKE_SEND_FD   /* Close the queued fds in fd_info, either due to them being successfully    * sent, or due to the connection being closed. */   static void do_close_fd_info(int *fd_info)   {    int num_fds = fd_info[1];    int *fds = fd_info + 2;    while (num_fds) { -  do_close_fd(fds[--num_fds]); +  do_close_fd((void*)(ptrdiff_t)fds[--num_fds]);   #ifdef PIKE_DEBUG    fds[num_fds] = -1;   #endif    }    fd_info[1] = 0;   }      /* Restore THIS->fd_info that was removed during the call to writev_fds(). */   static void restore_fd_info(int *fd_info)   {
pike.git/src/modules/_Stdio/file.c:1294:    *! @note    *! When at the end of a file or stream, repeated calls to @[read()]    *! will return the empty string since it's not considered an error.    *! The empty string is never returned in other cases, unless nonblocking    *! mode is used or @[len] is zero.    *!    *! @seealso    *! @[read_oob()], @[write()], @[receive_fd()], @[send_fd()]    */    - /*! -  *! @decl int read(Stdio.Buffer|String.Buffer dst) + /*! @decl int read(Stdio.Buffer|String.Buffer dst)    *!    *! Reads data from a file or stream into the buffer @[dst]. Tries to    *! read as many bytes as buffer space available.    *! Will advance the write position in @[dst] by the number of bytes    *! read.    *!    *! @returns    *! The number of bytes read. Returns @expr{-1@} on error and    *! @[errno()] will return the corresponding error code.    */    - /*! -  *! @decl int read(System.Memory dst, void|int(0..) offset) + /*! @decl int read(System.Memory dst, void|int(0..) offset)    *!    *! Reads data from a file or stream into the buffer @[dst] at offset    *! @[offset]. Tries to read as many bytes as buffer space available.    *!    *! @returns    *! The number of bytes read. Returns @expr{-1@} on error and    *! @[errno()] will return the corresponding error code.    */   static void file_read(INT32 args)   {