00001 00010 #ifndef _TXC_LIBC_SYSCALLS_H 00011 #define _TXC_LIBC_SYSCALLS_H 00012 00013 #include <sys/types.h> 00014 #include <sys/stat.h> 00015 #include <fcntl.h> 00016 #include <unistd.h> 00017 #include <stdio.h> 00018 00019 00020 00021 static inline 00022 int 00023 txc_libc_creat(const char *pathname, mode_t mode) 00024 { 00025 return creat(pathname, mode); 00026 } 00027 00028 00029 static inline 00030 int 00031 txc_libc_open(const char *pathname, int flags, mode_t mode) 00032 { 00033 return open(pathname, flags, mode); 00034 } 00035 00036 00037 static inline 00038 int 00039 txc_libc_close(int fd) 00040 { 00041 return close(fd); 00042 } 00043 00044 00045 static inline 00046 int 00047 txc_libc_rename(const char *oldpath, const char *newpath) 00048 { 00049 return rename(oldpath, newpath); 00050 } 00051 00052 00053 static inline 00054 int 00055 txc_libc_stat(const char *path, struct stat *buf) 00056 { 00057 return stat(path, buf); 00058 } 00059 00060 00061 static inline 00062 int 00063 txc_libc_unlink(const char *path) 00064 { 00065 return unlink(path); 00066 } 00067 00068 00069 static inline 00070 ssize_t 00071 txc_libc_write(int fd, const void *buf, size_t nbyte) 00072 { 00073 return write(fd, buf, nbyte); 00074 } 00075 00076 00077 static inline 00078 ssize_t 00079 txc_libc_read(int fd, void *buf, size_t nbyte) 00080 { 00081 return read(fd, buf, nbyte); 00082 } 00083 00084 00085 static inline 00086 off_t 00087 txc_libc_lseek(int fildes, off_t offset, int whence) 00088 { 00089 return lseek(fildes, offset, whence); 00090 } 00091 00092 00093 static inline 00094 size_t 00095 txc_libc_pread(int fd, void *buf, size_t count, off_t offset) 00096 { 00097 return pread(fd, buf, count, offset); 00098 } 00099 00100 00101 static inline 00102 ssize_t 00103 txc_libc_pwrite(int fd, const void *buf, size_t count, off_t offset) 00104 { 00105 return pwrite(fd, buf, count, offset); 00106 } 00107 00108 00109 static inline 00110 int 00111 txc_libc_ftruncate(int fd, off_t length) 00112 { 00113 return ftruncate(fd, length); 00114 } 00115 00116 00117 static inline 00118 int 00119 txc_libc_link(const char *oldpath, const char *newpath) 00120 { 00121 return link(oldpath, newpath); 00122 } 00123 00124 00125 static inline 00126 int 00127 txc_libc_dup(int oldfd) 00128 { 00129 return dup(oldfd); 00130 } 00131 00132 00133 static inline 00134 int 00135 txc_libc_pipe(int filedes[2]) 00136 { 00137 return pipe(filedes); 00138 } 00139 00140 00141 static inline 00142 int 00143 txc_libc_socket(int domain, int type, int protocol) 00144 { 00145 return socket(domain, type, protocol); 00146 } 00147 00148 00149 static inline 00150 ssize_t 00151 txc_libc_recv(int s, void *buf, size_t len, int flags) 00152 { 00153 return recv(s, buf, len, flags); 00154 } 00155 00156 00157 static inline 00158 ssize_t 00159 txc_libc_recvfrom(int s, void *buf, size_t len, int flags, 00160 struct sockaddr *from, socklen_t *fromlen) 00161 { 00162 return recvfrom(s, buf, len, flags, from, fromlen); 00163 } 00164 00165 00166 static inline 00167 ssize_t 00168 txc_libc_recvmsg(int s, struct msghdr *msg, int flags) 00169 { 00170 return recvmsg(s, msg, flags); 00171 } 00172 00173 00174 static inline 00175 ssize_t 00176 txc_libc_send(int s, const void *buf, size_t len, int flags) 00177 { 00178 return send(s, buf, len, flags); 00179 } 00180 00181 00182 static inline 00183 ssize_t 00184 txc_libc_sendto(int s, const void *buf, size_t len, int flags, 00185 const struct sockaddr *to, socklen_t tolen) 00186 { 00187 return sendto(s, buf, len, flags, to, tolen); 00188 } 00189 00190 00191 static inline 00192 ssize_t 00193 txc_libc_sendmsg(int s, const struct msghdr *msg, int flags) 00194 { 00195 return sendmsg(s, msg, flags); 00196 } 00197 00198 static inline 00199 int 00200 txc_libc_fsync(int fd) 00201 { 00202 return fsync(fd); 00203 } 00204 00205 #endif