A very basic node monitoring test - directly uses the kernel calls (since
there is no libbe.so yet). Doesn't even query the port; just causes send_notification() in the kernel to be called which will print out some info. Added to the build. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2487 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
32a301820f
commit
481ce84e6c
@ -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
|
||||
|
44
src/kernel/apps/monitor_test.c
Normal file
44
src/kernel/apps/monitor_test.c
Normal file
@ -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 <OS.h>
|
||||
#include <NodeMonitor.h>
|
||||
#include <syscalls.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user