Files
linux-kernel-module-cheat/userland/posix/count.c
Ciro Santilli 六四事件 法轮功 d205140557 userland: move some multithreaded examples from cpp-cheat
Using them mostly to evaluate how well the emulators are handling user
mode multithreading.
2019-07-19 00:00:03 +00:00

22 lines
487 B
C

/* Count to infinity with 1 second sleep between each increment.
*
* https://github.com/cirosantilli/linux-kernel-module-cheat#unistd-h
*
* Sample application: https://cirosantilli.com/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(void) {
unsigned long i = 0;
while (1) {
printf("%lu\n", i);
i++;
sleep(1);
}
}