Changeset 823a929 in mainline
- Timestamp:
- 2011-06-23T23:57:33Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e64b55a
- Parents:
- da084d9
- Location:
- uspace/lib/posix
- Files:
-
- 3 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/Makefile
rda084d9 r823a929 41 41 ctype.c \ 42 42 fcntl.c \ 43 math.c \ 43 44 stdio.c \ 44 45 stdlib.c \ … … 47 48 strings.c \ 48 49 sys/stat.c \ 50 sys/wait.c \ 49 51 time.c \ 50 52 unistd.c -
uspace/lib/posix/math.h
rda084d9 r823a929 36 36 #define POSIX_MATH_H_ 37 37 38 /* Empty. Just to satisfy preprocessor. */ 38 /* Normalization Functions */ 39 extern double posix_ldexp(double x, int exp); 40 extern double posix_frexp(double num, int *exp); 41 42 #ifndef LIBPOSIX_INTERNAL 43 #define ldexp posix_ldexp 44 #define frexp posix_frexp 45 #endif 39 46 40 47 #endif /* POSIX_MATH_H_ */ -
uspace/lib/posix/signal.h
rda084d9 r823a929 56 56 #define signal(sig,func) (errno = ENOTSUP, SIG_ERR) 57 57 #define raise(sig) ((int) -1) 58 #define kill(pid,sig) (errno = ENOTSUP, (int) -1) 58 59 59 60 typedef int posix_sig_atomic_t; -
uspace/lib/posix/stdio.c
rda084d9 r823a929 167 167 * @return 168 168 */ 169 int posix_vsprintf(char *s, const char *format, va_list ap) 170 { 171 // TODO: low priority, just a compile-time dependency of binutils 172 not_implemented(); 173 } 174 175 /** 176 * 177 * @param s 178 * @param format 179 * @param ... 180 * @return 181 */ 169 182 int posix_sscanf(const char *s, const char *format, ...) 170 183 { … … 173 186 } 174 187 188 /** 189 * 190 * @param path 191 * @return 192 */ 193 int posix_remove(const char *path) 194 { 195 // TODO: low priority, just a compile-time dependency of binutils 196 not_implemented(); 197 } 198 199 /** 200 * 201 * @param s 202 * @return 203 */ 204 char *posix_tmpnam(char *s) 205 { 206 // TODO: low priority, just a compile-time dependency of binutils 207 not_implemented(); 208 } 209 175 210 /** @} 176 211 */ -
uspace/lib/posix/stdio.h
rda084d9 r823a929 39 39 #include "libc/stdio.h" 40 40 #include "sys/types.h" 41 #include "libc/stdarg.h" 41 42 42 43 /* Character Input/Output */ … … 60 61 /* Formatted Input/Output */ 61 62 extern int posix_sprintf(char *restrict s, const char *restrict format, ...); 63 extern int posix_vsprintf(char *restrict s, const char *restrict format, va_list ap); 62 64 extern int posix_sscanf(const char *restrict s, const char *restrict format, ...); 65 66 /* Deleting Files */ 67 extern int posix_remove(const char *path); 68 69 /* Temporary Files */ 70 extern char *posix_tmpnam(char *s); 63 71 64 72 #ifndef LIBPOSIX_INTERNAL … … 73 81 74 82 #define sprintf posix_sprintf 83 #define vsprintf posix_vsprintf 75 84 #define sscanf posix_sscanf 85 86 #define remove posix_remove 87 88 #define tmpnam posix_tmpnam 76 89 #endif 77 90 -
uspace/lib/posix/stdlib.c
rda084d9 r823a929 40 40 41 41 /** 42 * 42 * 43 43 * @param array 44 44 * @param count … … 46 46 * @param compare 47 47 */ 48 int posix_atexit(void (*func)(void)) 49 { 50 // TODO: low priority, just a compile-time dependency of binutils 51 not_implemented(); 52 } 53 54 /** 55 * 56 * @param array 57 * @param count 58 * @param size 59 * @param compare 60 */ 61 int posix_abs(int i) 62 { 63 // TODO 64 not_implemented(); 65 } 66 67 /** 68 * 69 * @param array 70 * @param count 71 * @param size 72 * @param compare 73 */ 48 74 void posix_qsort(void *array, size_t count, size_t size, 49 75 int (*compare)(const void *, const void *)) … … 70 96 * @return 71 97 */ 98 int posix_putenv(char *string) 99 { 100 // TODO: low priority, just a compile-time dependency of binutils 101 not_implemented(); 102 } 103 104 /** 105 * 106 * @param name 107 * @param resolved 108 * @return 109 */ 72 110 char *posix_realpath(const char *name, char *resolved) 73 111 { … … 113 151 } 114 152 153 /** 154 * 155 * @param size 156 * @return 157 */ 158 void *posix_malloc(size_t size) 159 { 160 return malloc(size); 161 } 162 163 /** 164 * 165 * @param nelem 166 * @param elsize 167 * @return 168 */ 169 void *posix_calloc(size_t nelem, size_t elsize) 170 { 171 return calloc(nelem, elsize); 172 } 173 174 /** 175 * 176 * @param ptr 177 * @param size 178 * @return 179 */ 180 void *posix_realloc(void *ptr, size_t size) 181 { 182 return realloc(ptr, size); 183 } 184 185 /** 186 * 187 * @param ptr 188 */ 189 void posix_free(void *ptr) 190 { 191 free(ptr); 192 } 193 194 /** 195 * 196 * @param tmpl 197 * @return 198 */ 199 char *posix_mktemp(char *tmpl) 200 { 201 // TODO: low priority, just a compile-time dependency of binutils 202 not_implemented(); 203 } 204 115 205 /** @} 116 206 */ -
uspace/lib/posix/stdlib.h
rda084d9 r823a929 49 49 #define EXIT_SUCCESS 0 50 50 #define _Exit exit 51 extern int posix_atexit(void (*func)(void)); 52 53 /* Absolute Value */ 54 extern int posix_abs(int i); 51 55 52 56 /* Array Sort Function */ … … 56 60 /* Environment Access */ 57 61 extern char *posix_getenv(const char *name); 62 extern int posix_putenv(char *string); 58 63 59 64 /* Symbolic Links */ … … 68 73 extern int posix_atoi(const char *str); 69 74 75 /* Memory Allocation */ 76 extern void *posix_malloc(size_t size); 77 extern void *posix_calloc(size_t nelem, size_t elsize); 78 extern void *posix_realloc(void *ptr, size_t size); 79 extern void posix_free(void *ptr); 80 81 /* Legacy Declarations */ 82 extern char *posix_mktemp(char *tmpl); 83 70 84 #ifndef LIBPOSIX_INTERNAL 85 #define atexit posix_atexit 86 87 #define abs posix_abs 88 71 89 #define qsort posix_qsort 90 72 91 #define getenv posix_getenv 92 73 93 #define realpath posix_realpath 74 94 … … 78 98 79 99 #define atoi posix_atoi 100 101 #define malloc posix_malloc 102 #define calloc posix_calloc 103 #define realloc posix_realloc 104 #define free posix_free 105 106 #define mktemp posix_mktemp 80 107 #endif 81 108 -
uspace/lib/posix/time.c
rda084d9 r823a929 87 87 } 88 88 89 /** 90 * 91 * @return 92 */ 93 posix_clock_t posix_clock(void) 94 { 95 // TODO 96 not_implemented(); 97 } 98 89 99 /** @} 90 100 */ -
uspace/lib/posix/time.h
rda084d9 r823a929 55 55 }; 56 56 57 typedef long posix_clock_t; 58 57 59 /* Broken-down Time */ 58 60 extern struct posix_tm *posix_localtime(const time_t *timep); … … 63 65 extern size_t posix_strftime(char *restrict s, size_t maxsize, const char *restrict format, const struct posix_tm *restrict tm); 64 66 67 /* CPU Time */ 68 extern posix_clock_t posix_clock(void); 69 65 70 #ifndef LIBPOSIX_INTERNAL 66 71 #define tm posix_tm 72 73 #define clock_t posix_clock_t 67 74 68 75 #define localtime posix_localtime … … 71 78 #define ctime posix_ctime 72 79 #define strftime posix_strftime 80 81 #define clock posix_clock 73 82 #endif 74 83 -
uspace/lib/posix/unistd.c
rda084d9 r823a929 38 38 #include "internal/common.h" 39 39 #include "unistd.h" 40 #include <task.h> 40 41 41 42 /* Array of environment variable strings (NAME=VALUE). */ … … 61 62 { 62 63 return getpagesize(); 64 } 65 66 /** 67 * 68 * @return 69 */ 70 posix_pid_t posix_getpid(void) 71 { 72 return task_get_id(); 63 73 } 64 74 … … 106 116 } 107 117 118 /** 119 * 120 * @param path 121 * @param name 122 * @return 123 */ 124 long posix_pathconf(const char *path, int name) 125 { 126 // TODO: low priority, just a compile-time dependency of binutils 127 not_implemented(); 128 } 129 130 /** 131 * 132 * @return 133 */ 134 posix_pid_t posix_fork(void) 135 { 136 // TODO: low priority, just a compile-time dependency of binutils 137 not_implemented(); 138 } 139 140 /** 141 * 142 * @param path 143 * @param argv 144 * @return 145 */ 146 int posix_execv(const char *path, char *const argv[]) 147 { 148 // TODO: low priority, just a compile-time dependency of binutils 149 not_implemented(); 150 } 151 152 /** 153 * 154 * @param file 155 * @param argv 156 * @return 157 */ 158 int posix_execvp(const char *file, char *const argv[]) 159 { 160 // TODO: low priority, just a compile-time dependency of binutils 161 not_implemented(); 162 } 163 164 /** 165 * 166 * @param fildes 167 * @return 168 */ 169 int posix_pipe(int fildes[2]) 170 { 171 // TODO: low priority, just a compile-time dependency of binutils 172 not_implemented(); 173 } 174 108 175 /** @} 109 176 */ -
uspace/lib/posix/unistd.h
rda084d9 r823a929 58 58 59 59 /* Process Identification */ 60 #define getpid task_get_id 60 extern posix_pid_t posix_getpid(void); 61 61 extern posix_uid_t posix_getuid(void); 62 62 extern posix_gid_t posix_getgid(void); … … 112 112 _PC_VDISABLE 113 113 }; 114 extern long posix_pathconf(const char *path, int name); 115 116 /* Creating a Process */ 117 extern posix_pid_t posix_fork(void); 118 119 /* Executing a File */ 120 extern int posix_execv(const char *path, char *const argv[]); 121 extern int posix_execvp(const char *file, char *const argv[]); 122 123 /* Creating a Pipe */ 124 extern int posix_pipe(int fildes[2]); 114 125 115 126 #ifndef LIBPOSIX_INTERNAL … … 121 132 #define getpagesize posix_getpagesize 122 133 134 #define getpid posix_getpid 123 135 #define getuid posix_getuid 124 136 #define getgid posix_getgid … … 127 139 128 140 #define sysconf posix_sysconf 141 142 #define pathconf posix_pathconf 143 144 #define fork posix_fork 145 146 #define execv posix_execv 147 #define execvp posix_execvp 148 149 #define pipe posix_pipe 129 150 #endif 130 151
Note:
See TracChangeset
for help on using the changeset viewer.