From a9f20457f32877bf13e7a52366aa0996f9d8b2a9 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 24 Oct 2001 21:56:54 +0000 Subject: [PATCH] * Makefile.in: Only build testsuite directory on first 'make check'. * configure.in: Remove testsuite from SUBDIRS. * configure: Regenerate. --- winsup/ChangeLog | 6 ++++++ winsup/Makefile.in | 28 ++++++++++++++++++++++------ winsup/configure | 4 ++-- winsup/configure.in | 2 +- winsup/cygwin/cygheap.h | 1 + winsup/cygwin/external.cc | 19 +++++++++++++++++++ winsup/cygwin/fhandler_console.cc | 2 +- winsup/cygwin/include/sys/cygwin.h | 4 +++- winsup/cygwin/path.cc | 23 +++++++++-------------- winsup/cygwin/shared.cc | 11 ++++++++--- winsup/cygwin/shared_info.h | 4 ++-- winsup/utils/Makefile.in | 7 +++---- winsup/utils/mount.cc | 2 +- 13 files changed, 78 insertions(+), 35 deletions(-) diff --git a/winsup/ChangeLog b/winsup/ChangeLog index b80d14952..da56fc4dd 100644 --- a/winsup/ChangeLog +++ b/winsup/ChangeLog @@ -1,3 +1,9 @@ +2001-10-24 Christopher Faylor + + * Makefile.in: Only build testsuite directory on first 'make check'. + * configure.in: Remove testsuite from SUBDIRS. + * configure: Regenerate. + 2001-10-12 Christopher Faylor * Makefile.in: Add -nostdinc to CXXFLAGS. diff --git a/winsup/Makefile.in b/winsup/Makefile.in index 2bc1c419c..c1e686fd3 100644 --- a/winsup/Makefile.in +++ b/winsup/Makefile.in @@ -36,7 +36,7 @@ datadir:=@datadir@ infodir:=@infodir@ includedir:=@includedir@ -SUBDIRS=@SUBDIRS@ +SUBDIRS=@SUBDIRS@ testsuite INSTALL_SUBDIRS=${patsubst %,install_%,$(SUBDIRS)} CLEAN_SUBDIRS=${patsubst %,clean_%,$(SUBDIRS)} @@ -66,13 +66,19 @@ install-info: info: $(SUBDIRS): - @$(MAKE) -C $@ all + @if cd $@ 2>/dev/null; then \ + $(MAKE) all; \ + fi || exit 0 $(INSTALL_SUBDIRS): - @$(MAKE) -C ${patsubst install_%,%,$@} install + @if cd ${patsubst install_%,%,$@} 2>/dev/null; then \ + make install; \ + fi || exit 0 $(CLEAN_SUBDIRS): - @$(MAKE) -C ${patsubst clean_%,%,$@} clean + @if cd ${patsubst clean_%,%,$@} 2>/dev/null; then \ + make install; \ + fi || exit 0 .PRECIOUS: Makefile @@ -82,5 +88,15 @@ Makefile: Makefile.in $(srcdir)/configure.in config.status config.status: configure $(SHELL) config.status --recheck -check: - @$(MAKE) -C testsuite check +check: cygwin + @if [ -d testsuite ]; then \ + cd testsuite; \ + else \ + mkdir testsuite; \ + cd testsuite; \ + sed -n -e '1,/^done/{' -e 's%/cygwin%/testsuite%g; ' -e 'p; }' ../cygwin/config.status > config.status; \ + chmod a+x config.status; \ + sh ./config.status --recheck; \ + sh ./config.status; \ + fi; \ + $(MAKE) check diff --git a/winsup/configure b/winsup/configure index 2aac72dfe..f7bd35077 100755 --- a/winsup/configure +++ b/winsup/configure @@ -922,7 +922,7 @@ case "$with_cross_host" in test -d $srcdir/bz2lib && SUBDIRS="$SUBDIRS bz2lib" test -d $srcdir/cinstall && SUBDIRS="$SUBDIRS cinstall" test -d $srcdir/subauth && SUBDIRS="$SUBDIRS subauth" - SUBDIRS="$SUBDIRS utils doc testsuite" + SUBDIRS="$SUBDIRS utils doc" ;; esac @@ -1121,7 +1121,7 @@ s%@CC@%$CC%g s%@CXX@%$CXX%g s%@subdirs@%$subdirs%g s%@SET_MAKE@%$SET_MAKE%g -s%@SUBDIRS@%$SUBDIRS%g +s%@SUBDIRS testsuite@%$SUBDIRS testsuite%g CEOF EOF diff --git a/winsup/configure.in b/winsup/configure.in index eb1d33bac..71d2c34e6 100755 --- a/winsup/configure.in +++ b/winsup/configure.in @@ -72,7 +72,7 @@ case "$with_cross_host" in test -d $srcdir/bz2lib && SUBDIRS="$SUBDIRS bz2lib" test -d $srcdir/cinstall && SUBDIRS="$SUBDIRS cinstall" test -d $srcdir/subauth && SUBDIRS="$SUBDIRS subauth" - SUBDIRS="$SUBDIRS utils doc testsuite" + SUBDIRS="$SUBDIRS utils doc" ;; esac diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h index 7f0f04f11..16f22c52d 100644 --- a/winsup/cygwin/cygheap.h +++ b/winsup/cygwin/cygheap.h @@ -165,6 +165,7 @@ struct init_cygheap HANDLE shared_h; HANDLE console_h; HANDLE etc_changed_h; + char *cygwin_regname; cwdstuff cwd; dtable fdtab; diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc index a4b81be92..5780647a2 100644 --- a/winsup/cygwin/external.cc +++ b/winsup/cygwin/external.cc @@ -11,6 +11,7 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ #include "winsup.h" +#include #include "security.h" #include "fhandler.h" #include "sync.h" @@ -20,6 +21,11 @@ details. */ #include "shared_info.h" #include "cygwin_version.h" #include "perprocess.h" +#include "cygerrno.h" +#include "fhandler.h" +#include "path.h" +#include "dtable.h" +#include "cygheap.h" static external_pinfo * fillout_pinfo (pid_t pid, int winpid) @@ -175,6 +181,19 @@ cygwin_internal (cygwin_getinfo_types t, ...) return get_cygdrive_info (user, system, user_flags, system_flags); } + case CW_SET_CYGWIN_REGISTRY_NAME: + { +# define cr ((char *) arg) + if (check_null_empty_str_errno (cr)) + return (DWORD) NULL; + cygheap->cygwin_regname = (char *) crealloc (cygheap->cygwin_regname, + strlen (cr) + 1); + strcpy (cygheap->cygwin_regname, cr); + case CW_GET_CYGWIN_REGISTRY_NAME: + return (DWORD) cygheap->cygwin_regname; +# undef cr + } + default: return (DWORD) -1; } diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index a9b7bffe8..504d2457c 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -104,7 +104,7 @@ get_tty_stuff (int flags = 0) if (shared_console_info) return shared_console_info; - shared_console_info = (tty_min *) open_shared (NULL, cygheap->console_h, + shared_console_info = (tty_min *) open_shared (NULL, 0, cygheap->console_h, sizeof (*shared_console_info), NULL); ProtectHandle (cygheap->console_h); diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h index 1d53f636b..a4a8cf699 100644 --- a/winsup/cygwin/include/sys/cygwin.h +++ b/winsup/cygwin/include/sys/cygwin.h @@ -64,7 +64,9 @@ typedef enum CW_GET_CYGDRIVE_PREFIXES, CW_GETPINFO_FULL, CW_INIT_EXCEPTIONS, - CW_GET_CYGDRIVE_INFO + CW_GET_CYGDRIVE_INFO, + CW_SET_CYGWIN_REGISTRY_NAME, + CW_GET_CYGWIN_REGISTRY_NAME } cygwin_getinfo_types; #define CW_NEXTPID 0x80000000 // or with pid to get next one diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 066ef2e30..ad3008c08 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -107,6 +107,8 @@ struct symlink_info int pcheck_case = PCHECK_RELAXED; /* Determines the case check behaviour. */ +#define CYGWIN_REGNAME (cygheap->cygwin_regname ?: CYGWIN_INFO_CYGWIN_REGISTRY_NAME) + /* Determine if path prefix matches current cygdrive */ #define iscygdrive(path) \ (path_prefix_p (mount_table->cygdrive, (path), mount_table->cygdrive_len)) @@ -1711,8 +1713,7 @@ mount_info::from_registry () /* Then read mounts from system-wide mount table. */ reg_key r1 (HKEY_LOCAL_MACHINE, KEY_READ, "SOFTWARE", - CYGWIN_INFO_CYGNUS_REGISTRY_NAME, - CYGWIN_INFO_CYGWIN_REGISTRY_NAME, + CYGWIN_INFO_CYGNUS_REGISTRY_NAME, CYGWIN_REGNAME, CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, NULL); read_mounts (r1); @@ -1757,8 +1758,7 @@ mount_info::add_reg_mount (const char * native_path, const char * posix_path, un { /* reg_key for system mounts in HKEY_LOCAL_MACHINE. */ reg_key reg_sys (HKEY_LOCAL_MACHINE, KEY_ALL_ACCESS, "SOFTWARE", - CYGWIN_INFO_CYGNUS_REGISTRY_NAME, - CYGWIN_INFO_CYGWIN_REGISTRY_NAME, + CYGWIN_INFO_CYGNUS_REGISTRY_NAME, CYGWIN_REGNAME, CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, NULL); @@ -1806,8 +1806,7 @@ mount_info::del_reg_mount (const char * posix_path, unsigned flags) sys_mount_table_counter++; cygwin_shared->sys_mount_table_counter++; reg_key reg_sys (HKEY_LOCAL_MACHINE, KEY_ALL_ACCESS, "SOFTWARE", - CYGWIN_INFO_CYGNUS_REGISTRY_NAME, - CYGWIN_INFO_CYGWIN_REGISTRY_NAME, + CYGWIN_INFO_CYGNUS_REGISTRY_NAME, CYGWIN_REGNAME, CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, NULL); res = reg_sys.kill (posix_path); @@ -1839,8 +1838,7 @@ mount_info::read_cygdrive_info_from_registry () /* reg_key for system path prefix in HKEY_LOCAL_MACHINE. */ reg_key r2 (HKEY_LOCAL_MACHINE, KEY_READ, "SOFTWARE", - CYGWIN_INFO_CYGNUS_REGISTRY_NAME, - CYGWIN_INFO_CYGWIN_REGISTRY_NAME, + CYGWIN_INFO_CYGNUS_REGISTRY_NAME, CYGWIN_REGNAME, CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, NULL); @@ -1890,8 +1888,7 @@ mount_info::write_cygdrive_info_to_registry (const char *cygdrive_prefix, unsign /* reg_key for user path prefix in HKEY_CURRENT_USER or system path prefix in HKEY_LOCAL_MACHINE. */ reg_key r (top, KEY_ALL_ACCESS, "SOFTWARE", - CYGWIN_INFO_CYGNUS_REGISTRY_NAME, - CYGWIN_INFO_CYGWIN_REGISTRY_NAME, + CYGWIN_INFO_CYGNUS_REGISTRY_NAME, CYGWIN_REGNAME, CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, NULL); @@ -1947,8 +1944,7 @@ mount_info::remove_cygdrive_info_from_registry (const char *cygdrive_prefix, uns /* reg_key for user path prefix in HKEY_CURRENT_USER or system path prefix in HKEY_LOCAL_MACHINE. */ reg_key r (top, KEY_ALL_ACCESS, "SOFTWARE", - CYGWIN_INFO_CYGNUS_REGISTRY_NAME, - CYGWIN_INFO_CYGWIN_REGISTRY_NAME, + CYGWIN_INFO_CYGNUS_REGISTRY_NAME, CYGWIN_REGNAME, CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, NULL); @@ -1980,8 +1976,7 @@ mount_info::get_cygdrive_info (char *user, char *system, char* user_flags, /* Get the system path prefix from HKEY_LOCAL_MACHINE. */ reg_key r2 (HKEY_LOCAL_MACHINE, KEY_READ, "SOFTWARE", - CYGWIN_INFO_CYGNUS_REGISTRY_NAME, - CYGWIN_INFO_CYGWIN_REGISTRY_NAME, + CYGWIN_INFO_CYGNUS_REGISTRY_NAME, CYGWIN_REGNAME, CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, NULL); int res2 = r2.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, system, MAX_PATH, ""); diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index 7e155ebeb..01584873e 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -55,7 +55,7 @@ shared_name (const char *str, int num) } void * __stdcall -open_shared (const char *name, HANDLE &shared_h, DWORD size, void *addr) +open_shared (const char *name, int n, HANDLE &shared_h, DWORD size, void *addr) { void *shared; @@ -66,7 +66,7 @@ open_shared (const char *name, HANDLE &shared_h, DWORD size, void *addr) mapname = NULL; else { - mapname = shared_name (name, 0); + mapname = shared_name (name, n); shared_h = OpenFileMappingA (FILE_MAP_READ | FILE_MAP_WRITE, TRUE, mapname); } @@ -127,6 +127,7 @@ memory_init () /* Initialize general shared memory */ HANDLE shared_h = cygheap ? cygheap->shared_h : NULL; cygwin_shared = (shared_info *) open_shared ("shared", + CYGWIN_VERSION_SHARED_DATA, shared_h, sizeof (*cygwin_shared), cygwin_shared_address); @@ -151,7 +152,8 @@ memory_init () ProtectHandle (cygheap->shared_h); heap_init (); - mount_table = (mount_info *) open_shared (user_name, cygwin_mount_h, + mount_table = (mount_info *) open_shared (user_name, MOUNT_VERSION, + cygwin_mount_h, sizeof (mount_info), 0); debug_printf ("opening mount table for '%s' at %p", cygheap->user.name (), mount_table_address); @@ -165,6 +167,9 @@ memory_init () debug_printf ("initializing mount table"); mount_table->init (); /* Initialize the mount table. */ } + else if (mount_table->version != MOUNT_VERSION) + multiple_cygwin_die (); + } void __stdcall diff --git a/winsup/cygwin/shared_info.h b/winsup/cygwin/shared_info.h index 088b3f908..46b53c8b3 100644 --- a/winsup/cygwin/shared_info.h +++ b/winsup/cygwin/shared_info.h @@ -40,7 +40,7 @@ class mount_item scheme should be satisfactory for a long while yet. */ #define MAX_MOUNTS 30 -#define MOUNT_VERSION 0x01010103 +#define MOUNT_VERSION 27 // increment when mount table changes class reg_key; class mount_info @@ -158,4 +158,4 @@ void __stdcall shared_terminate (void); #define cygheap_address shared_align_past ((mount_info *) shared_align_past (cygwin_shared)) char *__stdcall shared_name (const char *, int); -void *__stdcall open_shared (const char *name, HANDLE &shared_h, DWORD size, void *addr); +void *__stdcall open_shared (const char *name, int n, HANDLE &shared_h, DWORD size, void *addr); diff --git a/winsup/utils/Makefile.in b/winsup/utils/Makefile.in index baf642a4d..be7a1cf31 100644 --- a/winsup/utils/Makefile.in +++ b/winsup/utils/Makefile.in @@ -67,10 +67,9 @@ ALL_LDFLAGS:=-B$(newlib_build)/libc/ -B$(newlib_build)/libm/ -B$(w32api_lib)/ \ MINGW_LDFLAGS:=$(ALL_LDFLAGS) $(MINGW_LIB) DUMPER_LDFLAGS:=$(ALL_LDFLAGS) $(DUMPER_LIB) -PROGS:=mount$(EXEEXT) umount$(EXEEXT) ps$(EXEEXT) kill$(EXEEXT) \ - mkpasswd$(EXEEXT) mkgroup$(EXEEXT) cygpath$(EXEEXT) cygcheck$(EXEEXT) \ - passwd$(EXEEXT) getfacl$(EXEEXT) setfacl$(EXEEXT) strace$(EXEEXT) \ - regtool$(EXEEXT) ssp$(EXEEXT) +PROGS:= cygcheck.exe cygpath.exe cygme.exe getfacl.exe kill.exe mkgroup.exe \ + mkpasswd.exe mount.exe passwd.exe ps.exe regtool.exe setfacl.exe \ + ssp.exe strace.exe umount.exe CLEAN_PROGS:=$(PROGS) ifdef build_dumper diff --git a/winsup/utils/mount.cc b/winsup/utils/mount.cc index 31f4aed16..981c72945 100644 --- a/winsup/utils/mount.cc +++ b/winsup/utils/mount.cc @@ -1,6 +1,6 @@ /* mount.cc - Copyright 1996, 1997, 1998, 1999 Cygnus Solutions. + Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc. This file is part of Cygwin.