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>
+ 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.
# 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.
#
# 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@
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@
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 \
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 \
-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)
(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)
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'
${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 $@ $?
[ -s $@ ] && touch $@
sigfe.o: sigfe.s
- $(CC) -c -o $@ $?
+ $(CC) -c -o $@ $<
winsup.h: config.h
/* 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.
details. */
#include "winsup.h"
-#include "security.h"
#include <wingdi.h>
#include <winuser.h>
/* cxx.cc
- Copyright 2002, 2003 Red Hat, Inc.
+ Copyright 2002, 2003, 2005, 2009 Red Hat, Inc.
This file is part of Cygwin.
#if (__GNUC__ >= 3)
#include "winsup.h"
-#include <stdlib.h>
void *
operator new (size_t s)
/* 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
#include "miscfuncs.h"
#include <stdlib.h>
#include "sigproc.h"
-#include "thread.h"
#include "cygtls.h"
#undef CloseHandle
/* 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
#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"
/* 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
#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
#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
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)));
/* 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.
#include <stdlib.h>
#include "glob.h"
#include <ctype.h>
+#include "environ.h"
#include "sigproc.h"
#include "pinfo.h"
#include "cygerrno.h"
#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 ()
atexit (do_global_dtors);
}
-exit_states NO_COPY exit_state;
-
void __stdcall
do_exit (int status)
{
/* 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
details. */
#include "winsup.h"
-#include "security.h"
#include "cygerrno.h"
#ifdef DEBUGGING
#include "path.h"
#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"
%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"
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
#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;
/* 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.
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
+#define CYGTLS_HANDLE
#include "winsup.h"
#include "miscfuncs.h"
#include <wingdi.h>
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 *)
{
/* 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)
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"
/* 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.
#include "winsup.h"
#include "cygerrno.h"
-#include "security.h"
#include "path.h"
#include "fhandler.h"
#include "ntdll.h"
/* 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.
#include <unistd.h>
#include "cygerrno.h"
-#include "security.h"
#include "path.h"
#include "fhandler.h"
#include "ntdll.h"
-/* 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.
#include "winsup.h"
#include "cygerrno.h"
-#include "security.h"
#include "path.h"
#include "fhandler.h"
/* 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)
details. */
#include "winsup.h"
-#include <limits.h>
#include <unistd.h>
#include "cygerrno.h"
-#include "security.h"
#include "path.h"
#include "fhandler.h"
/* 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.
#include <cygwin/rdevio.h>
#include <sys/mtio.h>
#include "cygerrno.h"
-#include "security.h"
#include "path.h"
#include "fhandler.h"
/* 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.
initialization we are, is really a terrible kludge and should
be fixed ASAP.
*/
- extern char *__progname;
if (reset_com && __progname)
{
DCB state;
/* 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.
#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 */
/* 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.
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"
/* 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).
#include <wingdi.h>
#include <winuser.h>
#include "cygerrno.h"
-#include "security.h"
#include "path.h"
#include "fhandler.h"
/* 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.
#include <unistd.h>
#include <stdlib.h>
#include "cygerrno.h"
-#include "security.h"
#include "path.h"
#include "fhandler.h"
#include "dtable.h"
#include "child_info.h"
#include "cygtls.h"
#include "tls_pbuf.h"
-#include "perprocess.h"
#include "dll_init.h"
#include "cygmalloc.h"
#undef MAXPATHLEN
#define MAXPATHLEN 16384
-extern BOOL ignore_case_with_glob;
-
#define DOLLAR '$'
#define DOT '.'
#define EOS '\0'
--- /dev/null
+/* 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;
#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>
/* 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.
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;
extern void __stdcall dll_crt0_0 ();
-HMODULE NO_COPY cygwin_hmodule;
-
extern "C" BOOL WINAPI
dll_entry (HANDLE h, DWORD reason, void *static_load)
{
/* 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
#include "winsup.h"
#include "cygerrno.h"
-#include "security.h"
#include "path.h"
#include "fhandler.h"
#include "dtable.h"
-/* 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.
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;
/* 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.
details. */
#undef __INSIDE_CYGWIN__
-#include <sys/cygwin.h>
#include "crt0.h"
extern void __stdcall _dll_crt0 ()
/* 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,
/* 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.
details. */
#include <windows.h>
-#include <string.h>
#define SP " \t\n"
#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
/* 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>
#include <windows.h>
#include <iphlpapi.h>
#include <windns.h>
-#include <sys/cygwin.h>
/***********************************************************************
* write_record: Translates a Windows DNS record into a compressed record
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>
--- /dev/null
+#!/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;
+}
--- /dev/null
+#!/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";
+}
/* 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.
#include "tls_pbuf.h"
#include <ntdll.h>
#include <wchar.h>
+#include <stdio.h>
/* Determine if path prefix matches current cygdrive */
#define iscygdrive(path) \
/* 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.
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;
/* 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];
/* 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.
return !!h;
}
-extern char **__argv;
-
DWORD WINAPI
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++)
/* 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"
/* 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.
details. */
#include <windows.h>
-#include <stdio.h>
#include <sys/types.h>
#include <errno.h>
-#include <math.h>
#include <profil.h>
/* 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.
#include "winsup.h"
#include "registry.h"
-#include "security.h"
-#include <cygwin/version.h>
#include "cygerrno.h"
#include "path.h"
#include "fhandler.h"
/* 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.
|| type == SidTypeAlias || type == SidTypeWellKnownGroup;
}
+class path_conv;
/* File manipulation */
int __stdcall get_file_attribute (HANDLE, path_conv &, mode_t *,
__uid32_t *, __gid32_t *);
/* 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.
/* 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 ()
/* 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.
#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. */
/* 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.
return dst;
}
-extern "C" int
+int
__small_vsprintf (char *dst, const char *fmt, va_list ap)
{
char tmp[NT_MAX_PATH];
return dst - orig;
}
-extern "C" int
+int
__small_sprintf (char *dst, const char *fmt, ...)
{
int r;
return r;
}
-extern "C" void
+void
small_printf (const char *fmt, ...)
{
char buf[16384];
#ifdef DEBUGGING
static HANDLE NO_COPY console_handle = NULL;
-extern "C" void
+void
console_printf (const char *fmt, ...)
{
char buf[16384];
return dst;
}
-extern "C" int
+int
__small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap)
{
WCHAR tmp[NT_MAX_PATH];
return dst - orig;
}
-extern "C" int
+int
__small_swprintf (PWCHAR dst, const WCHAR *fmt, ...)
{
int r;
/* 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.
suffix_info (NULL)
};
-HANDLE hExeced;
child_info_spawn *chExeced;
/* Add .exe to PROG if not already present and see if that exists.
}
-int __stdcall
+int
spawn_guts (const char *prog_arg, const char *const *argv,
const char *const envp[], int mode, int __stdin, int __stdout)
{
$extract{$_} = 1;
}
-my $dir = tempdir();
+my $dir = tempdir(CLEANUP => 1);
chdir $dir;
# print join(' ', '+', $ar, 'x', sort keys %extract), "\n";
/* 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.
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)
/* 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.
#include "dtable.h"
#include "cygheap.h"
-codepage_type current_codepage = ansi_cp;
-UINT active_codepage = 0;
-
UINT
get_cp ()
{
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.
#undef WaitForSingleObject
DWORD NO_COPY muto::exiting_thread;
+muto NO_COPY lock_process::locker;
void
muto::grab ()
/* 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.
#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);
/* 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.
#include <pthread.h>
#include <limits.h>
-#include <security.h>
+#include "security.h"
#include <errno.h>
enum cw_sig_wait
/* 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.
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>
/* 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.
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 */
/* 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.
#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
/* 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 ();
__attribute__ ((regparm(3)));
/* Used to check if Cygwin DLL is dynamically loaded. */
-extern int dynamically_loaded;
extern int cygserver_running;
#include "debug.h"
-/* Events/mutexes */
-extern HANDLE tty_mutex;
-
/**************************** Convenience ******************************/
/* Used to define status flag accessor methods */
/* 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)
/* 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 */
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 ******************************/
/* 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, ...);
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 ******************************/
#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)
}
}
-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 */