mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-23 19:10:30 +00:00
Add Linux ptrace() tutorial
This commit is contained in:
parent
98909b1391
commit
3b9e66ecba
14 changed files with 1290 additions and 23 deletions
1048
tool/build/strace.c
Normal file
1048
tool/build/strace.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -22,6 +22,7 @@ TOOL_NET_COMS = \
|
|||
o/$(MODE)/tool/net/redbean-static.com \
|
||||
o/$(MODE)/tool/net/redbean-unsecure.com \
|
||||
o/$(MODE)/tool/net/redbean-original.com \
|
||||
o/$(MODE)/tool/net/redbean-assimilate.com \
|
||||
o/$(MODE)/tool/net/echoserver.com \
|
||||
o/$(MODE)/tool/net/wb.com
|
||||
|
||||
|
@ -314,6 +315,33 @@ o/$(MODE)/tool/net/redbean-original.com.dbg: \
|
|||
o/$(MODE)/tool/net/redbean-original.o: tool/net/redbean.c o/$(MODE)/tool/net/redbean.o
|
||||
@$(COMPILE) -AOBJECTIFY.c $(OBJECTIFY.c) -DSTATIC -DUNSECURE -DREDBEAN=\"redbean-original\" $(OUTPUT_OPTION) $<
|
||||
|
||||
# REDBEAN-ASSIMILATE.COM
|
||||
#
|
||||
# Same as REDBEAN.COM except without no-modify-self behavior.
|
||||
|
||||
o/$(MODE)/tool/net/redbean-assimilate.com.dbg: \
|
||||
o/$(MODE)/tool/net/redbean.com.dbg
|
||||
@cp -f $< $@
|
||||
|
||||
o/$(MODE)/tool/net/redbean-assimilate.com: \
|
||||
o/$(MODE)/tool/net/redbean-assimilate.com.dbg \
|
||||
o/$(MODE)/third_party/infozip/zip.com \
|
||||
o/$(MODE)/tool/build/symtab.com \
|
||||
tool/net/net.mk \
|
||||
tool/net/help.txt \
|
||||
tool/net/.init.lua \
|
||||
tool/net/favicon.ico \
|
||||
tool/net/redbean.png
|
||||
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
||||
@$(COMPILE) -AMKDIR -T$@ mkdir -p o/$(MODE)/tool/net/.redbean-assimilate
|
||||
@$(COMPILE) -ASYMTAB o/$(MODE)/tool/build/symtab.com -o o/$(MODE)/tool/net/.redbean-assimilate/.symtab $<
|
||||
@$(COMPILE) -AZIP -T$@ o/$(MODE)/third_party/infozip/zip.com -9qj $@ \
|
||||
o/$(MODE)/tool/net/.redbean-assimilate/.symtab \
|
||||
tool/net/help.txt \
|
||||
tool/net/.init.lua \
|
||||
tool/net/favicon.ico \
|
||||
tool/net/redbean.png
|
||||
|
||||
.PHONY: o/$(MODE)/tool/net
|
||||
o/$(MODE)/tool/net: \
|
||||
$(TOOL_NET_BINS) \
|
||||
|
|
|
@ -2674,7 +2674,7 @@ static void LaunchBrowser(const char *path) {
|
|||
sigprocmask(SIG_BLOCK, &chldmask, &savemask);
|
||||
CHECK_NE(-1, (pid = fork()));
|
||||
if (!pid) {
|
||||
setpgid(getpid(), getpid());
|
||||
setpgid(getpid(), getpid()); // ctrl-c'ing redbean shouldn't kill browser
|
||||
sigaction(SIGINT, &saveint, 0);
|
||||
sigaction(SIGQUIT, &savequit, 0);
|
||||
sigprocmask(SIG_SETMASK, &savemask, 0);
|
||||
|
@ -6605,7 +6605,7 @@ static void RestoreApe(void) {
|
|||
WARNF("(srvr) can't restore .ape");
|
||||
free(p);
|
||||
} else {
|
||||
WARNF("(srvr) /.ape not found");
|
||||
INFOF("(srvr) /.ape not found");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6907,6 +6907,10 @@ void RedBean(int argc, char *argv[]) {
|
|||
if (daemonize) {
|
||||
Daemonize();
|
||||
} else {
|
||||
// xxx: create process group to make it easier to propagate SIGTERM
|
||||
// to children. the downside to doing this seems to be that
|
||||
// ctrl-c isn't propagating as expected when running redbean
|
||||
// underneath strace.com :|
|
||||
setpgid(getpid(), getpid());
|
||||
if (logpath) {
|
||||
close(2);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue