Commit Graph

5338 Commits

Author SHA1 Message Date
Christopher Faylor 280fdd0b67 * dcrt0.cc (getstack): New function.
(alloc_stack): Use tls stuff for stack info rather than calling VirtualQuery.
(dll_crt0_0): Initialize _impure_ptr stuff much earlier.  Move
init_console_handler here.
* fork.cc (class frok): New class renamed from local fork() struct.
(stack_base): Change argument type.  Use tls stuff to determine stack info
rather than calling VirtualQuery.
(frok::child): Rename from fork_child.  Eliminate now unneeded arguments.
(frok::parent): Rename from fork_parent and ditto.  Set error and errno as
appropriate.  Fixup impersonation in cleanup, if needed.  Try harder to set
errno appropriately.
(fork): Define "grouped" as a frok type.  Deal with errors from fork_parent
here.
* init.cc (dll_entry): Remove init_console_handler call.
2005-09-28 15:18:49 +00:00
Christopher Faylor 9edadc960e * pinfo.cc (_pinfo::dup_proc_pipe): Ignore error if the child process has just
gone away.
2005-09-28 13:55:04 +00:00
Christopher Faylor 43634a4158 * init.cc (prime_threads): Make this static, as it should be.
(dll_entry): Apply cosmetic changes to define closer to the way MSDN suggests.
2005-09-28 02:43:29 +00:00
Corinna Vinschen 22704a8da3 * pthread.cc (mangle_sem_name): Use cygheap->shared_prefix instead
of fiddling with wincap.has_terminal_services manually.
2005-09-27 20:34:19 +00:00
Corinna Vinschen f1cdab8563 * cygheap.cc (cygheap_init): Add GLOBAL_PRIV to hProcToken explicitely
since hProcImpToken isn't initialized here.
	* shared.cc (open_shared): Always print mapname instead of name in
	debug output.
2005-09-27 19:04:38 +00:00
Christopher Faylor e0be0a1d50 * strace.cc (strace::vsprntf): Avoid printing a zero pid. 2005-09-27 18:54:32 +00:00
Corinna Vinschen 91049bd9cd * init.cc (dll_entry): Call IsWow64Process with GetCurrentProcess
as process handle since hMainProc isn't initialized here.
2005-09-27 17:44:29 +00:00
Corinna Vinschen 357d430185 * fhandler_floppy.cc (fhandler_dev_floppy::get_drive_info): Always
try IOCTL_DISK_GET_DRIVE_GEOMETRY_EX and
	IOCTL_DISK_GET_PARTITION_INFO_EX ioctls first, to allow access to GPT
	partitioned disks.  Fall back to old non-EX ioctls otherwise.
	Add comment to explain NT4 weirdness.
2005-09-27 15:33:02 +00:00
Corinna Vinschen 6c22c79f73 * errno.cc (errmap): Map ERROR_SEEK and ERROR_SECTOR_NOT_FOUND. 2005-09-26 15:27:15 +00:00
Christopher Faylor a3d5219c5f * exceptions.cc (_cygtls::call_signal_handler): Minor cleanup. 2005-09-26 14:58:16 +00:00
Corinna Vinschen b470a0e81f * fhandler.h (class fhandler_dev_raw): Add drive information members
drive_size, current_position and bytes_per_sector.
	(fhandler_dev_floppy::get_drive_info): Declare.
	* fhandler_floppy.cc (fhandler_dev_floppy::is_eom): Define ERROR_SEEK
	and ERROR_SECTOR_NOT_FOUND as end-of-medium conditions.
	(fhandler_dev_floppy::get_drive_info): New method to have one function
	retrieving drive info.
	(fhandler_dev_floppy::open): Call get_drive_info to get drive
	information right from the start.
	(fhandler_dev_floppy::lseek): Use and set drive information members.
	Especially keep track of current_position.
	(fhandler_dev_floppy::ioctl): Ditto.
	* fhandler_raw.cc (fhandler_dev_raw::write_file): Keep track of
	current_position.
	(fhandler_dev_raw::read_file): Ditto.
	(fhandler_dev_raw::raw_read): Never try to read beyond end-of-medium.
	(fhandler_dev_raw::dup): Handle new drive information members.
