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

version» Context lines:

pike.git/src/modules/_Stdio/file.c:1777:    if (!UNSAFE_IS_ZERO (&f->event_cbs[ev]))    cb_events |= 1 << ev;       if (cb_events) {    if (FD >= 0 &&    !(fd_query_properties(FD, fd_CAN_NONBLOCK) & fd_CAN_NONBLOCK))    Pike_error("Callback operations not supported for this file.\n");       ADD_FD_EVENTS (f, cb_events);    } -  -  pop_n_elems(args); -  push_int(0); +    }      static void file__disable_callbacks(INT32 args)   {    struct my_file *f = THIS;      #if 0    if(FD<0)    Pike_error("File is not open.\n");   #endif       SUB_FD_EVENTS (f, ~0); -  -  pop_n_elems(args); -  push_int(0); +    }         /*! @decl int write(string data)    *! @decl int write(string format, mixed ... extras)    *! @decl int write(array(string) data)    *! @decl int write(array(string) format, mixed ... extras)    *!    *! Write data to a file or a stream.    *!
pike.git/src/modules/_Stdio/file.c:3755: Inside #if defined(__NT__)
   !(fd_query_properties(THIS->box.fd, fd_CAN_NONBLOCK) & fd_CAN_NONBLOCK)) {    Pike_error("set_backend() on non-socket!\n");    }   #endif /* __NT__ */       if (f->box.backend)    change_backend_for_box (&f->box, backend);    else    INIT_FD_CALLBACK_BOX (&f->box, backend, f->box.ref_obj,    f->box.fd, 0, got_fd_event, f->box.flags); -  -  pop_n_elems (args - 1); +    }      /*! @decl Pike.Backend query_backend()    *!    *! Return the backend used for the callbacks.    *!    *! @seealso    *! @[set_backend]    */   static void file_query_backend (INT32 args)
pike.git/src/modules/_Stdio/file.c:3803:    if(set_nonblocking(FD,1))    {    ERRNO=errno;    push_int (ERRNO);    f_strerror (1);    Pike_error("Stdio.File->set_nonblocking() failed: %S\n",    Pike_sp[-1].u.string);    }       THIS->open_mode |= FILE_NONBLOCKING; -  -  pop_n_elems(args); +    }      /*! @decl void set_blocking()    *!    *! Sets this file to blocking operation.    *!    *! This is the inverse operation of @[set_nonblocking()].    *!    *! @seealso    *! @[set_nonblocking()]    */   static void file_set_blocking(INT32 args)   {    if(FD >= 0)    {    set_nonblocking(FD,0);    THIS->open_mode &=~ FILE_NONBLOCKING;    } -  pop_n_elems(args); +    }      /*! @decl void set_close_on_exec(int(0..1) yes_no)    *!    *! Marks the file as to be closed in spawned processes.    *!    *! This function determines whether this file will be closed when    *! calling exec().    *!    *! Default is that the file WILL be closed on exec except for
pike.git/src/modules/_Stdio/file.c:3852:    SIMPLE_TOO_FEW_ARGS_ERROR("set_close_on_exec", 1);    if(FD <0)    Pike_error("File not open.\n");       if(UNSAFE_IS_ZERO(Pike_sp-args))    {    my_set_close_on_exec(FD,0);    }else{    my_set_close_on_exec(FD,1);    } -  pop_n_elems(args); +    }      /*! @decl int is_open()    *!    *! Returns true if the file is open.    *!    *! @note    *! If the file is a socket that has been closed from the remote side,    *! this function might still return true.    *!
pike.git/src/modules/_Stdio/file.c:3923:    *! @seealso    *! @[release_fd()]    */   static void file_take_fd(INT32 args)   {    if (args < 1)    SIMPLE_TOO_FEW_ARGS_ERROR ("take_fd", 1);    if (TYPEOF(Pike_sp[-args]) != PIKE_T_INT)    SIMPLE_BAD_ARG_ERROR ("take_fd", 0, "int");    change_fd_for_box(&THIS->box, Pike_sp[-args].u.integer); -  pop_n_elems(args); +    }      PMOD_EXPORT struct object *file_make_object_from_fd(int fd, int mode, int guess)   {    struct object *o;    struct my_file *f;    if (Pike_fp->context->prog == file_program) {    /* Called from within the file (aka Fd) object.    * Attempt to clone ourselves.    */
pike.git/src/modules/_Stdio/file.c:4042:    Pike_error("Bufsize must be larger than zero.\n");       if(args>1)    {    if(TYPEOF(Pike_sp[1-args]) != PIKE_T_STRING)    SIMPLE_BAD_ARG_ERROR("set_buffer", 2, "string");    flags=parse(Pike_sp[1-args].u.string->str);    }else{    flags=FILE_READ | FILE_WRITE;    } -  pop_n_elems(args); +       #ifdef SOCKET_BUFFER_MAX   #if SOCKET_BUFFER_MAX    if(bufsize>SOCKET_BUFFER_MAX) bufsize=SOCKET_BUFFER_MAX;   #endif    flags &= THIS->open_mode;   #ifdef SO_RCVBUF    if(flags & FILE_READ)    {    int tmp=bufsize;
pike.git/src/modules/_Stdio/file.c:5380: Inside #if defined(_REENTRANT)
   num_threads++;    if(th_create_small(&id,proxy_thread,p))    {    free(p);    while (fd_close(from) && errno == EINTR) {}    while (fd_close(to) && errno == EINTR) {}    Pike_error("Failed to create thread.\n");    }       th_destroy(& id); -  pop_n_elems(args); -  push_int(0); +    }      PMOD_EXPORT void create_proxy_pipe(struct object *o, int for_reading)   {    struct object *n,*n2;    push_object(n=clone_object(file_program,0));    push_int(fd_INTERPROCESSABLE);    apply(n,"pipe",1);    if(TYPEOF(Pike_sp[-1]) != PIKE_T_OBJECT)    Pike_error("Failed to create proxy pipe (errno=%d)!\n",get_file_storage(n)->my_errno);