diff options
author | Christopher Faylor <me@cgf.cx> | 2001-04-17 03:52:08 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-04-17 03:52:08 +0000 |
commit | 431ba7dd33c6c29bca5b1172c43d522c1fa152cf (patch) | |
tree | 6c35ba68e0ddb119924f6d89549a14f22feed658 | |
parent | 7ade56ca6aed6c0a1a7227934ea31160958306a3 (diff) | |
download | newlib-431ba7dd33c6c29bca5b1172c43d522c1fa152cf.zip newlib-431ba7dd33c6c29bca5b1172c43d522c1fa152cf.tar.gz newlib-431ba7dd33c6c29bca5b1172c43d522c1fa152cf.tar.bz2 |
* 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.
-rw-r--r-- | winsup/cygwin/ChangeLog | 16 | ||||
-rw-r--r-- | winsup/cygwin/child_info.h | 7 | ||||
-rw-r--r-- | winsup/cygwin/cygheap.h | 19 | ||||
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 6 | ||||
-rw-r--r-- | winsup/cygwin/fhandler.h | 4 | ||||
-rw-r--r-- | winsup/cygwin/path.cc | 42 | ||||
-rw-r--r-- | winsup/cygwin/path.h | 21 | ||||
-rw-r--r-- | winsup/cygwin/spawn.cc | 3 |
8 files changed, 48 insertions, 70 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index ca3ad20..593e4d2 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -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> * mmap.cc: Move fh_paging_file from some functions to be diff --git a/winsup/cygwin/child_info.h b/winsup/cygwin/child_info.h index 8297576..5cef260 100644 --- a/winsup/cygwin/child_info.h +++ b/winsup/cygwin/child_info.h @@ -68,9 +68,6 @@ public: int envc; char **envp; HANDLE myself_pinfo; - char *cwd_posix; - char *cwd_win32; - DWORD cwd_hash; }; class child_info_spawn: public child_info @@ -88,10 +85,6 @@ public: { if (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) { for (char **e = moreinfo->envp; *e; e++) diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h index 07d85f5..b807612 100644 --- a/winsup/cygwin/cygheap.h +++ b/winsup/cygwin/cygheap.h @@ -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 { _cmalloc_entry *chain; @@ -105,6 +123,7 @@ struct init_cygheap mode_t umask; HANDLE shared_h; HANDLE console_h; + cwdstuff cwd; }; extern init_cygheap *cygheap; diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 4560088..ff75644 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -701,9 +701,6 @@ dll_crt0_1 () __argv = spawn_info->moreinfo->argv; envp = spawn_info->moreinfo->envp; 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, spawn_info->moreinfo->fds); signal_fixup_after_exec (child_proc_info->type == PROC_SPAWN); @@ -719,6 +716,7 @@ dll_crt0_1 () cygheap->user.set_sid (NULL); break; } + // fdtab.vfork_child_fixup (); } ProtectHandle (hMainProc); ProtectHandle (hMainThread); @@ -735,7 +733,7 @@ dll_crt0_1 () /* Initialize events. */ events_init (); - cygcwd.init (); + cygheap->cwd.init (); cygbench ("pre-forkee"); if (user_data->forkee) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index f99b093..fc54376 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -88,7 +88,6 @@ enum FH_PIPEW = 0x0000000a, /* write end of a pipe */ FH_SOCKET = 0x0000000b, /* is a socket */ FH_WINDOWS = 0x0000000c, /* is a window */ - FH_OSS_DSP = 0x0000000d, /* is the dsp audio device */ FH_SLOW = 0x00000010, /* "slow" device if below this */ /* Fast devices */ @@ -100,8 +99,9 @@ enum FH_RANDOM = 0x00000015, /* is a random device */ FH_MEM = 0x00000016, /* is a mem 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_BAD = 0xffffffff }; diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index b7a6705..02641f3 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -108,8 +108,6 @@ struct symlink_info 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. */ #define path_prefix_p(p1, p2, l1) \ @@ -697,7 +695,7 @@ normalize_posix_path (const char *src, char *dst) } if (!isslash (src[0])) { - if (!cygcwd.get (dst)) + if (!cygheap->cwd.get (dst)) return get_errno (); dst = strchr (dst, '\0'); if (*src == '.') @@ -830,7 +828,7 @@ normalize_win32_path (const char *src, char *dst) } else if (strchr (src, ':') == NULL && *src != '/') { - if (!cygcwd.get (dst, 0)) + if (!cygheap->cwd.get (dst, 0)) return get_errno (); if (beg_src_slash) { @@ -1225,7 +1223,7 @@ fillin: else if (isrelpath) { char cwd_win32[MAX_PATH]; - if (!cygcwd.get (cwd_win32, 0)) + if (!cygheap->cwd.get (cwd_win32, 0)) return get_errno (); unsigned cwdlen = strlen (cwd_win32); 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)) { - hash = cygcwd.get_hash (); + hash = cygheap->cwd.get_hash (); if (name[0] == '.' && name[1] == '\0') return hash; hash += hash_path_name (hash, "\\"); @@ -2889,7 +2887,7 @@ hashit: char * getcwd (char *buf, size_t ulen) { - return cygcwd.get (buf, 1, 1, ulen); + return cygheap->cwd.get (buf, 1, 1, ulen); } /* getwd: standards? */ @@ -2968,14 +2966,14 @@ chdir (const char *dir) __seterrno (); else if (!path.has_symlinks () && strpbrk (dir, ":\\") == NULL && pcheck_case == PCHECK_RELAXED) - cygcwd.set (path, dir); + cygheap->cwd.set (path, dir); 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 it was worth locking just for strace. */ - syscall_printf ("%d = chdir() cygcwd.posix '%s' native '%s'", res, - cygcwd.posix, native_dir); + syscall_printf ("%d = chdir() cygheap->cwd.posix '%s' native '%s'", res, + cygheap->cwd.posix, native_dir); MALLOC_CHECK; return res; } @@ -3268,15 +3266,6 @@ cwdstuff::init () 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 process tree. */ bool @@ -3389,16 +3378,3 @@ out: MALLOC_CHECK; 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 (); -} diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index 4f9df23..d7b5d74 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -160,26 +160,5 @@ has_exec_chars (const char *buf, int len) (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 pathnmatch (const char *path1, const char *path2, int len); diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 933d4d6..3fb5abe 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -529,9 +529,6 @@ spawn_guts (HANDLE hToken, const char * prog_arg, const char *const *argv, ciresrv.moreinfo->argc = newargv.argc; 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->envp = (char **) cmalloc (HEAP_1_ARGV, ciresrv.moreinfo->envc); ciresrv.hexec_proc = hexec_proc; |