mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-22 16:49:45 +08:00
* path.h (cwdstuff): Move class.
* cygheap.h (cwdstuff): To here. (init_cygheap): Add cwd field. * child_info.h (cygheap_exec_info): Eliminate cwd stuff. (child_info_spawn): Ditto. * dcrt0.cc (dll_crt0_1): Remove cygcwd.fixup_after_exec call. Convert cygcwd reference to cygheap->cwd. * path.cc: Ditto, throughout. (cwdstuff::copy): Eliminate. (cwdstuff::fixup_after_exec): Ditto. * spawn.cc (spawn_guts): Eliminate call to cygcwd.copy. * fhandler.h (FH_OSS_DSP): Move into "fast" device category.
This commit is contained in:
parent
7ade56ca6a
commit
431ba7dd33
@ -1,3 +1,19 @@
|
|||||||
|
Mon Apr 16 23:45:24 2001 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
|
* path.h (cwdstuff): Move class.
|
||||||
|
* cygheap.h (cwdstuff): To here.
|
||||||
|
(init_cygheap): Add cwd field.
|
||||||
|
* child_info.h (cygheap_exec_info): Eliminate cwd stuff.
|
||||||
|
(child_info_spawn): Ditto.
|
||||||
|
* dcrt0.cc (dll_crt0_1): Remove cygcwd.fixup_after_exec call. Convert
|
||||||
|
cygcwd reference to cygheap->cwd.
|
||||||
|
* path.cc: Ditto, throughout.
|
||||||
|
(cwdstuff::copy): Eliminate.
|
||||||
|
(cwdstuff::fixup_after_exec): Ditto.
|
||||||
|
* spawn.cc (spawn_guts): Eliminate call to cygcwd.copy.
|
||||||
|
|
||||||
|
* fhandler.h (FH_OSS_DSP): Move into "fast" device category.
|
||||||
|
|
||||||
Mon Apr 16 19:19:00 2001 Corinna Vinschen <corinna@vinschen.de>
|
Mon Apr 16 19:19:00 2001 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* mmap.cc: Move fh_paging_file from some functions to be
|
* mmap.cc: Move fh_paging_file from some functions to be
|
||||||
|
@ -68,9 +68,6 @@ public:
|
|||||||
int envc;
|
int envc;
|
||||||
char **envp;
|
char **envp;
|
||||||
HANDLE myself_pinfo;
|
HANDLE myself_pinfo;
|
||||||
char *cwd_posix;
|
|
||||||
char *cwd_win32;
|
|
||||||
DWORD cwd_hash;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class child_info_spawn: public child_info
|
class child_info_spawn: public child_info
|
||||||
@ -88,10 +85,6 @@ public:
|
|||||||
{
|
{
|
||||||
if (moreinfo->old_title)
|
if (moreinfo->old_title)
|
||||||
cfree (moreinfo->old_title);
|
cfree (moreinfo->old_title);
|
||||||
if (moreinfo->cwd_posix)
|
|
||||||
cfree (moreinfo->cwd_posix);
|
|
||||||
if (moreinfo->cwd_win32)
|
|
||||||
cfree (moreinfo->cwd_win32);
|
|
||||||
if (moreinfo->envp)
|
if (moreinfo->envp)
|
||||||
{
|
{
|
||||||
for (char **e = moreinfo->envp; *e; e++)
|
for (char **e = moreinfo->envp; *e; e++)
|
||||||
|
@ -97,6 +97,24 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* cwd cache stuff. */
|
||||||
|
|
||||||
|
class muto;
|
||||||
|
|
||||||
|
struct cwdstuff
|
||||||
|
{
|
||||||
|
char *posix;
|
||||||
|
char *win32;
|
||||||
|
DWORD hash;
|
||||||
|
muto *lock;
|
||||||
|
char *get (char *buf, int need_posix = 1, int with_chroot = 0, unsigned ulen = MAX_PATH);
|
||||||
|
DWORD get_hash ();
|
||||||
|
void init ();
|
||||||
|
void fixup_after_exec (char *win32, char *posix, DWORD hash);
|
||||||
|
bool get_initial ();
|
||||||
|
void set (const char *win32_cwd, const char *posix_cwd = NULL);
|
||||||
|
};
|
||||||
|
|
||||||
struct init_cygheap
|
struct init_cygheap
|
||||||
{
|
{
|
||||||
_cmalloc_entry *chain;
|
_cmalloc_entry *chain;
|
||||||
@ -105,6 +123,7 @@ struct init_cygheap
|
|||||||
mode_t umask;
|
mode_t umask;
|
||||||
HANDLE shared_h;
|
HANDLE shared_h;
|
||||||
HANDLE console_h;
|
HANDLE console_h;
|
||||||
|
cwdstuff cwd;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern init_cygheap *cygheap;
|
extern init_cygheap *cygheap;
|
||||||
|
@ -701,9 +701,6 @@ dll_crt0_1 ()
|
|||||||
__argv = spawn_info->moreinfo->argv;
|
__argv = spawn_info->moreinfo->argv;
|
||||||
envp = spawn_info->moreinfo->envp;
|
envp = spawn_info->moreinfo->envp;
|
||||||
envc = spawn_info->moreinfo->envc;
|
envc = spawn_info->moreinfo->envc;
|
||||||
cygcwd.fixup_after_exec (spawn_info->moreinfo->cwd_win32,
|
|
||||||
spawn_info->moreinfo->cwd_posix,
|
|
||||||
spawn_info->moreinfo->cwd_hash);
|
|
||||||
fdtab.fixup_after_exec (spawn_info->parent, spawn_info->moreinfo->nfds,
|
fdtab.fixup_after_exec (spawn_info->parent, spawn_info->moreinfo->nfds,
|
||||||
spawn_info->moreinfo->fds);
|
spawn_info->moreinfo->fds);
|
||||||
signal_fixup_after_exec (child_proc_info->type == PROC_SPAWN);
|
signal_fixup_after_exec (child_proc_info->type == PROC_SPAWN);
|
||||||
@ -719,6 +716,7 @@ dll_crt0_1 ()
|
|||||||
cygheap->user.set_sid (NULL);
|
cygheap->user.set_sid (NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// fdtab.vfork_child_fixup ();
|
||||||
}
|
}
|
||||||
ProtectHandle (hMainProc);
|
ProtectHandle (hMainProc);
|
||||||
ProtectHandle (hMainThread);
|
ProtectHandle (hMainThread);
|
||||||
@ -735,7 +733,7 @@ dll_crt0_1 ()
|
|||||||
/* Initialize events. */
|
/* Initialize events. */
|
||||||
events_init ();
|
events_init ();
|
||||||
|
|
||||||
cygcwd.init ();
|
cygheap->cwd.init ();
|
||||||
|
|
||||||
cygbench ("pre-forkee");
|
cygbench ("pre-forkee");
|
||||||
if (user_data->forkee)
|
if (user_data->forkee)
|
||||||
|
@ -88,7 +88,6 @@ enum
|
|||||||
FH_PIPEW = 0x0000000a, /* write end of a pipe */
|
FH_PIPEW = 0x0000000a, /* write end of a pipe */
|
||||||
FH_SOCKET = 0x0000000b, /* is a socket */
|
FH_SOCKET = 0x0000000b, /* is a socket */
|
||||||
FH_WINDOWS = 0x0000000c, /* is a window */
|
FH_WINDOWS = 0x0000000c, /* is a window */
|
||||||
FH_OSS_DSP = 0x0000000d, /* is the dsp audio device */
|
|
||||||
FH_SLOW = 0x00000010, /* "slow" device if below this */
|
FH_SLOW = 0x00000010, /* "slow" device if below this */
|
||||||
|
|
||||||
/* Fast devices */
|
/* Fast devices */
|
||||||
@ -100,8 +99,9 @@ enum
|
|||||||
FH_RANDOM = 0x00000015, /* is a random device */
|
FH_RANDOM = 0x00000015, /* is a random device */
|
||||||
FH_MEM = 0x00000016, /* is a mem device */
|
FH_MEM = 0x00000016, /* is a mem device */
|
||||||
FH_CLIPBOARD = 0x00000017, /* is a clipbaord device */
|
FH_CLIPBOARD = 0x00000017, /* is a clipbaord device */
|
||||||
|
FH_OSS_DSP = 0x00000018, /* is a dsp audio device */
|
||||||
|
|
||||||
FH_NDEV = 0x00000018, /* Maximum number of devices */
|
FH_NDEV = 0x00000019, /* Maximum number of devices */
|
||||||
FH_DEVMASK = 0x00000fff, /* devices live here */
|
FH_DEVMASK = 0x00000fff, /* devices live here */
|
||||||
FH_BAD = 0xffffffff
|
FH_BAD = 0xffffffff
|
||||||
};
|
};
|
||||||
|
@ -108,8 +108,6 @@ struct symlink_info
|
|||||||
BOOL case_check (const char *path, char *orig_path);
|
BOOL case_check (const char *path, char *orig_path);
|
||||||
};
|
};
|
||||||
|
|
||||||
cwdstuff cygcwd; /* The current working directory. */
|
|
||||||
|
|
||||||
int pcheck_case = PCHECK_RELAXED; /* Determines the case check behaviour. */
|
int pcheck_case = PCHECK_RELAXED; /* Determines the case check behaviour. */
|
||||||
|
|
||||||
#define path_prefix_p(p1, p2, l1) \
|
#define path_prefix_p(p1, p2, l1) \
|
||||||
@ -697,7 +695,7 @@ normalize_posix_path (const char *src, char *dst)
|
|||||||
}
|
}
|
||||||
if (!isslash (src[0]))
|
if (!isslash (src[0]))
|
||||||
{
|
{
|
||||||
if (!cygcwd.get (dst))
|
if (!cygheap->cwd.get (dst))
|
||||||
return get_errno ();
|
return get_errno ();
|
||||||
dst = strchr (dst, '\0');
|
dst = strchr (dst, '\0');
|
||||||
if (*src == '.')
|
if (*src == '.')
|
||||||
@ -830,7 +828,7 @@ normalize_win32_path (const char *src, char *dst)
|
|||||||
}
|
}
|
||||||
else if (strchr (src, ':') == NULL && *src != '/')
|
else if (strchr (src, ':') == NULL && *src != '/')
|
||||||
{
|
{
|
||||||
if (!cygcwd.get (dst, 0))
|
if (!cygheap->cwd.get (dst, 0))
|
||||||
return get_errno ();
|
return get_errno ();
|
||||||
if (beg_src_slash)
|
if (beg_src_slash)
|
||||||
{
|
{
|
||||||
@ -1225,7 +1223,7 @@ fillin:
|
|||||||
else if (isrelpath)
|
else if (isrelpath)
|
||||||
{
|
{
|
||||||
char cwd_win32[MAX_PATH];
|
char cwd_win32[MAX_PATH];
|
||||||
if (!cygcwd.get (cwd_win32, 0))
|
if (!cygheap->cwd.get (cwd_win32, 0))
|
||||||
return get_errno ();
|
return get_errno ();
|
||||||
unsigned cwdlen = strlen (cwd_win32);
|
unsigned cwdlen = strlen (cwd_win32);
|
||||||
if (!path_prefix_p (cwd_win32, dst, cwdlen))
|
if (!path_prefix_p (cwd_win32, dst, cwdlen))
|
||||||
@ -2865,7 +2863,7 @@ hash_path_name (unsigned long hash, const char *name)
|
|||||||
|
|
||||||
if (!hash && !isabspath (name))
|
if (!hash && !isabspath (name))
|
||||||
{
|
{
|
||||||
hash = cygcwd.get_hash ();
|
hash = cygheap->cwd.get_hash ();
|
||||||
if (name[0] == '.' && name[1] == '\0')
|
if (name[0] == '.' && name[1] == '\0')
|
||||||
return hash;
|
return hash;
|
||||||
hash += hash_path_name (hash, "\\");
|
hash += hash_path_name (hash, "\\");
|
||||||
@ -2889,7 +2887,7 @@ hashit:
|
|||||||
char *
|
char *
|
||||||
getcwd (char *buf, size_t ulen)
|
getcwd (char *buf, size_t ulen)
|
||||||
{
|
{
|
||||||
return cygcwd.get (buf, 1, 1, ulen);
|
return cygheap->cwd.get (buf, 1, 1, ulen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* getwd: standards? */
|
/* getwd: standards? */
|
||||||
@ -2968,14 +2966,14 @@ chdir (const char *dir)
|
|||||||
__seterrno ();
|
__seterrno ();
|
||||||
else if (!path.has_symlinks () && strpbrk (dir, ":\\") == NULL
|
else if (!path.has_symlinks () && strpbrk (dir, ":\\") == NULL
|
||||||
&& pcheck_case == PCHECK_RELAXED)
|
&& pcheck_case == PCHECK_RELAXED)
|
||||||
cygcwd.set (path, dir);
|
cygheap->cwd.set (path, dir);
|
||||||
else
|
else
|
||||||
cygcwd.set (path, NULL);
|
cygheap->cwd.set (path, NULL);
|
||||||
|
|
||||||
/* Note that we're accessing cwd.posix without a lock here. I didn't think
|
/* Note that we're accessing cwd.posix without a lock here. I didn't think
|
||||||
it was worth locking just for strace. */
|
it was worth locking just for strace. */
|
||||||
syscall_printf ("%d = chdir() cygcwd.posix '%s' native '%s'", res,
|
syscall_printf ("%d = chdir() cygheap->cwd.posix '%s' native '%s'", res,
|
||||||
cygcwd.posix, native_dir);
|
cygheap->cwd.posix, native_dir);
|
||||||
MALLOC_CHECK;
|
MALLOC_CHECK;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -3268,15 +3266,6 @@ cwdstuff::init ()
|
|||||||
lock = new_muto (FALSE, "cwd");
|
lock = new_muto (FALSE, "cwd");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called to fill in cwd values after an exec. */
|
|
||||||
void
|
|
||||||
cwdstuff::fixup_after_exec (char *win32_cwd, char *posix_cwd, DWORD hash_cwd)
|
|
||||||
{
|
|
||||||
win32 = win32_cwd;
|
|
||||||
posix = posix_cwd;
|
|
||||||
hash = hash_cwd;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get initial cwd. Should only be called once in a
|
/* Get initial cwd. Should only be called once in a
|
||||||
process tree. */
|
process tree. */
|
||||||
bool
|
bool
|
||||||
@ -3389,16 +3378,3 @@ out:
|
|||||||
MALLOC_CHECK;
|
MALLOC_CHECK;
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get copies of all cwdstuff elements. Used by spawn_guts. */
|
|
||||||
void
|
|
||||||
cwdstuff::copy (char * &posix_cwd, char * &win32_cwd, DWORD hash_cwd)
|
|
||||||
{
|
|
||||||
lock->acquire ();
|
|
||||||
get_initial (); /* FIXME: Check return someday */
|
|
||||||
posix_cwd = cstrdup (posix);
|
|
||||||
win32_cwd = cstrdup (win32);
|
|
||||||
hash_cwd = hash;
|
|
||||||
MALLOC_CHECK;
|
|
||||||
lock->release ();
|
|
||||||
}
|
|
||||||
|
@ -160,26 +160,5 @@ has_exec_chars (const char *buf, int len)
|
|||||||
(buf[0] == 'M' && buf[1] == 'Z'));
|
(buf[0] == 'M' && buf[1] == 'Z'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cwd cache stuff. */
|
|
||||||
|
|
||||||
class muto;
|
|
||||||
|
|
||||||
struct cwdstuff
|
|
||||||
{
|
|
||||||
char *posix;
|
|
||||||
char *win32;
|
|
||||||
DWORD hash;
|
|
||||||
muto *lock;
|
|
||||||
char *get (char *buf, int need_posix = 1, int with_chroot = 0, unsigned ulen = MAX_PATH);
|
|
||||||
DWORD get_hash ();
|
|
||||||
void init ();
|
|
||||||
void fixup_after_exec (char *win32, char *posix, DWORD hash);
|
|
||||||
bool get_initial ();
|
|
||||||
void copy (char * &posix_cwd, char * &win32_cwd, DWORD hash_cwd);
|
|
||||||
void set (const char *win32_cwd, const char *posix_cwd = NULL);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern cwdstuff cygcwd;
|
|
||||||
|
|
||||||
extern int pathmatch (const char *path1, const char *path2);
|
extern int pathmatch (const char *path1, const char *path2);
|
||||||
extern int pathnmatch (const char *path1, const char *path2, int len);
|
extern int pathnmatch (const char *path1, const char *path2, int len);
|
||||||
|
@ -529,9 +529,6 @@ spawn_guts (HANDLE hToken, const char * prog_arg, const char *const *argv,
|
|||||||
ciresrv.moreinfo->argc = newargv.argc;
|
ciresrv.moreinfo->argc = newargv.argc;
|
||||||
ciresrv.moreinfo->argv = newargv;
|
ciresrv.moreinfo->argv = newargv;
|
||||||
|
|
||||||
cygcwd.copy (ciresrv.moreinfo->cwd_posix, ciresrv.moreinfo->cwd_win32,
|
|
||||||
ciresrv.moreinfo->cwd_hash);
|
|
||||||
|
|
||||||
ciresrv.moreinfo->envc = envsize (envp, 1);
|
ciresrv.moreinfo->envc = envsize (envp, 1);
|
||||||
ciresrv.moreinfo->envp = (char **) cmalloc (HEAP_1_ARGV, ciresrv.moreinfo->envc);
|
ciresrv.moreinfo->envp = (char **) cmalloc (HEAP_1_ARGV, ciresrv.moreinfo->envc);
|
||||||
ciresrv.hexec_proc = hexec_proc;
|
ciresrv.hexec_proc = hexec_proc;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user