OSDN Git Service

Rename hinfo -> dtable. Name the former dtable array 'fdtab'.
authorcgf <cgf>
Sat, 12 Aug 2000 04:48:44 +0000 (04:48 +0000)
committercgf <cgf>
Sat, 12 Aug 2000 04:48:44 +0000 (04:48 +0000)
22 files changed:
winsup/cygwin/ChangeLog
winsup/cygwin/dcrt0.cc
winsup/cygwin/dtable.cc
winsup/cygwin/fcntl.cc
winsup/cygwin/fhandler_tty.cc
winsup/cygwin/fork.cc
winsup/cygwin/ioctl.cc
winsup/cygwin/mmap.cc
winsup/cygwin/net.cc
winsup/cygwin/passwd.cc
winsup/cygwin/pinfo.cc
winsup/cygwin/pipe.cc
winsup/cygwin/poll.cc
winsup/cygwin/security.cc
winsup/cygwin/select.cc
winsup/cygwin/spawn.cc
winsup/cygwin/syscalls.cc
winsup/cygwin/sysconf.cc
winsup/cygwin/syslog.cc
winsup/cygwin/termios.cc
winsup/cygwin/tty.cc
winsup/cygwin/winsup.h

index 3f16c25..416b3d8 100644 (file)
@@ -1,3 +1,7 @@
+Sat Aug 12 00:47:11 2000  Christopher Faylor <cgf@cygnus.com>
+
+       Rename hinfo -> dtable.  Name the former dtable array 'fdtab'.
+
 Fri Aug 11 14:47:00 2000  Corinna Vinschen <corinna@vinschen.de>
 
        * poll.cc: Allow any descriptor and any number of descriptors.
index f84a164..aa00a3a 100644 (file)
@@ -729,8 +729,8 @@ dll_crt0_1 ()
       set_console_title (cp);
     }
 
-  /* Allocate dtable */
-  dtable_init ();
+  /* Allocate fdtab */
+  fdtab_init ();
 
 /* Initialize uid, gid. */
   uinfo_init ();
@@ -742,7 +742,7 @@ dll_crt0_1 ()
   tty_init ();
 
   /* Set up standard fds in file descriptor table. */
-  hinfo_init ();
+  stdio_init ();
 
   if (user_data->premain[0])
     for (unsigned int i = 0; i < PREMAIN_LEN / 2; i++)
index 72ee96f..45c0680 100644 (file)
@@ -1,4 +1,4 @@
-/* hinfo.cc: file descriptor support.
+/* dtable.cc: file descriptor support.
 
    Copyright 1996, 1997, 1998, 1999, 2000 Cygnus Solutions.
 
@@ -21,29 +21,29 @@ details. */
 
 #include <winsock.h>
 
-hinfo dtable;
+dtable fdtab;
 
 /* Set aside space for the table of fds */
 void
-dtable_init (void)
+fdtab_init (void)
 {
-  if (!dtable.size)
-    dtable.extend(NOFILE_INCR);
+  if (!fdtab.size)
+    fdtab.extend(NOFILE_INCR);
 }
 
 void __stdcall
 set_std_handle (int fd)
 {
   if (fd == 0)
-    SetStdHandle (STD_INPUT_HANDLE, dtable[fd]->get_handle ());
+    SetStdHandle (STD_INPUT_HANDLE, fdtab[fd]->get_handle ());
   else if (fd == 1)
-    SetStdHandle (STD_OUTPUT_HANDLE, dtable[fd]->get_output_handle ());
+    SetStdHandle (STD_OUTPUT_HANDLE, fdtab[fd]->get_output_handle ());
   else if (fd == 2)
-    SetStdHandle (STD_ERROR_HANDLE, dtable[fd]->get_output_handle ());
+    SetStdHandle (STD_ERROR_HANDLE, fdtab[fd]->get_output_handle ());
 }
 
 int
