From 66a83f3eac1c9c8ad575c117b7c49995dc549d26 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sat, 3 Jan 2009 05:12:22 +0000 Subject: [PATCH] Remove unneeded header files from source files throughout. Update copyrights where appropriate. * globals.cc: New file for generic global variables. * mkglobals_h: New file to generate globals.h. * mkstatic: New Script used to build a (currently non-working) static libcygwin_s.a. * Makefile.in: Add unused rule to build a non-working libcygwin_s.a. (DLL_OFILES): Add globals.o. Make all objects rely on globals.h. (globals.h): New target. Generate globals.h. * cygtls.h: Honor new CYGTLS_HANDLE define to control when the HANDLE operator is allowed in _cygtls. * dcrt0.cc: Move most globals to globals.cc. * init.cc: Ditto. * environ.cc (strip_title_path): Remove now-unneeded extern. * fhandler_serial.cc (fhandler_serial::open): Ditto. * pinfo.cc: Ditto. (commune_process): Ditto. * shared.cc: Ditto. * glob.cc: Ditto. * strace.cc: Ditto. * exceptions.cc: Define CYGTLS_HANDLE before including winsup.h. * path.cc (stat_suffixes): Move here. * security.h: Add forward class path_conv declaration. * smallprint.cc (__small_vsprintf): Make a true c++ function. (__small_sprintf): Ditto. (small_printf): Ditto. (console_printf): Ditto. (__small_vswprintf): Ditto. (__small_swprintf): Ditto. * spawn.cc (spawn_guts): Remove _stdcall decoration in favor of regparm. (hExeced): Move to globals.cc * strfuncs.cc (current_codepage): Ditto. (active_codepage): Ditto. * sync.cc (lock_process::locker): Move here from dcrt0.cc. * syscalls.cc (stat_suffixes): Move to path.cc. * tty.cc (tty::create_master): Uncapitalize fatal warning for consistency. * winsup.h: Include globals.h to declare most of the grab bag list of globals which were previously defined here. * mount.h: Move USER_* defines back to shared_info.h. * speclib: Force temporary directory cleanup. --- winsup/cygwin/ChangeLog | 49 ++++++++++ winsup/cygwin/Makefile.in | 42 ++++++--- winsup/cygwin/assert.cc | 3 +- winsup/cygwin/cxx.cc | 3 +- winsup/cygwin/cygthread.cc | 4 +- winsup/cygwin/cygtls.cc | 4 +- winsup/cygwin/cygtls.h | 10 +- winsup/cygwin/dcrt0.cc | 81 ++-------------- winsup/cygwin/debug.cc | 4 +- winsup/cygwin/devices.cc | 4 - winsup/cygwin/devices.in | 4 - winsup/cygwin/environ.cc | 4 +- winsup/cygwin/exceptions.cc | 4 +- winsup/cygwin/fhandler_clipboard.cc | 5 +- winsup/cygwin/fhandler_mailslot.cc | 4 +- winsup/cygwin/fhandler_mem.cc | 4 +- winsup/cygwin/fhandler_nodevice.cc | 6 +- winsup/cygwin/fhandler_random.cc | 5 +- winsup/cygwin/fhandler_raw.cc | 4 +- winsup/cygwin/fhandler_serial.cc | 3 +- winsup/cygwin/fhandler_termios.cc | 5 +- winsup/cygwin/fhandler_virtual.cc | 4 +- winsup/cygwin/fhandler_windows.cc | 4 +- winsup/cygwin/fork.cc | 4 +- winsup/cygwin/glob.cc | 2 - winsup/cygwin/globals.cc | 115 +++++++++++++++++++++++ winsup/cygwin/gmon.c | 3 - winsup/cygwin/init.cc | 5 +- winsup/cygwin/ioctl.cc | 4 +- winsup/cygwin/lib/_cygwin_crt0_common.cc | 8 +- winsup/cygwin/lib/cygwin_crt0.c | 3 +- winsup/cygwin/lib/dll_main.cc | 5 +- winsup/cygwin/lib/libcmain.c | 3 +- winsup/cygwin/libc/bsdlib.cc | 4 - winsup/cygwin/libc/minires-os-if.c | 3 +- winsup/cygwin/mcount.c | 1 - winsup/cygwin/mkglobals_h | 29 ++++++ winsup/cygwin/mkstatic | 59 ++++++++++++ winsup/cygwin/mount.cc | 3 +- winsup/cygwin/mount.h | 6 +- winsup/cygwin/path.cc | 9 +- winsup/cygwin/pinfo.cc | 5 +- winsup/cygwin/poll.cc | 5 +- winsup/cygwin/profil.c | 4 +- winsup/cygwin/registry.cc | 4 +- winsup/cygwin/security.h | 4 +- winsup/cygwin/shared.cc | 3 +- winsup/cygwin/shared_info.h | 6 +- winsup/cygwin/smallprint.cc | 14 +-- winsup/cygwin/spawn.cc | 5 +- winsup/cygwin/speclib | 2 +- winsup/cygwin/strace.cc | 4 +- winsup/cygwin/strfuncs.cc | 5 +- winsup/cygwin/sync.cc | 5 +- winsup/cygwin/syscalls.cc | 11 +-- winsup/cygwin/thread.h | 4 +- winsup/cygwin/times.cc | 4 +- winsup/cygwin/tty.cc | 4 +- winsup/cygwin/winsup.h | 103 ++++++-------------- 59 files changed, 410 insertions(+), 308 deletions(-) create mode 100644 winsup/cygwin/globals.cc create mode 100755 winsup/cygwin/mkglobals_h create mode 100755 winsup/cygwin/mkstatic diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 739531786..88c6a5508 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,52 @@ +2009-01-02 Christopher Faylor + + Remove unneeded header files from source files throughout. + Update copyrights where appropriate. + + * globals.cc: New file for generic global variables. + * mkglobals_h: New file to generate globals.h. + * mkstatic: New Script used to build a (currently non-working) static + libcygwin_s.a. + * Makefile.in: Add unused rule to build a non-working libcygwin_s.a. + (DLL_OFILES): Add globals.o. Make all objects rely on globals.h. + (globals.h): New target. Generate globals.h. + * cygtls.h: Honor new CYGTLS_HANDLE define to control when the HANDLE + operator is allowed in _cygtls. + * dcrt0.cc: Move most globals to globals.cc. + * init.cc: Ditto. + * environ.cc (strip_title_path): Remove now-unneeded extern. + * fhandler_serial.cc (fhandler_serial::open): Ditto. + * pinfo.cc: Ditto. + (commune_process): Ditto. + * shared.cc: Ditto. + * glob.cc: Ditto. + * strace.cc: Ditto. + * exceptions.cc: Define CYGTLS_HANDLE before including winsup.h. + * path.cc (stat_suffixes): Move here. + * security.h: Add forward class path_conv declaration. + * smallprint.cc (__small_vsprintf): Make a true c++ function. + (__small_sprintf): Ditto. + (small_printf): Ditto. + (console_printf): Ditto. + (__small_vswprintf): Ditto. + (__small_swprintf): Ditto. + * spawn.cc (spawn_guts): Remove _stdcall decoration in favor of + regparm. + (hExeced): Move to globals.cc + * strfuncs.cc (current_codepage): Ditto. + (active_codepage): Ditto. + * sync.cc (lock_process::locker): Move here from dcrt0.cc. + * syscalls.cc (stat_suffixes): Move to path.cc. + * tty.cc (tty::create_master): Uncapitalize fatal warning for + consistency. + * winsup.h: Include globals.h to declare most of the grab bag list of + globals which were previously defined here. + + * mount.h: Move USER_* defines back to shared_info.h. + + * speclib: Force temporary directory cleanup. + + 2009-01-02 Christopher Faylor * speclib: Rewrite completely in perl. Avoid multiple nm calls. diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index 4c433ff94..6fd0882f7 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -1,6 +1,6 @@ # Makefile.in for Cygwin. # Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008 Red Hat, Inc. +# 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. # # This file is part of Cygwin. # @@ -55,7 +55,7 @@ CC:=@CC@ # FIXME: Which is it, CC or CC_FOR_TARGET? CC_FOR_TARGET:=$(CC) CFLAGS=@CFLAGS@ -override CFLAGS+=-MMD ${$(*F)_CFLAGS} -fmerge-constants -ftracer $(CCEXTRA) +override CFLAGS+=-MMD ${$(*F)_CFLAGS} -Werror -fmerge-constants -ftracer $(CCEXTRA) CXX=@CXX@ override CXXFLAGS=@CXXFLAGS@ @@ -98,6 +98,7 @@ RUNTESTFLAGS = DLL_NAME:=cygwin1.dll TEST_DLL_NAME:=cygwin0.dll TEST_LIB_NAME:=libcygwin0.a +STATIC_LIB_NAME:=libcygwin_s.a DEF_FILE:=cygwin.def DLL_ENTRY:=@DLL_ENTRY@ @@ -135,7 +136,7 @@ DLL_OFILES:=assert.o autoload.o bsdlib.o ctype.o cxx.o cygheap.o cygthread.o \ fhandler_registry.o fhandler_serial.o fhandler_socket.o fhandler_tape.o \ fhandler_termios.o fhandler_tty.o fhandler_virtual.o fhandler_windows.o \ fhandler_zero.o flock.o fnmatch.o fork.o fts.o ftw.o getopt.o glob.o \ - glob_pattern_p.o grp.o heap.o hookapi.o inet_addr.o inet_network.o \ + glob_pattern_p.o globals.o grp.o heap.o hookapi.o inet_addr.o inet_network.o \ init.o ioctl.o ipc.o kernel32.o localtime.o lsearch.o malloc_wrapper.o \ minires-os-if.o minires.o miscfuncs.o mktemp.o mmap.o msg.o mount.o \ net.o netdb.o nfs.o nftw.o ntea.o passwd.o path.o pinfo.o pipe.o \ @@ -149,6 +150,15 @@ DLL_OFILES:=assert.o autoload.o bsdlib.o ctype.o cxx.o cygheap.o cygthread.o \ xsique.o \ $(EXTRA_DLL_OFILES) $(EXTRA_OFILES) $(MALLOC_OFILES) $(MT_SAFE_OBJECTS) +EXCLUDE_STATIC_OFILES:=$(addprefix --exclude=,\ + cygtls.o \ + dcrt0.o \ + exceptions.o \ + fork.o \ + signal.o \ + spawn.o \ +) + GMON_OFILES:=gmon.o mcount.o profil.o OBSOLETE_FUNCTIONS:=open acl aclcheck aclfrommode aclfrompbits \ @@ -381,7 +391,7 @@ $(TEST_DLL_NAME): $(LDSCRIPT) dllfixdbg $(DLL_OFILES) $(DLL_IMPORTS) $(LIBSERVER -Wl,--heap=0 -Wl,--out-implib,cygdll.a -shared -o $@ \ -e $(DLL_ENTRY) $(DEF_FILE) $(DLL_OFILES) version.o winver.o \ $(MALLOC_OBJ) $(LIBSERVER) $(LIBM) $(LIBC) \ - -lgcc $(DLL_IMPORTS) + -lgcc $(DLL_IMPORTS) -Wl,-Map,cygwin.map @$(word 2,$^) $(OBJDUMP) $(OBJCOPY) $@ ${patsubst %0.dll,%1.dbg,$@} @ln -f $@ new-$(DLL_NAME) @@ -392,6 +402,9 @@ $(LIB_NAME): rmsym newsym $(TEST_DLL_NAME) $(LIBCOS) (echo create $(LIB_NAME); echo addmod $(LIBCOS); echo addlib cygdll.a; echo save) | $(AR) -M $(RANLIB) $@ +${STATIC_LIB_NAME}: mkstatic ${TEST_DLL_NAME} + perl -d $< -x ${EXCLUDE_STATIC_OFILES} --library=${LIBC} --library=${LIBM} --ar=${AR} $@ cygwin.map + # Rule to make stub library used by testsuite # dependency set to $(LIB_NAME) to accommodate make -j2. # Otherwise dlltool gets confused. cgf (11-16-2000) @@ -412,8 +425,13 @@ $(API_VER): $(srcdir)/cygwin.din version.cc winver.o: winver_stamp @ : +globals.h: mkglobals_h globals.cc + $^ > $@ + +${DLL_OFILES}: globals.h + shared_info_magic.h: cygmagic shared_info.h - /bin/sh ${word 1,$^} $@ "$(CC) -x c" ${word 2,$^} USER_MAGIC 'class user_info' SHARED_MAGIC 'class shared_info' + /bin/sh ${word 1,$^} $@ "$(CC) -x c" ${word 2,$^} SHARED_MAGIC 'class shared_info' USER_MAGIC 'class user_info' child_info_magic.h: cygmagic child_info.h /bin/sh ${word 1,$^} $@ "$(CC) -x c" ${word 2,$^} CHILD_INFO_MAGIC 'class child_info' @@ -429,22 +447,22 @@ $(srcdir)/devices.cc: gendevices devices.in devices.h ${wordlist 1,2,$^} $@ $(PWD)/libpthread.a: speclib $(LIB_NAME) pthread.o thread.o - /bin/sh ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^} + ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^} $(PWD)/libutil.a: speclib $(LIB_NAME) bsdlib.o - /bin/sh ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^} + ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^} $(PWD)/libm.a: speclib $(LIB_NAME) $(LIBM) - /bin/sh ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^} + ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^} $(PWD)/libc.a: speclib $(LIB_NAME) $(PWD)/libm.a libpthread.a libutil.a - /bin/sh ${word 1, $^} -v $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^} + ${word 1, $^} -v $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^} $(PWD)/libdl.a: speclib $(LIB_NAME) dlfcn.o - /bin/sh ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^} + ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^} $(PWD)/libresolv.a: speclib $(LIB_NAME) minires.o - /bin/sh ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^} + ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^} lib%.a: %.o $(AR) cru $@ $? @@ -469,7 +487,7 @@ sigfe.s: $(DEF_FILE) [ -s $@ ] && touch $@ sigfe.o: sigfe.s - $(CC) -c -o $@ $? + $(CC) -c -o $@ $< winsup.h: config.h diff --git a/winsup/cygwin/assert.cc b/winsup/cygwin/assert.cc index 8b8c1815b..a47a3827f 100644 --- a/winsup/cygwin/assert.cc +++ b/winsup/cygwin/assert.cc @@ -1,6 +1,6 @@ /* assert.cc: Handle the assert macro for WIN32. - Copyright 1997, 1998, 2000, 2001, 2007 Red Hat, Inc. + Copyright 1997, 1998, 2000, 2001, 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -9,7 +9,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ #include "winsup.h" -#include "security.h" #include #include diff --git a/winsup/cygwin/cxx.cc b/winsup/cygwin/cxx.cc index 1cee576f4..6021b4fa8 100644 --- a/winsup/cygwin/cxx.cc +++ b/winsup/cygwin/cxx.cc @@ -1,6 +1,6 @@ /* cxx.cc - Copyright 2002, 2003 Red Hat, Inc. + Copyright 2002, 2003, 2005, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -11,7 +11,6 @@ details. */ #if (__GNUC__ >= 3) #include "winsup.h" -#include void * operator new (size_t s) diff --git a/winsup/cygwin/cygthread.cc b/winsup/cygwin/cygthread.cc index 4c674ed36..b0aea3619 100644 --- a/winsup/cygwin/cygthread.cc +++ b/winsup/cygwin/cygthread.cc @@ -1,6 +1,7 @@ /* cygthread.cc - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 + Red Hat, Inc. This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for @@ -10,7 +11,6 @@ details. */ #include "miscfuncs.h" #include #include "sigproc.h" -#include "thread.h" #include "cygtls.h" #undef CloseHandle diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc index 3d15ae6ea..1d8153a32 100644 --- a/winsup/cygwin/cygtls.cc +++ b/winsup/cygwin/cygtls.cc @@ -1,6 +1,6 @@ /* cygtls.cc - Copyright 2003, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. + Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for @@ -8,10 +8,8 @@ details. */ #include "winsup.h" #define USE_SYS_TYPES_FD_SET -#include "thread.h" #include "cygtls.h" #include -#include #include "path.h" #include "fhandler.h" #include "dtable.h" diff --git a/winsup/cygwin/cygtls.h b/winsup/cygwin/cygtls.h index 7aee1ae32..5b944eb91 100644 --- a/winsup/cygwin/cygtls.h +++ b/winsup/cygwin/cygtls.h @@ -1,6 +1,6 @@ /* cygtls.h - Copyright 2003, 2004, 2005, 2008 Red Hat, Inc. + Copyright 2003, 2004, 2005, 2008, 2009 Red Hat, Inc. This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for @@ -12,7 +12,7 @@ details. */ #include #include #include -#include +#include #define _NOMNTENT_FUNCS #include #undef _NOMNTENT_FUNCS @@ -36,6 +36,10 @@ details. */ #define TP_NUM_C_BUFS 10 #define TP_NUM_W_BUFS 10 +#ifdef CYGTLS_HANDLE +#include "thread.h" +#endif + #pragma pack(push,4) /* Defined here to support auto rebuild of tlsoffsets.h. */ class tls_pathbuf @@ -236,7 +240,7 @@ struct _cygtls void copy_context (CONTEXT *) __attribute__ ((regparm(2))); void signal_debugger (int) __attribute__ ((regparm(2))); -#ifdef _THREAD_H +#ifdef CYGTLS_HANDLE operator HANDLE () const {return tid->win32_obj_id;} #endif void set_siginfo (struct sigpacket *) __attribute__ ((regparm (3))); diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 961e60567..9ffbd72ff 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -1,7 +1,8 @@ /* dcrt0.cc -- essentially the main() for the Cygwin dll - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008 Red Hat, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009 + Red Hat, Inc. This file is part of Cygwin. @@ -15,6 +16,7 @@ details. */ #include #include "glob.h" #include +#include "environ.h" #include "sigproc.h" #include "pinfo.h" #include "cygerrno.h" @@ -36,79 +38,14 @@ details. */ #define PREMAIN_LEN (sizeof (user_data->premain) / sizeof (user_data->premain[0])) + extern "C" void cygwin_exit (int) __attribute__ ((noreturn)); - -HANDLE NO_COPY hMainProc = (HANDLE) -1; -HANDLE NO_COPY hMainThread; -HANDLE NO_COPY hProcToken; -HANDLE NO_COPY hProcImpToken; - -muto NO_COPY lock_process::locker; - -bool display_title; -bool strip_title_path; -bool allow_glob = true; -bool NO_COPY in_forkee; - -int __argc_safe; -int __argc; -char **__argv; -#ifdef NEWVFORK -vfork_save NO_COPY *main_vfork; -#endif - -static int NO_COPY envc; -char NO_COPY **envp; - extern "C" void __sinit (_reent *); -_cygtls NO_COPY *_main_tls; +static int NO_COPY envc; +static char NO_COPY **envp; -bool NO_COPY cygwin_finished_initializing; - -MTinterface _mtinterf; - -bool NO_COPY _cygwin_testing; - -char NO_COPY almost_null[1]; - -extern "C" -{ - /* This is an exported copy of environ which can be used by DLLs - which use cygwin.dll. */ - char **__cygwin_environ; - char ***main_environ = &__cygwin_environ; - /* __progname used in getopt error message */ - char *__progname; - struct per_process __cygwin_user_data = - {/* initial_sp */ 0, /* magic_biscuit */ 0, - /* dll_major */ CYGWIN_VERSION_DLL_MAJOR, - /* dll_major */ CYGWIN_VERSION_DLL_MINOR, - /* impure_ptr_ptr */ NULL, /* envptr */ NULL, - /* malloc */ malloc, /* free */ free, - /* realloc */ realloc, - /* fmode_ptr */ NULL, /* main */ NULL, /* ctors */ NULL, - /* dtors */ NULL, /* data_start */ NULL, /* data_end */ NULL, - /* bss_start */ NULL, /* bss_end */ NULL, - /* calloc */ calloc, - /* premain */ {NULL, NULL, NULL, NULL}, - /* run_ctors_p */ 0, - /* unused */ {0, 0, 0, 0, 0, 0, 0}, - /* UNUSED forkee */ 0, - /* hmodule */ NULL, - /* api_major */ CYGWIN_VERSION_API_MAJOR, - /* api_minor */ CYGWIN_VERSION_API_MINOR, - /* unused2 */ {0, 0, 0, 0, 0, 0}, - /* threadinterface */ &_mtinterf, - /* impure_ptr */ _GLOBAL_REENT, - }; - bool ignore_case_with_glob; - int _check_for_executable = true; -}; - -int NO_COPY __api_fatal_exit_val = 1; -char *old_title; -char title_buf[TITLESIZE + 1]; +static char title_buf[TITLESIZE + 1]; static void do_global_dtors () @@ -1039,8 +976,6 @@ __main (void) atexit (do_global_dtors); } -exit_states NO_COPY exit_state; - void __stdcall do_exit (int status) { diff --git a/winsup/cygwin/debug.cc b/winsup/cygwin/debug.cc index 87d35c799..232a7b838 100644 --- a/winsup/cygwin/debug.cc +++ b/winsup/cygwin/debug.cc @@ -1,6 +1,7 @@ /* debug.cc - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + 2008, 2009 Red Hat, Inc. This software is a copyrighted work licensed under the terms of the @@ -8,7 +9,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ #include "winsup.h" -#include "security.h" #include "cygerrno.h" #ifdef DEBUGGING #include "path.h" diff --git a/winsup/cygwin/devices.cc b/winsup/cygwin/devices.cc index 3391ad518..1f4bb9529 100644 --- a/winsup/cygwin/devices.cc +++ b/winsup/cygwin/devices.cc @@ -1,10 +1,6 @@ #include "winsup.h" -#include -#include -#include -#include #include "devices.h" #include "sys/cygwin.h" #include "tty.h" diff --git a/winsup/cygwin/devices.in b/winsup/cygwin/devices.in index e5d972060..bbe829683 100644 --- a/winsup/cygwin/devices.in +++ b/winsup/cygwin/devices.in @@ -1,9 +1,5 @@ %import { #include "winsup.h" -#include -#include -#include -#include #include "devices.h" #include "sys/cygwin.h" #include "tty.h" diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index 2c42675fb..4b8cb0380 100644 --- a/winsup/cygwin/environ.cc +++ b/winsup/cygwin/environ.cc @@ -2,7 +2,7 @@ process's environment. Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008 Red Hat, Inc. + 2006, 2007, 2008, 2009 Red Hat, Inc. This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for @@ -30,10 +30,8 @@ details. */ #include "child_info.h" extern bool dos_file_warning; -extern bool allow_glob; extern bool ignore_case_with_glob; extern bool allow_winsymlinks; -extern bool strip_title_path; bool reset_com = false; static bool envcache = true; static bool create_upcaseenv = false; diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 4428d49e8..6a468cf80 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -1,7 +1,7 @@ /* exceptions.cc Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008 Red Hat, Inc. + 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -9,6 +9,7 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#define CYGTLS_HANDLE #include "winsup.h" #include "miscfuncs.h" #include @@ -476,7 +477,6 @@ rtl_unwind (exception_list *frame, PEXCEPTION_RECORD e) extern exception_list *_except_list asm ("%fs:0"); -extern "C" char *__progname; int _cygtls::handle_exceptions (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in, void *) { diff --git a/winsup/cygwin/fhandler_clipboard.cc b/winsup/cygwin/fhandler_clipboard.cc index d4b974393..86304deed 100644 --- a/winsup/cygwin/fhandler_clipboard.cc +++ b/winsup/cygwin/fhandler_clipboard.cc @@ -1,6 +1,7 @@ /* fhandler_dev_clipboard: code to access /dev/clipboard - Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2008 Red Hat, Inc + Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009 + Red Hat, Inc Written by Charles Wilson (cwilson@ece.gatech.edu) @@ -11,12 +12,10 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ #include "winsup.h" -#include #include #include #include #include "cygerrno.h" -#include "security.h" #include "path.h" #include "fhandler.h" diff --git a/winsup/cygwin/fhandler_mailslot.cc b/winsup/cygwin/fhandler_mailslot.cc index edbb09441..dda4d3385 100644 --- a/winsup/cygwin/fhandler_mailslot.cc +++ b/winsup/cygwin/fhandler_mailslot.cc @@ -1,6 +1,7 @@ /* fhandler_mailslot.cc. See fhandler.h for a description of the fhandler classes. - Copyright 2005, 2007 Red Hat, Inc. + Copyright 2005, 2007, 2008, 2009 + Red Hat, Inc. This file is part of Cygwin. @@ -11,7 +12,6 @@ #include "winsup.h" #include "cygerrno.h" -#include "security.h" #include "path.h" #include "fhandler.h" #include "ntdll.h" diff --git a/winsup/cygwin/fhandler_mem.cc b/winsup/cygwin/fhandler_mem.cc index 3d277f240..9683d90ae 100644 --- a/winsup/cygwin/fhandler_mem.cc +++ b/winsup/cygwin/fhandler_mem.cc @@ -1,6 +1,7 @@ /* fhandler_mem.cc. See fhandler.h for a description of the fhandler classes. - Copyright 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. + Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 + Red Hat, Inc. This file is part of Cygwin. @@ -12,7 +13,6 @@ #include #include "cygerrno.h" -#include "security.h" #include "path.h" #include "fhandler.h" #include "ntdll.h" diff --git a/winsup/cygwin/fhandler_nodevice.cc b/winsup/cygwin/fhandler_nodevice.cc index cb3b61e0d..4ffe2c447 100644 --- a/winsup/cygwin/fhandler_nodevice.cc +++ b/winsup/cygwin/fhandler_nodevice.cc @@ -1,6 +1,7 @@ -/* fhandler.cc. See console.cc for fhandler_console functions. +/* fhandler_nodevice.cc. "No such device" handler. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009 + Red Hat, Inc. This file is part of Cygwin. @@ -10,7 +11,6 @@ details. */ #include "winsup.h" #include "cygerrno.h" -#include "security.h" #include "path.h" #include "fhandler.h" diff --git a/winsup/cygwin/fhandler_random.cc b/winsup/cygwin/fhandler_random.cc index b8784b075..09d70c554 100644 --- a/winsup/cygwin/fhandler_random.cc +++ b/winsup/cygwin/fhandler_random.cc @@ -1,6 +1,7 @@ /* fhandler_random.cc: code to access /dev/random and /dev/urandom - Copyright 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. + Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009 + Red Hat, Inc. Written by Corinna Vinschen (vinschen@cygnus.com) @@ -11,10 +12,8 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ #include "winsup.h" -#include #include #include "cygerrno.h" -#include "security.h" #include "path.h" #include "fhandler.h" diff --git a/winsup/cygwin/fhandler_raw.cc b/winsup/cygwin/fhandler_raw.cc index 8c46ab6a6..5ffe8c1e9 100644 --- a/winsup/cygwin/fhandler_raw.cc +++ b/winsup/cygwin/fhandler_raw.cc @@ -1,6 +1,7 @@ /* fhandler_raw.cc. See fhandler.h for a description of the fhandler classes. - Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 Red Hat, Inc. + Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009 + Red Hat, Inc. This file is part of Cygwin. @@ -13,7 +14,6 @@ #include #include #include "cygerrno.h" -#include "security.h" #include "path.h" #include "fhandler.h" diff --git a/winsup/cygwin/fhandler_serial.cc b/winsup/cygwin/fhandler_serial.cc index 36c6ee222..484350390 100644 --- a/winsup/cygwin/fhandler_serial.cc +++ b/winsup/cygwin/fhandler_serial.cc @@ -1,7 +1,7 @@ /* fhandler_serial.cc Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007 Red Hat, Inc. + 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -229,7 +229,6 @@ fhandler_serial::open (int flags, mode_t mode) initialization we are, is really a terrible kludge and should be fixed ASAP. */ - extern char *__progname; if (reset_com && __progname) { DCB state; diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc index caa98e7ca..8bdfdcd5d 100644 --- a/winsup/cygwin/fhandler_termios.cc +++ b/winsup/cygwin/fhandler_termios.cc @@ -1,6 +1,7 @@ /* fhandler_termios.cc - Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 Red Hat, Inc. + Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009 + Red Hat, Inc. This file is part of Cygwin. @@ -12,13 +13,11 @@ details. */ #include #include #include "cygerrno.h" -#include "security.h" #include "path.h" #include "fhandler.h" #include "sigproc.h" #include "pinfo.h" #include "tty.h" -#include "sys/cygwin.h" #include "cygtls.h" /* Common functions shared by tty/console */ diff --git a/winsup/cygwin/fhandler_virtual.cc b/winsup/cygwin/fhandler_virtual.cc index ded590227..141fe7bd0 100644 --- a/winsup/cygwin/fhandler_virtual.cc +++ b/winsup/cygwin/fhandler_virtual.cc @@ -1,6 +1,6 @@ /* fhandler_virtual.cc: base fhandler class for virtual filesystems - Copyright 2002, 2003, 2004, 2005, 2007 Red Hat, Inc. + Copyright 2002, 2003, 2004, 2005, 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -9,11 +9,9 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ #include "winsup.h" -#include #include #include #include "cygerrno.h" -#include "security.h" #include "path.h" #include "fhandler.h" #include "dtable.h" diff --git a/winsup/cygwin/fhandler_windows.cc b/winsup/cygwin/fhandler_windows.cc index 8232450bb..09ce3a017 100644 --- a/winsup/cygwin/fhandler_windows.cc +++ b/winsup/cygwin/fhandler_windows.cc @@ -1,6 +1,7 @@ /* fhandler_windows.cc: code to access windows message queues. - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009 + Red Hat, Inc. Written by Sergey S. Okhapkin (sos@prospect.com.ru). Feedback and testing by Andy Piper (andyp@parallax.co.uk). @@ -15,7 +16,6 @@ details. */ #include #include #include "cygerrno.h" -#include "security.h" #include "path.h" #include "fhandler.h" diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 742f1e7f8..fc5f4a161 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -1,7 +1,7 @@ /* fork.cc Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006, - 2007, 2008 Red Hat, Inc. + 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -14,7 +14,6 @@ details. */ #include #include #include "cygerrno.h" -#include "security.h" #include "path.h" #include "fhandler.h" #include "dtable.h" @@ -24,7 +23,6 @@ details. */ #include "child_info.h" #include "cygtls.h" #include "tls_pbuf.h" -#include "perprocess.h" #include "dll_init.h" #include "cygmalloc.h" diff --git a/winsup/cygwin/glob.cc b/winsup/cygwin/glob.cc index 6534249a7..6bb97c19a 100644 --- a/winsup/cygwin/glob.cc +++ b/winsup/cygwin/glob.cc @@ -102,8 +102,6 @@ __FBSDID("$FreeBSD: /repoman/r/ncvs/src/lib/libc/gen/glob.c,v 1.25 2006/06/05 18 #undef MAXPATHLEN #define MAXPATHLEN 16384 -extern BOOL ignore_case_with_glob; - #define DOLLAR '$' #define DOT '.' #define EOS '\0' diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc new file mode 100644 index 000000000..b87b070ef --- /dev/null +++ b/winsup/cygwin/globals.cc @@ -0,0 +1,115 @@ +/* globals.cc - Define global variables here. + + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 2006, 2007, 2008, 2009 Red Hat, Inc. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#define _GLOBALS_H 1 +#include "winsup.h" +#include "cygtls.h" +#include "perprocess.h" +#include "thread.h" +#include +#include + +HANDLE NO_COPY hMainProc = (HANDLE) -1; +HANDLE NO_COPY hMainThread; +HANDLE NO_COPY hProcToken; +HANDLE NO_COPY hProcImpToken; +HMODULE NO_COPY cygwin_hmodule; +HANDLE hExeced; + +/* Codepage and multibyte string specific stuff. */ +enum codepage_type {ansi_cp, oem_cp, utf8_cp}; +codepage_type current_codepage = ansi_cp; +UINT active_codepage; + +/* program exit the program */ + +enum exit_states + { + ES_NOT_EXITING = 0, + ES_PROCESS_LOCKED, + ES_GLOBAL_DTORS, + ES_EVENTS_TERMINATE, + ES_THREADTERM, + ES_SIGNAL, + ES_CLOSEALL, + ES_HUP_PGRP, + ES_HUP_SID, + ES_EXEC_EXIT, + ES_TITLE, + ES_TTY_TERMINATE, + ES_FINAL + }; + +exit_states NO_COPY exit_state; + +SYSTEM_INFO system_info; + +/* Set in init.cc. Used to check if Cygwin DLL is dynamically loaded. */ +int NO_COPY dynamically_loaded; + +bool display_title; +bool strip_title_path; +bool allow_glob = true; +bool NO_COPY in_forkee; + +int __argc_safe; +int __argc; +char **__argv; +#ifdef NEWVFORK +vfork_save NO_COPY *main_vfork; +#endif + +_cygtls NO_COPY *_main_tls /* !globals.h */; + +bool NO_COPY cygwin_finished_initializing; + +bool NO_COPY _cygwin_testing; + +char NO_COPY almost_null[1]; + +char *old_title; + +extern "C" +{ + /* This is an exported copy of environ which can be used by DLLs + which use cygwin.dll. */ + char **__cygwin_environ; + char ***main_environ = &__cygwin_environ; + /* __progname used in getopt error message */ + char *__progname; + static MTinterface _mtinterf; + struct per_process __cygwin_user_data = + {/* initial_sp */ 0, /* magic_biscuit */ 0, + /* dll_major */ CYGWIN_VERSION_DLL_MAJOR, + /* dll_major */ CYGWIN_VERSION_DLL_MINOR, + /* impure_ptr_ptr */ NULL, /* envptr */ NULL, + /* malloc */ malloc, /* free */ free, + /* realloc */ realloc, + /* fmode_ptr */ NULL, /* main */ NULL, /* ctors */ NULL, + /* dtors */ NULL, /* data_start */ NULL, /* data_end */ NULL, + /* bss_start */ NULL, /* bss_end */ NULL, + /* calloc */ calloc, + /* premain */ {NULL, NULL, NULL, NULL}, + /* run_ctors_p */ 0, + /* unused */ {0, 0, 0, 0, 0, 0, 0}, + /* UNUSED forkee */ 0, + /* hmodule */ NULL, + /* api_major */ CYGWIN_VERSION_API_MAJOR, + /* api_minor */ CYGWIN_VERSION_API_MINOR, + /* unused2 */ {0, 0, 0, 0, 0, 0}, + /* threadinterface */ &_mtinterf, + /* impure_ptr */ _GLOBAL_REENT, + }; + bool ignore_case_with_glob; + int _check_for_executable = true; +}; + +int NO_COPY __api_fatal_exit_val = 1; diff --git a/winsup/cygwin/gmon.c b/winsup/cygwin/gmon.c index 048ef0df1..981b41042 100644 --- a/winsup/cygwin/gmon.c +++ b/winsup/cygwin/gmon.c @@ -36,11 +36,8 @@ static char rcsid[] = "$OpenBSD: gmon.c,v 1.8 1997/07/23 21:11:27 kstailey Exp $ #endif #include -#include #include #include -#include -#include #include #include diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc index 1e633f432..52e2df7e1 100644 --- a/winsup/cygwin/init.cc +++ b/winsup/cygwin/init.cc @@ -1,7 +1,7 @@ /* init.cc Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006 Red Hat, Inc. + 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -16,7 +16,6 @@ details. */ static DWORD _my_oldfunc; -int NO_COPY dynamically_loaded; static char NO_COPY *search_for = (char *) cygthread::stub; unsigned threadfunc_ix[8] __attribute__((section (".cygwin_dll_common"), shared)); extern cygthread *hwait_sig; @@ -113,8 +112,6 @@ respawn_wow64_process () extern void __stdcall dll_crt0_0 (); -HMODULE NO_COPY cygwin_hmodule; - extern "C" BOOL WINAPI dll_entry (HANDLE h, DWORD reason, void *static_load) { diff --git a/winsup/cygwin/ioctl.cc b/winsup/cygwin/ioctl.cc index 3bd019dae..ffcdbded4 100644 --- a/winsup/cygwin/ioctl.cc +++ b/winsup/cygwin/ioctl.cc @@ -1,6 +1,7 @@ /* ioctl.cc: ioctl routines. - Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2006 Red Hat, Inc. + Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2008, 2009 + Red Hat, Inc. Written by Doug Evans of Cygnus Support dje@cygnus.com @@ -13,7 +14,6 @@ details. */ #include "winsup.h" #include "cygerrno.h" -#include "security.h" #include "path.h" #include "fhandler.h" #include "dtable.h" diff --git a/winsup/cygwin/lib/_cygwin_crt0_common.cc b/winsup/cygwin/lib/_cygwin_crt0_common.cc index 935b84f31..a81c3e932 100644 --- a/winsup/cygwin/lib/_cygwin_crt0_common.cc +++ b/winsup/cygwin/lib/_cygwin_crt0_common.cc @@ -1,6 +1,6 @@ -/* common.cc: common crt0 function for cygwin crt0's. +/* _cygwin_crt0_common.cc: common crt0 function for cygwin crt0's. - Copyright 2000, 2001 Red Hat, Inc. + Copyright 2000, 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -9,11 +9,7 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ #include "winsup.h" -#include "perprocess.h" -#include "cygwin/version.h" #include "crt0.h" -#include -#include /* Avoid an info message from linker when linking applications. */ extern __declspec(dllimport) struct _reent *_impure_ptr; diff --git a/winsup/cygwin/lib/cygwin_crt0.c b/winsup/cygwin/lib/cygwin_crt0.c index fdd2d8d5f..a3aa07773 100644 --- a/winsup/cygwin/lib/cygwin_crt0.c +++ b/winsup/cygwin/lib/cygwin_crt0.c @@ -1,6 +1,6 @@ /* cygwin_crt0.cc: crt0 for cygwin - Copyright 2000, 2001 Red Hat, Inc. + Copyright 2000, 2001, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -9,7 +9,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ #undef __INSIDE_CYGWIN__ -#include #include "crt0.h" extern void __stdcall _dll_crt0 () diff --git a/winsup/cygwin/lib/dll_main.cc b/winsup/cygwin/lib/dll_main.cc index a224a0a2f..7f977f689 100644 --- a/winsup/cygwin/lib/dll_main.cc +++ b/winsup/cygwin/lib/dll_main.cc @@ -1,17 +1,14 @@ /* dll_main.cc: Provide the DllMain stub that the user can override. - Copyright 1998, 2000, 2001 Red Hat, Inc. + Copyright 1998, 2000, 2001, 2009 Red Hat, Inc. This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ -#include #define WIN32_LEAN_AND_MEAN #include -#undef WIN32_LEAN_AND_MEAN -#include extern "C" BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, diff --git a/winsup/cygwin/lib/libcmain.c b/winsup/cygwin/lib/libcmain.c index da2a69839..d1faba1b3 100644 --- a/winsup/cygwin/lib/libcmain.c +++ b/winsup/cygwin/lib/libcmain.c @@ -1,6 +1,6 @@ /* libcmain.c - Copyright 1996, 1997, 1998, 2000, 2001 Red Hat, Inc. + Copyright 1996, 1997, 1998, 2000, 2001, 2006, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -9,7 +9,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ #include -#include #define SP " \t\n" diff --git a/winsup/cygwin/libc/bsdlib.cc b/winsup/cygwin/libc/bsdlib.cc index 9d488c35a..23f6f2791 100644 --- a/winsup/cygwin/libc/bsdlib.cc +++ b/winsup/cygwin/libc/bsdlib.cc @@ -33,14 +33,10 @@ #include "winsup.h" #include #include -#include #include #include -#include #include #include -#include "cygerrno.h" -#include "thread.h" #include "cygtls.h" extern "C" int diff --git a/winsup/cygwin/libc/minires-os-if.c b/winsup/cygwin/libc/minires-os-if.c index 1908ccf62..3715c0847 100644 --- a/winsup/cygwin/libc/minires-os-if.c +++ b/winsup/cygwin/libc/minires-os-if.c @@ -1,6 +1,6 @@ /* minires-os-if.c. Stub synchronous resolver for Cygwin. - Copyright 2006, 2007 Red Hat, Inc. + Copyright 2006, 2007, 2008, 2009 Red Hat, Inc. Written by Pierre A. Humblet @@ -27,7 +27,6 @@ details. */ #include #include #include -#include /*********************************************************************** * write_record: Translates a Windows DNS record into a compressed record diff --git a/winsup/cygwin/mcount.c b/winsup/cygwin/mcount.c index dcdbc2b06..4f69864b3 100644 --- a/winsup/cygwin/mcount.c +++ b/winsup/cygwin/mcount.c @@ -35,7 +35,6 @@ static char rcsid[] = "$OpenBSD: mcount.c,v 1.6 1997/07/23 21:11:27 kstailey Exp $"; #endif -#include #include #include diff --git a/winsup/cygwin/mkglobals_h b/winsup/cygwin/mkglobals_h new file mode 100755 index 000000000..61cfef35c --- /dev/null +++ b/winsup/cygwin/mkglobals_h @@ -0,0 +1,29 @@ +#!/usr/bin/perl +my @argv = @ARGV; +$_ = join('', <>); +s/\n[^\n]*!globals.h[^\n]*\n/\n/sog; +s%/\*.*?\*/%%sog; +s/(enum\s.*?{.*?})/munge($1)/soge; +s/^(\s*)([a-zA-Z_])/$1extern $2/mog; +s/extern (extern|enum)/$1/sog; +s/\n\s*extern static[^\n]*\n/\n/sog; +s/\s+=.*?;/;/sog; +s/^\n+//sog; +s/#include "winsup\.h"\n//so; +s/-NL-/\n/sog; +s/-EQ-/=/sog; +s/\s+\n/\n/sog; +s/\n{2,}/\n/sog; +print <\@exclude, 'library=s'=>\@library, 'ar=s'=>\$ar, 'x!'=>\$x); + +die "$0: must specify --ar\n" unless defined $ar; +my $lib = shift or die "$0: missing lib argument\nusage: $0 lib [map-file]\n"; +$lib = Cwd::abs_path($lib); + +my %excludes = map {($_, 1)} @exclude; +my $libraries = join('|', map {quotemeta} @library); + +my %sources = (); +while (<>) { + my ($source, $file, $absfile); + if (m%^($libraries)\(([^)]*)\)%o) { + $source = $1; + $absfile = $file = $2; + } elsif (/^LOAD\s+(.*\.o)$/o) { + $source = '.'; + $file = $1; + $absfile = Cwd::abs_path($file); + } else { + next; + } + push @{$sources{$source}}, $absfile unless $excludes{$file} || $excludes{$source}; +} + +my $here = getcwd(); +my $dir = tempdir(CLEANUP=>1); +chdir $dir; +my @files = (); +for (sort keys %sources) { + if ($_ eq '.') { + xsystem '/bin/cp', '-a', @{$sources{$_}}, '.'; + } else { + xsystem $ar, 'x', $_, @{$sources{$_}}, '.'; + } + push @files, map {basename($_)} @{$sources{$_}}; +} + +unlink $lib; +xsystem $ar, 'crs', $lib, sort @files; +exit 0; + +sub xsystem(@) { + print join(' ', 'x', @_), "\n" if $x; + system(@_) == 0 or die "$0: @_[0] $_[1] $_[2]... exited with non-zero status\n"; +} diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc index 34b7b72ff..364c77b01 100644 --- a/winsup/cygwin/mount.cc +++ b/winsup/cygwin/mount.cc @@ -1,7 +1,7 @@ /* mount.cc: mount handling. Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008 Red Hat, Inc. + 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -30,6 +30,7 @@ details. */ #include "tls_pbuf.h" #include #include +#include /* Determine if path prefix matches current cygdrive */ #define iscygdrive(path) \ diff --git a/winsup/cygwin/mount.h b/winsup/cygwin/mount.h index 45e7a8484..c6c0bb1e0 100644 --- a/winsup/cygwin/mount.h +++ b/winsup/cygwin/mount.h @@ -1,7 +1,7 @@ /* mount.h: mount definitions. Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008 Red Hat, Inc. + 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -87,10 +87,6 @@ class mount_item scheme should be satisfactory for a long while yet. */ #define MAX_MOUNTS 30 -#define USER_VERSION 1 // increment when mount table changes and -#define USER_VERSION_MAGIC CYGWIN_VERSION_MAGIC (USER_MAGIC, USER_VERSION) -#define CURR_USER_MAGIC 0xb2232e71U - class reg_key; struct device; diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index ccbd9164f..f44650a4a 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -1,7 +1,7 @@ /* path.cc: path support. Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008 Red Hat, Inc. + 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -75,6 +75,13 @@ bool dos_file_warning = true; +suffix_info stat_suffixes[] = +{ + suffix_info ("", 1), + suffix_info (".exe", 1), + suffix_info (NULL) +}; + struct symlink_info { char contents[SYMLINK_MAX + 1]; diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index 300388f64..f5062b8d6 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -1,7 +1,7 @@ /* pinfo.cc: process table support Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008 Red Hat, Inc. + 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -419,8 +419,6 @@ _pinfo::alive () return !!h; } -extern char **__argv; - DWORD WINAPI commune_process (void *arg) { @@ -444,7 +442,6 @@ commune_process (void *arg) { sigproc_printf ("processing PICOM_CMDLINE"); unsigned n = 0; - extern int __argc_safe; const char *argv[__argc_safe + 1]; for (int i = 0; i < __argc_safe; i++) diff --git a/winsup/cygwin/poll.cc b/winsup/cygwin/poll.cc index e7f8da5ad..b7f452ddb 100644 --- a/winsup/cygwin/poll.cc +++ b/winsup/cygwin/poll.cc @@ -1,6 +1,7 @@ /* poll.cc. Implements poll(2) via usage of select(2) call. - Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc. + Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + Red Hat, Inc. This file is part of Cygwin. @@ -13,11 +14,9 @@ #define FD_SETSIZE 16384 // lots of fds #include "winsup.h" #include -#include #include #define USE_SYS_TYPES_FD_SET #include "cygerrno.h" -#include "security.h" #include "path.h" #include "fhandler.h" #include "dtable.h" diff --git a/winsup/cygwin/profil.c b/winsup/cygwin/profil.c index cbfffc1b2..a4f64ae2c 100644 --- a/winsup/cygwin/profil.c +++ b/winsup/cygwin/profil.c @@ -1,6 +1,6 @@ /* profil.c -- win32 profil.c equivalent - Copyright 1998, 1999, 2000, 2001 Red Hat, Inc. + Copyright 1998, 1999, 2000, 2001, 2003, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -9,10 +9,8 @@ details. */ #include -#include #include #include -#include #include diff --git a/winsup/cygwin/registry.cc b/winsup/cygwin/registry.cc index 2858bc4f5..47f8642f1 100644 --- a/winsup/cygwin/registry.cc +++ b/winsup/cygwin/registry.cc @@ -1,7 +1,7 @@ /* registry.cc: registry interface Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008 Red Hat, Inc. + 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -11,8 +11,6 @@ details. */ #include "winsup.h" #include "registry.h" -#include "security.h" -#include #include "cygerrno.h" #include "path.h" #include "fhandler.h" diff --git a/winsup/cygwin/security.h b/winsup/cygwin/security.h index 0f194bade..5799beb7c 100644 --- a/winsup/cygwin/security.h +++ b/winsup/cygwin/security.h @@ -1,6 +1,7 @@ /* security.h: security declarations - Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. + Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + Red Hat, Inc. This file is part of Cygwin. @@ -336,6 +337,7 @@ legal_sid_type (SID_NAME_USE type) || type == SidTypeAlias || type == SidTypeWellKnownGroup; } +class path_conv; /* File manipulation */ int __stdcall get_file_attribute (HANDLE, path_conv &, mode_t *, __uid32_t *, __gid32_t *); diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index 505c4e3d0..20e3821a7 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -1,7 +1,7 @@ /* shared.cc: shared data area support. Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008 Red Hat, Inc. + 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -34,7 +34,6 @@ HANDLE NO_COPY cygwin_user_h; /* This function returns a handle to the top-level directory in the global NT namespace used to implement global objects including shared memory. */ -extern bool _cygwin_testing; HANDLE get_shared_parent_dir () diff --git a/winsup/cygwin/shared_info.h b/winsup/cygwin/shared_info.h index 97b46c5a2..668557ff7 100644 --- a/winsup/cygwin/shared_info.h +++ b/winsup/cygwin/shared_info.h @@ -1,6 +1,6 @@ /* shared_info.h: shared info for cygwin - Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008 Red Hat, Inc. + Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -33,6 +33,10 @@ public: #define CURR_SHARED_MAGIC 0x398d8baU +#define USER_VERSION 1 // increment when mount table changes and +#define USER_VERSION_MAGIC CYGWIN_VERSION_MAGIC (USER_MAGIC, USER_VERSION) +#define CURR_USER_MAGIC 0xb2232e71U + /* NOTE: Do not make gratuitous changes to the names or organization of the below class. The layout is checksummed to determine compatibility between different cygwin versions. */ diff --git a/winsup/cygwin/smallprint.cc b/winsup/cygwin/smallprint.cc index 44fc05134..b646a9cee 100644 --- a/winsup/cygwin/smallprint.cc +++ b/winsup/cygwin/smallprint.cc @@ -1,6 +1,6 @@ /* smallprint.cc: small print routines for WIN32 - Copyright 1996, 1998, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008 + Copyright 1996, 1998, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -61,7 +61,7 @@ __rn (char *dst, int base, int dosign, long long val, int len, int pad, unsigned return dst; } -extern "C" int +int __small_vsprintf (char *dst, const char *fmt, va_list ap) { char tmp[NT_MAX_PATH]; @@ -223,7 +223,7 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap) return dst - orig; } -extern "C" int +int __small_sprintf (char *dst, const char *fmt, ...) { int r; @@ -234,7 +234,7 @@ __small_sprintf (char *dst, const char *fmt, ...) return r; } -extern "C" void +void small_printf (const char *fmt, ...) { char buf[16384]; @@ -261,7 +261,7 @@ small_printf (const char *fmt, ...) #ifdef DEBUGGING static HANDLE NO_COPY console_handle = NULL; -extern "C" void +void console_printf (const char *fmt, ...) { char buf[16384]; @@ -329,7 +329,7 @@ __wrn (PWCHAR dst, int base, int dosign, long long val, int len, int pad, unsign return dst; } -extern "C" int +int __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap) { WCHAR tmp[NT_MAX_PATH]; @@ -466,7 +466,7 @@ __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap) return dst - orig; } -extern "C" int +int __small_swprintf (PWCHAR dst, const WCHAR *fmt, ...) { int r; diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index b84a142c9..bb8a75fe6 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -1,7 +1,7 @@ /* spawn.cc Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008 Red Hat, Inc. + 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -50,7 +50,6 @@ static suffix_info dll_suffixes[] = suffix_info (NULL) }; -HANDLE hExeced; child_info_spawn *chExeced; /* Add .exe to PROG if not already present and see if that exists. @@ -260,7 +259,7 @@ do_cleanup (void *args) } -int __stdcall +int spawn_guts (const char *prog_arg, const char *const *argv, const char *const envp[], int mode, int __stdin, int __stdout) { diff --git a/winsup/cygwin/speclib b/winsup/cygwin/speclib index 31c7113d8..5f73fed75 100755 --- a/winsup/cygwin/speclib +++ b/winsup/cygwin/speclib @@ -55,7 +55,7 @@ for (@headtail) { $extract{$_} = 1; } -my $dir = tempdir(); +my $dir = tempdir(CLEANUP => 1); chdir $dir; # print join(' ', '+', $ar, 'x', sort keys %extract), "\n"; diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc index b9af9df91..04fb0eef6 100644 --- a/winsup/cygwin/strace.cc +++ b/winsup/cygwin/strace.cc @@ -1,7 +1,7 @@ /* strace.cc: system/windows tracing Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008 Red Hat, Inc. + 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -121,8 +121,6 @@ mypid (char *buf) return buf; } -extern "C" char *__progname; - /* sprintf analog for use by output routines. */ int strace::vsprntf (char *buf, const char *func, const char *infmt, va_list ap) diff --git a/winsup/cygwin/strfuncs.cc b/winsup/cygwin/strfuncs.cc index 8c0bbb241..e051cd7b4 100644 --- a/winsup/cygwin/strfuncs.cc +++ b/winsup/cygwin/strfuncs.cc @@ -1,7 +1,7 @@ /* strfuncs.cc: misc funcs that don't belong anywhere else Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008 Red Hat, Inc. + 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -21,9 +21,6 @@ details. */ #include "dtable.h" #include "cygheap.h" -codepage_type current_codepage = ansi_cp; -UINT active_codepage = 0; - UINT get_cp () { diff --git a/winsup/cygwin/sync.cc b/winsup/cygwin/sync.cc index 6bd0ecf66..8fa0d93f0 100644 --- a/winsup/cygwin/sync.cc +++ b/winsup/cygwin/sync.cc @@ -4,9 +4,7 @@ which is intended to operate similarly to a mutex but attempts to avoid making expensive calls to the kernel. - Copyright 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. - - Written by Christopher Faylor + Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -23,6 +21,7 @@ details. */ #undef WaitForSingleObject DWORD NO_COPY muto::exiting_thread; +muto NO_COPY lock_process::locker; void muto::grab () diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 7100ce36b..858413cde 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1,7 +1,7 @@ /* syscalls.cc: syscalls Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008 Red Hat, Inc. + 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -72,15 +72,6 @@ details. */ #undef _lseek64 #undef _fstat64 -suffix_info stat_suffixes[] = -{ - suffix_info ("", 1), - suffix_info (".exe", 1), - suffix_info (NULL) -}; - -SYSTEM_INFO system_info; - static int __stdcall mknod_worker (const char *, mode_t, mode_t, _major_t, _minor_t); diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h index 3f6de8fba..db94fd2c2 100644 --- a/winsup/cygwin/thread.h +++ b/winsup/cygwin/thread.h @@ -1,7 +1,7 @@ /* thread.h: Locking and threading module definitions Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, - 2008 Red Hat, Inc. + 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -19,7 +19,7 @@ details. */ #include #include -#include +#include "security.h" #include enum cw_sig_wait diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index 4b78cab61..f89a72a5e 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -1,7 +1,7 @@ /* times.cc Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007 Red Hat, Inc. + 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -9,8 +9,8 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ -#include "winsup.h" #define __timezonefunc__ +#include "winsup.h" #include #include #include diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc index 6341eb11c..f831a536d 100644 --- a/winsup/cygwin/tty.cc +++ b/winsup/cygwin/tty.cc @@ -1,6 +1,6 @@ /* tty.cc - Copyright 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008 + Copyright 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -100,7 +100,7 @@ tty::create_master (int ttynum) ttym.setunit (ttynum); /* CGF FIXME device */ tty_master = (fhandler_tty_master *) build_fh_dev (ttym); if (tty_master->init ()) - api_fatal ("Can't create master tty"); + api_fatal ("can't create master tty"); else { /* Log utmp entry */ diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index f4e41796a..97980eafd 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -1,7 +1,7 @@ /* winsup.h: main Cygwin header file. Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008 Red Hat, Inc. + 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -36,17 +36,17 @@ details. */ #ifdef __cplusplus extern "C" { #endif -extern __uid32_t getuid32 (); -extern __uid32_t geteuid32 (); -extern int seteuid32 (__uid32_t); -extern __gid32_t getegid32 (void); -extern struct passwd *getpwuid32 (__uid32_t); -extern struct passwd *getpwnam (const char *); -extern struct __sFILE64 *fopen64 (const char *, const char *); -extern struct hostent *cygwin_gethostbyname (const char *name); +__uid32_t getuid32 (); +__uid32_t geteuid32 (); +int seteuid32 (__uid32_t); +__gid32_t getegid32 (void); +struct passwd *getpwuid32 (__uid32_t); +struct passwd *getpwnam (const char *); +struct __sFILE64 *fopen64 (const char *, const char *); +struct hostent *cygwin_gethostbyname (const char *name); /* Don't enforce definition of in_addr_t. */ -extern uint32_t cygwin_inet_addr (const char *cp); -extern int fcntl64 (int fd, int cmd, ...); +uint32_t cygwin_inet_addr (const char *cp); +int fcntl64 (int fd, int cmd, ...); #ifdef __cplusplus } #endif @@ -104,11 +104,6 @@ extern const char case_folded_upper[]; /* The one function we use from winuser.h most of the time */ extern "C" DWORD WINAPI GetLastError (void); -/* Codepage and multibyte string specific stuff. */ -enum codepage_type {ansi_cp, oem_cp, utf8_cp}; -extern codepage_type current_codepage; -extern UINT active_codepage; - void codepage_init (const char *buf); UINT get_cp (); @@ -127,7 +122,6 @@ int __stdcall sys_mbstowcs_alloc (PWCHAR *, int, const char *, int = -1) __attribute__ ((regparm(3))); /* Used to check if Cygwin DLL is dynamically loaded. */ -extern int dynamically_loaded; extern int cygserver_running; @@ -137,9 +131,6 @@ extern int cygserver_running; #include "debug.h" -/* Events/mutexes */ -extern HANDLE tty_mutex; - /**************************** Convenience ******************************/ /* Used to define status flag accessor methods */ @@ -163,7 +154,6 @@ extern HANDLE tty_mutex; /* Convert a signal to a signal mask */ #define SIGTOMASK(sig) (1 << ((sig) - 1)) -extern int __api_fatal_exit_val; #define set_api_fatal_return(n) do {extern int __api_fatal_exit_val; __api_fatal_exit_val = (n);} while (0) #define api_fatal(fmt, args...) __api_fatal (fmt,## args) @@ -191,38 +181,17 @@ class per_process; /* cygwin .dll initialization */ void dll_crt0 (per_process *) __asm__ ("_dll_crt0__FP11per_process"); extern "C" void __stdcall _dll_crt0 (); -extern void dll_crt0_1 (void *); -extern void dll_dllcrt0_1 (void *); -extern int __stdcall spawn_guts (const char * prog_arg, const char *const *argv, - const char *const envp[], int mode, - int __stdin = -1, int __stdout = -1); +void dll_crt0_1 (void *); +void dll_dllcrt0_1 (void *); +int spawn_guts (const char * prog_arg, const char *const *argv, + const char *const envp[], int mode, int __stdin = -1, + int __stdout = -1) __attribute__ ((regparm(3))); /* dynamically loaded dll initialization */ extern "C" int dll_dllcrt0 (HMODULE, per_process *); /* dynamically loaded dll initialization for non-cygwin apps */ extern "C" int dll_noncygwin_dllcrt0 (HMODULE, per_process *); - -/* exit the program */ - -enum exit_states - { - ES_NOT_EXITING = 0, - ES_PROCESS_LOCKED, - ES_GLOBAL_DTORS, - ES_EVENTS_TERMINATE, - ES_THREADTERM, - ES_SIGNAL, - ES_CLOSEALL, - ES_HUP_PGRP, - ES_HUP_SID, - ES_EXEC_EXIT, - ES_TITLE, - ES_TTY_TERMINATE, - ES_FINAL - }; - -extern exit_states exit_state; void __stdcall do_exit (int) __attribute__ ((regparm (1), noreturn)); /* UID/GID */ @@ -253,8 +222,6 @@ extern "C" int try_to_debug (bool waitloop = 1); void ld_preload (); const char *find_first_notloaded_dll (class path_conv &); -void set_file_api_mode (codepage_type); - extern bool cygwin_finished_initializing; /**************************** Miscellaneous ******************************/ @@ -293,11 +260,11 @@ extern bool wsock_started; /* Printf type functions */ extern "C" void __api_fatal (const char *, ...) __attribute__ ((noreturn)); -extern "C" int __small_sprintf (char *dst, const char *fmt, ...) /*__attribute__ ((regparm (2)))*/; -extern "C" int __small_vsprintf (char *dst, const char *fmt, va_list ap) /*__attribute__ ((regparm (3)))*/; -extern "C" int __small_swprintf (PWCHAR dst, const WCHAR *fmt, ...) /*__attribute__ ((regparm (2)))*/; -extern "C" int __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap) /*__attribute__ ((regparm (3)))*/; -extern void multiple_cygwin_problem (const char *, unsigned, unsigned); +int __small_sprintf (char *dst, const char *fmt, ...) /*__attribute__ ((regparm (2)))*/; +int __small_vsprintf (char *dst, const char *fmt, va_list ap) /*__attribute__ ((regparm (3)))*/; +int __small_swprintf (PWCHAR dst, const WCHAR *fmt, ...) /*__attribute__ ((regparm (2)))*/; +int __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap) /*__attribute__ ((regparm (3)))*/; +void multiple_cygwin_problem (const char *, unsigned, unsigned); extern "C" void vklog (int priority, const char *message, va_list ap); extern "C" void klog (int priority, const char *message, ...); @@ -336,11 +303,6 @@ extern "C" { int cygwin_select (int , fd_set *, fd_set *, fd_set *, struct timeval *to); int cygwin_gethostname (char *__name, size_t __len); - -extern char _data_start__, _data_end__, _bss_start__, _bss_end__; -extern void (*__CTOR_LIST__) (void); -extern void (*__DTOR_LIST__) (void); -extern SYSTEM_INFO system_info; }; /*************************** Unsorted ******************************/ @@ -355,18 +317,13 @@ extern SYSTEM_INFO system_info; #define NO_R ~(S_IRUSR | S_IRGRP | S_IROTH) #define NO_X ~(S_IXUSR | S_IXGRP | S_IXOTH) -/* The title on program start. */ -extern char *old_title; -extern bool display_title; -extern bool transparent_exe; -extern bool in_forkee; - -extern HANDLE hMainThread; -extern HANDLE hMainProc; -extern HANDLE hProcToken; -extern HANDLE hProcImpToken; +extern "C" char _data_start__, _data_end__, _bss_start__, _bss_end__; +extern "C" void (*__CTOR_LIST__) (void); +extern "C" void (*__DTOR_LIST__) (void); +#if !defined(_GLOBALS_H) +#include "globals.h" inline void clear_procimptoken () { if (hProcImpToken) @@ -377,11 +334,7 @@ inline void clear_procimptoken () } } -extern HANDLE hExeced; -extern HMODULE cygwin_hmodule; - -extern bool cygwin_testing; - -extern char almost_null[]; +void set_file_api_mode (codepage_type); +#endif #endif /* defined __cplusplus */