Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorRobert Collins <rbtcollins@hotmail.com>2002-01-15 15:52:53 +0300
committerRobert Collins <rbtcollins@hotmail.com>2002-01-15 15:52:53 +0300
commit8e03995af57e82c17d169188867b43a57018a11e (patch)
treea1515743f368c42a6c3aaf69f6e37523b8d715ba /winsup
parent7225be84398d6299e1cce0201060013ce10abc2b (diff)
Merged changes from HEAD
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog108
-rw-r--r--winsup/cygwin/Makefile.in37
-rwxr-xr-xwinsup/cygwin/cygmagic12
-rw-r--r--winsup/cygwin/dcrt0.cc19
-rw-r--r--winsup/cygwin/dir.cc14
-rw-r--r--winsup/cygwin/dtable.cc11
-rw-r--r--winsup/cygwin/exceptions.cc37
-rw-r--r--winsup/cygwin/fhandler.cc4
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc6
-rw-r--r--winsup/cygwin/include/sys/ioctl.h4
-rw-r--r--winsup/cygwin/ioctl.cc20
-rwxr-xr-xwinsup/cygwin/mkvers.sh2
-rw-r--r--winsup/cygwin/net.cc145
-rw-r--r--winsup/cygwin/path.cc16
-rw-r--r--winsup/cygwin/path.h6
-rw-r--r--winsup/cygwin/signal.cc30
-rw-r--r--winsup/cygwin/sigproc.cc25
-rw-r--r--winsup/cygwin/sigproc.h4
-rw-r--r--winsup/cygwin/spawn.cc6
-rwxr-xr-xwinsup/cygwin/speclib10
-rw-r--r--winsup/cygwin/syscalls.cc7
-rw-r--r--winsup/cygwin/times.cc5
-rw-r--r--winsup/cygwin/window.cc7
-rw-r--r--winsup/cygwin/winsup.h4
24 files changed, 427 insertions, 112 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 65f120d0e..362f54e34 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -249,6 +249,114 @@ Tue Sep 25 16:22:00 2001 Robert Collins <rbtcollins@hotmail.com>
* include/sys/ipc.h: New file.
* include/sys/shm.h: New file.
+2002-01-14 Corinna Vinschen <corinna@vinschen.de>
+
+ * dir.cc: Use INVALID_FILE_ATTRIBUTES instead of "(DWORD) -1"
+ for file attributes throughout.
+ * fhandler.cc: Ditto.
+ * fhandler_disk_file.cc: Ditto.
+ * path.cc: Ditto.
+ * path.h: Ditto.
+ * syscalls.cc: Ditto.
+ * times.cc (utimes): Use path_conv::isdir() instead of explicit
+ GetFileAttributes() call.
+
+2002-01-13 Christopher Faylor <cgf@redhat.com>
+
+ * dcrt0.cc (multiple_cygwin_problem): Clarify logic and make
+ CYGWIN_MISMATCH_OK more powerful.
+
+2002-01-10 Christopher Faylor <cgf@redhat.com>
+
+ * exceptions.cc (sig_handle): Accept a second argument indicating
+ whether the signal came from this process or not.
+ * sigproc.h: Reflect sig_handle arg change.
+ * signal.cc (kill_pgrp): Add sigframe info.
+ (abort): New function. Eliminates newlib function of same name.
+ * sigproc.cc (wait_sig): Pass "signal from this process" value as arg
+ 2.
+
+2002-01-10 Corinna Vinschen <corinna@vinschen.de>
+
+ * syscalls.cc (pathconf): Guard _PC_PATH_MAX branch against invalid
+ file parameter.
+
+2002-01-09 Christopher Faylor <cgf@redhat.com>
+ Robert Collins <rbtcollins@hotmail.com>
+
+ * exceptions.cc (early_stuff_init): Rename from misnamed
+ set_console_handler.
+ (ctrl_c_handler): Attempt to work around potential signal duplication
+ during process startup.
+ (sig_handle): Ignore SIGINT when we're just an "exec stub".
+ * spawn.cc (spawn_guts): Store pid of spawned process in global for use
+ by ctrl_c_handler.
+ * dcrt0.cc (dll_crt0_1): Call renamed initialization function.
+ * winsup.h: Reflect function name change.
+
+2002-01-08 Corinna Vinschen <corinna@vinschen.de>
+
+ * net.cc (cygwin_accept): Set sun_path for newly connected socket.
+
+2002-01-07 Ralf Habacker <Ralf.Habacker@freenet.de>
+
+ * Makefile.in: Add uninstall target.
+
+2002-01-07 Christopher Faylor <cgf@redhat.com>
+
+ * sigproc.cc (getsem): Clean up debugging output.
+
+2002-01-07 Christopher Faylor <cgf@redhat.com>
+
+ * sigproc.cc (getsem): Set errno when unable to create own semaphore.
+ Reorganize to make clearer that error should only come from initial
+ creation of process semaphore.
+
+2002-01-06 Christopher Faylor <cgf@redhat.com>
+
+ * dtable.cc (dtable::init_std_file_from_handle): Add some defensive
+ code to invalid handle case.
+
+2002-01-06 Corinna Vinschen <corinna@vinschen.de>
+
+ * ioctl.cc (ioctl): Make third argument optional.
+ * include/sys/ioctl.h: Ditto in declaration.
+ * dtable.cc (dtable::init_std_file_from_handle): Revert previous
+ bogus patch.
+ * window.cc (WndProc): Raise SIGURG instead of SIGIO in case of FD_OOB
+ message.
+
+2002-01-05 Christopher Faylor <cgf@redhat.com>
+
+ * dir.cc (opendir): Guarantee release of alloced fhandler structure on
+ error.
+
+2002-01-05 Corinna Vinschen <corinna@vinschen.de>
+
+ * exceptions.cc (sig_handle): Set default action for SIGURG to SIG_IGN.
+
+2002-01-05 Corinna Vinschen <corinna@vinschen.de>
+
+ * dtable.cc (dtable::init_std_file_from_handle): Don't treat NULL
+ handle as errorneous.
+
+2002-01-04 Christopher Faylor <cgf@redhat.com>
+
+ * cygmagic: Change logic for equality test.
+
+2002-01-04 Christopher Faylor <cgf@redhat.com>
+
+ * dir.cc (opendir): Don't attempt to call sub-opendir if ENOENT.
+
+2002-01-04 Corinna Vinschen <corinna@vinschen.de>
+
+ * net.cc: Replace usage of AF_UNIX by Posix compliant AF_LOCAL
+ throughout.
+ (socketpair): Explicitly allow SOCK_STREAM and SOCK_DGRAM socket types
+ in families AF_UNIX and AF_LOCAL. Explicitly allow PF_UNSPEC, PF_LOCAL
+ and PF_INET protocols. Return error otherwise. Implement datagram
+ socketpairs.
+
2002-01-01 Christopher Faylor <cgf@redhat.com>
* speclib: Remove temp files automatically.
diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in
index 2e324a606..b61a79f22 100644
--- a/winsup/cygwin/Makefile.in
+++ b/winsup/cygwin/Makefile.in
@@ -166,11 +166,11 @@ all_host: new-$(LIB_NAME) cygrun.exe
force:
-install: install-bin install-libs install-headers $(install_host) $(install_target)
-
-install: install-libs install-headers install-man install_target \
+install: install-bin install-libs install-headers install-man install_target \
$(install_host) $(install_target)
+uninstall: uninstall-libs uninstall-headers uninstall-man
+
install-libs: $(TARGET_LIBS)
$(INSTALL_DATA) new-$(DLL_NAME) $(bindir)/$(DLL_NAME); \
for i in $^; do \
@@ -206,6 +206,37 @@ install_target: cygserver.exe
install_host:
+
+uninstall-libs: $(TARGET_LIBS)
+ rm -f $(bindir)/$(DLL_NAME); \
+ for i in $^; do \
+ rm -f $(tooldir)/lib/$$i ; \
+ done
+
+uninstall-headers:
+ cd $(srcdir); \
+ for sub in `find include -name '[a-z]*' -type d -print | sort`; do \
+ for i in $$sub/*.h ; do \
+ rm -f $(tooldir)/$$sub/`basename $$i` ; \
+ done ; \
+ done ; \
+ rm -f $(tooldir)/include/regex.h
+
+uninstall-man:
+ cd $(srcdir); \
+ for i in `find . -type f -name '*.2'`; do \
+ rm -f $(tooldir)/man/man2/`basename $$i` ; \
+ done; \
+ for i in `find . -type f -name '*.3'`; do \
+ rm -f $(tooldir)/man/man3/`basename $$i` ; \
+ done; \
+ for i in `find . -type f -name '*.5'`; do \
+ rm -f $(tooldir)/man/man5/`basename $$i` ; \
+ done; \
+ for i in `find . -type f -name '*.7'`; do \
+ rm -f $(tooldir)/man/man7/`basename $$i` ; \
+ done
+
clean:
-rm -f *.o *.dll *.a *.exp junk *.base version.cc regexp/*.o winver_stamp *.exe *.d *stamp* *_magic.h
diff --git a/winsup/cygwin/cygmagic b/winsup/cygwin/cygmagic
index 5589b26f6..87e571d9c 100755
--- a/winsup/cygwin/cygmagic
+++ b/winsup/cygwin/cygmagic
@@ -1,4 +1,14 @@
#!/bin/sh
+# cygmagic - Generate "magic numbers" from a structure.
+#
+# Copyright 2001, 2002 Red Hat, Inc.
+#
+# This file is part of Cygwin.
+#
+# This software is a copyrighted work licensed under the terms of the
+# Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+# details.
+
file_magic=$1; shift
gcc=$1; shift
file=$1; shift
@@ -13,7 +23,7 @@ while [ -n "$1" ]; do
sum=`$gcc -E $file | sed -n "/^$struct/,/^};/p" | sed -e 's/[ ]//g' -e '/^$/d' | sum | awk '{printf "0x%x", $1}'`
echo "#define $define $sum"
curr=`sed -n "s/^#[ ]*define CURR_$define[ ][ ]*\([^ ][^ ]*\)/\1/p" $file`
- [ "$curr" == "$sum" ] || echo "*** WARNING WARNING WARNING WARNING WARNING ***
+ [ "$curr" != "$sum" ] && echo "*** WARNING WARNING WARNING WARNING WARNING ***
*** $file: magic number for $define changed old $curr != new $sum
*** WARNING WARNING WARNING WARNING WARNING ***" 1>&2
done >> $file_magic
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 5bc4481be..fadde6ff6 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -1,6 +1,6 @@
/* dcrt0.cc -- essentially the main() for the Cygwin dll
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -817,7 +817,7 @@ _dll_crt0 ()
main_environ = user_data->envptr;
*main_environ = NULL;
- set_console_handler ();
+ early_stuff_init ();
if (!DuplicateHandle (GetCurrentProcess (), GetCurrentProcess (),
GetCurrentProcess (), &hMainProc, 0, FALSE,
DUPLICATE_SAME_ACCESS))
@@ -841,9 +841,11 @@ _dll_crt0 ()
case _PROC_FORK:
user_data->forkee = fork_info->cygpid;
should_be_cb = sizeof (child_info_fork);
+ /* fall through */;
case _PROC_SPAWN:
if (fork_info->pppid_handle)
CloseHandle (fork_info->pppid_handle);
+ /* fall through */;
case _PROC_EXEC:
if (!should_be_cb)
should_be_cb = sizeof (child_info);
@@ -1043,17 +1045,20 @@ multiple_cygwin_problem (const char *what, unsigned magic_version, unsigned vers
fork_info = NULL;
return;
}
- if (CYGWIN_VERSION_MAGIC_VERSION (magic_version) != version)
+
+ char buf[1024];
+ if (GetEnvironmentVariable ("CYGWIN_MISMATCH_OK", buf, sizeof (buf)))
+ return;
+
+ if (CYGWIN_VERSION_MAGIC_VERSION (magic_version) == version)
+ system_printf ("%s magic number mismatch detected - %p/%p", what, magic_version, version);
+ else
api_fatal ("%s version mismatch detected - %p/%p.\n\
You have multiple copies of cygwin1.dll on your system.\n\
Search for cygwin1.dll using the Windows Start->Find/Search facility\n\
and delete all but the most recent version. The most recent version *should*\n\
reside in x:\\cygwin\\bin, where 'x' is the drive on which you have\n\
installed the cygwin distribution.", what, magic_version, version);
-
- char buf[1024];
- if (!GetEnvironmentVariable ("CYGWIN_MISMATCH_OK", buf, sizeof (buf)))
- system_printf ("%s magic number mismatch detected - %p/%p", what, magic_version, version);
}
#ifdef DEBUGGING
diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc
index 5713c5767..1134c45e0 100644
--- a/winsup/cygwin/dir.cc
+++ b/winsup/cygwin/dir.cc
@@ -1,6 +1,6 @@
/* dir.cc: Posix directory-related routines
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -88,12 +88,16 @@ opendir (const char *name)
PC_SYM_FOLLOW | PC_FULL, NULL);
if (!fh)
res = NULL;
+ else if (pc.exists ())
+ res = fh->opendir (pc);
else
{
- res = fh->opendir (pc);
- if (!res)
- delete fh;
+ set_errno (ENOENT);
+ res = NULL;
}
+
+ if (!res && fh)
+ delete fh;
return res;
}
@@ -256,7 +260,7 @@ rmdir (const char *dir)
/* RemoveDirectory on a samba drive doesn't return an error if the
directory can't be removed because it's not empty. Checking for
existence afterwards keeps us informed about success. */
- if (GetFileAttributes (real_dir) != (DWORD) -1)
+ if (GetFileAttributes (real_dir) != INVALID_FILE_ATTRIBUTES)
set_errno (ENOTEMPTY);
else
res = 0;
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index a6f5b075c..f09ddec6c 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -1,6 +1,6 @@
/* dtable.cc: file descriptor support.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -91,8 +91,8 @@ dtable::extend (int howmuch)
}
/* Initialize the file descriptor/handle mapping table.
- We only initialize the parent table here. The child table is
- initialized at each fork () call. */
+ This function should only be called when a cygwin function is invoked
+ by a non-cygwin function, i.e., it should only happen very rarely. */
void
stdio_init (void)
@@ -197,7 +197,10 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle, DWORD myaccess)
first_fd_for_open = 0;
if (!handle || handle == INVALID_HANDLE_VALUE)
- return;
+ {
+ fds[fd] = NULL;
+ return;
+ }
if (__fmode)
bin = __fmode;
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index a9481167b..cb4de7a37 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -1,6 +1,6 @@
/* exceptions.cc
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -38,6 +38,9 @@ extern DWORD __no_sig_start, __no_sig_end;
extern DWORD sigtid;
+extern HANDLE hExeced;
+extern DWORD dwExeced;
+
static BOOL WINAPI ctrl_c_handler (DWORD);
static void signal_exit (int) __attribute__ ((noreturn));
static char windows_system_directory[1024];
@@ -113,8 +116,12 @@ init_exception_handler (exception_list *el)
#endif
void
-set_console_handler ()
+early_stuff_init ()
{
+ (void) SetConsoleCtrlHandler (ctrl_c_handler, FALSE);
+ if (!SetConsoleCtrlHandler (ctrl_c_handler, TRUE))
+ system_printf ("SetConsoleCtrlHandler failed, %E");
+
/* Initialize global security attribute stuff */
sec_none.nLength = sec_none_nih.nLength =
@@ -124,10 +131,6 @@ set_console_handler ()
sec_none.lpSecurityDescriptor = sec_none_nih.lpSecurityDescriptor = NULL;
sec_all.lpSecurityDescriptor = sec_all_nih.lpSecurityDescriptor =
get_null_sd ();
-
- (void) SetConsoleCtrlHandler (ctrl_c_handler, FALSE);
- if (!SetConsoleCtrlHandler (ctrl_c_handler, TRUE))
- system_printf ("SetConsoleCtrlHandler failed, %E");
}
extern "C" void
@@ -890,7 +893,7 @@ setup_handler (int sig, void *handler, struct sigaction& siga)
#error "Need to supply machine dependent setup_handler"
#endif
-/* CGF Keyboard interrupt handler. */
+/* Keyboard interrupt handler. */
static BOOL WINAPI
ctrl_c_handler (DWORD type)
{
@@ -911,8 +914,18 @@ ctrl_c_handler (DWORD type)
return FALSE;
}
+ /* If we are a stub and the new process has a pinfo structure, let it
+ handle this signal. */
+ if (dwExeced && pinfo (dwExeced))
+ return TRUE;
+
+ /* We're only the process group leader when we have a valid pinfo structure.
+ If we don't have one, then the parent "stub" will handle the signal. */
+ if (!pinfo (GetCurrentProcessId ()))
+ return TRUE;
+
tty_min *t = cygwin_shared->tty.get_tty (myself->ctty);
- /* Ignore this if we're not the process group lead since it should be handled
+ /* Ignore this if we're not the process group leader since it should be handled
*by* the process group leader. */
if (myself->ctty != -1 && t->getpgid () == myself->pid &&
(GetTickCount () - t->last_ctrl_c) >= MIN_CTRL_C_SLOP)
@@ -925,6 +938,7 @@ ctrl_c_handler (DWORD type)
t->last_ctrl_c = GetTickCount ();
return TRUE;
}
+
return TRUE;
}
@@ -949,7 +963,7 @@ set_process_mask (sigset_t newmask)
}
int __stdcall
-sig_handle (int sig)
+sig_handle (int sig, bool thisproc)
{
int rc = 0;
@@ -996,7 +1010,8 @@ sig_handle (int sig)
if (handler == (void *) SIG_DFL)
{
- if (sig == SIGCHLD || sig == SIGIO || sig == SIGCONT || sig == SIGWINCH)
+ if (sig == SIGCHLD || sig == SIGIO || sig == SIGCONT || sig == SIGWINCH
+ || sig == SIGURG || (thisproc && hExeced && sig == SIGINT))
{
sigproc_printf ("default signal %d ignored", sig);
goto done;
@@ -1059,8 +1074,6 @@ sig_handle (int sig)
static void
signal_exit (int rc)
{
- extern HANDLE hExeced;
-
rc = EXIT_SIGNAL | (rc << 8);
if (exit_already++)
myself->exit (rc);
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 21f4fb39c..a36ef0b13 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -1,6 +1,6 @@
/* fhandler.cc. See console.cc for fhandler_console functions.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -386,7 +386,7 @@ fhandler_base::open (path_conv *, int flags, mode_t mode)
if (get_query_open () &&
isremote () &&
creation_distribution == OPEN_EXISTING &&
- GetFileAttributes (get_win32_name ()) == (DWORD) -1)
+ GetFileAttributes (get_win32_name ()) == INVALID_FILE_ATTRIBUTES)
{
set_errno (ENOENT);
goto done;
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 1ce4893d2..18887844e 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -1,6 +1,6 @@
/* fhandler_disk_file.cc
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -382,7 +382,7 @@ fhandler_disk_file::open (path_conv *real_path, int flags, mode_t mode)
which returns a valid handle when trying to open a file in a nonexistent
directory. */
if (real_path->has_buggy_open ()
- && GetFileAttributes (win32_path_name) == (DWORD) -1)
+ && GetFileAttributes (win32_path_name) == INVALID_FILE_ATTRIBUTES)
{
debug_printf ("Buggy open detected.");
close ();
@@ -804,7 +804,7 @@ fhandler_cygdrive::readdir (DIR *dir)
set_errno (ENMFILE);
return NULL;
}
- if (GetFileAttributes (pdrive) == (DWORD) -1)
+ if (GetFileAttributes (pdrive) == INVALID_FILE_ATTRIBUTES)
{
pdrive += DRVSZ;
return readdir (dir);
diff --git a/winsup/cygwin/include/sys/ioctl.h b/winsup/cygwin/include/sys/ioctl.h
index 93f73a69c..fd9515fb1 100644
--- a/winsup/cygwin/include/sys/ioctl.h
+++ b/winsup/cygwin/include/sys/ioctl.h
@@ -1,6 +1,6 @@
/* sys/ioctl.h
- Copyright 1998, 2001 Red Hat, Inc.
+ Copyright 1998, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -23,7 +23,7 @@ details. */
__BEGIN_DECLS
-int ioctl (int __fd, int __cmd, void *);
+int ioctl (int __fd, int __cmd, ...);
__END_DECLS
diff --git a/winsup/cygwin/ioctl.cc b/winsup/cygwin/ioctl.cc
index 98c157800..2f96e8508 100644
--- a/winsup/cygwin/ioctl.cc
+++ b/winsup/cygwin/ioctl.cc
@@ -1,6 +1,6 @@
/* ioctl.cc: ioctl routines.
- Copyright 1996, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
Written by Doug Evans of Cygnus Support
dje@cygnus.com
@@ -23,25 +23,31 @@ details. */
#include <sys/termios.h>
extern "C" int
-ioctl (int fd, int cmd, void *buf)
+ioctl (int fd, int cmd, ...)
{
cygheap_fdget cfd (fd);
if (cfd < 0)
return -1;
+ /* check for optional mode argument */
+ va_list ap;
+ va_start (ap, cmd);
+ char *argp = va_arg (ap, char *);
+ va_end (ap);
+
debug_printf ("fd %d, cmd %x\n", fd, cmd);
if (cfd->is_tty () && cfd->get_device () != FH_PTYM)
switch (cmd)
{
case TCGETA:
- return tcgetattr (fd, (struct termios *) buf);
+ return tcgetattr (fd, (struct termios *) argp);
case TCSETA:
- return tcsetattr (fd, TCSANOW, (struct termios *) buf);
+ return tcsetattr (fd, TCSANOW, (struct termios *) argp);
case TCSETAW:
- return tcsetattr (fd, TCSADRAIN, (struct termios *) buf);
+ return tcsetattr (fd, TCSADRAIN, (struct termios *) argp);
case TCSETAF:
- return tcsetattr (fd, TCSAFLUSH, (struct termios *) buf);
+ return tcsetattr (fd, TCSAFLUSH, (struct termios *) argp);
}
- return cfd->ioctl (cmd, buf);
+ return cfd->ioctl (cmd, argp);
}
diff --git a/winsup/cygwin/mkvers.sh b/winsup/cygwin/mkvers.sh
index 6d54b4fca..3296b569a 100755
--- a/winsup/cygwin/mkvers.sh
+++ b/winsup/cygwin/mkvers.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# mkvers.sh - Make version information for cygwin DLL
#
-# Copyright 1998, 1999, 2000, 2001 Red Hat, Inc.
+# Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
#
# This file is part of Cygwin.
#
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index 9e02085e1..c73a5af18 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -541,7 +541,7 @@ cygwin_socket (int af, int type, int protocol)
{
debug_printf ("socket (%d, %d, %d)", af, type, protocol);
- soc = socket (AF_INET, type, af == AF_UNIX ? 0 : protocol);
+ soc = socket (AF_INET, type, af == AF_LOCAL ? 0 : protocol);
if (soc == INVALID_SOCKET)
{
@@ -578,7 +578,7 @@ static int get_inet_addr (const struct sockaddr *in, int inlen,
*outlen = inlen;
return 1;
}
- else if (in->sa_family == AF_UNIX)
+ else if (in->sa_family == AF_LOCAL)
{
int fd = _open (in->sa_data, O_RDONLY);
if (fd == -1)
@@ -897,7 +897,7 @@ cygwin_connect (int fd,
}
set_winsock_errno ();
}
- if (sock->get_addr_family () == AF_UNIX)
+ if (sock->get_addr_family () == AF_LOCAL)
{
if (!res || in_progress)
{
@@ -1215,7 +1215,7 @@ cygwin_accept (int fd, struct sockaddr *peer, int *len)
WSAGetLastError () == WSAEWOULDBLOCK)
in_progress = TRUE;
- if (sock->get_addr_family () == AF_UNIX)
+ if (sock->get_addr_family () == AF_LOCAL)
{
if ((SOCKET) res != (SOCKET) INVALID_SOCKET || in_progress)
{
@@ -1255,6 +1255,8 @@ cygwin_accept (int fd, struct sockaddr *peer, int *len)
else
{
fhandler_socket* res_fh = fdsock (res_fd, sock->get_name (), res);
+ if (sock->get_addr_family () == AF_LOCAL)
+ res_fh->set_sun_path (sock->get_sun_path ());
res_fh->set_addr_family (sock->get_addr_family ());
res = res_fd;
}
@@ -1276,7 +1278,7 @@ cygwin_bind (int fd, const struct sockaddr *my_addr, int addrlen)
fhandler_socket *sock = get (fd);
if (sock)
{
- if (my_addr->sa_family == AF_UNIX)
+ if (my_addr->sa_family == AF_LOCAL)
{
#define un_addr ((struct sockaddr_un *) my_addr)
struct sockaddr_in sin;
@@ -1293,19 +1295,19 @@ cygwin_bind (int fd, const struct sockaddr *my_addr, int addrlen)
sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
if (bind (sock->get_socket (), (sockaddr *) &sin, len))
{
- syscall_printf ("AF_UNIX: bind failed %d", get_errno ());
+ syscall_printf ("AF_LOCAL: bind failed %d", get_errno ());
set_winsock_errno ();
goto out;
}
if (getsockname (sock->get_socket (), (sockaddr *) &sin, &len))
{
- syscall_printf ("AF_UNIX: getsockname failed %d", get_errno ());
+ syscall_printf ("AF_LOCAL: getsockname failed %d", get_errno ());
set_winsock_errno ();
goto out;
}
sin.sin_port = ntohs (sin.sin_port);
- debug_printf ("AF_UNIX: socket bound to port %u", sin.sin_port);
+ debug_printf ("AF_LOCAL: socket bound to port %u", sin.sin_port);
/* bind must fail if file system socket object already exists
so _open () is called with O_EXCL flag. */
@@ -1367,11 +1369,11 @@ cygwin_getsockname (int fd, struct sockaddr *addr, int *namelen)
fhandler_socket *sock = get (fd);
if (sock)
{
- if (sock->get_addr_family () == AF_UNIX)
+ if (sock->get_addr_family () == AF_LOCAL)
{
struct sockaddr_un *sun = (struct sockaddr_un *) addr;
memset (sun, 0, *namelen);
- sun->sun_family = AF_UNIX;
+ sun->sun_family = AF_LOCAL;
/* According to SUSv2 "If the actual length of the address is greater
than the length of the supplied sockaddr structure, the stored
address will be truncated." We play it save here so that the
@@ -2322,17 +2324,34 @@ done:
/* socketpair: standards? */
/* Win32 supports AF_INET only, so ignore domain and protocol arguments */
extern "C" int
-socketpair (int, int type, int, int *sb)
+socketpair (int family, int type, int protocol, int *sb)
{
int res = -1;
SOCKET insock, outsock, newsock;
- struct sockaddr_in sock_in;
- int len = sizeof (sock_in);
+ struct sockaddr_in sock_in, sock_out;
+ int len;
+ cygheap_fdnew sb0;
if (__check_null_invalid_struct_errno (sb, 2 * sizeof(int)))
return -1;
- cygheap_fdnew sb0;
+ if (family != AF_LOCAL && family != AF_INET)
+ {
+ set_errno (EAFNOSUPPORT);
+ goto done;
+ }
+ if (type != SOCK_STREAM && type != SOCK_DGRAM)
+ {
+ set_errno (EPROTOTYPE);
+ goto done;
+ }
+ if ((family == AF_LOCAL && protocol != PF_UNSPEC && protocol != PF_LOCAL)
+ || (family == AF_INET && protocol != PF_UNSPEC && protocol != PF_INET))
+ {
+ set_errno (EPROTONOSUPPORT);
+ goto done;
+ }
+
if (sb0 < 0)
goto done;
else
@@ -2344,7 +2363,8 @@ socketpair (int, int type, int, int *sb)
sb[1] = sb1;
}
- /* create a listening socket */
+
+ /* create the first socket */
newsock = socket (AF_INET, type, 0);
if (newsock == INVALID_SOCKET)
{
@@ -2357,7 +2377,6 @@ socketpair (int, int type, int, int *sb)
sock_in.sin_family = AF_INET;
sock_in.sin_port = 0;
sock_in.sin_addr.s_addr = INADDR_ANY;
-
if (bind (newsock, (struct sockaddr *) &sock_in, sizeof (sock_in)) < 0)
{
debug_printf ("bind failed");
@@ -2365,7 +2384,7 @@ socketpair (int, int type, int, int *sb)
closesocket (newsock);
goto done;
}
-
+ len = sizeof (sock_in);
if (getsockname (newsock, (struct sockaddr *) &sock_in, &len) < 0)
{
debug_printf ("getsockname error");
@@ -2374,7 +2393,9 @@ socketpair (int, int type, int, int *sb)
goto done;
}
- listen (newsock, 2);
+ /* For stream sockets, create a listener */
+ if (type == SOCK_STREAM)
+ listen (newsock, 2);
/* create a connecting socket */
outsock = socket (AF_INET, type, 0);
@@ -2386,9 +2407,37 @@ socketpair (int, int type, int, int *sb)
goto done;
}
+ /* For datagram sockets, bind the 2nd socket to an unused address, too */
+ if (type == SOCK_DGRAM)
+ {
+ sock_out.sin_family = AF_INET;
+ sock_out.sin_port = 0;
+ sock_out.sin_addr.s_addr = INADDR_ANY;
+ if (bind (outsock, (struct sockaddr *) &sock_out, sizeof (sock_out)) < 0)
+ {
+ debug_printf ("bind failed");
+ set_winsock_errno ();
+ closesocket (newsock);
+ closesocket (outsock);
+ goto done;
+ }
+ len = sizeof (sock_out);
+ if (getsockname (outsock, (struct sockaddr *) &sock_out, &len) < 0)
+ {
+ debug_printf ("getsockname error");
+ set_winsock_errno ();
+ closesocket (newsock);
+ closesocket (outsock);
+ goto done;
+ }
+ }
+
+ /* Force IP address to loopback */
sock_in.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
+ if (type == SOCK_DGRAM)
+ sock_out.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
- /* Do a connect and accept the connection */
+ /* Do a connect */
if (connect (outsock, (struct sockaddr *) &sock_in,
sizeof (sock_in)) < 0)
{
@@ -2399,22 +2448,60 @@ socketpair (int, int type, int, int *sb)
goto done;
}
- insock = accept (newsock, (struct sockaddr *) &sock_in, &len);
- if (insock == INVALID_SOCKET)
+ if (type == SOCK_STREAM)
{
- debug_printf ("accept error");
- set_winsock_errno ();
+ /* For stream sockets, accept the connection and close the listener */
+ len = sizeof (sock_in);
+ insock = accept (newsock, (struct sockaddr *) &sock_in, &len);
+ if (insock == INVALID_SOCKET)
+ {
+ debug_printf ("accept error");
+ set_winsock_errno ();
+ closesocket (newsock);
+ closesocket (outsock);
+ goto done;
+ }
closesocket (newsock);
- closesocket (outsock);
- goto done;
+ }
+ else
+ {
+ /* For datagram sockets, connect the 2nd socket */
+ if (connect (newsock, (struct sockaddr *) &sock_out,
+ sizeof (sock_out)) < 0)
+ {
+ debug_printf ("connect error");
+ set_winsock_errno ();
+ closesocket (newsock);
+ closesocket (outsock);
+ goto done;
+ }
+ insock = newsock;
}
- closesocket (newsock);
res = 0;
- fdsock (sb[0], "/dev/tcp", insock);
-
- fdsock (sb[1], "/dev/tcp", outsock);
+ if (family == AF_LOCAL)
+ {
+ fhandler_socket *fh;
+
+ fh = fdsock (sb[0],
+ type == SOCK_STREAM ? "/dev/streamsocket" : "/dev/dgsocket",
+ insock);
+ fh->set_sun_path ("");
+ fh->set_addr_family (AF_LOCAL);
+ fh = fdsock (sb[1],
+ type == SOCK_STREAM ? "/dev/streamsocket" : "/dev/dgsocket",
+ outsock);
+ fh->set_sun_path ("");
+ fh->set_addr_family (AF_LOCAL);
+ }
+ else
+ {
+ fdsock (sb[0], type == SOCK_STREAM ? "/dev/tcp" : "/dev/udp",
+ insock)->set_addr_family (AF_INET);
+ fdsock (sb[1], type == SOCK_STREAM ? "/dev/tcp" : "/dev/udp",
+ outsock)->set_addr_family (AF_INET);
+ }
done:
syscall_printf ("%d = socketpair (...)", res);
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index aa0ec5454..6b8a71e49 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1,6 +1,6 @@
/* path.cc: path support.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -400,7 +400,7 @@ path_conv::check (const char *src, unsigned opt,
int loop = 0;
path_flags = 0;
known_suffix = NULL;
- fileattr = (DWORD) -1;
+ fileattr = INVALID_FILE_ATTRIBUTES;
case_clash = false;
devn = unit = 0;
root_dir[0] = '\0';
@@ -551,7 +551,7 @@ path_conv::check (const char *src, unsigned opt,
/* If symlink.check found an existing non-symlink file, then
it sets the appropriate flag. It also sets any suffix found
into `ext_here'. */
- if (!sym.is_symlink && sym.fileattr != (DWORD) -1)
+ if (!sym.is_symlink && sym.fileattr != INVALID_FILE_ATTRIBUTES)
{
error = sym.error;
if (component == 0)
@@ -2397,7 +2397,7 @@ cygdrive_getmntent ()
__small_sprintf (native_path, "%c:\\", drive);
if (GetDriveType (native_path) == DRIVE_REMOVABLE ||
- GetFileAttributes (native_path) == (DWORD) -1)
+ GetFileAttributes (native_path) == INVALID_FILE_ATTRIBUTES)
{
available_drives &= ~mask;
continue;
@@ -2609,7 +2609,7 @@ symlink (const char *topath, const char *frompath)
}
backslashify (topath, w32topath, 0);
}
- if (!cp || GetFileAttributes (w32topath) == (DWORD)-1)
+ if (!cp || GetFileAttributes (w32topath) == INVALID_FILE_ATTRIBUTES)
{
win32_topath.check (topath, PC_SYM_NOFOLLOW);
if (!cp || win32_topath.error != ENOENT)
@@ -2911,7 +2911,7 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt)
{
error = 0;
fileattr = GetFileAttributes (suffix.path);
- if (fileattr == (DWORD) -1)
+ if (fileattr == INVALID_FILE_ATTRIBUTES)
{
/* The GetFileAttributes call can fail for reasons that don't
matter, so we just return 0. For example, getting the
@@ -2978,7 +2978,7 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt)
if (!suffix.lnk_match () || !ext_tacked_on)
goto file_not_symlink;
- fileattr = (DWORD) -1;
+ fileattr = INVALID_FILE_ATTRIBUTES;
continue; /* in case we're going to tack *another* .lnk on this filename. */
case 2:
res = check_sysfile (suffix.path, fileattr, h, contents, &error, &pflags);
@@ -3072,7 +3072,7 @@ readlink (const char *path, char *buf, int buflen)
if (!pathbuf.issymlink ())
{
- if (pathbuf.fileattr != (DWORD) -1)
+ if (pathbuf.fileattr != INVALID_FILE_ATTRIBUTES)
set_errno (EINVAL);
return -1;
}
diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h
index 766c2a261..ea3a6545a 100644
--- a/winsup/cygwin/path.h
+++ b/winsup/cygwin/path.h
@@ -1,6 +1,6 @@
/* path.h: path data structures
- Copyright 1996, 1997, 1998, 2000 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -86,7 +86,7 @@ class path_conv
int issymlink () const {return path_flags & PATH_SYMLINK;}
int issocket () const {return path_flags & PATH_SOCKET;}
int iscygexec () const {return path_flags & PATH_CYGWIN_EXEC;}
- bool exists () const {return fileattr != (DWORD) -1;}
+ bool exists () const {return fileattr != INVALID_FILE_ATTRIBUTES;}
bool has_attribute (DWORD x) const {return exists () && (fileattr & x);}
int isdir () const {return has_attribute (FILE_ATTRIBUTE_DIRECTORY);}
executable_states exec_state ()
@@ -124,7 +124,7 @@ class path_conv
check (src, opt | PC_NULLEMPTY, suffixes);
}
- path_conv (): path_flags (0), known_suffix (NULL), error (0), devn (0), unit (0), fileattr (0xffffffff) {path[0] = '\0';}
+ path_conv (): path_flags (0), known_suffix (NULL), error (0), devn (0), unit (0), fileattr (INVALID_FILE_ATTRIBUTES) {path[0] = '\0';}
inline char *get_win32 () { return path; }
operator char *() {return path; }
diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc
index 652348302..5a00a7fca 100644
--- a/winsup/cygwin/signal.cc
+++ b/winsup/cygwin/signal.cc
@@ -1,6 +1,6 @@
/* signal.cc
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
Written by Steve Chamberlain of Cygnus Support, sac@cygnus.com
Significant changes by Sergey Okhapkin <sos@prospect.com.ru>
@@ -13,6 +13,7 @@ details. */
#include "winsup.h"
#include <errno.h>
+#include <stdlib.h>
#include "cygerrno.h"
#include <sys/cygwin.h>
#include "sync.h"
@@ -190,6 +191,7 @@ _raise (int sig)
int
_kill (pid_t pid, int sig)
{
+ sigframe thisframe (mainthread);
syscall_printf ("kill (%d, %d)", pid, sig);
/* check that sig is in right range */
if (sig < 0 || sig >= NSIG)
@@ -214,6 +216,7 @@ kill_pgrp (pid_t pid, int sig)
int res = 0;
int found = 0;
int killself = 0;
+ sigframe thisframe (mainthread);
sigproc_printf ("pid %d, signal %d", pid, sig);
@@ -257,6 +260,31 @@ killpg (pid_t pgrp, int sig)
return _kill (-pgrp, sig);
}
+extern "C" void
+abort (void)
+{
+ sigframe thisframe (mainthread);
+ /* Flush all streams as per SUSv2.
+ From my reading of this document, this isn't strictly correct.
+ The streams are supposed to be flushed prior to exit. However,
+ if there is I/O in any signal handler that will not necessarily
+ be flushed.
+ However this is the way FreeBSD does it, and it is much easier to
+ do things this way, so... */
+ if (_reent_clib ()->__cleanup)
+ _reent_clib ()->__cleanup (_reent_clib ());
+
+ /* Ensure that SIGABRT can be caught regardless of blockage. */
+ sigset_t sig_mask;
+ sigfillset (&sig_mask);
+ sigdelset (&sig_mask, SIGABRT);
+ set_process_mask (sig_mask);
+
+ _raise (SIGABRT);
+ (void) thisframe.call_signal_handler (); /* Call any signal handler */
+ do_exit (1); /* signal handler didn't exit. Goodbye. */
+}
+
extern "C" int
sigaction (int sig, const struct sigaction *newact, struct sigaction *oldact)
{
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 2e409820a..ef70fa232 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -1,6 +1,6 @@
/* sigproc.cc: inter/intra signal and sub process handler
- Copyright 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
Written by Christopher Faylor <cgf@cygnus.com>
@@ -926,6 +926,7 @@ getsem (_pinfo *p, const char *str, int init, int max)
return NULL;
}
int wait = 1000;
+ /* Wait for new process to generate its semaphores. */
sigproc_printf ("pid %d, ppid %d, wait %d, initializing %x", p->pid, p->ppid, wait,
ISSTATE (p, PID_INITIALIZING));
for (int i = 0; ISSTATE (p, PID_INITIALIZING) && i < wait; i++)
@@ -941,27 +942,27 @@ getsem (_pinfo *p, const char *str, int init, int max)
h = CreateSemaphore (allow_ntsec ? sec_user_nih (sa_buf) : &sec_none_nih,
init, max, str = shared_name (str, winpid));
p = myself;
+ if (!h)
+ {
+ system_printf ("can't create semaphore %s, %E", str);
+ __seterrno ();
+ }
}
else
{
h = OpenSemaphore (SEMAPHORE_ALL_ACCESS, FALSE,
- str = shared_name (str, p->dwProcessId));
+ shared_name (str, p->dwProcessId));
- if (h == NULL)
+ if (!h)
{
if (GetLastError () == ERROR_FILE_NOT_FOUND && !proc_exists (p))
- set_errno (ESRCH);
+ set_errno (ESRCH); /* No such process */
else
- set_errno (EPERM);
- return NULL;
+ set_errno (EPERM); /* Couldn't access the semaphore --
+ different cygwin DLL maybe? */
}
}
- if (!h)
- {
- system_printf ("can't %s %s, %E", p ? "open" : "create", str);
- set_errno (ESRCH);
- }
return h;
}
@@ -1189,7 +1190,7 @@ wait_sig (VOID *)
/* A normal UNIX signal */
default:
sigproc_printf ("Got signal %d", sig);
- int wasdispatched = sig_handle (sig);
+ int wasdispatched = sig_handle (sig, rc != 2);
if (sig == SIGCHLD && wasdispatched)
dispatched_sigchld = 1;
/* Need to decrement again to offset increment below since
diff --git a/winsup/cygwin/sigproc.h b/winsup/cygwin/sigproc.h
index dc67b6b08..b4cc45eb6 100644
--- a/winsup/cygwin/sigproc.h
+++ b/winsup/cygwin/sigproc.h
@@ -1,6 +1,6 @@
/* sigproc.h
- Copyright 1997, 1998, 2000, 2001 Red Hat, Inc.
+ Copyright 1997, 1998, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -98,7 +98,7 @@ BOOL __stdcall my_parent_is_alive ();
extern "C" int __stdcall sig_dispatch_pending (int force = FALSE);
extern "C" void __stdcall set_process_mask (sigset_t newmask);
extern "C" void __stdcall reset_signal_arrived ();
-int __stdcall sig_handle (int);
+int __stdcall sig_handle (int, bool);
void __stdcall sig_clear (int);
void __stdcall sig_set_pending (int);
int __stdcall handle_sigsuspend (sigset_t);
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 72fb649bf..887e69b3e 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -1,6 +1,6 @@
/* spawn.cc
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -48,6 +48,7 @@ static suffix_info std_suffixes[] =
};
HANDLE hExeced;
+DWORD dwExeced;
/* Add .exe to PROG if not already present and see if that exists.
If not, return PROG (converted from posix to win32 rules if necessary).
@@ -56,7 +57,7 @@ HANDLE hExeced;
Returns (possibly NULL) suffix */
static const char *
-perhaps_suffix (const char *prog, path_conv &buf)
+perhaps_suffix (const char *prog, path_conv& buf)
{
char *ext;
@@ -760,6 +761,7 @@ spawn_guts (HANDLE hToken, const char * prog_arg, const char *const *argv,
primarily for strace. */
strace.execing = 1;
hExeced = pi.hProcess;
+ dwExeced = pi.dwProcessId;
strcpy (myself->progname, real_path);
close_all_files ();
}
diff --git a/winsup/cygwin/speclib b/winsup/cygwin/speclib
index f9c467685..ac7cc28fa 100755
--- a/winsup/cygwin/speclib
+++ b/winsup/cygwin/speclib
@@ -1,4 +1,14 @@
#!/bin/sh
+# speclib - Make a special version of the cygwin import library.
+#
+# Copyright 2001, 2002 Red Hat, Inc.
+#
+# This file is part of Cygwin.
+#
+# This software is a copyrighted work licensed under the terms of the
+# Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+# details.
+
case "$1" in
-v) v="-v"; shift
esac
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 7686eb155..c7693ae81 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -1,6 +1,6 @@
/* syscalls.cc: syscalls
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -205,7 +205,8 @@ _unlink (const char *ourname)
syscall_printf ("CreateFile/CloseHandle succeeded");
/* Everything is fine if the file has disappeared or if we know that the
FILE_FLAG_DELETE_ON_CLOSE will eventually work. */
- if (GetFileAttributes (win32_name) == (DWORD) -1 || delete_on_close_ok)
+ if (GetFileAttributes (win32_name) == INVALID_FILE_ATTRIBUTES
+ || delete_on_close_ok)
goto ok; /* The file is either gone already or will eventually be
deleted by the OS. */
}
@@ -1424,6 +1425,8 @@ pathconf (const char *file, int v)
switch (v)
{
case _PC_PATH_MAX:
+ if (check_null_empty_str_errno (file))
+ return -1;
return PATH_MAX - strlen (file);
case _PC_NAME_MAX:
return PATH_MAX;
diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc
index e5635ddff..1993c5884 100644
--- a/winsup/cygwin/times.cc
+++ b/winsup/cygwin/times.cc
@@ -1,6 +1,6 @@
/* times.cc
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -475,8 +475,7 @@ utimes (const char *path, struct timeval *tvp)
if (h == INVALID_HANDLE_VALUE)
{
- if ((res = GetFileAttributes (win32.get_win32 ())) != -1 &&
- (res & FILE_ATTRIBUTE_DIRECTORY))
+ if (win32.isdir ())
{
/* What we can do with directories more? */
res = 0;
diff --git a/winsup/cygwin/window.cc b/winsup/cygwin/window.cc
index 953f603ba..2a1dafb62 100644
--- a/winsup/cygwin/window.cc
+++ b/winsup/cygwin/window.cc
@@ -18,6 +18,8 @@ details. */
#include <limits.h>
#include <wingdi.h>
#include <winuser.h>
+#define USE_SYS_TYPES_FD_SET
+#include <winsock2.h>
#include <unistd.h>
#include "cygerrno.h"
#include "perprocess.h"
@@ -61,7 +63,10 @@ WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
return 0;
case WM_ASYNCIO:
- raise (SIGIO);
+ if (WSAGETSELECTEVENT(lParam) == FD_OOB)
+ raise (SIGURG);
+ else
+ raise (SIGIO);
return 0;
default:
return DefWindowProc (hwnd, uMsg, wParam, lParam);
diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h
index 9759f1348..5548e2de4 100644
--- a/winsup/cygwin/winsup.h
+++ b/winsup/cygwin/winsup.h
@@ -1,6 +1,6 @@
/* winsup.h: main Cygwin header file.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -195,7 +195,7 @@ void __stdcall totimeval (struct timeval *dst, FILETIME * src, int sub, int flag
long __stdcall to_time_t (FILETIME * ptr);
void __stdcall set_console_title (char *);
-void set_console_handler ();
+void early_stuff_init ();
int __stdcall check_null_str (const char *name) __attribute__ ((regparm(1)));
int __stdcall check_null_empty_str (const char *name) __attribute__ ((regparm(1)));