Commit Graph

377 Commits

Author SHA1 Message Date
Takashi Yano 583102e7c9 Cygwin: pty: Fix state management for pseudo console support.
- Pseudo console support introduced by commit
  169d65a577 has some bugs which
  cause mismatch between state variables and real pseudo console
  state regarding console attaching and r/w pipe switching. This
  patch fixes this issue by redesigning the state management.
2019-09-04 12:05:15 +02:00
Takashi Yano 169d65a577 Cygwin: pty: add pseudo console support.
- Support pseudo console in PTY. Pseudo console is a new feature
  in Windows 10 1809, which provides console APIs on virtual
  terminal. With this patch, native console applications can work
  in PTYs such as mintty, ssh, gnu screen or tmux.
2019-08-29 13:47:40 +02:00
Corinna Vinschen 98669a2476 Cygwin: exec: check execute bit prior to evaluating script
When the exec family of functions is called for a script-like
file, the av::setup function handles the exec[vl]p case as
well.  The execve case for files not starting with a she-bang
is handled first by returning ENOEXEC.  Only after that, the
file's executability is checked.

This leads to the problem that ENOEXEC is returned for non-executable
files as well.  A calling shell interprets this as a file it should try
to run as script.  This is not desired for non-executable files.

Fix this problem by checking the file for executability first.  Only
after that, follow the other potential code paths.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-08-06 10:50:42 +02:00
Michael Haubenwallner 23a779bf3d Cygwin: pinfo: stop remember doing reattach
During fork, the child process requires the process table to be
initialized for fixup_shms_after_fork, while still allowing subsequent
dlls.load_after_fork to fail silently (for when the "forkable" hardlinks
are not created yet).
pinfo::remember not performing reattach anymore requires explicit
pinfo::reattach now where appropriate.

Prepares to improve "Cygwin: fork: Remember child not before success."
commit f03ea8e1c5, which leads to fork
problems if cygserver is running:

