OSDN Git Service

Change foo (void) to foo () for all c++ functions throughout. Remove all
authorcgf <cgf>
Tue, 5 Jul 2005 03:16:41 +0000 (03:16 +0000)
committercgf <cgf>
Tue, 5 Jul 2005 03:16:41 +0000 (03:16 +0000)
fhandler_*::dump functions throughout.
* fhandler.h (fhandler_dev_mem::close): Remove pass-through function in favor
of virtual method.
(handler_dev_raw::close): Ditto.
(fhandler_dev_clipboard::fixup_after_exec): New method.
* fhandler_dev_mem.cc (fhandler_dev_mem::close): Eliminate pass through
* fhandler_dev_raw.cc (fhandler_dev_raw::close): Ditto.
* fhandler_clipboard.cc (fhandler_dev_clipboard::close): Don't go to extra
effort when execing.
(fhandler_dev_clipboard::fixup_after_exec): New function.
* fhandler_console.cc (fhandler_console::close): Don't do "extra stuff" when we
know we're execing.
* fhandler_disk_file.cc (fhandler_disk_file::close): Ditto.
* fhandler_dsp.cc (fhandler_dev_dsp::close): Ditto.
* fhandler_fifo.cc (fhandler_fifo.cc::close): Ditto.  function in favor of base
function.
* fhandler_random.cc (fhandler_dev_random::close): Ditto.
* fhandler_registry.cc (fhandler_registry::close): Ditto.
* fhandler_tty.cc (fhandler_tty_slave::close): Ditto.
* fhandler_virtual.cc (fhandler_virtual::close): Ditto.
* pinfo.cc (proc_waiter): Remove unneeded hExeced declaration.
* sigproc.cc: Ditto.
* winsup.h (hExeced): Define here.
* fhandler_virtual.cc (fhandler_virtual::fixup_after_exec): Just call close()
to reinitialize things to known state.

35 files changed:
winsup/cygwin/ChangeLog
winsup/cygwin/cygserver_msg.h
winsup/cygwin/cygserver_sem.h
winsup/cygwin/cygserver_shm.h
winsup/cygwin/dtable.h
winsup/cygwin/exceptions.cc
winsup/cygwin/fhandler.cc
winsup/cygwin/fhandler.h
winsup/cygwin/fhandler_clipboard.cc
winsup/cygwin/fhandler_console.cc
winsup/cygwin/fhandler_disk_file.cc
winsup/cygwin/fhandler_dsp.cc
winsup/cygwin/fhandler_fifo.cc
winsup/cygwin/fhandler_mem.cc
winsup/cygwin/fhandler_random.cc
winsup/cygwin/fhandler_raw.cc
winsup/cygwin/fhandler_registry.cc
winsup/cygwin/fhandler_serial.cc
winsup/cygwin/fhandler_socket.cc
winsup/cygwin/fhandler_tape.cc
winsup/cygwin/fhandler_tty.cc
winsup/cygwin/fhandler_virtual.cc
winsup/cygwin/fhandler_zero.cc
winsup/cygwin/mmap.cc
winsup/cygwin/mtinfo.h
winsup/cygwin/pinfo.cc
winsup/cygwin/pthread.cc
winsup/cygwin/sched.cc
winsup/cygwin/sec_helper.cc
winsup/cygwin/security.h
winsup/cygwin/sigproc.cc
winsup/cygwin/thread.cc
winsup/cygwin/thread.h
winsup/cygwin/tty.cc
winsup/cygwin/winsup.h

index 7f7bab9..7a97b1f 100644 (file)
@@ -1,5 +1,37 @@
 2005-07-04  Christopher Faylor  <cgf@timesys.com>
 
+       Change foo (void) to foo () for all c++ functions throughout.
+       Remove all fhandler_*::dump functions throughout.
+
+       * fhandler.h (fhandler_dev_mem::close): Remove pass-through function in
+       favor of virtual method.
+       (handler_dev_raw::close): Ditto.
+       (fhandler_dev_clipboard::fixup_after_exec): New method.
+       * fhandler_dev_mem.cc (fhandler_dev_mem::close): Eliminate pass through
+       * fhandler_dev_raw.cc (fhandler_dev_raw::close): Ditto.
+       * fhandler_clipboard.cc (fhandler_dev_clipboard::close): Don't go to
+       extra effort when execing.
+       (fhandler_dev_clipboard::fixup_after_exec): New function.
+       * fhandler_console.cc (fhandler_console::close): Don't do "extra stuff"
+       when we know we're execing.
+       * fhandler_disk_file.cc (fhandler_disk_file::close): Ditto.
+       * fhandler_dsp.cc (fhandler_dev_dsp::close): Ditto.
+       * fhandler_fifo.cc (fhandler_fifo.cc::close): Ditto.
+       function in favor of base function.
+       * fhandler_random.cc (fhandler_dev_random::close): Ditto.
+       * fhandler_registry.cc (fhandler_registry::close): Ditto.
+       * fhandler_tty.cc (fhandler_tty_slave::close): Ditto.
+       * fhandler_virtual.cc (fhandler_virtual::close): Ditto.
+
+       * pinfo.cc (proc_waiter): Remove unneeded hExeced declaration.
+       * sigproc.cc: Ditto.
+       * winsup.h (hExeced): Define here.
+
+       * fhandler_virtual.cc (fhandler_virtual::fixup_after_exec): Just call
+       close() to reinitialize things to known state.
+
+2005-07-04  Christopher Faylor  <cgf@timesys.com>
+
         * cygtls.h (_cygtls): Perform minor reformatting.
 
        * winsup.h (close_all_files): Reflect argument change.
