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