Add debug log to cosmoaudio and add examples

This commit is contained in:
Justine Tunney 2024-09-11 02:14:38 -07:00
parent a5c0189bf6
commit 0f3457c172
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
38 changed files with 504 additions and 371 deletions

View file

@ -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));
}