Implemented a generic system watching mechanism with a userland API. Currently
only a few events can be watched (team creation/deletion/exec, thread creation/ deletion/name changes). The functions start_system_watching()/ stop_system_watching start/stop watching events. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39862 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
|
||||
struct kernel_args;
|
||||
|
||||
|
||||
@@ -15,15 +16,24 @@ struct kernel_args;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern status_t system_info_init(struct kernel_args *args);
|
||||
extern uint32 get_haiku_revision(void);
|
||||
|
||||
extern status_t _user_get_system_info(system_info *userInfo, size_t size);
|
||||
extern status_t _user_get_system_info_etc(int32 id, void *buffer,
|
||||
size_t bufferSize);
|
||||
status_t system_info_init(struct kernel_args *args);
|
||||
status_t system_notifications_init();
|
||||
uint32 get_haiku_revision(void);
|
||||
|
||||
status_t _user_get_system_info(system_info *userInfo, size_t size);
|
||||
status_t _user_get_system_info_etc(int32 id, void *buffer,
|
||||
size_t bufferSize);
|
||||
|
||||
status_t _user_start_system_watching(int32 object, uint32 flags,
|
||||
port_id port, int32 token);
|
||||
status_t _user_stop_system_watching(int32 object, uint32 flags,
|
||||
port_id port, int32 token);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _KERNEL_SYSTEM_INFO_H */
|
||||
|
||||
@@ -174,6 +174,11 @@ extern status_t _kern_get_team_usage_info(team_id team, int32 who,
|
||||
extern status_t _kern_get_extended_team_info(team_id teamID, uint32 flags,
|
||||
void* buffer, size_t size, size_t* _sizeNeeded);
|
||||
|
||||
extern status_t _kern_start_system_watching(int32 object, uint32 flags,
|
||||
port_id port, int32 token);
|
||||
extern status_t _kern_stop_system_watching(int32 object, uint32 flags,
|
||||
port_id port, int32 token);
|
||||
|
||||
extern status_t _kern_block_thread(uint32 flags, bigtime_t timeout);
|
||||
extern status_t _kern_unblock_thread(thread_id thread, status_t status);
|
||||
extern status_t _kern_unblock_threads(thread_id* threads, uint32 count,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008 Haiku, Inc. All rights reserved.
|
||||
* Copyright 2008-2010, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _SYSTEM_INFO_H
|
||||
@@ -24,14 +24,56 @@ struct system_memory_info {
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
// team creation or deletion; object == -1; either one also triggers on
|
||||
// exec()
|
||||
B_WATCH_SYSTEM_TEAM_CREATION = 0x01,
|
||||
B_WATCH_SYSTEM_TEAM_DELETION = 0x02,
|
||||
|
||||
// thread creation or deletion or property (name, priority) changes;
|
||||
// object == team ID or -1 for all teams
|
||||
B_WATCH_SYSTEM_THREAD_CREATION = 0x04,
|
||||
B_WATCH_SYSTEM_THREAD_DELETION = 0x08,
|
||||
B_WATCH_SYSTEM_THREAD_PROPERTIES = 0x10,
|
||||
|
||||
B_WATCH_SYSTEM_ALL
|
||||
= B_WATCH_SYSTEM_TEAM_CREATION
|
||||
| B_WATCH_SYSTEM_TEAM_DELETION
|
||||
| B_WATCH_SYSTEM_THREAD_CREATION
|
||||
| B_WATCH_SYSTEM_THREAD_DELETION
|
||||
| B_WATCH_SYSTEM_THREAD_PROPERTIES
|
||||
};
|
||||
|
||||
enum {
|
||||
// message what for the notification messages
|
||||
B_SYSTEM_OBJECT_UPDATE = 'SOUP',
|
||||
|
||||
// "opcode" values
|
||||
B_TEAM_CREATED = 0,
|
||||
B_TEAM_DELETED = 1,
|
||||
B_TEAM_EXEC = 2,
|
||||
B_THREAD_CREATED = 3,
|
||||
B_THREAD_DELETED = 4,
|
||||
B_THREAD_NAME_CHANGED = 5
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern status_t get_system_info_etc(int32 id, void *buffer, size_t bufferSize);
|
||||
|
||||
status_t get_system_info_etc(int32 id, void* buffer, size_t bufferSize);
|
||||
|
||||
status_t start_system_watching(int32 object, uint32 flags, port_id port,
|
||||
int32 token);
|
||||
status_t stop_system_watching(int32 object, uint32 flags, port_id port,
|
||||
int32 token);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _SYSTEM_INFO_H */
|
||||
|
||||
Reference in New Issue
Block a user