mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-27 04:01:36 +01:00
start the big userland migration
This commit is contained in:
23
userland/posix/count.c
Normal file
23
userland/posix/count.c
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user