mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-03 11:12:27 +00:00
Add debug log to cosmoaudio and add examples
This commit is contained in:
parent
a5c0189bf6
commit
0f3457c172
38 changed files with 504 additions and 371 deletions
|
@ -7,10 +7,10 @@
|
|||
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
||||
╚─────────────────────────────────────────────────────────────────*/
|
||||
#endif
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/sigaction.h"
|
||||
#include "libc/fmt/itoa.h"
|
||||
#include "libc/str/str.h"
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
volatile int g_sig;
|
||||
|
||||
|
@ -21,16 +21,13 @@ void OnSig(int sig) {
|
|||
int main(int argc, char *argv[]) {
|
||||
|
||||
// listen for all signals
|
||||
for (int sig = 1; sig <= NSIG; ++sig) {
|
||||
for (int sig = 1; sig <= NSIG; ++sig)
|
||||
signal(sig, OnSig);
|
||||
}
|
||||
|
||||
// wait for a signal
|
||||
char ibuf[12];
|
||||
FormatInt32(ibuf, getpid());
|
||||
tinyprint(2, "waiting for signal to be sent to ", ibuf, "\n", NULL);
|
||||
printf("waiting for signal to be sent to my pid %d\n", getpid());
|
||||
pause();
|
||||
|
||||
// report the signal
|
||||
tinyprint(1, "got ", strsignal(g_sig), "\n", NULL);
|
||||
printf("got %s\n", strsignal(g_sig));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue