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

version» Context lines:

pike.git/src/modules/_Stdio/socket.c:56:   #include <sys/protosw.h>   #endif      #ifdef HAVE_SYS_SOCKETVAR_H   #include <sys/socketvar.h>   #endif      #ifdef HAVE_SYS_UN_H   #include <sys/un.h>   #endif -  +    #include "dmalloc.h"      /*! @module Stdio    */      /*! @class Port    */      struct port   {
pike.git/src/modules/_Stdio/socket.c:728:    /* map_variable takes care of id and accept_callback. */   }      static void exit_port_struct(struct object *UNUSED(o))   {    do_close(THIS);    unhook_fd_callback_box (&THIS->box);    /* map_variable takes care of id and accept_callback. */   }    + int fd_from_portobject( struct object *p ) + { +  struct port *po = get_storage( p, port_program ); +  if(!po) return -1; +  return po->box.fd; + } +  + static void port_query_fd(INT32 UNUSED(args)) + { +  push_int(fd_from_portobject(Pike_fp->current_object)); + }   /*! @endclass    */      /*! @endmodule    */      PMOD_EXPORT struct program *port_program = NULL;      void exit_stdio_port(void)   {
pike.git/src/modules/_Stdio/socket.c:780:    port_fd_factory_fun_num =    ADD_FUNCTION("fd_factory", port_fd_factory, tFunc(tNone,tObjIs_STDIO_FD),    ID_STATIC);    ADD_FUNCTION("accept",port_accept,tFunc(tNone,tObjIs_STDIO_FD),0);    /* function(void|string|int,void|mixed,void|string:void) */    ADD_FUNCTION("create", port_create,    tFunc(tOr3(tVoid,tStr,tInt) tOr(tVoid,tMix) tOr(tVoid,tStr),    tVoid), 0);    ADD_FUNCTION ("set_backend", port_set_backend, tFunc(tObj,tVoid), 0);    ADD_FUNCTION ("query_backend", port_query_backend, tFunc(tVoid,tObj), 0); +  ADD_FUNCTION ("query_fd", port_query_fd, tFunc(tVoid,tInt), 0);    -  + #ifdef SO_REUSEPORT +  ADD_INT_CONSTANT( "SO_REUSEPORT_SUPPORT", SO_REUSEPORT, 0 ); + #endif + #ifdef TCP_FASTOPEN +  ADD_INT_CONSTANT( "TCP_FASTOPEN_SUPPORT", TCP_FASTOPEN, 0 ); + #endif    set_init_callback(init_port_struct);    set_exit_callback(exit_port_struct);       port_program = end_program();    add_program_constant( "_port", port_program, 0 ); - } +     - int fd_from_portobject( struct object *p ) - { -  struct port *po = get_storage( p, port_program ); -  if(!po) return -1; -  return po->box.fd; +    } -  +