start the big userland migration

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-05-05 00:00:00 +00:00
parent 146e568db8
commit ecef42be81
21 changed files with 377 additions and 332 deletions

23
userland/posix/count.c Normal file
View File

@@ -0,0 +1,23 @@
/* Count to infinity with 1 second sleep between each increment.
* Sample application: https://github.com/cirosantilli/linux-kernel-module-cheat#gdb-step-debug-userland-custom-init
*/
#define _XOPEN_SOURCE 700
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char **argv) {
unsigned long i = 0, max;
if (argc > 1) {
max = strtoul(argv[1], NULL, 10);
} else {
max = ULONG_MAX;
}
while (i < max) {
printf("%lu\n", i);
i++;
sleep(1);
}
}