OSDN Git Service

Remove unneeded header files from source files throughout. Update copyrights
authorcgf <cgf>
Sat, 3 Jan 2009 05:12:19 +0000 (05:12 +0000)
committercgf <cgf>
Sat, 3 Jan 2009 05:12:19 +0000 (05:12 +0000)
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.

59 files changed:
winsup/cygwin/ChangeLog
winsup/cygwin/Makefile.in
winsup/cygwin/assert.cc
winsup/cygwin/cxx.cc
winsup/cygwin/cygthread.cc
winsup/cygwin/cygtls.cc
winsup/cygwin/cygtls.h
winsup/cygwin/dcrt0.cc
winsup/cygwin/debug.cc
winsup/cygwin/devices.cc
winsup/cygwin/devices.in
winsup/cygwin/environ.cc
winsup/cygwin/exceptions.cc
winsup/cygwin/fhandler_clipboard.cc
winsup/cygwin/fhandler_mailslot.cc
winsup/cygwin/fhandler_mem.cc
winsup/cygwin/fhandler_nodevice.cc
winsup/cygwin/fhandler_random.cc
winsup/cygwin/fhandler_raw.cc
winsup/cygwin/fhandler_serial.cc
winsup/cygwin/fhandler_termios.cc
winsup/cygwin/fhandler_virtual.cc
winsup/cygwin/fhandler_windows.cc
winsup/cygwin/fork.cc
winsup/cygwin/glob.cc
winsup/cygwin/globals.cc [new file with mode: 0644]
winsup/cygwin/gmon.c
winsup/cygwin/init.cc
winsup/cygwin/ioctl.cc
winsup/cygwin/lib/_cygwin_crt0_common.cc
winsup/cygwin/lib/cygwin_crt0.c
winsup/cygwin/lib/dll_main.cc
winsup/cygwin/lib/libcmain.c
winsup/cygwin/libc/bsdlib.cc
winsup/cygwin/libc/minires-os-if.c
winsup/cygwin/mcount.c
winsup/cygwin/mkglobals_h [new file with mode: 0755]
winsup/cygwin/mkstatic [new file with mode: 0755]
winsup/cygwin/mount.cc
winsup/cygwin/mount.h
winsup/cygwin/path.cc
winsup/cygwin/pinfo.cc
winsup/cygwin/poll.cc
winsup/cygwin/profil.c
winsup/cygwin/registry.cc
winsup/cygwin/security.h
winsup/cygwin/shared.cc
winsup/cygwin/shared_info.h
winsup/cygwin/smallprint.cc
winsup/cygwin/spawn.cc
winsup/cygwin/speclib
winsup/cygwin/strace.cc
winsup/cygwin/strfuncs.cc
winsup/cygwin/sync.cc
winsup/cygwin/syscalls.cc
winsup/cygwin/thread.h
winsup/cygwin/times.cc
winsup/cygwin/tty.cc
winsup/cygwin/winsup.h

index 7395317..88c6a55 100644 (file)
@@ -1,3 +1,52 @@
 2009-01-02  Christopher Faylor  <me+cygwin@cgf.cx>
 
+       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  <me+cygwin@cgf.cx>
+
        * speclib: Rewrite completely in perl.  Avoid multiple nm calls.
index 4c433ff..6fd0882 100644 (file)
@@ -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
 
index 8b8c181..a47a382 100644 (file)
@@ -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 <wingdi.h>
 #include <winuser.h>
 
index 1cee576..6021b4f 100644 (file)
@@ -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 <stdlib.h>
 
 void *
 operator new (size_t s)
index 4c674ed..b0aea36 100644 (file)
@@ -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 <stdlib.h>
 #include "sigproc.h"
-#include "thread.h"
 #include "cygtls.h"
 
 #undef CloseHandle
index 3d15ae6..1d8153a 100644 (file)
@@ -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 <syslog.h>
-#include <malloc.h>
 #include "path.h"
 #include "fhandler.h"
 #include "dtable.h"
index 7aee1ae..5b944eb 100644 (file)
@@ -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 <signal.h>
 #include <pwd.h>
 #include <grp.h>
-#include <sys/time.h>
+#include <time.h>
 #define _NOMNTENT_FUNCS
 #include <mntent.h>
 #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)));
index 961e605..9ffbd72 100644 (file)
@@ -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 <stdlib.h>
 #include "glob.h"
 #include <ctype.h>
+#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 cygwin_exit (int) __attribute__ ((noreturn));
 extern "C" void __sinit (_reent *);
 
