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.
This commit is contained in:
Christopher Faylor 2009-01-03 05:12:22 +00:00
parent 258776ce91
commit 66a83f3eac
59 changed files with 410 additions and 308 deletions

View 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> 2009-01-02 Christopher Faylor <me+cygwin@cgf.cx>
* speclib: Rewrite completely in perl. Avoid multiple nm calls. * speclib: Rewrite completely in perl. Avoid multiple nm calls.

View File

@ -1,6 +1,6 @@
# Makefile.in for Cygwin. # Makefile.in for Cygwin.
# Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 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. # This file is part of Cygwin.
# #
@ -55,7 +55,7 @@ CC:=@CC@
# FIXME: Which is it, CC or CC_FOR_TARGET? # FIXME: Which is it, CC or CC_FOR_TARGET?
CC_FOR_TARGET:=$(CC) CC_FOR_TARGET:=$(CC)
CFLAGS=@CFLAGS@ CFLAGS=@CFLAGS@
override CFLAGS+=-MMD ${$(*F)_CFLAGS} -fmerge-constants -ftracer $(CCEXTRA) override CFLAGS+=-MMD ${$(*F)_CFLAGS} -Werror -fmerge-constants -ftracer $(CCEXTRA)
CXX=@CXX@ CXX=@CXX@
override CXXFLAGS=@CXXFLAGS@ override CXXFLAGS=@CXXFLAGS@
@ -98,6 +98,7 @@ RUNTESTFLAGS =
DLL_NAME:=cygwin1.dll DLL_NAME:=cygwin1.dll
TEST_DLL_NAME:=cygwin0.dll TEST_DLL_NAME:=cygwin0.dll
TEST_LIB_NAME:=libcygwin0.a TEST_LIB_NAME:=libcygwin0.a
STATIC_LIB_NAME:=libcygwin_s.a
DEF_FILE:=cygwin.def DEF_FILE:=cygwin.def
DLL_ENTRY:=@DLL_ENTRY@ 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_registry.o fhandler_serial.o fhandler_socket.o fhandler_tape.o \
fhandler_termios.o fhandler_tty.o fhandler_virtual.o fhandler_windows.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 \ 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 \ 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 \ 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 \ 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 \ xsique.o \
$(EXTRA_DLL_OFILES) $(EXTRA_OFILES) $(MALLOC_OFILES) $(MT_SAFE_OBJECTS) $(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 GMON_OFILES:=gmon.o mcount.o profil.o
OBSOLETE_FUNCTIONS:=open acl aclcheck aclfrommode aclfrompbits \ 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 $@ \ -Wl,--heap=0 -Wl,--out-implib,cygdll.a -shared -o $@ \
-e $(DLL_ENTRY) $(DEF_FILE) $(DLL_OFILES) version.o winver.o \ -e $(DLL_ENTRY) $(DEF_FILE) $(DLL_OFILES) version.o winver.o \
$(MALLOC_OBJ) $(LIBSERVER) $(LIBM) $(LIBC) \ $(MALLOC_OBJ) $(LIBSERVER) $(LIBM) $(LIBC) \
-lgcc $(DLL_IMPORTS) -lgcc $(DLL_IMPORTS) -Wl,-Map,cygwin.map
@$(word 2,$^) $(OBJDUMP) $(OBJCOPY) $@ ${patsubst %0.dll,%1.dbg,$@} @$(word 2,$^) $(OBJDUMP) $(OBJCOPY) $@ ${patsubst %0.dll,%1.dbg,$@}
@ln -f $@ new-$(DLL_NAME) @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 (echo create $(LIB_NAME); echo addmod $(LIBCOS); echo addlib cygdll.a; echo save) | $(AR) -M
$(RANLIB) $@ $(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 # Rule to make stub library used by testsuite
# dependency set to $(LIB_NAME) to accommodate make -j2. # dependency set to $(LIB_NAME) to accommodate make -j2.
# Otherwise dlltool gets confused. cgf (11-16-2000) # Otherwise dlltool gets confused. cgf (11-16-2000)
@ -412,8 +425,13 @@ $(API_VER): $(srcdir)/cygwin.din
version.cc winver.o: winver_stamp version.cc winver.o: winver_stamp
@ : @ :
globals.h: mkglobals_h globals.cc
$^ > $@
${DLL_OFILES}: globals.h
shared_info_magic.h: cygmagic shared_info.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 child_info_magic.h: cygmagic child_info.h
/bin/sh ${word 1,$^} $@ "$(CC) -x c" ${word 2,$^} CHILD_INFO_MAGIC 'class child_info' /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,$^} $@ ${wordlist 1,2,$^} $@
$(PWD)/libpthread.a: speclib $(LIB_NAME) pthread.o thread.o $(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 $(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) $(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 $(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 $(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 $(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 lib%.a: %.o
$(AR) cru $@ $? $(AR) cru $@ $?
@ -469,7 +487,7 @@ sigfe.s: $(DEF_FILE)
[ -s $@ ] && touch $@ [ -s $@ ] && touch $@
sigfe.o: sigfe.s sigfe.o: sigfe.s
$(CC) -c -o $@ $? $(CC) -c -o $@ $<
winsup.h: config.h winsup.h: config.h

View File

@ -1,6 +1,6 @@
/* assert.cc: Handle the assert macro for WIN32. /* 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. This file is part of Cygwin.
@ -9,7 +9,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */ details. */
#include "winsup.h" #include "winsup.h"
#include "security.h"
#include <wingdi.h> #include <wingdi.h>
#include <winuser.h> #include <winuser.h>

View File

@ -1,6 +1,6 @@
/* cxx.cc /* cxx.cc
Copyright 2002, 2003 Red Hat, Inc. Copyright 2002, 2003, 2005, 2009 Red Hat, Inc.
This file is part of Cygwin. This file is part of Cygwin.
@ -11,7 +11,6 @@ details. */
#if (__GNUC__ >= 3) #if (__GNUC__ >= 3)
#include "winsup.h" #include "winsup.h"
#include <stdlib.h>
void * void *
operator new (size_t s) operator new (size_t s)

View File

@ -1,6 +1,7 @@
/* cygthread.cc /* 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 This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for Cygwin license. Please consult the file "CYGWIN_LICENSE" for
@ -10,7 +11,6 @@ details. */
#include "miscfuncs.h" #include "miscfuncs.h"
#include <stdlib.h> #include <stdlib.h>
#include "sigproc.h" #include "sigproc.h"
#include "thread.h"
#include "cygtls.h" #include "cygtls.h"
#undef CloseHandle #undef CloseHandle

View File

@ -1,6 +1,6 @@
/* cygtls.cc /* 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 This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for Cygwin license. Please consult the file "CYGWIN_LICENSE" for
@ -8,10 +8,8 @@ details. */
#include "winsup.h" #include "winsup.h"
#define USE_SYS_TYPES_FD_SET #define USE_SYS_TYPES_FD_SET
#include "thread.h"
#include "cygtls.h" #include "cygtls.h"
#include <syslog.h> #include <syslog.h>
#include <malloc.h>
#include "path.h" #include "path.h"
#include "fhandler.h" #include "fhandler.h"
#include "dtable.h" #include "dtable.h"

View File

@ -1,6 +1,6 @@
/* cygtls.h /* 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 This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for Cygwin license. Please consult the file "CYGWIN_LICENSE" for
@ -12,7 +12,7 @@ details. */
#include <signal.h> #include <signal.h>
#include <pwd.h> #include <pwd.h>
#include <grp.h> #include <grp.h>
#include <sys/time.h> #include <time.h>
#define _NOMNTENT_FUNCS #define _NOMNTENT_FUNCS
#include <mntent.h> #include <mntent.h>
#undef _NOMNTENT_FUNCS #undef _NOMNTENT_FUNCS
@ -36,6 +36,10 @@ details. */
#define TP_NUM_C_BUFS 10 #define TP_NUM_C_BUFS 10
#define TP_NUM_W_BUFS 10 #define TP_NUM_W_BUFS 10
#ifdef CYGTLS_HANDLE
#include "thread.h"
#endif
#pragma pack(push,4) #pragma pack(push,4)
/* Defined here to support auto rebuild of tlsoffsets.h. */ /* Defined here to support auto rebuild of tlsoffsets.h. */
class tls_pathbuf class tls_pathbuf
@ -236,7 +240,7 @@ struct _cygtls
void copy_context (CONTEXT *) __attribute__ ((regparm(2))); void copy_context (CONTEXT *) __attribute__ ((regparm(2)));
void signal_debugger (int) __attribute__ ((regparm(2))); void signal_debugger (int) __attribute__ ((regparm(2)));
#ifdef _THREAD_H #ifdef CYGTLS_HANDLE
operator HANDLE () const {return tid->win32_obj_id;} operator HANDLE () const {return tid->win32_obj_id;}
#endif #endif
void set_siginfo (struct sigpacket *) __attribute__ ((regparm (3))); void set_siginfo (struct sigpacket *) __attribute__ ((regparm (3)));

View File

@ -1,7 +1,8 @@
/* dcrt0.cc -- essentially the main() for the Cygwin dll /* dcrt0.cc -- essentially the main() for the Cygwin dll
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2006, 2007, 2008 Red Hat, Inc. 2007, 2008, 2009
Red Hat, Inc.
This file is part of Cygwin. This file is part of Cygwin.
@ -15,6 +16,7 @@ details. */
#include <stdlib.h> #include <stdlib.h>
#include "glob.h" #include "glob.h"
#include <ctype.h> #include <ctype.h>
#include "environ.h"
#include "sigproc.h" #include "sigproc.h"
#include "pinfo.h" #include "pinfo.h"
#include "cygerrno.h" #include "cygerrno.h"
@ -36,79 +38,14 @@ details. */
#define PREMAIN_LEN (sizeof (user_data->premain) / sizeof (user_data->premain[0])) #define PREMAIN_LEN (sizeof (user_data->premain) / sizeof (user_data->premain[0]))
extern "C" void cygwin_exit (int) __attribute__ ((noreturn)); 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 *); 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; static char title_buf[TITLESIZE + 1];
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 void static void
do_global_dtors () do_global_dtors ()
@ -1039,8 +976,6 @@ __main (void)
atexit (do_global_dtors); atexit (do_global_dtors);
} }
exit_states NO_COPY exit_state;
void __stdcall void __stdcall
do_exit (int status) do_exit (int status)
{ {

View File

@ -1,6 +1,7 @@
/* debug.cc /* 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. Red Hat, Inc.
This software is a copyrighted work licensed under the terms of the 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. */ details. */
#include "winsup.h" #include "winsup.h"
#include "security.h"
#include "cygerrno.h" #include "cygerrno.h"
#ifdef DEBUGGING #ifdef DEBUGGING
#include "path.h" #include "path.h"

View File

@ -1,10 +1,6 @@
#include "winsup.h" #include "winsup.h"
#include <sys/types.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "devices.h" #include "devices.h"
#include "sys/cygwin.h" #include "sys/cygwin.h"
#include "tty.h" #include "tty.h"

View File

@ -1,9 +1,5 @@
%import { %import {
#include "winsup.h" #include "winsup.h"
#include <sys/types.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "devices.h" #include "devices.h"
#include "sys/cygwin.h" #include "sys/cygwin.h"
#include "tty.h" #include "tty.h"

View File

@ -2,7 +2,7 @@
process's environment. process's environment.
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 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 This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for Cygwin license. Please consult the file "CYGWIN_LICENSE" for
@ -30,10 +30,8 @@ details. */
#include "child_info.h" #include "child_info.h"
extern bool dos_file_warning; extern bool dos_file_warning;
extern bool allow_glob;
extern bool ignore_case_with_glob; extern bool ignore_case_with_glob;
extern bool allow_winsymlinks; extern bool allow_winsymlinks;
extern bool strip_title_path;
bool reset_com = false; bool reset_com = false;
static bool envcache = true; static bool envcache = true;
static bool create_upcaseenv = false; static bool create_upcaseenv = false;

View File

@ -1,7 +1,7 @@
/* exceptions.cc /* exceptions.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 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. 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 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */ details. */
#define CYGTLS_HANDLE
#include "winsup.h" #include "winsup.h"
#include "miscfuncs.h" #include "miscfuncs.h"
#include <wingdi.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 exception_list *_except_list asm ("%fs:0");
extern "C" char *__progname;
int int
_cygtls::handle_exceptions (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in, void *) _cygtls::handle_exceptions (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in, void *)
{ {

View File

@ -1,6 +1,7 @@
/* fhandler_dev_clipboard: code to access /dev/clipboard /* 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) Written by Charles Wilson (cwilson@ece.gatech.edu)
@ -11,12 +12,10 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */ details. */
#include "winsup.h" #include "winsup.h"
#include <stdlib.h>
#include <wchar.h> #include <wchar.h>
#include <wingdi.h> #include <wingdi.h>
#include <winuser.h> #include <winuser.h>
#include "cygerrno.h" #include "cygerrno.h"
#include "security.h"
#include "path.h" #include "path.h"
#include "fhandler.h" #include "fhandler.h"

View File

@ -1,6 +1,7 @@
/* fhandler_mailslot.cc. See fhandler.h for a description of the fhandler classes. /* 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. This file is part of Cygwin.
@ -11,7 +12,6 @@
#include "winsup.h" #include "winsup.h"
#include "cygerrno.h" #include "cygerrno.h"
#include "security.h"
#include "path.h" #include "path.h"
#include "fhandler.h" #include "fhandler.h"
#include "ntdll.h" #include "ntdll.h"

View File

@ -1,6 +1,7 @@
/* fhandler_mem.cc. See fhandler.h for a description of the fhandler classes. /* 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. This file is part of Cygwin.
@ -12,7 +13,6 @@
#include <unistd.h> #include <unistd.h>
#include "cygerrno.h" #include "cygerrno.h"
#include "security.h"
#include "path.h" #include "path.h"
#include "fhandler.h" #include "fhandler.h"
#include "ntdll.h" #include "ntdll.h"

View 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. This file is part of Cygwin.
@ -10,7 +11,6 @@ details. */
#include "winsup.h" #include "winsup.h"
#include "cygerrno.h" #include "cygerrno.h"
#include "security.h"
#include "path.h" #include "path.h"
#include "fhandler.h" #include "fhandler.h"

View File

@ -1,6 +1,7 @@
/* fhandler_random.cc: code to access /dev/random and /dev/urandom /* 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) Written by Corinna Vinschen (vinschen@cygnus.com)
@ -11,10 +12,8 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */ details. */
#include "winsup.h" #include "winsup.h"
#include <limits.h>
#include <unistd.h> #include <unistd.h>
#include "cygerrno.h" #include "cygerrno.h"
#include "security.h"
#include "path.h" #include "path.h"
#include "fhandler.h" #include "fhandler.h"

View File

@ -1,6 +1,7 @@
/* fhandler_raw.cc. See fhandler.h for a description of the fhandler classes. /* 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. This file is part of Cygwin.
@ -13,7 +14,6 @@
#include <cygwin/rdevio.h> #include <cygwin/rdevio.h>
#include <sys/mtio.h> #include <sys/mtio.h>
#include "cygerrno.h" #include "cygerrno.h"
#include "security.h"
#include "path.h" #include "path.h"
#include "fhandler.h" #include "fhandler.h"

View File

@ -1,7 +1,7 @@
/* fhandler_serial.cc /* fhandler_serial.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 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. 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 initialization we are, is really a terrible kludge and should
be fixed ASAP. be fixed ASAP.
*/ */
extern char *__progname;
if (reset_com && __progname) if (reset_com && __progname)
{ {
DCB state; DCB state;

View File

@ -1,6 +1,7 @@
/* fhandler_termios.cc /* 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. This file is part of Cygwin.
@ -12,13 +13,11 @@ details. */
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include "cygerrno.h" #include "cygerrno.h"
#include "security.h"
#include "path.h" #include "path.h"
#include "fhandler.h" #include "fhandler.h"
#include "sigproc.h" #include "sigproc.h"
#include "pinfo.h" #include "pinfo.h"
#include "tty.h" #include "tty.h"
#include "sys/cygwin.h"
#include "cygtls.h" #include "cygtls.h"
/* Common functions shared by tty/console */ /* Common functions shared by tty/console */

View File

@ -1,6 +1,6 @@
/* fhandler_virtual.cc: base fhandler class for virtual filesystems /* 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. This file is part of Cygwin.
@ -9,11 +9,9 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */ details. */
#include "winsup.h" #include "winsup.h"
#include <stdlib.h>
#include <sys/acl.h> #include <sys/acl.h>
#include <sys/statvfs.h> #include <sys/statvfs.h>
#include "cygerrno.h" #include "cygerrno.h"
#include "security.h"
#include "path.h" #include "path.h"
#include "fhandler.h" #include "fhandler.h"
#include "dtable.h" #include "dtable.h"

View File

@ -1,6 +1,7 @@
/* fhandler_windows.cc: code to access windows message queues. /* 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). Written by Sergey S. Okhapkin (sos@prospect.com.ru).
Feedback and testing by Andy Piper (andyp@parallax.co.uk). Feedback and testing by Andy Piper (andyp@parallax.co.uk).
@ -15,7 +16,6 @@ details. */
#include <wingdi.h> #include <wingdi.h>
#include <winuser.h> #include <winuser.h>
#include "cygerrno.h" #include "cygerrno.h"
#include "security.h"
#include "path.h" #include "path.h"
#include "fhandler.h" #include "fhandler.h"

View File

@ -1,7 +1,7 @@
/* fork.cc /* fork.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 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. This file is part of Cygwin.
@ -14,7 +14,6 @@ details. */
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include "cygerrno.h" #include "cygerrno.h"
#include "security.h"
#include "path.h" #include "path.h"
#include "fhandler.h" #include "fhandler.h"
#include "dtable.h" #include "dtable.h"
@ -24,7 +23,6 @@ details. */
#include "child_info.h" #include "child_info.h"
#include "cygtls.h" #include "cygtls.h"
#include "tls_pbuf.h" #include "tls_pbuf.h"
#include "perprocess.h"
#include "dll_init.h" #include "dll_init.h"
#include "cygmalloc.h" #include "cygmalloc.h"

View 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 #undef MAXPATHLEN
#define MAXPATHLEN 16384 #define MAXPATHLEN 16384
extern BOOL ignore_case_with_glob;
#define DOLLAR '$' #define DOLLAR '$'
#define DOT '.' #define DOT '.'
#define EOS '\0' #define EOS '\0'

115
winsup/cygwin/globals.cc Normal file
View File

@ -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;

View File

@ -36,11 +36,8 @@ static char rcsid[] = "$OpenBSD: gmon.c,v 1.8 1997/07/23 21:11:27 kstailey Exp $
#endif #endif
#include <fcntl.h> #include <fcntl.h>
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <sys/param.h>
#include <sys/types.h>
#include <gmon.h> #include <gmon.h>
#include <profil.h> #include <profil.h>

View File

@ -1,7 +1,7 @@
/* init.cc /* init.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 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. This file is part of Cygwin.
@ -16,7 +16,6 @@ details. */
static DWORD _my_oldfunc; static DWORD _my_oldfunc;
int NO_COPY dynamically_loaded;
static char NO_COPY *search_for = (char *) cygthread::stub; static char NO_COPY *search_for = (char *) cygthread::stub;
unsigned threadfunc_ix[8] __attribute__((section (".cygwin_dll_common"), shared)); unsigned threadfunc_ix[8] __attribute__((section (".cygwin_dll_common"), shared));
extern cygthread *hwait_sig; extern cygthread *hwait_sig;
@ -113,8 +112,6 @@ respawn_wow64_process ()
extern void __stdcall dll_crt0_0 (); extern void __stdcall dll_crt0_0 ();
HMODULE NO_COPY cygwin_hmodule;
extern "C" BOOL WINAPI extern "C" BOOL WINAPI
dll_entry (HANDLE h, DWORD reason, void *static_load) dll_entry (HANDLE h, DWORD reason, void *static_load)
{ {

View File

@ -1,6 +1,7 @@
/* ioctl.cc: ioctl routines. /* 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 Written by Doug Evans of Cygnus Support
dje@cygnus.com dje@cygnus.com
@ -13,7 +14,6 @@ details. */
#include "winsup.h" #include "winsup.h"
#include "cygerrno.h" #include "cygerrno.h"
#include "security.h"
#include "path.h" #include "path.h"
#include "fhandler.h" #include "fhandler.h"
#include "dtable.h" #include "dtable.h"

View 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. This file is part of Cygwin.
@ -9,11 +9,7 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */ details. */
#include "winsup.h" #include "winsup.h"
#include "perprocess.h"
#include "cygwin/version.h"
#include "crt0.h" #include "crt0.h"
#include <reent.h>
#include <stdlib.h>
/* Avoid an info message from linker when linking applications. */ /* Avoid an info message from linker when linking applications. */
extern __declspec(dllimport) struct _reent *_impure_ptr; extern __declspec(dllimport) struct _reent *_impure_ptr;

View File

@ -1,6 +1,6 @@
/* cygwin_crt0.cc: crt0 for cygwin /* 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. This file is part of Cygwin.
@ -9,7 +9,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */ details. */
#undef __INSIDE_CYGWIN__ #undef __INSIDE_CYGWIN__
#include <sys/cygwin.h>
#include "crt0.h" #include "crt0.h"
extern void __stdcall _dll_crt0 () extern void __stdcall _dll_crt0 ()

View File

@ -1,17 +1,14 @@
/* dll_main.cc: Provide the DllMain stub that the user can override. /* 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 This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */ details. */
#include <windows.h>
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#include <stdio.h>
extern "C" extern "C"
BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason,

View File

@ -1,6 +1,6 @@
/* libcmain.c /* 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. This file is part of Cygwin.
@ -9,7 +9,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */ details. */
#include <windows.h> #include <windows.h>
#include <string.h>
#define SP " \t\n" #define SP " \t\n"

View File

@ -33,14 +33,10 @@
#include "winsup.h" #include "winsup.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h>
#include <utmp.h> #include <utmp.h>
#include <unistd.h> #include <unistd.h>
#include <sys/termios.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <fcntl.h> #include <fcntl.h>
#include "cygerrno.h"
#include "thread.h"
#include "cygtls.h" #include "cygtls.h"
extern "C" int extern "C" int

View File

@ -1,6 +1,6 @@
/* minires-os-if.c. Stub synchronous resolver for Cygwin. /* 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> Written by Pierre A. Humblet <Pierre.Humblet@ieee.org>
@ -27,7 +27,6 @@ details. */
#include <windows.h> #include <windows.h>
#include <iphlpapi.h> #include <iphlpapi.h>
#include <windns.h> #include <windns.h>
#include <sys/cygwin.h>
/*********************************************************************** /***********************************************************************
* write_record: Translates a Windows DNS record into a compressed record * write_record: Translates a Windows DNS record into a compressed record

View File

@ -35,7 +35,6 @@
static char rcsid[] = "$OpenBSD: mcount.c,v 1.6 1997/07/23 21:11:27 kstailey Exp $"; static char rcsid[] = "$OpenBSD: mcount.c,v 1.6 1997/07/23 21:11:27 kstailey Exp $";
#endif #endif
#include <sys/param.h>
#include <sys/types.h> #include <sys/types.h>
#include <gmon.h> #include <gmon.h>

29
winsup/cygwin/mkglobals_h Executable file
View File

@ -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;
}

59
winsup/cygwin/mkstatic Executable file
View File

@ -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";
}

View File

@ -1,7 +1,7 @@
/* mount.cc: mount handling. /* mount.cc: mount handling.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 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. This file is part of Cygwin.
@ -30,6 +30,7 @@ details. */
#include "tls_pbuf.h" #include "tls_pbuf.h"
#include <ntdll.h> #include <ntdll.h>
#include <wchar.h> #include <wchar.h>
#include <stdio.h>
/* Determine if path prefix matches current cygdrive */ /* Determine if path prefix matches current cygdrive */
#define iscygdrive(path) \ #define iscygdrive(path) \

View File

@ -1,7 +1,7 @@
/* mount.h: mount definitions. /* mount.h: mount definitions.
Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 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. This file is part of Cygwin.
@ -87,10 +87,6 @@ class mount_item
scheme should be satisfactory for a long while yet. */ scheme should be satisfactory for a long while yet. */
#define MAX_MOUNTS 30 #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; class reg_key;
struct device; struct device;

View File

@ -1,7 +1,7 @@
/* path.cc: path support. /* path.cc: path support.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 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. This file is part of Cygwin.
@ -75,6 +75,13 @@
bool dos_file_warning = true; bool dos_file_warning = true;
suffix_info stat_suffixes[] =
{
suffix_info ("", 1),
suffix_info (".exe", 1),
suffix_info (NULL)
};
struct symlink_info struct symlink_info
{ {
char contents[SYMLINK_MAX + 1]; char contents[SYMLINK_MAX + 1];

View File

@ -1,7 +1,7 @@
/* pinfo.cc: process table support /* pinfo.cc: process table support
Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 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. This file is part of Cygwin.
@ -419,8 +419,6 @@ _pinfo::alive ()
return !!h; return !!h;
} }
extern char **__argv;
DWORD WINAPI DWORD WINAPI
commune_process (void *arg) commune_process (void *arg)
{ {
@ -444,7 +442,6 @@ commune_process (void *arg)
{ {
sigproc_printf ("processing PICOM_CMDLINE"); sigproc_printf ("processing PICOM_CMDLINE");
unsigned n = 0; unsigned n = 0;
extern int __argc_safe;
const char *argv[__argc_safe + 1]; const char *argv[__argc_safe + 1];
for (int i = 0; i < __argc_safe; i++) for (int i = 0; i < __argc_safe; i++)

View File

@ -1,6 +1,7 @@
/* poll.cc. Implements poll(2) via usage of select(2) call. /* 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. This file is part of Cygwin.
@ -13,11 +14,9 @@
#define FD_SETSIZE 16384 // lots of fds #define FD_SETSIZE 16384 // lots of fds
#include "winsup.h" #include "winsup.h"
#include <sys/poll.h> #include <sys/poll.h>
#include <sys/socket.h>
#include <stdlib.h> #include <stdlib.h>
#define USE_SYS_TYPES_FD_SET #define USE_SYS_TYPES_FD_SET
#include "cygerrno.h" #include "cygerrno.h"
#include "security.h"
#include "path.h" #include "path.h"
#include "fhandler.h" #include "fhandler.h"
#include "dtable.h" #include "dtable.h"

View File

@ -1,6 +1,6 @@
/* profil.c -- win32 profil.c equivalent /* 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. This file is part of Cygwin.
@ -9,10 +9,8 @@
details. */ details. */
#include <windows.h> #include <windows.h>
#include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#include <errno.h> #include <errno.h>
#include <math.h>
#include <profil.h> #include <profil.h>

View File

@ -1,7 +1,7 @@
/* registry.cc: registry interface /* registry.cc: registry interface
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 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. This file is part of Cygwin.
@ -11,8 +11,6 @@ details. */
#include "winsup.h" #include "winsup.h"
#include "registry.h" #include "registry.h"
#include "security.h"
#include <cygwin/version.h>
#include "cygerrno.h" #include "cygerrno.h"
#include "path.h" #include "path.h"
#include "fhandler.h" #include "fhandler.h"

View File

@ -1,6 +1,7 @@
/* security.h: security declarations /* 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. This file is part of Cygwin.
@ -336,6 +337,7 @@ legal_sid_type (SID_NAME_USE type)
|| type == SidTypeAlias || type == SidTypeWellKnownGroup; || type == SidTypeAlias || type == SidTypeWellKnownGroup;
} }
class path_conv;
/* File manipulation */ /* File manipulation */
int __stdcall get_file_attribute (HANDLE, path_conv &, mode_t *, int __stdcall get_file_attribute (HANDLE, path_conv &, mode_t *,
__uid32_t *, __gid32_t *); __uid32_t *, __gid32_t *);

View File

@ -1,7 +1,7 @@
/* shared.cc: shared data area support. /* shared.cc: shared data area support.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 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. 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 /* This function returns a handle to the top-level directory in the global
NT namespace used to implement global objects including shared memory. */ NT namespace used to implement global objects including shared memory. */
extern bool _cygwin_testing;
HANDLE HANDLE
get_shared_parent_dir () get_shared_parent_dir ()

View File

@ -1,6 +1,6 @@
/* shared_info.h: shared info for cygwin /* 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. This file is part of Cygwin.
@ -33,6 +33,10 @@ public:
#define CURR_SHARED_MAGIC 0x398d8baU #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 /* NOTE: Do not make gratuitous changes to the names or organization of the
below class. The layout is checksummed to determine compatibility between below class. The layout is checksummed to determine compatibility between
different cygwin versions. */ different cygwin versions. */

View File

@ -1,6 +1,6 @@
/* smallprint.cc: small print routines for WIN32 /* 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. Red Hat, Inc.
This file is part of Cygwin. 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; return dst;
} }
extern "C" int int
__small_vsprintf (char *dst, const char *fmt, va_list ap) __small_vsprintf (char *dst, const char *fmt, va_list ap)
{ {
char tmp[NT_MAX_PATH]; char tmp[NT_MAX_PATH];
@ -223,7 +223,7 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
return dst - orig; return dst - orig;
} }
extern "C" int int
__small_sprintf (char *dst, const char *fmt, ...) __small_sprintf (char *dst, const char *fmt, ...)
{ {
int r; int r;
@ -234,7 +234,7 @@ __small_sprintf (char *dst, const char *fmt, ...)
return r; return r;
} }
extern "C" void void
small_printf (const char *fmt, ...) small_printf (const char *fmt, ...)
{ {
char buf[16384]; char buf[16384];
@ -261,7 +261,7 @@ small_printf (const char *fmt, ...)
#ifdef DEBUGGING #ifdef DEBUGGING
static HANDLE NO_COPY console_handle = NULL; static HANDLE NO_COPY console_handle = NULL;
extern "C" void void
console_printf (const char *fmt, ...) console_printf (const char *fmt, ...)
{ {
char buf[16384]; char buf[16384];
@ -329,7 +329,7 @@ __wrn (PWCHAR dst, int base, int dosign, long long val, int len, int pad, unsign
return dst; return dst;
} }
extern "C" int int
__small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap) __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap)
{ {
WCHAR tmp[NT_MAX_PATH]; WCHAR tmp[NT_MAX_PATH];
@ -466,7 +466,7 @@ __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap)
return dst - orig; return dst - orig;
} }
extern "C" int int
__small_swprintf (PWCHAR dst, const WCHAR *fmt, ...) __small_swprintf (PWCHAR dst, const WCHAR *fmt, ...)
{ {
int r; int r;

View File

@ -1,7 +1,7 @@
/* spawn.cc /* spawn.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 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. This file is part of Cygwin.
@ -50,7 +50,6 @@ static suffix_info dll_suffixes[] =
suffix_info (NULL) suffix_info (NULL)
}; };
HANDLE hExeced;
child_info_spawn *chExeced; child_info_spawn *chExeced;
/* Add .exe to PROG if not already present and see if that exists. /* 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, spawn_guts (const char *prog_arg, const char *const *argv,
const char *const envp[], int mode, int __stdin, int __stdout) const char *const envp[], int mode, int __stdin, int __stdout)
{ {

View File

@ -55,7 +55,7 @@ for (@headtail) {
$extract{$_} = 1; $extract{$_} = 1;
} }
my $dir = tempdir(); my $dir = tempdir(CLEANUP => 1);
chdir $dir; chdir $dir;
# print join(' ', '+', $ar, 'x', sort keys %extract), "\n"; # print join(' ', '+', $ar, 'x', sort keys %extract), "\n";

View File

@ -1,7 +1,7 @@
/* strace.cc: system/windows tracing /* strace.cc: system/windows tracing
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 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. This file is part of Cygwin.
@ -121,8 +121,6 @@ mypid (char *buf)
return buf; return buf;
} }
extern "C" char *__progname;
/* sprintf analog for use by output routines. */ /* sprintf analog for use by output routines. */
int int
strace::vsprntf (char *buf, const char *func, const char *infmt, va_list ap) strace::vsprntf (char *buf, const char *func, const char *infmt, va_list ap)

View File

@ -1,7 +1,7 @@
/* strfuncs.cc: misc funcs that don't belong anywhere else /* strfuncs.cc: misc funcs that don't belong anywhere else
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 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. This file is part of Cygwin.
@ -21,9 +21,6 @@ details. */
#include "dtable.h" #include "dtable.h"
#include "cygheap.h" #include "cygheap.h"
codepage_type current_codepage = ansi_cp;
UINT active_codepage = 0;
UINT UINT
get_cp () get_cp ()
{ {

View File

@ -4,9 +4,7 @@
which is intended to operate similarly to a mutex but attempts to which is intended to operate similarly to a mutex but attempts to
avoid making expensive calls to the kernel. avoid making expensive calls to the kernel.
Copyright 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009 Red Hat, Inc.
Written by Christopher Faylor <cgf@cygnus.com>
This file is part of Cygwin. This file is part of Cygwin.
@ -23,6 +21,7 @@ details. */
#undef WaitForSingleObject #undef WaitForSingleObject
DWORD NO_COPY muto::exiting_thread; DWORD NO_COPY muto::exiting_thread;
muto NO_COPY lock_process::locker;
void void
muto::grab () muto::grab ()

View File

@ -1,7 +1,7 @@
/* syscalls.cc: syscalls /* syscalls.cc: syscalls
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 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. This file is part of Cygwin.
@ -72,15 +72,6 @@ details. */
#undef _lseek64 #undef _lseek64
#undef _fstat64 #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, static int __stdcall mknod_worker (const char *, mode_t, mode_t, _major_t,
_minor_t); _minor_t);

View File

@ -1,7 +1,7 @@
/* thread.h: Locking and threading module definitions /* thread.h: Locking and threading module definitions
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 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. This file is part of Cygwin.
@ -19,7 +19,7 @@ details. */
#include <pthread.h> #include <pthread.h>
#include <limits.h> #include <limits.h>
#include <security.h> #include "security.h"
#include <errno.h> #include <errno.h>
enum cw_sig_wait enum cw_sig_wait

View File

@ -1,7 +1,7 @@
/* times.cc /* times.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 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. 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 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */ details. */
#include "winsup.h"
#define __timezonefunc__ #define __timezonefunc__
#include "winsup.h"
#include <sys/times.h> #include <sys/times.h>
#include <sys/timeb.h> #include <sys/timeb.h>
#include <utime.h> #include <utime.h>

View File

@ -1,6 +1,6 @@
/* tty.cc /* 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. Red Hat, Inc.
This file is part of Cygwin. This file is part of Cygwin.
@ -100,7 +100,7 @@ tty::create_master (int ttynum)
ttym.setunit (ttynum); /* CGF FIXME device */ ttym.setunit (ttynum); /* CGF FIXME device */
tty_master = (fhandler_tty_master *) build_fh_dev (ttym); tty_master = (fhandler_tty_master *) build_fh_dev (ttym);
if (tty_master->init ()) if (tty_master->init ())
api_fatal ("Can't create master tty"); api_fatal ("can't create master tty");
else else
{ {
/* Log utmp entry */ /* Log utmp entry */

View File

@ -1,7 +1,7 @@
/* winsup.h: main Cygwin header file. /* winsup.h: main Cygwin header file.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 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. This file is part of Cygwin.
@ -36,17 +36,17 @@ details. */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
extern __uid32_t getuid32 (); __uid32_t getuid32 ();
extern __uid32_t geteuid32 (); __uid32_t geteuid32 ();
extern int seteuid32 (__uid32_t); int seteuid32 (__uid32_t);
extern __gid32_t getegid32 (void); __gid32_t getegid32 (void);
extern struct passwd *getpwuid32 (__uid32_t); struct passwd *getpwuid32 (__uid32_t);
extern struct passwd *getpwnam (const char *); struct passwd *getpwnam (const char *);
extern struct __sFILE64 *fopen64 (const char *, const char *); struct __sFILE64 *fopen64 (const char *, const char *);
extern struct hostent *cygwin_gethostbyname (const char *name); struct hostent *cygwin_gethostbyname (const char *name);
/* Don't enforce definition of in_addr_t. */ /* Don't enforce definition of in_addr_t. */
extern uint32_t cygwin_inet_addr (const char *cp); uint32_t cygwin_inet_addr (const char *cp);
extern int fcntl64 (int fd, int cmd, ...); int fcntl64 (int fd, int cmd, ...);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
@ -104,11 +104,6 @@ extern const char case_folded_upper[];
/* The one function we use from winuser.h most of the time */ /* The one function we use from winuser.h most of the time */
extern "C" DWORD WINAPI GetLastError (void); 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); void codepage_init (const char *buf);
UINT get_cp (); UINT get_cp ();
@ -127,7 +122,6 @@ int __stdcall sys_mbstowcs_alloc (PWCHAR *, int, const char *, int = -1)
__attribute__ ((regparm(3))); __attribute__ ((regparm(3)));
/* Used to check if Cygwin DLL is dynamically loaded. */ /* Used to check if Cygwin DLL is dynamically loaded. */
extern int dynamically_loaded;
extern int cygserver_running; extern int cygserver_running;
@ -137,9 +131,6 @@ extern int cygserver_running;
#include "debug.h" #include "debug.h"
/* Events/mutexes */
extern HANDLE tty_mutex;
/**************************** Convenience ******************************/ /**************************** Convenience ******************************/
/* Used to define status flag accessor methods */ /* Used to define status flag accessor methods */
@ -163,7 +154,6 @@ extern HANDLE tty_mutex;
/* Convert a signal to a signal mask */ /* Convert a signal to a signal mask */
#define SIGTOMASK(sig) (1 << ((sig) - 1)) #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 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) #define api_fatal(fmt, args...) __api_fatal (fmt,## args)
@ -191,38 +181,17 @@ class per_process;
/* cygwin .dll initialization */ /* cygwin .dll initialization */
void dll_crt0 (per_process *) __asm__ ("_dll_crt0__FP11per_process"); void dll_crt0 (per_process *) __asm__ ("_dll_crt0__FP11per_process");
extern "C" void __stdcall _dll_crt0 (); extern "C" void __stdcall _dll_crt0 ();
extern void dll_crt0_1 (void *); void dll_crt0_1 (void *);
extern void dll_dllcrt0_1 (void *); void dll_dllcrt0_1 (void *);
extern int __stdcall spawn_guts (const char * prog_arg, const char *const *argv, int spawn_guts (const char * prog_arg, const char *const *argv,
const char *const envp[], int mode, const char *const envp[], int mode, int __stdin = -1,
int __stdin = -1, int __stdout = -1); int __stdout = -1) __attribute__ ((regparm(3)));
/* dynamically loaded dll initialization */ /* dynamically loaded dll initialization */
extern "C" int dll_dllcrt0 (HMODULE, per_process *); extern "C" int dll_dllcrt0 (HMODULE, per_process *);
/* dynamically loaded dll initialization for non-cygwin apps */ /* dynamically loaded dll initialization for non-cygwin apps */
extern "C" int dll_noncygwin_dllcrt0 (HMODULE, per_process *); 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)); void __stdcall do_exit (int) __attribute__ ((regparm (1), noreturn));
/* UID/GID */ /* UID/GID */
@ -253,8 +222,6 @@ extern "C" int try_to_debug (bool waitloop = 1);
void ld_preload (); void ld_preload ();
const char *find_first_notloaded_dll (class path_conv &); const char *find_first_notloaded_dll (class path_conv &);
void set_file_api_mode (codepage_type);
extern bool cygwin_finished_initializing; extern bool cygwin_finished_initializing;
/**************************** Miscellaneous ******************************/ /**************************** Miscellaneous ******************************/
@ -293,11 +260,11 @@ extern bool wsock_started;
/* Printf type functions */ /* Printf type functions */
extern "C" void __api_fatal (const char *, ...) __attribute__ ((noreturn)); extern "C" void __api_fatal (const char *, ...) __attribute__ ((noreturn));
extern "C" int __small_sprintf (char *dst, const char *fmt, ...) /*__attribute__ ((regparm (2)))*/; 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)))*/; 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)))*/; 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)))*/; int __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap) /*__attribute__ ((regparm (3)))*/;
extern void multiple_cygwin_problem (const char *, unsigned, unsigned); void multiple_cygwin_problem (const char *, unsigned, unsigned);
extern "C" void vklog (int priority, const char *message, va_list ap); extern "C" void vklog (int priority, const char *message, va_list ap);
extern "C" void klog (int priority, const char *message, ...); 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 *, int cygwin_select (int , fd_set *, fd_set *, fd_set *,
struct timeval *to); struct timeval *to);
int cygwin_gethostname (char *__name, size_t __len); 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 ******************************/ /*************************** Unsorted ******************************/
@ -355,18 +317,13 @@ extern SYSTEM_INFO system_info;
#define NO_R ~(S_IRUSR | S_IRGRP | S_IROTH) #define NO_R ~(S_IRUSR | S_IRGRP | S_IROTH)
#define NO_X ~(S_IXUSR | S_IXGRP | S_IXOTH) #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 "C" char _data_start__, _data_end__, _bss_start__, _bss_end__;
extern "C" void (*__CTOR_LIST__) (void);
extern HANDLE hMainThread; extern "C" void (*__DTOR_LIST__) (void);
extern HANDLE hMainProc;
extern HANDLE hProcToken;
extern HANDLE hProcImpToken;
#if !defined(_GLOBALS_H)
#include "globals.h"
inline void clear_procimptoken () inline void clear_procimptoken ()
{ {
if (hProcImpToken) if (hProcImpToken)
@ -377,11 +334,7 @@ inline void clear_procimptoken ()
} }
} }
extern HANDLE hExeced; void set_file_api_mode (codepage_type);
extern HMODULE cygwin_hmodule; #endif
extern bool cygwin_testing;
extern char almost_null[];
#endif /* defined __cplusplus */ #endif /* defined __cplusplus */