Changeset 4c53333 in mainline for uspace/lib/posix/include
- Timestamp:
- 2013-07-11T08:21:10Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 64e63ce1
- Parents:
- 80445cf (diff), c8bb1633 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/lib/posix/include/posix
- Files:
-
- 10 added
- 21 moved
-
assert.h (moved) (moved from uspace/lib/posix/assert.h )
-
ctype.h (moved) (moved from uspace/lib/posix/ctype.h ) (2 diffs)
-
dirent.h (added)
-
errno.h (moved) (moved from uspace/lib/posix/errno.h )
-
fcntl.h (moved) (moved from uspace/lib/posix/fcntl.h ) (3 diffs)
-
fenv.h (added)
-
float.h (added)
-
fnmatch.h (moved) (moved from uspace/lib/posix/fnmatch.h ) (2 diffs)
-
getopt.h (moved) (moved from uspace/lib/posix/math.c ) (2 diffs)
-
inttypes.h (moved) (moved from uspace/lib/posix/inttypes.h ) (1 diff)
-
iso646.h (moved) (moved from uspace/lib/posix/iso646.h )
-
limits.h (moved) (moved from uspace/lib/posix/limits.h ) (1 diff)
-
locale.h (moved) (moved from uspace/lib/posix/locale.h ) (4 diffs)
-
malloc.h (moved) (moved from uspace/lib/posix/float.h ) (2 diffs)
-
math.h (added)
-
pwd.h (moved) (moved from uspace/lib/posix/pwd.h ) (1 diff)
-
signal.h (moved) (moved from uspace/lib/posix/signal.h ) (5 diffs)
-
stdarg.h (added)
-
stddef.h (moved) (moved from uspace/lib/posix/stddef.h ) (2 diffs)
-
stdint.h (moved) (moved from uspace/lib/posix/stdint.h ) (2 diffs)
-
stdio.h (added)
-
stdlib.h (added)
-
string.h (added)
-
strings.h (moved) (moved from uspace/lib/posix/strings.h ) (2 diffs)
-
sys/mman.h (moved) (moved from uspace/lib/posix/sys/mman.h ) (2 diffs)
-
sys/stat.h (moved) (moved from uspace/lib/posix/sys/stat.h ) (3 diffs)
-
sys/types.h (moved) (moved from uspace/lib/posix/sys/types.h ) (1 diff)
-
sys/wait.h (moved) (moved from uspace/lib/posix/sys/wait.h ) (2 diffs)
-
time.h (added)
-
ucontext.h (added)
-
unistd.h (moved) (moved from uspace/lib/posix/unistd.h ) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/include/posix/ctype.h
r80445cf r4c53333 37 37 #define POSIX_CTYPE_H_ 38 38 39 #ifndef __POSIX_DEF__ 40 #define __POSIX_DEF__(x) x 41 #endif 42 39 43 #include "libc/ctype.h" 40 44 41 45 /* Classification of Characters */ 42 extern int posix_isxdigit(int c);43 extern int posix_isblank(int c);44 extern int posix_iscntrl(int c);45 extern int posix_isgraph(int c);46 extern int posix_isprint(int c);47 extern int posix_ispunct(int c);46 extern int __POSIX_DEF__(isxdigit)(int c); 47 extern int __POSIX_DEF__(isblank)(int c); 48 extern int __POSIX_DEF__(iscntrl)(int c); 49 extern int __POSIX_DEF__(isgraph)(int c); 50 extern int __POSIX_DEF__(isprint)(int c); 51 extern int __POSIX_DEF__(ispunct)(int c); 48 52 49 53 /* Obsolete Functions and Macros */ 50 extern int posix_isascii(int c);51 extern int posix_toascii(int c);54 extern int __POSIX_DEF__(isascii)(int c); 55 extern int __POSIX_DEF__(toascii)(int c); 52 56 #undef _tolower 53 57 #define _tolower(c) ((c) - 'A' + 'a') … … 56 60 57 61 58 #ifndef LIBPOSIX_INTERNAL59 #define isxdigit posix_isxdigit60 #define isblank posix_isblank61 #define iscntrl posix_iscntrl62 #define isgraph posix_isgraph63 #define isprint posix_isprint64 #define ispunct posix_ispunct65 66 #define isascii posix_isascii67 #define toascii posix_toascii68 #endif69 62 70 63 #endif /* POSIX_CTYPE_H_ */ -
uspace/lib/posix/include/posix/fcntl.h
r80445cf r4c53333 36 36 #define POSIX_FCNTL_H_ 37 37 38 #ifndef __POSIX_DEF__ 39 #define __POSIX_DEF__(x) x 40 #endif 41 38 42 #include "sys/types.h" 39 43 #include "libc/fcntl.h" … … 43 47 #undef O_ACCMODE 44 48 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) 49 50 /* Dummy compatibility flag */ 51 #undef O_NOCTTY 52 #define O_NOCTTY 0 45 53 46 54 /* fcntl commands */ … … 72 80 #define FD_CLOEXEC 1 /* Close on exec. */ 73 81 74 #undef open 75 #define open(path, ...) \ 76 ({ \ 77 int rc = open(path, ##__VA_ARGS__); \ 78 if (rc < 0) { \ 79 errno = -rc; \ 80 rc = -1; \ 81 } \ 82 rc; \ 83 }) 82 extern int __POSIX_DEF__(open)(const char *pathname, int flags, ...); 83 extern int __POSIX_DEF__(fcntl)(int fd, int cmd, ...); 84 84 85 extern int posix_fcntl(int fd, int cmd, ...);86 87 #ifndef LIBPOSIX_INTERNAL88 #define fcntl posix_fcntl89 #endif90 85 91 86 #endif /* POSIX_FCNTL_H_ */ -
uspace/lib/posix/include/posix/fnmatch.h
r80445cf r4c53333 36 36 #define POSIX_FNMATCH_H_ 37 37 38 #ifndef __POSIX_DEF__ 39 #define __POSIX_DEF__(x) x 40 #endif 41 38 42 /* Error Values */ 39 43 #undef FNM_NOMATCH … … 56 60 #define FNM_CASEFOLD 16 57 61 58 extern int posix_fnmatch(const char *pattern, const char *string, int flags);62 extern int __POSIX_DEF__(fnmatch)(const char *pattern, const char *string, int flags); 59 63 60 #ifndef LIBPOSIX_INTERNAL61 #define fnmatch posix_fnmatch62 #endif63 64 64 65 #endif /* POSIX_FNMATCH_H_ */ -
uspace/lib/posix/include/posix/getopt.h
r80445cf r4c53333 1 1 /* 2 * Copyright (c) 201 1 Petr Koupy2 * Copyright (c) 2012 Vojtech Horky 3 3 * All rights reserved. 4 4 * … … 30 30 * @{ 31 31 */ 32 /** @file Mathematical operations.32 /** @file Command line argument parsing. 33 33 */ 34 #ifndef POSIX_GETOPT_H 35 #define POSIX_GETOPT_H 34 36 35 #define LIBPOSIX_INTERNAL 37 #ifndef __POSIX_DEF__ 38 #define __POSIX_DEF__(x) x 39 #endif 36 40 37 #include "internal/common.h" 38 #include "math.h" 41 #include "unistd.h" 39 42 43 /* Option Arguments */ 44 #define no_argument 0 45 #define required_argument 1 46 #define optional_argument 2 47 48 #ifndef LIBPOSIX_INTERNAL 49 struct option { 50 const char *name; 51 int has_arg; 52 int *flag; 53 int val; 54 }; 55 #endif 56 57 extern int __POSIX_DEF__(getopt_long)(int, char * const [], const char *, const struct option *, int *); 58 59 60 #endif 40 61 /** 41 * 42 * @param x 43 * @param exp 44 * @return 62 * @} 45 63 */ 46 double posix_ldexp(double x, int exp)47 {48 // TODO: low priority, just a compile-time dependency of binutils49 not_implemented();50 }51 52 /**53 *54 * @param num55 * @param exp56 * @return57 */58 double posix_frexp(double num, int *exp)59 {60 // TODO: low priority, just a compile-time dependency of binutils61 not_implemented();62 }63 64 /** @}65 */ -
uspace/lib/posix/include/posix/inttypes.h
r80445cf r4c53333 36 36 #define POSIX_INTTYPES_H_ 37 37 38 #ifndef __POSIX_DEF__ 39 #define __POSIX_DEF__(x) x 40 #endif 41 38 42 #include "stdint.h" 39 43 #include "libc/inttypes.h" 40 44 41 extern posix_intmax_t posix_strtoimax(const char *restrict nptr,45 extern __POSIX_DEF__(intmax_t) __POSIX_DEF__(strtoimax)(const char *restrict nptr, 42 46 char **restrict endptr, int base); 43 extern posix_uintmax_t posix_strtoumax(const char *restrict nptr,47 extern __POSIX_DEF__(uintmax_t) __POSIX_DEF__(strtoumax)(const char *restrict nptr, 44 48 char **restrict endptr, int base); 45 49 46 #ifndef LIBPOSIX_INTERNAL47 #define strtoimax posix_strtoimax48 #define strtoumax posix_strtoumax49 #endif50 50 51 51 #endif /* POSIX_INTTYPES_H_ */ -
uspace/lib/posix/include/posix/limits.h
r80445cf r4c53333 49 49 #define PATH_MAX 256 50 50 51 /* it's probably a safe assumption */ 52 #undef CHAR_BIT 53 #define CHAR_BIT 8 54 51 55 #endif /* POSIX_LIMITS_H_ */ 52 56 -
uspace/lib/posix/include/posix/locale.h
r80445cf r4c53333 36 36 #define POSIX_LOCALE_H_ 37 37 38 #ifndef __POSIX_DEF__ 39 #define __POSIX_DEF__(x) x 40 #endif 41 38 42 #ifndef NULL 39 43 #define NULL ((void *) 0) … … 42 46 #ifndef __locale_t_defined 43 47 #define __locale_t_defined 44 typedef struct __posix_locale * posix_locale_t;48 typedef struct __posix_locale *__POSIX_DEF__(locale_t); 45 49 #ifndef LIBPOSIX_INTERNAL 46 #define locale_t posix_locale_t50 #define locale_t __POSIX_DEF__(locale_t) 47 51 #endif 48 52 #endif … … 82 86 #define LC_GLOBAL_LOCALE NULL 83 87 84 struct posix_lconv{88 struct __POSIX_DEF__(lconv) { 85 89 char *currency_symbol; 86 90 char *decimal_point; … … 109 113 }; 110 114 111 extern char * posix_setlocale(int category, const char *locale);112 extern struct posix_lconv *posix_localeconv(void);115 extern char *__POSIX_DEF__(setlocale)(int category, const char *locale); 116 extern struct __POSIX_DEF__(lconv) *__POSIX_DEF__(localeconv)(void); 113 117 114 118 /* POSIX Extensions */ 115 extern posix_locale_t posix_duplocale(posix_locale_tlocobj);116 extern void posix_freelocale(posix_locale_tlocobj);117 extern posix_locale_t posix_newlocale(int category_mask, const char *locale,118 posix_locale_tbase);119 extern posix_locale_t posix_uselocale(posix_locale_tnewloc);119 extern __POSIX_DEF__(locale_t) __POSIX_DEF__(duplocale)(__POSIX_DEF__(locale_t) locobj); 120 extern void __POSIX_DEF__(freelocale)(__POSIX_DEF__(locale_t) locobj); 121 extern __POSIX_DEF__(locale_t) __POSIX_DEF__(newlocale)(int category_mask, const char *locale, 122 __POSIX_DEF__(locale_t) base); 123 extern __POSIX_DEF__(locale_t) __POSIX_DEF__(uselocale)(__POSIX_DEF__(locale_t) newloc); 120 124 121 #ifndef LIBPOSIX_INTERNAL122 #define lconv posix_lconv123 124 #define setlocale posix_setlocale125 #define localeconv posix_localeconv126 127 #define newlocale posix_newlocale128 #define uselocale posix_uselocale129 #define duplocale posix_duplocale130 #define freelocale posix_freelocale131 #endif132 125 133 126 #endif /* POSIX_LOCALE_H_ */ -
uspace/lib/posix/include/posix/malloc.h
r80445cf r4c53333 1 1 /* 2 * Copyright (c) 201 1 Petr Koupy2 * Copyright (c) 2012 Vojtech Horky 3 3 * All rights reserved. 4 4 * … … 30 30 * @{ 31 31 */ 32 /** @file Floating type support. 33 */ 34 35 #ifndef POSIX_FLOAT_H_ 36 #define POSIX_FLOAT_H_ 32 #ifndef POSIX_MALLOC_H_ 33 #define POSIX_MALLOC_H_ 37 34 38 35 /* Empty. Just to satisfy preprocessor. */ 39 36 40 #endif /* POSIX_ FLOAT_H_ */37 #endif /* POSIX_MALLOC_H_ */ 41 38 42 39 /** @} -
uspace/lib/posix/include/posix/pwd.h
r80445cf r4c53333 36 36 #define POSIX_PWD_H_ 37 37 38 #ifndef __POSIX_DEF__ 39 #define __POSIX_DEF__(x) x 40 #endif 41 38 42 #include "sys/types.h" 39 43 40 struct posix_passwd{44 struct __POSIX_DEF__(passwd) { 41 45 char *pw_name; 42 posix_uid_tpw_uid;43 posix_gid_tpw_gid;46 __POSIX_DEF__(uid_t) pw_uid; 47 __POSIX_DEF__(gid_t) pw_gid; 44 48 char *pw_dir; 45 49 char *pw_shell; 46 50 }; 47 51 48 extern struct posix_passwd *posix_getpwent(void);49 extern void posix_setpwent(void);50 extern void posix_endpwent(void);52 extern struct __POSIX_DEF__(passwd) *__POSIX_DEF__(getpwent)(void); 53 extern void __POSIX_DEF__(setpwent)(void); 54 extern void __POSIX_DEF__(endpwent)(void); 51 55 52 extern struct posix_passwd *posix_getpwnam(const char *name);53 extern int posix_getpwnam_r(const char *name, struct posix_passwd*pwd,54 char *buffer, size_t bufsize, struct posix_passwd**result);56 extern struct __POSIX_DEF__(passwd) *__POSIX_DEF__(getpwnam)(const char *name); 57 extern int __POSIX_DEF__(getpwnam_r)(const char *name, struct __POSIX_DEF__(passwd) *pwd, 58 char *buffer, size_t bufsize, struct __POSIX_DEF__(passwd) **result); 55 59 56 extern struct posix_passwd *posix_getpwuid(posix_uid_tuid);57 extern int posix_getpwuid_r(posix_uid_t uid, struct posix_passwd*pwd,58 char *buffer, size_t bufsize, struct posix_passwd**result);60 extern struct __POSIX_DEF__(passwd) *__POSIX_DEF__(getpwuid)(__POSIX_DEF__(uid_t) uid); 61 extern int __POSIX_DEF__(getpwuid_r)(__POSIX_DEF__(uid_t) uid, struct __POSIX_DEF__(passwd) *pwd, 62 char *buffer, size_t bufsize, struct __POSIX_DEF__(passwd) **result); 59 63 60 #ifndef LIBPOSIX_INTERNAL61 #define passwd posix_passwd62 63 #define getpwent posix_getpwent64 #define setpwent posix_setpwent65 #define endpwent posix_endpwent66 67 #define getpwnam posix_getpwnam68 #define getpwnam_r posix_getpwnam_r69 70 #define getpwuid posix_getpwuid71 #define getpwuid_r posix_getpwuid_r72 #endif73 64 74 65 #endif /* POSIX_PWD_H_ */ -
uspace/lib/posix/include/posix/signal.h
r80445cf r4c53333 36 36 #define POSIX_SIGNAL_H_ 37 37 38 #include "libc/errno.h" 38 #ifndef __POSIX_DEF__ 39 #define __POSIX_DEF__(x) x 40 #endif 41 39 42 #include "sys/types.h" 43 #include <posix/ucontext.h> 40 44 41 45 extern void __posix_default_signal_handler(int signo); … … 52 56 #define SIG_IGN ((void (*)(int)) __posix_ignore_signal_handler) 53 57 54 typedef int posix_sig_atomic_t;55 typedef uint32_t posix_sigset_t;56 typedef struct posix_mcontext {57 /* must not be empty to avoid compiler warnings (-pedantic) */58 int dummy;59 } posix_mcontext_t;60 61 union posix_sigval {62 int sival_int;63 void *sival_ptr;64 };65 66 struct posix_sigevent {67 int sigev_notify; /* Notification type. */68 int sigev_signo; /* Signal number. */69 union posix_sigval sigev_value; /* Signal value. */70 void (*sigev_notify_function)(union posix_sigval); /* Notification function. */71 posix_thread_attr_t *sigev_notify_attributes; /* Notification attributes. */72 };73 58 74 59 typedef struct { … … 78 63 int si_errno; 79 64 80 posix_pid_tsi_pid;81 posix_uid_tsi_uid;65 __POSIX_DEF__(pid_t) si_pid; 66 __POSIX_DEF__(uid_t) si_uid; 82 67 void *si_addr; 83 68 int si_status; … … 85 70 long si_band; 86 71 87 union posix_sigvalsi_value;88 } posix_siginfo_t;89 90 struct posix_sigaction{72 union __POSIX_DEF__(sigval) si_value; 73 } __POSIX_DEF__(siginfo_t); 74 75 struct __POSIX_DEF__(sigaction) { 91 76 void (*sa_handler)(int); 92 posix_sigset_tsa_mask;77 __POSIX_DEF__(sigset_t) sa_mask; 93 78 int sa_flags; 94 void (*sa_sigaction)(int, posix_siginfo_t*, void *);79 void (*sa_sigaction)(int, __POSIX_DEF__(siginfo_t) *, void *); 95 80 }; 96 81 97 typedef struct { 98 void *ss_sp; 99 size_t ss_size; 100 int ss_flags; 101 } posix_stack_t; 102 103 typedef struct posix_ucontext { 104 struct posix_ucontext *uc_link; 105 posix_sigset_t uc_sigmask; 106 posix_stack_t uc_stack; 107 posix_mcontext_t uc_mcontext; 108 } posix_ucontext_t; 109 110 /* Values of posix_sigevent::sigev_notify */ 82 83 /* Values of __POSIX_DEF__(sigevent)::sigev_notify */ 111 84 #undef SIGEV_NONE 112 85 #undef SIGEV_SIGNAL … … 256 229 }; 257 230 258 extern int posix_sigaction(int sig, const struct posix_sigaction *restrict act, 259 struct posix_sigaction *restrict oact); 260 261 extern void (*posix_signal(int sig, void (*func)(int)))(int); 262 extern int posix_raise(int sig); 263 extern int posix_kill(posix_pid_t pid, int sig); 264 extern int posix_killpg(posix_pid_t pid, int sig); 265 266 extern void posix_psiginfo(const posix_siginfo_t *pinfo, const char *message); 267 extern void posix_psignal(int signum, const char *message); 268 269 extern int posix_sigemptyset(posix_sigset_t *set); 270 extern int posix_sigfillset(posix_sigset_t *set); 271 extern int posix_sigaddset(posix_sigset_t *set, int signo); 272 extern int posix_sigdelset(posix_sigset_t *set, int signo); 273 extern int posix_sigismember(const posix_sigset_t *set, int signo); 274 275 extern int posix_thread_sigmask(int how, const posix_sigset_t *restrict set, 276 posix_sigset_t *restrict oset); 277 extern int posix_sigprocmask(int how, const posix_sigset_t *restrict set, 278 posix_sigset_t *restrict oset); 279 280 #ifndef LIBPOSIX_INTERNAL 281 #define sig_atomic_t posix_sig_atomic_t 282 #define sigset_t posix_sigset_t 283 #define sigval posix_sigval 284 #ifndef sigevent 285 #define sigevent posix_sigevent 286 #endif 287 #define mcontext_t posix_mcontext_t 288 #define ucontext_t posix_ucontext_t 289 #define stack_t posix_stack_t 290 #define siginfo_t posix_siginfo_t 291 292 #define sigaction posix_sigaction 293 294 #define signal posix_signal 295 #define raise posix_raise 296 #define kill posix_kill 297 #define killpg posix_killpg 298 299 #define psiginfo posix_psiginfo 300 #define psignal posix_psignal 301 302 #define sigemptyset posix_sigemptyset 303 #define sigfillset posix_sigfillset 304 #define sigaddset posix_sigaddset 305 #define sigdelset posix_sigdelset 306 #define sigismember posix_sigismember 307 308 #define pthread_sigmask posix_thread_sigmask 309 #define sigprocmask posix_sigprocmask 310 #endif 231 extern int __POSIX_DEF__(sigaction)(int sig, const struct __POSIX_DEF__(sigaction) *restrict act, 232 struct __POSIX_DEF__(sigaction) *restrict oact); 233 234 extern void (*__POSIX_DEF__(signal)(int sig, void (*func)(int)))(int); 235 extern int __POSIX_DEF__(raise)(int sig); 236 extern int __POSIX_DEF__(kill)(__POSIX_DEF__(pid_t) pid, int sig); 237 extern int __POSIX_DEF__(killpg)(__POSIX_DEF__(pid_t) pid, int sig); 238 239 extern void __POSIX_DEF__(psiginfo)(const __POSIX_DEF__(siginfo_t) *pinfo, const char *message); 240 extern void __POSIX_DEF__(psignal)(int signum, const char *message); 241 242 extern int __POSIX_DEF__(sigemptyset)(__POSIX_DEF__(sigset_t) *set); 243 extern int __POSIX_DEF__(sigfillset)(__POSIX_DEF__(sigset_t) *set); 244 extern int __POSIX_DEF__(sigaddset)(__POSIX_DEF__(sigset_t) *set, int signo); 245 extern int __POSIX_DEF__(sigdelset)(__POSIX_DEF__(sigset_t) *set, int signo); 246 extern int __POSIX_DEF__(sigismember)(const __POSIX_DEF__(sigset_t) *set, int signo); 247 248 extern int __POSIX_DEF__(thread_sigmask)(int how, const __POSIX_DEF__(sigset_t) *restrict set, 249 __POSIX_DEF__(sigset_t) *restrict oset); 250 extern int __POSIX_DEF__(sigprocmask)(int how, const __POSIX_DEF__(sigset_t) *restrict set, 251 __POSIX_DEF__(sigset_t) *restrict oset); 252 311 253 312 254 #endif /* POSIX_SIGNAL_H_ */ -
uspace/lib/posix/include/posix/stddef.h
r80445cf r4c53333 36 36 #define POSIX_STDDEF_H_ 37 37 38 #include "libc/stddef.h" 38 #ifndef __POSIX_DEF__ 39 #define __POSIX_DEF__(x) x 40 #endif 41 42 #include "sys/types.h" 39 43 40 44 #ifndef NULL … … 44 48 #define offsetof(type,member) ((size_t) &(((type *) 0)->member)) 45 49 46 typedef ssize_t posix_ptrdiff_t;50 typedef ssize_t __POSIX_DEF__(ptrdiff_t); 47 51 48 #ifndef LIBPOSIX_INTERNAL49 #define ptrdiff_t posix_ptrdiff_t50 #endif51 52 52 53 #endif /* POSIX_STDDEF_H_ */ -
uspace/lib/posix/include/posix/stdint.h
r80445cf r4c53333 35 35 #ifndef POSIX_STDINT_H_ 36 36 #define POSIX_STDINT_H_ 37 38 #ifndef __POSIX_DEF__ 39 #define __POSIX_DEF__(x) x 40 #endif 37 41 38 42 #include "libc/stdint.h" … … 100 104 #include "libc/sys/types.h" 101 105 102 typedef int64_t posix_intmax_t;103 typedef uint64_t posix_uintmax_t;106 typedef int64_t __POSIX_DEF__(intmax_t); 107 typedef uint64_t __POSIX_DEF__(uintmax_t); 104 108 105 #ifndef LIBPOSIX_INTERNAL106 #define intmax_t posix_intmax_t107 #define uintmax_t posix_uintmax_t108 #endif109 109 110 110 #endif /* POSIX_STDINT_H_ */ -
uspace/lib/posix/include/posix/strings.h
r80445cf r4c53333 37 37 #define POSIX_STRINGS_H_ 38 38 39 #ifndef __POSIX_DEF__ 40 #define __POSIX_DEF__(x) x 41 #endif 42 43 44 #include <libarch/types.h> 45 39 46 /* Search Functions */ 40 47 #ifndef POSIX_STRING_H_ 41 extern int posix_ffs(int i);48 extern int __POSIX_DEF__(ffs)(int i); 42 49 #endif 43 50 44 51 /* String/Array Comparison */ 45 52 #ifndef POSIX_STRING_H_ 46 extern int posix_strcasecmp(const char *s1, const char *s2);47 extern int posix_strncasecmp(const char *s1, const char *s2, size_t n);53 extern int __POSIX_DEF__(strcasecmp)(const char *s1, const char *s2); 54 extern int __POSIX_DEF__(strncasecmp)(const char *s1, const char *s2, size_t n); 48 55 #endif 49 56 … … 55 62 56 63 /* Legacy Functions */ 57 extern int posix_bcmp(const void *mem1, const void *mem2, size_t n);58 extern void posix_bcopy(const void *src, void *dest, size_t n);59 extern void posix_bzero(void *mem, size_t n);60 extern char * posix_index(const char *s, int c);61 extern char * posix_rindex(const char *s, int c);64 extern int __POSIX_DEF__(bcmp)(const void *mem1, const void *mem2, size_t n); 65 extern void __POSIX_DEF__(bcopy)(const void *src, void *dest, size_t n); 66 extern void __POSIX_DEF__(bzero)(void *mem, size_t n); 67 extern char *__POSIX_DEF__(index)(const char *s, int c); 68 extern char *__POSIX_DEF__(rindex)(const char *s, int c); 62 69 63 #ifndef LIBPOSIX_INTERNAL64 #define ffs posix_ffs65 66 #define strcasecmp posix_strcasecmp67 #define strncasecmp posix_strncasecmp68 69 #define bcmp posix_bcmp70 #define bcopy posix_bcopy71 #undef bzero72 #define bzero posix_bzero73 #define index posix_index74 #define rindex posix_rindex75 #endif76 70 77 71 #endif // POSIX_STRINGS_H_ -
uspace/lib/posix/include/posix/sys/mman.h
r80445cf r4c53333 36 36 #define POSIX_SYS_MMAN_H_ 37 37 38 #include "../libc/sys/mman.h" 38 #ifndef __POSIX_DEF__ 39 #define __POSIX_DEF__(x) x 40 #endif 41 42 #include "sys/types.h" 43 #include <abi/mm/as.h> 44 45 #define MAP_FAILED ((void *) -1) 46 47 #define MAP_SHARED (1 << 0) 48 #define MAP_PRIVATE (1 << 1) 49 #define MAP_FIXED (1 << 2) 50 #define MAP_ANONYMOUS (1 << 3) 51 #define MAP_ANON MAP_ANONYMOUS 39 52 40 53 #undef PROT_NONE … … 43 56 #undef PROT_EXEC 44 57 #define PROT_NONE 0 45 #define PROT_READ PROTO_READ 46 #define PROT_WRITE PROTO_WRITE 47 #define PROT_EXEC PROTO_EXEC 58 #define PROT_READ AS_AREA_READ 59 #define PROT_WRITE AS_AREA_WRITE 60 #define PROT_EXEC AS_AREA_EXEC 61 62 extern void *mmap(void *start, size_t length, int prot, int flags, int fd, 63 __POSIX_DEF__(off_t) offset); 64 extern int munmap(void *start, size_t length); 65 48 66 49 67 #endif /* POSIX_SYS_MMAN_H_ */ -
uspace/lib/posix/include/posix/sys/stat.h
r80445cf r4c53333 37 37 #define POSIX_SYS_STAT_H_ 38 38 39 #include "../libc/sys/stat.h"40 39 #include "types.h" 41 40 #include "../time.h" 41 42 #ifndef __POSIX_DEF__ 43 #define __POSIX_DEF__(x) x 44 #endif 42 45 43 46 /* values are the same as on Linux */ … … 109 112 #define S_ISSOCK(m) ((m & S_IFSOCK) != 0) /* socket? (Not in POSIX.1-1996.) */ 110 113 111 struct posix_stat{112 posix_dev_tst_dev; /* ID of device containing file */113 posix_ino_tst_ino; /* inode number */114 struct __POSIX_DEF__(stat) { 115 __POSIX_DEF__(dev_t) st_dev; /* ID of device containing file */ 116 __POSIX_DEF__(ino_t) st_ino; /* inode number */ 114 117 mode_t st_mode; /* protection */ 115 posix_nlink_tst_nlink; /* number of hard links */116 posix_uid_tst_uid; /* user ID of owner */117 posix_gid_tst_gid; /* group ID of owner */118 posix_dev_tst_rdev; /* device ID (if special file) */119 posix_off_tst_size; /* total size, in bytes */120 posix_blksize_tst_blksize; /* blocksize for file system I/O */121 posix_blkcnt_tst_blocks; /* number of 512B blocks allocated */118 __POSIX_DEF__(nlink_t) st_nlink; /* number of hard links */ 119 __POSIX_DEF__(uid_t) st_uid; /* user ID of owner */ 120 __POSIX_DEF__(gid_t) st_gid; /* group ID of owner */ 121 __POSIX_DEF__(dev_t) st_rdev; /* device ID (if special file) */ 122 __POSIX_DEF__(off_t) st_size; /* total size, in bytes */ 123 __POSIX_DEF__(blksize_t) st_blksize; /* blocksize for file system I/O */ 124 __POSIX_DEF__(blkcnt_t) st_blocks; /* number of 512B blocks allocated */ 122 125 time_t st_atime; /* time of last access */ 123 126 time_t st_mtime; /* time of last modification */ … … 125 128 }; 126 129 127 extern int posix_fstat(int fd, struct posix_stat *st); 128 extern int posix_lstat(const char *restrict path, struct posix_stat *restrict st); 129 extern int posix_stat(const char *restrict path, struct posix_stat *restrict st); 130 extern int posix_chmod(const char *path, mode_t mode); 131 extern mode_t posix_umask(mode_t mask); 130 extern int __POSIX_DEF__(fstat)(int fd, struct __POSIX_DEF__(stat) *st); 131 extern int __POSIX_DEF__(lstat)(const char *restrict path, struct __POSIX_DEF__(stat) *restrict st); 132 extern int __POSIX_DEF__(stat)(const char *restrict path, struct __POSIX_DEF__(stat) *restrict st); 133 extern int __POSIX_DEF__(chmod)(const char *path, mode_t mode); 134 extern mode_t __POSIX_DEF__(umask)(mode_t mask); 135 extern int mkdir(const char *, mode_t); 132 136 133 #ifndef LIBPOSIX_INTERNAL134 #define fstat posix_fstat135 #define lstat posix_lstat136 #define stat posix_stat137 #define chmod posix_chmod138 #define umask posix_umask139 #endif140 137 141 138 #endif /* POSIX_SYS_STAT_H */ -
uspace/lib/posix/include/posix/sys/types.h
r80445cf r4c53333 37 37 #define POSIX_SYS_TYPES_H_ 38 38 39 #include "../libc/sys/types.h" 39 #ifndef __POSIX_DEF__ 40 #define __POSIX_DEF__(x) x 41 #endif 40 42 41 typedef unsigned int posix_ino_t; 42 typedef unsigned int posix_nlink_t; 43 typedef unsigned int posix_uid_t; 44 typedef unsigned int posix_gid_t; 45 typedef off64_t posix_off_t; 46 typedef long posix_blksize_t; 47 typedef long posix_blkcnt_t; 48 typedef int64_t posix_pid_t; 49 typedef sysarg_t posix_dev_t; 43 #include "libc/sys/types.h" 44 #include "libc/sys/time.h" 45 46 typedef unsigned int __POSIX_DEF__(ino_t); 47 typedef unsigned int __POSIX_DEF__(nlink_t); 48 typedef unsigned int __POSIX_DEF__(uid_t); 49 typedef unsigned int __POSIX_DEF__(gid_t); 50 typedef off64_t __POSIX_DEF__(off_t); 51 typedef long __POSIX_DEF__(blksize_t); 52 typedef long __POSIX_DEF__(blkcnt_t); 53 typedef int64_t __POSIX_DEF__(pid_t); 54 typedef sysarg_t __POSIX_DEF__(dev_t); 50 55 51 56 /* PThread Types */ 52 typedef struct posix_thread_attr posix_thread_attr_t;57 typedef struct __POSIX_DEF__(thread_attr) __POSIX_DEF__(thread_attr_t); 53 58 54 59 /* Clock Types */ 55 typedef long posix_clock_t;56 typedef int posix_clockid_t;60 typedef long __POSIX_DEF__(clock_t); 61 typedef int __POSIX_DEF__(clockid_t); 57 62 58 #ifndef LIBPOSIX_INTERNAL59 #define ino_t posix_ino_t60 #define nlink_t posix_nlink_t61 #define uid_t posix_uid_t62 #define gid_t posix_gid_t63 #define off_t posix_off_t64 #define blksize_t posix_blksize_t65 #define blkcnt_t posix_blkcnt_t66 #define pid_t posix_pid_t67 #define dev_t posix_dev_t68 69 #define pthread_attr_t posix_thread_attr_t70 71 #define clock_t posix_clock_t72 #define clockid_t posix_clockid_t73 #endif74 63 75 64 #endif /* POSIX_SYS_TYPES_H_ */ -
uspace/lib/posix/include/posix/sys/wait.h
r80445cf r4c53333 36 36 #define POSIX_SYS_WAIT_H_ 37 37 38 #ifndef __POSIX_DEF__ 39 #define __POSIX_DEF__(x) x 40 #endif 41 38 42 #include "types.h" 39 43 … … 52 56 extern int __posix_wtermsig(int status); 53 57 54 extern posix_pid_t posix_wait(int *stat_ptr);55 extern posix_pid_t posix_waitpid(posix_pid_tpid, int *stat_ptr, int options);58 extern __POSIX_DEF__(pid_t) __POSIX_DEF__(wait)(int *stat_ptr); 59 extern __POSIX_DEF__(pid_t) __POSIX_DEF__(waitpid)(__POSIX_DEF__(pid_t) pid, int *stat_ptr, int options); 56 60 57 #ifndef LIBPOSIX_INTERNAL58 #define wait posix_wait59 #define waitpid posix_waitpid60 #endif61 61 62 62 #endif /* POSIX_SYS_WAIT_H_ */ -
uspace/lib/posix/include/posix/unistd.h
r80445cf r4c53333 37 37 #define POSIX_UNISTD_H_ 38 38 39 #include "libc/unistd.h" 39 #ifndef __POSIX_DEF__ 40 #define __POSIX_DEF__(x) x 41 #endif 42 40 43 #include "sys/types.h" 44 #include "stddef.h" 41 45 42 46 /* Process Termination */ 43 47 #define _exit exit 44 48 45 /* Option Arguments */ 46 extern char *optarg; 49 extern char *__POSIX_DEF__(optarg); 47 50 extern int optind, opterr, optopt; 48 extern int getopt(int, char * const [], const char *);51 extern int __POSIX_DEF__(getopt)(int, char * const [], const char *); 49 52 50 53 /* Environment */ 51 extern char ** posix_environ;54 extern char **__POSIX_DEF__(environ); 52 55 53 56 /* Login Information */ 54 extern char * posix_getlogin(void);55 extern int posix_getlogin_r(char *name, size_t namesize);57 extern char *__POSIX_DEF__(getlogin)(void); 58 extern int __POSIX_DEF__(getlogin_r)(char *name, size_t namesize); 56 59 57 60 /* Identifying Terminals */ 58 extern int posix_isatty(int fd);61 extern int __POSIX_DEF__(isatty)(int fd); 59 62 60 63 /* Working Directory */ 61 extern char * posix_getcwd(char *buf, size_t size);62 extern int posix_chdir(const char *path);64 extern char *__POSIX_DEF__(getcwd)(char *buf, size_t size); 65 extern int __POSIX_DEF__(chdir)(const char *path); 63 66 64 67 /* Query Memory Parameters */ 65 extern int posix_getpagesize(void);68 extern int __POSIX_DEF__(getpagesize)(void); 66 69 67 70 /* Process Identification */ 68 extern posix_pid_t posix_getpid(void);69 extern posix_uid_t posix_getuid(void);70 extern posix_gid_t posix_getgid(void);71 extern __POSIX_DEF__(pid_t) __POSIX_DEF__(getpid)(void); 72 extern __POSIX_DEF__(uid_t) __POSIX_DEF__(getuid)(void); 73 extern __POSIX_DEF__(gid_t) __POSIX_DEF__(getgid)(void); 71 74 72 75 /* File Manipulation */ 73 extern int posix_close(int fildes);74 extern ssize_t posix_read(int fildes, void *buf, size_t nbyte);75 extern ssize_t posix_write(int fildes, const void *buf, size_t nbyte);76 extern int posix_fsync(int fildes);77 extern int posix_ftruncate(int fildes, posix_off_tlength);78 extern int posix_rmdir(const char *path);79 extern int posix_unlink(const char *path);80 extern int posix_dup(int fildes);81 extern int posix_dup2(int fildes, int fildes2);76 extern int __POSIX_DEF__(close)(int fildes); 77 extern ssize_t __POSIX_DEF__(read)(int fildes, void *buf, size_t nbyte); 78 extern ssize_t __POSIX_DEF__(write)(int fildes, const void *buf, size_t nbyte); 79 extern int __POSIX_DEF__(fsync)(int fildes); 80 extern int __POSIX_DEF__(ftruncate)(int fildes, __POSIX_DEF__(off_t) length); 81 extern int __POSIX_DEF__(rmdir)(const char *path); 82 extern int __POSIX_DEF__(unlink)(const char *path); 83 extern int __POSIX_DEF__(dup)(int fildes); 84 extern int __POSIX_DEF__(dup2)(int fildes, int fildes2); 82 85 83 86 /* Standard Streams */ … … 98 101 #define W_OK 2 /* Test for write permission. */ 99 102 #define R_OK 4 /* Test for read permission. */ 100 extern int posix_access(const char *path, int amode);103 extern int __POSIX_DEF__(access)(const char *path, int amode); 101 104 102 105 /* System Parameters */ … … 107 110 _SC_CLK_TCK 108 111 }; 109 extern long posix_sysconf(int name);112 extern long __POSIX_DEF__(sysconf)(int name); 110 113 111 114 /* Path Configuration Parameters */ … … 131 134 _PC_VDISABLE 132 135 }; 133 extern long posix_pathconf(const char *path, int name);136 extern long __POSIX_DEF__(pathconf)(const char *path, int name); 134 137 135 138 /* Creating a Process */ 136 extern posix_pid_t posix_fork(void);139 extern __POSIX_DEF__(pid_t) __POSIX_DEF__(fork)(void); 137 140 138 141 /* Executing a File */ 139 extern int posix_execv(const char *path, char *const argv[]);140 extern int posix_execvp(const char *file, char *const argv[]);142 extern int __POSIX_DEF__(execv)(const char *path, char *const argv[]); 143 extern int __POSIX_DEF__(execvp)(const char *file, char *const argv[]); 141 144 142 145 /* Creating a Pipe */ 143 extern int posix_pipe(int fildes[2]);146 extern int __POSIX_DEF__(pipe)(int fildes[2]); 144 147 145 #ifndef LIBPOSIX_INTERNAL 146 #define environ posix_environ 147 148 #define getlogin posix_getlogin 149 #define getlogin_r posix_getlogin_r 150 151 #define getcwd posix_getcwd 152 #define chdir posix_chdir 153 154 #define isatty posix_isatty 155 156 #undef getpagesize 157 #define getpagesize posix_getpagesize 158 159 #define getpid posix_getpid 160 #define getuid posix_getuid 161 #define getgid posix_getgid 162 163 #define close posix_close 164 #define read posix_read 165 #define write posix_write 166 #define fsync posix_fsync 167 #define ftruncate posix_ftruncate 168 #define rmdir posix_rmdir 169 #define unlink posix_unlink 170 #define dup posix_dup 171 #define dup2 posix_dup2 172 173 #define access posix_access 174 175 #define sysconf posix_sysconf 176 177 #define pathconf posix_pathconf 178 179 #define fork posix_fork 180 181 #define execv posix_execv 182 #define execvp posix_execvp 183 184 #define pipe posix_pipe 185 #endif 148 /* Issue alarm signal. */ 149 extern unsigned int __POSIX_DEF__(alarm)(unsigned int); 186 150 187 151 #endif /* POSIX_UNISTD_H_ */
Note:
See TracChangeset
for help on using the changeset viewer.
