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

version» Context lines:

pike.git/src/modules/_Stdio/file.c:1399:    *! The function may be interrupted prematurely    *! of the timeout (due to signals);    *! check the timing manually if this is imporant.    */   static void file_peek(INT32 args)   {    int ret;    int not_eof = 0;    FLOAT_TYPE tf = 0.0;    -  get_all_args("peek",args,".%F%d",&tf,&not_eof); +  get_all_args(NULL, args, ".%F%d", &tf, &not_eof);       {   #ifdef HAVE_AND_USE_POLL    struct pollfd fds;    int timeout = 0;    if (args && !IS_UNDEFINED(Pike_sp - args)) {    timeout = (int)(tf*1000); /* ignore overflow for now */    }    fds.fd=FD;    fds.events=POLLIN;
pike.git/src/modules/_Stdio/file.c:2284: Inside #if defined(SO_LINGER)
   */   static void file_linger(INT32 args)   {    int fd = FD;    int linger = -1;    struct linger li;       if(fd < 0)    Pike_error("File not open.\n");    -  get_all_args("linger", args, ".%d", &linger); +  get_all_args(NULL, args, ".%d", &linger);       if ((linger < -1) || (linger > 0xffff)) {    SIMPLE_ARG_TYPE_ERROR("linger", 1, "int(-1..65535)");    }       if (linger == -1) {    li.l_onoff = 0;    li.l_linger = 15;    } else {    li.l_onoff = 1;
pike.git/src/modules/_Stdio/file.c:2342: Inside #if defined(TCP_NODELAY)
   *! setsockopt()    */   static void file_nodelay(INT32 args)   {    int fd = FD;    int state = 1;       if(fd < 0)    Pike_error("File not open.\n");    -  get_all_args("set_nodelay", args, ".%d", &state); +  get_all_args(NULL, args, ".%d", &state);       if (state && state != 1) {    SIMPLE_ARG_TYPE_ERROR("set_nodelay()", 1, "int(0..1)");    }       errno = 0;    while ((fd_setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,    &state, sizeof(state)) < 0) &&    (errno == EINTR)) {    errno = 0;
pike.git/src/modules/_Stdio/file.c:2728: Inside #if defined(HAVE_OPENAT)
  static void file_openat(INT32 args)   {    int flags, fd, dir_fd;    int access = 00666;    int err;    struct pike_string *str, *flag_str;       if((dir_fd = FD) < 0)    Pike_error("File not open.\n");    -  get_all_args("openat", args, "%S%S.%d", &str, &flag_str, &access); +  get_all_args(NULL, args, "%S%S.%d", &str, &flag_str, &access);       flags = parse(flag_str->str);       if (string_has_null(str)) {    /* Filenames with NUL are not supported. */    ERRNO = errno = ENOENT;    pop_n_elems(args);    push_int(0);    return;    }
pike.git/src/modules/_Stdio/file.c:3200: Inside #if defined(HAVE_FSTATAT)
  {    int fd;    PIKE_STAT_T s;    int tmp;    struct pike_string *path;    int nofollow = 0;       if(FD < 0)    Pike_error("File not open.\n");    -  get_all_args("statat", args, "%S.%d", &path, &nofollow); +  get_all_args(NULL, args, "%S.%d", &path, &nofollow);       if (string_has_null(path)) {    /* Filenames with NUL are not supported. */    ERRNO = errno = ENOENT;    pop_n_elems(args);    push_int(0);    return;    }       fd=FD;
pike.git/src/modules/_Stdio/file.c:3255: Inside #if defined(HAVE_FSTATAT) and #if defined(HAVE_UNLINKAT)
   int dir_fd;    PIKE_STAT_T st;    struct pike_string *str;    INT32 i;       destruct_objects_to_destruct();       if((dir_fd = FD) < 0)    Pike_error("File not open.\n");    -  get_all_args("unlinkat", args, "%S", &str); +  get_all_args(NULL, args, "%S", &str);       if (string_has_null(str)) {    /* Filenames with NUL are not supported. */    ERRNO = ENOENT;    pop_n_elems(args);    push_int(0);    return;    }       THREADS_ALLOW_UID();
pike.git/src/modules/_Stdio/file.c:3319: Inside #if defined(HAVE_FDOPENDIR) && defined(HAVE_OPENAT)
  {    int fd;    int dfd;    struct pike_string *path = NULL;    ptrdiff_t name_max = -1;    DIR *dir = NULL;       if(FD < 0)    Pike_error("File not open.\n");    -  get_all_args("get_dir", args, ".%S", &path); +  get_all_args(NULL, args, ".%S", &path);       if (path && string_has_null(path)) {    fprintf(stderr, "NULL\n");    /* Filenames with NUL are not supported. */    ERRNO = errno = ENOENT;    pop_n_elems(args);    push_int(0);    return;    }   
pike.git/src/modules/_Stdio/file.c:3460:    *! Return the value of a specified attribute, or 0 if it does not exist    */   static void file_getxattr(INT32 args)   {    char buffer[1024];    char *ptr = buffer;    int mfd = FD, do_free = 0;    ssize_t res;    char *name;    -  get_all_args( "getxattr", args, "%s", &name ); +  get_all_args( NULL, args, "%s", &name );       THREADS_ALLOW();    do {   #ifdef HAVE_DARWIN_XATTR    res = fgetxattr( mfd, name, buffer, sizeof(buffer), 0, 0 ); /* First try, for speed.*/   #else    res = fgetxattr( mfd, name, buffer, sizeof(buffer) ); /* First try, for speed.*/   #endif /* HAVE_DARWIN_XATTR */    } while( res < 0 && errno == EINTR );    THREADS_DISALLOW();
pike.git/src/modules/_Stdio/file.c:3520:         /*! @decl void removexattr( string attr )    *! Remove the specified extended attribute.    */   static void file_removexattr( INT32 args )   {    char *name;    int mfd = FD;    int rv; -  get_all_args( "removexattr", args, "%s", &name ); +  get_all_args( NULL, args, "%s", &name );    THREADS_ALLOW();   #ifdef HAVE_DARWIN_XATTR    while( ((rv=fremovexattr( mfd, name, 0 )) < 0) && (errno == EINTR))    ;   #else    while( ((rv=fremovexattr( mfd, name )) < 0) && (errno == EINTR))    ;   #endif /* HAVE_DARWIN_XATTR */    THREADS_DISALLOW();   
pike.git/src/modules/_Stdio/file.c:3568:    *! @returns    *! 1 if successful, 0 otherwise, setting errno.    */   static void file_setxattr( INT32 args )   {    char *ind;    struct pike_string *val;    int flags;    int rv;    int mfd = FD; -  get_all_args( "setxattr", args, "%s%S%d", &ind, &val, &flags ); +  get_all_args( NULL, args, "%s%S%d", &ind, &val, &flags );    THREADS_ALLOW();   #ifdef HAVE_DARWIN_XATTR    while( ((rv=fsetxattr( mfd, ind, val->str,    (val->len<<val->size_shift), 0, flags )) < 0) &&    (errno == EINTR))    ;   #else    while( ((rv=fsetxattr( mfd, ind, val->str,    (val->len<<val->size_shift), flags )) < 0) &&    (errno == EINTR))
pike.git/src/modules/_Stdio/file.c:4776:    *!    *! Equivalent to setsockopt(Stdio.SO_KEEPALIVE, on_off), but will set errno    *! if SO_KEEPALIVE is not supported, rather than issuing a compilation error    *! for the missing constant.    */   static void file_set_keepalive(INT32 args)   {    int tmp, i;    INT_TYPE t;    -  get_all_args("set_keepalive", args, "%i", &t); +  get_all_args(NULL, args, "%i", &t);       /* In case int and INT_TYPE have different sizes */    tmp = t;      #ifdef SO_KEEPALIVE    i = fd_setsockopt(FD,SOL_SOCKET, SO_KEEPALIVE, (char *)&tmp, sizeof(tmp));    if(i)    {    ERRNO=errno;    }else{
pike.git/src/modules/_Stdio/file.c:4821:    *! 1 if successful, 0 if not (and sets errno())    *!    *! @seealso    *! @[set_keepalive()]    */   static void file_setsockopt(INT32 args)   {    int tmp, i, opt, level;    INT_TYPE o, t, l;    -  get_all_args("setsockopt", args, "%i%i%i", &l, &o, &t); +  get_all_args(NULL, args, "%i%i%i", &l, &o, &t);       /* In case int and INT_TYPE have different sizes */    tmp = t; opt = o; level = l;       i = fd_setsockopt(FD, level, opt, (char *)&tmp, sizeof(tmp));    if(i)    {    ERRNO=errno;    }else{    ERRNO=0;
pike.git/src/modules/_Stdio/file.c:4971:    struct svalue *src_port = NULL;       int tmp, was_closed = FD < 0;    int fd, sent = 0;    int nb_mode;    int old_events;    int e;       if (args < 4)    { -  get_all_args("connect", args, "%S%*", &dest_addr, &dest_port); +  get_all_args(NULL, args, "%S%*", &dest_addr, &dest_port);    }    else if( args == 5 )    {    struct svalue *src_sv; -  get_all_args("connect", args, "%S%*%*%*%S", +  get_all_args(NULL, args, "%S%*%*%*%S",    &dest_addr, &dest_port, &src_sv, &src_port, &data);    if(TYPEOF(*src_sv) != PIKE_T_INT )    {    if (TYPEOF(*src_sv) != PIKE_T_STRING || src_sv->u.string->size_shift)    SIMPLE_ARG_TYPE_ERROR("connect", 3, "int|string(8bit)");    src_addr = src_sv->u.string;    }    } else { -  get_all_args("connect", args, "%S%*%S%*", +  get_all_args(NULL, args, "%S%*%S%*",    &dest_addr, &dest_port, &src_addr, &src_port);    }       if(TYPEOF(*dest_port) != PIKE_T_INT &&    (TYPEOF(*dest_port) != PIKE_T_STRING || dest_port->u.string->size_shift))    SIMPLE_ARG_TYPE_ERROR("connect", 2, "int|string(8bit)");       if(src_port && TYPEOF(*src_port) != PIKE_T_INT &&    (TYPEOF(*src_port) != PIKE_T_STRING || src_port->u.string->size_shift))    SIMPLE_ARG_TYPE_ERROR("connect", 4, "int|string(8bit)");
pike.git/src/modules/_Stdio/file.c:5980:    *!    *! 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); +  get_all_args(NULL, args, "%c", &name);       proto = getprotobyname(name);       if (proto) {    push_int(proto->p_proto);    return;    }   #endif    Pike_error("Could not find protocol.\n");   }