index 716aaf8..7fbb12c 100644 (file)
@@ -75,13 +75,13 @@ public:
   client_request_msg (int, const void *, size_t, int); // msgsnd
 #endif
 
-  int retval (void) const { return _parameters.out.ret; }
-  ssize_t rcvval (void) const { return _parameters.out.rcv; }
+  int retval () const { return _parameters.out.ret; }
+  ssize_t rcvval () const { return _parameters.out.rcv; }
 };
 
 #ifndef __INSIDE_CYGWIN__
-int msginit (void);
-int msgunload (void);
+int msginit ();
+int msgunload ();
 int msgctl (struct thread *, struct msgctl_args *);
 int msgget (struct thread *, struct msgget_args *);
 int msgsnd (struct thread *, struct msgsnd_args *);
index 53a5ec5..225d8f2 100644 (file)
@@ -71,12 +71,12 @@ public:
   client_request_sem (int, struct sembuf *, size_t);   // semop
 #endif
 
-  int retval (void) const { return _parameters.out.ret; }
+  int retval () const { return _parameters.out.ret; }
 };
 
 #ifndef __INSIDE_CYGWIN__
-int seminit (void);
-int semunload (void);
+int seminit ();
+int semunload ();
 void semexit_myhook(void *arg, struct proc *p);
 
 int semctl (struct thread *, struct semctl_args *);
index e7d0295..2948f67 100644 (file)
@@ -78,14 +78,14 @@ public:
   client_request_shm (proc *);                         // shmfork
 #endif
 
-  int retval (void) const { return _parameters.out.ret; }
-  void *ptrval (void) const { return (void *)_parameters.out.ptr; }
-  vm_object_t objval (void) const { return _parameters.out.obj; }
+  int retval () const { return _parameters.out.ret; }
+  void *ptrval () const { return (void *)_parameters.out.ptr; }
+  vm_object_t objval () const { return _parameters.out.obj; }
 };
 
 #ifndef __INSIDE_CYGWIN__
-void shminit (void);
-int shmunload (void);
+void shminit ();
+int shmunload ();
 void shmexit_myhook (struct vmspace *vm);
 int cygwin_shmfork_myhook (struct thread *, struct proc *);
 
index 9e05238..202e288 100644 (file)
@@ -95,8 +95,8 @@ fhandler_base *build_fh_dev (const device&, const char * = NULL);
 fhandler_base *build_fh_name (const char *unix_name, HANDLE = NULL, unsigned = 0, suffix_info * = NULL);
 fhandler_base *build_fh_pc (path_conv& pc);
 
-void dtable_init (void);
-void stdio_init (void);
+void dtable_init ();
+void stdio_init ();
 extern dtable fdtab;
 
 extern "C" int getfdtabsize ();
index d375c0a..be3c020 100644 (file)
@@ -38,7 +38,6 @@ extern void sigdelayed ();
 
 extern DWORD sigtid;
 
-extern HANDLE hExeced;
 extern DWORD dwExeced;
 
 static BOOL WINAPI ctrl_c_handler (DWORD);
@@ -1165,7 +1164,7 @@ signal_exit (int rc)
 HANDLE NO_COPY tty_mutex = NULL;
 
 void
-events_init (void)
+events_init ()
 {
   char *name;
   char mutex_name[CYG_MAX_PATH];
@@ -1196,7 +1195,7 @@ events_init (void)
 }
 
 void
-events_terminate (void)
+events_terminate ()
 {
   exit_already = 1;
 }
index e5e08b0..b619b28 100644 (file)
@@ -1249,12 +1249,6 @@ fhandler_base::init (HANDLE f, DWORD a, mode_t bin)
   debug_printf ("created new fhandler_base for handle %p, bin %d", f, rbinary ());
 }
 
-void
-fhandler_base::dump (void)
-{
-  paranoid_printf ("here");
-}
-
 int
 fhandler_base::dup (fhandler_base *child)
 {
@@ -1345,7 +1339,7 @@ fhandler_base::tcsendbreak (int)
 }
 
 int
-fhandler_base::tcdrain (void)
+fhandler_base::tcdrain ()
 {
   set_errno (ENOTTY);
   return -1;
@@ -1380,7 +1374,7 @@ fhandler_base::tcsetpgrp (const pid_t)
 }
 
 int
-fhandler_base::tcgetpgrp (void)
+fhandler_base::tcgetpgrp ()
 {
   set_errno (ENOTTY);
   return -1;
@@ -1414,7 +1408,7 @@ fhandler_base::fhandler_base () :
 }
 
 /* Normal I/O destructor */
