mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
Make fixes and improvements
- Document more compiler flags - Expose new __print_maps() api - Better overflow checking in mmap() - Improve the shell example somewhat - Fix minor runtime bugs regarding stacks - Make kill() on fork()+execve()'d children work - Support CLONE_CHILD_CLEARTID for proper joining - Fix recent possible deadlock regression with --ftrace
This commit is contained in:
parent
6e52cba37a
commit
ec2cb88058
68 changed files with 1211 additions and 431 deletions
11
libc/nt/enum/th32cs.h
Normal file
11
libc/nt/enum/th32cs.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_TH32CS_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_ENUM_TH32CS_H_
|
||||
|
||||
#define kNtTh32csInherit 0x80000000
|
||||
#define kNtTh32csSnapheaplist 0x00000001
|
||||
#define kNtTh32csSnapmodule 0x00000008
|
||||
#define kNtTh32csSnapmodule32 0x00000010
|
||||
#define kNtTh32csSnapprocess 0x00000002
|
||||
#define kNtTh32csSnapthread 0x00000004
|
||||
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_TH32CS_H_ */
|
|
@ -1,2 +1,12 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp kernel32,__imp_CreateToolhelp32Snapshot,CreateToolhelp32Snapshot,250
|
||||
.imp kernel32,__imp_CreateToolhelp32Snapshot,CreateToolhelp32Snapshot,0
|
||||
|
||||
.text.windows
|
||||
CreateToolhelp32Snapshot:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov __imp_CreateToolhelp32Snapshot(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
.endfn CreateToolhelp32Snapshot,globl
|
||||
.previous
|
||||
|
|
|
@ -1,2 +1,12 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp kernel32,__imp_Process32FirstW,Process32FirstW,1065
|
||||
.imp kernel32,__imp_Process32FirstW,Process32FirstW,0
|
||||
|
||||
.text.windows
|
||||
Process32First:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov __imp_Process32FirstW(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
.endfn Process32First,globl
|
||||
.previous
|
||||
|
|
|
@ -1,2 +1,12 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp kernel32,__imp_Process32NextW,Process32NextW,1067
|
||||
.imp kernel32,__imp_Process32NextW,Process32NextW,0
|
||||
|
||||
.text.windows
|
||||
Process32Next:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov __imp_Process32NextW(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
.endfn Process32Next,globl
|
||||
.previous
|
||||
|
|
|
@ -208,7 +208,7 @@ imp 'CreateThreadpoolWait' CreateThreadpoolWait kernel32 0
|
|||
imp 'CreateThreadpoolWork' CreateThreadpoolWork kernel32 0
|
||||
imp 'CreateTimerQueue' CreateTimerQueue kernel32 0
|
||||
imp 'CreateTimerQueueTimer' CreateTimerQueueTimer kernel32 0
|
||||
imp 'CreateToolhelp32Snapshot' CreateToolhelp32Snapshot kernel32 250
|
||||
imp 'CreateToolhelp32Snapshot' CreateToolhelp32Snapshot kernel32 0 2
|
||||
imp 'CreateUmsCompletionList' CreateUmsCompletionList kernel32 251
|
||||
imp 'CreateUmsThreadContext' CreateUmsThreadContext kernel32 252
|
||||
imp 'CreateWaitableTimer' CreateWaitableTimerW kernel32 0 3
|
||||
|
@ -934,8 +934,8 @@ imp 'PowerSetRequest' PowerSetRequest kernel32 1059
|
|||
imp 'PrefetchVirtualMemory' PrefetchVirtualMemory kernel32 0 4
|
||||
imp 'PrepareTape' PrepareTape kernel32 1061
|
||||
imp 'PrivMoveFileIdentity' PrivMoveFileIdentityW kernel32 1063
|
||||
imp 'Process32First' Process32FirstW kernel32 1065
|
||||
imp 'Process32Next' Process32NextW kernel32 1067
|
||||
imp 'Process32First' Process32FirstW kernel32 0 2
|
||||
imp 'Process32Next' Process32NextW kernel32 0 2
|
||||
imp 'ProcessIdToSessionId' ProcessIdToSessionId kernel32 0
|
||||
imp 'PssCaptureSnapshot' PssCaptureSnapshot kernel32 0
|
||||
imp 'PssDuplicateSnapshot' PssDuplicateSnapshot kernel32 0
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_NT_PROCESS_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_PROCESS_H_
|
||||
#include "libc/nt/startupinfo.h"
|
||||
#include "libc/nt/struct/processentry32.h"
|
||||
#include "libc/nt/struct/processinformation.h"
|
||||
#include "libc/nt/struct/processmemorycounters.h"
|
||||
#include "libc/nt/struct/securityattributes.h"
|
||||
|
@ -73,6 +74,10 @@ bool32 GetProcessMemoryInfo(
|
|||
int64_t hProcess, struct NtProcessMemoryCountersEx *out_ppsmemCounters,
|
||||
uint32_t cb);
|
||||
|
||||
int64_t CreateToolhelp32Snapshot(uint32_t dwFlags, uint32_t th32ProcessID);
|
||||
bool32 Process32First(int64_t hSnapshot, struct NtProcessEntry32 *in_out_lppe);
|
||||
bool32 Process32Next(int64_t hSnapshot, struct NtProcessEntry32 *out_lppe);
|
||||
|
||||
#if ShouldUseMsabiAttribute()
|
||||
#include "libc/nt/thunk/process.inc"
|
||||
#endif /* ShouldUseMsabiAttribute() */
|
||||
|
|
19
libc/nt/struct/processentry32.h
Normal file
19
libc/nt/struct/processentry32.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_NT_STRUCT_PROCESSENTRY32_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_STRUCT_PROCESSENTRY32_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
struct NtProcessEntry32 {
|
||||
uint32_t dwSize;
|
||||
uint32_t cntUsage; /* unused */
|
||||
uint32_t th32ProcessID;
|
||||
uint64_t th32DefaultHeapID; /* unused */
|
||||
uint32_t th32ModuleID; /* unused */
|
||||
uint32_t cntThreads;
|
||||
uint32_t th32ParentProcessID;
|
||||
int32_t cPriClassBase;
|
||||
uint32_t dwFlags; /* unused */
|
||||
char16_t szExeFile[260];
|
||||
};
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_STRUCT_PROCESSENTRY32_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue