OSDN Git Service

Fix copyright throughout.
authorcorinna <corinna>
Wed, 15 Sep 2004 10:17:52 +0000 (10:17 +0000)
committercorinna <corinna>
Wed, 15 Sep 2004 10:17:52 +0000 (10:17 +0000)
Eliminate use of _impure_ptr outside Cygwin.
* bsd_helper.cc: Include errno.h instead of cygerrno.h.
* bsd_mutex.cc : Ditto.
* client.cc: Ditto.
* cygserver.cc: Ditto.
* process.cc: Don't build functions inside Cygwin.  Don't include
cygerrno.h.  Don't set errno.
* transport_pipes.cc (SET_ERRNO): New define.  Use througout.
* transport_sockets.cc (SET_ERRNO): Ditto.
(GET_ERRNO): Ditto.

17 files changed:
winsup/cygserver/ChangeLog
winsup/cygserver/bsd_helper.cc
winsup/cygserver/bsd_log.cc
winsup/cygserver/bsd_mutex.cc
winsup/cygserver/client.cc
winsup/cygserver/cygserver.cc
winsup/cygserver/msg.cc
winsup/cygserver/process.cc
winsup/cygserver/process.h
winsup/cygserver/sem.cc
winsup/cygserver/shm.cc
winsup/cygserver/threaded_queue.h
winsup/cygserver/transport.cc
winsup/cygserver/transport.h
winsup/cygserver/transport_pipes.cc
winsup/cygserver/transport_sockets.cc
winsup/cygserver/transport_sockets.h

index 207983e..a9781a0 100644 (file)
@@ -1,3 +1,17 @@
+2004-09-15  Corinna Vinschen  <corinna@vinschen.de>
+
+       Fix copyright throughout. 
+       Eliminate use of _impure_ptr outside Cygwin.
+       * bsd_helper.cc: Include errno.h instead of cygerrno.h.
+       * bsd_mutex.cc : Ditto.
+       * client.cc: Ditto.
+       * cygserver.cc: Ditto.
+       * process.cc: Don't build functions inside Cygwin.  Don't include
+       cygerrno.h.  Don't set errno.
+       * transport_pipes.cc (SET_ERRNO): New define.  Use througout.
+       * transport_sockets.cc (SET_ERRNO): Ditto.
+       (GET_ERRNO): Ditto.
+
 2004-09-06  Corinna Vinschen  <corinna@vinschen.de>
 
        * bsd_mutex.cc (_msleep): Disable resetting event object for now.
index 14026ce..364dddd 100644 (file)
@@ -1,6 +1,6 @@
 /* bsd_helper.cc
 
-   Copyright 2003 Red Hat Inc.
+   Copyright 2003, 2004 Red Hat Inc.
 
 This file is part of Cygwin.
 
@@ -9,7 +9,7 @@ Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
 details. */
 #ifdef __OUTSIDE_CYGWIN__
 #include "woutsup.h"
-#include "cygerrno.h"
+#include <errno.h>
 #define _KERNEL 1
 #define __BSD_VISIBLE 1
 #include <sys/smallprint.h>
index 5cf1c84..4b0ff74 100644 (file)
@@ -1,6 +1,6 @@
 /* bsd_log.cc
 
-   Copyright 2003 Red Hat Inc.
+   Copyright 2003, 2004 Red Hat Inc.
 
 This file is part of Cygwin.
 
index bd802d0..ad3c4a9 100644 (file)
@@ -1,6 +1,6 @@
 /* bsd_mutex.cc
 
-   Copyright 2003 Red Hat Inc.
+   Copyright 2003, 2004 Red Hat Inc.
 
 This file is part of Cygwin.
 
@@ -9,7 +9,7 @@ Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
 details. */
 #ifdef __OUTSIDE_CYGWIN__
 #include "woutsup.h"
-#include "cygerrno.h"
+#include <errno.h>
 #define _KERNEL 1
 #define __BSD_VISIBLE 1
 #include <sys/smallprint.h>
index 46451a9..953e5a1 100644 (file)
@@ -1,6 +1,6 @@
 /* client.cc
 
-   Copyright 2001, 2002, 2003 Red Hat Inc.
+   Copyright 2001, 2002, 2003, 2004 Red Hat Inc.
 
    Written by Egor Duda <deo@logos-m.ru>
 
@@ -18,12 +18,12 @@ details. */
 #endif
 
 #include <assert.h>
+#include <errno.h>
 #include <stdio.h>
 #include <unistd.h>
 
 #include "sigproc.h"
 
