mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-19 04:49:25 +08:00
* 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.
This commit is contained in:
parent
e7e231e531
commit
a05d38a8b4
@ -1,3 +1,13 @@
|
|||||||
|
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>
|
2001-10-22 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
Remove 'cb' parameter and modify fhandler_* constructors throughout.
|
Remove 'cb' parameter and modify fhandler_* constructors throughout.
|
||||||
|
@ -18,7 +18,7 @@ int __stdcall geterrno_from_win_error (DWORD code, int deferrno) __attribute__ (
|
|||||||
#ifndef DEBUGGING
|
#ifndef DEBUGGING
|
||||||
#define set_errno(val) (_impure_ptr->_errno = (val))
|
#define set_errno(val) (_impure_ptr->_errno = (val))
|
||||||
#else
|
#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))
|
#define set_errno(val) __set_errno (__PRETTY_FUNCTION__, __LINE__, (val))
|
||||||
#endif
|
#endif
|
||||||
#define get_errno() (_impure_ptr->_errno)
|
#define get_errno() (_impure_ptr->_errno)
|
||||||
|
@ -214,11 +214,14 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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)
|
if (hl)
|
||||||
|
{
|
||||||
hl->clexec_pid = setit ? GetCurrentProcessId () : 0;
|
hl->clexec_pid = setit ? GetCurrentProcessId () : 0;
|
||||||
|
hl->h = nh;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a new handle record */
|
/* 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. */
|
/* Add a handle to the linked list of known handles. */
|
||||||
void __stdcall
|
int __stdcall
|
||||||
__set_errno (const char *func, int ln, int val)
|
__set_errno (const char *func, int ln, int val)
|
||||||
{
|
{
|
||||||
debug_printf ("%s:%d val %d", func, ln, val);
|
debug_printf ("%s:%d val %d", func, ln, val);
|
||||||
_impure_ptr->_errno = val;
|
return _impure_ptr->_errno = val;
|
||||||
}
|
}
|
||||||
#endif /*DEBUGGING*/
|
#endif /*DEBUGGING*/
|
||||||
|
@ -43,7 +43,7 @@ int __stdcall iscygthread ();
|
|||||||
# define ProtectHandle1(h,n) do {} while (0)
|
# define ProtectHandle1(h,n) do {} while (0)
|
||||||
# define ProtectHandle2(h,n) do {} while (0)
|
# define ProtectHandle2(h,n) do {} while (0)
|
||||||
# define debug_init() 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)
|
# define debug_fixup_after_fork() do {} while (0)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -72,7 +72,7 @@ BOOL __stdcall close_handle (const char *, int, HANDLE, const char *, BOOL)
|
|||||||
__attribute__ ((regparm (3)));
|
__attribute__ ((regparm (3)));
|
||||||
void __stdcall cygbench (const char *s) __attribute__ ((regparm (1)));
|
void __stdcall cygbench (const char *s) __attribute__ ((regparm (1)));
|
||||||
extern "C" void console_printf (const char *fmt,...);
|
extern "C" void console_printf (const char *fmt,...);
|
||||||
void setclexec_pid (HANDLE, bool);
|
void setclexec_pid (HANDLE, HANDLE, bool);
|
||||||
void debug_fixup_after_fork ();
|
void debug_fixup_after_fork ();
|
||||||
extern int pinger;
|
extern int pinger;
|
||||||
|
|
||||||
|
@ -1611,6 +1611,7 @@ fhandler_dev_null::dump (void)
|
|||||||
void
|
void
|
||||||
fhandler_base::set_inheritance (HANDLE &h, int not_inheriting)
|
fhandler_base::set_inheritance (HANDLE &h, int not_inheriting)
|
||||||
{
|
{
|
||||||
|
HANDLE oh = h;
|
||||||
/* Note that we could use SetHandleInformation here but it is not available
|
/* Note that we could use SetHandleInformation here but it is not available
|
||||||
on all platforms. Test cases seem to indicate that using DuplicateHandle
|
on all platforms. Test cases seem to indicate that using DuplicateHandle
|
||||||
in this fashion does not actually close the original handle, which is
|
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))
|
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
|
||||||
debug_printf ("DuplicateHandle failed, %E");
|
debug_printf ("DuplicateHandle failed, %E");
|
||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
setclexec_pid (h, not_inheriting);
|
setclexec_pid (oh, h, not_inheriting);
|
||||||
#endif
|
#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);
|
debug_printf ("%s success - oldh %p, h %p", get_name (), oh, h);
|
||||||
// someday, maybe ProtectHandle2 (h, name);
|
// someday, maybe ProtectHandle2 (h, name);
|
||||||
setclexec_pid (h, !get_close_on_exec ());
|
setclexec_pid (h, h, !get_close_on_exec ());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user