-_cygtls NO_COPY *_main_tls;
-
-bool NO_COPY cygwin_finished_initializing;
-
-MTinterface _mtinterf;
-
-bool NO_COPY _cygwin_testing;
-
-char NO_COPY almost_null[1];
+static int NO_COPY envc;
+static char NO_COPY **envp;
 
-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)
 {
index 87d35c7..232a7b8 100644 (file)
@@ -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"
index 3391ad5..1f4bb95 100644 (file)
@@ -1,10 +1,6 @@
 
 
 #include "winsup.h"
-#include <sys/types.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
 #include "devices.h"
 #include "sys/cygwin.h"
 #include "tty.h"
index e5d9720..bbe8296 100644 (file)
@@ -1,9 +1,5 @@
 %import {
 #include "winsup.h"
-#include <sys/types.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
 #include "devices.h"
 #include "sys/cygwin.h"
 #include "tty.h"
index 2c42675..4b8cb03 100644 (file)
@@ -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;
index 4428d49..6a468cf 100644 (file)
@@ -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 <wingdi.h>
@@ -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 *)
 {
index d4b9743..86304de 100644 (file)
@@ -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 <stdlib.h>
 #include <wchar.h>
 #include <wingdi.h>
 #include <winuser.h>
 #include "cygerrno.h"
-#include "security.h"
 #include "path.h"
 #include "fhandler.h"
 
index edbb094..dda4d33 100644 (file)
@@ -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"
index 3d277f2..9683d90 100644 (file)
@@ -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 <unistd.h>
 
 #include "cygerrno.h"
-#include "security.h"
 #include "path.h"
 #include "fhandler.h"
 #include "ntdll.h"
index cb3b61e..4ffe2c4 100644 (file)
@@ -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"
 
index b8784b0..09d70c5 100644 (file)
@@ -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 <limits.h>
 #include <unistd.h>
 #include "cygerrno.h"
-#include "security.h"
 #include "path.h"
 #include "fhandler.h"
 
index 8c46ab6..5ffe8c1 100644 (file)
@@ -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 <cygwin/rdevio.h>
 #include <sys/mtio.h>
 #include "cygerrno.h"
-#include "security.h"
 #include "path.h"
 #include "fhandler.h"
 
index 36c6ee2..4843503 100644 (file)
@@ -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;
index caa98e7..8bdfdcd 100644 (file)
@@ -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 <stdlib.h>
 #include <ctype.h>
 #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 */
index ded5902..141fe7b 100644 (file)
@@ -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 <stdlib.h>
 #include <sys/acl.h>
 #include <sys/statvfs.h>
 #include "cygerrno.h"
-#include "security.h"
 #include "path.h"
 #include "fhandler.h"
 #include "dtable.h"
index 8232450..09ce3a0 100644 (file)
@@ -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 <wingdi.h>
 #include <winuser.h>
 #include "cygerrno.h"
-#include "security.h"
 #include "path.h"
 #include "fhandler.h"
 
index 742f1e7..fc5f4a1 100644 (file)
@@ -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 <unistd.h>
 #include <stdlib.h>
 #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"
 
index 6534249..6bb97c1 100644 (file)
@@ -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 (file)
index 0000000..b87b070
--- /dev/null
@@ -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 <malloc.h>
+#include <cygwin/version.h>
+
+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;
index 048ef0d..981b410 100644 (file)
@@ -36,11 +36,8 @@ static char rcsid[] = "$OpenBSD: gmon.c,v 1.8 1997/07/23 21:11:27 kstailey Exp $
 #endif
 
 #include <fcntl.h>
-#include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
-#include <sys/param.h>
-#include <sys/types.h>
 #include <gmon.h>
 
 #include <profil.h>
index 1e633f4..52e2df7 100644 (file)
@@ -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)
 {
index 3bd019d..ffcdbde 100644 (file)
@@ -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"
index 935b84f..a81c3e9 100644 (file)
@@ -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 <reent.h>
-#include <stdlib.h>
 
 /* Avoid an info message from linker when linking applications. */
 extern __declspec(dllimport) struct _reent *_impure_ptr;
index fdd2d8d..a3aa077 100644 (file)
@@ -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 <sys/cygwin.h>
 #include "crt0.h"
 
 extern void __stdcall _dll_crt0 ()
index a224a0a..7f977f6 100644 (file)
@@ -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 <windows.h>
 
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
-#include <stdio.h>
 
 extern "C"
 BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason,
index da2a698..d1faba1 100644 (file)
@@ -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 <windows.h>
-#include <string.h>
 
 #define SP " \t\n"
 
index 9d488c3..23f6f27 100644 (file)
 #include "winsup.h"
 #include <stdio.h>
 #include <stdlib.h>
-#include <stdarg.h>
 #include <utmp.h>
 #include <unistd.h>
-#include <sys/termios.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
-#include "cygerrno.h"
-#include "thread.h"
 #include "cygtls.h"
 
 extern "C" int
index 1908ccf..3715c08 100644 (file)
@@ -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 <Pierre.Humblet@ieee.org>
 
@@ -27,7 +27,6 @@ details. */
 #include <windows.h>
 #include <iphlpapi.h>
 #include <windns.h>
-#include <sys/cygwin.h>
 
 /***********************************************************************
  * write_record: Translates a Windows DNS record into a compressed record
index dcdbc2b..4f69864 100644 (file)
@@ -35,7 +35,6 @@
 static char rcsid[] = "$OpenBSD: mcount.c,v 1.6 1997/07/23 21:11:27 kstailey Exp $";
 #endif
 
-#include <sys/param.h>
 #include <sys/types.h>
 #include <gmon.h>
 
diff --git a/winsup/cygwin/mkglobals_h b/winsup/cygwin/mkglobals_h
new file mode 100755 (executable)
index 0000000..61cfef3
--- /dev/null
@@ -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 <<PRELUDE,$_,"#endif /*_GLOBALS_H*/\n";
+/* $target - Autogenerated from @argv.  Look there for comments. */
+
+#ifndef _GLOBALS_H
+#define _GLOBALS_H 1
+PRELUDE
+close $target_fd;
+sub munge($) {
+    my $val = shift;
+    $val =~ s/\n/-NL-/sog;
+    $val =~ s/=/-EQ-/sog;
+    return $val;
+}
diff --git a/winsup/cygwin/mkstatic b/winsup/cygwin/mkstatic
new file mode 100755 (executable)
index 0000000..b7a81b0
--- /dev/null
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+use strict;
+use Cwd;
+use Getopt::Long;
+use File::Temp qw/tempdir/;
+use File::Basename;
+
+sub xsystem(@);
+
+my @exclude = ();
+my @library = ();
+my $ar;
+our $x;
+GetOptions('exclude=s'=>\@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";
+}
index 34b7b72..364c77b 100644 (file)
@@ -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 <ntdll.h>
 #include <wchar.h>
+#include <stdio.h>
 
 /* Determine if path prefix matches current cygdrive */
 #define iscygdrive(path) \
index 45e7a84..c6c0bb1 100644 (file)
@@ -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;
 
index ccbd916..f44650a 100644 (file)
@@ -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.
 
 
 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];
index 300388f..f5062b8 100644 (file)
@@ -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++)
index e7f8da5..b7f452d 100644 (file)
@@ -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.
 
 #define FD_SETSIZE 16384               // lots of fds
 #include "winsup.h"
 #include <sys/poll.h>
