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

version» Context lines:

pike.git/src/modules/_Stdio/file.c:543: Inside #if defined(HAVE_FD_FLOCK) || defined(HAVE_FD_LOCKF)
   destruct(THIS->key);    THIS->key=0;    }   #endif      #ifdef HAVE_PIKE_SEND_FD    if (THIS->fd_info) do_close_fd_info(THIS->fd_info);   #endif       for (ev = 0; ev < NELEM (THIS->event_cbs); ev++) { -  free_svalue(& THIS->event_cbs[ev]); -  SET_SVAL(THIS->event_cbs[ev], PIKE_T_INT, NUMBER_NUMBER, integer, 0); +  assign_no_ref_svalue(&THIS->event_cbs[ev], NULL, Pike_fp->current_object);    }   }      static void close_fd(int quiet)   {    int fd=FD;    int olde = 0;    if(fd<0) return;       free_fd_stuff();
pike.git/src/modules/_Stdio/file.c:1594:   {    if(f->box.backend)    {    return f->box.flags;    }    else return 0;   }      static void set_fd_event_cb (struct my_file *f, struct svalue *cb, int event, int flags)   { +  /* NB: f is always THIS for the caller, so it is safe to +  * use Pike_fp->current_object. +  */ +  assign_no_ref_svalue(&f->event_cbs[event], cb, Pike_fp->current_object);    if (UNSAFE_IS_ZERO (cb)) { -  free_svalue (&f->event_cbs[event]); -  SET_SVAL(f->event_cbs[event], PIKE_T_INT, NUMBER_NUMBER, integer, 0); +     SUB_FD_EVENTS2 (f, 1 << event, flags);    }    else {   #ifdef __NT__    if (!(fd_query_properties(f->box.fd, fd_CAN_NONBLOCK) & fd_CAN_NONBLOCK)) {    Pike_error("Setting backend callback on a non-socket!\n");    }   #endif /* __NT__ */ -  assign_svalue (&f->event_cbs[event], cb); +     ADD_FD_EVENTS2 (f, 1 << event, flags);    }   }      #undef CBFUNCS      #define CBFUNCS(CB, EVENT) \    static void PIKE_CONCAT(file_set_,CB) (INT32 args) \    { \    if(!args) \
pike.git/src/modules/_Stdio/file.c:4426:    for (ev = 0; ev < NELEM (f->event_cbs); ev++)    if (TYPEOF(f->event_cbs[ev]) != PIKE_T_INT)    cb_events |= 1 << ev;    SUB_FD_EVENTS (f, ~cb_events);    }    break;    }   }       - static void low_dup(struct object *UNUSED(toob), + static void low_dup(struct object *toob,    struct my_file *to,    struct my_file *from)   {    size_t ev;       debug_check_internals (from);       my_set_close_on_exec(to->box.fd, to->box.fd > 2);       to->open_mode=from->open_mode;
pike.git/src/modules/_Stdio/file.c:4460:    /* Note: This previously enabled all events for which there were    * callbacks instead of copying the event settings from the source    * file. */       unhook_fd_callback_box (&to->box);    if (from->box.backend)    INIT_FD_CALLBACK_BOX (&to->box, from->box.backend, to->box.ref_obj,    to->box.fd, from->box.events, got_fd_event, from->box.flags);       for (ev = 0; ev < NELEM (to->event_cbs); ev++) -  assign_svalue (&to->event_cbs[ev], &from->event_cbs[ev]); +  assign_no_ref_svalue (&to->event_cbs[ev], &from->event_cbs[ev], toob);       debug_check_internals (to);   }      /*! @decl int dup2(Stdio.File to)    *!    *! Duplicate a file over another.    *!    *! This function works similarly to @[assign()], but instead of making    *! the argument a reference to the same file, it creates a new file
pike.git/src/modules/_Stdio/file.c:6020:      #define FILE_FUNC(X,Y,Z) \    PIKE_CONCAT(Y,_function_number) = ADD_FUNCTION(X,Y,Z,0);   #define FILE_OBJ tObjImpl_STDIO_FD   #include "file_functions.h"       PIKE_MAP_VARIABLE("_errno", OFFSETOF(my_file, my_errno),    tIntPos, PIKE_T_INT, ID_PROTECTED);    PIKE_MAP_VARIABLE("_read_callback",    OFFSETOF(my_file, event_cbs[PIKE_FD_READ]), -  tMix, PIKE_T_MIXED, 0); +  tMix, PIKE_T_NO_REF_MIXED, 0);    PIKE_MAP_VARIABLE("_write_callback",    OFFSETOF(my_file, event_cbs[PIKE_FD_WRITE]), -  tMix, PIKE_T_MIXED, 0); +  tMix, PIKE_T_NO_REF_MIXED, 0);    PIKE_MAP_VARIABLE("_read_oob_callback",    OFFSETOF(my_file, event_cbs[PIKE_FD_READ_OOB]), -  tMix, PIKE_T_MIXED, 0); +  tMix, PIKE_T_NO_REF_MIXED, 0);    PIKE_MAP_VARIABLE("_write_oob_callback",    OFFSETOF(my_file, event_cbs[PIKE_FD_WRITE_OOB]), -  tMix, PIKE_T_MIXED, 0); +  tMix, PIKE_T_NO_REF_MIXED, 0);    PIKE_MAP_VARIABLE("_fs_event_callback",    OFFSETOF(my_file, event_cbs[PIKE_FD_FS_EVENT]), -  tMix, PIKE_T_MIXED, 0); +  tMix, PIKE_T_NO_REF_MIXED, 0);       fd_fd_factory_fun_num =    ADD_FUNCTION("fd_factory", fd_fd_factory,    tFunc(tNone, tObjIs_STDIO_FD), ID_PROTECTED);       fd_receive_fd_fun_num =    ADD_FUNCTION("receive_fd", NULL,    tFunc(tObjIs_STDIO_FD, tVoid), ID_PROTECTED);       ADD_FUNCTION("`_fd", fd_backtick__fd, tFunc(tNone, tObjIs_STDIO_FD), 0);