xref: /haiku/headers/private/system/system_info.h (revision b46615c55ad2c8fe6de54412055a0713da3d610a)
1 /*
2  * Copyright 2008-2010, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _SYSTEM_INFO_H
6 #define _SYSTEM_INFO_H
7 
8 
9 #include <OS.h>
10 
11 
12 #define B_MEMORY_INFO	'memo'
13 
14 struct system_memory_info {
15 	uint64		max_memory;
16 	uint64		free_memory;
17 	uint64		needed_memory;
18 	uint64		max_swap_space;
19 	uint64		free_swap_space;
20 	uint64		block_cache_memory;
21 	uint32		page_faults;
22 
23 	// TODO: add active/inactive page counts, swap in/out, ...
24 };
25 
26 
27 enum {
28 	// team creation or deletion; object == -1; either one also triggers on
29 	// exec()
30 	B_WATCH_SYSTEM_TEAM_CREATION		= 0x01,
31 	B_WATCH_SYSTEM_TEAM_DELETION		= 0x02,
32 
33 	// thread creation or deletion or property (name, priority) changes;
34 	// object == team ID or -1 for all teams
35 	B_WATCH_SYSTEM_THREAD_CREATION		= 0x04,
36 	B_WATCH_SYSTEM_THREAD_DELETION		= 0x08,
37 	B_WATCH_SYSTEM_THREAD_PROPERTIES	= 0x10,
38 
39 	B_WATCH_SYSTEM_ALL
40 		= B_WATCH_SYSTEM_TEAM_CREATION
41 		| B_WATCH_SYSTEM_TEAM_DELETION
42 		| B_WATCH_SYSTEM_THREAD_CREATION
43 		| B_WATCH_SYSTEM_THREAD_DELETION
44 		| B_WATCH_SYSTEM_THREAD_PROPERTIES
45 };
46 
47 enum {
48 	// message what for the notification messages
49 	B_SYSTEM_OBJECT_UPDATE				= 'SOUP',
50 
51 	// "opcode" values
52 	B_TEAM_CREATED						= 0,
53 	B_TEAM_DELETED						= 1,
54 	B_TEAM_EXEC							= 2,
55 	B_THREAD_CREATED					= 3,
56 	B_THREAD_DELETED					= 4,
57 	B_THREAD_NAME_CHANGED				= 5
58 };
59 
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 
66 status_t __get_system_info_etc(int32 id, void* buffer, size_t bufferSize);
67 
68 status_t __start_watching_system(int32 object, uint32 flags, port_id port,
69 			int32 token);
70 status_t __stop_watching_system(int32 object, uint32 flags, port_id port,
71 			int32 token);
72 
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 
79 #endif	/* _SYSTEM_INFO_H */
80