https://cygwin.com/ml/cygwin-patches/2019-q2/msg00155.html
2019-07-31 13:27:47 +02:00
Corinna Vinschen 557227dda3 Cygwin: winpids: Fix getting process multiple times, take 2
commit d1be0a59d4,
"Cygwin: winpids: Fix getting process multiple times"
fixed duplicate processes in ps -W output, but it fixed
the symptom, not the cause.  It also didn't fix the problem
that the `ps' process itself may show up twice in its own
output.

This patch fixes it.  The spawn worker only deleted the
"winpid.PID" symlink of the current process if the child is
a non-Cygwin process, under the assumption that the exec'ing
process exits anyway.  However, the Window in which both
winpid.PID symlinks point to the same cygpid.PID area is just
too long.  The spawn worker now also deletes its own winpid.PID
symlink if the exec'ed process is a Cygwin process.

Additionally the fix from d1be0a59d4
is now performed on the calling process, too.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-04-02 13:00:22 +02:00
Corinna Vinschen 24f9cb015e Cygwin: fork/exec: Allow all users PROCESS_QUERY_LIMITED_INFORMATION
Create process with standard rights, plus
PROCESS_QUERY_LIMITED_INFORMATION for authenticated users.  This
allows to fetch basic process information and thus /proc/<PID>/stat
to succeed on foreign processes.

While at it, fix formatting in CreateProcess calls.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-03-12 11:41:35 +01:00
Corinna Vinschen 88605243a1 Cygwin: fix child getting another pid after spawnve
When calling spawnve, in contrast to execve, the parent has
to create the pid for the child.  With the old technique
this was simply the Windows pid, but now we have to inform
the child about its new pid.

Add a cygpid member to class child_info_spawn.  Set it in
child_info_spawn::worker, just prior to calling CreateProcess
rather than afterwards.  Overwrite cygheap->pid in
child_info_spawn::handle_spawn before calling pinfo::thisproc.
Make sure pinfo::thisproc knows the pid is already set by
setting the handle argument to INVALID_HANDLE_VALUE.

Also set procinfo->dwProcessId to myself_initial.dwProcessId
instead of to myself_initial.pid for clarity.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-08 15:49:47 +01:00
Corinna Vinschen 3a3934252c Cygwin: spawn: create and maintain winpid symlinks
- If the execve'ed process is a non-Cygwin process, we have to
  create the matching winpid symlink and remove the old one
  ourselves.

- If we spawn a child, the winpid symlink has to be maintained
  by the child process, otherwise it disappears if the parent
  process exits.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-02 20:01:41 +01:00
Corinna Vinschen b5e1003722 Cygwin: processes: use dedicated Cygwin PID rather than Windows PID
Using the Windows PID as Cygwin PID has a few drawbacks:

- the PIDs on Windows get reused quickly.  Some POSIX applications choke
  on that, so we need extra code to avoid too quick PID reuse.

- The code to avoid PID reuse keeps parent process handles and
  (depending on a build option) child processes open unnecessarily.

- After an execve, the process has a split personality:  Its Windows PID
  is a new PID, while its Cygwin PID is the PID of the execve caller
  process.  This requires to keep two procinfo shared sections open, the
  second just to redirect process info requests to the first, correct
  one.

This patch changes the way Cygwin PIDs are generated:

- Cygwin PIDs are generated independently of the Windows PID, in a way
  expected by POSIX processes.  The PIDs are created incrementally in
  the range between 2 and 65535, round-robin.

- On startup of the first Cygwin process, choose a semi-random start PID
  for the first process in the lower PID range to make the PIDs slightly
  unpredictable.  This may not be necessary but it seems kind of inviting
  to know that the first Cygwin process always starts with PID 2.

- Every process not only creates the shared procinfo section, but also a
  symlink in the NT namespace, symlinking the Windows PID to the Cygwin
  PID.  This drops the need for the extra procinfo section after execve.

- Don't keep other process handles around unnecessarily.

- Simplify the code creating/opening the shared procinfo section and
  make a clear distinction between interfaces getting a Cygwin PID and
  interfaces getting a Windows PID.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-01 20:06:47 +01:00
Corinna Vinschen da5b48ef3c No longer support "Interact with desktop"
Always create child user window station and desktop, unless only
spawning with restricted token.  Also fix formatting of a few comments
in child_info_spawn::worker.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-25 00:42:36 +02:00
Corinna Vinschen 8b8c6c014b Drop has_program_compatibility_assistant flag 2016-06-24 16:02:40 +02:00
Corinna Vinschen 6e623e9320 Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout option
Bump GPLv2+ to GPLv3+ for some files, clarify BSD 2-clause.

Everything else stays under GPLv3+.

New Linking Exception exempts resulting executables from LGPLv3 section 4.

Add CONTRIBUTORS file to keep track of licensing.

Remove 'Copyright Red Hat Inc' comments.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-23 10:09:17 +02:00
Peter Foley b259af51b8 Remove remnants of never-defined MALLOC_DEBUG and NEWVFORK
MALLOC_DEBUG and NEWVFORK haven't been defined since 2008 (4616253751).
Remove all references to tem.

winsup/cygwin/ChangeLog:
acconfig.h: delete
dcrt0.cc (dll_crt0_1): remove NEWVFORK code.
dcrt0.cc (do_exit): ditto.
debug.h: ditto.
dtable.h: ditto.
winsup.h: ditto.
globals.cc: ditto.
malloc_wrapper.cc: ditto.
malloc_wrapper.cc (malloc_init): ditto.
spawn.cc (spawnve): ditto.
syscalls.cc (setsid): ditto.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
2016-04-01 13:53:25 +02:00
Corinna Vinschen 4c9bb3e0f9 Propagate correct Windows error if executable can't be opened
* spawn.cc (av::setup): Set last Win32 error if NtOpenFile fails.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-17 17:46:11 +01:00
Corinna Vinschen 8f00fa7f36
Avoid name change if script is called via symlink from execvp et al.
* spawn.cc (find_exec): Fix a name change in case of a symlink which
	can be opened as is.

Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
2015-03-17 11:40:12 +01:00
Corinna Vinschen 46ada24209 * spawn.cc (find_exec): Extend preceeding comment to explain more
detailed what's going on in this function.  Overwrite potential symlink
	target with original path.
2015-02-16 11:49:33 +00:00
Corinna Vinschen d2bd82aa92 * path.h (path_conv): Make path_flags private. Rename known_suffix to
suffix and make private.  Rename normalized_path to posix_path and
	make privtae.  Accommodate name changes throughout in path_conv
	methods.
	(path_conv::known_suffix): New method.  Use throughout instead of
	accessing suffix directly.
	(path_conv::get_win32): Constify.
	(path_conv::get_posix): New method to read posix_path.  Use throughout
	instead of accessing normalized_path directly.
	(path_conv::set_posix): Rename from set_normalized_path.  Accommodate
	name change throughout.
	* spawn.cc (find_exec): Return POSIX path, not Win32 path.
2015-02-15 08:59:55 +00:00
Corinna Vinschen 117b1b1edb * dlfcn.cc (check_path_access): Drop FE_NATIVE from find_exec call.
(gfpod_helper): Drop equality sign from environment variable name
	in call to check_path_access.
	* exec.cc (execlp): Drop equality sign from environment variable name
	in call to find_exec.
	(execvp): Ditto.
	(execvpe): Ditto.
	* path.h (enum fe_types): Drop FE_NATIVE.
	(find_exec): Rename third paramter in declaration from search.  Drop
	equality sign from default value.
	* spawn.cc (perhaps_suffix): Add PC_POSIX to path_conv::check call.
	(find_exec): Simplify function.  Iterate over POSIX pathlist rather
	than Windows pathlist.  Drop handling of FE_NATIVE flag.  Always fill
	posix path of incoming path_conv buf, unless FE_NNF flag is given.
	(av::setup): Drop equality sign from environment variable name
	in call to find_exec.  Call unshift with normalized_path.
	* winf.cc (av::unshift): Drop conv parameter and code converting
	Windows to POSIX path.
	* winf.h (av::unshift): Accommodate prototype.
2015-02-11 13:15:59 +00:00
Corinna Vinschen f2b106b2df Revert accidental checkin 2014-12-02 15:41:13 +00:00
Corinna Vinschen df386ddac8 * flock.cc (create_lock_in_parent): Make lf_obj handle inheritable.
Explain why.
	(lockf_t::create_lock_obj): Use FALSE, rather than 0 for BOOL argument.
	(lockf_t::del_lock_obj): Check if NtSetEvent succeeded and print system
	message if not.
2014-12-02 15:39:57 +00:00
Corinna Vinschen 9119d13db8 * autoload.cc (CreateEnvironmentBlock): Import.
(DestroyEnvironmentBlock): Import.
	* environ.cc (env_compare): New static bsearch comparison function.
	(build_env): Add parameter taking a user token.  If token is non-NULL,
	fetch user's default Windows environment and merge it into the resulting
	environment.  Explain what we do in preceeding comment.
	* environ,h (build_env): Align prototype to above change.
	* external.cc (create_winenv): Call build_env with NULL token.
	* spawn.cc (child_info_spawn::worker): When spawning new process under
	another user account, call build_env with new token to allow merging
	user's default Windows environment.
	* winlean.h (_USERENV_): Define to override dllimport.
2014-12-02 10:16:03 +00:00
Corinna Vinschen 0c326d84b5 * spawn.cc (child_info_spawn::worker): Fix formatting. 2014-12-02 10:09:13 +00:00
Corinna Vinschen 3f3bd10104 * Throughout, use __try/__except/__endtry blocks, rather than myfault
handler.
	* cygtls.cc (_cygtls::remove): Accommodate the fact that pathbufs
	has been moved from _local_storage to _cygtls.
	* cygtls.h (class tls_pathbuf): Add comment to hint to gendef usage
	of counters.  Change type of counters to uint32_t for clarity.
	Remove _cygtls as friend class.
	(struct _local_storage): Move pathbufs from here...
	(struct _cygtls): ...to here, allowing to access it from _sigbe.
	(class san): Only define on 32 bit.  Remove errno, _c_cnt and _w_cnt
	members.
	(san::setup): Drop parameter.  Don't initialize removed members.
	(san::leave): Don't set removed members.
	(class myfault): Only define on 32 bit.
	(myfault::faulted): Only keep implementation not taking any parameter.
	Drop argument in call to sebastian.setup.
	(__try/__leave/__except/__endtry): Implement to support real SEH.  For
	now stick to SJLJ on 32 bit.
	* dcrt0.cc (dll_crt0_0): Drop 64 bit call to
	exception::install_myfault_handler.
	* exception.h (exception_handler): Define with EXCEPTION_DISPOSITION
	as return type.
	(PDISPATCHER_CONTEXT): Define as void * on 32 bit.  Define as pointer
	to _DISPATCHER_CONTEXT on 64 bit.
	(class exception): Define separately for 32 and 64 bit.
	(exception::myfault): Add handler for myfault SEH handling on 64 bit.
	(exception::exception): Fix mangled method name to account for change
	in type of last parameter.
	(exception::install_myfault_handler): Remove.
	* exceptions.cc (exception::myfault_handle): Remove.
	(exception::myfault): New SEH handler for 64 bit.
	* gendef (_sigbe): Set tls_pathbuf counters to 0 explicitely when
	returning to the caller.
	* ntdll.h: Move a comment to a better place.
	(struct _SCOPE_TABLE): Define on 64 bit.
	* thread.cc (verifyable_object_isvalid): Remove gcc 4.7 workaround.
	* tls_pbuf.cc (tls_pbuf): Fix to accommodate new place of pathbufs.
	(tls_pathbuf::destroy): Change type of loop variables to uint32_t.
	* tls_pbuf.h (class tmp_pathbuf): Change type of buffer counters to
	uint32_t.  Accommodate new place of pathbufs.
	* tlsoffsets.h: Regenerate.
	* tlsoffsets64.h: Regenerate.
2014-08-22 09:21:33 +00:00
Corinna Vinschen 8431e478d2 * spawn.cc (find_exec): Initialize err (CID 60111).
* strace.cc (strace::activate): Fix potential buffer overrun (CID 59938)
	* syscalls.cc (popen): Close parent pipe descriptor via fclosing fp on
	error to avoid resource leak (CID 59981).
	* thread.cc (pthread::exit): Avoid accessing cygtls member after
	deleting "this" (CID 60217).
2014-06-23 19:05:15 +00:00
Christopher Faylor d8b41bc3d0 * spawn.cc (av::setup): Eat trailing whitespace on #! script. 2014-05-03 19:58:20 +00:00
Corinna Vinschen d2a88d9792 Throughout, drop unnecessary explicit includes of windows header files
included by default.
	* winlean.h: Add long comment to explain why we have to define certain
	symbols.
	(_NORMALIZE_): Define.
	(_WINNLS_): Drop definition and subsequent undef.
	(_WINNETWK_): Ditto.
	(_WINSVC_): Ditto.

2013-11-23  Eric Blake  <eblake@redhat.com>
2013-11-24 12:13:36 +00:00
Christopher Faylor 1560d3e281 cygwin changes:
* spawn.cc (child_info_spawn): Revert previous change.  Always set
	lpReserved2.
	* release/1.7.25: Change wording.
doc changes:
	* new-features.xml (ov-new1.7.25): Change wording.
2013-08-23 18:19:46 +00:00
Corinna Vinschen 10822894db * path.h (enum path_types): Drop definition of PATH_64BITEXEC.
(path_conv::iscygexec32): Drop unused inline function.
	(path_conv::iscygexec64): Ditto.
	(path_conv::set_cygexec): Remove unnecessary setting of PATH_64BITEXEC.
	* spawn.cc (child_info_spawn::worker): Disable setting of
	STARTUPINFOW::lpReserved2 and STARTUPINFOW::cbReserved2 for non-Cygwin
	child processes.  Explain why.
2013-08-23 09:29:25 +00:00
Christopher Faylor 033fe7d87f cygwin directory changes:
* environ.cc (tty_is_gone): Delete.
	(known): Delete tty, add wincmdln.
	* globals.cc: Reorganize list of environment bools, remove explicit =
	false for slight load time optimization.
	(wincmdln): New global.
	* spawn.cc (child_info_spawn::worker): Honor wincmdln.

doc directory changes:
	* new-features.sgml (ov-new1.7.23): Add new section.  Mention wincmdln.
	* cygwinenv.xml: Mention wincmdln.
2013-07-26 17:28:00 +00:00
Christopher Faylor bbdd6c47c9 * spawn.cc (child_info_spawn::worker): Reinstate using temp buffer for wide
character command-line storage.  Use wcs method to convert command line.
* winf.h (lb_wcs): Delete.
(linebuf::wcs): Implement new single-argument method.
2013-07-19 22:44:02 +00:00
Christopher Faylor 521953a83a * common.din: Export GetCommandLine{A,W}.
* kernel32.cc: Add includes needed for GetCommandLine functions.
(ucmd): New function.
(cygwin_GetCommandLineW): Ditto.
(cygwin_GetCommandLineA): Ditto.
* spawn.cc (child_info_spawn::worker): Rename one_line -> cmd.  Use lb_wcs
macro to generate a wide character version of the line buffer.  Remove
duplicate printing of command line.  Don't access members of linebuf directly.
* winf.h: Use pragma once.
(linebuf): Make storage private.
(linebuf::operator size_t): New operator.  Return size of buf.
(linebuf::operator wchar_t): New operator.
(linebuf::wcs): New function.
(lb_wcs): New macro.
* include/cygwin/version.h: Bump API minor number to 268.
* strfuncs.cc: Clarify descriptive file comment.
2013-07-19 17:28:34 +00:00
Christopher Faylor 37ee5b49af * spawn.cc (child_info_spawn::worker): Eliminate call to newargv.set() in favor
of conglomerated newargv.setup().  Let newargv.setup() decide when to call
dup_all().  Only set argc and argv for cygwin processes.
(av::setup): Rename from av::fixup.  Accept argc and argv parameters.  Fill out
argv and argc here.  Duplicate whole argv structure when this is a Cygwin
executable.
* winf.cc (linebuf::fromargv): Don't bother duplicating argv elements since
they will never be used.
* winf.h (av::set): Delete.
(av::setup): Rename from av::fixup.  Add two parameters.
(av::replace0_maybe): Assign calloced to 1 rather than 'true' for clarity.
(av::dup_maybe): Delete.
(av::dup_all): Set calloced to show that we have duplicated all of the
arguments in the list.
2013-06-19 16:00:43 +00:00
Christopher Faylor 9e8cf6ebbd * spawn.cc (child_info_spawn::worker): Eliminate wascygexec. 2013-06-19 14:39:00 +00:00
Christopher Faylor ebba7327e1 * spawn.cc (ILLEGAL_SIG_FUNC_PTR): New define.
(system_call_handle): Rename from system_call_cleanup.
(is_system_call): New convenience method.
(system_call_handle::system_call_handle): Use ILLEGAL_SIG_FUNC_PTR rather than
cast.  Call sig_send here rather than in caller.  Initialize oldint.
(system_call_handle::arm): New function pulled from constructor.
(~system_call_handle::system_call_handle): Use is_system_call().
(child_info_spawn::worker): Use system_call_handle to set up for system call
early.  Use arm call prior to waiting for child to properly set up signal
handling.  Move comment closer to code it is commenting on.
2013-05-03 19:39:01 +00:00
Yaakov Selkowitz 1f36328e7f Throughout, (mainly in fhandler*) fix remaining gcc 4.7 mismatch
warnings between regparm definitions and declarations.
* smallprint.cc (__small_vswprintf): Conditionalize declaration and
setting of l_opt for only x86_64.
* spawn.cc (child_info_spawn::worker): Remove unused 'pid' variable.
* thread.cc (verifyable_object_isvalid): Temporarily define as
non-inline with gcc 4.7+, regardless of target.
2013-05-01 01:20:37 +00:00
Christopher Faylor 3cb9da1461 * spawn.cc (system_call_cleanup): Rename from pthread_cleanup. Extend
functionality.
(system_call_cleanup::system_call_cleanup): Set up signals like system()
requires.  Unblock previously-blocked signal handling.
(system_call_cleanup::~system_call_cleanup): Restore signal handling after
system().
(child_info_spawn::worker): Put signals on hold and use system_call_cleanup
class to set and restore signals rather than doing it prior to to running the
program.  Remove the ill-conceived pthread_cleanup stuff.
2013-04-30 23:51:08 +00:00
Corinna Vinschen 61522196c7 * Merge in cygwin-64bit-branch. 2013-04-23 09:44:36 +00:00
Christopher Faylor 8f8eeb70ba * child_info.h (cygheap_exec_info::sigmask): Declare new field.
* cygheap.cc (init_cygheap::find_tls): Rename threadlist_ix -> ix.  Only take
one pass through thread list, looking for eligible threads to signal.  Set a
new param indicating that function has found a sigwait* mask.
* cygheap.h (init_cygheap::find_tls): Reflect new parameter.
* dcrt0.cc (parent_sigmask): New variable.
(child_info_spawn::handle_spawn): Save parent's signal mask here.
(dll_crt0_1): Restore parent's signal mask to tls sigmask as appropriate.  Call
sig_dispatch_pending to flush signal queue when we can finally do something
with signals.
* exceptions.cc (sigpacket::process): Avoid attempting to handle signals if we
haven't finished initializing.  Rely on the fact that find_tls will do mask
checking and don't do it again.  Delete ill-named 'dummy' variable.
* sigproc.cc (cygheap_exec_info::alloc): Save calling thread's signal mask in
new sigmask field.
(wait_sig): Try to debug when WFSO fails and DEBUGGING is defined.
* thread.cc (pthread::set_tls_self_pointer): Make this a true automatic method
rather than inexplicably relying on a thread parameter.
(pthread::thread_init_wrapper): Accommodate set_tls_self_pointer change to
non-static.  Initialize sigmask before setting tid or suffer signal races.
* ehread.h (pthread::set_tls_self_pointer): Make non-static, delete parameter.
2013-03-31 12:35:44 +00:00
Christopher Faylor 4332090c2d whitespace 2013-03-31 11:05:35 +00:00
Christopher Faylor 6a375e0325 * spawn.cc (child_info_spawn::worker): Save and restore my_wr_proc_pipe around
non-execing operations to avoid handle leak seen in
http://cygwin.com/ml/cygwin/2013-03/msg00152.html .
2013-03-09 00:11:31 +00:00
Christopher Faylor bc837d22f3 Throughout, update copyrights to reflect dates which correspond to main-branch
checkins.  Regularize copyright format.
2013-01-21 04:38:31 +00:00
Christopher Faylor 1f8fe1aa0e * spawn.cc (child_info_spawn::worker): Make detection of '/c' case insensitive
when looking for cmd.exe command line.
2012-11-30 07:11:19 +00:00
Christopher Faylor 25e5803d35 * cygthread.cc (cygthread::stub): Remove old, unnecessary, FIXMEd code.
* spawn.cc (child_info_spawn::worker): Avoid calling close_all_files() twice.
2012-09-14 03:32:52 +00:00
Christopher Faylor 46f5dd5958 whitespace cleanup 2012-08-16 23:34:45 +00:00
Christopher Faylor 4485a26eff * spawn.cc (child_info_spawn::worker): Put back a minor variation of Corinna's
test for detecting a background process when starting a non-cygwin process.
2012-08-03 14:48:59 +00:00
Christopher Faylor 3de7be4c1d * DevNotes: Add entry cgf-000007.
* child_info.h (child_info_spawn::parent_winpid): Declare new field.
(child_info_spawn::get_parent_handle): Declare new function.
* dcrt0.cc (child_info_spawn::get_parent_handle): Define new function.
(child_info_spawn::handle_spawn): Recreate parent handle if possible when
dynamically loaded.  Don't mess with parent handle if it's NULL.
* spawn.cc (child_info_spawn::worker): Set parent_winpid appropriately.
2012-05-14 22:42:56 +00:00
Christopher Faylor dfd5d5bea6 * DevNotes: Add entry cgf-000004.
* pinfo.cc (pinfo::init): Reuse shared memory if the state is marked with
PID_REAPED.
* spawn.cc (child_info_spawn::worker): Don't duplicate myself_pinfo into
non-cygwin child.
* fork.cc (frok::parent): Improve error output.
2012-05-08 15:06:43 +00:00
Christopher Faylor 06bd0ef2ab * DevNotes: Add entry cgf-000003.
* cygheap.h (init_cygheap::pid_handle): Delete.
* dcrt0.cc (child_info_spawn::handle_spawn): Keep parent open if we have
execed.
* pinfo.cc (pinfo::thisproc): Remove pid_handle manipulations.
(pinfo::init): Don't consider a reaped process to be available.
* spawn.cc (child_info_spawn::worker): Remove pid_handle manipulations.  Make
wr_proc_pipe and parent noninheritable when starting a program which doesn't
use the Cygwin DLL.  Conditionally reset wr_proc_pipe to inheritable if
CreateProcess fails.  Inject wr_proc_pipe handle into non-Cygwin process.
Consider a non-cygwin process to be 'synced'.
2012-05-07 15:05:56 +00:00
Christopher Faylor aba77cbe8f wincap.h: Rename assitant to assistant throughout. wincap.cc: Ditto.
* devices.in (exists_console): Use fhandler_console::exists () rather than raw
test.
* devices.cc: Regenerate.
* fhandler.h (fhandler_console::exists): Define new function.
* fhandler_console.cc (fhandler_console::need_invisible): Use
fhandler_console::exists () rather than raw test.
* spawn.cc: Rename assitant to assistant throughout.
(child_info_spawn::worker): Simplify test for when to start a non-Cygwin
process in its own process group.  Just do it whenever we start a non-Cygwin
process.
2012-04-15 17:51:22 +00:00
Christopher Faylor b7d95b5bb5 * child_info.h (child_info::postfork): Define new function.
* fork.cc (frok::parent): Call postfork to do all of the manipulation required
prior to calling pinfo::remember.
* pinfo.h (pinfo::set_rd_proc_pipe): Just set pinfo's rd_proc_pipe.  Don't
bother setting it to NULL.
* sigproc.cc (child_info_spawn::wait_for_myself): Call postfork to set up
myself for waiting.
* spawn.cc (child_info_spawn::worker): Avoid now-unnecessary global lock.
Consistently test mode rather than chtype when making wr_proc_pipe decisions.
Call postfork() to set up stuff prior to pinfo::remember.
2012-03-21 15:54:50 +00:00