Commit Graph

53 Commits

Author SHA1 Message Date
Corinna Vinschen 3591470260 * Throughout fix copyright dates. 2011-02-15 15:56:03 +00:00
Christopher Faylor ca1953eeee * cygheap.cc: Add some __stdcall decoration where appropriate.
* lib/cygwin_crt0.c: __attribute -> __attribute__.
2011-02-10 02:22:36 +00:00
Christopher Faylor 92117cb21f * winlean.h: New file.
* automode.c: Use "winlean.h".
* binmode.c: Ditto.
* gmon.c: Ditto.
* textmode.c: Ditto.
* textreadmode.c: Ditto.
* winsup.h: Ditto.
* lib/cygwin_attach_dll.c: Ditto.
* lib/dll_main.cc: Ditto.
* profile.c: Ditto.
* crt0.c: Ditto.  Cleanup ancient cruft.  Add dummy calls to cygwin_premain*.
* include/sys/cygwin.h: Remove old stuff.  Move premain declarations nearer to
other cygwin-specific function declarations.
* globals.cc: Add comment.
2010-08-30 01:57:37 +00:00
Christopher Faylor 27f564e9a3 * Makefile.in (DLL_OFILES): Add pseudo-reloc.o.
* dcrt0.cc (child_info_fork::handle_fork): Call _pei386_runtime_relocator here.
(dll_crt0_1): Ditto for non-fork case.
* dll_init.cc (dll::init): Complain more in comment.  Clean up slightly.
(dll_dllcrt0_1): Call _pei386_runtime_relocator when we know we have a
filled-in per_process structure.
* globals.cc (__cygwin_user_data): Accommodate new fields for
_pei386_runtime_relocator.
* pseudo-reloc.cc: New file adapted from old lib/pseudo-reloc.c.  Include
winsup.h directly.  Collapse #ifdef __CYGWIN__ into one block.  Perform minor
whitespace code reformatting.
(__report_error): Use small_printf to output error.
(_pei386_runtime_relocator): Conditionalize for cygwin to take per_process
pointer parameter.
* winsup.h (_pei386_runtime_relocator): Declare.
* include/cygwin/version.h
(CYGWIN_VERSION_PER_PROCESS_API_VERSION_COMBINED): New macro.
(CYGWIN_VERSION_USER_API_VERSION_COMBINED): Use above macro.
(CYGWIN_VERSION_USE_PSEUDO_RELOC_IN_DLL): New macro.
(CYGWIN_VERSION_API_MINOR): Bump to 227.
* include/sys/cygwin.h: Remove obsolete comment.
(per_process::unused2): Shorten.
(per_process::pseudo_reloc_start): New field.
(per_process::pseudo_reloc_end): Ditto.
(per_process::image_base): Ditto.
* lib/_cygwin_crt0_common.cc: Declare pseudo runtime externs needed for
per_process structure.
(_cygwin_crt0_common): Fill in pseudo_reloc runtime constants.
* lib/pseudo-reloc-dummy.c: New file.  Dummy function to satisify ld.
* lib/pseudo-reloc.c: Delete.
2010-05-07 21:25:19 +00:00
Christopher Faylor 53755c55a7 * lib/_cygwin_crt0_common.cc: Remove unneeded declarations. 2010-04-20 03:30:32 +00:00
Charles Wilson 73ddc92062 Correct pseudo-reloc size bug wrt error messages 2009-10-26 14:50:09 +00:00
Charles Wilson 15c59df67f Sync pseudo-reloc.c with mingw64 2009-10-25 23:37:48 +00:00
Charles Wilson dc4e4aabba Support pseudo-reloc version 2 2009-10-07 15:47:38 +00:00
Christopher Faylor adfbdcdb07 * external.cc (cygwin_internal): Add hack to always reset cxx_malloc to proper
value.
* lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Relocate wayward comment.
2009-09-21 02:19:31 +00:00
Christopher Faylor 28c054b720 * pipe.cc (fhandler_pipe::create_selectable): Add -pipe to default pipe names.
* lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Use bool/true/false for
what is actually a boolean variable.
2009-08-17 12:45:51 +00:00
Corinna Vinschen ce5eb135a2 * cxx.cc (default_cygwin_cxx_malloc): Enhance commenting.
* dll_init.cc (dll_dllcrt0_1): Likewise.
	* dlfcn.cc (dlopen): Prevent dlopen()'d DLL from installing any
	cxx malloc overrides.
	* include/cygwin/cygwin_dll.h (__dynamically_loaded): New variable.
	* lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Check it and only
	install cxx malloc overrides when statically loaded.  Extend comments.