-hinfo::extend (int howmuch)
+dtable::extend (int howmuch)
 {
   int new_size = size + howmuch;
   fhandler_base **newfds;
@@ -76,7 +76,7 @@ hinfo::extend (int howmuch)
    initialized at each fork () call.  */
 
 void
-hinfo_init (void)
+stdio_init (void)
 {
   /* Set these before trying to output anything from strace.
      Also, always set them even if we're to pick up our parent's fds
@@ -88,7 +88,7 @@ hinfo_init (void)
       HANDLE out = GetStdHandle (STD_OUTPUT_HANDLE);
       HANDLE err = GetStdHandle (STD_ERROR_HANDLE);
 
-      dtable.init_std_file_from_handle (0, in, GENERIC_READ, "{stdin}");
+      fdtab.init_std_file_from_handle (0, in, GENERIC_READ, "{stdin}");
 
       /* STD_ERROR_HANDLE has been observed to be the same as
         STD_OUTPUT_HANDLE.  We need separate handles (e.g. using pipes
@@ -106,13 +106,13 @@ hinfo_init (void)
            }
        }
 
-      dtable.init_std_file_from_handle (1, out, GENERIC_WRITE, "{stdout}");
-      dtable.init_std_file_from_handle (2, err, GENERIC_WRITE, "{stderr}");
+      fdtab.init_std_file_from_handle (1, out, GENERIC_WRITE, "{stdout}");
+      fdtab.init_std_file_from_handle (2, err, GENERIC_WRITE, "{stderr}");
     }
 }
 
 int
-hinfo::not_open (int fd)
+dtable::not_open (int fd)
 {
   SetResourceLock(LOCK_FD_LIST,READ_LOCK," not_open");
 
@@ -123,7 +123,7 @@ hinfo::not_open (int fd)
 }
 
 int
-hinfo::find_unused_handle (int start)
+dtable::find_unused_handle (int start)
 {
   AssertResourceOwner(LOCK_FD_LIST, READ_LOCK);
 
@@ -139,7 +139,7 @@ hinfo::find_unused_handle (int start)
 }
 
 void
-hinfo::release (int fd)
+dtable::release (int fd)
 {
   if (!not_open (fd))
     {
@@ -149,7 +149,7 @@ hinfo::release (int fd)
 }
 
 void
-hinfo::init_std_file_from_handle (int fd, HANDLE handle,
+dtable::init_std_file_from_handle (int fd, HANDLE handle,
                                  DWORD myaccess, const char *name)
 {
   int bin = binmode ? O_BINARY : 0;
@@ -190,14 +190,14 @@ cygwin_attach_handle_to_fd (char *name, int fd, HANDLE handle, mode_t bin,
                              DWORD myaccess)
 {
   if (fd == -1)
-    fd = dtable.find_unused_handle();
-  fhandler_base *res = dtable.build_fhandler (fd, name, handle);
+    fd = fdtab.find_unused_handle();
+  fhandler_base *res = fdtab.build_fhandler (fd, name, handle);
   res->init (handle, myaccess, bin);
   return fd;
 }
 
 fhandler_base *
-hinfo::build_fhandler (int fd, const char *name, HANDLE handle)
+dtable::build_fhandler (int fd, const char *name, HANDLE handle)
 {
   int unit;
   DWORD devn;
@@ -229,7 +229,7 @@ hinfo::build_fhandler (int fd, const char *name, HANDLE handle)
 }
 
 fhandler_base *
-hinfo::build_fhandler (int fd, DWORD dev, const char *name, int unit)
+dtable::build_fhandler (int fd, DWORD dev, const char *name, int unit)
 {
   fhandler_base *fh;
   void *buf = calloc (1, sizeof (fhandler_union) + 100);
@@ -297,7 +297,7 @@ hinfo::build_fhandler (int fd, DWORD dev, const char *name, int unit)
 }
 
 fhandler_base *
-hinfo::dup_worker (fhandler_base *oldfh)
+dtable::dup_worker (fhandler_base *oldfh)
 {
   fhandler_base *newfh = build_fhandler (-1, oldfh->get_device (), NULL);
   *newfh = *oldfh;
@@ -315,7 +315,7 @@ hinfo::dup_worker (fhandler_base *oldfh)
 }
 
 int
-hinfo::dup2 (int oldfd, int newfd)
+dtable::dup2 (int oldfd, int newfd)
 {
   int res = -1;
   fhandler_base *newfh = NULL; // = NULL to avoid an incorrect warning
@@ -343,7 +343,7 @@ hinfo::dup2 (int oldfd, int newfd)
     }
 
   SetResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK,"dup");
-  if ((size_t) newfd >= dtable.size || newfd < 0)
+  if ((size_t) newfd >= fdtab.size || newfd < 0)
     {
       syscall_printf ("new fd out of bounds: %d", newfd);
       set_errno (EBADF);
@@ -366,14 +366,14 @@ done:
 }
 
 select_record *
-hinfo::select_read (int fd, select_record *s)
+dtable::select_read (int fd, select_record *s)
 {
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
       return NULL;
     }
-  fhandler_base *fh = dtable[fd];
+  fhandler_base *fh = fdtab[fd];
   s = fh->select_read (s);
   s->fd = fd;
   s->fh = fh;
@@ -383,14 +383,14 @@ hinfo::select_read (int fd, select_record *s)
 }
 
 select_record *
-hinfo::select_write (int fd, select_record *s)
+dtable::select_write (int fd, select_record *s)
 {
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
       return NULL;
     }
-  fhandler_base *fh = dtable[fd];
+  fhandler_base *fh = fdtab[fd];
   s = fh->select_write (s);
   s->fd = fd;
   s->fh = fh;
@@ -400,14 +400,14 @@ hinfo::select_write (int fd, select_record *s)
 }
 
 select_record *
-hinfo::select_except (int fd, select_record *s)
+dtable::select_except (int fd, select_record *s)
 {
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
       return NULL;
     }
-  fhandler_base *fh = dtable[fd];
+  fhandler_base *fh = fdtab[fd];
   s = fh->select_except (s);
   s->fd = fd;
   s->fh = fh;
@@ -417,7 +417,7 @@ hinfo::select_except (int fd, select_record *s)
 }
 
 /*
- * Function to take an existant hinfo array
+ * Function to take an existant dtable array
  * and linearize it into a memory buffer.
  * If memory buffer is NULL, it returns the size
  * of memory buffer needed to do the linearization.
@@ -425,7 +425,7 @@ hinfo::select_except (int fd, select_record *s)
  */
 
 int
-hinfo::linearize_fd_array (unsigned char *in_buf, int buflen)
+dtable::linearize_fd_array (unsigned char *in_buf, int buflen)
 {
   /* If buf == NULL, just precalculate length */
   if (in_buf == NULL)
@@ -492,19 +492,19 @@ hinfo::linearize_fd_array (unsigned char *in_buf, int buflen)
 }
 
 /*
- * Function to take a linearized hinfo array in a memory buffer and
- * re-create the original hinfo array.
+ * Function to take a linearized dtable array in a memory buffer and
+ * re-create the original dtable array.
  */
 
 LPBYTE
-hinfo::de_linearize_fd_array (LPBYTE buf)
+dtable::de_linearize_fd_array (LPBYTE buf)
 {
   int len, max_used_fd;
   size_t inc_size;
 
   debug_printf ("buf %x", buf);
 
-  /* First get the number of fd's - use this to set the dtablesize.
+  /* First get the number of fd's - use this to set the fdtabsize.
      NB. This is the only place in the code this should be done !!
   */
 
@@ -554,7 +554,7 @@ hinfo::de_linearize_fd_array (LPBYTE buf)
 }
 
 void
-hinfo::fixup_after_fork (HANDLE parent)
+dtable::fixup_after_fork (HANDLE parent)
 {
   SetResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK,"dup");
   for (size_t i = 0; i < size; i++)
@@ -571,7 +571,7 @@ hinfo::fixup_after_fork (HANDLE parent)
 }
 
 int
-hinfo::vfork_child_dup ()
+dtable::vfork_child_dup ()
 {
   fhandler_base **newtable;
   newtable = (fhandler_base **) calloc (size, sizeof(fds[0]));
@@ -595,7 +595,7 @@ out:
 }
 
 void
-hinfo::vfork_parent_restore ()
+dtable::vfork_parent_restore ()
 {
   SetResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK,"dup");
 
index 3b60944..793e432 100644 (file)
@@ -23,7 +23,7 @@ _fcntl (int fd, int cmd,...)
   int res;
   SetResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK, "_fcntl");
 
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
       res = -1;
