diff --git a/headers/private/kernel/fd.h b/headers/private/kernel/fd.h index f0a47295f6..3a38fffde4 100644 --- a/headers/private/kernel/fd.h +++ b/headers/private/kernel/fd.h @@ -10,22 +10,9 @@ #include #include #include +//#include -struct file_descriptor; -struct select_sync; -struct fs_mount; -struct vnode; - -/** The I/O context of a process/team, holds the fd array */ -struct io_context { - struct vnode *cwd; - mutex io_mutex; - int table_size; - int num_used_fds; - struct file_descriptor **fds; -}; - struct fd_ops { ssize_t (*fd_read) (struct file_descriptor *, off_t pos, void *buffer, size_t *length); ssize_t (*fd_write)(struct file_descriptor *, off_t pos, const void *buffer, size_t *length); diff --git a/headers/private/kernel/fs/node_monitor.h b/headers/private/kernel/fs/node_monitor.h new file mode 100644 index 0000000000..ea14307db0 --- /dev/null +++ b/headers/private/kernel/fs/node_monitor.h @@ -0,0 +1,25 @@ +#ifndef _KERNEL_NODE_MONITOR_H +#define _KERNEL_NODE_MONITOR_H +/* +** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ + + +#include + + +struct io_context; + +// private kernel API +extern status_t remove_node_monitors(struct io_context *context); +extern status_t node_monitor_init(void); + +// user-space exported calls +extern status_t user_stop_notifying(port_id port, uint32 token); +extern status_t user_start_watching(dev_t device, ino_t node, uint32 flags, + port_id port, uint32 token); +extern status_t user_stop_watching(dev_t device, ino_t node, uint32 flags, + port_id port, uint32 token); + +#endif /* _KRENEL_NODE_MONITOR_H */ diff --git a/headers/private/kernel/ksyscalls.h b/headers/private/kernel/ksyscalls.h index 222d4bf7eb..071389bb98 100755 --- a/headers/private/kernel/ksyscalls.h +++ b/headers/private/kernel/ksyscalls.h @@ -127,6 +127,9 @@ enum { SYSCALL_UNREGISTER_IMAGE, /* 115 */ SYSCALL_GET_IMAGE_INFO, SYSCALL_GET_NEXT_IMAGE_INFO, + SYSCALL_START_WATCHING, + SYSCALL_STOP_WATCHING, + SYSCALL_STOP_NOTIFYING, /* 120 */ }; int syscall_dispatcher(unsigned long call_num, void *arg_buffer, uint64 *call_ret); diff --git a/headers/private/kernel/syscalls.h b/headers/private/kernel/syscalls.h index f44a78d9b3..66896d670f 100644 --- a/headers/private/kernel/syscalls.h +++ b/headers/private/kernel/syscalls.h @@ -70,6 +70,13 @@ status_t sys_unregister_image(image_id id); status_t sys_get_image_info(image_id id, image_info *info, size_t size); status_t sys_get_next_image_info(team_id team, int32 *cookie, image_info *info, size_t size); +// node monitor functions +status_t sys_stop_notifying(port_id port, uint32 token); +status_t sys_start_watching(dev_t device, ino_t node, uint32 flags, + port_id port, uint32 token); +status_t sys_stop_watching(dev_t device, ino_t node, uint32 flags, + port_id port, uint32 token); + // area functions region_id sys_vm_create_anonymous_region(const char *name, void **address, int addr_type, addr size, int wiring, int lock); diff --git a/headers/private/kernel/vfs.h b/headers/private/kernel/vfs.h index fc4d94ab13..261577c273 100755 --- a/headers/private/kernel/vfs.h +++ b/headers/private/kernel/vfs.h @@ -13,19 +13,39 @@ #include #include #include +#include +#include #define DEFAULT_FD_TABLE_SIZE 128 #define MAX_FD_TABLE_SIZE 2048 +#define MAX_NODE_MONITORS 4096 #include + +struct file_descriptor; +struct selectsync; +struct pollfd; + + +/** The I/O context of a process/team, holds the fd array among others */ +typedef struct io_context { + struct vnode *cwd; + mutex io_mutex; + uint32 table_size; + uint32 num_used_fds; + struct file_descriptor **fds; + struct list node_monitors; + uint32 num_monitors; + uint32 max_monitors; +} io_context; + + /* macro to allocate a iovec array on the stack */ #define IOVECS(name, size) \ uint8 _##name[sizeof(iovecs) + (size)*sizeof(iovec)]; \ iovecs *name = (iovecs *)_##name -struct selectsync; -struct pollfd; #ifdef __cplusplus extern "C" {