diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 82840899f..f69641db2 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,27 @@ +2003-07-01 Christopher Faylor + + * Makefile.in: Remove cygserver stuff. + * acconfig.h: Add USE_CYGSERVER define. + * config.h.in: Regenerate. + * configure.in: Add --enable-server setting. + * configure: Regenerate. + * fhandler_tty.cc (fhandler_tty_slave::open): Conditionalize + compilation of cygserver stuff. + * fork.cc (fork_child): Ditto. + * shm.cc: Ditto. + * tty.cc (tty::common_init): Ditto. + + * dcrt0.cc: Use bool rather than BOOL for CYGWIN environment variable + definitions. + * environ.cc: Ditto. + * ntea.cc: Ditto. + * security.cc: Ditto. + * security.h: Ditto. + * syscalls.cc (check_posix_perm): Remove externs that were already + declared in a header. + * winsup.h: Ditto. Declare _MT_SAFE here. Delete it someday since + cygwin should always be _MT_SAFE. + 2003-06-30 Pierre Humblet * cygheap.h (enum impersonation): New enum. diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index 75133af8a..156188fed 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -144,9 +144,7 @@ MALLOC_OFILES=@MALLOC_OFILES@ DLL_IMPORTS:=$(w32api_lib)/libkernel32.a # Please maintain this list in sorted order, with maximum files per 80 col line -DLL_OFILES:=assert.o autoload.o cxx.o cygheap.o cygserver_client.o \ - cygserver_transport.o cygserver_transport_pipes.o \ - cygserver_transport_sockets.o cygthread.o dcrt0.o debug.o \ +DLL_OFILES:=assert.o autoload.o cxx.o cygheap.o cygthread.o dcrt0.o debug.o \ delqueue.o dir.o dlfcn.o dll_init.o dtable.o environ.o errno.o \ exceptions.o exec.o external.o fcntl.o fhandler.o \ fhandler_clipboard.o fhandler_console.o fhandler_disk_file.o \ @@ -250,7 +248,7 @@ install_host=@install_host@ all: all_target $(all_host) -all_target: $(TARGET_LIBS) cygserver.exe +all_target: $(TARGET_LIBS) all_host: $(TEST_LIB_NAME) @@ -291,8 +289,7 @@ install-man: $(INSTALL_DATA) $$i $(tooldir)/man/man7/`basename $$i` ; \ done -install_target: cygserver.exe - $(INSTALL_PROGRAM) cygserver.exe $(bindir)/cygserver.exe +install_target: install_host: @@ -397,27 +394,6 @@ winver_stamp: mkvers.sh include/cygwin/version.h winver.rc $(DLL_OFILES) $(COMPILE_CXX) -o version.o version.cc && \ touch $@ -cygserver_transport_outside.o: cygserver_transport.cc - $(COMPILE_CXX) -D__OUTSIDE_CYGWIN__ -o $@ $< - -cygserver_transport_pipes_outside.o: cygserver_transport_pipes.cc - $(COMPILE_CXX) -D__OUTSIDE_CYGWIN__ -o $@ $< - -cygserver_transport_sockets_outside.o: cygserver_transport_sockets.cc - $(COMPILE_CXX) -D__OUTSIDE_CYGWIN__ -o $@ $< - -cygserver_client_outside.o: cygserver_client.cc - $(COMPILE_CXX) -D__OUTSIDE_CYGWIN__ -o $@ $< - -cygserver.exe: cygserver.o cygserver_shm.o cygserver_transport_outside.o cygserver_transport_pipes_outside.o cygserver_transport_sockets_outside.o cygserver_client_outside.o cygserver_process.o threaded_queue.o wincap.o version.o smallprint.o - $(CXX) -o $@ $^ -lstdc++ -#ifdef VERBOSE -# $(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,3,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS) -#else -# @echo $(CXX) -o $@ ${wordlist 1,3,$^} ${filter-out -B%, $(MINGW_CXXFLAGS) $(MINGW_LDFLAGS)};\ -# $(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,3,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS) -#endif - -lgcc: : diff --git a/winsup/cygwin/acconfig.h b/winsup/cygwin/acconfig.h index c187c0be3..79e2651d3 100644 --- a/winsup/cygwin/acconfig.h +++ b/winsup/cygwin/acconfig.h @@ -7,8 +7,14 @@ /* Define if GCC supports builtin memset. */ #undef HAVE_BUILTIN_MEMSET +/* Define if MALLOC_DEBUGGING support is requested. */ +#undef MALLOC_DEBUG + /* Define if building thread-safe Cygwin DLL. */ #undef _MT_SAFE /* Define if using new vfork functionality. */ #undef NEWVFORK + +/* Define if using cygserver */ +#undef USE_CYGSERVER diff --git a/winsup/cygwin/config.h.in b/winsup/cygwin/config.h.in index 8a961b33c..d4f6269e0 100644 --- a/winsup/cygwin/config.h.in +++ b/winsup/cygwin/config.h.in @@ -25,17 +25,17 @@ /* Define if DEBUGGING support is requested. */ #undef DEBUGGING -/* Define if MALLOC_DEBUGGING support is requested. */ -#undef MALLOC_DEBUG - /* Define if building "extra" thread-safe Cygwin DLL. */ #undef _CYG_THREAD_FAILSAFE /* Define if GCC supports builtin memset. */ #undef HAVE_BUILTIN_MEMSET -/* Define if building thread-safe Cygwin DLL. */ -#undef _MT_SAFE +/* Define if MALLOC_DEBUGGING support is requested. */ +#undef MALLOC_DEBUG /* Define if using new vfork functionality. */ #undef NEWVFORK + +/* Define if using cygserver */ +#undef USE_CYGSERVER diff --git a/winsup/cygwin/configure b/winsup/cygwin/configure index f5c8a7d4b..9848c905a 100755 --- a/winsup/cygwin/configure +++ b/winsup/cygwin/configure @@ -11,12 +11,12 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: -ac_help="$ac_help - --enable-threadsafe=[runtime] Build a cygwin DLL which is thread safe" ac_help="$ac_help --enable-extra-threadsafe-checking Build a cygwin DLL which is thread safe with extra consistency checking" ac_help="$ac_help --enable-debugging Build a cygwin DLL which has more consistency checking for debugging" +ac_help="$ac_help + --enable-server Build a cygwin DLL which can communicate with cygserver" ac_help="$ac_help --enable-malloc-debugging Build a cygwin DLL with heap sanity checking (this is very slow, use only if you have heap corruption problems)" ac_help="$ac_help @@ -1865,28 +1865,6 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross -mt_safe_val=1 -MT_SAFE=yes - -# Check whether --enable-threadsafe or --disable-threadsafe was given. -if test "${enable_threadsafe+set}" = set; then - enableval="$enable_threadsafe" - case "${enableval}" in -yes) - ;; -runtime) - mt_safe_val=2 - MT_SAFE=yes - ;; -no) - mt_safe_val=0 - MT_SAFE=no - ;; -esac - -fi - - # Check whether --enable-extra-threadsafe-checking or --disable-extra-threadsafe-checking was given. if test "${enable_extra_threadsafe_checking+set}" = set; then enableval="$enable_extra_threadsafe_checking" @@ -1906,15 +1884,6 @@ esac fi -if test "$MT_SAFE" = "yes"; then - cat >> confdefs.h <> confdefs.h <<\EOF +#define USE_CYGSERVE 1 +EOF + ;; +no) ;; +esac + +fi + + MALLOC_OFILES= # Check whether --enable-malloc-debugging or --disable-malloc-debugging was given. if test "${enable_malloc_debugging+set}" = set; then @@ -2146,7 +2129,6 @@ s%@WINDRES@%$WINDRES%g s%@CPP@%$CPP%g s%@ALLOCA@%$ALLOCA%g s%@SET_MAKE@%$SET_MAKE%g -s%@MT_SAFE@%$MT_SAFE%g s%@MALLOC_OFILES@%$MALLOC_OFILES%g s%@DLL_ENTRY@%$DLL_ENTRY%g s%@DEF_DLL_ENTRY@%$DEF_DLL_ENTRY%g diff --git a/winsup/cygwin/configure.in b/winsup/cygwin/configure.in index 6a762e071..9ad229c38 100644 --- a/winsup/cygwin/configure.in +++ b/winsup/cygwin/configure.in @@ -1,5 +1,5 @@ dnl Autoconf configure script for Cygwin. -dnl Copyright 1996, 1997, 1998, 2000, 2001 Red Hat, Inc. +dnl Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003 Red Hat, Inc. dnl dnl This file is part of Cygwin. dnl @@ -118,27 +118,6 @@ if test $use_builtin_memset = "yes"; then fi AC_LANG_RESTORE -dnl set default mt safeness and then process the options. -mt_safe_val=1 -MT_SAFE=yes - -AC_ARG_ENABLE(threadsafe, -[ --enable-threadsafe=[runtime] Build a cygwin DLL which is thread safe], -[case "${enableval}" in -yes) - dnl default. - ;; -runtime) - mt_safe_val=2 - MT_SAFE=yes - ;; -no) - mt_safe_val=0 - MT_SAFE=no - ;; -esac -]) - AC_ARG_ENABLE(extra-threadsafe-checking, [ --enable-extra-threadsafe-checking Build a cygwin DLL which is thread safe with extra consistency checking], [case "${enableval}" in @@ -153,13 +132,6 @@ no) esac ]) -if test "$MT_SAFE" = "yes"; then - AC_DEFINE_UNQUOTED(_MT_SAFE,$mt_safe_val) -fi - -dnl Makefile uses MT_SAFE, so we subst as well as defining it. -AC_SUBST(MT_SAFE) - AC_ARG_ENABLE(debugging, [ --enable-debugging Build a cygwin DLL which has more consistency checking for debugging], [case "${enableval}" in @@ -168,6 +140,14 @@ no) ;; esac ]) +AC_ARG_ENABLE(cygserver, +[ --enable-server Build a cygwin DLL which can communicate with cygserver], +[case "${enableval}" in +yes) AC_DEFINE(USE_CYGSERVE) ;; +no) ;; +esac +]) + MALLOC_OFILES= AC_ARG_ENABLE(malloc-debugging, [ --enable-malloc-debugging Build a cygwin DLL with heap sanity checking (this is very slow, use only if you have heap corruption problems)], diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 34141c517..f43d3b6d5 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -53,9 +53,9 @@ per_thread NO_COPY *threadstuff[] = {&waitq_storage, &signal_dispatch_storage, NULL}; -BOOL display_title; -BOOL strip_title_path; -BOOL allow_glob = TRUE; +bool display_title; +bool strip_title_path; +bool allow_glob = TRUE; codepage_type current_codepage = ansi_cp; int cygwin_finished_initializing; diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index d476435b7..297069cb6 100644 --- a/winsup/cygwin/environ.cc +++ b/winsup/cygwin/environ.cc @@ -1,7 +1,7 @@ /* environ.cc: Cygwin-adopted functions from newlib to manipulate process's environment. - Copyright 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc. This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for @@ -26,17 +26,17 @@ details. */ #include "environ.h" #include "child_info.h" -extern BOOL allow_daemon; -extern BOOL allow_glob; +extern bool allow_glob; extern bool ignore_case_with_glob; -extern BOOL allow_ntea; -extern BOOL allow_smbntsec; -extern BOOL allow_winsymlinks; -extern BOOL strip_title_path; +extern bool allow_ntea; +extern bool allow_smbntsec; +extern bool allow_winsymlinks; +extern bool strip_title_path; extern int pcheck_case; extern int subauth_id; -BOOL reset_com = FALSE; -static BOOL envcache = TRUE; +bool reset_com = false; +bool allow_daemon = false; +static bool envcache = true; static char **lastenviron; @@ -365,7 +365,7 @@ ucenv (char *p, char *eq) /* Parse CYGWIN options */ -static NO_COPY BOOL export_settings = false; +static NO_COPY bool export_settings = false; enum settings { @@ -384,18 +384,18 @@ glob_init (const char *buf) { if (!buf || !*buf) { - allow_glob = FALSE; - ignore_case_with_glob = FALSE; + allow_glob = false; + ignore_case_with_glob = false; } else if (strncasematch (buf, "ignorecase", 10)) { - allow_glob = TRUE; - ignore_case_with_glob = TRUE; + allow_glob = true; + ignore_case_with_glob = true; } else { - allow_glob = TRUE; - ignore_case_with_glob = FALSE; + allow_glob = true; + ignore_case_with_glob = false; } } @@ -488,7 +488,7 @@ static struct parse_thing const char *name; union parse_setting { - BOOL *b; + bool *b; DWORD *x; int *i; void (*func)(const char *); @@ -506,21 +506,21 @@ static struct parse_thing {"binmode", {x: &binmode}, justset, NULL, {{O_TEXT}, {O_BINARY}}}, {"check_case", {func: &check_case_init}, isfunc, NULL, {{0}, {0}}}, {"codepage", {func: &codepage_init}, isfunc, NULL, {{0}, {0}}}, - {"daemon", {&allow_daemon}, justset, NULL, {{FALSE}, {TRUE}}}, - {"envcache", {&envcache}, justset, NULL, {{TRUE}, {FALSE}}}, + {"daemon", {&allow_daemon}, justset, NULL, {{false}, {true}}}, + {"envcache", {&envcache}, justset, NULL, {{true}, {false}}}, {"error_start", {func: &error_start_init}, isfunc, NULL, {{0}, {0}}}, - {"export", {&export_settings}, justset, NULL, {{FALSE}, {TRUE}}}, + {"export", {&export_settings}, justset, NULL, {{false}, {true}}}, {"forkchunk", {func: set_chunksize}, isfunc, NULL, {{0}, {0}}}, {"glob", {func: &glob_init}, isfunc, NULL, {{0}, {s: "normal"}}}, - {"ntea", {&allow_ntea}, justset, NULL, {{FALSE}, {TRUE}}}, - {"ntsec", {&allow_ntsec}, justset, NULL, {{FALSE}, {TRUE}}}, - {"smbntsec", {&allow_smbntsec}, justset, NULL, {{FALSE}, {TRUE}}}, - {"reset_com", {&reset_com}, justset, NULL, {{FALSE}, {TRUE}}}, - {"strip_title", {&strip_title_path}, justset, NULL, {{FALSE}, {TRUE}}}, + {"ntea", {&allow_ntea}, justset, NULL, {{false}, {true}}}, + {"ntsec", {&allow_ntsec}, justset, NULL, {{false}, {true}}}, + {"smbntsec", {&allow_smbntsec}, justset, NULL, {{false}, {true}}}, + {"reset_com", {&reset_com}, justset, NULL, {{false}, {true}}}, + {"strip_title", {&strip_title_path}, justset, NULL, {{false}, {true}}}, {"subauth_id", {func: &subauth_id_init}, isfunc, NULL, {{0}, {0}}}, - {"title", {&display_title}, justset, NULL, {{FALSE}, {TRUE}}}, + {"title", {&display_title}, justset, NULL, {{false}, {true}}}, {"tty", {NULL}, set_process_state, NULL, {{0}, {PID_USETTY}}}, - {"winsymlinks", {&allow_winsymlinks}, justset, NULL, {{FALSE}, {TRUE}}}, + {"winsymlinks", {&allow_winsymlinks}, justset, NULL, {{false}, {true}}}, {NULL, {0}, justset, 0, {{0}, {0}}} }; @@ -676,7 +676,7 @@ environ_init (char **envp, int envc) /* Set ntsec explicit as default, if NT is running */ if (wincap.has_security ()) - allow_ntsec = TRUE; + allow_ntsec = true; if (!envp) envp_passed_in = 0; diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index cc60235e8..84b862e40 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -507,9 +507,12 @@ fhandler_tty_slave::open (path_conv *, int flags, mode_t) HANDLE from_master_local, to_master_local; - if (!wincap.has_security () || - cygserver_running == CYGSERVER_UNAVAIL || - !cygserver_attach_tty (&from_master_local, &to_master_local)) + if (!wincap.has_security () +#ifdef USE_CYGSERVER + || cygserver_running == CYGSERVER_UNAVAIL + || !cygserver_attach_tty (&from_master_local, &to_master_local) +#endif +) { termios_printf ("cannot dup handles via server. using old method."); @@ -596,6 +599,7 @@ fhandler_tty_slave::cygserver_attach_tty (LPHANDLE from_master_ptr, if (!from_master_ptr || !to_master_ptr) return 0; +#ifdef USE_CYGSERVER client_request_attach_tty req ((DWORD) get_ttyp ()->master_pid, (HANDLE) get_ttyp ()->from_master, (HANDLE) get_ttyp ()->to_master); @@ -605,6 +609,8 @@ fhandler_tty_slave::cygserver_attach_tty (LPHANDLE from_master_ptr, *from_master_ptr = req.from_master (); *to_master_ptr = req.to_master (); +#endif + return 1; } diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index efda7222b..01daec953 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -298,8 +298,10 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls) (void) ForceCloseHandle1 (fork_info->subproc_ready, subproc_ready); (void) ForceCloseHandle1 (fork_info->forker_finished, forker_finished); +#ifdef USE_CYGSERVER if (fixup_shms_after_fork ()) api_fatal ("recreate_shm areas after fork failed"); +#endif pinfo_fixup_after_fork (); signal_fixup_after_fork (); diff --git a/winsup/cygwin/ntea.cc b/winsup/cygwin/ntea.cc index 7ddff7770..4841a4c93 100644 --- a/winsup/cygwin/ntea.cc +++ b/winsup/cygwin/ntea.cc @@ -16,7 +16,7 @@ details. */ #include "security.h" /* Default to not using NTEA information */ -BOOL allow_ntea; +bool allow_ntea; /* From Windows NT DDK: diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc index 5ccf37e3d..c08e1abe3 100644 --- a/winsup/cygwin/security.cc +++ b/winsup/cygwin/security.cc @@ -40,12 +40,11 @@ details. */ #include "lm.h" #include "pwdgrp.h" -extern BOOL allow_ntea; -BOOL allow_ntsec; +bool allow_ntsec; /* allow_smbntsec is handled exclusively in path.cc (path_conv::check). It's defined here because of it's strong relationship to allow_ntsec. The default is TRUE to reflect the old behaviour. */ -BOOL allow_smbntsec; +bool allow_smbntsec; cygsid * cygsidlist::alloc_sids (int n) diff --git a/winsup/cygwin/security.h b/winsup/cygwin/security.h index 2965b1dec..71ffe4cec 100644 --- a/winsup/cygwin/security.h +++ b/winsup/cygwin/security.h @@ -209,9 +209,9 @@ legal_sid_type (SID_NAME_USE type) || type == SidTypeAlias || type == SidTypeWellKnownGroup; } -extern BOOL allow_ntea; -extern BOOL allow_ntsec; -extern BOOL allow_smbntsec; +extern bool allow_ntea; +extern bool allow_ntsec; +extern bool allow_smbntsec; /* File manipulation */ int __stdcall set_process_privileges (); diff --git a/winsup/cygwin/shm.cc b/winsup/cygwin/shm.cc index fa0375d73..1221298d2 100644 --- a/winsup/cygwin/shm.cc +++ b/winsup/cygwin/shm.cc @@ -12,7 +12,7 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ #include "winsup.h" - +#ifdef USE_CYGSERVER #include #include @@ -690,3 +690,4 @@ client_request_shm::client_request_shm (const key_t key, msglen (sizeof (_parameters.in)); } +#endif /* USE_CYGSERVER */ diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 8e545c4af..a22f4ee06 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1514,8 +1514,6 @@ getpagesize () static int check_posix_perm (const char *fname, int v) { - extern int allow_ntea, allow_ntsec, allow_smbntsec; - /* Windows 95/98/ME don't support file system security at all. */ if (!wincap.has_security ()) return 0; diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc index 23e6f6219..4c3365d91 100644 --- a/winsup/cygwin/tty.cc +++ b/winsup/cygwin/tty.cc @@ -407,11 +407,16 @@ tty::common_init (fhandler_pty_master *ptym) */ if (wincap.has_security ()) { +#ifdef USE_CYGSERVER if (cygserver_running == CYGSERVER_UNKNOWN) cygserver_init (); +#endif - if (cygserver_running != CYGSERVER_OK - && !SetKernelObjectSecurity (hMainProc, + if ( +#ifdef USE_CYGSERVER + cygserver_running != CYGSERVER_OK && +#endif + !SetKernelObjectSecurity (hMainProc, DACL_SECURITY_INFORMATION, get_null_sd ())) system_printf ("Can't set process security, %E"); diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index 0fe2cfca9..68a386c7c 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -98,6 +98,8 @@ extern int dynamically_loaded; extern int cygserver_running; +#define _MT_SAFE // DELTEME someday + #define TITLESIZE 1024 /* status bit manipulation */ @@ -197,7 +199,6 @@ extern int cygwin_finished_initializing; void __stdcall set_std_handle (int); int __stdcall writable_directory (const char *file); int __stdcall stat_dev (DWORD, int, unsigned long, struct __stat64 *); -extern BOOL allow_ntsec; __ino64_t __stdcall hash_path_name (__ino64_t hash, const char *name) __attribute__ ((regparm(2))); void __stdcall nofinalslash (const char *src, char *dst) __attribute__ ((regparm(2))); @@ -292,7 +293,7 @@ extern SYSTEM_INFO system_info; /* The title on program start. */ extern char *old_title; -extern BOOL display_title; +extern bool display_title; extern HANDLE hMainThread; extern HANDLE hMainProc;