syscalls.h revision 8c6cb8af
2 * Copyright 2004-2015, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
9#include <arch_config.h>
10#include <DiskDeviceDefs.h>
11#include <elf_private.h>
12#include <image.h>
13#include <image_defs.h>
14#include <OS.h>
16#include <signal.h>
17#include <sys/socket.h>
20#ifdef __cplusplus
21extern "C" {
24struct attr_info;
25struct dirent;
26struct fd_info;
27struct fd_set;
28struct fs_info;
29struct iovec;
30struct msqid_ds;
31struct net_stat;
32struct pollfd;
33struct rlimit;
34struct scheduling_analysis;
35struct _sem_t;
36struct sembuf;
37union semun;
38struct sigaction;
39struct signal_frame_data;
40struct stat;
41struct system_profiler_parameters;
42struct user_timer_info;
44struct disk_device_job_progress_info;
45struct partitionable_space_data;
46struct thread_creation_attributes;
47struct user_disk_device_data;
48struct user_disk_device_job_info;
49struct user_disk_system_info;
51// This marks the beginning of the syscalls prototypes for gensyscallinfos.
52// NOTE:
53// * Nothing but those prototypes may live here.
54// * The arguments of the functions must be named to be processed properly.
57#	define __NO_RETURN
58#	pragma syscalls begin
60#	define __NO_RETURN	__attribute__((noreturn))
63extern int			_kern_is_computer_on(void);
64extern status_t		_kern_generic_syscall(const char *subsystem, uint32 function,
65						void *buffer, size_t bufferSize);
67extern int			_kern_getrlimit(int resource, struct rlimit * rlp);
68extern int			_kern_setrlimit(int resource, const struct rlimit * rlp);
70extern status_t		_kern_shutdown(bool reboot);
71extern status_t		_kern_get_safemode_option(const char *parameter,
72						char *buffer, size_t *_bufferSize);
74extern ssize_t		_kern_wait_for_objects(object_wait_info* infos, int numInfos,
75						uint32 flags, bigtime_t timeout);
77/* user mutex functions */
78extern status_t		_kern_mutex_lock(int32* mutex, const char* name,
79						uint32 flags, bigtime_t timeout);
80extern status_t		_kern_mutex_unlock(int32* mutex, uint32 flags);
81extern status_t		_kern_mutex_switch_lock(int32* fromMutex, int32* toMutex,
82						const char* name, uint32 flags, bigtime_t timeout);
83extern status_t		_kern_mutex_sem_acquire(int32* sem, const char* name,
84						uint32 flags, bigtime_t timeout);
85extern status_t		_kern_mutex_sem_release(int32* sem);
87/* sem functions */
88extern sem_id		_kern_create_sem(int count, const char *name);
89extern status_t		_kern_delete_sem(sem_id id);
90extern status_t		_kern_switch_sem(sem_id releaseSem, sem_id id);
91extern status_t		_kern_switch_sem_etc(sem_id releaseSem, sem_id id,
92						uint32 count, uint32 flags, bigtime_t timeout);
93extern status_t		_kern_acquire_sem(sem_id id);
94extern status_t		_kern_acquire_sem_etc(sem_id id, uint32 count, uint32 flags,
95						bigtime_t timeout);
96extern status_t		_kern_release_sem(sem_id id);
97extern status_t		_kern_release_sem_etc(sem_id id, uint32 count, uint32 flags);
98extern status_t		_kern_get_sem_count(sem_id id, int32* thread_count);
99extern status_t		_kern_get_sem_info(sem_id semaphore, struct sem_info *info,
100						size_t size);
101extern status_t		_kern_get_next_sem_info(team_id team, int32 *cookie,
102						struct sem_info *info, size_t size);
103extern status_t		_kern_set_sem_owner(sem_id id, team_id proc);
105/* POSIX realtime sem syscalls */
106extern status_t		_kern_realtime_sem_open(const char* name,
107						int openFlagsOrShared, mode_t mode, uint32 semCount,
108						struct _sem_t* userSem, struct _sem_t** _usedUserSem);
109extern status_t		_kern_realtime_sem_close(sem_id semID,
110						struct _sem_t** _deleteUserSem);
111extern status_t		_kern_realtime_sem_unlink(const char* name);
113extern status_t		_kern_realtime_sem_get_value(sem_id semID, int* value);
114extern status_t		_kern_realtime_sem_post(sem_id semID);
115extern status_t		_kern_realtime_sem_wait(sem_id semID, bigtime_t timeout);
117/* POSIX XSI semaphore syscalls */
118extern int			_kern_xsi_semget(key_t key, int numSems, int flags);
119extern int			_kern_xsi_semctl(int semID, int semNumber, int command,
120						union semun* args);
121extern status_t		_kern_xsi_semop(int semID, struct sembuf *semOps,
122						size_t numSemOps);
124/* POSIX XSI message queue syscalls */
125extern int			_kern_xsi_msgctl(int messageQueueID, int command,
126						struct msqid_ds *buffer);
127extern int			_kern_xsi_msgget(key_t key, int messageQueueFlags);
128extern ssize_t		_kern_xsi_msgrcv(int messageQueueID, void *messagePointer,
129						size_t messageSize, long messageType, int messageFlags);
130extern int			_kern_xsi_msgsnd(int messageQueueID,
131						const void *messagePointer, size_t messageSize,
132						int messageFlags);
134/* team & thread syscalls */
135extern thread_id	_kern_load_image(const char* const* flatArgs,
136						size_t flatArgsSize, int32 argCount, int32 envCount,
137						int32 priority, uint32 flags, port_id errorPort,
138						uint32 errorToken);
139extern void __NO_RETURN _kern_exit_team(status_t returnValue);
140extern status_t		_kern_kill_team(team_id team);
141extern team_id		_kern_get_current_team();
142extern status_t		_kern_wait_for_team(team_id team, status_t *_returnCode);
143extern pid_t		_kern_wait_for_child(thread_id child, uint32 flags,
144						siginfo_t* info);
145extern status_t		_kern_exec(const char *path, const char* const* flatArgs,
146						size_t flatArgsSize, int32 argCount, int32 envCount,
147						mode_t umask);
148extern thread_id	_kern_fork(void);
149extern pid_t		_kern_process_info(pid_t process, int32 which);
150extern pid_t		_kern_setpgid(pid_t process, pid_t group);
151extern pid_t		_kern_setsid(void);
152extern status_t		_kern_change_root(const char *path);
154extern thread_id	_kern_spawn_thread(
155						struct thread_creation_attributes* attributes);
156extern thread_id	_kern_find_thread(const char *name);
157extern status_t		_kern_suspend_thread(thread_id thread);
158extern status_t		_kern_resume_thread(thread_id thread);
159extern status_t		_kern_rename_thread(thread_id thread, const char *newName);
160extern status_t		_kern_set_thread_priority(thread_id thread,
161						int32 newPriority);
162extern status_t		_kern_kill_thread(thread_id thread);
163extern void			_kern_exit_thread(status_t returnValue);
164extern status_t		_kern_cancel_thread(thread_id threadID,
165						void (*cancelFunction)(int));
166extern void			_kern_thread_yield(void);
167extern status_t		_kern_wait_for_thread(thread_id thread,
168						status_t *_returnCode);
169extern bool			_kern_has_data(thread_id thread);
170extern status_t		_kern_send_data(thread_id thread, int32 code,
171						const void *buffer, size_t bufferSize);
172extern int32		_kern_receive_data(thread_id *_sender, void *buffer,
173						size_t bufferSize);
174extern int64		_kern_restore_signal_frame(
175						struct signal_frame_data* signalFrameData);
177extern status_t		_kern_get_thread_info(thread_id id, thread_info *info);
178extern status_t		_kern_get_next_thread_info(team_id team, int32 *cookie,
179						thread_info *info);
180extern status_t		_kern_get_team_info(team_id id, team_info *info);
181extern status_t		_kern_get_next_team_info(int32 *cookie, team_info *info);
182extern status_t		_kern_get_team_usage_info(team_id team, int32 who,
183						team_usage_info *info, size_t size);
184extern status_t		_kern_get_extended_team_info(team_id teamID, uint32 flags,
185						void* buffer, size_t size, size_t* _sizeNeeded);
187extern status_t		_kern_start_watching_system(int32 object, uint32 flags,
188						port_id port, int32 token);
189extern status_t		_kern_stop_watching_system(int32 object, uint32 flags,
190						port_id port, int32 token);
192extern status_t		_kern_block_thread(uint32 flags, bigtime_t timeout);
193extern status_t		_kern_unblock_thread(thread_id thread, status_t status);
194extern status_t		_kern_unblock_threads(thread_id* threads, uint32 count,
195						status_t status);
197extern bigtime_t	_kern_estimate_max_scheduling_latency(thread_id thread);
199extern status_t		_kern_set_scheduler_mode(int32 mode);
200extern int32		_kern_get_scheduler_mode(void);
202// user/group functions
203extern gid_t		_kern_getgid(bool effective);
204extern uid_t		_kern_getuid(bool effective);
205extern status_t		_kern_setregid(gid_t rgid, gid_t egid,
206						bool setAllIfPrivileged);
207extern status_t		_kern_setreuid(uid_t ruid, uid_t euid,
208						bool setAllIfPrivileged);
209extern ssize_t		_kern_getgroups(int groupCount, gid_t* groupList);
210extern status_t		_kern_setgroups(int groupCount, const gid_t* groupList);
212// signal functions
213extern status_t		_kern_send_signal(int32 id, uint32 signal,
214						const union sigval* userValue, uint32 flags);
215extern status_t		_kern_set_signal_mask(int how, const sigset_t *set,
216						sigset_t *oldSet);
217extern status_t		_kern_sigaction(int sig, const struct sigaction *action,
218						struct sigaction *oldAction);
219extern status_t		_kern_sigwait(const sigset_t *set, siginfo_t *info,
220						uint32 flags, bigtime_t timeout);
221extern status_t		_kern_sigsuspend(const sigset_t *mask);
222extern status_t		_kern_sigpending(sigset_t *set);
223extern status_t		_kern_set_signal_stack(const stack_t *newStack,
224						stack_t *oldStack);
226// image functions
227extern image_id		_kern_register_image(extended_image_info *info,
228						size_t size);
229extern status_t		_kern_unregister_image(image_id id);
230extern void			_kern_image_relocated(image_id id);
231extern void			_kern_loading_app_failed(status_t error);
232extern status_t		_kern_get_image_info(image_id id, image_info *info,
233						size_t size);
234extern status_t		_kern_get_next_image_info(team_id team, int32 *cookie,
235						image_info *info, size_t size);
236extern status_t		_kern_read_kernel_image_symbols(image_id id,
237						elf_sym* symbolTable, int32* _symbolCount,
238						char* stringTable, size_t* _stringTableSize,
239						addr_t* _imageDelta);
241// VFS functions
242extern dev_t		_kern_mount(const char *path, const char *device,
243						const char *fs_name, uint32 flags, const char *args,
244						size_t argsLength);
245extern status_t		_kern_unmount(const char *path, uint32 flags);
246extern status_t		_kern_read_fs_info(dev_t device, struct fs_info *info);
247extern status_t		_kern_write_fs_info(dev_t device, const struct fs_info *info,
248						int mask);
249extern dev_t		_kern_next_device(int32 *_cookie);
250extern status_t		_kern_sync(void);
251extern status_t		_kern_entry_ref_to_path(dev_t device, ino_t inode,
252						const char *leaf, char *userPath, size_t pathLength);
253extern status_t		_kern_normalize_path(const char* userPath,
254						bool traverseLink, char* buffer);
255extern int			_kern_open_entry_ref(dev_t device, ino_t inode,
256						const char *name, int openMode, int perms);
257extern int			_kern_open(int fd, const char *path, int openMode,
258						int perms);
259extern int			_kern_open_dir_entry_ref(dev_t device, ino_t inode,
260						const char *name);
261extern int			_kern_open_dir(int fd, const char *path);
262extern int			_kern_open_parent_dir(int fd, char *name,
263						size_t nameLength);
264extern status_t		_kern_fcntl(int fd, int op, size_t argument);
265extern status_t		_kern_fsync(int fd);
266extern status_t		_kern_flock(int fd, int op);
267extern off_t		_kern_seek(int fd, off_t pos, int seekType);
268extern status_t		_kern_create_dir_entry_ref(dev_t device, ino_t inode,
269						const char *name, int perms);
270extern status_t		_kern_create_dir(int fd, const char *path, int perms);
271extern status_t		_kern_remove_dir(int fd, const char *path);
272extern status_t		_kern_read_link(int fd, const char *path, char *buffer,
273						size_t *_bufferSize);
274extern status_t		_kern_create_symlink(int fd, const char *path,
275						const char *toPath, int mode);
276extern status_t		_kern_create_link(int pathFD, const char *path, int toFD,
277						const char *toPath, bool traverseLeafLink);
278extern status_t		_kern_unlink(int fd, const char *path);
279extern status_t		_kern_rename(int oldDir, const char *oldpath, int newDir,
280						const char *newpath);
281extern status_t		_kern_create_fifo(int fd, const char *path, mode_t perms);
282extern status_t		_kern_create_pipe(int *fds);
283extern status_t		_kern_access(int fd, const char *path, int mode,
284						bool effectiveUserGroup);
285extern ssize_t		_kern_select(int numfds, struct fd_set *readSet,
286						struct fd_set *writeSet, struct fd_set *errorSet,
287						bigtime_t timeout, const sigset_t *sigMask);
288extern ssize_t		_kern_poll(struct pollfd *fds, int numFDs,
289						bigtime_t timeout);
291extern int			_kern_open_attr_dir(int fd, const char *path,
292						bool traverseLeafLink);
293extern ssize_t		_kern_read_attr(int fd, const char *attribute, off_t pos,
294						void *buffer, size_t readBytes);
295extern ssize_t		_kern_write_attr(int fd, const char *attribute, uint32 type,
296						off_t pos, const void *buffer, size_t readBytes);
297extern status_t		_kern_stat_attr(int fd, const char *attribute,
298						struct attr_info *attrInfo);
299extern int			_kern_open_attr(int fd, const char* path, const char *name,
300						uint32 type, int openMode);
301extern status_t		_kern_remove_attr(int fd, const char *name);
302extern status_t		_kern_rename_attr(int fromFile, const char *fromName,
303						int toFile, const char *toName);
304extern int			_kern_open_index_dir(dev_t device);
305extern status_t		_kern_create_index(dev_t device, const char *name,
306						uint32 type, uint32 flags);
307extern status_t		_kern_read_index_stat(dev_t device, const char *name,
308						struct stat *stat);
309extern status_t		_kern_remove_index(dev_t device, const char *name);
310extern status_t		_kern_getcwd(char *buffer, size_t size);
311extern status_t		_kern_setcwd(int fd, const char *path);
312extern int			_kern_open_query(dev_t device, const char *query,
313						size_t queryLength, uint32 flags, port_id port,
314						int32 token);
316// file descriptor functions
317extern ssize_t		_kern_read(int fd, off_t pos, void *buffer,
318						size_t bufferSize);
319extern ssize_t		_kern_readv(int fd, off_t pos, const struct iovec *vecs,
320						size_t count);
321extern ssize_t		_kern_write(int fd, off_t pos, const void *buffer,
322						size_t bufferSize);
323extern ssize_t		_kern_writev(int fd, off_t pos, const struct iovec *vecs,
324						size_t count);
325extern status_t		_kern_ioctl(int fd, uint32 cmd, void *data, size_t length);
326extern ssize_t		_kern_read_dir(int fd, struct dirent *buffer,
327						size_t bufferSize, uint32 maxCount);
328extern status_t		_kern_rewind_dir(int fd);
329extern status_t		_kern_read_stat(int fd, const char *path, bool traverseLink,
330						struct stat *stat, size_t statSize);
331extern status_t		_kern_write_stat(int fd, const char *path,
332						bool traverseLink, const struct stat *stat,
333						size_t statSize, int statMask);
334extern status_t		_kern_close(int fd);
335extern int			_kern_dup(int fd);
336extern int			_kern_dup2(int ofd, int nfd);
337extern status_t		_kern_lock_node(int fd);
338extern status_t		_kern_unlock_node(int fd);
339extern status_t		_kern_get_next_fd_info(team_id team, uint32 *_cookie,
340						struct fd_info *info, size_t infoSize);
342// socket functions
343extern int			_kern_socket(int family, int type, int protocol);
344extern status_t		_kern_bind(int socket, const struct sockaddr *address,
345						socklen_t addressLength);
346extern status_t		_kern_shutdown_socket(int socket, int how);
347extern status_t		_kern_connect(int socket, const struct sockaddr *address,
348						socklen_t addressLength);
349extern status_t		_kern_listen(int socket, int backlog);
350extern int			_kern_accept(int socket, struct sockaddr *address,
351						socklen_t *_addressLength);
352extern ssize_t		_kern_recv(int socket, void *data, size_t length,
353						int flags);
354extern ssize_t		_kern_recvfrom(int socket, void *data, size_t length,
355						int flags, struct sockaddr *address,
356						socklen_t *_addressLength);
357extern ssize_t		_kern_recvmsg(int socket, struct msghdr *message,
358						int flags);
359extern ssize_t		_kern_send(int socket, const void *data, size_t length,
360						int flags);
361extern ssize_t		_kern_sendto(int socket, const void *data, size_t length,
362						int flags, const struct sockaddr *address,
363						socklen_t addressLength);
364extern ssize_t		_kern_sendmsg(int socket, const struct msghdr *message,
365						int flags);
366extern status_t		_kern_getsockopt(int socket, int level, int option,
367						void *value, socklen_t *_length);
368extern status_t		_kern_setsockopt(int socket, int level, int option,
369						const void *value, socklen_t length);
370extern status_t		_kern_getpeername(int socket, struct sockaddr *address,
371						socklen_t *_addressLength);
372extern status_t		_kern_getsockname(int socket, struct sockaddr *address,
373						socklen_t *_addressLength);
374extern int			_kern_sockatmark(int socket);
375extern status_t		_kern_socketpair(int family, int type, int protocol,
376						int *socketVector);
377extern status_t		_kern_get_next_socket_stat(int family, uint32 *cookie,
378						struct net_stat *stat);
380// node monitor functions
381extern status_t		_kern_stop_notifying(port_id port, uint32 token);
382extern status_t		_kern_start_watching(dev_t device, ino_t node, uint32 flags,
383						port_id port, uint32 token);
384extern status_t		_kern_stop_watching(dev_t device, ino_t node, port_id port,
385						uint32 token);
387// time functions
388extern status_t		_kern_set_real_time_clock(bigtime_t time);
389extern status_t		_kern_set_timezone(int32 timezoneOffset, const char *name,
390						size_t nameLength);
391extern status_t		_kern_get_timezone(int32 *_timezoneOffset, char *name,
392						size_t nameLength);
393extern status_t		_kern_set_real_time_clock_is_gmt(bool isGMT);
394extern status_t		_kern_get_real_time_clock_is_gmt(bool *_isGMT);
396extern status_t		_kern_get_clock(clockid_t clockID, bigtime_t* _time);
397extern status_t		_kern_set_clock(clockid_t clockID, bigtime_t time);
399extern bigtime_t	_kern_system_time();
400extern status_t		_kern_snooze_etc(bigtime_t time, int timebase, int32 flags,
401						bigtime_t* _remainingTime);
403extern int32		_kern_create_timer(clockid_t clockID, thread_id threadID,
404						uint32 flags, const struct sigevent* event,
405						const struct thread_creation_attributes*
406							threadAttributes);
407extern status_t		_kern_delete_timer(int32 timerID, thread_id threadID);
408extern status_t		_kern_get_timer(int32 timerID, thread_id threadID,
409						struct user_timer_info* info);
410extern status_t		_kern_set_timer(int32 timerID, thread_id threadID,
411						bigtime_t startTime, bigtime_t interval, uint32 flags,
412						struct user_timer_info* oldInfo);
414// area functions
415extern area_id		_kern_create_area(const char *name, void **address,
416						uint32 addressSpec, size_t size, uint32 lock,
417						uint32 protection);
418extern status_t		_kern_delete_area(area_id area);
419extern area_id		_kern_area_for(void *address);
420extern area_id		_kern_find_area(const char *name);
421extern status_t		_kern_get_area_info(area_id area, area_info *info);
422extern status_t		_kern_get_next_area_info(team_id team, ssize_t *cookie,
423						area_info *info);
424extern status_t		_kern_resize_area(area_id area, size_t newSize);
425extern area_id		_kern_transfer_area(area_id area, void **_address,
426						uint32 addressSpec, team_id target);
427extern status_t		_kern_set_area_protection(area_id area,
428						uint32 newProtection);
429extern area_id		_kern_clone_area(const char *name, void **_address,
430						uint32 addressSpec, uint32 protection,
431						area_id sourceArea);
432extern status_t		_kern_reserve_address_range(addr_t* _address,
433						uint32 addressSpec, addr_t size);
434extern status_t		_kern_unreserve_address_range(addr_t address, addr_t size);
436extern area_id		_kern_map_file(const char *name, void **address,
437						uint32 addressSpec, size_t size, uint32 protection,
438						uint32 mapping, bool unmapAddressRange, int fd,
439						off_t offset);
440extern status_t		_kern_unmap_memory(void *address, size_t size);
441extern status_t		_kern_set_memory_protection(void *address, size_t size,
442						uint32 protection);
443extern status_t		_kern_sync_memory(void *address, size_t size, int flags);
444extern status_t		_kern_memory_advice(void *address, size_t size,
445						uint32 advice);
447extern status_t		_kern_get_memory_properties(team_id teamID,
448						const void *address, uint32* _protected, uint32* _lock);
450/* kernel port functions */
451extern port_id		_kern_create_port(int32 queue_length, const char *name);
452extern status_t		_kern_close_port(port_id id);
453extern status_t		_kern_delete_port(port_id id);
454extern port_id		_kern_find_port(const char *port_name);
455extern status_t		_kern_get_port_info(port_id id, struct port_info *info);
456extern status_t		_kern_get_next_port_info(team_id team, int32 *cookie,
457						struct port_info *info);
458extern ssize_t		_kern_port_buffer_size_etc(port_id port, uint32 flags,
459						bigtime_t timeout);
460extern int32		_kern_port_count(port_id port);
461extern ssize_t		_kern_read_port_etc(port_id port, int32 *msgCode,
462						void *msgBuffer, size_t bufferSize, uint32 flags,
463						bigtime_t timeout);
464extern status_t		_kern_set_port_owner(port_id port, team_id team);
465extern status_t		_kern_write_port_etc(port_id port, int32 msgCode,
466						const void *msgBuffer, size_t bufferSize, uint32 flags,
467						bigtime_t timeout);
468extern status_t		_kern_writev_port_etc(port_id id, int32 msgCode,
469						const struct iovec *msgVecs, size_t vecCount,
470						size_t bufferSize, uint32 flags, bigtime_t timeout);
471extern status_t		_kern_get_port_message_info_etc(port_id port,
472						port_message_info *info, size_t infoSize, uint32 flags,
473						bigtime_t timeout);
475// debug support functions
476extern status_t		_kern_kernel_debugger(const char *message);
477extern void			_kern_register_syslog_daemon(port_id port);
478extern void			_kern_debugger(const char *message);
479extern int			_kern_disable_debugger(int state);
481extern status_t		_kern_install_default_debugger(port_id debuggerPort);
482extern port_id		_kern_install_team_debugger(team_id team,
483						port_id debuggerPort);
484extern status_t		_kern_remove_team_debugger(team_id team);
485extern status_t		_kern_debug_thread(thread_id thread);
486extern void			_kern_wait_for_debugger(void);
488extern status_t		_kern_set_debugger_breakpoint(void *address, uint32 type,
489						int32 length, bool watchpoint);
490extern status_t		_kern_clear_debugger_breakpoint(void *address,
491						bool watchpoint);
493extern status_t		_kern_system_profiler_start(
494						struct system_profiler_parameters* parameters);
495extern status_t		_kern_system_profiler_next_buffer(size_t bytesRead,
496						uint64* _droppedEvents);
497extern status_t		_kern_system_profiler_stop();
498extern status_t		_kern_system_profiler_recorded(
499						struct system_profiler_parameters* parameters);
501/* atomic_* ops (needed for CPUs that don't support them directly) */
503extern void		_kern_atomic_set(int32 *value, int32 newValue);
504extern int32		_kern_atomic_get_and_set(int32 *value, int32 newValue);
505extern int32		_kern_atomic_test_and_set(int32 *value, int32 newValue,
506						int32 testAgainst);
507extern int32		_kern_atomic_add(int32 *value, int32 addValue);
508extern int32		_kern_atomic_and(int32 *value, int32 andValue);
509extern int32		_kern_atomic_or(int32 *value, int32 orValue);
510extern int32		_kern_atomic_get(int32 *value);
514extern void		_kern_atomic_set64(int64 *value, int64 newValue);
515extern int64		_kern_atomic_get_and_set64(int64 *value, int64 newValue);
516extern int64		_kern_atomic_test_and_set64(int64 *value, int64 newValue,
517						int64 testAgainst);
518extern int64		_kern_atomic_add64(int64 *value, int64 addValue);
519extern int64		_kern_atomic_and64(int64 *value, int64 andValue);
520extern int64		_kern_atomic_or64(int64 *value, int64 orValue);
521extern int64		_kern_atomic_get64(int64 *value);
524/* System informations */
525extern status_t		_kern_get_system_info(system_info* info);
526extern status_t		_kern_get_cpu_info(uint32 firstCPU, uint32 cpuCount,
527						cpu_info* info);
528extern status_t		_kern_get_cpu_topology_info(
529						cpu_topology_node_info* topologyInfos,
530						uint32* topologyInfoCount);
532extern status_t		_kern_analyze_scheduling(bigtime_t from, bigtime_t until,
533						void* buffer, size_t size,
534						struct scheduling_analysis* analysis);
536/* Debug output */
537extern void			_kern_debug_output(const char *message);
538extern void			_kern_ktrace_output(const char *message);
539extern status_t		_kern_frame_buffer_update(addr_t baseAddress, int32 width,
540						int32 height, int32 depth, int32 bytesPerRow);
542/* messaging service */
543extern area_id		_kern_register_messaging_service(sem_id lockingSem,
544						sem_id counterSem);
545extern status_t		_kern_unregister_messaging_service();
547extern void			_kern_clear_caches(void *address, size_t length,
548						uint32 flags);
549extern bool			_kern_cpu_enabled(int32 cpu);
550extern status_t		_kern_set_cpu_enabled(int32 cpu, bool enabled);
552#if defined(__INTEL__) || defined(__x86_64__)
553// our only x86 only syscall
554extern status_t		_kern_get_cpuid(cpuid_info *info, uint32 eax, uint32 cpu);
558/* Disk Device Manager syscalls */
560// iterating, retrieving device/partition data
561extern partition_id	_kern_get_next_disk_device_id(int32 *cookie,
562						size_t *neededSize);
563extern partition_id	_kern_find_disk_device(const char *filename,
564						size_t *neededSize);
565extern partition_id	_kern_find_partition(const char *filename,
566						size_t *neededSize);
567extern partition_id	_kern_find_file_disk_device(const char *filename,
568						size_t *neededSize);
569extern status_t		_kern_get_disk_device_data(partition_id deviceID,
570						bool deviceOnly, struct user_disk_device_data *buffer,
571						size_t bufferSize, size_t *neededSize);
572extern partition_id	_kern_register_file_device(const char *filename);
573extern status_t		_kern_unregister_file_device(partition_id deviceID,
574						const char *filename);
575	// Only a valid deviceID or filename need to be passed. The other one
576	// is -1/NULL. If both is given only filename is ignored.
577extern status_t		_kern_get_file_disk_device_path(partition_id id,
578						char* buffer, size_t bufferSize);
580// disk systems
581extern status_t		_kern_get_disk_system_info(disk_system_id id,
582						struct user_disk_system_info *info);
583extern status_t		_kern_get_next_disk_system_info(int32 *cookie,
584						struct user_disk_system_info *info);
585extern status_t		_kern_find_disk_system(const char *name,
586						struct user_disk_system_info *info);
588// disk device modification
589extern status_t		_kern_defragment_partition(partition_id partitionID,
590						int32* changeCounter);
591extern status_t		_kern_repair_partition(partition_id partitionID,
592						int32* changeCounter, bool checkOnly);
593extern status_t		_kern_resize_partition(partition_id partitionID,
594						int32* changeCounter, partition_id childID,
595						int32* childChangeCounter, off_t size,
596						off_t contentSize);
597extern status_t		_kern_move_partition(partition_id partitionID,
598						int32* changeCounter, partition_id childID,
599						int32* childChangeCounter, off_t newOffset,
600						partition_id* descendantIDs,
601						int32* descendantChangeCounters, int32 descendantCount);
602extern status_t		_kern_set_partition_name(partition_id partitionID,
603						int32* changeCounter, partition_id childID,
604						int32* childChangeCounter, const char* name);
605extern status_t		_kern_set_partition_content_name(partition_id partitionID,
606						int32* changeCounter, const char* name);
607extern status_t		_kern_set_partition_type(partition_id partitionID,
608						int32* changeCounter, partition_id childID,
609						int32* childChangeCounter, const char* type);
610extern status_t		_kern_set_partition_parameters(partition_id partitionID,
611						int32* changeCounter, partition_id childID,
612						int32* childChangeCounter, const char* parameters);
613extern status_t		_kern_set_partition_content_parameters(
614						partition_id partitionID, int32* changeCounter,
615						const char* parameters);
616extern status_t		_kern_initialize_partition(partition_id partitionID,
617						int32* changeCounter, const char* diskSystemName,
618						const char* name, const char* parameters);
619extern status_t		_kern_uninitialize_partition(partition_id partitionID,
620						int32* changeCounter);
621extern status_t		_kern_create_child_partition(partition_id partitionID,
622						int32* changeCounter, off_t offset, off_t size,
623						const char* type, const char* name,
624						const char* parameters, partition_id* childID,
625						int32* childChangeCounter);
626extern status_t		_kern_delete_child_partition(partition_id partitionID,
627						int32* changeCounter, partition_id childID,
628						int32 childChangeCounter);
630// disk change notification
631extern status_t		_kern_start_watching_disks(uint32 eventMask, port_id port,
632						int32 token);
633extern status_t		_kern_stop_watching_disks(port_id port, int32 token);
636// The end mark for gensyscallinfos.
638#pragma syscalls end
641#undef __NO_RETURN
643#ifdef __cplusplus
647#endif	/* _SYSTEM_SYSCALLS_H */