-fhandler_base::~fhandler_base (void)
+fhandler_base::~fhandler_base ()
 {
   if (rabuf)
     free (rabuf);
@@ -1428,12 +1422,6 @@ fhandler_dev_null::fhandler_dev_null () :
 {
 }
 
-void
-fhandler_dev_null::dump (void)
-{
-  paranoid_printf ("here");
-}
-
 int
 fhandler_dev_null::open (int flags, mode_t mode)
 {
index cb0f5b1..0165c28 100644 (file)
@@ -279,7 +279,7 @@ class fhandler_base
   virtual int __stdcall ftruncate (_off64_t) __attribute__ ((regparm (2)));
   virtual int __stdcall link (const char *) __attribute__ ((regparm (2)));
   virtual int __stdcall utimes (const struct timeval *) __attribute__ ((regparm (2)));
-  virtual int __stdcall fsync (void) __attribute__ ((regparm (1)));
+  virtual int __stdcall fsync () __attribute__ ((regparm (1)));
   virtual int ioctl (unsigned int cmd, void *);
   virtual int fcntl (int cmd, void *);
   virtual char const *ttyname () { return get_name (); }
@@ -289,7 +289,6 @@ class fhandler_base
   virtual ssize_t writev (const struct iovec *, int iovcnt, ssize_t tot = -1);
   virtual _off64_t lseek (_off64_t offset, int whence);
   virtual int lock (int, struct __flock64 *);
-  virtual void dump ();
   virtual int dup (fhandler_base *child);
 
   virtual HANDLE mmap (caddr_t *addr, size_t len, DWORD access,
@@ -389,16 +388,16 @@ class fhandler_socket: public fhandler_base
   void af_local_set_secret (char *);
   void af_local_setblocking (bool &, bool &);
   void af_local_unsetblocking (bool, bool);
-  void af_local_set_cred (void);
+  void af_local_set_cred ();
   void af_local_copy (fhandler_socket *);
-  bool af_local_recv_secret (void);
-  bool af_local_send_secret (void);
-  bool af_local_recv_cred (void);
-  bool af_local_send_cred (void);
-  int af_local_accept (void);
+  bool af_local_recv_secret ();
+  bool af_local_send_secret ();
+  bool af_local_recv_cred ();
+  bool af_local_send_cred ();
+  int af_local_accept ();
  public:
-  int af_local_connect (void);
-  void af_local_set_sockpair_cred (void);
+  int af_local_connect ();
+  void af_local_set_sockpair_cred ();
 
  private:
   struct _WSAPROTOCOL_INFOA *prot_info_ptr;
@@ -576,11 +575,9 @@ class fhandler_dev_raw: public fhandler_base
   fhandler_dev_raw ();
 
  public:
-  ~fhandler_dev_raw (void);
+  ~fhandler_dev_raw ();
 
   int open (int flags, mode_t mode = 0);
-  int close (void);
-
   void raw_read (void *ptr, size_t& ulen);
   int raw_write (const void *ptr, size_t ulen);
 
@@ -617,7 +614,7 @@ class fhandler_dev_tape: public fhandler_dev_raw
 
   bool is_rewind_device () { return get_minor () < 128; }
   unsigned int driveno () { return (unsigned int) get_minor () & 0x7f; }
-  void drive_init (void);
+  void drive_init ();
 
   inline bool _lock ();
   inline int unlock (int ret = 0);
@@ -626,7 +623,7 @@ class fhandler_dev_tape: public fhandler_dev_raw
   fhandler_dev_tape ();
 
   virtual int open (int flags, mode_t mode = 0);
-  virtual int close (void);
+  virtual int close ();
 
   void raw_read (void *ptr, size_t& ulen);
   int raw_write (const void *ptr, size_t ulen);
@@ -645,7 +642,7 @@ class fhandler_dev_tape: public fhandler_dev_raw
 
 class fhandler_disk_file: public fhandler_base
 {
-  void touch_ctime (void);
+  void touch_ctime ();
 
  public:
   fhandler_disk_file ();
@@ -724,7 +721,6 @@ class fhandler_serial: public fhandler_base
   int tcgetattr (struct termios *t);
   _off64_t lseek (_off64_t, int) { return 0; }
   int tcflush (int);
-  void dump ();
   int is_tty () { return 1; }
   void fixup_after_fork (HANDLE parent);
   void fixup_after_exec ();
@@ -1027,7 +1023,6 @@ class fhandler_dev_null: public fhandler_base
   fhandler_dev_null ();
   int open (int, mode_t);
 
-  void dump ();
   select_record *select_read (select_record *s);
   select_record *select_write (select_record *s);
   select_record *select_except (select_record *s);
@@ -1041,8 +1036,6 @@ class fhandler_dev_zero: public fhandler_base
   int write (const void *ptr, size_t len);
   void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3)));
   _off64_t lseek (_off64_t offset, int whence);
-
-  void dump ();
 };
 
 class fhandler_dev_random: public fhandler_base
@@ -1061,10 +1054,8 @@ class fhandler_dev_random: public fhandler_base
   int write (const void *ptr, size_t len);
   void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3)));
   _off64_t lseek (_off64_t offset, int whence);
-  int close (void);
+  int close ();
   int dup (fhandler_base *child);
-
-  void dump ();
 };
 
 class fhandler_dev_mem: public fhandler_base
@@ -1075,13 +1066,12 @@ class fhandler_dev_mem: public fhandler_base
 
  public:
   fhandler_dev_mem ();
-  ~fhandler_dev_mem (void);
+  ~fhandler_dev_mem ();
 
   int open (int flags, mode_t mode = 0);
   int write (const void *ptr, size_t ulen);
   void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3)));
   _off64_t lseek (_off64_t offset, int whence);
-  int close (void);
   int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2)));
   int dup (fhandler_base *child);
 