2009-08-13 07:35:50 +00:00
Dave Korn b602bb90e2 winsup/ChangeLog:
* Makefile.common (COMPILE_CXX): Add support for per-file overrides
	to exclude $(nostdinc) and $(nostdincxx) from compiler flags.
	(COMPILE_CC): Likewise for $(nostdinc).

winsup/cygwin/ChangeLog:

	* Makefile.in (DLL_OFILES): Add libstdcxx_wrapper.o
	(libstdcxx_wrapper_CFLAGS): Add flags for new module.
	(_cygwin_crt0_common_STDINCFLAGS): Define per-file override.
	(libstdcxx_wrapper_STDINCFLAGS, cxx_STDINCFLAGS): Likewise.
	* cxx.cc: Include "cygwin-cxx.h".
	(operator new): Tweak prototype for full standards compliance.
	(operator new[]): Likewise.
	(operator new (nothrow)): New fallback function.
	(operator new[] (nothrow), operator delete (nothrow),
	operator delete[] (nothrow)): Likewise.
	(default_cygwin_cxx_malloc): New struct of pointers to the above,
	for final last-resort fallback default.
	* cygwin-cxx.h: New file.
	(struct per_process_cxx_malloc): Define.
	(default_cygwin_cxx_malloc): Declare extern.
	* cygwin.din (__wrap__ZdaPv): Export new wrapper.
	(__wrap__ZdaPvRKSt9nothrow_t, __wrap__ZdlPv,
	__wrap__ZdlPvRKSt9nothrow_t, __wrap__Znaj,
	__wrap__ZnajRKSt9nothrow_t, __wrap__Znwj,
	__wrap__ZnwjRKSt9nothrow_t): Likewise.
	* globals.cc (__cygwin_user_data): Init newly-repurposed 'forkee'
	field (now 'cxx_malloc') to point to default_cygwin_cxx_malloc.
	* libstdcxx_wrapper.cc: New file.
	(__wrap__ZdaPv, __wrap__ZdaPvRKSt9nothrow_t, __wrap__ZdlPv,
	__wrap__ZdlPvRKSt9nothrow_t, __wrap__Znaj,
	__wrap__ZnajRKSt9nothrow_t, __wrap__Znwj,
	__wrap__ZnwjRKSt9nothrow_t): Define wrapper functions for libstdc++
	malloc operators and their overrides.
	* winsup.h (default_cygwin_cxx_malloc): Declare extern.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
	* include/sys/cygwin.h (struct per_process_cxx_malloc): Forward
	declare here.
	(struct per_process::forkee): Rename and repurpose from this ...
	(struct per_process::cxx_malloc): ... to this.
	* lib/_cygwin_crt0_common.cc: Include cygwin-cxx.h.
	(WEAK): Define shorthand helper macro.
	(__cygwin_cxx_malloc): Define and populate with weak references
	to whatever libstdc++ malloc operators will be visible at final
	link time for Cygwin apps and dlls.
	(_cygwin_crt0_common): Always look up cygwin DLL's internal
	per_process data, and don't test for (impossible) failure.  Inherit
	any members of __cygwin_cxx_malloc that we don't have overrides
	for from the DLL's default and store the resulting overall set of
	overrides back into the DLL's global per_process data.
2009-07-07 20:12:44 +00:00
Christopher Faylor 66a83f3eac 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-03 05:12:22 +00:00
Christopher Faylor b58e5f427a * mount.cc (mount_info::init): Add location where we're looking for fstab to
temporary message.
* lib/cygwin_crt0.c (cygwin_crt0): Simplify by eliminating accommodations for
ancient cygwin DLLs.
* lib/crt0.h: Include <windows.h> directly since it is needed.
2008-07-27 16:59:07 +00:00
Christopher Faylor ba5f4d5087 * lib/cygwin_attach_dll.c: Fix compiler warning.
* lib/cygwin_crt0.c: Ditto.
2007-08-02 14:30:17 +00:00
Christopher Faylor 329a39ebea * Makefile.in (DLL_OFILES): Add winf.o.
* spawn.cc: Move command line handling stuff into winf.cc.
* winf.h: New file.
* winf.cc: New file.
2006-04-12 15:53:22 +00:00
Christopher Faylor fc2eba361c * lib/libcmain.c (main): Properly deal with quoted first argument. 2004-12-09 21:28:32 +00:00
Corinna Vinschen 2b94cfce89 * lib/_cygwin_crt0_common.cc: Revert patch from 2004-09-16. Brakes
newly built DLLs.
2004-09-27 16:30:44 +00:00
Corinna Vinschen 368ffbe3d8 * cygwin.din (_impure_ptr): Don't export.
(reent_data): Export.
	* lib/_cygwin_crt0_common.cc (_impure_ptr): Drop entirely.  Don't
	initialize _impure_ptr or u->impure_ptr_ptr.