-#include "cygerrno.h"
 #include "cygserver_msg.h"
 #include "cygserver_sem.h"
 #include "cygserver_shm.h"
index 0cc6244..88f5e67 100644 (file)
@@ -1,6 +1,6 @@
 /* cygserver.cc
 
-   Copyright 2001, 2002, 2003 Red Hat Inc.
+   Copyright 2001, 2002, 2003, 2004 Red Hat Inc.
 
    Written by Egor Duda <deo@logos-m.ru>
 
@@ -16,6 +16,7 @@ details. */
 #include <sys/types.h>
 
 #include <assert.h>
+#include <errno.h>
 #include <ctype.h>
 #include <getopt.h>
 #include <signal.h>
@@ -24,7 +25,6 @@ details. */
 #include <string.h>
 #include <unistd.h>
 
-#include "cygerrno.h"
 #include "cygwin_version.h"
 
 #include "cygserver.h"
index fd5eaf5..1e086ed 100644 (file)
@@ -1,6 +1,6 @@
 /* msg.cc: Single unix specification IPC interface for Cygwin.
 
-   Copyright 2003 Red Hat, Inc.
+   Copyright 2003, 2004 Red Hat, Inc.
 
 This file is part of Cygwin.
 
index 8f1ff57..94e7893 100644 (file)
@@ -1,6 +1,6 @@
 /* process.cc
 
-   Copyright 2001, 2002 Red Hat Inc.
+   Copyright 2001, 2002, 2003, 2004 Red Hat Inc.
 
    Written by Robert Collins <rbtcollins@hotmail.com>
 
@@ -10,6 +10,7 @@ This software is a copyrighted work licensed under the terms of the
 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
 details. */
 
+#ifdef __OUTSIDE_CYGWIN__
 #include "woutsup.h"
 
 #include <sys/types.h>
@@ -17,8 +18,6 @@ details. */
 #include <assert.h>
 #include <stdlib.h>
 
-#include "cygerrno.h"
-
 #include "process.h"
 
 /*****************************************************************************/
@@ -250,7 +249,6 @@ process_cache::process (const pid_t cygpid, const DWORD winpid,
                          "new connection refused for %d(%lu)"),
                         MAXIMUM_WAIT_OBJECTS - SPECIALS_COUNT,
                         cygpid, winpid);
-         set_errno (EAGAIN);
          return NULL;
        }
 
@@ -259,7 +257,6 @@ process_cache::process (const pid_t cygpid, const DWORD winpid,
        {
          LeaveCriticalSection (&_cache_write_access);
          delete entry;
-         set_errno (ESRCH);
          return NULL;
        }
 
@@ -433,3 +430,4 @@ process_cache::find (const DWORD winpid, class process **previous)
 }
 
 /*****************************************************************************/
+#endif /* __OUTSIDE_CYGWIN__ */
index 90d7c94..75d0c72 100644 (file)
@@ -1,6 +1,6 @@
 /* process.h
 
-   Copyright 2001, 2002 Red Hat Inc.
+   Copyright 2001, 2002, 2003, 2004 Red Hat Inc.
 
    Written by Robert Collins <rbtcollins@hotmail.com>
 
index 82ad3de..f0fbbac 100644 (file)
@@ -1,6 +1,6 @@
 /* sem.cc: Single unix specification IPC interface for Cygwin.
 
-   Copyright 2003 Red Hat, Inc.
+   Copyright 2003, 2004 Red Hat, Inc.
 
 This file is part of Cygwin.
 
index 48aec8a..17b05bf 100644 (file)
@@ -1,6 +1,6 @@
 /* shm.cc: Single unix specification IPC interface for Cygwin.
 
-   Copyright 2003 Red Hat, Inc.
+   Copyright 2003, 2004 Red Hat, Inc.
 
 This file is part of Cygwin.
 
index 5b6fddc..0c3f991 100644 (file)
@@ -1,6 +1,6 @@
 /* threaded_queue.h
 
-   Copyright 2001, 2002 Red Hat Inc.
+   Copyright 2001, 2002, 2003 Red Hat Inc.
 
    Written by Robert Collins <rbtcollins@hotmail.com>
 
index a52bb60..0e97082 100644 (file)
@@ -1,6 +1,6 @@
 /* transport.cc
 
-   Copyright 2001, 2002, 2003 Red Hat Inc.
+   Copyright 2001, 2002, 2003, 2004 Red Hat Inc.
 
    Written by Robert Collins <rbtcollins@hotmail.com>
 
index 76018d2..80f50fd 100644 (file)
@@ -1,6 +1,6 @@
 /* transport.h
 
-   Copyright 2001, 2002, 2003 Red Hat Inc.
+   Copyright 2001, 2002, 2003, 2004 Red Hat Inc.
 
    Written by Robert Collins <rbtcollins@hotmail.com>
 
index 5f8ceec..9fdf758 100644 (file)
@@ -1,6 +1,6 @@
 /* transport_pipes.cc
 
-   Copyright 2001, 2002, 2003 Red Hat Inc.
+   Copyright 2001, 2002, 2003, 2004 Red Hat Inc.
 
    Written by Robert Collins <rbtcollins@hotmail.com>
 
@@ -35,6 +35,12 @@ details. */
 #include "security.h"
 #endif
 