@@ -1090,30 +1080,25 @@ class fhandler_dev_mem: public fhandler_base
   int msync (HANDLE h, caddr_t addr, size_t len, int flags);
   bool fixup_mmap_after_fork (HANDLE h, DWORD access, int flags,
                              _off64_t offset, DWORD size, void *address);
-
-  void dump ();
 } ;
 
 class fhandler_dev_clipboard: public fhandler_base
 {
+  _off64_t pos;
+  void *membuffer;
+  size_t msize;
+  bool eof;
  public:
   fhandler_dev_clipboard ();
-  int is_windows (void) { return 1; }
+  int is_windows () { return 1; }
   int open (int flags, mode_t mode = 0);
   int write (const void *ptr, size_t len);
   void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3)));
   _off64_t lseek (_off64_t offset, int whence);
-  int close (void);
+  int close ();
 
   int dup (fhandler_base *child);
-
-  void dump ();
-
- private:
-  _off64_t pos;
-  void *membuffer;
-  size_t msize;
-  bool eof;
+  void fixup_after_exec ();
 };
 
 class fhandler_windows: public fhandler_base
@@ -1123,13 +1108,13 @@ class fhandler_windows: public fhandler_base
   int method_;  // write method (Post or Send)
  public:
   fhandler_windows ();
-  int is_windows (void) { return 1; }
+  int is_windows () { return 1; }
   int open (int flags, mode_t mode = 0);
   int write (const void *ptr, size_t len);
   void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3)));
   int ioctl (unsigned int cmd, void *);
   _off64_t lseek (_off64_t, int) { return 0; }
-  int close (void) { return 0; }
+  int close () { return 0; }
 
   void set_close_on_exec (bool val);
   void fixup_after_fork (HANDLE parent);
@@ -1160,9 +1145,8 @@ class fhandler_dev_dsp: public fhandler_base
   void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3)));
   int ioctl (unsigned int cmd, void *);
   _off64_t lseek (_off64_t, int);
-  int close (void);
+  int close ();
   int dup (fhandler_base *child);
-  void dump (void);
   void fixup_after_fork (HANDLE parent);
   void fixup_after_exec ();
  private:
@@ -1194,7 +1178,7 @@ class fhandler_virtual : public fhandler_base
   _off64_t lseek (_off64_t, int);
   int dup (fhandler_base *child);
   int open (int flags, mode_t mode = 0);
-  int close (void);
+  int close ();
   int __stdcall fstat (struct stat *buf) __attribute__ ((regparm (2)));
   int __stdcall fchmod (mode_t mode) __attribute__ ((regparm (1)));
   int __stdcall fchown (__uid32_t uid, __gid32_t gid) __attribute__ ((regparm (2)));
@@ -1246,7 +1230,7 @@ class fhandler_registry: public fhandler_proc
   int open (int flags, mode_t mode = 0);
   int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2)));
   bool fill_filebuf ();
-  int close (void);
+  int close ();
 };
 
 class pinfo;
index dc9276c..41313cc 100644 (file)
@@ -257,18 +257,21 @@ fhandler_dev_clipboard::lseek (_off64_t offset, int whence)
 }
 
 int
-fhandler_dev_clipboard::close (void)
+fhandler_dev_clipboard::close ()
 {
-  eof = true;
-  pos = 0;
-  if (membuffer)
-    free (membuffer);
-  msize = 0;
+  if (!hExeced)
+    {
+      eof = true;
+      pos = 0;
+      if (membuffer)
+       free (membuffer);
+      msize = 0;
+    }
   return 0;
 }
 
 void
-fhandler_dev_clipboard::dump ()
+fhandler_dev_clipboard::fixup_after_exec ()
 {
-  paranoid_printf ("here, fhandler_dev_clipboard");
+  (void) close ();
 }
index 4733c9f..3dcea84 100644 (file)
@@ -688,13 +688,11 @@ fhandler_console::open (int flags, mode_t)
 }
 
 int
-fhandler_console::close (void)
+fhandler_console::close ()
 {
   CloseHandle (get_io_handle ());
   CloseHandle (get_output_handle ());
-  set_io_handle (NULL);
-  set_output_handle (NULL);
-  if (--(cygheap->open_fhs) <= 0 && myself->ctty != TTY_CONSOLE)
+  if (!hExeced && --(cygheap->open_fhs) <= 0 && myself->ctty != TTY_CONSOLE)
     {
       syscall_printf ("open_fhs %d", cygheap->open_fhs);
       FreeConsole ();
@@ -1753,7 +1751,7 @@ fhandler_console::init (HANDLE f, DWORD a, mode_t bin)
 }
 
 int
-fhandler_console::igncr_enabled (void)
+fhandler_console::igncr_enabled ()
 {
   return tc->ti.c_iflag & IGNCR;
 }
index 7c2aaf0..491b559 100644 (file)
@@ -443,7 +443,7 @@ fhandler_disk_file::fstat (struct __stat64 *buf)
 }
 
 void
-fhandler_disk_file::touch_ctime (void)
+fhandler_disk_file::touch_ctime ()
 {
   FILETIME ft;
 
@@ -966,9 +966,12 @@ out:
 int
 fhandler_disk_file::close ()
 {
-  /* Changing inode data requires setting ctime (only 9x). */
-  if (has_changed ())
-    touch_ctime ();
+  if (!hExeced)
+    {
+      /* Changing inode data requires setting ctime (only 9x). */
+      if (has_changed ())
+       touch_ctime ();
+    }
   return close_fs ();
 }
 
index 6a10a24..c3e185a 100644 (file)
@@ -1109,17 +1109,20 @@ fhandler_dev_dsp::close_audio_out (bool immediately)
 }
 
 int
