Squash commits for public release
This commit is contained in:
8
userland/tests/sigtest/BUILD.gn
Normal file
8
userland/tests/sigtest/BUILD.gn
Normal file
@@ -0,0 +1,8 @@
|
||||
import("//build/userland/TEMPLATE.gni")
|
||||
|
||||
xOS_executable("sigtest") {
|
||||
install_path = "bin/"
|
||||
sources = [ "main.c" ]
|
||||
configs = [ "//build/userland:userland_flags" ]
|
||||
deplibs = [ "libc" ]
|
||||
}
|
||||
20
userland/tests/sigtest/main.c
Normal file
20
userland/tests/sigtest/main.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void save_on_terminate()
|
||||
{
|
||||
printf("Saving file and exiting");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
sigaction(SIGTERM, save_on_terminate);
|
||||
while (1) {
|
||||
// infinite loop
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user