pike.git / lib / modules / Stdio.pmod

version» Context lines:

pike.git/lib/modules/Stdio.pmod:1: - // $Id: Stdio.pmod,v 1.29 1998/07/15 15:08:36 grubba Exp $ + // $Id: Stdio.pmod,v 1.30 1998/07/19 03:24:09 hubbe Exp $      #include <string.h>      inherit files;      class File   {    inherit Fd_ref;       mixed ___read_callback;    mixed ___write_callback;    mixed ___close_callback;   #if constant(__HAVE_OOB__)_    mixed ___read_oob_callback;    mixed ___write_oob_callback;   #endif    mixed ___id;    -  + #ifdef __STDIO_DEBUG +  string __closed_backtrace; + #endif +     int errno()    {    return _fd && ::errno();    }       int open(string file, string mode, void|int bits)    {    _fd=Fd();    if(query_num_arg()<3) bits=0666;    return ::open(file,mode,bits);
pike.git/lib/modules/Stdio.pmod:117:    object o;    o = File();    do_assign(o, this_object());    return o;    }          int close(void|string how)    {    if(::close(how||"rw")) +  {    _fd=0; -  + #ifdef __STDIO_DEBUG +  __closed_backtrace=master()->describe_backtrace(backtrace()); + #endif +  }    return 1;   #if 0    if(how)    {    if(::close(how))    _fd=0;    }else{    _fd=0;    }   #endif
pike.git/lib/modules/Stdio.pmod:197:       void set_nonblocking(mixed|void rcb,    mixed|void wcb,    mixed|void ccb,   #if constant(__HAVE_OOB__)_    mixed|void roobcb,    mixed|void woobcb   #endif    )    { + #ifdef __STDIO_DEBUG +  if(!_fd) +  { +  throw(({ +  "Stdio.File(): set_nonblocking on closed file.\n"+ +  (__closed_backtrace ? +  sprintf("File was closed from:\n %-=200s\n",__closed_backtrace) : +  "This file has never been open.\n" ), +  backtrace()})); +  +  } + #endif    SET(read_callback,rcb);    SET(write_callback,wcb);    ___close_callback=ccb;      #if constant(__HAVE_OOB__)_    SET(read_oob_callback,roobcb);    SET(write_oob_callback,woobcb);   #endif    ::set_nonblocking();    }