-fhandler_dev_dsp::close (void)
+fhandler_dev_dsp::close ()
 {
   debug_printf ("audio_in=%08x audio_out=%08x",
                (int)audio_in_, (int)audio_out_);
-  if ((fhandler_dev_dsp *) archetype != this)
-    return ((fhandler_dev_dsp *)archetype)->close ();
-
-  if (--usecount == 0)
+  if (!hExeced)
     {
-      close_audio_in ();
-      close_audio_out (exit_state != ES_NOT_EXITING);
+      if ((fhandler_dev_dsp *) archetype != this)
+       return ((fhandler_dev_dsp *) archetype)->close ();
+
+      if (--usecount == 0)
+       {
+         close_audio_in ();
+         close_audio_out (exit_state != ES_NOT_EXITING);
+       }
     }
   return 0;
 }
@@ -1343,12 +1346,6 @@ fhandler_dev_dsp::ioctl (unsigned int cmd, void *ptr)
 }
 
 void
-fhandler_dev_dsp::dump ()
-{
-  paranoid_printf ("here");
-}
-
-void
 fhandler_dev_dsp::fixup_after_fork (HANDLE parent)
 { // called from new child process
   debug_printf ("audio_in=%08x audio_out=%08x",
index 742b70c..694a518 100644 (file)
@@ -62,7 +62,8 @@ fhandler_fifo::close ()
   fhandler_pipe::close ();
   if (get_output_handle ())
     CloseHandle (get_output_handle ());
-  set_use (-1);
+  if (!hExeced)
+    set_use (-1);
   return 0;
 }
 
index ff1798c..53c5186 100644 (file)
@@ -27,7 +27,7 @@ fhandler_dev_mem::fhandler_dev_mem ()
 {
 }
 
-fhandler_dev_mem::~fhandler_dev_mem (void)
+fhandler_dev_mem::~fhandler_dev_mem ()
 {
 }
 
@@ -220,12 +220,6 @@ fhandler_dev_mem::read (void *ptr, size_t& ulen)
   return;
 }
 
-int
-fhandler_dev_mem::close (void)
-{
-  return fhandler_base::close ();
-}
-
 _off64_t
 fhandler_dev_mem::lseek (_off64_t offset, int whence)
 {
@@ -428,9 +422,3 @@ fhandler_dev_mem::dup (fhandler_base *child)
     }
   return ret;
 }
-
-void
-fhandler_dev_mem::dump ()
-{
-  paranoid_printf ("here, fhandler_dev_mem");
-}
index abca009..eecbe65 100644 (file)
@@ -146,9 +146,9 @@ fhandler_dev_random::lseek (_off64_t, int)
 }
 
 int
-fhandler_dev_random::close (void)
+fhandler_dev_random::close ()
 {
-  if (crypt_prov)
+  if (!hExeced && crypt_prov)
     while (!CryptReleaseContext (crypt_prov, 0)
           && GetLastError () == ERROR_BUSY)
       Sleep (10);
@@ -162,9 +162,3 @@ fhandler_dev_random::dup (fhandler_base *child)
   fhr->crypt_prov = (HCRYPTPROV)NULL;
   return 0;
 }
-
-void
-fhandler_dev_random::dump ()
-{
-  paranoid_printf ("here, fhandler_dev_random");
-}
index 0a80cc4..5b2bb63 100644 (file)
@@ -75,7 +75,7 @@ fhandler_dev_raw::fhandler_dev_raw ()
   need_fork_fixup (true);
 }
 
-fhandler_dev_raw::~fhandler_dev_raw (void)
+fhandler_dev_raw::~fhandler_dev_raw ()
 {
   if (devbufsiz > 1L)
     delete [] devbuf;
@@ -136,12 +136,6 @@ fhandler_dev_raw::open (int flags, mode_t)
   return res;
 }
 
-int
-fhandler_dev_raw::close (void)
-{
-  return fhandler_base::close ();
-}
-
 void
 fhandler_dev_raw::raw_read (void *ptr, size_t& ulen)
 {
index 383643b..a7a0e29 100644 (file)
@@ -534,7 +534,7 @@ fhandler_registry::close ()
          res = -1;
        }
     }
-  if (value_name)
+  if (!hExeced && value_name)
     cfree (value_name);
   return res;
 }
index b91adc9..4c587c9 100644 (file)
@@ -198,12 +198,6 @@ err:
 }
 
 void
