* dcrt0.cc (dll_crt0_1): Move uinfo_init call to before sigproc_init to avoid a

race.
(noload): Add an extra argument for debugging.
* uinfo.cc (uinfo_init): Eliminate test for multiple calls.
(getlogin): Assume that uinfo_init has already been called.
This commit is contained in:
Christopher Faylor 2000-05-22 00:54:22 +00:00
parent c9ae5a27b3
commit 7054be8b55
3 changed files with 18 additions and 16 deletions

View File

@ -1,3 +1,11 @@
Sun May 21 20:51:44 2000 Christopher Faylor <cgf@cygnus.com>
* dcrt0.cc (dll_crt0_1): Move uinfo_init call to before sigproc_init to
avoid a race.
(noload): Add an extra argument for debugging.
* uinfo.cc (uinfo_init): Eliminate test for multiple calls.
(getlogin): Assume that uinfo_init has already been called.
Sat May 20 01:34:57 2000 Christopher Faylor <cgf@cygnus.com> Sat May 20 01:34:57 2000 Christopher Faylor <cgf@cygnus.com>
* exceptions.cc (interruptible): Add an argument to control whether * exceptions.cc (interruptible): Add an argument to control whether

View File

@ -721,6 +721,9 @@ dll_crt0_1 ()
/* Allocate dtable */ /* Allocate dtable */
dtable_init (); dtable_init ();
/* Initialize uid, gid. */
uinfo_init ();
/* Initialize signal/subprocess handling. */ /* Initialize signal/subprocess handling. */
sigproc_init (); sigproc_init ();
@ -730,11 +733,6 @@ dll_crt0_1 ()
/* Set up standard fds in file descriptor table. */ /* Set up standard fds in file descriptor table. */
hinfo_init (); hinfo_init ();
#if 0
/* Initialize uid, gid. */
uinfo_init ();
#endif
/* Scan the command line and build argv. Expand wildcards if not /* Scan the command line and build argv. Expand wildcards if not
called from another cygwin process. */ called from another cygwin process. */
build_argv (line, argv, argc, build_argv (line, argv, argc,
@ -758,14 +756,11 @@ dll_crt0_1 ()
set_errno (0); set_errno (0);
debug_printf ("user_data->main %p", user_data->main); debug_printf ("user_data->main %p", user_data->main);
/* Initialize uid, gid. */
uinfo_init ();
/* Flush signals and ensure that signal thread is up and running. Can't /* Flush signals and ensure that signal thread is up and running. Can't
do this for noncygwin case since the signal thread is blocked due to do this for noncygwin case since the signal thread is blocked due to
LoadLibrary serialization. */ LoadLibrary serialization. */
if (!dynamically_loaded) if (!dynamically_loaded)
sig_send (NULL, __SIGFLUSH); sig_send (NULL, __SIGFLUSH); /* also initializes uid, gid */
if (user_data->main && !dynamically_loaded) if (user_data->main && !dynamically_loaded)
exit (user_data->main (argc, argv, *user_data->envptr)); exit (user_data->main (argc, argv, *user_data->envptr));
@ -992,13 +987,14 @@ __api_fatal (const char *fmt, ...)
} }
extern "C" { extern "C" {
static void noload (char *s) __asm__ ("noload"); static void noload (HANDLE h, char *s) __asm__ ("noload");
static void __attribute__((unused)) static void __attribute__((unused))
noload (char *s) noload (HANDLE h, char *s)
{ {
api_fatal ("couldn't dynamically determine load address for '%s', %E", s); api_fatal ("couldn't dynamically determine load address for '%s' (handle %p), %E", s, h);
} }
/* FIXME: This is not thread-safe! */
__asm__ (" __asm__ ("
.globl cygwin_dll_func_load .globl cygwin_dll_func_load
cygwin_dll_func_load: cygwin_dll_func_load:
@ -1013,6 +1009,8 @@ cygwin_dll_func_load:
popl %eax # No. Get back popl %eax # No. Get back
addl $8,%eax # pointer to name addl $8,%eax # pointer to name
pushl %eax # and pushl %eax # and
movl -4(%eax),%eax # Address of Handle to DLL
pushl (%eax) # Handle to DLL
call noload # issue an error call noload # issue an error
gotit: gotit:
popl %ecx # Pointer to 'return address' popl %ecx # Pointer to 'return address'

View File

@ -109,9 +109,6 @@ uinfo_init ()
{ {
struct passwd *p; struct passwd *p;
if (myself->username[0])
return;
myself->psid = (PSID) myself->sidbuf; myself->psid = (PSID) myself->sidbuf;
if ((p = getpwnam (internal_getlogin (myself))) != NULL) if ((p = getpwnam (internal_getlogin (myself))) != NULL)
{ {
@ -140,7 +137,6 @@ getlogin (void)
static NO_COPY char this_username[MAX_USER_NAME]; static NO_COPY char this_username[MAX_USER_NAME];
#endif #endif
uinfo_init ();
return strcpy (this_username, myself->username); return strcpy (this_username, myself->username);
} }