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

version» Context lines:

pike.git/src/modules/_Stdio/file.c:6037: Inside #if defined(HAVE_LINUX_IF_H) && defined(HAVE_SYS_IOCTL_H)
   up++;    }       fd_close(fd);    }   #endif /* defined(HAVE_LINUX_IF_H) && defined(HAVE_SYS_IOCTL_H) */       push_mapping(m);   }    + /*! @decl int getprotobyname(string(8bit) name) +  *! +  *! Returns the protocol number of the protocol @expr{name@}. +  *! This calls the POSIX function getprotobyname. +  *! If the protocol cannot be found an error is thrown. +  */ + static void f_getprotobyname(INT32 args) { + #ifdef HAVE_GETPROTOBYNAME +  struct protoent *proto; +  const char *name; +  +  get_all_args("getprotobyname", args, "%c", &name); +  +  proto = getprotobyname(name); +  +  if (proto) { +  push_int(proto->p_proto); +  return; +  } + #endif +  Pike_error("Could not find protocol.\n"); + } +    #ifdef HAVE_OPENPTY   #include <pty.h>   #endif      int fd_write_identifier_offset;      PIKE_MODULE_INIT   {    struct object *o;    int write_fun_num;
pike.git/src/modules/_Stdio/file.c:6271:    /* function(void:mapping) */    ADD_FUNCTION2("gethostip", f_gethostip, tFunc(tNone,tMapping),    0, OPT_EXTERNAL_DEPEND);      #ifdef PIKE_DEBUG    dmalloc_accept_leak(add_to_callback(&do_debug_callbacks,    check_static_file_data,    0,    0));   #endif +  ADD_FUNCTION2("getprotobyname", f_getprotobyname, tFunc(tStr8,tInt), 0, 0);   }      /*! @endmodule    */      /* Used from backend */   PMOD_EXPORT int pike_make_pipe(int *fds)   {    return socketpair(AF_UNIX, SOCK_STREAM, 0, fds);   }      PMOD_EXPORT int fd_from_object(struct object *o)   {    extern int fd_from_portobject( struct object *o );    struct my_file *f=get_file_storage(o);    if(!f)    return fd_from_portobject( o );    return f->box.fd;   }