-fhandler_serial::dump (void)
-{
-  paranoid_printf ("here");
-}
-
-void
 fhandler_serial::init (HANDLE f, DWORD flags, mode_t bin)
 {
   (void) open (flags, bin & (O_BINARY | O_TEXT));
@@ -332,7 +326,7 @@ fhandler_serial::tcsendbreak (int duration)
 
 /* tcdrain: POSIX 7.2.2.1 */
 int
-fhandler_serial::tcdrain (void)
+fhandler_serial::tcdrain ()
 {
   if (FlushFileBuffers (get_handle ()) == 0)
     return -1;
index ffe647c..496f4ff 100644 (file)
@@ -165,7 +165,7 @@ fhandler_socket::open (int flags, mode_t mode)
 }
 
 void
-fhandler_socket::af_local_set_sockpair_cred (void)
+fhandler_socket::af_local_set_sockpair_cred ()
 {
   sec_pid = sec_peer_pid = getpid ();
   sec_uid = sec_peer_uid = geteuid32 ();
@@ -202,7 +202,7 @@ fhandler_socket::af_local_unsetblocking (bool async, bool nonblocking)
 }
 
 bool
-fhandler_socket::af_local_recv_secret (void)
+fhandler_socket::af_local_recv_secret ()
 {
   int out[4] = { 0, 0, 0, 0 };
   int rest = sizeof out;
@@ -232,7 +232,7 @@ fhandler_socket::af_local_recv_secret (void)
 }
 
 bool
-fhandler_socket::af_local_send_secret (void)
+fhandler_socket::af_local_send_secret ()
 {
   int rest = sizeof connect_secret;
   char *ptr = (char *) connect_secret;
@@ -250,7 +250,7 @@ fhandler_socket::af_local_send_secret (void)
 }
 
 bool
-fhandler_socket::af_local_recv_cred (void)
+fhandler_socket::af_local_recv_cred ()
 {
   struct ucred out = { (pid_t) 0, (__uid32_t) -1, (__gid32_t) -1 };
   int rest = sizeof out;
@@ -277,7 +277,7 @@ fhandler_socket::af_local_recv_cred (void)
 }
 
 bool
-fhandler_socket::af_local_send_cred (void)
+fhandler_socket::af_local_send_cred ()
 {
   struct ucred in = { sec_pid, sec_uid, sec_gid };
   int rest = sizeof in;
@@ -298,7 +298,7 @@ fhandler_socket::af_local_send_cred (void)
 }
 
 int
-fhandler_socket::af_local_connect (void)
+fhandler_socket::af_local_connect ()
 {
   /* This keeps the test out of select. */
   if (get_addr_family () != AF_LOCAL || get_socket_type () != SOCK_STREAM)
@@ -320,7 +320,7 @@ fhandler_socket::af_local_connect (void)
 }
 
 int
-fhandler_socket::af_local_accept (void)
+fhandler_socket::af_local_accept ()
 {
   debug_printf ("af_local_accept called");
   bool orig_async_io, orig_is_nonblocking;
@@ -339,7 +339,7 @@ fhandler_socket::af_local_accept (void)
 }
 
 void
-fhandler_socket::af_local_set_cred (void)
+fhandler_socket::af_local_set_cred ()
 {
   sec_pid = getpid ();
   sec_uid = geteuid32 ();
index 2b1d458..b251d70 100644 (file)
@@ -1128,7 +1128,7 @@ mtinfo_drive::ioctl (HANDLE mt, unsigned int cmd, void *buf)
 /* mtinfo */
 
 void
-mtinfo::initialize (void)
+mtinfo::initialize ()
 {
   char name[CYG_MAX_PATH];
   HANDLE mtx;
@@ -1241,7 +1241,7 @@ fhandler_dev_tape::open (int flags, mode_t)
 }
 
 int
-fhandler_dev_tape::close (void)
+fhandler_dev_tape::close ()
 {
   int ret, cret;
 
index 3d3cab5..9fe3c5e 100644 (file)
@@ -612,20 +612,23 @@ out:
 int
 fhandler_tty_slave::close ()
 {
-  if (!--cygheap->open_fhs && myself->ctty == -1)
-    FreeConsole ();
+  if (!hExeced)
+    {
+      if (!--cygheap->open_fhs && myself->ctty == -1)
+       FreeConsole ();
 
-  archetype->usecount--;
-  report_tty_counts (this, "closed", "decremented ", "");
+      archetype->usecount--;
+      report_tty_counts (this, "closed", "decremented ", "");
 
-  if (archetype->usecount)
-    {
+      if (archetype->usecount)
+       {
 #ifdef DEBUGGING
-      if (archetype->usecount < 0)
-       system_printf ("error: usecount %d", archetype->usecount);
+         if (archetype->usecount < 0)
+           system_printf ("error: usecount %d", archetype->usecount);
 #endif
-      termios_printf ("just returning because archetype usecount is != 0");
-      return 0;
+         termios_printf ("just returning because archetype usecount is != 0");
+         return 0;
+       }
     }
 
   termios_printf ("closing last open %s handle", ttyname ());
@@ -1208,8 +1211,11 @@ fhandler_tty_common::close ()
   if (!ForceCloseHandle1 (get_output_handle (), to_pty))
     termios_printf ("CloseHandle (get_output_handle ()<%p>), %E", get_output_handle ());
 
-  inuse = NULL;
-  set_io_handle (NULL);
+  if (!hExeced)
+    {
+      inuse = NULL;
+      set_io_handle (NULL);
+    }
   return 0;
 }
 
@@ -1235,7 +1241,8 @@ fhandler_pty_master::close ()
        CloseHandle (get_ttyp ()->from_master);
       if (get_ttyp ()->to_master)
        CloseHandle (get_ttyp ()->to_master);
-      get_ttyp ()->init ();
+      if (!hExeced)
+       get_ttyp ()->init ();
     }
 
   return 0;
index 32d700a..a052c4b 100644 (file)
@@ -40,8 +40,7 @@ fhandler_virtual::~fhandler_virtual ()
 void
 fhandler_virtual::fixup_after_exec ()
 {
-  if (filebuf)
-    filebuf = NULL;
+  close ();
 }
 
 DIR *
@@ -166,11 +165,13 @@ fhandler_virtual::dup (fhandler_base * child)
 int
 fhandler_virtual::close ()
 {
-  if (filebuf)
-    free (filebuf);
-  filebuf = NULL;
-  bufalloc = (size_t) -1;
-  user_shared->delqueue.process_queue ();
+  if (!hExeced)
+    {
+      if (filebuf)
+       free (filebuf);
+      filebuf = NULL;
+      bufalloc = (size_t) -1;
+    }
   return 0;
 }
 
index 9068986..4938c36 100644 (file)
@@ -54,9 +54,3 @@ fhandler_dev_zero::lseek (_off64_t, int)
 {
   return 0;
 }
-
-void
-fhandler_dev_zero::dump ()
-{
-  paranoid_printf ("here, fhandler_dev_zero");
-}
index a3c5f13..12eed33 100644 (file)
@@ -94,7 +94,7 @@ class mmap_record
 
     bool alloc_page_map (_off64_t off, DWORD len);
     void free_page_map () { if (page_map_) cfree (page_map_); }
-    void fixup_page_map (void);
+    void fixup_page_map ();
 
     DWORD find_unused_pages (DWORD pages);
     _off64_t map_pages (_off64_t off, DWORD len);
index cf69496..dd78c7f 100644 (file)
@@ -125,8 +125,8 @@ public:
   IMPLEMENT_STATUS_FLAG (bool, sysv)
   IMPLEMENT_STATUS_FLAG (bool, nowait)
 
-  PTAPE_GET_DRIVE_PARAMETERS dp (void) { return &_dp; }
-  PTAPE_GET_MEDIA_PARAMETERS mp (void) { return &_mp; }
+  PTAPE_GET_DRIVE_PARAMETERS dp () { return &_dp; }
+  PTAPE_GET_MEDIA_PARAMETERS mp () { return &_mp; }
   mtinfo_part *part (int num) { return &_part[num]; }
 };
 
@@ -137,7 +137,7 @@ class mtinfo
   mtinfo_drive _drive[MAX_DRIVE_NUM];
 
 public:
-  void initialize (void);
+  void initialize ();
   mtinfo_drive *drive (int num) { return &_drive[num]; }
 };
 
index b4a9f0b..9e5dd4e 100644 (file)
@@ -960,7 +960,6 @@ proc_waiter (void *arg)
     {
       DWORD nb;
       char buf = '\0';
-      extern HANDLE hExeced;
 
       if (!ReadFile (vchild.rd_proc_pipe, &buf, 1, &nb, NULL)
          && GetLastError () != ERROR_BROKEN_PIPE)
index d35cee6..956d70a 100644 (file)
@@ -130,7 +130,7 @@ pthread_setcanceltype (int type, int *oldtype)
 }
 
 void
-pthread_testcancel (void)
+pthread_testcancel ()
 {
   pthread::self ()->testcancel ();
 }
index 0f4b2fe..85f9738 100644 (file)
@@ -493,7 +493,7 @@ sched_setscheduler (pid_t pid, int policy,
 
 /* yield the cpu */
 int
-sched_yield (void)
+sched_yield ()
 {
   low_priority_sleep (0);
   return 0;
index 20ef794..4abbfdd 100644 (file)
@@ -242,7 +242,7 @@ security_descriptor::realloc (size_t nsize)
 }
 
 void
-security_descriptor::free (void)
+security_descriptor::free ()
 {
   if (psd)
     ::free (psd);
index 8987098..a15f55e 100644 (file)
@@ -188,9 +188,9 @@ public:
 
   PSECURITY_DESCRIPTOR malloc (size_t nsize);
   PSECURITY_DESCRIPTOR realloc (size_t nsize);
-  void free (void);
+  void free ();
 
-  inline DWORD size (void) const { return sd_size; }
+  inline DWORD size () const { return sd_size; }
   inline operator const PSECURITY_DESCRIPTOR () { return psd; }
 };
 
@@ -368,7 +368,7 @@ void set_cygwin_privileges (HANDLE token);
 
 /* shared.cc: */
 /* Retrieve a security descriptor that allows all access */
-SECURITY_DESCRIPTOR *__stdcall get_null_sd (void);
+SECURITY_DESCRIPTOR *__stdcall get_null_sd ();
 
 /* Various types of security attributes for use in Create* functions. */
 extern SECURITY_ATTRIBUTES sec_none, sec_none_nih, sec_all, sec_all_nih;
index 758bd52..3c7d19f 100644 (file)
@@ -81,8 +81,6 @@ static bool __stdcall remove_proc (int);
 static bool __stdcall stopped_or_terminated (waitq *, _pinfo *);
 static DWORD WINAPI wait_sig (VOID *arg);
 
-extern HANDLE hExeced;
-
 /* wait_sig bookkeeping */
 
 class pending_signals
index acd9974..5ecf64e 100644 (file)
@@ -354,14 +354,14 @@ MTinterface::Init ()
 }
 
 void
-MTinterface::fixup_before_fork (void)
+MTinterface::fixup_before_fork ()
 {
   pthread_key::fixup_before_fork ();
 }
 
 /* This function is called from a single threaded process */
 void
-MTinterface::fixup_after_fork (void)
+MTinterface::fixup_after_fork ()
 {
   pthread_key::fixup_after_fork ();
 
@@ -570,7 +570,7 @@ pthread::exit (void *value_ptr)
 }
 
 int
-pthread::cancel (void)
+pthread::cancel ()
 {
   class pthread *thread = this;
   class pthread *self = pthread::self ();
@@ -788,7 +788,7 @@ opengroup specs.
 }
 
 void
-pthread::testcancel (void)
+pthread::testcancel ()
 {
   if (cancelstate == PTHREAD_CANCEL_DISABLE)
     return;
@@ -798,7 +798,7 @@ pthread::testcancel (void)
 }
 
 void
-pthread::static_cancel_self (void)
+pthread::static_cancel_self ()
 {
   pthread::self ()->cancel_self ();
 }
@@ -2038,7 +2038,7 @@ pthread::cancel (pthread_t thread)
 }
 
 void