-#include <sys/socket.h>
 #include <stdlib.h>
 #define USE_SYS_TYPES_FD_SET
 #include "cygerrno.h"
-#include "security.h"
 #include "path.h"
 #include "fhandler.h"
 #include "dtable.h"
index cbfffc1..a4f64ae 100644 (file)
@@ -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 <windows.h>
-#include <stdio.h>
 #include <sys/types.h>
 #include <errno.h>
-#include <math.h>
 
 #include <profil.h>
 
index 2858bc4..47f8642 100644 (file)
@@ -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 <cygwin/version.h>
 #include "cygerrno.h"
 #include "path.h"
 #include "fhandler.h"
index 0f194ba..5799beb 100644 (file)
@@ -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 *);
index 505c4e3..20e3821 100644 (file)
@@ -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 ()
index 97b46c5..668557f 100644 (file)
@@ -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. */
index 44fc051..b646a9c 100644 (file)
@@ -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;
index b84a142..bb8a75f 100644 (file)
@@ -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)
 {
index 31c7113..5f73fed 100755 (executable)
@@ -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";
index b9af9df..04fb0ee 100644 (file)
@@ -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)
index 8c0bbb2..e051cd7 100644 (file)
@@ -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 ()
 {
index 6bd0ecf..8fa0d93 100644 (file)
@@ -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 <cgf@cygnus.com>
+   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 ()
index 7100ce3..858413c 100644 (file)
@@ -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);
 
index 3f6de8f..db94fd2 100644 (file)
@@ -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 <pthread.h>
 #include <limits.h>
-#include <security.h>
+#include "security.h"
 #include <errno.h>
 
 enum cw_sig_wait
index 4b78cab..f89a72a 100644 (file)
@@ -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 <sys/times.h>
 #include <sys/timeb.h>
 #include <utime.h>
index 6341eb1..f831a53 100644 (file)
@@ -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 */
index f4e4179..97980ea 100644 (file)
@@ -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 */