+#ifdef __INSIDE_CYGWIN__
+#define SET_ERRNO(err) set_errno (err)
+#else
+#define SET_ERRNO(err) errno = (err)
+#endif
+
 enum
   {
     MAX_WAIT_NAMED_PIPE_RETRY = 64,
@@ -214,7 +220,7 @@ transport_layer_pipes::read (void *const buf, const size_t len)
   if (!ReadFile (_hPipe, buf, len, &count, NULL))
     {
       debug_printf ("error reading from pipe (%lu)", GetLastError ());
-      set_errno (EINVAL);      // FIXME?
+      SET_ERRNO (EINVAL);      // FIXME?
       return -1;
     }
 
@@ -234,7 +240,7 @@ transport_layer_pipes::write (void *const buf, const size_t len)
   if (!WriteFile (_hPipe, buf, len, &count, NULL))
     {
       debug_printf ("error writing to pipe, error = %lu", GetLastError ());
-      set_errno (EINVAL);      // FIXME?
+      SET_ERRNO (EINVAL);      // FIXME?
       return -1;
     }
 
index f3668f6..d89e343 100644 (file)
@@ -1,6 +1,6 @@
 /* transport_sockets.cc
 
-   Copyright 2001, 2002 Red Hat Inc.
+   Copyright 2001, 2002, 2003, 2004 Red Hat Inc.
 
    Written by Robert Collins <rbtcollins@hotmail.com>
 
@@ -22,13 +22,21 @@ details. */
 #include <sys/stat.h>
 
 #include <assert.h>
-#include <errno.h>
 #include <stdio.h>
 #include <unistd.h>
 
+#include "cygerrno.h"
 #include "transport.h"
 #include "transport_sockets.h"
 
+#ifdef __INSIDE_CYGWIN__
+#define SET_ERRNO(err) set_errno (err)
+#define GET_ERRNO()    get_errno ()
+#else
+#define SET_ERRNO(err) errno = (err)
+#define GET_ERRNO()    (errno)
+#endif
+
 /* to allow this to link into cygwin and the .dll, a little magic is needed. */
 #ifndef __OUTSIDE_CYGWIN__
 
@@ -99,10 +107,10 @@ transport_layer_sockets::listen ()
 
   if (stat (_addr.sun_path, &sbuf) == -1)
     {
-      if (errno != ENOENT)
+      if (GET_ERRNO () != ENOENT)
        {
          system_printf ("cannot access socket file `%s': %s",
-                        _addr.sun_path, strerror (errno));
+                        _addr.sun_path, strerror (GET_ERRNO ()));
          return -1;
        }
     }
@@ -115,7 +123,7 @@ transport_layer_sockets::listen ()
       if (newfd == -1)
        {
          system_printf ("failed to create UNIX domain socket: %s",
-                        strerror (errno));
+                        strerror (GET_ERRNO ()));
          return -1;
        }
 
@@ -133,7 +141,7 @@ transport_layer_sockets::listen ()
       if (unlink (_addr.sun_path) == -1)
        {
          system_printf ("failed to remove `%s': %s",
-                        _addr.sun_path, strerror (errno));
+                        _addr.sun_path, strerror (GET_ERRNO ()));
          (void) ::close (newfd);
          return -1;
        }
@@ -150,17 +158,17 @@ transport_layer_sockets::listen ()
   if (_fd == -1)
     {
       system_printf ("failed to create UNIX domain socket: %s",
-                    strerror (errno));
+                    strerror (GET_ERRNO ()));
       return -1;
     }
 
   if (cygwin_bind (_fd, (struct sockaddr *) &_addr, _addr_len) == -1)
     {
-      const int saved_errno = errno;
+      const int saved_errno = GET_ERRNO ();
       close ();
-      errno = saved_errno;
+      SET_ERRNO (saved_errno);
       system_printf ("failed to bind UNIX domain socket `%s': %s",
-                    _addr.sun_path, strerror (errno));
+                    _addr.sun_path, strerror (GET_ERRNO ()));
       return -1;
     }
 