-pthread::atforkprepare (void)
+pthread::atforkprepare ()
 {
   callback *cb = MT_INTERFACE->pthread_prepare;
   while (cb)
@@ -2053,7 +2053,7 @@ pthread::atforkprepare (void)
 }
 
 void
-pthread::atforkparent (void)
+pthread::atforkparent ()
 {
   __fp_unlock_all ();
 
@@ -2066,7 +2066,7 @@ pthread::atforkparent (void)
 }
 
 void
-pthread::atforkchild (void)
+pthread::atforkchild ()
 {
   MT_INTERFACE->fixup_after_fork ();
 
@@ -2419,7 +2419,7 @@ pthread::resume (pthread_t *thread)
    See http://www.opengroup.org/onlinepubs/007908799/xsh/pthread_getconcurrency.html
 */
 extern "C" int
-pthread_getconcurrency (void)
+pthread_getconcurrency ()
 {
   return MT_INTERFACE->concurrency;
 }
index ce89863..7fa6198 100644 (file)
@@ -454,7 +454,7 @@ private:
 
   void _fixup_after_fork ();
 
-  void pop_all_cleanup_handlers (void);
+  void pop_all_cleanup_handlers ();
   void precreate (pthread_attr *);
   void postcreate ();
   bool create_cancel_event ();
@@ -689,8 +689,8 @@ struct MTinterface
   callback *pthread_parent;
 
   void Init ();
-  void fixup_before_fork (void);
-  void fixup_after_fork (void);
+  void fixup_before_fork ();
+  void fixup_after_fork ();
 
 #if 0 // avoid initialization since zero is implied and
   MTinterface () :
index e2883fe..78fce27 100644 (file)
@@ -55,7 +55,7 @@ ttyslot (void)
 }
 
 void __stdcall