2005-09-26 14:55:40 +00:00
Christopher Faylor d5f4ee62b7 * exceptions.cc (handle_exceptions): Just si_code to SI_KERNEL first and let it
be overridden.
* exceptions.cc (_cygtls::call_signal_handler): Call signal handler with extra
siginfo_t * and void * parameters when SA_SIGINFO flag is set.
* signal.cc (signal): Clear SA_SIGINFO flag.
(sigqueue): Fix incorrect setting of si_code.
* sigproc.cc (signal_fixup_after_exec): Clear SA_SIGINFO flag when setting
handler to SIG_DFL.
2005-09-26 14:51:48 +00:00
Christopher Faylor 683cc8189c * pinfo.cc (proc_waiter): Properly fill out si_code as according to SUSv3.
* exceptions.cc (handle_exceptions): Properly fill out si_code as according to
SUSv3.
2005-09-26 13:47:27 +00:00
Christopher Faylor f086715060 * exceptions.cc (handle_exceptions): Properly fill out si_code. 2005-09-26 13:23:47 +00:00
Christopher Faylor 529649f983 * sigproc.cc (wait_sig): Cosmetic change.
* pinfo.cc (pinfo::exit): Don't explicitly remove myself since some other
thread may still be using it.
2005-09-26 01:27:36 +00:00
Joshua Daniel Franklin 7b96339c80 2005-09-25 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
* faq.xml: Remove copyright section, link to license.html
	* faq-sections.xml: Remove copyright section, link to license.html
	* faq-programming.xml: Remove confusing reference to Red Hat.
	* faq-what.xml: Reword "supported" FAQ.
2005-09-26 00:29:51 +00:00
Christopher Faylor 6f96c53642 * sigproc.cc (sigproc_terminate): More reversion of always-exit-from-sigthread
change.
2005-09-24 19:17:49 +00:00
Danny Smith e6e55ca6a2 * include/math.h (HUGE_VALF, HUGE_VALL, INFINITY, NAN)
Avoid raising FP exceptions.
2005-09-24 01:26:24 +00:00
Christopher Faylor 5cbcdfa9dd * shared.cc (open_shared): Add crucial bit of debugging info. 2005-09-23 23:56:17 +00:00
Christopher Faylor 5e477e9a9b Semi-reversion of always-exit-from-sigthread change of 2005-09-15.
* exceptions.cc (sigpacket::process): Eliminate return after call to reinstated
noreturn function.
(signal_exit): Allow function to exit when a captive process has been
terminated.
* pinfo.cc (pinfo::exit): Enter exit_lock here.  Once again exit here under
control of exit_lock.
* sigproc.cc (sig_send): Don't wait for completion if process is exiting.
Remove special __SIGEXIT accommodations.
(wait_sig): Just exit the thread when a __SIGEXIT has been detected.  Don't
exit the process.
2005-09-23 23:37:52 +00:00
Christopher Faylor 1b19d74296 * net.cc (cygwin_gethostbyname): Remove debugging cruft. 2005-09-23 23:25:25 +00:00
Chris Sutcliffe 2b4f76269d 2005-09-23 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
* lib/ddk/newdev.def: Added.
        Thanks to: Stephan Meyer <ste_meyer at users dot sourceforge dot net>
2005-09-23 22:41:24 +00:00
Christopher Faylor 0017e72675 * pinfo.cc (pinfo::exit): Call ExitProcess if called from signal thread. 2005-09-23 20:05:50 +00:00
Chris Sutcliffe e68bd70ab4 2005-09-23 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
* include/commdlg.h (OPENFILENAME): Added WINNT >= 0x0500
        component.
        Thanks to: Gennady Feldman <gena01 at users dot sourceforge dot net>
2005-09-23 19:59:33 +00:00
Christopher Faylor 0c75486267 * tlsoffsets.h: Regenerate. 2005-09-23 19:24:03 +00:00
Christopher Faylor 08c7ea264b * pinfo.cc (pinfo::exit): Eliminate use of _my_tls.thread_handle. 2005-09-23 19:23:26 +00:00
Christopher Faylor 255e7e559e * cygtls.h (struct _cygtls::thread_handle): Remove/revert.
* sigproc.h (struct sipacket::thread_handle): Put thread_handle here.
* sigproc.cc (sigproc_terminate): Move setting of thread_handle...
(sig_send): ...to here.  Put it in packet being sent.  Only close pack.wakeup
when we're waiting for completion.
(wait_sig): Use thread_handle directly from received packet.
2005-09-23 15:18:22 +00:00
Chris Sutcliffe e7a76793ad 2005-09-23 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
* lib/shell32.def (SHILCreateFromPath): Add stub.
        Thanks to: Michael Jung <mjung at iss dot tu-darmstadt dot de>
