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-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.
/* bsd_helper.cc
- Copyright 2003 Red Hat Inc.
+ Copyright 2003, 2004 Red Hat Inc.
This file is part of Cygwin.
details. */
#ifdef __OUTSIDE_CYGWIN__
#include "woutsup.h"
-#include "cygerrno.h"
+#include <errno.h>
#define _KERNEL 1
#define __BSD_VISIBLE 1
#include <sys/smallprint.h>
/* bsd_log.cc
- Copyright 2003 Red Hat Inc.
+ Copyright 2003, 2004 Red Hat Inc.
This file is part of Cygwin.
/* bsd_mutex.cc
- Copyright 2003 Red Hat Inc.
+ Copyright 2003, 2004 Red Hat Inc.
This file is part of Cygwin.
details. */
#ifdef __OUTSIDE_CYGWIN__
#include "woutsup.h"
-#include "cygerrno.h"
+#include <errno.h>
#define _KERNEL 1
#define __BSD_VISIBLE 1
#include <sys/smallprint.h>
/* 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>
#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"
/* 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>
#include <sys/types.h>
#include <assert.h>
+#include <errno.h>
#include <ctype.h>
#include <getopt.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
-#include "cygerrno.h"
#include "cygwin_version.h"
#include "cygserver.h"
/* 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.
/* process.cc
- Copyright 2001, 2002 Red Hat Inc.
+ Copyright 2001, 2002, 2003, 2004 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
+#ifdef __OUTSIDE_CYGWIN__
#include "woutsup.h"
#include <sys/types.h>
#include <assert.h>
#include <stdlib.h>
-#include "cygerrno.h"
-
#include "process.h"
/*****************************************************************************/
"new connection refused for %d(%lu)"),
MAXIMUM_WAIT_OBJECTS - SPECIALS_COUNT,
cygpid, winpid);
- set_errno (EAGAIN);
return NULL;
}
{
LeaveCriticalSection (&_cache_write_access);
delete entry;
- set_errno (ESRCH);
return NULL;
}
}
/*****************************************************************************/
+#endif /* __OUTSIDE_CYGWIN__ */
/* process.h
- Copyright 2001, 2002 Red Hat Inc.
+ Copyright 2001, 2002, 2003, 2004 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
/* 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.
/* 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.
/* threaded_queue.h
- Copyright 2001, 2002 Red Hat Inc.
+ Copyright 2001, 2002, 2003 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
/* transport.cc
- Copyright 2001, 2002, 2003 Red Hat Inc.
+ Copyright 2001, 2002, 2003, 2004 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
/* transport.h
- Copyright 2001, 2002, 2003 Red Hat Inc.
+ Copyright 2001, 2002, 2003, 2004 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
/* 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>
#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,
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;
}
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;
}
/* transport_sockets.cc
- Copyright 2001, 2002 Red Hat Inc.
+ Copyright 2001, 2002, 2003, 2004 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
#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__
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;
}
}
if (newfd == -1)
{
system_printf ("failed to create UNIX domain socket: %s",
- strerror (errno));
+ strerror (GET_ERRNO ()));
return -1;
}
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;
}
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;
}
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;
}
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:
if (res != -1)
{
if (res == 0)
- errno = EIO; // FIXME?
+ SET_ERRNO (EIO); // FIXME?
res = buf_len - read_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]",
if (res != -1)
{
if (res == 0)
- errno = EIO; // FIXME?
+ SET_ERRNO (EIO); // FIXME?
res = buf_len - write_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]",
if (_fd == -1)
{
system_printf ("failed to create UNIX domain socket: %s",
- strerror (errno));
+ strerror (GET_ERRNO ()));
return -1;
}
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;
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;
}
/* transport_sockets.h
- Copyright 2001, 2002 Red Hat Inc.
+ Copyright 2001, 2002, 2003 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>