-tty_init (void)
+tty_init ()
 {
   if (!myself->cygstarted && NOTSTATE (myself, PID_CYGPARENT))
     cygheap->fdtab.get_debugger_info ();
@@ -105,7 +105,7 @@ create_tty_master (int ttynum)
 }
 
 void __stdcall
-tty_terminate (void)
+tty_terminate ()
 {
   if (NOTSTATE (myself, PID_USETTY))
     return;
@@ -125,7 +125,7 @@ attach_tty (int num)
 }
 
 void
-tty_list::terminate (void)
+tty_list::terminate ()
 {
   int ttynum = myself->ctty;
 
@@ -186,7 +186,7 @@ tty_list::connect_tty (int ttynum)
 }
 
 void
-tty_list::init (void)
+tty_list::init ()
 {
   for (int i = 0; i < NTTYS; i++)
     {
@@ -365,7 +365,7 @@ tty::create_inuse (const char *fmt)
 }
 
 void
-tty::init (void)
+tty::init ()
 {
   output_stopped = 0;
   setsid (0);
index 7bec185..2178d27 100644 (file)
@@ -205,7 +205,7 @@ extern exit_states exit_state;
 void __stdcall do_exit (int) __attribute__ ((regparm (1), noreturn));
 
 /* UID/GID */
-void uinfo_init (void);
+void uinfo_init ();
 
 #define ILLEGAL_UID16 ((__uid16_t)-1)
 #define ILLEGAL_UID ((__uid32_t)-1)
@@ -220,8 +220,8 @@ void uinfo_init (void);
 #define get_ll(pl)  (((long long) (pl).HighPart << 32) | (pl).LowPart)
 
 /* various events */
-void events_init (void);
-void events_terminate (void);
+void events_init ();
+void events_terminate ();
 
 void __stdcall close_all_files (bool = false);
 
@@ -297,7 +297,7 @@ int fcntl_worker (int fd, int cmd, void *arg);
 extern "C" int low_priority_sleep (DWORD) __attribute__ ((regparm (1)));
 #define SLEEP_0_STAY_LOW INFINITE
 
-size_t getshmlba (void);
+size_t getshmlba ();
 
 int winprio_to_nice (DWORD) __attribute__ ((regparm (1)));
 DWORD nice_to_winprio (int &) __attribute__ ((regparm (1)));
@@ -336,6 +336,7 @@ extern HANDLE hMainThread;
 extern HANDLE hMainProc;
 extern HANDLE hProcToken;
 extern HANDLE hProcImpToken;
+extern HANDLE hExeced;
 
 extern bool cygwin_testing;