Changes in / [8ab339e:088b334] in mainline


Ignore:
Location:
uspace
Files:
3 deleted
49 edited

Legend:

Unmodified
Added
Removed
  • uspace/Makefile.common

    r8ab339e r088b334  
    227227ifeq ($(POSIX_COMPAT),y)
    228228        CFLAGS = -I$(LIBPOSIX_PREFIX)/include/posix  -I$(LIBPOSIX_PREFIX)/include/
    229         BASE_LIBS = $(LIBPOSIX_PREFIX)/libposixaslibc.a $(LIBPOSIX_PREFIX)/libc4posix.a $(LIBSOFTINT_PREFIX)/libsoftint.a
     229        LIBS += $(LIBPOSIX_PREFIX)/libposix.a
    230230endif
    231231
  • uspace/app/bdsh/cmds/builtins/batch/batch.c

    r8ab339e r088b334  
    2929#include <stdio.h>
    3030#include <stdlib.h>
    31 #include <stdbool.h>
    32 #include <errno.h>
    3331#include "config.h"
    3432#include "util.h"
     
    4644        if (level == HELP_SHORT) {
    4745                printf(
    48                 "\n  batch [filename] [-c]\n"
     46                "\n  batch [filename]\n"
    4947                "  Issues commands stored in the file.\n"
    5048                "  Each command must correspond to the single line in the file.\n\n");
     
    5654                "  separate groups of commands. There is no support for comments,\n"
    5755                "  variables, recursion or other programming constructs - the `batch'\n"
    58                 "  command is indeed very trivial.\n"
    59                 "  If the filename is followed by -c, execution continues even if some\n"
    60                 "  of the commands failed.\n\n");
     56                "  command is indeed very trivial.\n\n");
    6157        }
    6258
     
    6965{
    7066        unsigned int argc;
    71         bool continue_despite_errors = false;
    7267
    7368        /* Count the arguments */
     
    7772                printf("%s - no input file provided.\n", cmdname);
    7873                return CMD_FAILURE;
    79         }
    80 
    81         if (argc > 2) {
    82                 if (str_cmp(argv[2], "-c") == 0)
    83                         continue_despite_errors = true;
    8474        }
    8575
     
    10999                                        rc = process_input(&fusr);
    110100                                        /* fusr->line was freed by process_input() */
    111                                         if ((rc != EOK) && continue_despite_errors) {
    112                                                 /* Mute the error. */
    113                                                 rc = EOK;
    114                                         }
    115101                                }
    116102                                if (rc == 0 && c != EOF) {
  • uspace/app/binutils/intrusive.sh

    r8ab339e r088b334  
    9696# libposix function name redefinitons in one of the arm-specific files.
    9797#
    98 # Patch 9
    99 # Libiberty does not trust our strncmp that is provided in libposix.
    100 # That is because when cross-compiling, it cannot check how it behaves
    101 # and assumes the worst. But then it clashes when linking (due to
    102 # multiple definitions of ...) and this patch prevents compilation of
    103 # liberty strncmp.
    10498
    10599case "$1" in
     
    163157                # Patch libiberty configure script.
    164158                cat "$2/libiberty/configure.backup" | \
    165                 # See Patch 1 and 9.
    166                 sed -e 's/^cross_compiling=no/cross_compiling=yes/g' \
    167                         -e 's/ac_cv_func_strncmp_works=no/ac_cv_func_strncmp_works=yes/g' \
     159                # See Patch 1.
     160                sed 's/^cross_compiling=no/cross_compiling=yes/g' \
    168161                > "$2/libiberty/configure"
    169162
  • uspace/app/pcc/config.h

    r8ab339e r088b334  
    5050
    5151/* Define to 1 if you have the `mkstemp' function. */
    52 #define HAVE_MKSTEMP 1
     52//#define HAVE_MKSTEMP 1
    5353
    5454/* Define to 1 if you have the `snprintf' function. */
  • uspace/lib/c/generic/io/io.c

    r8ab339e r088b334  
    192192}
    193193
    194 /** Set stream buffer.
    195  *
    196  * When @p buf is NULL, the stream is set as unbuffered, otherwise
    197  * full buffering is enabled.
    198  */
    199 void setbuf(FILE *stream, void *buf)
    200 {
    201         if (buf == NULL) {
    202                 setvbuf(stream, NULL, _IONBF, BUFSIZ);
    203         } else {
    204                 setvbuf(stream, buf, _IOFBF, BUFSIZ);
    205         }
    206 }
    207 
    208194static void _setvbuf(FILE *stream)
    209195{
  • uspace/lib/c/include/stdio.h

    r8ab339e r088b334  
    143143
    144144extern void setvbuf(FILE *, void *, int, size_t);
    145 extern void setbuf(FILE *, void *);
    146145
    147146/* Misc file functions */
  • uspace/lib/posix/Makefile

    r8ab339e r088b334  
    3737INCLUDE_LIBC = ./include/libc
    3838
    39 LIBC_FILE = $(LIBC_PREFIX)/libc.a
    40 
    41 FIXED_POSIX_LIBRARY = libposixaslibc.a
    42 FIXED_C_LIBRARY = libc4posix.a
    43 
    44 REDEFS_HIDE_LIBC = redefs-hide-libc.xargs
    45 REDEFS_SHOW_LIBPOSIX = redefs-show-posix.xargs
    46 COLLISIONS_LIST = collisions.list
    47 
    4839PRE_DEPEND = $(INCLUDE_LIBC)
    49 EXTRA_CLEAN = \
    50         $(INCLUDE_LIBC) \
    51         $(REDEFS_HIDE_LIBC) $(REDEFS_SHOW_LIBPOSIX) \
    52         $(COLLISIONS_LIST)
    53 EXTRA_OUTPUT = $(FIXED_C_LIBRARY) $(FIXED_POSIX_LIBRARY)
     40EXTRA_CLEAN = $(INCLUDE_LIBC)
    5441
    5542SOURCES = \
     
    7966$(INCLUDE_LIBC): ../c/include
    8067        ln -s -f -n ../$^ $@
    81 
    82 $(FIXED_C_LIBRARY): $(REDEFS_HIDE_LIBC) $(REDEFS_SHOW_LIBPOSIX)
    83         ./tools/transform-symbols.sh \
    84                 $(OBJCOPY) $(AR) echo \
    85                 $(LIBC_FILE) $@ \
    86                 $(REDEFS_HIDE_LIBC) $(REDEFS_SHOW_LIBPOSIX)
    87 
    88 $(FIXED_POSIX_LIBRARY): $(LIBRARY).a $(REDEFS_HIDE_LIBC) $(REDEFS_SHOW_LIBPOSIX)
    89         ./tools/transform-symbols.sh \
    90                 $(OBJCOPY) $(AR) echo \
    91                 $(LIBRARY).a $@ \
    92                 $(REDEFS_HIDE_LIBC) $(REDEFS_SHOW_LIBPOSIX)
    93 
    94 $(REDEFS_HIDE_LIBC): $(COLLISIONS_LIST)
    95         ./tools/create-redefines.sh "" "__helenos_libc_" <$(COLLISIONS_LIST) >$@
    96        
    97 $(REDEFS_SHOW_LIBPOSIX): $(COLLISIONS_LIST)
    98         ./tools/create-redefines.sh "posix_" "" <$(COLLISIONS_LIST) >$@
    99 
    100 $(COLLISIONS_LIST):
    101         ./tools/get-collision-list.sh ./include/posix >$@
  • uspace/lib/posix/include/posix/ctype.h

    r8ab339e r088b334  
    3737#define POSIX_CTYPE_H_
    3838
    39 #ifndef __POSIX_DEF__
    40 #define __POSIX_DEF__(x) x
    41 #endif
    42 
    4339#include "libc/ctype.h"
    4440
    4541/* Classification of Characters */
    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);
     42extern int posix_isxdigit(int c);
     43extern int posix_isblank(int c);
     44extern int posix_iscntrl(int c);
     45extern int posix_isgraph(int c);
     46extern int posix_isprint(int c);
     47extern int posix_ispunct(int c);
    5248
    5349/* Obsolete Functions and Macros */
    54 extern int __POSIX_DEF__(isascii)(int c);
    55 extern int __POSIX_DEF__(toascii)(int c);
     50extern int posix_isascii(int c);
     51extern int posix_toascii(int c);
    5652#undef _tolower
    5753#define _tolower(c) ((c) - 'A' + 'a')
     
    6056
    6157
     58#ifndef LIBPOSIX_INTERNAL
     59        #define isxdigit posix_isxdigit
     60        #define isblank posix_isblank
     61        #define iscntrl posix_iscntrl
     62        #define isgraph posix_isgraph
     63        #define isprint posix_isprint
     64        #define ispunct posix_ispunct
     65       
     66        #define isascii posix_isascii
     67        #define toascii posix_toascii
     68#endif
    6269
    6370#endif /* POSIX_CTYPE_H_ */
  • uspace/lib/posix/include/posix/fcntl.h

    r8ab339e r088b334  
    3636#define POSIX_FCNTL_H_
    3737
    38 #ifndef __POSIX_DEF__
    39 #define __POSIX_DEF__(x) x
    40 #endif
    41 
    4238#include "sys/types.h"
    4339#include "libc/fcntl.h"
     
    7672#define FD_CLOEXEC         1 /* Close on exec. */
    7773
    78 extern int __POSIX_DEF__(open)(const char *pathname, int flags, ...);
    79 extern int __POSIX_DEF__(fcntl)(int fd, int cmd, ...);
     74extern int posix_open(const char *pathname, int flags, ...);
     75extern int posix_fcntl(int fd, int cmd, ...);
    8076
     77#ifndef LIBPOSIX_INTERNAL
     78        #define fcntl posix_fcntl
     79        #define open posix_open
     80#endif
    8181
    8282#endif /* POSIX_FCNTL_H_ */
  • uspace/lib/posix/include/posix/float.h

    r8ab339e r088b334  
    3636#define POSIX_FLOAT_H_
    3737
    38 /*
    39  * The macros defined below are needed for compilation of MPFR
    40  * (http://www.mpfr.org/). Probably, they should be provided by GCC
    41  * itself but that does not work for cross-compilation.
    42  *
    43  * They are intentionally guarded by the given macro to ensure that anyone
    44  * who wants them states this explicitly.
    45  *
    46  * The values are the ones GCC prints when compiled on i686 Linux.
    47  *
    48  * WARNING: the values are not accurate (especially the long double ones)!
    49  *
    50  */
    51 #ifdef FLOAT_H_YES_I_REALLY_WANT_LIMITS
    52 
    53 /* float limits */
    54 #define FLT_MIN 1.1754943508222875079687365372222456778186655567720875215087517062784172594547271728515625e-38
    55 #define FLT_MAX 340282346638528859811704183484516925440
    56 
    57 /* double limits */
    58 #define DBL_MIN 2.2250738585072013830902327173324040642192159804623318305533274168872044348139181958542831590125110205640673397310358110051524341615534601088560123853777188211307779935320023304796101474425836360719216e-308
    59 #define DBL_MAX 1.7976931348623157081452742373170435679807056752584499659891747680315726078002853876058955863276687817154045895351438246423432132688946418276846754670353751698604991057655128207624549009038932894407587e+308
    60 
    61 /* long double limits */
    62 #define LDBL_MIN 3.3621031431120935062626778173217526025980793448464712401088272298087426993907289670430927063650562228625019066688234732270901114717276781407474941951906317291667263914849985862188944930687409323125832e-4932L
    63 #define LDBL_MAX 1.1897314953572317650212638530309702051690633222946242004403237338917370055229707226164102903365288828535456978074955773144274431536702884341981255738537436786735932007069732632019159182829615243655295e+4932L
    64 
    65 /* epsilons */
    66 #define FLT_EPSILON 1.1920928955078125e-07
    67 #define DBL_EPSILON 2.220446049250313080847263336181640625e-16
    68 #define LDBL_EPSILON 1.08420217248550443400745280086994171142578125e-19L
    69 
    70 /* float radix */
    71 #define FLT_RADIX 2
    72 
    73 /* mantisa */
    74 #define FLT_MANT_DIG 24
    75 #define DBL_MANT_DIG 53
    76 #define LDBL_MANT_DIG 64
    77 
    78 /* exponents */
    79 #define DBL_MIN_EXP -1021
    80 #define DBL_MAX_EXP 1024
    81 
    82 #endif
     38/* Empty. Just to satisfy preprocessor. */
    8339
    8440#endif /* POSIX_FLOAT_H_ */
  • uspace/lib/posix/include/posix/fnmatch.h

    r8ab339e r088b334  
    3636#define POSIX_FNMATCH_H_
    3737
    38 #ifndef __POSIX_DEF__
    39 #define __POSIX_DEF__(x) x
    40 #endif
    41 
    4238/* Error Values */
    4339#undef FNM_NOMATCH
     
    6056#define FNM_CASEFOLD 16
    6157
    62 extern int __POSIX_DEF__(fnmatch)(const char *pattern, const char *string, int flags);
     58extern int posix_fnmatch(const char *pattern, const char *string, int flags);
    6359
     60#ifndef LIBPOSIX_INTERNAL
     61        #define fnmatch posix_fnmatch
     62#endif
    6463
    6564#endif /* POSIX_FNMATCH_H_ */
  • uspace/lib/posix/include/posix/getopt.h

    r8ab339e r088b334  
    3535#define POSIX_GETOPT_H
    3636
    37 #ifndef __POSIX_DEF__
    38 #define __POSIX_DEF__(x) x
    39 #endif
    40 
    4137#include "unistd.h"
    4238
     
    5551#endif
    5652
    57 extern int __POSIX_DEF__(getopt_long)(int, char * const [], const char *, const struct option *, int *);
     53extern int posix_getopt_long(int, char * const [], const char *, const struct option *, int *);
     54
     55
     56#ifndef LIBPOSIX_INTERNAL
     57        #define getopt_long posix_getopt_long
     58#endif
    5859
    5960
  • uspace/lib/posix/include/posix/inttypes.h

    r8ab339e r088b334  
    3636#define POSIX_INTTYPES_H_
    3737
    38 #ifndef __POSIX_DEF__
    39 #define __POSIX_DEF__(x) x
    40 #endif
    41 
    4238#include "stdint.h"
    4339#include "libc/inttypes.h"
    4440
    45 extern __POSIX_DEF__(intmax_t) __POSIX_DEF__(strtoimax)(const char *restrict nptr,
     41extern posix_intmax_t posix_strtoimax(const char *restrict nptr,
    4642    char **restrict endptr, int base);
    47 extern __POSIX_DEF__(uintmax_t) __POSIX_DEF__(strtoumax)(const char *restrict nptr,
     43extern posix_uintmax_t posix_strtoumax(const char *restrict nptr,
    4844    char **restrict endptr, int base);
    4945
     46#ifndef LIBPOSIX_INTERNAL
     47        #define strtoimax posix_strtoimax
     48        #define strtoumax posix_strtoumax
     49#endif
    5050
    5151#endif /* POSIX_INTTYPES_H_ */
  • uspace/lib/posix/include/posix/locale.h

    r8ab339e r088b334  
    3636#define POSIX_LOCALE_H_
    3737
    38 #ifndef __POSIX_DEF__
    39 #define __POSIX_DEF__(x) x
    40 #endif
    41 
    4238#ifndef NULL
    4339        #define NULL ((void *) 0)
     
    4642#ifndef __locale_t_defined
    4743        #define __locale_t_defined
    48         typedef struct __posix_locale *__POSIX_DEF__(locale_t);
     44        typedef struct __posix_locale *posix_locale_t;
    4945        #ifndef LIBPOSIX_INTERNAL
    50                 #define locale_t __POSIX_DEF__(locale_t)
     46                #define locale_t posix_locale_t
    5147        #endif
    5248#endif
     
    8682#define LC_GLOBAL_LOCALE NULL
    8783
    88 struct __POSIX_DEF__(lconv) {
     84struct posix_lconv {
    8985        char *currency_symbol;
    9086        char *decimal_point;
     
    113109};
    114110
    115 extern char *__POSIX_DEF__(setlocale)(int category, const char *locale);
    116 extern struct __POSIX_DEF__(lconv) *__POSIX_DEF__(localeconv)(void);
     111extern char *posix_setlocale(int category, const char *locale);
     112extern struct posix_lconv *posix_localeconv(void);
    117113
    118114/* POSIX Extensions */
    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);
     115extern posix_locale_t posix_duplocale(posix_locale_t locobj);
     116extern void posix_freelocale(posix_locale_t locobj);
     117extern posix_locale_t posix_newlocale(int category_mask, const char *locale,
     118    posix_locale_t base);
     119extern posix_locale_t posix_uselocale(posix_locale_t newloc);
    124120
     121#ifndef LIBPOSIX_INTERNAL
     122        #define lconv posix_lconv
     123
     124        #define setlocale posix_setlocale
     125        #define localeconv posix_localeconv
     126
     127        #define newlocale posix_newlocale
     128        #define uselocale posix_uselocale
     129        #define duplocale posix_duplocale
     130        #define freelocale posix_freelocale
     131#endif
    125132
    126133#endif /* POSIX_LOCALE_H_ */
  • uspace/lib/posix/include/posix/math.h

    r8ab339e r088b334  
    3636#define POSIX_MATH_H_
    3737
    38 #ifndef __POSIX_DEF__
    39 #define __POSIX_DEF__(x) x
     38/* Normalization Functions */
     39extern double posix_ldexp(double x, int exp);
     40extern double posix_frexp(double num, int *exp);
     41
     42#ifndef LIBPOSIX_INTERNAL
     43        #define ldexp posix_ldexp
     44        #define frexp posix_frexp
    4045#endif
    41 
    42 /* Normalization Functions */
    43 extern double __POSIX_DEF__(ldexp)(double x, int exp);
    44 extern double __POSIX_DEF__(frexp)(double num, int *exp);
    45 
    4646
    4747#endif /* POSIX_MATH_H_ */
  • uspace/lib/posix/include/posix/pwd.h

    r8ab339e r088b334  
    3636#define POSIX_PWD_H_
    3737
    38 #ifndef __POSIX_DEF__
    39 #define __POSIX_DEF__(x) x
    40 #endif
    41 
    4238#include "sys/types.h"
    4339
    44 struct __POSIX_DEF__(passwd) {
     40struct posix_passwd {
    4541        char *pw_name;
    46         __POSIX_DEF__(uid_t) pw_uid;
    47         __POSIX_DEF__(gid_t) pw_gid;
     42        posix_uid_t pw_uid;
     43        posix_gid_t pw_gid;
    4844        char *pw_dir;
    4945        char *pw_shell;
    5046};
    5147
    52 extern struct __POSIX_DEF__(passwd) *__POSIX_DEF__(getpwent)(void);
    53 extern void __POSIX_DEF__(setpwent)(void);
    54 extern void __POSIX_DEF__(endpwent)(void);
     48extern struct posix_passwd *posix_getpwent(void);
     49extern void posix_setpwent(void);
     50extern void posix_endpwent(void);
    5551
    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);
     52extern struct posix_passwd *posix_getpwnam(const char *name);
     53extern int posix_getpwnam_r(const char *name, struct posix_passwd *pwd,
     54    char *buffer, size_t bufsize, struct posix_passwd **result);
    5955
    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);
     56extern struct posix_passwd *posix_getpwuid(posix_uid_t uid);
     57extern int posix_getpwuid_r(posix_uid_t uid, struct posix_passwd *pwd,
     58    char *buffer, size_t bufsize, struct posix_passwd **result);
    6359
     60#ifndef LIBPOSIX_INTERNAL
     61        #define passwd posix_passwd
     62       
     63        #define getpwent posix_getpwent
     64        #define setpwent posix_setpwent
     65        #define endpwent posix_endpwent
     66
     67        #define getpwnam posix_getpwnam
     68        #define getpwnam_r posix_getpwnam_r
     69
     70        #define getpwuid posix_getpwuid
     71        #define getpwuid_r posix_getpwuid_r
     72#endif
    6473
    6574#endif /* POSIX_PWD_H_ */
  • uspace/lib/posix/include/posix/signal.h

    r8ab339e r088b334  
    3636#define POSIX_SIGNAL_H_
    3737
    38 #ifndef __POSIX_DEF__
    39 #define __POSIX_DEF__(x) x
    40 #endif
    41 
    4238#include "sys/types.h"
    4339
     
    5551#define SIG_IGN ((void (*)(int)) __posix_ignore_signal_handler)
    5652
    57 typedef int __POSIX_DEF__(sig_atomic_t);
    58 typedef uint32_t __POSIX_DEF__(sigset_t);
    59 typedef struct __POSIX_DEF__(mcontext) {
     53typedef int posix_sig_atomic_t;
     54typedef uint32_t posix_sigset_t;
     55typedef struct posix_mcontext {
    6056        /* must not be empty to avoid compiler warnings (-pedantic) */
    6157        int dummy;
    62 } __POSIX_DEF__(mcontext_t);
    63 
    64 union __POSIX_DEF__(sigval) {
     58} posix_mcontext_t;
     59
     60union posix_sigval {
    6561        int sival_int;
    6662        void *sival_ptr;
    6763};
    6864
    69 struct __POSIX_DEF__(sigevent) {
     65struct posix_sigevent {
    7066        int sigev_notify; /* Notification type. */
    7167        int sigev_signo; /* Signal number. */
    72         union __POSIX_DEF__(sigval) sigev_value; /* Signal value. */
    73         void (*sigev_notify_function)(union __POSIX_DEF__(sigval)); /* Notification function. */
    74         __POSIX_DEF__(thread_attr_t) *sigev_notify_attributes; /* Notification attributes. */
     68        union posix_sigval sigev_value; /* Signal value. */
     69        void (*sigev_notify_function)(union posix_sigval); /* Notification function. */
     70        posix_thread_attr_t *sigev_notify_attributes; /* Notification attributes. */
    7571};
    7672
     
    8177        int si_errno;
    8278
    83         __POSIX_DEF__(pid_t) si_pid;
    84         __POSIX_DEF__(uid_t) si_uid;
     79        posix_pid_t si_pid;
     80        posix_uid_t si_uid;
    8581        void *si_addr;
    8682        int si_status;
     
    8884        long si_band;
    8985
    90         union __POSIX_DEF__(sigval) si_value;
    91 } __POSIX_DEF__(siginfo_t);
    92 
    93 struct __POSIX_DEF__(sigaction) {
     86        union posix_sigval si_value;
     87} posix_siginfo_t;
     88
     89struct posix_sigaction {
    9490        void (*sa_handler)(int);
    95         __POSIX_DEF__(sigset_t) sa_mask;
     91        posix_sigset_t sa_mask;
    9692        int sa_flags;
    97         void (*sa_sigaction)(int, __POSIX_DEF__(siginfo_t) *, void *);
     93        void (*sa_sigaction)(int, posix_siginfo_t *, void *);
    9894};
    9995
     
    10298        size_t ss_size;
    10399        int ss_flags;
    104 } __POSIX_DEF__(stack_t);
    105 
    106 typedef struct __POSIX_DEF__(ucontext) {
    107         struct __POSIX_DEF__(ucontext) *uc_link;
    108         __POSIX_DEF__(sigset_t) uc_sigmask;
    109         __POSIX_DEF__(stack_t) uc_stack;
    110         __POSIX_DEF__(mcontext_t) uc_mcontext;
    111 } __POSIX_DEF__(ucontext_t);
    112 
    113 /* Values of __POSIX_DEF__(sigevent)::sigev_notify */
     100} posix_stack_t;
     101
     102typedef struct posix_ucontext {
     103        struct posix_ucontext *uc_link;
     104        posix_sigset_t uc_sigmask;
     105        posix_stack_t uc_stack;
     106        posix_mcontext_t uc_mcontext;
     107} posix_ucontext_t;
     108
     109/* Values of posix_sigevent::sigev_notify */
    114110#undef SIGEV_NONE
    115111#undef SIGEV_SIGNAL
     
    259255};
    260256
    261 extern int __POSIX_DEF__(sigaction)(int sig, const struct __POSIX_DEF__(sigaction) *restrict act,
    262     struct __POSIX_DEF__(sigaction) *restrict oact);
    263 
    264 extern void (*__POSIX_DEF__(signal)(int sig, void (*func)(int)))(int);
    265 extern int __POSIX_DEF__(raise)(int sig);
    266 extern int __POSIX_DEF__(kill)(__POSIX_DEF__(pid_t) pid, int sig);
    267 extern int __POSIX_DEF__(killpg)(__POSIX_DEF__(pid_t) pid, int sig);
    268 
    269 extern void __POSIX_DEF__(psiginfo)(const __POSIX_DEF__(siginfo_t) *pinfo, const char *message);
    270 extern void __POSIX_DEF__(psignal)(int signum, const char *message);
    271 
    272 extern int __POSIX_DEF__(sigemptyset)(__POSIX_DEF__(sigset_t) *set);
    273 extern int __POSIX_DEF__(sigfillset)(__POSIX_DEF__(sigset_t) *set);
    274 extern int __POSIX_DEF__(sigaddset)(__POSIX_DEF__(sigset_t) *set, int signo);
    275 extern int __POSIX_DEF__(sigdelset)(__POSIX_DEF__(sigset_t) *set, int signo);
    276 extern int __POSIX_DEF__(sigismember)(const __POSIX_DEF__(sigset_t) *set, int signo);
    277 
    278 extern int __POSIX_DEF__(thread_sigmask)(int how, const __POSIX_DEF__(sigset_t) *restrict set,
    279     __POSIX_DEF__(sigset_t) *restrict oset);
    280 extern int __POSIX_DEF__(sigprocmask)(int how, const __POSIX_DEF__(sigset_t) *restrict set,
    281     __POSIX_DEF__(sigset_t) *restrict oset);
    282 
     257extern int posix_sigaction(int sig, const struct posix_sigaction *restrict act,
     258    struct posix_sigaction *restrict oact);
     259
     260extern void (*posix_signal(int sig, void (*func)(int)))(int);
     261extern int posix_raise(int sig);
     262extern int posix_kill(posix_pid_t pid, int sig);
     263extern int posix_killpg(posix_pid_t pid, int sig);
     264
     265extern void posix_psiginfo(const posix_siginfo_t *pinfo, const char *message);
     266extern void posix_psignal(int signum, const char *message);
     267
     268extern int posix_sigemptyset(posix_sigset_t *set);
     269extern int posix_sigfillset(posix_sigset_t *set);
     270extern int posix_sigaddset(posix_sigset_t *set, int signo);
     271extern int posix_sigdelset(posix_sigset_t *set, int signo);
     272extern int posix_sigismember(const posix_sigset_t *set, int signo);
     273
     274extern int posix_thread_sigmask(int how, const posix_sigset_t *restrict set,
     275    posix_sigset_t *restrict oset);
     276extern int posix_sigprocmask(int how, const posix_sigset_t *restrict set,
     277    posix_sigset_t *restrict oset);
     278
     279#ifndef LIBPOSIX_INTERNAL
     280        #define sig_atomic_t posix_sig_atomic_t
     281        #define sigset_t posix_sigset_t
     282        #define sigval posix_sigval
     283        #ifndef sigevent
     284                #define sigevent posix_sigevent
     285        #endif
     286        #define mcontext_t posix_mcontext_t
     287        #define ucontext_t posix_ucontext_t
     288        #define stack_t posix_stack_t
     289        #define siginfo_t posix_siginfo_t
     290
     291        #define sigaction posix_sigaction
     292
     293        #define signal posix_signal
     294        #define raise posix_raise
     295        #define kill posix_kill
     296        #define killpg posix_killpg
     297
     298        #define psiginfo posix_psiginfo
     299        #define psignal posix_psignal
     300
     301        #define sigemptyset posix_sigemptyset
     302        #define sigfillset posix_sigfillset
     303        #define sigaddset posix_sigaddset
     304        #define sigdelset posix_sigdelset
     305        #define sigismember posix_sigismember
     306
     307        #define pthread_sigmask posix_thread_sigmask
     308        #define sigprocmask posix_sigprocmask
     309#endif
    283310
    284311#endif /* POSIX_SIGNAL_H_ */
  • uspace/lib/posix/include/posix/stddef.h

    r8ab339e r088b334  
    3636#define POSIX_STDDEF_H_
    3737
    38 #ifndef __POSIX_DEF__
    39 #define __POSIX_DEF__(x) x
    40 #endif
    41 
    4238#include "sys/types.h"
    4339
     
    4844#define offsetof(type,member) ((size_t) &(((type *) 0)->member))
    4945
    50 typedef ssize_t __POSIX_DEF__(ptrdiff_t);
     46typedef ssize_t posix_ptrdiff_t;
    5147
     48#ifndef LIBPOSIX_INTERNAL
     49        #define ptrdiff_t posix_ptrdiff_t
     50#endif
    5251
    5352#endif /* POSIX_STDDEF_H_ */
  • uspace/lib/posix/include/posix/stdint.h

    r8ab339e r088b334  
    3535#ifndef POSIX_STDINT_H_
    3636#define POSIX_STDINT_H_
    37 
    38 #ifndef __POSIX_DEF__
    39 #define __POSIX_DEF__(x) x
    40 #endif
    4137
    4238#include "libc/stdint.h"
     
    104100#include "libc/sys/types.h"
    105101
    106 typedef int64_t __POSIX_DEF__(intmax_t);
    107 typedef uint64_t __POSIX_DEF__(uintmax_t);
     102typedef int64_t posix_intmax_t;
     103typedef uint64_t posix_uintmax_t;
    108104
     105#ifndef LIBPOSIX_INTERNAL
     106        #define intmax_t posix_intmax_t
     107        #define uintmax_t posix_uintmax_t
     108#endif
    109109
    110110#endif /* POSIX_STDINT_H_ */
  • uspace/lib/posix/include/posix/stdio.h

    r8ab339e r088b334  
    3737#define POSIX_STDIO_H_
    3838
    39 #ifndef __POSIX_DEF__
    40 #define __POSIX_DEF__(x) x
    41 /* DEBUG macro does not belong to POSIX stdio.h. Its unconditional
    42  * definition in the native stdio.h causes unexpected behaviour of
    43  * applications which uses their own DEBUG macro (e.g. debugging
    44  * output is printed even if not desirable). */
    45 #undef DEBUG
    46 #endif
    47 
    4839#include "stddef.h"
    4940#include "unistd.h"
     
    10697extern size_t fwrite(const void *, size_t, size_t, FILE *);
    10798
     99extern int fseek(FILE *, off64_t, int);
    108100extern void rewind(FILE *);
     101extern off64_t ftell(FILE *);
    109102extern int feof(FILE *);
    110103extern int fileno(FILE *);
     
    122115#undef L_ctermid
    123116#define L_ctermid PATH_MAX
    124 extern char *__POSIX_DEF__(ctermid)(char *s);
     117extern char *posix_ctermid(char *s);
    125118
    126119/* Error Recovery */
    127 extern void __POSIX_DEF__(clearerr)(FILE *stream);
     120extern void posix_clearerr(FILE *stream);
    128121
    129122/* Input/Output */
    130123#undef putc
    131124#define putc fputc
    132 extern int __POSIX_DEF__(fputs)(const char *restrict s, FILE *restrict stream);
     125extern int posix_fputs(const char *restrict s, FILE *restrict stream);
    133126#undef getc
    134127#define getc fgetc
    135 extern int __POSIX_DEF__(ungetc)(int c, FILE *stream);
    136 extern ssize_t __POSIX_DEF__(getdelim)(char **restrict lineptr, size_t *restrict n,
     128extern int posix_ungetc(int c, FILE *stream);
     129extern ssize_t posix_getdelim(char **restrict lineptr, size_t *restrict n,
    137130    int delimiter, FILE *restrict stream);
    138 extern ssize_t __POSIX_DEF__(getline)(char **restrict lineptr, size_t *restrict n,
     131extern ssize_t posix_getline(char **restrict lineptr, size_t *restrict n,
    139132    FILE *restrict stream);
    140133
    141134/* Opening Streams */
    142 extern FILE *__POSIX_DEF__(freopen)(const char *restrict filename,
     135extern FILE *posix_freopen(const char *restrict filename,
    143136    const char *restrict mode, FILE *restrict stream);
    144137
    145138/* Error Messages */
    146 extern void __POSIX_DEF__(perror)(const char *s);
     139extern void posix_perror(const char *s);
    147140
    148141/* File Positioning */
    149 typedef struct _posix_fpos __POSIX_DEF__(fpos_t);
    150 extern int __POSIX_DEF__(fsetpos)(FILE *stream, const __POSIX_DEF__(fpos_t) *pos);
    151 extern int __POSIX_DEF__(fgetpos)(FILE *restrict stream, __POSIX_DEF__(fpos_t) *restrict pos);
    152 extern int __POSIX_DEF__(fseek)(FILE *stream, long offset, int whence);
    153 extern int __POSIX_DEF__(fseeko)(FILE *stream, __POSIX_DEF__(off_t) offset, int whence);
    154 extern long __POSIX_DEF__(ftell)(FILE *stream);
    155 extern __POSIX_DEF__(off_t) __POSIX_DEF__(ftello)(FILE *stream);
     142typedef struct _posix_fpos posix_fpos_t;
     143extern int posix_fsetpos(FILE *stream, const posix_fpos_t *pos);
     144extern int posix_fgetpos(FILE *restrict stream, posix_fpos_t *restrict pos);
     145extern int posix_fseek(FILE *stream, long offset, int whence);
     146extern int posix_fseeko(FILE *stream, posix_off_t offset, int whence);
     147extern long posix_ftell(FILE *stream);
     148extern posix_off_t posix_ftello(FILE *stream);
    156149
    157150/* Flushing Buffers */
    158 extern int __POSIX_DEF__(fflush)(FILE *stream);
     151extern int posix_fflush(FILE *stream);
    159152
    160153/* Formatted Output */
    161 extern int __POSIX_DEF__(dprintf)(int fildes, const char *restrict format, ...)
     154extern int posix_dprintf(int fildes, const char *restrict format, ...)
    162155    PRINTF_ATTRIBUTE(2, 3);
    163 extern int __POSIX_DEF__(vdprintf)(int fildes, const char *restrict format, va_list ap);
    164 extern int __POSIX_DEF__(sprintf)(char *restrict s, const char *restrict format, ...)
     156extern int posix_vdprintf(int fildes, const char *restrict format, va_list ap);
     157extern int posix_sprintf(char *restrict s, const char *restrict format, ...)
    165158    PRINTF_ATTRIBUTE(2, 3);
    166 extern int __POSIX_DEF__(vsprintf)(char *restrict s, const char *restrict format, va_list ap);
     159extern int posix_vsprintf(char *restrict s, const char *restrict format, va_list ap);
    167160
    168161/* Formatted Input */
    169 extern int __POSIX_DEF__(fscanf)(
     162extern int posix_fscanf(
    170163    FILE *restrict stream, const char *restrict format, ...);
    171 extern int __POSIX_DEF__(vfscanf)(
     164extern int posix_vfscanf(
    172165    FILE *restrict stream, const char *restrict format, va_list arg);
    173 extern int __POSIX_DEF__(scanf)(const char *restrict format, ...);
    174 extern int __POSIX_DEF__(vscanf)(const char *restrict format, va_list arg);
    175 extern int __POSIX_DEF__(sscanf)(
     166extern int posix_scanf(const char *restrict format, ...);
     167extern int posix_vscanf(const char *restrict format, va_list arg);
     168extern int posix_sscanf(
    176169    const char *restrict s, const char *restrict format, ...);
    177 extern int __POSIX_DEF__(vsscanf)(
     170extern int posix_vsscanf(
    178171    const char *restrict s, const char *restrict format, va_list arg);
    179172
    180173/* File Locking */
    181 extern void __POSIX_DEF__(flockfile)(FILE *file);
    182 extern int __POSIX_DEF__(ftrylockfile)(FILE *file);
    183 extern void __POSIX_DEF__(funlockfile)(FILE *file);
    184 extern int __POSIX_DEF__(getc_unlocked)(FILE *stream);
    185 extern int __POSIX_DEF__(getchar_unlocked)(void);
    186 extern int __POSIX_DEF__(putc_unlocked)(int c, FILE *stream);
    187 extern int __POSIX_DEF__(putchar_unlocked)(int c);
     174extern void posix_flockfile(FILE *file);
     175extern int posix_ftrylockfile(FILE *file);
     176extern void posix_funlockfile(FILE *file);
     177extern int posix_getc_unlocked(FILE *stream);
     178extern int posix_getchar_unlocked(void);
     179extern int posix_putc_unlocked(int c, FILE *stream);
     180extern int posix_putchar_unlocked(int c);
    188181
    189182/* Deleting Files */
    190 extern int __POSIX_DEF__(remove)(const char *path);
     183extern int posix_remove(const char *path);
    191184
    192185/* Renaming Files */
    193 extern int __POSIX_DEF__(rename)(const char *old, const char *new);
     186extern int posix_rename(const char *old, const char *new);
    194187
    195188/* Temporary Files */
    196189#undef L_tmpnam
    197190#define L_tmpnam PATH_MAX
    198 extern char *__POSIX_DEF__(tmpnam)(char *s);
    199 extern char *__POSIX_DEF__(tempnam)(const char *dir, const char *pfx);
    200 extern FILE *__POSIX_DEF__(tmpfile)(void);
    201 
     191extern char *posix_tmpnam(char *s);
     192extern char *posix_tempnam(const char *dir, const char *pfx);
     193extern FILE *posix_tmpfile(void);
     194
     195#ifndef LIBPOSIX_INTERNAL
     196        /* DEBUG macro does not belong to POSIX stdio.h. Its unconditional
     197         * definition in the native stdio.h causes unexpected behaviour of
     198         * applications which uses their own DEBUG macro (e.g. debugging
     199         * output is printed even if not desirable). */
     200        #undef DEBUG
     201
     202        #define ctermid posix_ctermid
     203
     204        #define clearerr posix_clearerr
     205
     206        #define fputs posix_fputs
     207        #define ungetc posix_ungetc
     208        #define getdelim posix_getdelim
     209        #define getline posix_getline
     210
     211        #define freopen posix_freopen
     212
     213        #define perror posix_perror
     214
     215        #define fpos_t posix_fpos_t
     216        #define fsetpos posix_fsetpos
     217        #define fgetpos posix_fgetpos
     218        #define fseek posix_fseek
     219        #define fseeko posix_fseeko
     220        #define ftell posix_ftell
     221        #define ftello posix_ftello
     222
     223        #define fflush posix_fflush
     224
     225        #define dprintf posix_dprintf
     226        #define vdprintf posix_vdprintf
     227        #define sprintf posix_sprintf
     228        #define vsprintf posix_vsprintf
     229
     230        #define fscanf posix_fscanf
     231        #define vfscanf posix_vfscanf
     232        #define vscanf posix_vscanf
     233        #define scanf posix_scanf
     234        #define sscanf posix_sscanf
     235        #define vsscanf posix_vsscanf
     236
     237        #define flockfile posix_flockfile
     238        #define ftrylockfile posix_ftrylockfile
     239        #define funlockfile posix_funlockfile
     240
     241        #define getc_unlocked posix_getc_unlocked
     242        #define getchar_unlocked posix_getchar_unlocked
     243        #define putc_unlocked posix_putc_unlocked
     244        #define putchar_unlocked posix_putchar_unlocked
     245
     246        #define remove posix_remove
     247
     248        #define rename posix_rename
     249
     250        #define tmpnam posix_tmpnam
     251        #define tempnam posix_tempnam
     252        #define tmpfile posix_tmpfile
     253#endif
    202254
    203255#endif /* POSIX_STDIO_H_ */
  • uspace/lib/posix/include/posix/stdlib.h

    r8ab339e r088b334  
    3737#define POSIX_STDLIB_H_
    3838
    39 #ifndef __POSIX_DEF__
    40 #define __POSIX_DEF__(x) x
    41 #endif
    42 
    4339#include "sys/types.h"
    4440
     
    5349#define EXIT_SUCCESS 0
    5450#define _Exit exit
    55 extern int __POSIX_DEF__(atexit)(void (*func)(void));
     51extern int posix_atexit(void (*func)(void));
    5652extern void exit(int status);
    5753extern void abort(void) __attribute__((noreturn));
    5854
    5955/* Absolute Value */
    60 extern int __POSIX_DEF__(abs)(int i);
    61 extern long __POSIX_DEF__(labs)(long i);
    62 extern long long __POSIX_DEF__(llabs)(long long i);
     56extern int posix_abs(int i);
     57extern long posix_labs(long i);
     58extern long long posix_llabs(long long i);
    6359
    6460/* Integer Division */
     
    6662typedef struct {
    6763        int quot, rem;
    68 } __POSIX_DEF__(div_t);
     64} posix_div_t;
    6965
    7066typedef struct {
    7167        long quot, rem;
    72 } __POSIX_DEF__(ldiv_t);
     68} posix_ldiv_t;
    7369
    7470typedef struct {
    7571        long long quot, rem;
    76 } __POSIX_DEF__(lldiv_t);
     72} posix_lldiv_t;
    7773
    78 extern __POSIX_DEF__(div_t) __POSIX_DEF__(div)(int numer, int denom);
    79 extern __POSIX_DEF__(ldiv_t) __POSIX_DEF__(ldiv)(long numer, long denom);
    80 extern __POSIX_DEF__(lldiv_t) __POSIX_DEF__(lldiv)(long long numer, long long denom);
     74extern posix_div_t posix_div(int numer, int denom);
     75extern posix_ldiv_t posix_ldiv(long numer, long denom);
     76extern posix_lldiv_t posix_lldiv(long long numer, long long denom);
    8177
    8278/* Array Functions */
    83 extern void __POSIX_DEF__(qsort)(void *array, size_t count, size_t size,
     79extern void posix_qsort(void *array, size_t count, size_t size,
    8480    int (*compare)(const void *, const void *));
    85 extern void *__POSIX_DEF__(bsearch)(const void *key, const void *base,
     81extern void *posix_bsearch(const void *key, const void *base,
    8682    size_t nmemb, size_t size, int (*compar)(const void *, const void *));
    8783
    8884/* Environment Access */
    89 extern char *__POSIX_DEF__(getenv)(const char *name);
    90 extern int __POSIX_DEF__(putenv)(char *string);
    91 extern int __POSIX_DEF__(system)(const char *string);
     85extern char *posix_getenv(const char *name);
     86extern int posix_putenv(char *string);
     87extern int posix_system(const char *string);
    9288
    9389/* Symbolic Links */
    94 extern char *__POSIX_DEF__(realpath)(const char *restrict name, char *restrict resolved);
     90extern char *posix_realpath(const char *restrict name, char *restrict resolved);
    9591
    9692/* Floating Point Conversion */
    97 extern double __POSIX_DEF__(atof)(const char *nptr);
    98 extern float __POSIX_DEF__(strtof)(const char *restrict nptr, char **restrict endptr);
    99 extern double __POSIX_DEF__(strtod)(const char *restrict nptr, char **restrict endptr);
    100 extern long double __POSIX_DEF__(strtold)(const char *restrict nptr, char **restrict endptr);
     93extern double posix_atof(const char *nptr);
     94extern float posix_strtof(const char *restrict nptr, char **restrict endptr);
     95extern double posix_strtod(const char *restrict nptr, char **restrict endptr);
     96extern long double posix_strtold(const char *restrict nptr, char **restrict endptr);
    10197
    10298/* Integer Conversion */
    103 extern int __POSIX_DEF__(atoi)(const char *nptr);
    104 extern long int __POSIX_DEF__(atol)(const char *nptr);
    105 extern long long int __POSIX_DEF__(atoll)(const char *nptr);
    106 extern long int __POSIX_DEF__(strtol)(const char *restrict nptr,
     99extern int posix_atoi(const char *nptr);
     100extern long int posix_atol(const char *nptr);
     101extern long long int posix_atoll(const char *nptr);
     102extern long int posix_strtol(const char *restrict nptr,
    107103    char **restrict endptr, int base);
    108 extern long long int __POSIX_DEF__(strtoll)(const char *restrict nptr,
     104extern long long int posix_strtoll(const char *restrict nptr,
    109105    char **restrict endptr, int base);
    110 extern unsigned long int __POSIX_DEF__(strtoul)(const char *restrict nptr,
     106extern unsigned long int posix_strtoul(const char *restrict nptr,
    111107    char **restrict endptr, int base);
    112 extern unsigned long long int __POSIX_DEF__(strtoull)(
     108extern unsigned long long int posix_strtoull(
    113109    const char *restrict nptr, char **restrict endptr, int base);
    114110
    115111/* Memory Allocation */
    116 extern void *__POSIX_DEF__(malloc)(size_t size);
    117 extern void *__POSIX_DEF__(calloc)(size_t nelem, size_t elsize);
    118 extern void *__POSIX_DEF__(realloc)(void *ptr, size_t size);
    119 extern void __POSIX_DEF__(free)(void *ptr);
     112extern void *posix_malloc(size_t size);
     113extern void *posix_calloc(size_t nelem, size_t elsize);
     114extern void *posix_realloc(void *ptr, size_t size);
     115extern void posix_free(void *ptr);
    120116
    121117/* Temporary Files */
    122 extern int __POSIX_DEF__(mkstemp)(char *tmpl);
     118extern int posix_mkstemp(char *tmpl);
    123119
    124120/* Legacy Declarations */
    125 extern char *__POSIX_DEF__(mktemp)(char *tmpl);
     121extern char *posix_mktemp(char *tmpl);
    126122extern int bsd_getloadavg(double loadavg[], int nelem);
     123
     124#ifndef LIBPOSIX_INTERNAL
     125        #define atexit posix_atexit
     126
     127        #define abs posix_abs
     128        #define labs posix_labs
     129        #define llabs posix_llabs
     130
     131        #define div_t posix_div_t
     132        #define ldiv_t posix_ldiv_t
     133        #define lldiv_t posix_lldiv_t
     134        #define div posix_div
     135        #define ldiv posix_ldiv
     136        #define lldiv posix_lldiv
     137
     138        #define qsort posix_qsort
     139        #define bsearch posix_bsearch
     140
     141        #define getenv posix_getenv
     142        #define putenv posix_putenv
     143        #define system posix_system
     144
     145        #define realpath posix_realpath
     146       
     147        #define atof posix_atof
     148        #define strtof posix_strtof
     149        #define strtod posix_strtod
     150        #define strtold posix_strtold
     151       
     152        #define atoi posix_atoi
     153        #define atol posix_atol
     154        #define atoll posix_atoll
     155        #define strtol posix_strtol
     156        #define strtoll posix_strtoll
     157        #define strtoul posix_strtoul
     158        #define strtoull posix_strtoull
     159
     160        #define malloc posix_malloc
     161        #define calloc posix_calloc
     162        #define realloc posix_realloc
     163        #define free posix_free
     164
     165        #define mkstemp posix_mkstemp
     166
     167        #define mktemp posix_mktemp
     168        #define getloadavg bsd_getloadavg
     169#endif
    127170
    128171#endif  // POSIX_STDLIB_H_
  • uspace/lib/posix/include/posix/string.h

    r8ab339e r088b334  
    3737#define POSIX_STRING_H_
    3838
    39 #ifndef __POSIX_DEF__
    40 #define __POSIX_DEF__(x) x
    41 #endif
    42 
    4339#include "sys/types.h"
    4440
     
    6965
    7066/* From mem.h */
    71 // #define bzero(ptr, len)  memset((ptr), 0, (len))
     67#define bzero(ptr, len)  memset((ptr), 0, (len))
    7268extern void *memset(void *, int, size_t);
    7369extern void *memcpy(void *, const void *, size_t);
     
    7672
    7773/* Copying and Concatenation */
    78 extern char *__POSIX_DEF__(strcpy)(char *restrict dest, const char *restrict src);
    79 extern char *__POSIX_DEF__(strncpy)(char *restrict dest, const char *restrict src, size_t n);
    80 extern char *__POSIX_DEF__(stpcpy)(char *restrict dest, const char *restrict src);
    81 extern char *__POSIX_DEF__(stpncpy)(char *restrict dest, const char *restrict src, size_t n);
    82 extern char *__POSIX_DEF__(strcat)(char *restrict dest, const char *restrict src);
    83 extern char *__POSIX_DEF__(strncat)(char *restrict dest, const char *restrict src, size_t n);
    84 extern void *__POSIX_DEF__(memccpy)(void *restrict dest, const void *restrict src, int c, size_t n);
    85 extern char *__POSIX_DEF__(strdup)(const char *s);
    86 extern char *__POSIX_DEF__(strndup)(const char *s, size_t n);
     74extern char *posix_strcpy(char *restrict dest, const char *restrict src);
     75extern char *posix_strncpy(char *restrict dest, const char *restrict src, size_t n);
     76extern char *posix_stpcpy(char *restrict dest, const char *restrict src);
     77extern char *posix_stpncpy(char *restrict dest, const char *restrict src, size_t n);
     78extern char *posix_strcat(char *restrict dest, const char *restrict src);
     79extern char *posix_strncat(char *restrict dest, const char *restrict src, size_t n);
     80extern void *posix_memccpy(void *restrict dest, const void *restrict src, int c, size_t n);
     81extern char *posix_strdup(const char *s);
     82extern char *posix_strndup(const char *s, size_t n);
    8783
    8884/* String/Array Comparison */
    89 extern int __POSIX_DEF__(memcmp)(const void *mem1, const void *mem2, size_t n);
    90 extern int __POSIX_DEF__(strcmp)(const char *s1, const char *s2);
    91 extern int __POSIX_DEF__(strncmp)(const char *s1, const char *s2, size_t n);
     85extern int posix_memcmp(const void *mem1, const void *mem2, size_t n);
     86extern int posix_strcmp(const char *s1, const char *s2);
     87extern int posix_strncmp(const char *s1, const char *s2, size_t n);
    9288
    9389/* Search Functions */
    94 extern void *__POSIX_DEF__(memchr)(const void *mem, int c, size_t n);
    95 extern char *__POSIX_DEF__(strchr)(const char *s, int c);
    96 extern char *__POSIX_DEF__(strrchr)(const char *s, int c);
     90extern void *posix_memchr(const void *mem, int c, size_t n);
     91extern char *posix_strchr(const char *s, int c);
     92extern char *posix_strrchr(const char *s, int c);
    9793extern char *gnu_strchrnul(const char *s, int c);
    98 extern char *__POSIX_DEF__(strpbrk)(const char *s1, const char *s2);
    99 extern size_t __POSIX_DEF__(strcspn)(const char *s1, const char *s2);
    100 extern size_t __POSIX_DEF__(strspn)(const char *s1, const char *s2);
    101 extern char *__POSIX_DEF__(strstr)(const char *haystack, const char *needle);
     94extern char *posix_strpbrk(const char *s1, const char *s2);
     95extern size_t posix_strcspn(const char *s1, const char *s2);
     96extern size_t posix_strspn(const char *s1, const char *s2);
     97extern char *posix_strstr(const char *haystack, const char *needle);
    10298
    10399/* Collation Functions */
    104 extern int __POSIX_DEF__(strcoll)(const char *s1, const char *s2);
    105 extern size_t __POSIX_DEF__(strxfrm)(char *restrict s1, const char *restrict s2, size_t n);
     100extern int posix_strcoll(const char *s1, const char *s2);
     101extern size_t posix_strxfrm(char *restrict s1, const char *restrict s2, size_t n);
    106102
    107103/* Error Messages */
    108 extern char *__POSIX_DEF__(strerror)(int errnum);
    109 extern int __POSIX_DEF__(strerror_r)(int errnum, char *buf, size_t bufsz);
     104extern char *posix_strerror(int errnum);
     105extern int posix_strerror_r(int errnum, char *buf, size_t bufsz);
    110106
    111107/* String Length */
    112 extern size_t __POSIX_DEF__(strlen)(const char *s);
    113 extern size_t __POSIX_DEF__(strnlen)(const char *s, size_t n);
     108extern size_t posix_strlen(const char *s);
     109extern size_t posix_strnlen(const char *s, size_t n);
    114110
    115111/* Signal Messages */
    116 extern char *__POSIX_DEF__(strsignal)(int signum);
     112extern char *posix_strsignal(int signum);
    117113
    118114/* Legacy Declarations */
    119115#ifndef POSIX_STRINGS_H_
    120 extern int __POSIX_DEF__(ffs)(int i);
    121 extern int __POSIX_DEF__(strcasecmp)(const char *s1, const char *s2);
    122 extern int __POSIX_DEF__(strncasecmp)(const char *s1, const char *s2, size_t n);
     116extern int posix_ffs(int i);
     117extern int posix_strcasecmp(const char *s1, const char *s2);
     118extern int posix_strncasecmp(const char *s1, const char *s2, size_t n);
    123119#endif
    124120
     121#ifndef LIBPOSIX_INTERNAL
     122        #define strcpy posix_strcpy
     123        #define strncpy posix_strncpy
     124        #define stpcpy posix_stpcpy
     125        #define stpncpy posix_stpncpy
     126        #define strcat posix_strcat
     127        #define strncat posix_strncat
     128        #define memccpy posix_memccpy
     129        #define strdup posix_strdup
     130        #define strndup posix_strndup
     131
     132        #define memcmp posix_memcmp
     133        #define strcmp posix_strcmp
     134        #define strncmp posix_strncmp
     135
     136        #define memchr posix_memchr
     137        #define strchr posix_strchr
     138        #define strrchr posix_strrchr
     139        #define strchrnul gnu_strchrnul
     140        #define strpbrk posix_strpbrk
     141        #define strcspn posix_strcspn
     142        #define strspn posix_strspn
     143        #define strstr posix_strstr
     144
     145        #define strcoll posix_strcoll
     146        #define strxfrm posix_strxfrm
     147
     148        #define strerror posix_strerror
     149        #define strerror_r posix_strerror_r
     150
     151        #define strlen posix_strlen
     152        #define strnlen posix_strnlen
     153
     154        #define strsignal posix_strsignal
     155
     156        #define ffs posix_ffs
     157        #define strcasecmp posix_strcasecmp
     158        #define strncasecmp posix_strncasecmp
     159#endif
    125160
    126161#endif  // POSIX_STRING_H_
  • uspace/lib/posix/include/posix/strings.h

    r8ab339e r088b334  
    3737#define POSIX_STRINGS_H_
    3838
    39 #ifndef __POSIX_DEF__
    40 #define __POSIX_DEF__(x) x
    41 #endif
    42 
    43 
    44 #include <libarch/types.h>
    45 
    4639/* Search Functions */
    4740#ifndef POSIX_STRING_H_
    48 extern int __POSIX_DEF__(ffs)(int i);
     41extern int posix_ffs(int i);
    4942#endif
    5043
    5144/* String/Array Comparison */
    5245#ifndef POSIX_STRING_H_
    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);
     46extern int posix_strcasecmp(const char *s1, const char *s2);
     47extern int posix_strncasecmp(const char *s1, const char *s2, size_t n);
    5548#endif
    5649
     
    6255
    6356/* Legacy Functions */
    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);
     57extern int posix_bcmp(const void *mem1, const void *mem2, size_t n);
     58extern void posix_bcopy(const void *src, void *dest, size_t n);
     59extern void posix_bzero(void *mem, size_t n);
     60extern char *posix_index(const char *s, int c);
     61extern char *posix_rindex(const char *s, int c);
    6962
     63#ifndef LIBPOSIX_INTERNAL
     64        #define ffs posix_ffs
     65
     66        #define strcasecmp posix_strcasecmp
     67        #define strncasecmp posix_strncasecmp
     68
     69        #define bcmp posix_bcmp
     70        #define bcopy posix_bcopy
     71        #undef bzero
     72        #define bzero posix_bzero
     73        #define index posix_index
     74        #define rindex posix_rindex
     75#endif
    7076
    7177#endif  // POSIX_STRINGS_H_
  • uspace/lib/posix/include/posix/sys/mman.h

    r8ab339e r088b334  
    3636#define POSIX_SYS_MMAN_H_
    3737
    38 #ifndef __POSIX_DEF__
    39 #define __POSIX_DEF__(x) x
    40 #endif
    41 
    4238#include "sys/types.h"
    4339#include <abi/mm/as.h>
     
    6056
    6157extern void *mmap(void *start, size_t length, int prot, int flags, int fd,
    62     __POSIX_DEF__(off_t) offset);
     58    posix_off_t offset);
    6359extern int munmap(void *start, size_t length);
    64 
    6560
    6661#endif /* POSIX_SYS_MMAN_H_ */
  • uspace/lib/posix/include/posix/sys/stat.h

    r8ab339e r088b334  
    3939#include "types.h"
    4040#include "../time.h"
    41 
    42 #ifndef __POSIX_DEF__
    43 #define __POSIX_DEF__(x) x
    44 #endif
    4541
    4642/* values are the same as on Linux */
     
    112108#define S_ISSOCK(m) ((m & S_IFSOCK) != 0) /* socket? (Not in POSIX.1-1996.) */
    113109
    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 */
     110struct posix_stat {
     111        posix_dev_t     st_dev;     /* ID of device containing file */
     112        posix_ino_t     st_ino;     /* inode number */
    117113        mode_t          st_mode;    /* protection */
    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 */
     114        posix_nlink_t   st_nlink;   /* number of hard links */
     115        posix_uid_t     st_uid;     /* user ID of owner */
     116        posix_gid_t     st_gid;     /* group ID of owner */
     117        posix_dev_t     st_rdev;    /* device ID (if special file) */
     118        posix_off_t     st_size;    /* total size, in bytes */
     119        posix_blksize_t st_blksize; /* blocksize for file system I/O */
     120        posix_blkcnt_t  st_blocks;  /* number of 512B blocks allocated */
    125121        time_t          st_atime;   /* time of last access */
    126122        time_t          st_mtime;   /* time of last modification */
     
    128124};
    129125
    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);
     126extern int posix_fstat(int fd, struct posix_stat *st);
     127extern int posix_lstat(const char *restrict path, struct posix_stat *restrict st);
     128extern int posix_stat(const char *restrict path, struct posix_stat *restrict st);
     129extern int posix_chmod(const char *path, mode_t mode);
     130extern mode_t posix_umask(mode_t mask);
    135131extern int mkdir(const char *, mode_t);
    136132
     133#ifndef LIBPOSIX_INTERNAL
     134        #define fstat posix_fstat
     135        #define lstat posix_lstat
     136        #define stat posix_stat
     137        #define chmod posix_chmod
     138        #define umask posix_umask
     139#endif
    137140
    138141#endif /* POSIX_SYS_STAT_H */
  • uspace/lib/posix/include/posix/sys/types.h

    r8ab339e r088b334  
    3737#define POSIX_SYS_TYPES_H_
    3838
    39 #ifndef __POSIX_DEF__
    40 #define __POSIX_DEF__(x) x
    41 #endif
    42 
    4339#include "libc/sys/types.h"
    4440#include "libc/sys/time.h"
    4541
    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);
     42typedef unsigned int posix_ino_t;
     43typedef unsigned int posix_nlink_t;
     44typedef unsigned int posix_uid_t;
     45typedef unsigned int posix_gid_t;
     46typedef off64_t posix_off_t;
     47typedef long posix_blksize_t;
     48typedef long posix_blkcnt_t;
     49typedef int64_t posix_pid_t;
     50typedef sysarg_t posix_dev_t;
    5551
    5652/* PThread Types */
    57 typedef struct __POSIX_DEF__(thread_attr) __POSIX_DEF__(thread_attr_t);
     53typedef struct posix_thread_attr posix_thread_attr_t;
    5854
    5955/* Clock Types */
    60 typedef long __POSIX_DEF__(clock_t);
    61 typedef int __POSIX_DEF__(clockid_t);
     56typedef long posix_clock_t;
     57typedef int posix_clockid_t;
    6258
     59#ifndef LIBPOSIX_INTERNAL
     60        #define ino_t posix_ino_t
     61        #define nlink_t posix_nlink_t
     62        #define uid_t posix_uid_t
     63        #define gid_t posix_gid_t
     64        #define off_t posix_off_t
     65        #define blksize_t posix_blksize_t
     66        #define blkcnt_t posix_blkcnt_t
     67        #define pid_t posix_pid_t
     68        #define dev_t posix_dev_t
     69       
     70        #define pthread_attr_t posix_thread_attr_t
     71       
     72        #define clock_t posix_clock_t
     73        #define clockid_t posix_clockid_t
     74#endif
    6375
    6476#endif /* POSIX_SYS_TYPES_H_ */
  • uspace/lib/posix/include/posix/sys/wait.h

    r8ab339e r088b334  
    3636#define POSIX_SYS_WAIT_H_
    3737
    38 #ifndef __POSIX_DEF__
    39 #define __POSIX_DEF__(x) x
    40 #endif
    41 
    4238#include "types.h"
    4339
     
    5652extern int __posix_wtermsig(int status);
    5753
    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);
     54extern posix_pid_t posix_wait(int *stat_ptr);
     55extern posix_pid_t posix_waitpid(posix_pid_t pid, int *stat_ptr, int options);
    6056
     57#ifndef LIBPOSIX_INTERNAL
     58        #define wait posix_wait
     59        #define waitpid posix_waitpid
     60#endif
    6161
    6262#endif /* POSIX_SYS_WAIT_H_ */
  • uspace/lib/posix/include/posix/time.h

    r8ab339e r088b334  
    3737#define POSIX_TIME_H_
    3838
    39 #ifndef __POSIX_DEF__
    40 #define __POSIX_DEF__(x) x
    41 #endif
    42 
    4339#include "sys/types.h"
    4440
     
    5349#ifndef __locale_t_defined
    5450        #define __locale_t_defined
    55         typedef struct __posix_locale *__POSIX_DEF__(locale_t);
     51        typedef struct __posix_locale *posix_locale_t;
    5652        #ifndef LIBPOSIX_INTERNAL
    57                 #define locale_t __POSIX_DEF__(locale_t)
     53                #define locale_t posix_locale_t
    5854        #endif
    5955#endif
    6056
    6157#ifndef POSIX_SIGNAL_H_
    62         struct __POSIX_DEF__(sigevent);
     58        struct posix_sigevent;
    6359        #ifndef LIBPOSIX_INTERNAL
    64                 #define sigevent __POSIX_DEF__(sigevent)
     60                #define sigevent posix_sigevent
    6561        #endif
    6662#endif
    6763
    6864#undef CLOCK_REALTIME
    69 #define CLOCK_REALTIME ((__POSIX_DEF__(clockid_t)) 0)
     65#define CLOCK_REALTIME ((posix_clockid_t) 0)
    7066
    71 struct __POSIX_DEF__(timespec) {
     67struct posix_timespec {
    7268        time_t tv_sec; /* Seconds. */
    7369        long tv_nsec; /* Nanoseconds. */
    7470};
    7571
    76 struct __POSIX_DEF__(itimerspec) {
    77         struct __POSIX_DEF__(timespec) it_interval; /* Timer period. */
    78         struct __POSIX_DEF__(timespec) it_value; /* Timer expiration. */
     72struct posix_itimerspec {
     73        struct posix_timespec it_interval; /* Timer period. */
     74        struct posix_timespec it_value; /* Timer expiration. */
    7975};
    8076
    81 typedef struct __posix_timer *__POSIX_DEF__(timer_t);
     77typedef struct __posix_timer *posix_timer_t;
    8278
    8379/* Timezones */
    84 extern int __POSIX_DEF__(daylight);
    85 extern long __POSIX_DEF__(timezone);
    86 extern char *__POSIX_DEF__(tzname)[2];
    87 extern void __POSIX_DEF__(tzset)(void);
     80extern int posix_daylight;
     81extern long posix_timezone;
     82extern char *posix_tzname[2];
     83extern void posix_tzset(void);
    8884
    8985/* Broken-down Time */
    90 extern struct tm *__POSIX_DEF__(gmtime_r)(const time_t *restrict timer,
     86extern struct tm *posix_gmtime_r(const time_t *restrict timer,
    9187    struct tm *restrict result);
    92 extern struct tm *__POSIX_DEF__(gmtime)(const time_t *restrict timep);
    93 extern struct tm *__POSIX_DEF__(localtime_r)(const time_t *restrict timer,
     88extern struct tm *posix_gmtime(const time_t *restrict timep);
     89extern struct tm *posix_localtime_r(const time_t *restrict timer,
    9490    struct tm *restrict result);
    95 extern struct tm *__POSIX_DEF__(localtime)(const time_t *restrict timep);
     91extern struct tm *posix_localtime(const time_t *restrict timep);
    9692
    9793/* Formatting Calendar Time */
    98 extern char *__POSIX_DEF__(asctime_r)(const struct tm *restrict timeptr,
     94extern char *posix_asctime_r(const struct tm *restrict timeptr,
    9995    char *restrict buf);
    100 extern char *__POSIX_DEF__(asctime)(const struct tm *restrict timeptr);
    101 extern char *__POSIX_DEF__(ctime_r)(const time_t *timer, char *buf);
    102 extern char *__POSIX_DEF__(ctime)(const time_t *timer);
     96extern char *posix_asctime(const struct tm *restrict timeptr);
     97extern char *posix_ctime_r(const time_t *timer, char *buf);
     98extern char *posix_ctime(const time_t *timer);
    10399
    104100/* Clocks */
    105 extern int __POSIX_DEF__(clock_getres)(__POSIX_DEF__(clockid_t) clock_id,
    106     struct __POSIX_DEF__(timespec) *res);
    107 extern int __POSIX_DEF__(clock_gettime)(__POSIX_DEF__(clockid_t) clock_id,
    108     struct __POSIX_DEF__(timespec) *tp);
    109 extern int __POSIX_DEF__(clock_settime)(__POSIX_DEF__(clockid_t) clock_id,
    110     const struct __POSIX_DEF__(timespec) *tp);
    111 extern int __POSIX_DEF__(clock_nanosleep)(__POSIX_DEF__(clockid_t) clock_id, int flags,
    112     const struct __POSIX_DEF__(timespec) *rqtp, struct __POSIX_DEF__(timespec) *rmtp);
     101extern int posix_clock_getres(posix_clockid_t clock_id,
     102    struct posix_timespec *res);
     103extern int posix_clock_gettime(posix_clockid_t clock_id,
     104    struct posix_timespec *tp);
     105extern int posix_clock_settime(posix_clockid_t clock_id,
     106    const struct posix_timespec *tp);
     107extern int posix_clock_nanosleep(posix_clockid_t clock_id, int flags,
     108    const struct posix_timespec *rqtp, struct posix_timespec *rmtp);
    113109
    114110/* CPU Time */
    115 extern __POSIX_DEF__(clock_t) __POSIX_DEF__(clock)(void);
     111extern posix_clock_t posix_clock(void);
    116112
     113#ifndef LIBPOSIX_INTERNAL
     114        #define timespec    posix_timespec
     115        #define itimerspec  posix_itimerspec
     116        #define timer_t     posix_timer_t
     117
     118        #define daylight    posix_daylight
     119        #define timezone    posix_timezone
     120        #define tzname      posix_tzname
     121        #define tzset       posix_tzset
     122
     123        #define gmtime_r    posix_gmtime_r
     124        #define gmtime      posix_gmtime
     125        #define localtime_r posix_localtime_r
     126        #define localtime   posix_localtime
     127
     128        #define asctime_r   posix_asctime_r
     129        #define asctime     posix_asctime
     130        #define ctime_r     posix_ctime_r
     131        #define ctime       posix_ctime
     132
     133        #define clock_getres posix_clock_getres
     134        #define clock_gettime posix_clock_gettime
     135        #define clock_settime posix_clock_settime
     136        #define clock_nanosleep posix_clock_nanosleep
     137
     138        #define clock posix_clock
     139#endif
    117140
    118141#endif  // POSIX_TIME_H_
  • uspace/lib/posix/include/posix/unistd.h

    r8ab339e r088b334  
    3737#define POSIX_UNISTD_H_
    3838
    39 #ifndef __POSIX_DEF__
    40 #define __POSIX_DEF__(x) x
    41 #endif
    42 
    4339#include "sys/types.h"
    4440#include "stddef.h"
     
    4743#define _exit exit
    4844
    49 extern char *__POSIX_DEF__(optarg);
     45extern char *posix_optarg;
    5046extern int optind, opterr, optopt;
    51 extern int __POSIX_DEF__(getopt)(int, char * const [], const char *);
     47extern int posix_getopt(int, char * const [], const char *);
    5248
    5349/* Environment */
    54 extern char **__POSIX_DEF__(environ);
     50extern char **posix_environ;
    5551
    5652/* Login Information */
    57 extern char *__POSIX_DEF__(getlogin)(void);
    58 extern int __POSIX_DEF__(getlogin_r)(char *name, size_t namesize);
     53extern char *posix_getlogin(void);
     54extern int posix_getlogin_r(char *name, size_t namesize);
    5955
    6056/* Identifying Terminals */
    61 extern int __POSIX_DEF__(isatty)(int fd);
     57extern int posix_isatty(int fd);
    6258
    6359/* Working Directory */
    64 extern char *__POSIX_DEF__(getcwd)(char *buf, size_t size);
    65 extern int __POSIX_DEF__(chdir)(const char *path);
     60extern char *posix_getcwd(char *buf, size_t size);
     61extern int posix_chdir(const char *path);
    6662
    6763/* Query Memory Parameters */
    68 extern int __POSIX_DEF__(getpagesize)(void);
     64extern int posix_getpagesize(void);
    6965
    7066/* Process Identification */
    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);
     67extern posix_pid_t posix_getpid(void);
     68extern posix_uid_t posix_getuid(void);
     69extern posix_gid_t posix_getgid(void);
    7470
    7571/* File Manipulation */
    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);
     72extern int posix_close(int fildes);
     73extern ssize_t posix_read(int fildes, void *buf, size_t nbyte);
     74extern ssize_t posix_write(int fildes, const void *buf, size_t nbyte);
     75extern int posix_fsync(int fildes);
     76extern int posix_ftruncate(int fildes, posix_off_t length);
     77extern int posix_rmdir(const char *path);
     78extern int posix_unlink(const char *path);
     79extern int posix_dup(int fildes);
     80extern int posix_dup2(int fildes, int fildes2);
    8581
    8682/* Standard Streams */
     
    10197#define W_OK 2 /* Test for write permission. */
    10298#define R_OK 4 /* Test for read permission. */
    103 extern int __POSIX_DEF__(access)(const char *path, int amode);
     99extern int posix_access(const char *path, int amode);
    104100
    105101/* System Parameters */
     
    110106        _SC_CLK_TCK
    111107};
    112 extern long __POSIX_DEF__(sysconf)(int name);
     108extern long posix_sysconf(int name);
    113109
    114110/* Path Configuration Parameters */
     
    134130        _PC_VDISABLE
    135131};
    136 extern long __POSIX_DEF__(pathconf)(const char *path, int name);
     132extern long posix_pathconf(const char *path, int name);
    137133
    138134/* Creating a Process */
    139 extern __POSIX_DEF__(pid_t) __POSIX_DEF__(fork)(void);
     135extern posix_pid_t posix_fork(void);
    140136
    141137/* Executing a File */
    142 extern int __POSIX_DEF__(execv)(const char *path, char *const argv[]);
    143 extern int __POSIX_DEF__(execvp)(const char *file, char *const argv[]);
     138extern int posix_execv(const char *path, char *const argv[]);
     139extern int posix_execvp(const char *file, char *const argv[]);
    144140
    145141/* Creating a Pipe */
    146 extern int __POSIX_DEF__(pipe)(int fildes[2]);
     142extern int posix_pipe(int fildes[2]);
    147143
     144#ifndef LIBPOSIX_INTERNAL
     145        #define getopt posix_getopt
     146        #define optarg posix_optarg
     147
     148        #define environ posix_environ
     149
     150        #define getlogin posix_getlogin
     151        #define getlogin_r posix_getlogin_r
     152
     153        #define getcwd posix_getcwd
     154        #define chdir posix_chdir
     155
     156        #define isatty posix_isatty
     157
     158        #undef getpagesize
     159        #define getpagesize posix_getpagesize
     160
     161        #define getpid posix_getpid
     162        #define getuid posix_getuid
     163        #define getgid posix_getgid
     164
     165        #define close posix_close
     166        #define read posix_read
     167        #define write posix_write
     168        #define fsync posix_fsync
     169        #define ftruncate posix_ftruncate
     170        #define rmdir posix_rmdir
     171        #define unlink posix_unlink
     172        #define dup posix_dup
     173        #define dup2 posix_dup2
     174
     175        #define access posix_access
     176
     177        #define sysconf posix_sysconf
     178
     179        #define pathconf posix_pathconf
     180
     181        #define fork posix_fork
     182
     183        #define execv posix_execv
     184        #define execvp posix_execvp
     185
     186        #define pipe posix_pipe
     187#endif
    148188
    149189#endif /* POSIX_UNISTD_H_ */
  • uspace/lib/posix/source/ctype.c

    r8ab339e r088b334  
    3535
    3636#define LIBPOSIX_INTERNAL
    37 #define __POSIX_DEF__(x) posix_##x
    3837
    3938#include "posix/ctype.h"
  • uspace/lib/posix/source/errno.c

    r8ab339e r088b334  
    3232/** @file System error numbers.
    3333 */
    34 #define LIBPOSIX_INTERNAL
    35 #define __POSIX_DEF__(x) posix_##x
    3634
    3735#include "posix/errno.h"
     
    4543{
    4644        if (*__errno() != 0) {
    47                 _posix_errno = posix_abs(*__errno());
     45                _posix_errno = abs(*__errno());
    4846                *__errno() = 0;
    4947        }
  • uspace/lib/posix/source/fcntl.c

    r8ab339e r088b334  
    3434
    3535#define LIBPOSIX_INTERNAL
    36 #define __POSIX_DEF__(x) posix_##x
    3736
    3837#include "internal/common.h"
  • uspace/lib/posix/source/fnmatch.c

    r8ab339e r088b334  
    4343
    4444#define LIBPOSIX_INTERNAL
    45 #define __POSIX_DEF__(x) posix_##x
    4645
    4746#include "libc/stdbool.h"
  • uspace/lib/posix/source/getopt.c

    r8ab339e r088b334  
    3333 */
    3434#define LIBPOSIX_INTERNAL
    35 #define __POSIX_DEF__(x) posix_##x
    3635
    3736#include "internal/common.h"
  • uspace/lib/posix/source/locale.c

    r8ab339e r088b334  
    3434
    3535#define LIBPOSIX_INTERNAL
    36 #define __POSIX_DEF__(x) posix_##x
    3736
    3837#include "internal/common.h"
  • uspace/lib/posix/source/math.c

    r8ab339e r088b334  
    3434
    3535#define LIBPOSIX_INTERNAL
    36 #define __POSIX_DEF__(x) posix_##x
    3736
    3837#include "internal/common.h"
  • uspace/lib/posix/source/pwd.c

    r8ab339e r088b334  
    3434
    3535#define LIBPOSIX_INTERNAL
    36 #define __POSIX_DEF__(x) posix_##x
    3736
    3837#include "libc/stdbool.h"
  • uspace/lib/posix/source/signal.c

    r8ab339e r088b334  
    3434
    3535#define LIBPOSIX_INTERNAL
    36 #define __POSIX_DEF__(x) posix_##x
    3736
    3837#include "posix/signal.h"
  • uspace/lib/posix/source/stdio.c

    r8ab339e r088b334  
    3535
    3636#define LIBPOSIX_INTERNAL
    37 #define __POSIX_DEF__(x) posix_##x
    3837
    3938#include "internal/common.h"
  • uspace/lib/posix/source/stdio/scanf.c

    r8ab339e r088b334  
    3434
    3535#define LIBPOSIX_INTERNAL
    36 #define __POSIX_DEF__(x) posix_##x
    3736
    3837#include "posix/assert.h"
  • uspace/lib/posix/source/stdlib.c

    r8ab339e r088b334  
    3535
    3636#define LIBPOSIX_INTERNAL
    37 #define __POSIX_DEF__(x) posix_##x
    3837
    3938#include "internal/common.h"
  • uspace/lib/posix/source/stdlib/strtol.c

    r8ab339e r088b334  
    3434
    3535#define LIBPOSIX_INTERNAL
    36 #define __POSIX_DEF__(x) posix_##x
    3736
    3837#include "../internal/common.h"
  • uspace/lib/posix/source/stdlib/strtold.c

    r8ab339e r088b334  
    3434
    3535#define LIBPOSIX_INTERNAL
    36 #define __POSIX_DEF__(x) posix_##x
    3736
    3837#include "../internal/common.h"
  • uspace/lib/posix/source/string.c

    r8ab339e r088b334  
    3535
    3636#define LIBPOSIX_INTERNAL
    37 #define __POSIX_DEF__(x) posix_##x
    3837
    3938#include "internal/common.h"
  • uspace/lib/posix/source/strings.c

    r8ab339e r088b334  
    3535
    3636#define LIBPOSIX_INTERNAL
    37 #define __POSIX_DEF__(x) posix_##x
    3837
    3938#include "internal/common.h"
  • uspace/lib/posix/source/sys/stat.c

    r8ab339e r088b334  
    3535
    3636#define LIBPOSIX_INTERNAL
    37 #define __POSIX_DEF__(x) posix_##x
    3837
    3938#include "../internal/common.h"
  • uspace/lib/posix/source/sys/wait.c

    r8ab339e r088b334  
    3535
    3636#define LIBPOSIX_INTERNAL
    37 #define __POSIX_DEF__(x) posix_##x
    3837
    3938#include "../internal/common.h"
  • uspace/lib/posix/source/time.c

    r8ab339e r088b334  
    3535
    3636#define LIBPOSIX_INTERNAL
    37 #define __POSIX_DEF__(x) posix_##x
    3837
    3938#include "internal/common.h"
  • uspace/lib/posix/source/unistd.c

    r8ab339e r088b334  
    3535
    3636#define LIBPOSIX_INTERNAL
    37 #define __POSIX_DEF__(x) posix_##x
    3837
    3938#include "internal/common.h"
Note: See TracChangeset for help on using the changeset viewer.