diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2004-09-15 10:17:53 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2004-09-15 10:17:53 +0000 |
commit | 1dcd520bb878cfd02e72f31b9e2d8ccdd3073a2c (patch) | |
tree | 94b87d56b4ff157a24e01fd570a906987f1ba51c /winsup | |
parent | b103e0d73285adeb8dc4dfa58568dacf2927742e (diff) | |
download | newlib-1dcd520bb878cfd02e72f31b9e2d8ccdd3073a2c.zip newlib-1dcd520bb878cfd02e72f31b9e2d8ccdd3073a2c.tar.gz newlib-1dcd520bb878cfd02e72f31b9e2d8ccdd3073a2c.tar.bz2 |
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.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygserver/ChangeLog | 14 | ||||
-rw-r--r-- | winsup/cygserver/bsd_helper.cc | 4 | ||||
-rw-r--r-- | winsup/cygserver/bsd_log.cc | 2 | ||||
-rw-r--r-- | winsup/cygserver/bsd_mutex.cc | 4 | ||||
-rw-r--r-- | winsup/cygserver/client.cc | 4 | ||||
-rw-r--r-- | winsup/cygserver/cygserver.cc | 4 | ||||
-rw-r--r-- | winsup/cygserver/msg.cc | 2 | ||||
-rw-r--r-- | winsup/cygserver/process.cc | 8 | ||||
-rw-r--r-- | winsup/cygserver/process.h | 2 | ||||
-rw-r--r-- | winsup/cygserver/sem.cc | 2 | ||||
-rw-r--r-- | winsup/cygserver/shm.cc | 2 | ||||
-rw-r--r-- | winsup/cygserver/threaded_queue.h | 2 | ||||
-rw-r--r-- | winsup/cygserver/transport.cc | 2 | ||||
-rw-r--r-- | winsup/cygserver/transport.h | 2 | ||||
-rw-r--r-- | winsup/cygserver/transport_pipes.cc | 12 | ||||
-rw-r--r-- | winsup/cygserver/transport_sockets.cc | 54 | ||||
-rw-r--r-- | winsup/cygserver/transport_sockets.h | 2 |
17 files changed, 74 insertions, 48 deletions
diff --git a/winsup/cygserver/ChangeLog b/winsup/cygserver/ChangeLog index 207983e..a9781a0 100644 --- a/winsup/cygserver/ChangeLog +++ b/winsup/cygserver/ChangeLog @@ -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. diff --git a/winsup/cygserver/bsd_helper.cc b/winsup/cygserver/bsd_helper.cc index 14026ce..364dddd 100644 --- a/winsup/cygserver/bsd_helper.cc +++ b/winsup/cygserver/bsd_helper.cc @@ -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> diff --git a/winsup/cygserver/bsd_log.cc b/winsup/cygserver/bsd_log.cc index 5cf1c84..4b0ff74 100644 --- a/winsup/cygserver/bsd_log.cc +++ b/winsup/cygserver/bsd_log.cc @@ -1,6 +1,6 @@ /* bsd_log.cc - Copyright 2003 Red Hat Inc. + Copyright 2003, 2004 Red Hat Inc. This file is part of Cygwin. diff --git a/winsup/cygserver/bsd_mutex.cc b/winsup/cygserver/bsd_mutex.cc index bd802d0..ad3c4a9 100644 --- a/winsup/cygserver/bsd_mutex.cc +++ b/winsup/cygserver/bsd_mutex.cc @@ -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> diff --git a/winsup/cygserver/client.cc b/winsup/cygserver/client.cc index 46451a9..953e5a1 100644 --- a/winsup/cygserver/client.cc +++ b/winsup/cygserver/client.cc @@ -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" diff --git a/winsup/cygserver/cygserver.cc b/winsup/cygserver/cygserver.cc index 0cc6244..88f5e67 100644 --- a/winsup/cygserver/cygserver.cc +++ b/winsup/cygserver/cygserver.cc @@ -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" diff --git a/winsup/cygserver/msg.cc b/winsup/cygserver/msg.cc index fd5eaf5..1e086ed 100644 --- a/winsup/cygserver/msg.cc +++ b/winsup/cygserver/msg.cc @@ -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. diff --git a/winsup/cygserver/process.cc b/winsup/cygserver/process.cc index 8f1ff57..94e7893 100644 --- a/winsup/cygserver/process.cc +++ b/winsup/cygserver/process.cc @@ -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__ */ diff --git a/winsup/cygserver/process.h b/winsup/cygserver/process.h index 90d7c94..75d0c72 100644 --- a/winsup/cygserver/process.h +++ b/winsup/cygserver/process.h @@ -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> diff --git a/winsup/cygserver/sem.cc b/winsup/cygserver/sem.cc index 82ad3de..f0fbbac 100644 --- a/winsup/cygserver/sem.cc +++ b/winsup/cygserver/sem.cc @@ -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. diff --git a/winsup/cygserver/shm.cc b/winsup/cygserver/shm.cc index 48aec8a..17b05bf 100644 --- a/winsup/cygserver/shm.cc +++ b/winsup/cygserver/shm.cc @@ -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. diff --git a/winsup/cygserver/threaded_queue.h b/winsup/cygserver/threaded_queue.h index 5b6fddc..0c3f991 100644 --- a/winsup/cygserver/threaded_queue.h +++ b/winsup/cygserver/threaded_queue.h @@ -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> diff --git a/winsup/cygserver/transport.cc b/winsup/cygserver/transport.cc index a52bb60..0e97082 100644 --- a/winsup/cygserver/transport.cc +++ b/winsup/cygserver/transport.cc @@ -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> diff --git a/winsup/cygserver/transport.h b/winsup/cygserver/transport.h index 76018d2..80f50fd 100644 --- a/winsup/cygserver/transport.h +++ b/winsup/cygserver/transport.h @@ -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> diff --git a/winsup/cygserver/transport_pipes.cc b/winsup/cygserver/transport_pipes.cc index 5f8ceec..9fdf758 100644 --- a/winsup/cygserver/transport_pipes.cc +++ b/winsup/cygserver/transport_pipes.cc @@ -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; } diff --git a/winsup/cygserver/transport_sockets.cc b/winsup/cygserver/transport_sockets.cc index f3668f6..d89e343 100644 --- a/winsup/cygserver/transport_sockets.cc +++ b/winsup/cygserver/transport_sockets.cc @@ -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; } diff --git a/winsup/cygserver/transport_sockets.h b/winsup/cygserver/transport_sockets.h index d684a87..dab086e 100644 --- a/winsup/cygserver/transport_sockets.h +++ b/winsup/cygserver/transport_sockets.h @@ -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> |