* exceptions.cc (set_signal_mask): Redefine to not pass by address. Report
calculated mask in debugging output. * sigproc.h (set_signal_mask): Reflect above change in declaration. * path.cc (mount_item::build_win32): Take path apart before feeding it to fnmunge. Throughout, change use of _reent_winsup()-> to _my_tls.locals. instead. Throughout, remove obsolete MT_SAFE/_CYG_THREAD_FAILSAFE considerations. Througout, add cygtls.h include. * Makefile.in (DLL_OFILES): Add cygtls.o. Add some more objects to the -fomit-frame-pointer list. * acconfig.h: Remove obsolete settings. * config.h.in: Ditto. * bsdlib.cc: Add cygtls.h include. * configure.in: Remove --enable-extra-threadsafe-checking. * configure: Regenerate. * cygtls.h (_local_storage): New struct renamed from _winsup_t (sic). (_threadinfo:local_clib): Add new field. (_threadinfo::locals): Ditto. (_threadinfo::init_thread): Accept second _reent * argument. (_threadinfo::call): Define as regparm. (CYGTLS_PADSIZE): Remove unnecessary slop. (_getreent): Define as a macro. * thread.h: Remove _CYG_THREAD_FAILSAFE and MT_SAFE stuff. (_winsup_t): Move to cygtls.h. (ResourceLocks::ResourceLocks): Eliminate empty constructor. (MTinterface::reents): Eliminate. (MTinterface::thread_self_key): Eliminate. (MTinterface::MTinterface): Eliminate. * dcrt0.cc: Include stdio.h for _impure_ptr initialization. (do_global_ctors): Remove run_ctors_p (sic) considerations. Don't call atexit here. (__main): Initialize destructors for user here. (dll_crt0_1): Accept a dummy argument. Don't call init_thread here. Don't set _impure_ptr here. Call do_global_ctors after more things have been initialized. (_dll_crt0): Define zeros buffer as max of needed size of CYGTLS_PADSIZE so that it can be used for two purposes while minimizing stack usage. Initialize _impure_ptr specifically, for speed. Call dll_crt0_1 with buffer argument. (cygwin_dll_init): Call dll_crt0_1 with dummy argument. * dtable.cc (dtable::find_unused_handle): Remove call to AssertResourceOwner. * exceptions.cc: Move _threadinfo stuff to new file. * cygtls.cc: New file. * gentls_offsets: Accommodate increasing complexity of cygtls.h. * hires.h (hires_base::~hires_base): Remove. * init.cc (dll_entry): Remove setting of reents. * thread.cc: Remove syslog.h include. (__getreent): Simplify to use _my_tls. (_reent_winsup): Delete. (AssertResourceOwner): Delete. (MTinterface::Init): Remove setting of _clib and _winsup, with all that entails. (MTinterface::fixup_after_fork): Ditto. (pthread::thread_init_wrapper): Ditto. Also remove call to set_tls_self_pointer. (pthread::set_tls_self_pointer): Eliminate. (pthread::get_tls_self_pointer): Just return _my_tls.tid; (__reent_t::init_clib): Eliminate. * tlsoffsets.h: Regenerate.
This commit is contained in:
@ -72,16 +72,9 @@ details. */
|
||||
#include "cygheap.h"
|
||||
#include "shared_info.h"
|
||||
#include "registry.h"
|
||||
#include "cygtls.h"
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef _MT_SAFE
|
||||
#define iteration _reent_winsup ()->_iteration
|
||||
#define available_drives _reent_winsup ()->available_drives
|
||||
#else
|
||||
static int iteration;
|
||||
static DWORD available_drives;
|
||||
#endif
|
||||
|
||||
static int normalize_win32_path (const char *src, char *dst);
|
||||
static void slashify (const char *src, char *dst, int trailing_slash_p);
|
||||
static void backslashify (const char *src, char *dst, int trailing_slash_p);
|
||||
@ -1235,7 +1228,7 @@ void
|
||||
mount_item::fnmunge (char *dst, const char *src)
|
||||
{
|
||||
int name_type;
|
||||
if (!(flags & MOUNT_ENC) || !(name_type = special_name (src)))
|
||||
if (!(name_type = special_name (src)))
|
||||
strcpy (dst, src);
|
||||
else
|
||||
{
|
||||
@ -1286,7 +1279,25 @@ mount_item::build_win32 (char *dst, const char *src, unsigned *outflags, unsigne
|
||||
/* nothing */;
|
||||
else if ((!(flags & MOUNT_ENC) && isdrive (dst) && !dst[2]) || *p)
|
||||
dst[n++] = '\\';
|
||||
fnmunge (dst + n, p);
|
||||
if (!*p || !(flags & MOUNT_ENC))
|
||||
strcpy (dst + n, p);
|
||||
else
|
||||
while (*p)
|
||||
{
|
||||
char slash = 0;
|
||||
char *s = strchr (p + 1, '/');
|
||||
if (s)
|
||||
{
|
||||
slash = *s;
|
||||
*s = '\0';
|
||||
}
|
||||
fnmunge (dst += n, p);
|
||||
if (!s)
|
||||
break;
|
||||
n = strlen (dst);
|
||||
*s = slash;
|
||||
p = s;
|
||||
}
|
||||
}
|
||||
|
||||
/* conv_to_win32_path: Ensure src_path is a pure Win32 path and store
|
||||
@ -2234,18 +2245,14 @@ mount_info::del_item (const char *path, unsigned flags, int reg_p)
|
||||
static mntent *
|
||||
fillout_mntent (const char *native_path, const char *posix_path, unsigned flags)
|
||||
{
|
||||
#ifdef _MT_SAFE
|
||||
struct mntent &ret=_reent_winsup ()->mntbuf;
|
||||
#else
|
||||
static NO_COPY struct mntent ret;
|
||||
#endif
|
||||
struct mntent& ret=_my_tls.locals.mntbuf;
|
||||
|
||||
/* Remove drivenum from list if we see a x: style path */
|
||||
if (strlen (native_path) == 2 && native_path[1] == ':')
|
||||
{
|
||||
int drivenum = cyg_tolower (native_path[0]) - 'a';
|
||||
if (drivenum >= 0 && drivenum <= 31)
|
||||
available_drives &= ~(1 << drivenum);
|
||||
_my_tls.locals.available_drives &= ~(1 << drivenum);
|
||||
}
|
||||
|
||||
/* Pass back pointers to mount_table strings reserved for use by
|
||||
@ -2253,40 +2260,39 @@ fillout_mntent (const char *native_path, const char *posix_path, unsigned flags)
|
||||
table because the mount table might change, causing weird effects
|
||||
from the getmntent user's point of view. */
|
||||
|
||||
strcpy (_reent_winsup ()->mnt_fsname, native_path);
|
||||
ret.mnt_fsname = _reent_winsup ()->mnt_fsname;
|
||||
strcpy (_reent_winsup ()->mnt_dir, posix_path);
|
||||
ret.mnt_dir = _reent_winsup ()->mnt_dir;
|
||||
strcpy (_my_tls.locals.mnt_fsname, native_path);
|
||||
ret.mnt_fsname = _my_tls.locals.mnt_fsname;
|
||||
strcpy (_my_tls.locals.mnt_dir, posix_path);
|
||||
ret.mnt_dir = _my_tls.locals.mnt_dir;
|
||||
|
||||
if (!(flags & MOUNT_SYSTEM)) /* user mount */
|
||||
strcpy (_reent_winsup ()->mnt_type, (char *) "user");
|
||||
strcpy (_my_tls.locals.mnt_type, (char *) "user");
|
||||
else /* system mount */
|
||||
strcpy (_reent_winsup ()->mnt_type, (char *) "system");
|
||||
strcpy (_my_tls.locals.mnt_type, (char *) "system");
|
||||
|
||||
ret.mnt_type = _reent_winsup ()->mnt_type;
|
||||
ret.mnt_type = _my_tls.locals.mnt_type;
|
||||
|
||||
/* mnt_opts is a string that details mount params such as
|
||||
binary or textmode, or exec. We don't print
|
||||
`silent' here; it's a magic internal thing. */
|
||||
|
||||
if (!(flags & MOUNT_BINARY))
|
||||
strcpy (_reent_winsup ()->mnt_opts, (char *) "textmode");
|
||||
strcpy (_my_tls.locals.mnt_opts, (char *) "textmode");
|
||||
else
|
||||
strcpy (_reent_winsup ()->mnt_opts, (char *) "binmode");
|
||||
strcpy (_my_tls.locals.mnt_opts, (char *) "binmode");
|
||||
|
||||
if (flags & MOUNT_CYGWIN_EXEC)
|
||||
strcat (_reent_winsup ()->mnt_opts, (char *) ",cygexec");
|
||||
strcat (_my_tls.locals.mnt_opts, (char *) ",cygexec");
|
||||
else if (flags & MOUNT_EXEC)
|
||||
strcat (_reent_winsup ()->mnt_opts, (char *) ",exec");
|
||||
strcat (_my_tls.locals.mnt_opts, (char *) ",exec");
|
||||
else if (flags & MOUNT_NOTEXEC)
|
||||
strcat (_reent_winsup ()->mnt_opts, (char *) ",noexec");
|
||||
strcat (_my_tls.locals.mnt_opts, (char *) ",noexec");
|
||||
if (flags & MOUNT_ENC)
|
||||
strcat (_reent_winsup ()->mnt_opts, ",managed");
|
||||
strcat (_my_tls.locals.mnt_opts, ",managed");
|
||||
|
||||
if ((flags & MOUNT_CYGDRIVE)) /* cygdrive */
|
||||
strcat (_reent_winsup ()->mnt_opts, (char *) ",noumount");
|
||||
|
||||
ret.mnt_opts = _reent_winsup ()->mnt_opts;
|
||||
strcat (_my_tls.locals.mnt_opts, (char *) ",noumount");
|
||||
ret.mnt_opts = _my_tls.locals.mnt_opts;
|
||||
|
||||
ret.mnt_freq = 1;
|
||||
ret.mnt_passno = 1;
|
||||
@ -2307,16 +2313,16 @@ cygdrive_getmntent ()
|
||||
DWORD mask = 1, drive = 'a';
|
||||
struct mntent *ret = NULL;
|
||||
|
||||
while (available_drives)
|
||||
while (_my_tls.locals.available_drives)
|
||||
{
|
||||
for (/* nothing */; drive <= 'z'; mask <<= 1, drive++)
|
||||
if (available_drives & mask)
|
||||
if (_my_tls.locals.available_drives & mask)
|
||||
break;
|
||||
|
||||
__small_sprintf (native_path, "%c:\\", drive);
|
||||
if (GetFileAttributes (native_path) == INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
available_drives &= ~mask;
|
||||
_my_tls.locals.available_drives &= ~mask;
|
||||
continue;
|
||||
}
|
||||
native_path[2] = '\0';
|
||||
@ -2425,15 +2431,15 @@ cygwin_umount (const char *path, unsigned flags)
|
||||
extern "C" FILE *
|
||||
setmntent (const char *filep, const char *)
|
||||
{
|
||||
iteration = 0;
|
||||
available_drives = GetLogicalDrives ();
|
||||
_my_tls.locals.iteration = 0;
|
||||
_my_tls.locals.available_drives = GetLogicalDrives ();
|
||||
return (FILE *) filep;
|
||||
}
|
||||
|
||||
extern "C" struct mntent *
|
||||
getmntent (FILE *)
|
||||
{
|
||||
return mount_table->getmntent (iteration++);
|
||||
return mount_table->getmntent (_my_tls.locals.iteration++);
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
|
Reference in New Issue
Block a user