@@ -168,11 +176,11 @@ transport_layer_sockets::listen ()
 
   if (cygwin_listen (_fd, SOMAXCONN) == -1)
     {
-      const int saved_errno = errno;
+      const int saved_errno = GET_ERRNO ();
       close ();
-      errno = saved_errno;
+      SET_ERRNO (saved_errno);
       system_printf ("failed to listen on UNIX domain socket `%s': %s",
-                    _addr.sun_path, strerror (errno));
+                    _addr.sun_path, strerror (GET_ERRNO ()));
       return -1;
     }
 
@@ -198,8 +206,8 @@ transport_layer_sockets::accept (bool *const recoverable)
 
   if (accept_fd == -1)
     {
-      system_printf ("failed to accept connection: %s", strerror (errno));
-      switch (errno)
+      system_printf ("failed to accept connection: %s", strerror (GET_ERRNO ()));
+      switch (GET_ERRNO ())
        {
        case ECONNABORTED:
        case EINTR:
@@ -276,7 +284,7 @@ transport_layer_sockets::read (void *const buf, const size_t buf_len)
   if (res != -1)
     {
       if (res == 0)
-       errno = EIO;            // FIXME?
+       SET_ERRNO (EIO);        // FIXME?
 
       res = buf_len - read_buf_len;
     }
@@ -284,7 +292,7 @@ transport_layer_sockets::read (void *const buf, const size_t buf_len)
   if (res != static_cast<ssize_t> (buf_len))
     debug_printf ("%d = read (buf = %p, len = %u) [this = %p, fd = %d]: %s",
                  res, buf, buf_len, this, _fd,
-                 (res == -1 ? strerror (errno) : "EOF"));
+                 (res == -1 ? strerror (GET_ERRNO ()) : "EOF"));
   else
     {
       // verbose: debug_printf ("%d = read (buf = %p, len = %u) [this = %p, fd = %d]",
@@ -322,7 +330,7 @@ transport_layer_sockets::write (void *const buf, const size_t buf_len)
   if (res != -1)
     {
       if (res == 0)
-       errno = EIO;            // FIXME?
+       SET_ERRNO (EIO);        // FIXME?
 
       res = buf_len - write_buf_len;
     }
@@ -330,7 +338,7 @@ transport_layer_sockets::write (void *const buf, const size_t buf_len)
   if (res != static_cast<ssize_t> (buf_len))
     debug_printf ("%d = write (buf = %p, len = %u) [this = %p, fd = %d]: %s",
                  res, buf, buf_len, this, _fd,
-                 (res == -1 ? strerror (errno) : "EOF"));
+                 (res == -1 ? strerror (GET_ERRNO ()) : "EOF"));
   else
     {
       // verbose: debug_printf ("%d = write (buf = %p, len = %u) [this = %p, fd = %d]",
@@ -358,7 +366,7 @@ transport_layer_sockets::connect ()
       if (_fd == -1)
        {
          system_printf ("failed to create UNIX domain socket: %s",
-                        strerror (errno));
+                        strerror (GET_ERRNO ()));
          return -1;
        }
 
@@ -369,9 +377,9 @@ transport_layer_sockets::connect ()
          return 0;
        }
 
-      if (!assume_cygserver || errno != ECONNREFUSED)
+      if (!assume_cygserver || GET_ERRNO () != ECONNREFUSED)
        {
-         debug_printf ("failed to connect to server: %s", strerror (errno));
+         debug_printf ("failed to connect to server: %s", strerror (GET_ERRNO ()));
          (void) ::close (_fd);
          _fd = -1;
          return -1;
@@ -382,6 +390,6 @@ transport_layer_sockets::connect ()
       Sleep (0);               // Give the server a chance.
     }
 
-  debug_printf ("failed to connect to server: %s", strerror (errno));
+  debug_printf ("failed to connect to server: %s", strerror (GET_ERRNO ()));
   return -1;
 }
index d684a87..dab086e 100644 (file)
@@ -1,6 +1,6 @@
 /* transport_sockets.h
 
-   Copyright 2001, 2002 Red Hat Inc.
+   Copyright 2001, 2002, 2003 Red Hat Inc.
 
    Written by Robert Collins <rbtcollins@hotmail.com>