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 ]

001 /* Copyright (C) 2005 David Decotigny
002    Copyright (C) 2003 Thomas Petazzoni
003 
004    This program is free software; you can redistribute it and/or
005    modify it under the terms of the GNU General Public License
006    as published by the Free Software Foundation; either version 2
007    of the License, or (at your option) any later version.
008    
009    This program is distributed in the hope that it will be useful,
010    but WITHOUT ANY WARRANTY; without even the implied warranty of
011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012    GNU General Public License for more details.
013    
014    You should have received a copy of the GNU General Public License
015    along with this program; if not, write to the Free Software
016    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
017    USA. 
018 */
019 #ifndef _SOS_USER_LIBC_H_
020 #define _SOS_USER_LIBC_H_
021 
022 #include <types.h>
023 
024 /**
025  * @file libc.h
026  *
027  * The basic user C library for user programs
028  */
029 
030 /**
031  * The most important function of a C program ! ;)
032  */
033 void exit (int status) __attribute__((noreturn, alias("_sos_exit")));
034 
035 
036 /**
037  * Function to duplicate the current running process
038  */
039 pid_t fork(void)  __attribute__ ((alias("_sos_fork")));
040 
041 
042 /**
043  * Function to re-initialize the address space of the current process
044  * with that of the program 'progname'
045  */
046 int exec(const char *progname) __attribute__ ((alias("_sos_exec")));
047 
048 
049 /**
050  * These flags (for mmap API) MUST be consistent with those defined in
051  * paging.h and umem_vmm.h
052  */
053 #define PROT_NONE  0
054 #define PROT_READ  (1<<0)
055 #define PROT_WRITE (1<<1)
056 #define PROT_EXEC  (1<<2) /* Not supported on IA32 */
057 
058 #define MAP_SHARED (1 << 0)
059 #define MAP_FIXED  (1 << 31)
060 
061 /**
062  * Non standard version of mmap. Differences with standard version:
063  *  - the resource to map is given by its "path", not by a file descriptor
064  *  - the offset is a signed 64bits, and MUST be >= 0 (error otherwise)
065  *  - no errno support
066  */
067 void * mmap(void *start, size_t length, int prot , int flags,
068             const char *path, loff_t offset);
069 
070 
071 /**
072  * Unmap the given user address interval
073  */
074 int munmap(void * start, size_t length) __attribute__ ((alias("_sos_munmap")));
075 
076 
077 /**
078  * Change the access permissions of the given user address interval
079  */
080 int mprotect(const void *addr, size_t len, int prot) __attribute__ ((alias("_sos_mprotect")));
081 
082 
083 
084 /**
085  * This flag tells mremap that the underlying VR may be moved, when necessary
086  */
087 #define MREMAP_MAYMOVE (1 << 30)
088 
089 /**
090  * Grow/shrink the end of the given mapping
091  */
092 void * mremap(void * old_addr, size_t old_len,
093               size_t new_len,
094               unsigned long flags);
095 
096 
097 /**
098  * Standard heap management API
099  */
100 
101 /** @note MT UNSAFE */
102 int brk(void *end_data_seg);
103 
104 /** @note MT UNSAFE */
105 void *sbrk(ptrdiff_t increment);
106 
107 /** @note MT UNSAFE */
108 void * calloc (size_t nmemb, size_t size);
109 
110 /** @note MT UNSAFE */
111 void * malloc (size_t size);
112 
113 
114 #endif /* _SOS_USER_LIBC_H_ */

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