2004-09-16 09:14:29 +00:00
Christopher Faylor 22a1a24f10 * cygwin.din (_impure_ptr): Export.
(reent_data): Don't export.
* dcrt0.cc (reent_data): Drop.
(__cygwin_user_data): Initialize impure_ptr as GLOBAL_REENT.
(_dll_crt0): Initialize _impure_ptr as GLOBAL_REENT.
* lib/_cygwin_crt0_common.cc (_impure_ptr): Drop.  Declare extern as dllimport
instead.
2004-09-16 03:49:03 +00:00
Christopher Faylor a7d42fef9f * cygwin.din: Make crt0 functions NOSIGFE.
* include/cygwin/version.h: Gratuitous comment change.
* lib/_cygwin_crt0_common.cc: Remove unneeded declaration.
2003-12-31 06:30:48 +00:00
Corinna Vinschen 932a40e86b * Makefile.in (DLL_OFILES): Add getopt.o and iruserok.o.
* cygwin.din: Export __check_rhosts_file, __rcmd_errstr, optarg,
	opterr, optind, optopt, optreset, getopt, getopt_long, iruserok
	and ruserok.
	* getopt.c: Moved from lib to here.  Define opt* variables as
	dllexport.
	* iruserok.c: Moved from lib to here.  Rearrange function order.
	Prefer using 64/32 bit functions.
	* syscalls.cc (shell_fp): Define as struct __sFILE64.
	(getusershell): Use fopen64 instead of fopen.
	* winsup.h: Add declarations for seteuid32, fopen64,
	cygwin_gethostbyname and cygwin_inet_addr.
	* include/getopt.h: Declare opt* variables dllimport.
	* include/cygwin/version.h: Bump API minor number.
2003-09-10 19:13:05 +00:00
Corinna Vinschen 34a1d63d80 * Makefile.in (DLL_OFILES): Add bsdlib.o.
* autoload.cc (RegisterServiceProcess): Add.
	* bsdlib.cc: New file.
	(daemon): New function.
	(login_tty): Ditto.
	(openpty): Ditto.
	(forkpty): Ditto.
	* cygwin.din: Export daemon, forkpty, login_tty, logwtmp, updwtmp,
	openpty and revoke.
	* syscalls.cc (updwtmp): New function, writing to wtmp exclusively.
	(logwtmp): Ditto.
	(login): Call updwtmp instead of writing to wtmp by itself.
	(logout): Ditto.
	* tty.cc (revoke): New funtion.
	* include/paths.h: Define _PATH_DEVNULL.
	* include/pty.h: New header.
	* include/cygwin/version.h: Bump API minor number.
	* include/sys/utmp.h: Declare logwtmp with const arguments.
	Declare updwtmp.
	* lib/iruserok.c: New file.
	(ruserok): New function.
	(iruserok): Ditto.
	(__ivaliduser): Ditto.
	(__icheckhost): Ditto.
2003-09-10 15:51:59 +00:00
Christopher Faylor cffdb4b17f * lib/getopt.c: Refresh from NetBSD sources. 2003-03-03 04:30:09 +00:00
Christopher Faylor c2c6b1701a * lib/getopt.c: Nuke use of unneeded BSDisms. 2003-03-02 22:52:18 +00:00
Christopher Faylor ba6e108396 * lib/getopt.c: Allow environment variable control of POSIXLY_INCORRECT behavior. 2003-01-30 01:14:30 +00:00
Christopher Faylor b862c42198 * lib/pseudo-reloc.c: New file.
* lib/_cygwin_crt0_common.cc: Perform pseudo-relocs during initialization of
cygwin binary (.exe or .dll).
2002-12-09 22:49:12 +00:00
Christopher Faylor eecef29f50 * lib/_cygwin_S_IEXEC.cc: Remove obsolete file. 2002-06-24 02:08:41 +00:00
Corinna Vinschen ac0ac6534d * winsup.h: Remove alloca definition since it's now defined through
inclusion of stdlib.h.
	* lib/cygwin_crt0.c: Ditto.
