mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 23:08:31 +00:00
Spoof PID across execve() on Windows
It's now possible with cosmo and redbean, to deliver a signal to a child process after it has called execve(). However the executed program needs to be compiled using cosmocc. The cosmo runtime WinMain() implementation now intercepts a _COSMO_PID environment variable that's set by execve(). It ensures the child process will use the same C:\ProgramData\cosmo\sigs file, which is where kill() will place the delivered signal. We are able to do this on Windows even better than NetBSD, which has a bug with this Fixes #1334
This commit is contained in:
parent
9cc1bd04b2
commit
26c051c297
8 changed files with 187 additions and 21 deletions
|
@ -35,6 +35,9 @@
|
|||
* signal a cosmo process. The targeting process will then notice that a
|
||||
* signal has been added and delivers to any thread as soon as possible.
|
||||
*
|
||||
* On Windows, the only signal that's guaranteed to work on non-cosmocc
|
||||
* processes is SIGKILL.
|
||||
*
|
||||
* On Windows, the concept of a process group isn't fully implemented.
|
||||
* Saying `kill(0, sig)` will deliver `sig` to all direct descendent
|
||||
* processes. Saying `kill(-pid, sig)` will be the same as saying
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue