* 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 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
int envc;
char **envp;
HANDLE myself_pinfo;
- char *cwd_posix;
- char *cwd_win32;
- DWORD cwd_hash;
};
class child_info_spawn: public child_info
{
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++)
}
};
+/* 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;
mode_t umask;
HANDLE shared_h;
HANDLE console_h;
+ cwdstuff cwd;
};
extern init_cygheap *cygheap;
__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);
cygheap->user.set_sid (NULL);
break;
}
+ // fdtab.vfork_child_fixup ();
}
ProtectHandle (hMainProc);
ProtectHandle (hMainThread);
/* Initialize events. */
events_init ();
- cygcwd.init ();
+ cygheap->cwd.init ();
cygbench ("pre-forkee");
if (user_data->forkee)
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 */
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
};
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) \
}
if (!isslash (src[0]))
{
- if (!cygcwd.get (dst))
+ if (!cygheap->cwd.get (dst))
return get_errno ();
dst = strchr (dst, '\0');
if (*src == '.')
}
else if (strchr (src, ':') == NULL && *src != '/')
{
- if (!cygcwd.get (dst, 0))
+ if (!cygheap->cwd.get (dst, 0))
return get_errno ();
if (beg_src_slash)
{
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))
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, "\\");
char *
getcwd (char *buf, size_t ulen)
{
- return cygcwd.get (buf, 1, 1, ulen);
+ return cygheap->cwd.get (buf, 1, 1, ulen);
}
/* getwd: standards? */
__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;
}
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
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 ();
-}
(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);
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;