SimpleOS

LXR

Navigation



Site hébergé par : enix

The LXR Cross Referencer for SOS

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Article:1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 6.5 ] [ 7 ] [ 7.5 ] [ 8 ] [ 9 ] [ 9.5 ]

Diff markup

Differences between /userland/crt.h (Article 9) and /userland/crt.h (Article 9.5)


001 /* Copyright (C) 2005 David Decotigny             001 /* Copyright (C) 2005 David Decotigny
002    Copyright (C) 2003 Thomas Petazzoni            002    Copyright (C) 2003 Thomas Petazzoni
003                                                   003 
004    This program is free software; you can redi    004    This program is free software; you can redistribute it and/or
005    modify it under the terms of the GNU Genera    005    modify it under the terms of the GNU General Public License
006    as published by the Free Software Foundatio    006    as published by the Free Software Foundation; either version 2
007    of the License, or (at your option) any lat    007    of the License, or (at your option) any later version.
008                                                   008    
009    This program is distributed in the hope tha    009    This program is distributed in the hope that it will be useful,
010    but WITHOUT ANY WARRANTY; without even the     010    but WITHOUT ANY WARRANTY; without even the implied warranty of
011    MERCHANTABILITY or FITNESS FOR A PARTICULAR    011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012    GNU General Public License for more details    012    GNU General Public License for more details.
013                                                   013    
014    You should have received a copy of the GNU     014    You should have received a copy of the GNU General Public License
015    along with this program; if not, write to t    015    along with this program; if not, write to the Free Software
016    Foundation, Inc., 59 Temple Place - Suite 3    016    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
017    USA.                                           017    USA. 
018 */                                                018 */
019 #ifndef _SOS_USER_CRT_H_                          019 #ifndef _SOS_USER_CRT_H_
020 #define _SOS_USER_CRT_H_                          020 #define _SOS_USER_CRT_H_
021                                                   021 
022                                                   022 
023 /**                                               023 /**
024  * @file crt.h                                    024  * @file crt.h
025  *                                                025  *
026  * C runtime environment for the user side of     026  * C runtime environment for the user side of the kernel/user
027  * interface                                      027  * interface
028  */                                               028  */
029                                                   029 
030 #include <types.h>                                030 #include <types.h>
031                                                   031 
032 /**                                               032 /**
033  * We include the syscall.h file from the kern    033  * We include the syscall.h file from the kernel to retrieve the list
034  * of available syscall ID                        034  * of available syscall ID
035  */                                               035  */
036 #include <sos/syscall.h>                          036 #include <sos/syscall.h>
037                                                   037 
038                                                   038 
039 /**                                               039 /**
040  * The syscall wrappers hiding the details of     040  * The syscall wrappers hiding the details of the implementation
041  */                                               041  */
042 int _sos_syscall0(int id);                        042 int _sos_syscall0(int id);
043                                                   043 
044 int _sos_syscall1(int id,                         044 int _sos_syscall1(int id,
045                   unsigned int arg1);             045                   unsigned int arg1);
046                                                   046 
047 int _sos_syscall2(int id,                         047 int _sos_syscall2(int id,
048                   unsigned int arg1,              048                   unsigned int arg1,
049                   unsigned int arg2);             049                   unsigned int arg2);
050                                                   050 
051 int _sos_syscall3(int id,                         051 int _sos_syscall3(int id,
052                   unsigned int arg1,              052                   unsigned int arg1,
053                   unsigned int arg2,              053                   unsigned int arg2,
054                   unsigned int arg3);             054                   unsigned int arg3);
055                                                   055 
056 int _sos_syscall4(int id,                         056 int _sos_syscall4(int id,
057                   unsigned int arg1,              057                   unsigned int arg1,
058                   unsigned int arg2,              058                   unsigned int arg2,
059                   unsigned int arg3,              059                   unsigned int arg3,
060                   unsigned int arg4);             060                   unsigned int arg4);
061                                                   061 
062 int _sos_syscall5(int id,                         062 int _sos_syscall5(int id,
063                   unsigned int arg1,              063                   unsigned int arg1,
064                   unsigned int arg2,              064                   unsigned int arg2,
065                   unsigned int arg3,              065                   unsigned int arg3,
066                   unsigned int arg4,              066                   unsigned int arg4,
067                   unsigned int arg5);             067                   unsigned int arg5);
068                                                   068 
069 int _sos_syscall6(int id,                         069 int _sos_syscall6(int id,
070                   unsigned int arg1,              070                   unsigned int arg1,
071                   unsigned int arg2,              071                   unsigned int arg2,
072                   unsigned int arg3,              072                   unsigned int arg3,
073                   unsigned int arg4,              073                   unsigned int arg4,
074                   unsigned int arg5,              074                   unsigned int arg5,
075                   unsigned int arg6);             075                   unsigned int arg6);
076                                                   076 
077 int _sos_syscall7(int id,                         077 int _sos_syscall7(int id,
078                   unsigned int arg1,              078                   unsigned int arg1,
079                   unsigned int arg2,              079                   unsigned int arg2,
080                   unsigned int arg3,              080                   unsigned int arg3,
081                   unsigned int arg4,              081                   unsigned int arg4,
082                   unsigned int arg5,              082                   unsigned int arg5,
083                   unsigned int arg6,              083                   unsigned int arg6,
084                   unsigned int arg7);             084                   unsigned int arg7);
085                                                   085 
086 int _sos_syscall8(int id,                         086 int _sos_syscall8(int id,
087                   unsigned int arg1,              087                   unsigned int arg1,
088                   unsigned int arg2,              088                   unsigned int arg2,
089                   unsigned int arg3,              089                   unsigned int arg3,
090                   unsigned int arg4,              090                   unsigned int arg4,
091                   unsigned int arg5,              091                   unsigned int arg5,
092                   unsigned int arg6,              092                   unsigned int arg6,
093                   unsigned int arg7,              093                   unsigned int arg7,
094                   unsigned int arg8);             094                   unsigned int arg8);
095                                                   095 
096                                                   096 
097 /**                                               097 /**
098  * The most important function of a C program     098  * The most important function of a C program ! ;)
099  */                                               099  */
100 void _sos_exit (int status) __attribute__((nor    100 void _sos_exit (int status) __attribute__((noreturn));
101                                                   101 
102                                                   102 
103 /**                                               103 /**
104  * Non standard function to print something on    104  * Non standard function to print something on bochs
105  */                                               105  */
106 int _sos_bochs_write(const char *str, unsigned    106 int _sos_bochs_write(const char *str, unsigned length);
107                                                   107 
108 /**                                               108 /**
109  * Syscall to duplicate the current running pr    109  * Syscall to duplicate the current running process
110  */                                               110  */
111 int _sos_fork(void);                              111 int _sos_fork(void);
112                                                   112 
113                                                   113 
114 /**                                               114 /**
115  * Syscall to re-initialize the address space     115  * Syscall to re-initialize the address space of the current process
116  * with that of the program 'progname'            116  * with that of the program 'progname'
117  */                                               117  */
118 int _sos_exec(const char * prog);                 118 int _sos_exec(const char * prog);
119                                                   119 
120                                                   120 
121 /**                                               121 /**
122  * Syscall to unmap the given user address int    122  * Syscall to unmap the given user address interval
123  */                                               123  */
124 int _sos_munmap(void * start, size_t length);     124 int _sos_munmap(void * start, size_t length);
125                                                   125 
126                                                   126 
127 /**                                               127 /**
128  * Syscall to change the access permissions of    128  * Syscall to change the access permissions of the given user address
129  * interval                                       129  * interval
130  */                                               130  */
131 int _sos_mprotect(const void *addr, size_t len    131 int _sos_mprotect(const void *addr, size_t len, int prot);
132                                                   132 
133                                                   133 
134 /**                                               134 /**
135  * Syscall to resize the given user mapped res    135  * Syscall to resize the given user mapped resource at the given
136  * old_addr address                               136  * old_addr address
137  */                                               137  */
138 int _sos_mresize(void * old_addr, size_t old_l    138 int _sos_mresize(void * old_addr, size_t old_len,
139                  void * *new_addr, size_t new_    139                  void * *new_addr, size_t new_len,
140                  unsigned long flags);            140                  unsigned long flags);
141                                                   141 
142                                                   142 
                                                   >> 143 /**
                                                   >> 144  * Syscall to synchronize caches with the contents of the mapped memory
                                                   >> 145  */
                                                   >> 146 int _sos_msync(void *start, size_t length, int flags);
                                                   >> 147 
                                                   >> 148 
                                                   >> 149 /**
                                                   >> 150  * Definition of a thread routine
                                                   >> 151  */
143 typedef void (sos_thread_func_t(unsigned long     152 typedef void (sos_thread_func_t(unsigned long int arg));
144                                                   153 
145 /**                                               154 /**
146  * Syscall to create a new thread inside the c    155  * Syscall to create a new thread inside the current process
147  */                                               156  */
148 int _sos_new_thread(sos_thread_func_t *func,      157 int _sos_new_thread(sos_thread_func_t *func,
149                     void * arg,                   158                     void * arg,
150                     size_t stack_size);           159                     size_t stack_size);
151                                                   160 
152                                                   161 
153 /**                                               162 /**
154  * Syscall to put the calling thread asleep       163  * Syscall to put the calling thread asleep
155  */                                               164  */
156 int _sos_nanosleep(unsigned long int sec,         165 int _sos_nanosleep(unsigned long int sec,
157                    unsigned long int nanosec);    166                    unsigned long int nanosec);
158                                                   167 
159                                                   168 
160 /**                                               169 /**
161  * Syscall to get/set heap top address            170  * Syscall to get/set heap top address
162  */                                               171  */
163 void * _sos_brk(void * new_top_address);          172 void * _sos_brk(void * new_top_address);
164                                                   173 
165                                                   174 
166 int _sos_mount(const char *source, const char     175 int _sos_mount(const char *source, const char *target,
167                const char *filesystemtype, uns    176                const char *filesystemtype, unsigned long mountflags,
168                const char *data);                 177                const char *data);
169 int _sos_umount(const char *target);              178 int _sos_umount(const char *target);
170                                                   179 
171 void _sos_sync(void);                             180 void _sos_sync(void);
172                                                   181 
173 struct statvfs; /**< Forward declaration */       182 struct statvfs; /**< Forward declaration */
174 int _sos_statvfs(const char *path, struct stat    183 int _sos_statvfs(const char *path, struct statvfs *buf);
175                                                   184 
176 int _sos_open(const char * pathname, int flags    185 int _sos_open(const char * pathname, int flags, int mode);
177 int _sos_close(int fd);                           186 int _sos_close(int fd);
178                                                   187 
179 int _sos_read(int fd, char * buf, size_t * len    188 int _sos_read(int fd, char * buf, size_t * len);
180 int _sos_write(int fd, const char * buf, size_    189 int _sos_write(int fd, const char * buf, size_t * len);
181 int _sos_seek64(int fd, loff_t * offset, int w    190 int _sos_seek64(int fd, loff_t * offset, int whence);
182 int _sos_ftruncate64(int fd, loff_t length);      191 int _sos_ftruncate64(int fd, loff_t length);
183 int _sos_fmmap(void ** ptr_hint_addr, size_t l    192 int _sos_fmmap(void ** ptr_hint_addr, size_t len, int prot, int flags,
184                int fd, loff_t offset);            193                int fd, loff_t offset);
185 int _sos_fcntl(int fd, int cmd, int arg);         194 int _sos_fcntl(int fd, int cmd, int arg);
186 int _sos_ioctl(int fd, int cmd, int arg);         195 int _sos_ioctl(int fd, int cmd, int arg);
187                                                   196 
188 struct dirent; /* Forward declaration */          197 struct dirent; /* Forward declaration */
189 int _sos_readdir(int fd, struct dirent * diren    198 int _sos_readdir(int fd, struct dirent * dirent);
190                                                   199 
191 int _sos_creat(const char *pathname, int mode)    200 int _sos_creat(const char *pathname, int mode);
192 int _sos_link (const char *oldpath, const char    201 int _sos_link (const char *oldpath, const char *newpath);
193 int _sos_unlink(const char *pathname);            202 int _sos_unlink(const char *pathname);
194 int _sos_rename (const char *oldpath, const ch    203 int _sos_rename (const char *oldpath, const char *newpath);
195 int _sos_symlink(const char *target, const cha    204 int _sos_symlink(const char *target, const char *path);
196 int _sos_mknod(const char *pathname, mode_t mo    205 int _sos_mknod(const char *pathname, mode_t mode,
197                int type,                          206                int type,
198                unsigned int major, unsigned mi    207                unsigned int major, unsigned minor);
199                                                   208 
200 int _sos_mkdir(const char *pathname, mode_t mo    209 int _sos_mkdir(const char *pathname, mode_t mode);
201 int _sos_rmdir(const char *pathname);             210 int _sos_rmdir(const char *pathname);
202                                                   211 
203 int _sos_chmod(const char *pathname, mode_t mo    212 int _sos_chmod(const char *pathname, mode_t mode);
204                                                   213 
205 struct stat; /**< forward declaration */          214 struct stat; /**< forward declaration */
206 int _sos_stat(const char *pathname, int nofoll    215 int _sos_stat(const char *pathname, int nofollow, struct stat * st);
207                                                   216 
208 int _sos_chroot(const char *dirname);             217 int _sos_chroot(const char *dirname);
209 int _sos_chdir(const char *dirname);              218 int _sos_chdir(const char *dirname);
210 int _sos_fchdir(int fd);                          219 int _sos_fchdir(int fd);
211                                                   220 
212 #endif /* _SOS_USER_CRT_H_ */                     221 #endif /* _SOS_USER_CRT_H_ */
                                                      

source navigation ] diff markup ] identifier search ] general search ]