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

version» Context lines:

pike.git/src/modules/_Stdio/socket.c:31: Inside #if defined(HAVE_SYS_WAIT_H)
  #include <signal.h>   #ifdef HAVE_SYS_WAIT_H   #include <sys/wait.h>   #endif   #ifdef HAVE_SYS_SOCKET_H   #include <sys/socket.h>   #endif      #ifdef HAVE_SYS_STREAM_H   #include <sys/stream.h> -  - /* Ugly patch for AIX 3.2 */ - #ifdef u - #undef u +    #endif    - #endif -  +    #ifdef HAVE_SYS_PROTOSW_H   #include <sys/protosw.h>   #endif      #ifdef HAVE_SYS_SOCKETVAR_H   #include <sys/socketvar.h>   #endif      #ifdef HAVE_SYS_UN_H   #include <sys/un.h>
pike.git/src/modules/_Stdio/socket.c:136:   /*! @decl mixed set_id(mixed id)    *!    *! This function sets the id used for accept_callback by this port.    *! The default id is @[this_object()].    *!    *! @seealso    *! @[query_id]    */   static void port_set_id(INT32 args)   { -  check_all_args("Port->set_id", args, BIT_MIXED, 0); +  check_all_args(NULL, args, BIT_MIXED, 0);    assign_svalue(& THIS->id, Pike_sp-args);    pop_n_elems(args-1);   }      /*! @decl mixed query_id()    *!    *! This function returns the id for this port. The id is normally the    *! first argument to accept_callback.    *!    *! @seealso
pike.git/src/modules/_Stdio/socket.c:187:    *! @seealso    *! @[bind], @[accept]    */   static void port_listen_fd(INT32 args)   {    struct port *p = THIS;    struct svalue *cb = NULL;    int fd;    do_close(p);    -  get_all_args("listen_fd", args, "%d.%*", &fd, &cb); +  get_all_args(NULL, args, "%d.%*", &fd, &cb);       if(fd<0)    {    errno = p->my_errno=EBADF;    pop_n_elems(args);    push_int(0);    return;    }       if(fd_listen(fd, 16384) < 0)
pike.git/src/modules/_Stdio/socket.c:400: Inside #if defined(HAVE_SYS_UN_H)
  static void bind_unix(INT32 args)   {    struct port *p = THIS;    struct sockaddr_un *addr;    struct pike_string *path;    struct svalue *cb = NULL;    int addr_len,fd,tmp;       do_close(p);    -  get_all_args("bind_unix", args, "%n.%*", &path, &cb); +  get_all_args(NULL, args, "%n.%*", &path, &cb);       /* NOTE: Some operating systems (eg Linux 2.6) do not support    * paths longer than what fits into a plain struct sockaddr_un.    */    addr_len = sizeof(struct sockaddr_un) + path->len + 1 -    sizeof(addr->sun_path);    addr = xalloc(addr_len);       strcpy(addr->sun_path, path->str);    addr->sun_family = AF_UNIX;
pike.git/src/modules/_Stdio/socket.c:497:   /*! @decl void create(int|string port, void|function accept_callback, @    *! void|string ip)    *! @decl void create("stdin", void|function accept_callback)    *!    *! When called with an int or any string except @expr{"stdin"@} as    *! first argument, this function does the same as @[bind()] would do    *! with the same arguments.    *!    *! When called with @expr{"stdin"@} as argument, a socket is created    *! out of the file descriptor 0. This is only useful if that actually -  *! IS a socket to begin with. +  *! IS a socket to begin with, and is equivalent to creating a port and +  *! initializing it with @[listen_fd](0).    *!    *! @seealso    *! @[bind], @[listen_fd]    */   static void port_create(INT32 args)   {    if(args)    {    if(TYPEOF(Pike_sp[-args]) == PIKE_T_INT ||    (TYPEOF(Pike_sp[-args]) == PIKE_T_STRING &&
pike.git/src/modules/_Stdio/socket.c:796:    ADD_FUNCTION("set_id",port_set_id,tFunc(tMix,tMix),0);    /* function(:mixed) */    ADD_FUNCTION("query_id",port_query_id,tFunc(tNone,tMix),0);    /* function(:string) */    ADD_FUNCTION("query_address",socket_query_address,tFunc(tNone,tStr),0);    /* function(:int) */    ADD_FUNCTION("errno",port_errno,tFunc(tNone,tInt),0);    /* function(:object) */    port_fd_factory_fun_num =    ADD_FUNCTION("fd_factory", port_fd_factory, tFunc(tNone,tObjIs_STDIO_FD), -  ID_STATIC); +  ID_PROTECTED);    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