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
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog10
-rw-r--r--winsup/cygwin/cygerrno.h2
-rw-r--r--winsup/cygwin/debug.cc13
-rw-r--r--winsup/cygwin/debug.h4
-rw-r--r--winsup/cygwin/fhandler.cc5
5 files changed, 24 insertions, 10 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 4c22f8ab4..9d6e25224 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,15 @@
2001-10-22 Christopher Faylor <cgf@redhat.com>
+ * debug.cc (set_errno): Return value of errno that was set, just like
+ the macro.
+ (setclexec_pid): Replace old handle with new handle.
+ * debug.h: Reflect change in arguments for setclexec_pid.
+ * fhandler.cc (fhandler_base::set_inheritance): Ditto.
+ (fhandler_base::fork_fixup): Ditto.
+ * cygerrno.h: Reflect return value change for set_errno.
+
+2001-10-22 Christopher Faylor <cgf@redhat.com>
+
Remove 'cb' parameter and modify fhandler_* constructors throughout.
* dtable.cc (dtable::build_fhandler): Remove debugging output which
uses 'cb'.
diff --git a/winsup/cygwin/cygerrno.h b/winsup/cygwin/cygerrno.h
index ff4e90489..0c1513f25 100644
--- a/winsup/cygwin/cygerrno.h
+++ b/winsup/cygwin/cygerrno.h
@@ -18,7 +18,7 @@ int __stdcall geterrno_from_win_error (DWORD code, int deferrno) __attribute__ (
#ifndef DEBUGGING
#define set_errno(val) (_impure_ptr->_errno = (val))
#else
-void __stdcall __set_errno (const char *ln, int ln, int val) __attribute ((regparm(3)));
+int __stdcall __set_errno (const char *ln, int ln, int val) __attribute ((regparm(3)));
#define set_errno(val) __set_errno (__PRETTY_FUNCTION__, __LINE__, (val))
#endif
#define get_errno() (_impure_ptr->_errno)
diff --git a/winsup/cygwin/debug.cc b/winsup/cygwin/debug.cc
index 6de0757ab..ef2ba1fc4 100644
--- a/winsup/cygwin/debug.cc
+++ b/winsup/cygwin/debug.cc
@@ -214,11 +214,14 @@ out:
}
void
-setclexec_pid (HANDLE h, bool setit)
+setclexec_pid (HANDLE oh, HANDLE nh, bool setit)
{
- handle_list *hl = find_handle (h);
+ handle_list *hl = find_handle (oh);
if (hl)
- hl->clexec_pid = setit ? GetCurrentProcessId () : 0;
+ {
+ hl->clexec_pid = setit ? GetCurrentProcessId () : 0;
+ hl->h = nh;
+ }
}
/* Create a new handle record */
@@ -351,10 +354,10 @@ close_handle (const char *func, int ln, HANDLE h, const char *name, BOOL force)
}
/* Add a handle to the linked list of known handles. */
-void __stdcall
+int __stdcall
__set_errno (const char *func, int ln, int val)
{
debug_printf ("%s:%d val %d", func, ln, val);
- _impure_ptr->_errno = val;
+ return _impure_ptr->_errno = val;
}
#endif /*DEBUGGING*/
diff --git a/winsup/cygwin/debug.h b/winsup/cygwin/debug.h
index 8323e617a..0b7e53359 100644
--- a/winsup/cygwin/debug.h
+++ b/winsup/cygwin/debug.h
@@ -43,7 +43,7 @@ int __stdcall iscygthread ();
# define ProtectHandle1(h,n) do {} while (0)
# define ProtectHandle2(h,n) do {} while (0)
# define debug_init() do {} while (0)
-# define setclexec_pid(h, b) do {} while (0)
+# define setclexec_pid(h, nh, b) do {} while (0)
# define debug_fixup_after_fork() do {} while (0)
#else
@@ -72,7 +72,7 @@ BOOL __stdcall close_handle (const char *, int, HANDLE, const char *, BOOL)
__attribute__ ((regparm (3)));
void __stdcall cygbench (const char *s) __attribute__ ((regparm (1)));
extern "C" void console_printf (const char *fmt,...);
-void setclexec_pid (HANDLE, bool);
+void setclexec_pid (HANDLE, HANDLE, bool);
void debug_fixup_after_fork ();
extern int pinger;
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 2e6100a3a..cc205c087 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -1611,6 +1611,7 @@ fhandler_dev_null::dump (void)
void
fhandler_base::set_inheritance (HANDLE &h, int not_inheriting)
{
+ HANDLE oh = h;
/* Note that we could use SetHandleInformation here but it is not available
on all platforms. Test cases seem to indicate that using DuplicateHandle
in this fashion does not actually close the original handle, which is
@@ -1620,7 +1621,7 @@ fhandler_base::set_inheritance (HANDLE &h, int not_inheriting)
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
debug_printf ("DuplicateHandle failed, %E");
#ifdef DEBUGGING
- setclexec_pid (h, not_inheriting);
+ setclexec_pid (oh, h, not_inheriting);
#endif
}
@@ -1640,7 +1641,7 @@ fhandler_base::fork_fixup (HANDLE parent, HANDLE &h, const char *name)
{
debug_printf ("%s success - oldh %p, h %p", get_name (), oh, h);
// someday, maybe ProtectHandle2 (h, name);
- setclexec_pid (h, !get_close_on_exec ());
+ setclexec_pid (h, h, !get_close_on_exec ());
}
#endif
}