1 /* 2 * Copyright 2004-2017, Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _KERNEL_SYSCALLS_H 6 #define _KERNEL_SYSCALLS_H 7 8 9 #include <OS.h> 10 #include <image.h> 11 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 17 18 /* Since libroot_build is also used on Haiku and linked against the real 19 * libroot which also has the syscall functions, these must be shadowed. */ 20 #define _kern_entry_ref_to_path _kernbuild_entry_ref_to_path 21 #define _kern_open_entry_ref _kernbuild_open_entry_ref 22 #define _kern_open _kernbuild_open 23 #define _kern_open_dir_entry_ref _kernbuild_open_dir_entry_ref 24 #define _kern_open_dir _kernbuild_open_dir 25 #define _kern_open_parent_dir _kernbuild_open_parent_dir 26 #define _kern_fsync _kernbuild_fsync 27 #define _kern_seek _kernbuild_seek 28 #define _kern_create_dir_entry_ref _kernbuild_create_dir_entry_ref 29 #define _kern_create_dir _kernbuild_create_dir 30 #define _kern_read_link _kernbuild_read_link 31 #define _kern_create_symlink _kernbuild_create_symlink 32 #define _kern_unlink _kernbuild_unlink 33 #define _kern_rename _kernbuild_rename 34 #define _kern_open_attr_dir _kernbuild_open_attr_dir 35 #define _kern_remove_attr _kernbuild_remove_attr 36 #define _kern_rename_attr _kernbuild_rename_attr 37 #define _kern_read _kernbuild_read 38 #define _kern_readv _kernbuild_readv 39 #define _kern_write _kernbuild_write 40 #define _kern_writev _kernbuild_writev 41 #define _kern_read_dir _kernbuild_read_dir 42 #define _kern_rewind_dir _kernbuild_rewind_dir 43 #define _kern_read_stat _kernbuild_read_stat 44 #define _kern_write_stat _kernbuild_write_stat 45 #define _kern_close _kernbuild_close 46 #define _kern_dup _kernbuild_dup 47 #define _kern_lock_node _kernbuild_lock_node 48 #define _kern_unlock_node _kernbuild_unlock_node 49 50 51 struct stat; 52 struct dirent; 53 54 extern status_t _kern_entry_ref_to_path(dev_t device, ino_t inode, 55 const char *leaf, char *userPath, size_t pathLength); 56 extern int _kern_open_entry_ref(dev_t device, ino_t inode, 57 const char *name, int openMode, int perms); 58 extern int _kern_open(int fd, const char *path, int openMode, 59 int perms); 60 extern int _kern_open_dir_entry_ref(dev_t device, ino_t inode, 61 const char *name); 62 extern int _kern_open_dir(int fd, const char *path); 63 extern int _kern_open_parent_dir(int fd, char *name, 64 size_t nameLength); 65 extern status_t _kern_fsync(int fd); 66 extern off_t _kern_seek(int fd, off_t pos, int seekType); 67 extern status_t _kern_create_dir_entry_ref(dev_t device, ino_t inode, 68 const char *name, int perms); 69 extern status_t _kern_create_dir(int fd, const char *path, int perms); 70 extern status_t _kern_read_link(int fd, const char *path, char *buffer, 71 size_t *_bufferSize); 72 extern status_t _kern_create_symlink(int fd, const char *path, 73 const char *toPath, int mode); 74 extern status_t _kern_unlink(int fd, const char *path); 75 extern status_t _kern_rename(int oldDir, const char *oldpath, int newDir, 76 const char *newpath); 77 extern int _kern_open_attr_dir(int fd, const char *path); 78 extern status_t _kern_remove_attr(int fd, const char *name); 79 extern status_t _kern_rename_attr(int fromFile, const char *fromName, 80 int toFile, const char *toName); 81 82 // file descriptor functions 83 extern ssize_t _kern_read(int fd, off_t pos, void *buffer, 84 size_t bufferSize); 85 extern ssize_t _kern_readv(int fd, off_t pos, const struct iovec *vecs, 86 size_t count); 87 extern ssize_t _kern_write(int fd, off_t pos, const void *buffer, 88 size_t bufferSize); 89 extern ssize_t _kern_writev(int fd, off_t pos, const struct iovec *vecs, 90 size_t count); 91 extern ssize_t _kern_read_dir(int fd, struct dirent *buffer, 92 size_t bufferSize, uint32 maxCount); 93 extern status_t _kern_rewind_dir(int fd); 94 extern status_t _kern_read_stat(int fd, const char *path, 95 bool traverseLink, struct stat *stat, size_t statSize); 96 extern status_t _kern_write_stat(int fd, const char *path, 97 bool traverseLink, const struct stat *stat, 98 size_t statSize, int statMask); 99 extern status_t _kern_close(int fd); 100 extern int _kern_dup(int fd); 101 extern status_t _kern_lock_node(int fd); 102 extern status_t _kern_unlock_node(int fd); 103 104 #ifdef __cplusplus 105 } 106 #endif 107 108 #endif /* _KERNEL_SYSCALLS_H */ 109