mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 06:53:33 +00:00
Make revision to previous change
This commit is contained in:
parent
0d74673213
commit
d50f4c02f6
4 changed files with 10 additions and 7 deletions
|
@ -29,7 +29,7 @@ void __sig_generate(int, int);
|
|||
void __sig_init(void);
|
||||
|
||||
char16_t *__sig_process_path(char16_t *, uint32_t);
|
||||
atomic_ulong *__sig_map_process(int);
|
||||
atomic_ulong *__sig_map_process(int, int);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_SIGNALS_INTERNAL_H_ */
|
||||
|
|
|
@ -99,12 +99,13 @@ textwindows char16_t *__sig_process_path(char16_t *path, uint32_t pid) {
|
|||
return path;
|
||||
}
|
||||
|
||||
textwindows static atomic_ulong *__sig_map_process_impl(int pid) {
|
||||
textwindows static atomic_ulong *__sig_map_process_impl(int pid,
|
||||
int disposition) {
|
||||
char16_t path[128];
|
||||
intptr_t hand = CreateFile(__sig_process_path(path, pid),
|
||||
kNtGenericRead | kNtGenericWrite,
|
||||
kNtFileShareRead | kNtFileShareWrite, 0,
|
||||
kNtOpenAlways, kNtFileAttributeNormal, 0);
|
||||
disposition, kNtFileAttributeNormal, 0);
|
||||
if (hand == -1)
|
||||
return 0;
|
||||
SetFilePointer(hand, 8, 0, kNtFileBegin);
|
||||
|
@ -120,9 +121,9 @@ textwindows static atomic_ulong *__sig_map_process_impl(int pid) {
|
|||
return sigs;
|
||||
}
|
||||
|
||||
textwindows atomic_ulong *__sig_map_process(int pid) {
|
||||
textwindows atomic_ulong *__sig_map_process(int pid, int disposition) {
|
||||
int e = errno;
|
||||
atomic_ulong *res = __sig_map_process_impl(pid);
|
||||
atomic_ulong *res = __sig_map_process_impl(pid, disposition);
|
||||
errno = e;
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/intrin/strace.h"
|
||||
#include "libc/nt/console.h"
|
||||
#include "libc/nt/enum/creationdisposition.h"
|
||||
#include "libc/nt/enum/ctrlevent.h"
|
||||
#include "libc/nt/enum/processaccess.h"
|
||||
#include "libc/nt/errors.h"
|
||||
|
@ -75,7 +76,7 @@ textwindows int sys_kill_nt(int pid, int sig) {
|
|||
// attempt to signal via /var/sig shared memory file
|
||||
if (pid > 0 && sig != 9) {
|
||||
atomic_ulong *sigproc;
|
||||
if ((sigproc = __sig_map_process(pid))) {
|
||||
if ((sigproc = __sig_map_process(pid, kNtOpenExisting))) {
|
||||
if (sig > 0)
|
||||
atomic_fetch_or_explicit(sigproc, 1ull << (sig - 1),
|
||||
memory_order_release);
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "libc/nt/accounting.h"
|
||||
#include "libc/nt/console.h"
|
||||
#include "libc/nt/enum/consolemodeflags.h"
|
||||
#include "libc/nt/enum/creationdisposition.h"
|
||||
#include "libc/nt/enum/filemapflags.h"
|
||||
#include "libc/nt/enum/pageflags.h"
|
||||
#include "libc/nt/files.h"
|
||||
|
@ -317,7 +318,7 @@ abi int64_t WinMain(int64_t hInstance, int64_t hPrevInstance,
|
|||
__gransize = si.dwAllocationGranularity;
|
||||
__umask = 077;
|
||||
__pid = __imp_GetCurrentProcessId();
|
||||
if (!(__sig.process = __sig_map_process(__pid)))
|
||||
if (!(__sig.process = __sig_map_process(__pid, kNtOpenAlways)))
|
||||
__sig.process = &fake_process_signals;
|
||||
atomic_store_explicit(__sig.process, 0, memory_order_release);
|
||||
cmdline = __imp_GetCommandLineW();
|
||||
|
|
Loading…
Reference in a new issue