@@ -36,24 +36,24 @@ _fcntl (int fd, int cmd,...)
       va_start (args, cmd);
       arg = va_arg (args,int);
       va_end (args);
-      res = dup2 (fd, dtable.find_unused_handle (arg));
+      res = dup2 (fd, fdtab.find_unused_handle (arg));
       goto done;
 
     case F_GETFD:
-      res = dtable[fd]->get_close_on_exec () ? FD_CLOEXEC : 0;
+      res = fdtab[fd]->get_close_on_exec () ? FD_CLOEXEC : 0;
       goto done;
 
     case F_SETFD:
       va_start (args, cmd);
       arg = va_arg (args, int);
       va_end (args);
-      dtable[fd]->set_close_on_exec (arg);
+      fdtab[fd]->set_close_on_exec (arg);
       res = 0;
       goto done;
 
     case F_GETFL:
       {
-       res = dtable[fd]->get_flags ();
+       res = fdtab[fd]->get_flags ();
        goto done;
       }
     case F_SETFL:
@@ -71,8 +71,8 @@ _fcntl (int fd, int cmd,...)
 
        syscall_printf ("fcntl (%d, F_SETFL, %d)", arg);
 
-       dtable[fd]->set_access (temp);
-       dtable[fd]->set_flags (arg);
+       fdtab[fd]->set_access (temp);
+       fdtab[fd]->set_flags (arg);
 
        res = 0;
        goto done;
@@ -86,7 +86,7 @@ _fcntl (int fd, int cmd,...)
        va_start (args, cmd);
        fl = va_arg (args,struct flock *);
        va_end (args);
-       res = dtable[fd]->lock (cmd, fl);
+       res = fdtab[fd]->lock (cmd, fl);
        goto done;
       }
     default:
index 275ce4d..6491ed9 100644 (file)
@@ -1074,7 +1074,7 @@ fhandler_tty_master::de_linearize (const char *buf, const char *unix_name,
 int
 fhandler_tty_master::init_console ()
 {
-  console = (fhandler_console *) dtable.build_fhandler (-1, FH_CONSOLE, "/dev/ttym");
+  console = (fhandler_console *) fdtab.build_fhandler (-1, FH_CONSOLE, "/dev/ttym");
   if (console == NULL)
     return -1;
 
index 6dfa83a..1f0a007 100644 (file)
@@ -559,7 +559,7 @@ fork ()
 
       MALLOC_CHECK;
 
-      dtable.fixup_after_fork (hParent);
+      fdtab.fixup_after_fork (hParent);
       signal_fixup_after_fork ();
       exec_fixup_after_fork ();
 
@@ -654,10 +654,10 @@ vfork ()
       for (pp = (char **)vf->frame, esp = vf->vfork_esp;
           esp <= vf->vfork_ebp + 1; pp++, esp++)
        *pp = *esp;
-      return dtable.vfork_child_dup () ? 0 : -1;
+      return fdtab.vfork_child_dup () ? 0 : -1;
     }
 
-  dtable.vfork_parent_restore ();
+  fdtab.vfork_parent_restore ();
 
   vf = get_vfork_val ();
   if (vf->pid < 0)
index 77f075e..51022ee 100644 (file)
@@ -19,14 +19,14 @@ extern "C"
 int
 ioctl (int fd, int cmd, void *buf)
 {
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
       return -1;
     }
 
   debug_printf ("fd %d, cmd %x\n", fd, cmd);
-  fhandler_base *fh = dtable[fd];
+  fhandler_base *fh = fdtab[fd];
   if (fh->is_tty () && fh->get_device () != FH_PTYM)
     switch (cmd)
       {
index 44e4ba3..400b575 100644 (file)
@@ -200,14 +200,14 @@ mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t off)
   else
     {
       /* Ensure that fd is open */
-      if (dtable.not_open (fd))
+      if (fdtab.not_open (fd))
        {
          set_errno (EBADF);
          syscall_printf ("-1 = mmap(): EBADF");
           ReleaseResourceLock(LOCK_MMAP_LIST,READ_LOCK|WRITE_LOCK," mmap");
          return (caddr_t) -1;
        }
-      hFile = dtable[fd]->get_handle ();
+      hFile = fdtab[fd]->get_handle ();
     }
 
   HANDLE h = CreateFileMapping (hFile, &sec_none, protect, 0, len, NULL);
index 77b2011..00d988f 100644 (file)
@@ -318,7 +318,7 @@ cygwin_getprotobynumber (int number)
 void
 fdsock (int fd, const char *name, SOCKET soc)
 {
-  fhandler_base *fh = dtable.build_fhandler(fd, FH_SOCKET, name);
+  fhandler_base *fh = fdtab.build_fhandler(fd, FH_SOCKET, name);
   fh->set_io_handle ((HANDLE) soc);
   fh->set_flags (O_RDWR);
 }
@@ -333,7 +333,7 @@ cygwin_socket (int af, int type, int protocol)
 
   SOCKET soc;
 
-  int fd = dtable.find_unused_handle ();
+  int fd = fdtab.find_unused_handle ();
 
   if (fd < 0)
     {
@@ -361,7 +361,7 @@ cygwin_socket (int af, int type, int protocol)
 
       fdsock (fd, name, soc);
       res = fd;
-      fhandler_socket *h = (fhandler_socket *) dtable[fd];
+      fhandler_socket *h = (fhandler_socket *) fdtab[fd];
 
       h->set_addr_family (af);
     }
@@ -419,7 +419,7 @@ cygwin_sendto (int fd,
                 const struct sockaddr *to,
                 int tolen)
 {
-  fhandler_socket *h = (fhandler_socket *) dtable[fd];
+  fhandler_socket *h = (fhandler_socket *) fdtab[fd];
   sockaddr_in sin;
   sigframe thisframe (mainthread, 0);
 
@@ -446,7 +446,7 @@ cygwin_recvfrom (int fd,
                   struct sockaddr *from,
                   int *fromlen)
 {
-  fhandler_socket *h = (fhandler_socket *) dtable[fd];
+  fhandler_socket *h = (fhandler_socket *) fdtab[fd];
   sigframe thisframe (mainthread, 0);
 
   debug_printf ("recvfrom %d", h->get_socket ());
@@ -465,13 +465,13 @@ cygwin_recvfrom (int fd,
 fhandler_socket *
 get (int fd)
 {
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EINVAL);
       return 0;
     }
 
-  return dtable[fd]->is_socket ();
+  return fdtab[fd]->is_socket ();
 }
 
 /* exported as setsockopt: standards? */
@@ -733,7 +733,7 @@ cygwin_accept (int fd, struct sockaddr *peer, int *len)
 
       SetResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," accept");
 
-      int res_fd = dtable.find_unused_handle ();
+      int res_fd = fdtab.find_unused_handle ();
       if (res_fd == -1)
        {
          /* FIXME: what is correct errno? */
@@ -929,7 +929,7 @@ extern "C"
 int
 cygwin_getpeername (int fd, struct sockaddr *name, int *len)
 {
-  fhandler_socket *h = (fhandler_socket *) dtable[fd];
+  fhandler_socket *h = (fhandler_socket *) fdtab[fd];
 
   debug_printf ("getpeername %d", h->get_socket ());
   int res = getpeername (h->get_socket (), name, len);
@@ -945,7 +945,7 @@ extern "C"
 int
 cygwin_recv (int fd, void *buf, int len, unsigned int flags)
 {
-  fhandler_socket *h = (fhandler_socket *) dtable[fd];
+  fhandler_socket *h = (fhandler_socket *) fdtab[fd];
   sigframe thisframe (mainthread, 0);
 
   int res = recv (h->get_socket (), (char *) buf, len, flags);
@@ -971,7 +971,7 @@ extern "C"
 int
 cygwin_send (int fd, const void *buf, int len, unsigned int flags)
 {
-  fhandler_socket *h = (fhandler_socket *) dtable[fd];
+  fhandler_socket *h = (fhandler_socket *) fdtab[fd];
   sigframe thisframe (mainthread, 0);
 
   int res = send (h->get_socket (), (const char *) buf, len, flags);
@@ -1361,13 +1361,13 @@ cygwin_rcmd (char **ahost, unsigned short inport, char *locuser,
   SOCKET fd2s;
   sigframe thisframe (mainthread, 0);
 
-  int res_fd = dtable.find_unused_handle ();
+  int res_fd = fdtab.find_unused_handle ();
   if (res_fd == -1)
     goto done;
 
   if (fd2p)
     {
-      *fd2p = dtable.find_unused_handle (res_fd + 1);
+      *fd2p = fdtab.find_unused_handle (res_fd + 1);
       if (*fd2p == -1)
        goto done;
     }
@@ -1401,7 +1401,7 @@ cygwin_rresvport (int *port)
   int res = -1;
   sigframe thisframe (mainthread, 0);
 
-  int res_fd = dtable.find_unused_handle ();
+  int res_fd = fdtab.find_unused_handle ();
   if (res_fd == -1)
     goto done;
   res = rresvport (port);
@@ -1430,12 +1430,12 @@ cygwin_rexec (char **ahost, unsigned short inport, char *locuser,
   SOCKET fd2s;
   sigframe thisframe (mainthread, 0);
 
-  int res_fd = dtable.find_unused_handle ();
+  int res_fd = fdtab.find_unused_handle ();
   if (res_fd == -1)
     goto done;
   if (fd2p)
     {
-      *fd2p = dtable.find_unused_handle (res_fd + 1);
+      *fd2p = fdtab.find_unused_handle (res_fd + 1);
       if (*fd2p == -1)
        goto done;
     }
@@ -1478,13 +1478,13 @@ socketpair (int, int type, int, int *sb)
 
   SetResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," socketpair");
 
-  sb[0] = dtable.find_unused_handle ();
+  sb[0] = fdtab.find_unused_handle ();
   if (sb[0] == -1)
     {
       set_errno (EMFILE);
       goto done;
     }
-  sb[1] = dtable.find_unused_handle (sb[0] + 1);
+  sb[1] = fdtab.find_unused_handle (sb[0] + 1);
   if (sb[1] == -1)
     {
       set_errno (EMFILE);
index ee4fd4a..6dd0129 100644 (file)
@@ -257,14 +257,14 @@ getpass (const char * prompt)
   if (passwd_state == uninitialized)
     read_etc_passwd();
 
-  if (dtable.not_open (0))
+  if (fdtab.not_open (0))
     {
       set_errno (EBADF);
       pass[0] = '\0';
     }
   else
     {
-      fhandler_base *fhstdin = dtable[0];
+      fhandler_base *fhstdin = fdtab[0];
       fhstdin->tcgetattr (&ti);
       newti = ti;
       newti.c_lflag &= ~ECHO;
index c802683..02d3cf6 100644 (file)
@@ -79,7 +79,7 @@ pinfo_init (LPBYTE info)
 
       /* Inherit file descriptor information from parent in info.
        */
-      LPBYTE b = dtable.de_linearize_fd_array (info);
+      LPBYTE b = fdtab.de_linearize_fd_array (info);
       extern char title_buf[];
       if (b && *b)
        old_title = strcpy (title_buf, (char *)b);
index b601bf6..951e9f4 100644 (file)
@@ -22,16 +22,16 @@ make_pipe (int fildes[2], unsigned int psize, int mode)
   int  fdr, fdw;
   SECURITY_ATTRIBUTES *sa = (mode & O_NOINHERIT) ?  &sec_none_nih : &sec_none;
 
-  if ((fdr = dtable.find_unused_handle ()) < 0)
+  if ((fdr = fdtab.find_unused_handle ()) < 0)
     set_errno (ENMFILE);
-  else if ((fdw = dtable.find_unused_handle (fdr + 1)) < 0)
+  else if ((fdw = fdtab.find_unused_handle (fdr + 1)) < 0)
     set_errno ( ENMFILE);
   else if (!CreatePipe (&r, &w, sa, psize))
     __seterrno ();
   else
     {
-      fhandler_base *fhr = dtable.build_fhandler (fdr, FH_PIPER, "/dev/piper");
-      fhandler_base *fhw = dtable.build_fhandler (fdw, FH_PIPEW, "/dev/pipew");
+      fhandler_base *fhr = fdtab.build_fhandler (fdr, FH_PIPER, "/dev/piper");
+      fhandler_base *fhw = fdtab.build_fhandler (fdw, FH_PIPEW, "/dev/pipew");
 
       int binmode = mode & O_TEXT ? 0 : 1;
       fhr->init (r, GENERIC_READ, binmode);
@@ -69,7 +69,7 @@ _pipe (int filedes[2], unsigned int psize, int mode)
   int res = make_pipe (filedes, psize, mode);
   /* This type of pipe is not interruptible so set the appropriate flag. */
   if (!res)
-    dtable[filedes[0]]->set_r_no_interrupt (1);
+    fdtab[filedes[0]]->set_r_no_interrupt (1);
   return res;
 }
 
@@ -79,7 +79,7 @@ dup (int fd)
   int res;
   SetResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," dup");
 
-  res = dup2 (fd, dtable.find_unused_handle ());
+  res = dup2 (fd, fdtab.find_unused_handle ());
 
   ReleaseResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," dup");
 
@@ -89,5 +89,5 @@ dup (int fd)
 int
 dup2 (int oldfd, int newfd)
 {
-  return dtable.dup2 (oldfd, newfd);
+  return fdtab.dup2 (oldfd, newfd);
 }
index b0a5ebd..6804619 100644 (file)
@@ -43,7 +43,7 @@ poll (struct pollfd *fds, unsigned int nfds, int timeout)
   memset (except_fds, 0, fds_size);
 
   for (unsigned int i = 0; i < nfds; ++i)
-    if (!dtable.not_open (fds[i].fd))
+    if (!fdtab.not_open (fds[i].fd))
       {
         FD_SET (fds[i].fd, open_fds);
         if (fds[i].events & POLLIN)
@@ -61,7 +61,7 @@ poll (struct pollfd *fds, unsigned int nfds, int timeout)
     {
       if (!FD_ISSET (fds[i].fd, open_fds))
         fds[i].revents = POLLNVAL;
-      else if (dtable.not_open(fds[i].fd))
+      else if (fdtab.not_open(fds[i].fd))
         fds[i].revents = POLLHUP;
       else if (ret < 0)
         fds[i].revents = POLLERR;
index dae7b06..09c732d 100644 (file)
@@ -1701,13 +1701,13 @@ extern "C"
 int
 facl (int fd, int cmd, int nentries, aclent_t *aclbufp)
 {
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       syscall_printf ("-1 = facl (%d)", fd);
       set_errno (EBADF);
       return -1;
     }
-  const char *path = dtable[fd]->get_name ();
+  const char *path = fdtab[fd]->get_name ();
   if (path == NULL)
     {
       syscall_printf ("-1 = facl (%d) (no name)", fd);
index bb8c355..3b23b39 100644 (file)
@@ -85,7 +85,7 @@ fhandler_##what::ready_for_read (int fd, DWORD howlong, int ignra) \
   me.fd = fd; \
   (void) select_read (&me); \
   while (!peek_##what (&me, ignra) && howlong == INFINITE) \
-    if (fd >= 0 && dtable.not_open (fd)) \
+    if (fd >= 0 && fdtab.not_open (fd)) \
       break; \
     else if (WaitForSingleObject (signal_arrived, 10) == WAIT_OBJECT_0) \
       break; \
@@ -94,7 +94,7 @@ fhandler_##what::ready_for_read (int fd, DWORD howlong, int ignra) \
 
 #define set_handle_or_return_if_not_open(h, s) \
   h = (s)->fh->get_handle (); \
-  if (dtable.not_open ((s)->fd)) \
+  if (fdtab.not_open ((s)->fd)) \
     { \
       (s)->saw_error = TRUE; \
       set_errno (EBADF); \
@@ -203,11 +203,11 @@ select_stuff::test_and_set (int i, fd_set *readfds, fd_set *writefds,
                            fd_set *exceptfds)
 {
   select_record *s = NULL;
-  if (UNIX_FD_ISSET (i, readfds) && (s = dtable.select_read (i, s)) == NULL)
+  if (UNIX_FD_ISSET (i, readfds) && (s = fdtab.select_read (i, s)) == NULL)
     return 0; /* error */
-  if (UNIX_FD_ISSET (i, writefds) && (s = dtable.select_write (i, s)) == NULL)
+  if (UNIX_FD_ISSET (i, writefds) && (s = fdtab.select_write (i, s)) == NULL)
     return 0; /* error */
-  if (UNIX_FD_ISSET (i, exceptfds) && (s = dtable.select_except (i, s)) == NULL)
+  if (UNIX_FD_ISSET (i, exceptfds) && (s = fdtab.select_except (i, s)) == NULL)
     return 0; /* error */
   if (s == NULL)
     return 1; /* nothing to do */
index 36098a2..af5ac6c 100644 (file)
@@ -135,7 +135,7 @@ out:
 static HANDLE
 handle (int n, int direction)
 {
-  fhandler_base *fh = dtable[n];
+  fhandler_base *fh = fdtab[n];
 
   if (!fh)
     return INVALID_HANDLE_VALUE;
@@ -462,7 +462,7 @@ skip_arg_parsing:
   /* Pass fd table to a child */
 
   MALLOC_CHECK;
-  int len = dtable.linearize_fd_array (0, 0);
+  int len = fdtab.linearize_fd_array (0, 0);
   MALLOC_CHECK;
   if (len == -1)
     {
@@ -490,7 +490,7 @@ skip_arg_parsing:
   LPBYTE resrv = si.lpReserved2 + sizeof *ciresrv;
 # undef ciresrv
 
-  if (dtable.linearize_fd_array (resrv, len) < 0)
+  if (fdtab.linearize_fd_array (resrv, len) < 0)
     {
       system_printf ("FATAL error in second linearize_fd_array");
       return -1;
index e4a705c..2fa0643 100644 (file)
@@ -35,8 +35,8 @@ extern BOOL allow_ntsec;
 void __stdcall
 close_all_files (void)
 {
-  for (int i = 0; i < (int)dtable.size; i++)
-    if (!dtable.not_open (i))
+  for (int i = 0; i < (int)fdtab.size; i++)
+    if (!fdtab.not_open (i))
       _close (i);
 
   cygwin_shared->delqueue.process_queue ();
@@ -186,9 +186,9 @@ read_handler (int fd, void *ptr, size_t len)
 {
   int res;
   sigframe thisframe (mainthread);
-  fhandler_base *fh = dtable[fd];
+  fhandler_base *fh = fdtab[fd];
 
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
       return -1;
@@ -217,14 +217,14 @@ read_handler (int fd, void *ptr, size_t len)
 extern "C" int
 _read (int fd, void *ptr, size_t len)
 {
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
       return -1;
     }
 
   set_sig_errno (0);
-  fhandler_base *fh = dtable[fd];
+  fhandler_base *fh = fdtab[fd];
 
   /* Could block, so let user know we at least got here.  */
   syscall_printf ("read (%d, %p, %d)", fd, ptr, len);
@@ -252,7 +252,7 @@ _write (int fd, const void *ptr, size_t len)
 {
   int res = -1;
 
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
       goto done;
@@ -265,7 +265,7 @@ _write (int fd, const void *ptr, size_t len)
     syscall_printf  ("write (%d, %p, %d)", fd, ptr, len);
 
   fhandler_base *fh;
-  fh = dtable[fd];
+  fh = fdtab[fd];
 
   res = fh->bg_check (SIGTTOU);
   if (res > 0)
@@ -398,15 +398,15 @@ _open (const char *unix_path, int flags, ...)
       mode = va_arg (ap, mode_t);
       va_end (ap);
 
-      fd = dtable.find_unused_handle ();
+      fd = fdtab.find_unused_handle ();
 
       if (fd < 0)
        set_errno (ENMFILE);
-      else if ((fh = dtable.build_fhandler (fd, unix_path, NULL)) == NULL)
+      else if ((fh = fdtab.build_fhandler (fd, unix_path, NULL)) == NULL)
        res = -1;               // errno already set
       else if (!fh->open (unix_path, flags, (mode & 0777) & ~myself->umask))
        {
-         dtable.release (fd);
+         fdtab.release (fd);
          res = -1;
        }
       else if ((res = fd) <= 2)
@@ -424,14 +424,14 @@ _lseek (int fd, off_t pos, int dir)
 {
   off_t res;
 
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
       res = -1;
     }
   else
     {
-      res = dtable[fd]->lseek (pos, dir);
+      res = fdtab[fd]->lseek (pos, dir);
     }
   syscall_printf ("%d = lseek (%d, %d, %d)", res, fd, pos, dir);
 
@@ -447,7 +447,7 @@ _close (int fd)
   syscall_printf ("close (%d)", fd);
 
   MALLOC_CHECK;
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       debug_printf ("handle %d not open", fd);
       set_errno (EBADF);
@@ -456,8 +456,8 @@ _close (int fd)
   else
     {
       SetResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," close");
-      res = dtable[fd]->close ();
-      dtable.release (fd);
+      res = fdtab[fd]->close ();
+      fdtab.release (fd);
       ReleaseResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," close");
     }
 
@@ -472,13 +472,13 @@ isatty (int fd)
 {
   int res;
 
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       syscall_printf ("0 = isatty (%d)", fd);
       return 0;
     }
 
-  res = dtable[fd]->is_tty ();
+  res = fdtab[fd]->is_tty ();
   syscall_printf ("%d = isatty (%d)", res, fd);
   return res;
 }
@@ -741,14 +741,14 @@ extern "C"
 int
 fchown (int fd, uid_t uid, gid_t gid)
 {
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       syscall_printf ("-1 = fchown (%d,...)", fd);
       set_errno (EBADF);
       return -1;
     }
 
-  const char *path = dtable[fd]->get_name ();
+  const char *path = fdtab[fd]->get_name ();
 
   if (path == NULL)
     {
@@ -854,14 +854,14 @@ extern "C"
 int
 fchmod (int fd, mode_t mode)
 {
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       syscall_printf ("-1 = fchmod (%d, 0%o)", fd, mode);
       set_errno (EBADF);
       return -1;
     }
 
-  const char *path = dtable[fd]->get_name ();
+  const char *path = fdtab[fd]->get_name ();
 
   if (path == NULL)
     {
@@ -911,7 +911,7 @@ _fstat (int fd, struct stat *buf)
 {
   int r;
 
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       syscall_printf ("-1 = fstat (%d, %p)", fd, buf);
       set_errno (EBADF);
@@ -920,7 +920,7 @@ _fstat (int fd, struct stat *buf)
   else
     {
       memset (buf, 0, sizeof (struct stat));
-      r = dtable[fd]->fstat (buf);
+      r = fdtab[fd]->fstat (buf);
       syscall_printf ("%d = fstat (%d, %x)", r,fd,buf);
     }
 
@@ -932,14 +932,14 @@ extern "C"
 int
 fsync (int fd)
 {
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       syscall_printf ("-1 = fsync (%d)", fd);
       set_errno (EBADF);
       return -1;
     }
 
-  HANDLE h = dtable[fd]->get_handle ();
+  HANDLE h = fdtab[fd]->get_handle ();
 
   if (FlushFileBuffers (h) == 0)
     {
@@ -1327,15 +1327,15 @@ extern "C"
 void
 setdtablesize (int size)
 {
-  if (size > (int)dtable.size)
-    dtable.extend (size);
+  if (size > (int)fdtab.size)
+    fdtab.extend (size);
 }
 
 extern "C"
 int
 getdtablesize ()
 {
-  return dtable.size;
+  return fdtab.size;
 }
 
 extern "C"
@@ -1430,11 +1430,11 @@ extern "C"
 char *
 ttyname (int fd)
 {
-  if (dtable.not_open (fd) || !dtable[fd]->is_tty ())
+  if (fdtab.not_open (fd) || !fdtab[fd]->is_tty ())
     {
       return 0;
     }
-  return (char *)(dtable[fd]->ttyname ());
+  return (char *)(fdtab[fd]->ttyname ());
 }
 
 /* Tells stdio if it should do the cr/lf conversion for this file */
@@ -1449,13 +1449,13 @@ _cygwin_istext_for_stdio (int fd)
       return 0; /* we do it for old apps, due to getc/putc macros */
     }
 
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       syscall_printf(" _cifs: fd not open\n");
       return 0;
     }
 
-  fhandler_base *p = dtable[fd];
+  fhandler_base *p = fdtab[fd];
 
   if (p->get_device() != FH_DISK)
     {
@@ -1497,13 +1497,13 @@ setmode_helper (FILE *f)
 extern "C" int
 getmode (int fd)
 {
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
       return -1;
     }
 
-  return dtable[fd]->get_flags () & (O_BINARY | O_TEXT);
+  return fdtab[fd]->get_flags () & (O_BINARY | O_TEXT);
 }
 
 /* Set a file descriptor into text or binary mode, returning the
@@ -1512,7 +1512,7 @@ getmode (int fd)
 extern "C" int
 setmode (int fd, int mode)
 {
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
       return -1;
@@ -1523,7 +1523,7 @@ setmode (int fd, int mode)
       return -1;
     }
 
-  fhandler_base *p = dtable[fd];
+  fhandler_base *p = fdtab[fd];
 
   /* Note that we have no way to indicate the case that writes are
      binary but not reads, or vice-versa.  These cases can arise when
@@ -1568,21 +1568,21 @@ ftruncate (int fd, off_t length)
 {
   int res = -1;
 
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
     }
   else
     {
-      HANDLE h = dtable[fd]->get_handle ();
+      HANDLE h = fdtab[fd]->get_handle ();
       off_t prev_loc;
 
       if (h)
        {
          /* remember curr file pointer location */
-         prev_loc = dtable[fd]->lseek (0, SEEK_CUR);
+         prev_loc = fdtab[fd]->lseek (0, SEEK_CUR);
 
-         dtable[fd]->lseek (length, SEEK_SET);
+         fdtab[fd]->lseek (length, SEEK_SET);
          if (!SetEndOfFile (h))
            {
              __seterrno ();
@@ -1591,7 +1591,7 @@ ftruncate (int fd, off_t length)
            res = 0;
 
          /* restore original file pointer location */
-         dtable[fd]->lseek (prev_loc, 0);
+         fdtab[fd]->lseek (prev_loc, 0);
        }
     }
   syscall_printf ("%d = ftruncate (%d, %d)", res, fd, length);
@@ -1630,13 +1630,13 @@ get_osfhandle (int fd)
 {
   long res = -1;
 
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno ( EBADF);
     }
   else
     {
-      res = (long) dtable[fd]->get_handle ();
+      res = (long) fdtab[fd]->get_handle ();
     }
   syscall_printf ("%d = get_osfhandle(%d)", res, fd);
 
@@ -1688,12 +1688,12 @@ extern "C"
 int
 fstatfs (int fd, struct statfs *sfs)
 {
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
       return -1;
     }
-  fhandler_disk_file *f = (fhandler_disk_file *) dtable[fd];
+  fhandler_disk_file *f = (fhandler_disk_file *) fdtab[fd];
   return statfs (f->get_name (), sfs);
 }
 
@@ -1772,12 +1772,12 @@ extern "C"
 char *
 ptsname (int fd)
 {
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
       return 0;
     }
-  return (char *)(dtable[fd]->ptsname ());
+  return (char *)(fdtab[fd]->ptsname ());
 }
 
 /* FIXME: what is this? */
index 1d89c0b..75bf69f 100644 (file)
@@ -27,9 +27,9 @@ sysconf (int in)
        return 1048576;
       case _SC_OPEN_MAX:
        /* FIXME: this returns the current limit which can increase
-          if and when hinfo::find_unused_handle is called.  Perhaps
+          if and when dtable::find_unused_handle is called.  Perhaps
           we should return NOFILE or OPEN_MAX instead? */
-       return dtable.size;
+       return fdtab.size;
       case _SC_PAGESIZE:
        {
          SYSTEM_INFO b;
index f7a4c35..50ef80b 100644 (file)
@@ -361,7 +361,7 @@ syslog (int priority, const char *message, ...)
           interleaved, we must lock the first byte of the file
           This works on Win32 even if we created the file above.
        */
-       HANDLE fHandle = dtable[fileno (fp)]->get_handle ();
+       HANDLE fHandle = fdtab[fileno (fp)]->get_handle ();
        if (LockFile (fHandle, 0, 0, 1, 0) == FALSE)
          {
            debug_printf ("failed to lock file %s", get_win95_event_log_path());
index c2274b9..4b8a996 100644 (file)
@@ -21,14 +21,14 @@ tcsendbreak (int fd, int duration)
 {
   int res = -1;
 
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
       goto out;
     }
 
   fhandler_base *fh;
-  fh = dtable[fd];
+  fh = fdtab[fd];
 
   if (!fh->is_tty ())
     set_errno (ENOTTY);
@@ -52,14 +52,14 @@ tcdrain (int fd)
 
   termios_printf ("tcdrain");
 
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
       goto out;
     }
 
   fhandler_base *fh;
-  fh = dtable[fd];
+  fh = fdtab[fd];
 
   if (!fh->is_tty ())
     set_errno (ENOTTY);
@@ -81,14 +81,14 @@ tcflush (int fd, int queue)
 {
   int res = -1;
 
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
       goto out;
     }
 
   fhandler_base *fh;
-  fh = dtable[fd];
+  fh = fdtab[fd];
 
   if (!fh->is_tty ())
     set_errno (ENOTTY);
@@ -110,14 +110,14 @@ tcflow (int fd, int action)
 {
   int res = -1;
 
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
       goto out;
     }
 
   fhandler_base *fh;
-  fh = dtable[fd];
+  fh = fdtab[fd];
 
   if (!fh->is_tty ())
     set_errno (ENOTTY);
@@ -140,14 +140,14 @@ tcsetattr (int fd, int a, const struct termios *t)
   int res = -1;
 
   t = __tonew_termios (t);
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     {
       set_errno (EBADF);
       goto out;
     }
 
   fhandler_base *fh;
-  fh = dtable[fd];
+  fh = fdtab[fd];
 
   if (!fh->is_tty ())
     set_errno (ENOTTY);
@@ -173,13 +173,13 @@ tcgetattr (int fd, struct termios *in_t)
   int res = -1;
   struct termios *t = __makenew_termios (in_t);
 
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     set_errno (EBADF);
-  else if (!dtable[fd]->is_tty ())
+  else if (!fdtab[fd]->is_tty ())
     set_errno (ENOTTY);
   else
     {
-      if ((res = dtable[fd]->tcgetattr (t)) == 0)
+      if ((res = fdtab[fd]->tcgetattr (t)) == 0)
        (void) __toapp_termios (in_t, t);
     }
 
@@ -200,12 +200,12 @@ tcgetpgrp (int fd)
 {
   int res = -1;
 
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     set_errno (EBADF);
-  else if (!dtable[fd]->is_tty ())
+  else if (!fdtab[fd]->is_tty ())
     set_errno (ENOTTY);
   else
-    res = dtable[fd]->tcgetpgrp ();
+    res = fdtab[fd]->tcgetpgrp ();
 
   termios_printf ("%d = tcgetpgrp (%d)", res, fd);
   return res;
@@ -218,12 +218,12 @@ tcsetpgrp (int fd, pid_t pgid)
 {
   int res = -1;
 
-  if (dtable.not_open (fd))
+  if (fdtab.not_open (fd))
     set_errno (EBADF);
-  else if (!dtable[fd]->is_tty ())
+  else if (!fdtab[fd]->is_tty ())
     set_errno (ENOTTY);
   else
-    res = dtable[fd]->tcsetpgrp (pgid);
+    res = fdtab[fd]->tcsetpgrp (pgid);
 
   termios_printf ("%d = tcsetpgrp (%d, %x)", res, fd, pgid);
   return res;
index 615cb23..fa55b26 100644 (file)
@@ -59,7 +59,7 @@ tty_init (void)
 void __stdcall
 create_tty_master (int ttynum)
 {
-  tty_master = (fhandler_tty_master *) dtable.build_fhandler (-1, FH_TTYM,
+  tty_master = (fhandler_tty_master *) fdtab.build_fhandler (-1, FH_TTYM,
                                                             "/dev/ttym", ttynum);
   if (tty_master->init (ttynum))
     api_fatal ("Can't create master tty");
index 5094028..f3794f5 100644 (file)
@@ -131,14 +131,14 @@ extern "C" per_process __cygwin_user_data; /* Pointer into application's static
    Do not change this value. */
 #define SIZEOF_PER_PROCESS (42 * 4)
 
-class hinfo
+class dtable
 {
   fhandler_base **fds;
   fhandler_base **fds_on_hold;
   int first_fd_for_open;
 public:
   size_t size;
-  hinfo () {first_fd_for_open = 3;}
+  dtable () {first_fd_for_open = 3;}
   int vfork_child_dup ();
   void vfork_parent_restore ();
   fhandler_base *dup_worker (fhandler_base *oldfh);
@@ -321,9 +321,9 @@ void heap_init (void);
 void malloc_init (void);
 
 /* fd table */
-void dtable_init (void);
-void hinfo_init (void);
-extern hinfo dtable;
+void fdtab_init (void);
+void stdio_init (void);
+extern dtable fdtab;
 
 /* UID/GID */
 void uinfo_init (void);
@@ -435,8 +435,8 @@ int kill_pgrp (pid_t, int);
 int _kill (int, int);
 int _raise (int sig);
 
-int getdtablesize ();
-void setdtablesize (int);
+int getfdtabsize ();
+void setfdtabsize (int);
 
 extern DWORD binmode;
 extern char _data_start__, _data_end__, _bss_start__, _bss_end__;