2005-09-23 10:50:15 +00:00
Christopher Faylor 85b0face89 * tlsoffsets.h: Regenerate. 2005-09-23 03:40:57 +00:00
Christopher Faylor 936e4018b6 * cygheap.cc (cygheap_fixup_in_child): It's not just for exec.
* cygtls.h (struct _cygtls::thread_handle): New field.
* dcrt0.cc (exit_lock): Remove declaration.
* winsup.h (exit_lock): Add declaration.
* exceptions.cc (sigpacket::process): Properly return after signal_exit.
* pinfo.cc (pinfo::exit): Only exit the process if _my_tls.thread_handle has
not been filled out -- which should be an impossible event.
* sigproc.cc (sigproc_terminate): Fillout _my_tls.thread_handle to provide
something for wait_sig to wait for.  Use the siginfo_t version of sig_send and
fill out the tls argument with _my_tls.
(wait_sig): Wait for the thread specified in pack.tls or (for now) complain
bitterly if it doesn't exit.
2005-09-23 03:35:41 +00:00
Christopher Faylor 4340c43955 * pinfo.cc (set_myself): Call strace.hello unconditionally when DEBUGGING.
(pinfo::init): Sleep and issue debugging output before looping when a
PID_EXITED is found.
2005-09-22 21:10:07 +00:00
Corinna Vinschen b30dbbe2c3 * fhandler_disk_file.cc (fhandler_base::fstat_helper): Fix copy/paste
bug.
2005-09-22 17:53:38 +00:00
Christopher Faylor 378017d7c2 * strace.cc (strace::vsprntf): Avoid accessing myself->pid if !myself. 2005-09-22 17:06:48 +00:00
Christopher Faylor 7e7a719a8e * include/sys/strace.h (_STRACE_ON): Remove semicolon from definition.
(_STRACE_OFF): Remove semicolon from definition.
2005-09-22 16:41:36 +00:00
Corinna Vinschen f3810c7281 * fhandler.h (fhandler_base::fstat_helper): Declare with additional
file attributes argument.
	* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Use
	file attributes evaluated from NtQueryFileInformation or
	FileInformationByHandle in call to fstat_helper.
	Set pc.fileattr from just evaluated file attributes here.
	(fhandler_base::fstat_by_name): Use file attributes evaluated from
	FindFileFirst or default attribute in call to fstat_helper.
	Set pc.fileattr from just evaluated file attributes here.
	(fhandler_base::fstat_helper): Use file attributes given as argument,
	not file attributes stored in this fhandler, since this information
	is potentially wrong.  Add comment to explain this.
	* path.h (has_attribute): New global inline function.
	(path_conv::set_attributes): New method to change fileattr.
2005-09-22 15:52:02 +00:00
Corinna Vinschen f3a61fc4aa Fix typo. 2005-09-21 22:27:38 +00:00
Corinna Vinschen d829da1423 Align error message handling to mkpasswd's error messages throughout.
* mkgroup.c (print_win_error): Create macro calling ...
	(_print_win_error): ... this function created from former
	print_win_error.  Move up in source.
	(PDOMAIN_CONTROLLER_INFOW): Define return type of DcGetDcNameW.
	(dsgetdcname): New function pointer for DcGetDcNameW.
	(load_netapi): Get DcGetDcNameW address.
	(main): If DcGetDcNameW is available, use it.
	* mkpasswd.c (PDOMAIN_CONTROLLER_INFOW): Define return type of
	DcGetDcNameW.
	(dsgetdcname): New function pointer for DcGetDcNameW.
	(load_netapi): Get DcGetDcNameW address.
	(main): If DcGetDcNameW is available, use it.  Rename local variable
	domain_name_specified to domain_specified as in mkgroup.c.