2001-11-14 10:47:54 +00:00
Corinna Vinschen e2c07930f7 * lib/getopt.c (getopt_internal): Reset optind to 1 only if optreset
is not set.
2001-11-07 11:47:23 +00:00
Christopher Faylor 9c510edc61 Eliminate excess whitespace. 2001-11-05 06:09:15 +00:00
Christopher Faylor 3263838430 * select.cc (peek_pipe): Only grab mutex when we actually got something from
the pipe.
2001-09-24 22:49:12 +00:00
Christopher Faylor 9e5ad282f0 * lib/getopt.c (__progname): Don't declare if not compiling for cygwin. 2001-09-19 16:24:10 +00:00
Corinna Vinschen 09376842d4 * lib/getopt.c (getopt_long): Avoid compiler warning. 2001-09-19 16:08:33 +00:00
Christopher Faylor 596f3269b0 * lib/getopt.c: Use __progname==__argv[0] when not compiling for cygwin.
* scandir.cc (scandir): Use correct default when compar == NULL.
2001-09-19 15:54:12 +00:00
Christopher Faylor 5733509e25 * cygwin.din (__argv): Export.
(__argc): Ditto.
(__progname): Ditto.
* include/getopt.h (getopt_long): constify arguments.
* lib/getopt.c: Import new file from NetBSD.
2001-09-19 01:07:11 +00:00
Christopher Faylor e3c25c4a47 Update copyrights. 2001-09-11 20:01:02 +00:00
Christopher Faylor 792011508a * cygheap.cc (_cfree): Add regparm attribute.
(_crealloc): Ditto.
* dcrt0.cc (dll_crt0_1): Default to always checking for executable for now.
* dtable.cc (dtable::not_open): Move method.
* dtable.h (dtable): Here.
* exceptions.cc (ctrl_c_handler): Don't expect process group leader to handle a
signal if it doesn't exist.
* fhandler.h (fhandler_base): Make openflags protected.
* localtime.c (tzsetwall): Check for __CYGWIN__ as well as __WIN32__.
* path.cc (path_conv::check): Add some comments.  Change strcat to assignment.
* lib/_cygwin_S_IEXEC.cc (_cygwin_bob__): Eliminate.
* fhandler_tty.cc (fhandler_console::dup): Set controlling terminal if
necessary.
* fhandler_tty.cc (fhandler_tty_slave::dup): Ditto.
2001-05-08 15:16:49 +00:00
Christopher Faylor 1ac6d1a144 * lib/_cygwin_S_IEXEC.c: Remove "const" from globals or they never seem to be
defined.  Wrap definitions in extern "C".  Include winsup.h to assure proper
definitions.
* dcrt0.cc (dll_crt0_1): Call stdio_init after premain run so that binmode.o,
etc., will control default stdio settings.
* dtable.cc (dtable::init_std_file_from_handle): Allow __fmode to force
binmode/textmode settings.  Default pipes to binmode.
2001-03-28 03:42:58 +00:00
Christopher Faylor 95a8465ba0 * dlopen.c (dlopen): Return NULL when name is NULL (suggested by
chrisiasci@aol.com).
* cygwin.din: Add a new, internally used export - _check_for_executable.
* dcrt0.cc (dll_crt0_1): Set _check_for_executable for older binaries.  Pass
user_data to premain functions.
* fhandler.cc (fhandler_disk_file::open): Only check for executable if the
linked program is intereested in the executable bit.
(fhandler_disk_file::check_execable_p): Delete.
* fhandler.h (executable_states): New enumeration of various states of
executable bit caring.
(fhandler_base::set_execable_p): New method.
* fhandler_termios.cc (fhandler_termios::line_edit): Flag when a signal has
been sent to the tty.  Return -1 when this is so.
* fhandler_console.cc (fhandler_console::read): Return -1 when signal sending
character encountered.
* path.cc (path_conv::check): Record when path refers to a disk device.  Move
executable extension check here.
(check_sysfile): Accomodate new EXEC path states.
(has_suffix): Remove.
(next_suffix): Remove.
(class suffix_scan): New clas.
(suffix_scan::has): New method.
(suffix_scan:next): New method.
(symlink_info::check): Use suffix_scan method to control for scanning for
suffixes.
* path.h (path_conv::exec_state): New method.
* perprocess.h: Make "C" friendly.
* include/cygwin/version.h: Define CYGWIN_VERSION_CHECK_FOR_S_IEXEC.  Bump
CYGWIN_VERSION_API_MINOR.
* include/sys/cygwin.h: Change premain declarations.
* winsup.h: Move __cplusplus test to after builtin defines.
2001-03-05 06:28:25 +00:00
Christopher Faylor 077ec4cb37 * pinfo.cc (codepage_init): Move function.
* environ.cc (codepage_init): To here.
* exceptoins.cc (SIG_NONMASKABLE): Remove SIGCONT from consideration since it
is supposed to be maskable.
* signal.cc (sigaction): Ditto.
* sigproc.cc (wait_sig): Ditto.
* winsup.h: Eliminate global declaration of codepage_init.
2001-01-08 04:02:02 +00:00
Christopher Faylor 70a11195b9 * path.cc (get_device_number): Allow /dev/ttySn to designate a com port. 2000-11-13 04:06:41 +00:00
Christopher Faylor 75a57bf04a Whitespace cleanup.
* configure.in: Eliminate subdir stuff.
* configure: Regenerate.
* include/getopt.h (option): Make name field 'const'.
2000-10-28 05:41:44 +00:00
Christopher Faylor 2137295d10 * lib/_cygwin_crt0_common.cc: Add missing header files. 2000-09-08 15:54:36 +00:00
Christopher Faylor 9eef1530d5 * include/cygwin/cygwin_dll.h: Update for modern compilers.
* lib/cygwin_crt0.c: Inexplicably need to define alloca for newer compilers.
* fhandler.h (fhandler_console): Add new method.
* fhandler.cc (fhandler_console::set_cursor_maybe): New method.
(fhandler_console::read): Set cursor if it has moved to make it visible.
2000-07-29 04:19:24 +00:00
Christopher Faylor 5bc584ba65 Throughout, eliminate third argument to path_conv and use new PC_* constants
for second argument.
* path.h: Generalize SYMLINK_* constants to PC_*.
(path_conv): Create a new method.  Fold third argument into second.
* dll_init.cc (dll_list::alloc): Try harder to find space to allocate dll
struct.
(dll_dllcrt0): Don't check sanity if we've already called dll_crt0.
* path.cc (path_conv::check): Don't check for a null or empty path unless
specifically told with a flag setting.
(check_null_empty_path): New function, adapted from macro.
* syscalls.cc (_rename): Use already-determined file attributes rather than
checking again.
* lib/cygwin/cygwin_attach.dll.c (cygwin_attach_dll): Use a static per_process
structure since this is apparently supposed to be zeroed.
* lib/cygwin_crt0.c (cygwin_crt0): Zero per_process structure sent to older
DLLs.
2000-07-17 19:18:21 +00:00
Christopher Faylor c609f9dcec * _cygwin_crt0_common.cc: Undef 'environ' or suffer compiler error. 2000-07-17 00:24:56 +00:00
Christopher Faylor 2eb392bd77 * hinfo.cc (hinfo::linearize_fd_array): Make max_used_fd an int so that we can
detect when there are no fds to pass.
* dcrt0.cc (host_dependent_constants::init): Revert Sat Mar 18 01:32:04 2000
change.
(dll_crt0_1): Set "cygwin_finished_initializing" flag.
(dll_crt0): Don't perform memcpy if uptr is already set to internal structure.
(_dll_crt0): Remember location of programs envptr.
* dll_init.h (per_module, dll, dll_list): Revamp.
* dll_init.cc: Revamp.  Use new classes.
* fork.cc (fork): Use new revamped dll, dll_list, and per_module stuff.
* environ.cc: Use __cygwin_environ throughout rather than the
user_data->envptr.
* exec.cc: Ditto.
* spawn.cc: Ditto.
* winsup.h: Declare update_envptrs, cygwin_finished_initializing.
* lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Revert previous change.
* lib/cygwin_attach_dll.cc (cygwin_attach_dll): Always pass in own per_process
structure or we end up overwriting information from the main program.
2000-07-15 02:48:11 +00:00
Christopher Faylor a0f7b496ad * lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Don't reset environ if
already set.
2000-07-12 04:02:45 +00:00
Christopher Faylor 85219b356e * external.cc (cygwin_internal): Export __cygwin_user_data.
* include/sys/cygwin.h: Allow definition of per_process even when not compiling
with C++.
(cygwin_getinfo_types): Add CW_USER_DATA.
* lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Get __cygwin_user_data
pointer from cygwin_internal.  If it doesn't exist, return failure.  Use either
this pointer or passed in pointer throughout.  Clear forkee.
* lib/crt0.h: Accomodate argument changes to _cygwin_crt0_common.
* lib/cygwin_attach_dll.c (cygwin_attach_dll): Reorganize to allow use of newer
binaries with older DLLs.  Detect older DLLs when _cygwin_crt0_common returns 0
and allocate space for a per_process structure on the stack.
* lib/cygwin_crt0.c (cygwin_crt0): Ditto.
2000-07-08 04:36:27 +00:00