xref: /haiku/headers/private/system/syscalls.h (revision 4f2fd49bdc6078128b1391191e4edac647044c3d)
1 /*
2  * Copyright 2004-2008, Haiku Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _SYSTEM_SYSCALLS_H
6 #define _SYSTEM_SYSCALLS_H
7 
8 
9 #include <arch_config.h>
10 #include <image.h>
11 #include <OS.h>
12 #include <DiskDeviceDefs.h>
13 
14 #include <signal.h>
15 #include <sys/socket.h>
16 
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 struct dirent;
23 struct Elf32_Sym;
24 struct fd_info;
25 struct fd_set;
26 struct fs_info;
27 struct iovec;
28 struct msqid_ds;
29 struct net_stat;
30 struct pollfd;
31 struct rlimit;
32 struct scheduling_analysis;
33 struct sigaction;
34 struct stat;
35 struct _sem_t;
36 struct sembuf;
37 union semun;
38 
39 struct disk_device_job_progress_info;
40 struct partitionable_space_data;
41 struct thread_creation_attributes;
42 struct user_disk_device_data;
43 struct user_disk_device_job_info;
44 struct user_disk_system_info;
45 
46 // This marks the beginning of the syscalls prototypes for gensyscallinfos.
47 // NOTE:
48 // * Nothing but those prototypes may live here.
49 // * The arguments of the functions must be named to be processed properly.
50 
51 #ifdef GEN_SYSCALL_INFOS_PROCESSING
52 #pragma syscalls begin
53 #endif
54 
55 extern int			_kern_is_computer_on(void);
56 extern status_t		_kern_generic_syscall(const char *subsystem, uint32 function,
57 						void *buffer, size_t bufferSize);
58 
59 extern int			_kern_getrlimit(int resource, struct rlimit * rlp);
60 extern int			_kern_setrlimit(int resource, const struct rlimit * rlp);
61 
62 extern status_t		_kern_shutdown(bool reboot);
63 extern status_t		_kern_get_safemode_option(const char *parameter,
64 						char *buffer, size_t *_bufferSize);
65 
66 extern ssize_t		_kern_wait_for_objects(object_wait_info* infos, int numInfos,
67 						uint32 flags, bigtime_t timeout);
68 
69 /* sem functions */
70 extern sem_id		_kern_create_sem(int count, const char *name);
71 extern status_t		_kern_delete_sem(sem_id id);
72 extern status_t		_kern_switch_sem(sem_id releaseSem, sem_id id);
73 extern status_t		_kern_switch_sem_etc(sem_id releaseSem, sem_id id,
74 						uint32 count, uint32 flags, bigtime_t timeout);
75 extern status_t		_kern_acquire_sem(sem_id id);
76 extern status_t		_kern_acquire_sem_etc(sem_id id, uint32 count, uint32 flags,
77 						bigtime_t timeout);
78 extern status_t		_kern_release_sem(sem_id id);
79 extern status_t		_kern_release_sem_etc(sem_id id, uint32 count, uint32 flags);
80 extern status_t		_kern_get_sem_count(sem_id id, int32* thread_count);
81 extern status_t		_kern_get_sem_info(sem_id semaphore, struct sem_info *info,
82 						size_t size);
83 extern status_t		_kern_get_next_sem_info(team_id team, int32 *cookie,
84 						struct sem_info *info, size_t size);
85 extern status_t		_kern_set_sem_owner(sem_id id, team_id proc);
86 
87 /* POSIX realtime sem syscalls */
88 extern status_t		_kern_realtime_sem_open(const char* name,
89 						int openFlagsOrShared, mode_t mode, uint32 semCount,
90 						struct _sem_t* userSem, struct _sem_t** _usedUserSem);
91 extern status_t		_kern_realtime_sem_close(sem_id semID,
92 						struct _sem_t** _deleteUserSem);
93 extern status_t		_kern_realtime_sem_unlink(const char* name);
94 
95 extern status_t		_kern_realtime_sem_get_value(sem_id semID, int* value);
96 extern status_t		_kern_realtime_sem_post(sem_id semID);
97 extern status_t		_kern_realtime_sem_wait(sem_id semID, bigtime_t timeout);
98 
99 /* POSIX XSI semaphore syscalls */
100 extern int			_kern_xsi_semget(key_t key, int numSems, int flags);
101 extern int			_kern_xsi_semctl(int semID, int semNumber, int command,
102 						union semun* args);
103 extern status_t		_kern_xsi_semop(int semID, struct sembuf *semOps,
104 						size_t numSemOps);
105 
106 /* POSIX XSI message queue syscalls */
107 extern int			_kern_xsi_msgctl(int messageQueueID, int command,
108 						struct msqid_ds *buffer);
109 extern int			_kern_xsi_msgget(key_t key, int messageQueueFlags);
110 extern ssize_t		_kern_xsi_msgrcv(int messageQueueID, void *messagePointer,
111 						size_t messageSize, long messageType, int messageFlags);
112 extern int			_kern_xsi_msgsnd(int messageQueueID,
113 						const void *messagePointer, size_t messageSize,
114 						int messageFlags);
115 
116 /* team & thread syscalls */
117 extern thread_id	_kern_load_image(const char* const* flatArgs,
118 						size_t flatArgsSize, int32 argCount, int32 envCount,
119 						int32 priority, uint32 flags, port_id errorPort,
120 						uint32 errorToken);
121 extern void			_kern_exit_team(status_t returnValue);
122 extern status_t		_kern_kill_team(team_id team);
123 extern team_id		_kern_get_current_team();
124 extern status_t		_kern_wait_for_team(team_id team, status_t *_returnCode);
125 extern thread_id	_kern_wait_for_child(thread_id child, uint32 flags,
126 						int32 *_reason, status_t *_returnCode);
127 extern status_t		_kern_exec(const char *path, const char* const* flatArgs,
128 						size_t flatArgsSize, int32 argCount, int32 envCount);
129 extern thread_id	_kern_fork(void);
130 extern pid_t		_kern_process_info(pid_t process, int32 which);
131 extern pid_t		_kern_setpgid(pid_t process, pid_t group);
132 extern pid_t		_kern_setsid(void);
133 extern status_t		_kern_change_root(const char *path);
134 
135 extern thread_id	_kern_spawn_thread(
136 						struct thread_creation_attributes* attributes);
137 extern thread_id	_kern_find_thread(const char *name);
138 extern status_t		_kern_suspend_thread(thread_id thread);
139 extern status_t		_kern_resume_thread(thread_id thread);
140 extern status_t		_kern_rename_thread(thread_id thread, const char *newName);
141 extern status_t		_kern_set_thread_priority(thread_id thread, int32 newPriority);
142 extern status_t		_kern_kill_thread(thread_id thread);
143 extern void			_kern_exit_thread(status_t returnValue);
144 extern void			_kern_thread_yield(void);
145 extern status_t		_kern_wait_for_thread(thread_id thread, status_t *_returnCode);
146 extern bool			_kern_has_data(thread_id thread);
147 extern status_t		_kern_send_data(thread_id thread, int32 code, const void *buffer, size_t bufferSize);
148 extern int32		_kern_receive_data(thread_id *_sender, void *buffer, size_t bufferSize);
149 extern int64		_kern_restore_signal_frame();
150 
151 extern status_t		_kern_get_thread_info(thread_id id, thread_info *info);
152 extern status_t		_kern_get_next_thread_info(team_id team, int32 *cookie, thread_info *info);
153 extern status_t		_kern_get_team_info(team_id id, team_info *info);
154 extern status_t		_kern_get_next_team_info(int32 *cookie, team_info *info);
155 extern status_t		_kern_get_team_usage_info(team_id team, int32 who, team_usage_info *info, size_t size);
156 
157 extern status_t		_kern_block_thread(uint32 flags, bigtime_t timeout);
158 extern status_t		_kern_unblock_thread(thread_id thread, status_t status);
159 extern status_t		_kern_unblock_threads(thread_id* threads, uint32 count,
160 						status_t status);
161 
162 // user/group functions
163 extern gid_t		_kern_getgid(bool effective);
164 extern uid_t		_kern_getuid(bool effective);
165 extern status_t		_kern_setregid(gid_t rgid, gid_t egid,
166 						bool setAllIfPrivileged);
167 extern status_t		_kern_setreuid(uid_t ruid, uid_t euid,
168 						bool setAllIfPrivileged);
169 extern ssize_t		_kern_getgroups(int groupCount, gid_t* groupList);
170 extern status_t		_kern_setgroups(int groupCount, const gid_t* groupList);
171 
172 // signal functions
173 extern status_t		_kern_send_signal(pid_t tid, uint sig);
174 extern status_t		_kern_sigprocmask(int how, const sigset_t *set,
175 						sigset_t *oldSet);
176 extern status_t		_kern_sigaction(int sig, const struct sigaction *action,
177 						struct sigaction *oldAction);
178 extern bigtime_t	_kern_set_alarm(bigtime_t time, uint32 mode);
179 extern status_t		_kern_sigwait(const sigset_t *set, int *_signal);
180 extern status_t		_kern_sigsuspend(const sigset_t *mask);
181 extern status_t		_kern_sigpending(sigset_t *set);
182 extern status_t		_kern_set_signal_stack(const stack_t *newStack,
183 						stack_t *oldStack);
184 
185 // image functions
186 extern image_id		_kern_register_image(image_info *info, size_t size);
187 extern status_t		_kern_unregister_image(image_id id);
188 extern void			_kern_image_relocated(image_id id);
189 extern void			_kern_loading_app_failed(status_t error);
190 extern status_t		_kern_get_image_info(image_id id, image_info *info, size_t size);
191 extern status_t		_kern_get_next_image_info(team_id team, int32 *cookie, image_info *info, size_t size);
192 extern status_t		_kern_read_kernel_image_symbols(image_id id,
193 						struct Elf32_Sym* symbolTable, int32* _symbolCount,
194 						char* stringTable, size_t* _stringTableSize,
195 						addr_t* _imageDelta);
196 
197 // VFS functions
198 extern dev_t		_kern_mount(const char *path, const char *device,
199 						const char *fs_name, uint32 flags, const char *args, size_t argsLength);
200 extern status_t		_kern_unmount(const char *path, uint32 flags);
201 extern status_t		_kern_read_fs_info(dev_t device, struct fs_info *info);
202 extern status_t		_kern_write_fs_info(dev_t device, const struct fs_info *info, int mask);
203 extern dev_t		_kern_next_device(int32 *_cookie);
204 extern status_t		_kern_sync(void);
205 extern status_t		_kern_entry_ref_to_path(dev_t device, ino_t inode,
206 						const char *leaf, char *userPath, size_t pathLength);
207 extern status_t		_kern_normalize_path(const char* userPath,
208 						bool traverseLink, char* buffer);
209 extern int			_kern_open_entry_ref(dev_t device, ino_t inode, const char *name, int openMode, int perms);
210 extern int			_kern_open(int fd, const char *path, int openMode, int perms);
211 extern int			_kern_open_dir_entry_ref(dev_t device, ino_t inode, const char *name);
212 extern int			_kern_open_dir(int fd, const char *path);
213 extern int			_kern_open_parent_dir(int fd, char *name,
214 						size_t nameLength);
215 extern status_t		_kern_fcntl(int fd, int op, uint32 argument);
216 extern status_t		_kern_fsync(int fd);
217 extern status_t		_kern_flock(int fd, int op);
218 extern off_t		_kern_seek(int fd, off_t pos, int seekType);
219 extern status_t		_kern_create_dir_entry_ref(dev_t device, ino_t inode, const char *name, int perms);
220 extern status_t		_kern_create_dir(int fd, const char *path, int perms);
221 extern status_t		_kern_remove_dir(int fd, const char *path);
222 extern status_t		_kern_read_link(int fd, const char *path, char *buffer,
223 						size_t *_bufferSize);
224 extern status_t		_kern_create_symlink(int fd, const char *path,
225 						const char *toPath, int mode);
226 extern status_t		_kern_create_link(const char *path, const char *toPath);
227 extern status_t		_kern_unlink(int fd, const char *path);
228 extern status_t		_kern_rename(int oldDir, const char *oldpath, int newDir,
229 						const char *newpath);
230 extern status_t		_kern_create_fifo(const char *path, mode_t perms);
231 extern status_t		_kern_create_pipe(int *fds);
232 extern status_t		_kern_access(const char *path, int mode);
233 extern ssize_t		_kern_select(int numfds, struct fd_set *readSet,
234 						struct fd_set *writeSet, struct fd_set *errorSet,
235 						bigtime_t timeout, const sigset_t *sigMask);
236 extern ssize_t		_kern_poll(struct pollfd *fds, int numfds, bigtime_t timeout);
237 extern int			_kern_open_attr_dir(int fd, const char *path);
238 extern int			_kern_create_attr(int fd, const char *name, uint32 type, int openMode);
239 extern int			_kern_open_attr(int fd, const char *name, int openMode);
240 extern status_t		_kern_remove_attr(int fd, const char *name);
241 extern status_t		_kern_rename_attr(int fromFile, const char *fromName, int toFile, const char *toName);
242 extern int			_kern_open_index_dir(dev_t device);
243 extern status_t		_kern_create_index(dev_t device, const char *name, uint32 type, uint32 flags);
244 extern status_t		_kern_read_index_stat(dev_t device, const char *name, struct stat *stat);
245 extern status_t		_kern_remove_index(dev_t device, const char *name);
246 extern status_t		_kern_getcwd(char *buffer, size_t size);
247 extern status_t		_kern_setcwd(int fd, const char *path);
248 extern int			_kern_open_query(dev_t device, const char *query, size_t queryLength,
249 						uint32 flags, port_id port, int32 token);
250 
251 // file descriptor functions
252 extern ssize_t		_kern_read(int fd, off_t pos, void *buffer, size_t bufferSize);
253 extern ssize_t		_kern_readv(int fd, off_t pos, const struct iovec *vecs, size_t count);
254 extern ssize_t		_kern_write(int fd, off_t pos, const void *buffer, size_t bufferSize);
255 extern ssize_t		_kern_writev(int fd, off_t pos, const struct iovec *vecs,
256 						size_t count);
257 extern status_t		_kern_ioctl(int fd, ulong cmd, void *data, size_t length);
258 extern ssize_t		_kern_read_dir(int fd, struct dirent *buffer, size_t bufferSize,
259 						uint32 maxCount);
260 extern status_t		_kern_rewind_dir(int fd);
261 extern status_t		_kern_read_stat(int fd, const char *path, bool traverseLink,
262 						struct stat *stat, size_t statSize);
263 extern status_t		_kern_write_stat(int fd, const char *path,
264 						bool traverseLink, const struct stat *stat,
265 						size_t statSize, int statMask);
266 extern status_t		_kern_close(int fd);
267 extern int			_kern_dup(int fd);
268 extern int			_kern_dup2(int ofd, int nfd);
269 extern status_t		_kern_lock_node(int fd);
270 extern status_t		_kern_unlock_node(int fd);
271 extern status_t		_kern_get_next_fd_info(team_id team, uint32 *_cookie,
272 						struct fd_info *info, size_t infoSize);
273 
274 // socket functions
275 extern int			_kern_socket(int family, int type, int protocol);
276 extern status_t		_kern_bind(int socket, const struct sockaddr *address,
277 						socklen_t addressLength);
278 extern status_t		_kern_shutdown_socket(int socket, int how);
279 extern status_t		_kern_connect(int socket, const struct sockaddr *address,
280 						socklen_t addressLength);
281 extern status_t		_kern_listen(int socket, int backlog);
282 extern int			_kern_accept(int socket, struct sockaddr *address,
283 						socklen_t *_addressLength);
284 extern ssize_t		_kern_recv(int socket, void *data, size_t length,
285 						int flags);
286 extern ssize_t		_kern_recvfrom(int socket, void *data, size_t length,
287 						int flags, struct sockaddr *address,
288 						socklen_t *_addressLength);
289 extern ssize_t		_kern_recvmsg(int socket, struct msghdr *message,
290 						int flags);
291 extern ssize_t		_kern_send(int socket, const void *data, size_t length,
292 						int flags);
293 extern ssize_t		_kern_sendto(int socket, const void *data, size_t length,
294 						int flags, const struct sockaddr *address,
295 						socklen_t addressLength);
296 extern ssize_t		_kern_sendmsg(int socket, const struct msghdr *message,
297 						int flags);
298 extern status_t		_kern_getsockopt(int socket, int level, int option,
299 						void *value, socklen_t *_length);
300 extern status_t		_kern_setsockopt(int socket, int level, int option,
301 						const void *value, socklen_t length);
302 extern status_t		_kern_getpeername(int socket, struct sockaddr *address,
303 						socklen_t *_addressLength);
304 extern status_t		_kern_getsockname(int socket, struct sockaddr *address,
305 						socklen_t *_addressLength);
306 extern int			_kern_sockatmark(int socket);
307 extern status_t		_kern_socketpair(int family, int type, int protocol,
308 						int *socketVector);
309 extern status_t		_kern_get_next_socket_stat(int family, uint32 *cookie,
310 						struct net_stat *stat);
311 
312 // node monitor functions
313 extern status_t		_kern_stop_notifying(port_id port, uint32 token);
314 extern status_t		_kern_start_watching(dev_t device, ino_t node, uint32 flags,
315 						port_id port, uint32 token);
316 extern status_t		_kern_stop_watching(dev_t device, ino_t node, port_id port,
317 						uint32 token);
318 
319 // time functions
320 extern status_t		_kern_set_real_time_clock(uint32 time);
321 extern status_t		_kern_set_timezone(int32 timezoneOffset, bool daylightSavingTime);
322 extern status_t		_kern_get_timezone(int32 *_timezoneOffset, bool *_daylightSavingTime);
323 extern status_t		_kern_set_tzfilename(const char *filename, size_t length, bool isGMT);
324 extern status_t		_kern_get_tzfilename(char *filename, size_t length, bool *_isGMT);
325 
326 extern bigtime_t	_kern_system_time();
327 extern status_t		_kern_snooze_etc(bigtime_t time, int timebase, int32 flags);
328 
329 // area functions
330 extern area_id		_kern_create_area(const char *name, void **address, uint32 addressSpec,
331 						size_t size, uint32 lock, uint32 protection);
332 extern status_t		_kern_delete_area(area_id area);
333 extern area_id		_kern_area_for(void *address);
334 extern area_id		_kern_find_area(const char *name);
335 extern status_t		_kern_get_area_info(area_id area, area_info *info);
336 extern status_t		_kern_get_next_area_info(team_id team, int32 *cookie, area_info *info);
337 extern status_t		_kern_resize_area(area_id area, size_t newSize);
338 extern area_id		_kern_transfer_area(area_id area, void **_address, uint32 addressSpec,
339 						team_id target);
340 extern status_t		_kern_set_area_protection(area_id area, uint32 newProtection);
341 extern area_id		_kern_clone_area(const char *name, void **_address, uint32 addressSpec,
342 						uint32 protection, area_id sourceArea);
343 extern status_t		_kern_reserve_heap_address_range(addr_t* _address, uint32 addressSpec,
344 						addr_t size);
345 
346 extern area_id		_kern_map_file(const char *name, void **address,
347 						int addressSpec, size_t size, int protection,
348 						int mapping, int fd, off_t offset);
349 extern status_t		_kern_unmap_memory(void *address, size_t size);
350 extern status_t		_kern_set_memory_protection(void *address, size_t size,
351 						int protection);
352 extern status_t		_kern_sync_memory(void *address, size_t size, int flags);
353 extern status_t		_kern_memory_advice(void *address, size_t size,
354 						int advice);
355 
356 /* kernel port functions */
357 extern port_id		_kern_create_port(int32 queue_length, const char *name);
358 extern status_t		_kern_close_port(port_id id);
359 extern status_t		_kern_delete_port(port_id id);
360 extern port_id		_kern_find_port(const char *port_name);
361 extern status_t		_kern_get_port_info(port_id id, struct port_info *info);
362 extern status_t	 	_kern_get_next_port_info(team_id team, int32 *cookie, struct port_info *info);
363 extern ssize_t		_kern_port_buffer_size_etc(port_id port, uint32 flags, bigtime_t timeout);
364 extern int32		_kern_port_count(port_id port);
365 extern ssize_t		_kern_read_port_etc(port_id port, int32 *msgCode, void *msgBuffer,
366 						size_t bufferSize, uint32 flags, bigtime_t timeout);
367 extern status_t		_kern_set_port_owner(port_id port, team_id team);
368 extern status_t		_kern_write_port_etc(port_id port, int32 msgCode, const void *msgBuffer,
369 						size_t bufferSize, uint32 flags, bigtime_t timeout);
370 extern status_t		_kern_writev_port_etc(port_id id, int32 msgCode,
371 						const struct iovec *msgVecs, size_t vecCount,
372 						size_t bufferSize, uint32 flags, bigtime_t timeout);
373 extern status_t		_kern_get_port_message_info_etc(port_id port,
374 						port_message_info *info, size_t infoSize, uint32 flags,
375 						bigtime_t timeout);
376 
377 // debug support functions
378 extern void			_kern_debugger(const char *message);
379 extern int			_kern_disable_debugger(int state);
380 
381 extern status_t		_kern_install_default_debugger(port_id debuggerPort);
382 extern port_id		_kern_install_team_debugger(team_id team,
383 						port_id debuggerPort);
384 extern status_t		_kern_remove_team_debugger(team_id team);
385 extern status_t		_kern_debug_thread(thread_id thread);
386 extern void			_kern_wait_for_debugger(void);
387 
388 extern status_t		_kern_set_debugger_breakpoint(void *address, uint32 type,
389 						int32 length, bool watchpoint);
390 extern status_t		_kern_clear_debugger_breakpoint(void *address,
391 						bool watchpoint);
392 
393 /* atomic_* ops (needed for CPUs that don't support them directly) */
394 #ifdef ATOMIC_FUNCS_ARE_SYSCALLS
395 extern int32		_kern_atomic_set(vint32 *value, int32 newValue);
396 extern int32		_kern_atomic_test_and_set(vint32 *value, int32 newValue, int32 testAgainst);
397 extern int32		_kern_atomic_add(vint32 *value, int32 addValue);
398 extern int32		_kern_atomic_and(vint32 *value, int32 andValue);
399 extern int32		_kern_atomic_or(vint32 *value, int32 orValue);
400 extern int32		_kern_atomic_get(vint32 *value);
401 #endif	// ATOMIC_FUNCS_ARE_SYSCALLS
402 
403 #ifdef ATOMIC64_FUNCS_ARE_SYSCALLS
404 extern int64		_kern_atomic_set64(vint64 *value, int64 newValue);
405 extern int64		_kern_atomic_test_and_set64(vint64 *value, int64 newValue, int64 testAgainst);
406 extern int64		_kern_atomic_add64(vint64 *value, int64 addValue);
407 extern int64		_kern_atomic_and64(vint64 *value, int64 andValue);
408 extern int64		_kern_atomic_or64(vint64 *value, int64 orValue);
409 extern int64		_kern_atomic_get64(vint64 *value);
410 #endif	// ATOMIC64_FUNCS_ARE_SYSCALLS
411 
412 /* System informations */
413 extern status_t		_kern_get_system_info(system_info *info, size_t size);
414 extern status_t		_kern_get_system_info_etc(int32 id, void *buffer,
415 						size_t bufferSize);
416 extern status_t		_kern_analyze_scheduling(bigtime_t from, bigtime_t until,
417 						void* buffer, size_t size,
418 						struct scheduling_analysis* analysis);
419 
420 /* Debug output */
421 extern void			_kern_debug_output(const char *message);
422 extern void			_kern_ktrace_output(const char *message);
423 extern status_t		_kern_frame_buffer_update(addr_t baseAddress, int32 width,
424 						int32 height, int32 depth, int32 bytesPerRow);
425 
426 /* messaging service */
427 extern area_id		_kern_register_messaging_service(sem_id lockingSem,
428 						sem_id counterSem);
429 extern status_t		_kern_unregister_messaging_service();
430 
431 extern void			_kern_clear_caches(void *address, size_t length, uint32 flags);
432 extern bool			_kern_cpu_enabled(int32 cpu);
433 extern status_t		_kern_set_cpu_enabled(int32 cpu, bool enabled);
434 
435 #ifdef __INTEL__
436 // our only x86 only syscall
437 extern status_t		_kern_get_cpuid(cpuid_info *info, uint32 eax, uint32 cpu);
438 #endif
439 
440 
441 /* Disk Device Manager syscalls */
442 
443 // iterating, retrieving device/partition data
444 extern partition_id	_kern_get_next_disk_device_id(int32 *cookie,
445 						size_t *neededSize);
446 extern partition_id	_kern_find_disk_device(const char *filename,
447 						size_t *neededSize);
448 extern partition_id	_kern_find_partition(const char *filename,
449 						size_t *neededSize);
450 extern partition_id	_kern_find_file_disk_device(const char *filename,
451 						size_t *neededSize);
452 extern status_t		_kern_get_disk_device_data(partition_id deviceID,
453 						bool deviceOnly, struct user_disk_device_data *buffer,
454 						size_t bufferSize, size_t *neededSize);
455 extern partition_id	_kern_register_file_device(const char *filename);
456 extern status_t		_kern_unregister_file_device(partition_id deviceID,
457 						const char *filename);
458 	// Only a valid deviceID or filename need to be passed. The other one
459 	// is -1/NULL. If both is given only filename is ignored.
460 extern status_t		_kern_get_file_disk_device_path(partition_id id,
461 						char* buffer, size_t bufferSize);
462 
463 // disk systems
464 extern status_t		_kern_get_disk_system_info(disk_system_id id,
465 						struct user_disk_system_info *info);
466 extern status_t		_kern_get_next_disk_system_info(int32 *cookie,
467 						struct user_disk_system_info *info);
468 extern status_t		_kern_find_disk_system(const char *name,
469 						struct user_disk_system_info *info);
470 
471 // disk device modification
472 extern status_t		_kern_defragment_partition(partition_id partitionID,
473 						int32* changeCounter);
474 extern status_t		_kern_repair_partition(partition_id partitionID,
475 						int32* changeCounter, bool checkOnly);
476 extern status_t		_kern_resize_partition(partition_id partitionID,
477 						int32* changeCounter, partition_id childID,
478 						int32* childChangeCounter, off_t size,
479 						off_t contentSize);
480 extern status_t		_kern_move_partition(partition_id partitionID,
481 						int32* changeCounter, partition_id childID,
482 						int32* childChangeCounter, off_t newOffset,
483 						partition_id* descendantIDs,
484 						int32* descendantChangeCounters, int32 descendantCount);
485 extern status_t		_kern_set_partition_name(partition_id partitionID,
486 						int32* changeCounter, partition_id childID,
487 						int32* childChangeCounter, const char* name);
488 extern status_t		_kern_set_partition_content_name(partition_id partitionID,
489 						int32* changeCounter, const char* name);
490 extern status_t		_kern_set_partition_type(partition_id partitionID,
491 						int32* changeCounter, partition_id childID,
492 						int32* childChangeCounter, const char* type);
493 extern status_t		_kern_set_partition_parameters(partition_id partitionID,
494 						int32* changeCounter, partition_id childID,
495 						int32* childChangeCounter, const char* parameters,
496 						size_t parametersSize);
497 extern status_t		_kern_set_partition_content_parameters(
498 						partition_id partitionID, int32* changeCounter,
499 						const char* parameters, size_t parametersSize);
500 extern status_t		_kern_initialize_partition(partition_id partitionID,
501 						int32* changeCounter, const char* diskSystemName,
502 						const char* name, const char* parameters,
503 						size_t parametersSize);
504 extern status_t		_kern_uninitialize_partition(partition_id partitionID,
505 						int32* changeCounter);
506 extern status_t		_kern_create_child_partition(partition_id partitionID,
507 						int32* changeCounter, off_t offset, off_t size,
508 						const char* type, const char* name,
509 						const char* parameters, size_t parametersSize,
510 						partition_id* childID, int32* childChangeCounter);
511 extern status_t		_kern_delete_child_partition(partition_id partitionID,
512 						int32* changeCounter, partition_id childID,
513 						int32 childChangeCounter);
514 
515 #if 0
516 
517 // watching
518 status_t start_disk_device_watching(port_id, int32 token, uint32 flags);
519 status_t start_disk_device_job_watching(disk_job_id job, port_id, int32 token,
520 										uint32 flags);
521 status_t stop_disk_device_watching(port_id, int32 token);
522 
523 #endif	// 0
524 
525 
526 // The end mark for gensyscallinfos.
527 #ifdef GEN_SYSCALL_INFOS_PROCESSING
528 #pragma syscalls end
529 #endif
530 
531 #ifdef __cplusplus
532 }
533 #endif
534 
535 #endif	/* _SYSTEM_SYSCALLS_H */
536