2005-09-21 22:26:08 +00:00
Christopher Faylor faf4210542 * cygthread.cc (cygthread::operator new): Just use getenv() to look for
CYGWIN_FREERANGE_NOCHECK since the Windows environment may be truncated by
being previously execed.
2005-09-21 19:29:50 +00:00
Chris Sutcliffe 574c2ba2a3 2005-09-21 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
* include/winbase.h (RegisterWaitForSingleObject,
	RegisterWaitForSingleObjectEx): Define.
	* lib/kernel32.def (RegisterWaitForSingleObjectEx@20): Define.
	(RegisterWaitForSingleObject@16): Changed to
	RegisterWaitForSingleObject@24.
	Thanks to: Brandon Sneed <nivenh at users dot sourceforge dot net>
2005-09-21 19:20:46 +00:00
Christopher Faylor e15e9fc9a7 * spawn.cc (av::fixup): Just blindly run any file if it has a .bat or .cmd
extension.
2005-09-20 18:32:23 +00:00
Christopher Faylor c529909f45 * dcrt0.cc (do_exit): Only call sigproc_terminate from one location --
pinfo::exit.
* pinfo.cc (pinfo::exit): Move sigproc_terminate later so that signals can be
processed while waiting for hExeced child.
(pinfo::maybe_set_exit_code_from_windows): Set exit code from sigExeced if it
is non-zero.  Set exit_state to ES_EXEC_EXIT prior to waiting for captive
process exit code.
* exceptions.cc (sigExeced): New global variable.
(signal_exit): Remove noreturn attribute from declaration.
(signal_exit): Just terminate captive process and return if hExeced on the
theory that the exit will be subsequently handled in the main thread.
* sigproc.cc (sigproc_terminate): Eliminate test for ES_SIGPROCTERMINATE and
use ES_FINAL instead.
(sig_send): Use no_signals_available instead of duplicate test.
* winsup.h (ES_EXEC_EXIT): New enum.
(ES_SIGPROCTERMINATE): Delete.
2005-09-20 02:06:57 +00:00
Christopher Faylor e60ec8bf96 white space changes to force new snapshot 2005-09-19 15:50:56 +00:00
Christopher Faylor 1bde6e09a6 * sigproc.cc (talktome): Take siginfo_t argument. Don't scan all pids trying
to find one that's talking to me.  Just use the pid from siginfo_t.
(wait_pid): Pass siginfo_t argument to talktome.
2005-09-19 14:15:06 +00:00
Danny Smith 64cf26a0e9 * include/winsock2.h (SO_EXCLUSIVEADDRUSE): Define.
Thanks to Gisle Vanem  <giva at bgnett dot no>
2005-09-19 10:32:51 +00:00
Danny Smith c1c5de21a9 * include/stdlib.h (strtof): Add prototype. Uglify
parameter names in inline definition.
	(wcstof): Likewise.
	(_Exit): Uglify	parameter names in inline definition.
	(llabs): Add prototype.
	(_set_error_mode): Add prototype and input defines.
2005-09-19 09:48:08 +00:00
Christopher Faylor 0d8efc429f * pipe.cc (fhandler_pipe::open): Use 'cfree' to free buffer since it is now
allocated by cmalloc.
2005-09-17 20:36:34 +00:00
Corinna Vinschen 5da8b1281b * net.cc (cygwin_inet_ntop): Change len argument to socklen_t to
follow SUSv3.
	* include/arpa/inet.h (inet_ntop): Ditto.
	* include/cygwin/in.h: Include cygwin/socket.h to get socklen_t.
2005-09-17 08:55:30 +00:00
Christopher Faylor b3ecdcf438 * environ.cc (build_env): Use "kilo"bytes not "mega"bytes. Return immediately
on error.
* spawn.cc (spawn_guts): Set return value to -1 on error from build_env.
2005-09-16 20:12:12 +00:00
Christopher Faylor e4d981b957 * environ.cc (build_env): Clear envblock and return NULL on attempt to use env
var > 32K.
* spawn.cc (spawn_guts): Set E2BIG if build_env detects an error.
2005-09-16 19:58:12 +00:00
Christopher Faylor 541ea31352 * environ.cc (environ_init): Protect with a 'myfault' in case
GetEnvironmentStrings misbehaves.
* environ.cc (environ_init): Add debugging output with value returned from
GetEnvironmentStrings.
2005-09-16 15:56:06 +00:00