diff --git a/src/kernel/apps/Jamfile b/src/kernel/apps/Jamfile index 418f3ed69b..7af96fdf6a 100644 --- a/src/kernel/apps/Jamfile +++ b/src/kernel/apps/Jamfile @@ -4,6 +4,7 @@ KernelObjects false_main.c fibo_main.c init.c + monitor_test.c true_main.c sig_test.c select_test.c diff --git a/src/kernel/apps/monitor_test.c b/src/kernel/apps/monitor_test.c new file mode 100644 index 0000000000..7adc786875 --- /dev/null +++ b/src/kernel/apps/monitor_test.c @@ -0,0 +1,44 @@ +/* tests node monitor functionality (very basic test!) */ + +/* +** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ + + +#include +#include +#include + +#include +#include +#include + + +int +main(int argc, char **argv) +{ + struct stat st; + if (stat("/", &st) < 0) { + fprintf(stderr, "Could not stat root!\n"); + return -1; + } + + printf("watch file: device = %ld, node = %Ld\n", st.st_dev, st.st_ino); + + if (sys_start_watching(st.st_dev, st.st_ino, B_WATCH_DIRECTORY, 1, 2) < B_OK) { + fprintf(stderr, "Could not start watching!\n"); + return -1; + } + + mkdir("/temp_test", 0755); + rmdir("/temp_test"); + + if (sys_stop_watching(st.st_dev, st.st_ino, 0, 1, 2) < B_OK) { + fprintf(stderr, "Could not stop watching!\n"); + return -1; + } + + return 0; +} +