Changeset 4c53333 in mainline for uspace/lib/posix


Ignore:
Timestamp:
2013-07-11T08:21:10Z (13 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
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.
Message:

merge mainline changes

Location:
uspace/lib/posix
Files:
16 added
5 deleted
1 edited
39 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/Makefile

    r80445cf r4c53333  
    3333LSONAME = libposix.so0
    3434
    35 INCLUDE_LIBC = ./libc
     35EXTRA_CFLAGS = -Iinclude/
     36
     37INCLUDE_LIBC = ./include/libc
     38
     39LIBC_FILE = $(LIBC_PREFIX)/libc.a
     40
     41FIXED_POSIX_LIBRARY = libposixaslibc.a
     42FIXED_C_LIBRARY = libc4posix.a
     43
     44REDEFS_HIDE_LIBC = redefs-hide-libc.xargs
     45REDEFS_SHOW_LIBPOSIX = redefs-show-posix.xargs
     46COLLISIONS_LIST = collisions.list
    3647
    3748PRE_DEPEND = $(INCLUDE_LIBC)
    38 EXTRA_CLEAN = $(INCLUDE_LIBC)
     49EXTRA_CLEAN = \
     50        $(INCLUDE_LIBC) \
     51        $(REDEFS_HIDE_LIBC) $(REDEFS_SHOW_LIBPOSIX) \
     52        $(COLLISIONS_LIST)
     53EXTRA_OUTPUT = $(FIXED_C_LIBRARY) $(FIXED_POSIX_LIBRARY)
    3954
    4055SOURCES = \
    41         ctype.c \
    42         errno.c \
    43         fcntl.c \
    44         fnmatch.c \
    45         locale.c \
    46         math.c \
    47         pwd.c \
    48         signal.c \
    49         stdio.c \
    50         stdio/scanf.c \
    51         stdlib.c \
    52         stdlib/strtol.c \
    53         stdlib/strtold.c \
    54         string.c \
    55         strings.c \
    56         sys/stat.c \
    57         sys/wait.c \
    58         time.c \
    59         unistd.c
     56        source/ctype.c \
     57        source/errno.c \
     58        source/fcntl.c \
     59        source/fnmatch.c \
     60        source/getopt.c \
     61        source/locale.c \
     62        source/math.c \
     63        source/pwd.c \
     64        source/signal.c \
     65        source/stdio.c \
     66        source/stdio/scanf.c \
     67        source/stdlib.c \
     68        source/stdlib/strtol.c \
     69        source/stdlib/strtold.c \
     70        source/string.c \
     71        source/strings.c \
     72        source/sys/stat.c \
     73        source/sys/wait.c \
     74        source/time.c \
     75        source/unistd.c
    6076
    6177include $(USPACE_PREFIX)/Makefile.common
    6278
    6379$(INCLUDE_LIBC): ../c/include
    64         ln -s -f -n $^ $@
     80        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

    r80445cf r4c53333  
    3737#define POSIX_CTYPE_H_
    3838
     39#ifndef __POSIX_DEF__
     40#define __POSIX_DEF__(x) x
     41#endif
     42
    3943#include "libc/ctype.h"
    4044
    4145/* 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);
     46extern int __POSIX_DEF__(isxdigit)(int c);
     47extern int __POSIX_DEF__(isblank)(int c);
     48extern int __POSIX_DEF__(iscntrl)(int c);
     49extern int __POSIX_DEF__(isgraph)(int c);
     50extern int __POSIX_DEF__(isprint)(int c);
     51extern int __POSIX_DEF__(ispunct)(int c);
    4852
    4953/* Obsolete Functions and Macros */
    50 extern int posix_isascii(int c);
    51 extern int posix_toascii(int c);
     54extern int __POSIX_DEF__(isascii)(int c);
     55extern int __POSIX_DEF__(toascii)(int c);
    5256#undef _tolower
    5357#define _tolower(c) ((c) - 'A' + 'a')
     
    5660
    5761
    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
    6962
    7063#endif /* POSIX_CTYPE_H_ */
  • uspace/lib/posix/include/posix/fcntl.h

    r80445cf r4c53333  
    3636#define POSIX_FCNTL_H_
    3737
     38#ifndef __POSIX_DEF__
     39#define __POSIX_DEF__(x) x
     40#endif
     41
    3842#include "sys/types.h"
    3943#include "libc/fcntl.h"
     
    4347#undef O_ACCMODE
    4448#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
     49
     50/* Dummy compatibility flag */
     51#undef O_NOCTTY
     52#define O_NOCTTY 0
    4553
    4654/* fcntl commands */
     
    7280#define FD_CLOEXEC         1 /* Close on exec. */
    7381
    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         })
     82extern int __POSIX_DEF__(open)(const char *pathname, int flags, ...);
     83extern int __POSIX_DEF__(fcntl)(int fd, int cmd, ...);
    8484
    85 extern int posix_fcntl(int fd, int cmd, ...);
    86 
    87 #ifndef LIBPOSIX_INTERNAL
    88         #define fcntl posix_fcntl
    89 #endif
    9085
    9186#endif /* POSIX_FCNTL_H_ */
  • uspace/lib/posix/include/posix/fnmatch.h

    r80445cf r4c53333  
    3636#define POSIX_FNMATCH_H_
    3737
     38#ifndef __POSIX_DEF__
     39#define __POSIX_DEF__(x) x
     40#endif
     41
    3842/* Error Values */
    3943#undef FNM_NOMATCH
     
    5660#define FNM_CASEFOLD 16
    5761
    58 extern int posix_fnmatch(const char *pattern, const char *string, int flags);
     62extern int __POSIX_DEF__(fnmatch)(const char *pattern, const char *string, int flags);
    5963
    60 #ifndef LIBPOSIX_INTERNAL
    61         #define fnmatch posix_fnmatch
    62 #endif
    6364
    6465#endif /* POSIX_FNMATCH_H_ */
  • uspace/lib/posix/include/posix/getopt.h

    r80445cf r4c53333  
    11/*
    2  * Copyright (c) 2011 Petr Koupy
     2 * Copyright (c) 2012 Vojtech Horky
    33 * All rights reserved.
    44 *
     
    3030 * @{
    3131 */
    32 /** @file Mathematical operations.
     32/** @file Command line argument parsing.
    3333 */
     34#ifndef POSIX_GETOPT_H
     35#define POSIX_GETOPT_H
    3436
    35 #define LIBPOSIX_INTERNAL
     37#ifndef __POSIX_DEF__
     38#define __POSIX_DEF__(x) x
     39#endif
    3640
    37 #include "internal/common.h"
    38 #include "math.h"
     41#include "unistd.h"
    3942
     43/* Option Arguments */
     44#define no_argument        0
     45#define required_argument  1
     46#define optional_argument  2
     47
     48#ifndef LIBPOSIX_INTERNAL
     49struct option {
     50        const char *name;
     51        int has_arg;
     52        int *flag;
     53        int val;
     54};
     55#endif
     56
     57extern int __POSIX_DEF__(getopt_long)(int, char * const [], const char *, const struct option *, int *);
     58
     59
     60#endif
    4061/**
    41  *
    42  * @param x
    43  * @param exp
    44  * @return
     62 * @}
    4563 */
    46 double posix_ldexp(double x, int exp)
    47 {
    48         // TODO: low priority, just a compile-time dependency of binutils
    49         not_implemented();
    50 }
    51 
    52 /**
    53  *
    54  * @param num
    55  * @param exp
    56  * @return
    57  */
    58 double posix_frexp(double num, int *exp)
    59 {
    60         // TODO: low priority, just a compile-time dependency of binutils
    61         not_implemented();
    62 }
    63 
    64 /** @}
    65  */
  • uspace/lib/posix/include/posix/inttypes.h

    r80445cf r4c53333  
    3636#define POSIX_INTTYPES_H_
    3737
     38#ifndef __POSIX_DEF__
     39#define __POSIX_DEF__(x) x
     40#endif
     41
    3842#include "stdint.h"
    3943#include "libc/inttypes.h"
    4044
    41 extern posix_intmax_t posix_strtoimax(const char *restrict nptr,
     45extern __POSIX_DEF__(intmax_t) __POSIX_DEF__(strtoimax)(const char *restrict nptr,
    4246    char **restrict endptr, int base);
    43 extern posix_uintmax_t posix_strtoumax(const char *restrict nptr,
     47extern __POSIX_DEF__(uintmax_t) __POSIX_DEF__(strtoumax)(const char *restrict nptr,
    4448    char **restrict endptr, int base);
    4549
    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/limits.h

    r80445cf r4c53333  
    4949#define PATH_MAX 256
    5050
     51/* it's probably a safe assumption */
     52#undef CHAR_BIT
     53#define CHAR_BIT 8
     54
    5155#endif /* POSIX_LIMITS_H_ */
    5256
  • uspace/lib/posix/include/posix/locale.h

    r80445cf r4c53333  
    3636#define POSIX_LOCALE_H_
    3737
     38#ifndef __POSIX_DEF__
     39#define __POSIX_DEF__(x) x
     40#endif
     41
    3842#ifndef NULL
    3943        #define NULL ((void *) 0)
     
    4246#ifndef __locale_t_defined
    4347        #define __locale_t_defined
    44         typedef struct __posix_locale *posix_locale_t;
     48        typedef struct __posix_locale *__POSIX_DEF__(locale_t);
    4549        #ifndef LIBPOSIX_INTERNAL
    46                 #define locale_t posix_locale_t
     50                #define locale_t __POSIX_DEF__(locale_t)
    4751        #endif
    4852#endif
     
    8286#define LC_GLOBAL_LOCALE NULL
    8387
    84 struct posix_lconv {
     88struct __POSIX_DEF__(lconv) {
    8589        char *currency_symbol;
    8690        char *decimal_point;
     
    109113};
    110114
    111 extern char *posix_setlocale(int category, const char *locale);
    112 extern struct posix_lconv *posix_localeconv(void);
     115extern char *__POSIX_DEF__(setlocale)(int category, const char *locale);
     116extern struct __POSIX_DEF__(lconv) *__POSIX_DEF__(localeconv)(void);
    113117
    114118/* POSIX Extensions */
    115 extern posix_locale_t posix_duplocale(posix_locale_t locobj);
    116 extern void posix_freelocale(posix_locale_t locobj);
    117 extern posix_locale_t posix_newlocale(int category_mask, const char *locale,
    118     posix_locale_t base);
    119 extern posix_locale_t posix_uselocale(posix_locale_t newloc);
     119extern __POSIX_DEF__(locale_t) __POSIX_DEF__(duplocale)(__POSIX_DEF__(locale_t) locobj);
     120extern void __POSIX_DEF__(freelocale)(__POSIX_DEF__(locale_t) locobj);
     121extern __POSIX_DEF__(locale_t) __POSIX_DEF__(newlocale)(int category_mask, const char *locale,
     122    __POSIX_DEF__(locale_t) base);
     123extern __POSIX_DEF__(locale_t) __POSIX_DEF__(uselocale)(__POSIX_DEF__(locale_t) newloc);
    120124
    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
    132125
    133126#endif /* POSIX_LOCALE_H_ */
  • uspace/lib/posix/include/posix/malloc.h

    r80445cf r4c53333  
    11/*
    2  * Copyright (c) 2011 Petr Koupy
     2 * Copyright (c) 2012 Vojtech Horky
    33 * All rights reserved.
    44 *
     
    3030 * @{
    3131 */
    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_
    3734
    3835/* Empty. Just to satisfy preprocessor. */
    3936
    40 #endif /* POSIX_FLOAT_H_ */
     37#endif /* POSIX_MALLOC_H_ */
    4138
    4239/** @}
  • uspace/lib/posix/include/posix/pwd.h

    r80445cf r4c53333  
    3636#define POSIX_PWD_H_
    3737
     38#ifndef __POSIX_DEF__
     39#define __POSIX_DEF__(x) x
     40#endif
     41
    3842#include "sys/types.h"
    3943
    40 struct posix_passwd {
     44struct __POSIX_DEF__(passwd) {
    4145        char *pw_name;
    42         posix_uid_t pw_uid;
    43         posix_gid_t pw_gid;
     46        __POSIX_DEF__(uid_t) pw_uid;
     47        __POSIX_DEF__(gid_t) pw_gid;
    4448        char *pw_dir;
    4549        char *pw_shell;
    4650};
    4751
    48 extern struct posix_passwd *posix_getpwent(void);
    49 extern void posix_setpwent(void);
    50 extern void posix_endpwent(void);
     52extern struct __POSIX_DEF__(passwd) *__POSIX_DEF__(getpwent)(void);
     53extern void __POSIX_DEF__(setpwent)(void);
     54extern void __POSIX_DEF__(endpwent)(void);
    5155
    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);
     56extern struct __POSIX_DEF__(passwd) *__POSIX_DEF__(getpwnam)(const char *name);
     57extern int __POSIX_DEF__(getpwnam_r)(const char *name, struct __POSIX_DEF__(passwd) *pwd,
     58    char *buffer, size_t bufsize, struct __POSIX_DEF__(passwd) **result);
    5559
    56 extern struct posix_passwd *posix_getpwuid(posix_uid_t uid);
    57 extern int posix_getpwuid_r(posix_uid_t uid, struct posix_passwd *pwd,
    58     char *buffer, size_t bufsize, struct posix_passwd **result);
     60extern struct __POSIX_DEF__(passwd) *__POSIX_DEF__(getpwuid)(__POSIX_DEF__(uid_t) uid);
     61extern 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);
    5963
    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
    7364
    7465#endif /* POSIX_PWD_H_ */
  • uspace/lib/posix/include/posix/signal.h

    r80445cf r4c53333  
    3636#define POSIX_SIGNAL_H_
    3737
    38 #include "libc/errno.h"
     38#ifndef __POSIX_DEF__
     39#define __POSIX_DEF__(x) x
     40#endif
     41
    3942#include "sys/types.h"
     43#include <posix/ucontext.h>
    4044
    4145extern void __posix_default_signal_handler(int signo);
     
    5256#define SIG_IGN ((void (*)(int)) __posix_ignore_signal_handler)
    5357
    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 };
    7358
    7459typedef struct {
     
    7863        int si_errno;
    7964
    80         posix_pid_t si_pid;
    81         posix_uid_t si_uid;
     65        __POSIX_DEF__(pid_t) si_pid;
     66        __POSIX_DEF__(uid_t) si_uid;
    8267        void *si_addr;
    8368        int si_status;
     
    8570        long si_band;
    8671
    87         union posix_sigval si_value;
    88 } posix_siginfo_t;
    89 
    90 struct posix_sigaction {
     72        union __POSIX_DEF__(sigval) si_value;
     73} __POSIX_DEF__(siginfo_t);
     74
     75struct __POSIX_DEF__(sigaction) {
    9176        void (*sa_handler)(int);
    92         posix_sigset_t sa_mask;
     77        __POSIX_DEF__(sigset_t) sa_mask;
    9378        int sa_flags;
    94         void (*sa_sigaction)(int, posix_siginfo_t *, void *);
     79        void (*sa_sigaction)(int, __POSIX_DEF__(siginfo_t) *, void *);
    9580};
    9681
    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 */
    11184#undef SIGEV_NONE
    11285#undef SIGEV_SIGNAL
     
    256229};
    257230
    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
     231extern int __POSIX_DEF__(sigaction)(int sig, const struct __POSIX_DEF__(sigaction) *restrict act,
     232    struct __POSIX_DEF__(sigaction) *restrict oact);
     233
     234extern void (*__POSIX_DEF__(signal)(int sig, void (*func)(int)))(int);
     235extern int __POSIX_DEF__(raise)(int sig);
     236extern int __POSIX_DEF__(kill)(__POSIX_DEF__(pid_t) pid, int sig);
     237extern int __POSIX_DEF__(killpg)(__POSIX_DEF__(pid_t) pid, int sig);
     238
     239extern void __POSIX_DEF__(psiginfo)(const __POSIX_DEF__(siginfo_t) *pinfo, const char *message);
     240extern void __POSIX_DEF__(psignal)(int signum, const char *message);
     241
     242extern int __POSIX_DEF__(sigemptyset)(__POSIX_DEF__(sigset_t) *set);
     243extern int __POSIX_DEF__(sigfillset)(__POSIX_DEF__(sigset_t) *set);
     244extern int __POSIX_DEF__(sigaddset)(__POSIX_DEF__(sigset_t) *set, int signo);
     245extern int __POSIX_DEF__(sigdelset)(__POSIX_DEF__(sigset_t) *set, int signo);
     246extern int __POSIX_DEF__(sigismember)(const __POSIX_DEF__(sigset_t) *set, int signo);
     247
     248extern int __POSIX_DEF__(thread_sigmask)(int how, const __POSIX_DEF__(sigset_t) *restrict set,
     249    __POSIX_DEF__(sigset_t) *restrict oset);
     250extern int __POSIX_DEF__(sigprocmask)(int how, const __POSIX_DEF__(sigset_t) *restrict set,
     251    __POSIX_DEF__(sigset_t) *restrict oset);
     252
    311253
    312254#endif /* POSIX_SIGNAL_H_ */
  • uspace/lib/posix/include/posix/stddef.h

    r80445cf r4c53333  
    3636#define POSIX_STDDEF_H_
    3737
    38 #include "libc/stddef.h"
     38#ifndef __POSIX_DEF__
     39#define __POSIX_DEF__(x) x
     40#endif
     41
     42#include "sys/types.h"
    3943
    4044#ifndef NULL
     
    4448#define offsetof(type,member) ((size_t) &(((type *) 0)->member))
    4549
    46 typedef ssize_t posix_ptrdiff_t;
     50typedef ssize_t __POSIX_DEF__(ptrdiff_t);
    4751
    48 #ifndef LIBPOSIX_INTERNAL
    49         #define ptrdiff_t posix_ptrdiff_t
    50 #endif
    5152
    5253#endif /* POSIX_STDDEF_H_ */
  • uspace/lib/posix/include/posix/stdint.h

    r80445cf r4c53333  
    3535#ifndef POSIX_STDINT_H_
    3636#define POSIX_STDINT_H_
     37
     38#ifndef __POSIX_DEF__
     39#define __POSIX_DEF__(x) x
     40#endif
    3741
    3842#include "libc/stdint.h"
     
    100104#include "libc/sys/types.h"
    101105
    102 typedef int64_t posix_intmax_t;
    103 typedef uint64_t posix_uintmax_t;
     106typedef int64_t __POSIX_DEF__(intmax_t);
     107typedef uint64_t __POSIX_DEF__(uintmax_t);
    104108
    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/strings.h

    r80445cf r4c53333  
    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
    3946/* Search Functions */
    4047#ifndef POSIX_STRING_H_
    41 extern int posix_ffs(int i);
     48extern int __POSIX_DEF__(ffs)(int i);
    4249#endif
    4350
    4451/* String/Array Comparison */
    4552#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);
     53extern int __POSIX_DEF__(strcasecmp)(const char *s1, const char *s2);
     54extern int __POSIX_DEF__(strncasecmp)(const char *s1, const char *s2, size_t n);
    4855#endif
    4956
     
    5562
    5663/* 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);
     64extern int __POSIX_DEF__(bcmp)(const void *mem1, const void *mem2, size_t n);
     65extern void __POSIX_DEF__(bcopy)(const void *src, void *dest, size_t n);
     66extern void __POSIX_DEF__(bzero)(void *mem, size_t n);
     67extern char *__POSIX_DEF__(index)(const char *s, int c);
     68extern char *__POSIX_DEF__(rindex)(const char *s, int c);
    6269
    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
    7670
    7771#endif  // POSIX_STRINGS_H_
  • uspace/lib/posix/include/posix/sys/mman.h

    r80445cf r4c53333  
    3636#define POSIX_SYS_MMAN_H_
    3737
    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
    3952
    4053#undef PROT_NONE
     
    4356#undef PROT_EXEC
    4457#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
     62extern void *mmap(void *start, size_t length, int prot, int flags, int fd,
     63    __POSIX_DEF__(off_t) offset);
     64extern int munmap(void *start, size_t length);
     65
    4866
    4967#endif /* POSIX_SYS_MMAN_H_ */
  • uspace/lib/posix/include/posix/sys/stat.h

    r80445cf r4c53333  
    3737#define POSIX_SYS_STAT_H_
    3838
    39 #include "../libc/sys/stat.h"
    4039#include "types.h"
    4140#include "../time.h"
     41
     42#ifndef __POSIX_DEF__
     43#define __POSIX_DEF__(x) x
     44#endif
    4245
    4346/* values are the same as on Linux */
     
    109112#define S_ISSOCK(m) ((m & S_IFSOCK) != 0) /* socket? (Not in POSIX.1-1996.) */
    110113
    111 struct posix_stat {
    112         posix_dev_t     st_dev;     /* ID of device containing file */
    113         posix_ino_t     st_ino;     /* inode number */
     114struct __POSIX_DEF__(stat) {
     115        __POSIX_DEF__(dev_t)     st_dev;     /* ID of device containing file */
     116        __POSIX_DEF__(ino_t)     st_ino;     /* inode number */
    114117        mode_t          st_mode;    /* protection */
    115         posix_nlink_t   st_nlink;   /* number of hard links */
    116         posix_uid_t     st_uid;     /* user ID of owner */
    117         posix_gid_t     st_gid;     /* group ID of owner */
    118         posix_dev_t     st_rdev;    /* device ID (if special file) */
    119         posix_off_t     st_size;    /* total size, in bytes */
    120         posix_blksize_t st_blksize; /* blocksize for file system I/O */
    121         posix_blkcnt_t  st_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 */
    122125        time_t          st_atime;   /* time of last access */
    123126        time_t          st_mtime;   /* time of last modification */
     
    125128};
    126129
    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);
     130extern int __POSIX_DEF__(fstat)(int fd, struct __POSIX_DEF__(stat) *st);
     131extern int __POSIX_DEF__(lstat)(const char *restrict path, struct __POSIX_DEF__(stat) *restrict st);
     132extern int __POSIX_DEF__(stat)(const char *restrict path, struct __POSIX_DEF__(stat) *restrict st);
     133extern int __POSIX_DEF__(chmod)(const char *path, mode_t mode);
     134extern mode_t __POSIX_DEF__(umask)(mode_t mask);
     135extern int mkdir(const char *, mode_t);
    132136
    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
    140137
    141138#endif /* POSIX_SYS_STAT_H */
  • uspace/lib/posix/include/posix/sys/types.h

    r80445cf r4c53333  
    3737#define POSIX_SYS_TYPES_H_
    3838
    39 #include "../libc/sys/types.h"
     39#ifndef __POSIX_DEF__
     40#define __POSIX_DEF__(x) x
     41#endif
    4042
    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
     46typedef unsigned int __POSIX_DEF__(ino_t);
     47typedef unsigned int __POSIX_DEF__(nlink_t);
     48typedef unsigned int __POSIX_DEF__(uid_t);
     49typedef unsigned int __POSIX_DEF__(gid_t);
     50typedef off64_t __POSIX_DEF__(off_t);
     51typedef long __POSIX_DEF__(blksize_t);
     52typedef long __POSIX_DEF__(blkcnt_t);
     53typedef int64_t __POSIX_DEF__(pid_t);
     54typedef sysarg_t __POSIX_DEF__(dev_t);
    5055
    5156/* PThread Types */
    52 typedef struct posix_thread_attr posix_thread_attr_t;
     57typedef struct __POSIX_DEF__(thread_attr) __POSIX_DEF__(thread_attr_t);
    5358
    5459/* Clock Types */
    55 typedef long posix_clock_t;
    56 typedef int posix_clockid_t;
     60typedef long __POSIX_DEF__(clock_t);
     61typedef int __POSIX_DEF__(clockid_t);
    5762
    58 #ifndef LIBPOSIX_INTERNAL
    59         #define ino_t posix_ino_t
    60         #define nlink_t posix_nlink_t
    61         #define uid_t posix_uid_t
    62         #define gid_t posix_gid_t
    63         #define off_t posix_off_t
    64         #define blksize_t posix_blksize_t
    65         #define blkcnt_t posix_blkcnt_t
    66         #define pid_t posix_pid_t
    67         #define dev_t posix_dev_t
    68        
    69         #define pthread_attr_t posix_thread_attr_t
    70        
    71         #define clock_t posix_clock_t
    72         #define clockid_t posix_clockid_t
    73 #endif
    7463
    7564#endif /* POSIX_SYS_TYPES_H_ */
  • uspace/lib/posix/include/posix/sys/wait.h

    r80445cf r4c53333  
    3636#define POSIX_SYS_WAIT_H_
    3737
     38#ifndef __POSIX_DEF__
     39#define __POSIX_DEF__(x) x
     40#endif
     41
    3842#include "types.h"
    3943
     
    5256extern int __posix_wtermsig(int status);
    5357
    54 extern posix_pid_t posix_wait(int *stat_ptr);
    55 extern posix_pid_t posix_waitpid(posix_pid_t pid, int *stat_ptr, int options);
     58extern __POSIX_DEF__(pid_t) __POSIX_DEF__(wait)(int *stat_ptr);
     59extern __POSIX_DEF__(pid_t) __POSIX_DEF__(waitpid)(__POSIX_DEF__(pid_t) pid, int *stat_ptr, int options);
    5660
    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/unistd.h

    r80445cf r4c53333  
    3737#define POSIX_UNISTD_H_
    3838
    39 #include "libc/unistd.h"
     39#ifndef __POSIX_DEF__
     40#define __POSIX_DEF__(x) x
     41#endif
     42
    4043#include "sys/types.h"
     44#include "stddef.h"
    4145
    4246/* Process Termination */
    4347#define _exit exit
    4448
    45 /* Option Arguments */
    46 extern char *optarg;
     49extern char *__POSIX_DEF__(optarg);
    4750extern int optind, opterr, optopt;
    48 extern int getopt(int, char * const [], const char *);
     51extern int __POSIX_DEF__(getopt)(int, char * const [], const char *);
    4952
    5053/* Environment */
    51 extern char **posix_environ;
     54extern char **__POSIX_DEF__(environ);
    5255
    5356/* Login Information */
    54 extern char *posix_getlogin(void);
    55 extern int posix_getlogin_r(char *name, size_t namesize);
     57extern char *__POSIX_DEF__(getlogin)(void);
     58extern int __POSIX_DEF__(getlogin_r)(char *name, size_t namesize);
    5659
    5760/* Identifying Terminals */
    58 extern int posix_isatty(int fd);
     61extern int __POSIX_DEF__(isatty)(int fd);
    5962
    6063/* Working Directory */
    61 extern char *posix_getcwd(char *buf, size_t size);
    62 extern int posix_chdir(const char *path);
     64extern char *__POSIX_DEF__(getcwd)(char *buf, size_t size);
     65extern int __POSIX_DEF__(chdir)(const char *path);
    6366
    6467/* Query Memory Parameters */
    65 extern int posix_getpagesize(void);
     68extern int __POSIX_DEF__(getpagesize)(void);
    6669
    6770/* 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);
     71extern __POSIX_DEF__(pid_t) __POSIX_DEF__(getpid)(void);
     72extern __POSIX_DEF__(uid_t) __POSIX_DEF__(getuid)(void);
     73extern __POSIX_DEF__(gid_t) __POSIX_DEF__(getgid)(void);
    7174
    7275/* 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_t length);
    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);
     76extern int __POSIX_DEF__(close)(int fildes);
     77extern ssize_t __POSIX_DEF__(read)(int fildes, void *buf, size_t nbyte);
     78extern ssize_t __POSIX_DEF__(write)(int fildes, const void *buf, size_t nbyte);
     79extern int __POSIX_DEF__(fsync)(int fildes);
     80extern int __POSIX_DEF__(ftruncate)(int fildes, __POSIX_DEF__(off_t) length);
     81extern int __POSIX_DEF__(rmdir)(const char *path);
     82extern int __POSIX_DEF__(unlink)(const char *path);
     83extern int __POSIX_DEF__(dup)(int fildes);
     84extern int __POSIX_DEF__(dup2)(int fildes, int fildes2);
    8285
    8386/* Standard Streams */
     
    98101#define W_OK 2 /* Test for write permission. */
    99102#define R_OK 4 /* Test for read permission. */
    100 extern int posix_access(const char *path, int amode);
     103extern int __POSIX_DEF__(access)(const char *path, int amode);
    101104
    102105/* System Parameters */
     
    107110        _SC_CLK_TCK
    108111};
    109 extern long posix_sysconf(int name);
     112extern long __POSIX_DEF__(sysconf)(int name);
    110113
    111114/* Path Configuration Parameters */
     
    131134        _PC_VDISABLE
    132135};
    133 extern long posix_pathconf(const char *path, int name);
     136extern long __POSIX_DEF__(pathconf)(const char *path, int name);
    134137
    135138/* Creating a Process */
    136 extern posix_pid_t posix_fork(void);
     139extern __POSIX_DEF__(pid_t) __POSIX_DEF__(fork)(void);
    137140
    138141/* 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[]);
     142extern int __POSIX_DEF__(execv)(const char *path, char *const argv[]);
     143extern int __POSIX_DEF__(execvp)(const char *file, char *const argv[]);
    141144
    142145/* Creating a Pipe */
    143 extern int posix_pipe(int fildes[2]);
     146extern int __POSIX_DEF__(pipe)(int fildes[2]);
    144147
    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. */
     149extern unsigned int __POSIX_DEF__(alarm)(unsigned int);
    186150
    187151#endif /* POSIX_UNISTD_H_ */
  • uspace/lib/posix/source/ctype.c

    r80445cf r4c53333  
    3535
    3636#define LIBPOSIX_INTERNAL
     37#define __POSIX_DEF__(x) posix_##x
    3738
    38 #include "ctype.h"
     39#include "posix/ctype.h"
    3940
    4041/**
  • uspace/lib/posix/source/errno.c

    r80445cf r4c53333  
    3232/** @file System error numbers.
    3333 */
     34#define LIBPOSIX_INTERNAL
     35#define __POSIX_DEF__(x) posix_##x
    3436
    35 #include "errno.h"
     37#include "posix/errno.h"
    3638
    37 #include "stdlib.h"
     39#include "posix/stdlib.h"
    3840#include "libc/fibril.h"
    3941
     
    4345{
    4446        if (*__errno() != 0) {
    45                 _posix_errno = abs(*__errno());
     47                _posix_errno = posix_abs(*__errno());
    4648                *__errno() = 0;
    4749        }
  • uspace/lib/posix/source/fcntl.c

    r80445cf r4c53333  
    3434
    3535#define LIBPOSIX_INTERNAL
     36#define __POSIX_DEF__(x) posix_##x
    3637
    3738#include "internal/common.h"
    38 #include "fcntl.h"
     39#include "posix/fcntl.h"
    3940
    4041#include "libc/unistd.h"
    4142#include "libc/vfs/vfs.h"
    42 #include "errno.h"
     43#include "posix/errno.h"
    4344
    4445/**
     
    9596}
    9697
     98/**
     99 * Open, possibly create, a file.
     100 *
     101 * @param pathname Path to the file.
     102 * @param flags Access mode flags.
     103 */
     104int posix_open(const char *pathname, int flags, ...)
     105{
     106        mode_t mode = 0;
     107        if ((flags & O_CREAT) > 0) {
     108                va_list args;
     109                va_start(args, flags);
     110                mode = va_arg(args, mode_t);
     111                va_end(args);
     112        }
     113
     114        int rc = open(pathname, flags, mode);
     115        if (rc < 0) {
     116                errno = -rc;
     117                rc = -1;
     118        }
     119
     120        return rc;
     121}
     122
    97123/** @}
    98124 */
  • uspace/lib/posix/source/fnmatch.c

    r80445cf r4c53333  
    4242 */
    4343
    44 #include "stdbool.h"
    45 #include "ctype.h"
    46 #include "string.h"
    47 #include "stdlib.h"
    48 #include "assert.h"
    49 
    5044#define LIBPOSIX_INTERNAL
     45#define __POSIX_DEF__(x) posix_##x
     46
     47#include "libc/stdbool.h"
     48#include "posix/ctype.h"
     49#include "posix/string.h"
     50#include "posix/stdlib.h"
     51#include "posix/assert.h"
    5152
    5253#include "internal/common.h"
    53 #include "fnmatch.h"
     54#include "posix/fnmatch.h"
    5455
    5556/* Returned by _match... functions. */
     
    182183        { "alnum", isalnum },
    183184        { "alpha", isalpha },
    184         { "blank", isblank },
    185         { "cntrl", iscntrl },
     185        { "blank", posix_isblank },
     186        { "cntrl", posix_iscntrl },
    186187        { "digit", isdigit },
    187         { "graph", isgraph },
     188        { "graph", posix_isgraph },
    188189        { "lower", islower },
    189         { "print", isprint },
    190         { "punct", ispunct },
     190        { "print", posix_isprint },
     191        { "punct", posix_ispunct },
    191192        { "space", isspace },
    192193        { "upper", isupper },
    193         { "xdigit", isxdigit }
     194        { "xdigit", posix_isxdigit }
    194195};
    195196
     
    204205{
    205206        const struct _char_class *class = elem;
    206         return strcmp((const char *) key, class->name);
     207        return posix_strcmp((const char *) key, class->name);
    207208}
    208209
     
    217218{
    218219        /* Search for class in the array of supported character classes. */
    219         const struct _char_class *class = bsearch(cname, _char_classes,
     220        const struct _char_class *class = posix_bsearch(cname, _char_classes,
    220221            sizeof(_char_classes) / sizeof(struct _char_class),
    221222            sizeof(struct _char_class), _class_compare);
     
    549550                        end = string;
    550551                } else {
    551                         end = strchrnul(string, pathname ? '/' : '\0');
     552                        end = gnu_strchrnul(string, pathname ? '/' : '\0');
    552553                }
    553554
     
    581582{
    582583        assert(s != NULL);
    583         char *result = strdup(s);
     584        char *result = posix_strdup(s);
    584585        for (char *i = result; *i != '\0'; ++i) {
    585586                *i = tolower(*i);
  • uspace/lib/posix/source/locale.c

    r80445cf r4c53333  
    3434
    3535#define LIBPOSIX_INTERNAL
     36#define __POSIX_DEF__(x) posix_##x
    3637
    3738#include "internal/common.h"
    38 #include "locale.h"
     39#include "posix/locale.h"
    3940
    40 #include "errno.h"
    41 #include "limits.h"
    42 #include "string.h"
     41#include "posix/errno.h"
     42#include "posix/limits.h"
     43#include "posix/string.h"
    4344
    4445/* Just a very basic dummy implementation.
  • uspace/lib/posix/source/pwd.c

    r80445cf r4c53333  
    3434
    3535#define LIBPOSIX_INTERNAL
     36#define __POSIX_DEF__(x) posix_##x
    3637
    37 #include "pwd.h"
    38 #include "string.h"
    39 #include "errno.h"
     38#include "libc/stdbool.h"
     39#include "posix/pwd.h"
     40#include "posix/string.h"
     41#include "posix/errno.h"
     42#include "posix/assert.h"
    4043
    4144static bool entry_read = false;
  • uspace/lib/posix/source/signal.c

    r80445cf r4c53333  
    3434
    3535#define LIBPOSIX_INTERNAL
    36 
    37 #include "signal.h"
     36#define __POSIX_DEF__(x) posix_##x
     37
     38#include "posix/signal.h"
    3839#include "internal/common.h"
    39 #include "limits.h"
    40 #include "stdlib.h"
    41 #include "string.h"
    42 #include "errno.h"
     40#include "posix/limits.h"
     41#include "posix/stdlib.h"
     42#include "posix/string.h"
     43#include "posix/errno.h"
    4344
    4445#include "libc/fibril_synch.h"
  • uspace/lib/posix/source/stdio.c

    r80445cf r4c53333  
    3535
    3636#define LIBPOSIX_INTERNAL
    37 
    38 /* Has to be first. */
    39 #include "stdbool.h"
     37#define __POSIX_DEF__(x) posix_##x
    4038
    4139#include "internal/common.h"
    42 #include "stdio.h"
    43 
    44 #include "assert.h"
    45 #include "errno.h"
    46 #include "stdlib.h"
    47 #include "string.h"
    48 #include "sys/types.h"
    49 #include "unistd.h"
    50 
     40#include "posix/stdio.h"
     41
     42#include "posix/assert.h"
     43#include "posix/errno.h"
     44#include "posix/stdlib.h"
     45#include "posix/string.h"
     46#include "posix/sys/types.h"
     47#include "posix/unistd.h"
     48
     49#include "libc/stdio.h"
    5150#include "libc/io/printf_core.h"
     51#include "libc/stdbool.h"
    5252#include "libc/str.h"
    5353#include "libc/malloc.h"
     
    5959 * need to be implemented in libc anyway
    6060 */
    61 #include "../c/generic/private/stdio.h"
     61#include "../../c/generic/private/stdio.h"
    6262
    6363/** Clears the stream's error and end-of-file indicators.
  • uspace/lib/posix/source/stdio/scanf.c

    r80445cf r4c53333  
    3434
    3535#define LIBPOSIX_INTERNAL
    36 
    37 /* Must be first. */
    38 #include "../stdbool.h"
    39 
    40 #include "../assert.h"
    41 #include "../errno.h"
    42 
    43 #include "../stdio.h"
    44 #include "../stdlib.h"
    45 #include "../stddef.h"
    46 #include "../string.h"
    47 #include "../ctype.h"
    48 #include "../sys/types.h"
     36#define __POSIX_DEF__(x) posix_##x
     37
     38#include "posix/assert.h"
     39#include "posix/errno.h"
     40
     41#include "posix/stdio.h"
     42#include "posix/stdlib.h"
     43#include "posix/stddef.h"
     44#include "posix/string.h"
     45#include "posix/ctype.h"
     46#include "posix/sys/types.h"
    4947
    5048#include "../internal/common.h"
    51 #include "../libc/malloc.h"
     49#include "libc/malloc.h"
     50#include "libc/stdbool.h"
    5251
    5352/** Unified data type for possible data sources for scanf. */
  • uspace/lib/posix/source/stdlib.c

    r80445cf r4c53333  
    3535
    3636#define LIBPOSIX_INTERNAL
     37#define __POSIX_DEF__(x) posix_##x
    3738
    3839#include "internal/common.h"
    39 #include "stdlib.h"
    40 
    41 #include "errno.h"
    42 #include "fcntl.h"
    43 #include "limits.h"
    44 #include "string.h"
    45 #include "sys/stat.h"
    46 #include "unistd.h"
     40#include "posix/stdlib.h"
     41
     42#include "posix/errno.h"
     43#include "posix/fcntl.h"
     44#include "posix/limits.h"
     45#include "posix/string.h"
     46#include "posix/sys/stat.h"
     47#include "posix/unistd.h"
    4748
    4849#include "libc/sort.h"
     
    6263        // TODO: low priority, just a compile-time dependency of binutils
    6364        not_implemented();
     65        return 1;
    6466}
    6567
     
    231233        // TODO: low priority, just a compile-time dependency of binutils
    232234        not_implemented();
     235        return 0;
    233236}
    234237
     
    243246int posix_system(const char *string) {
    244247        // TODO: does nothing at the moment
     248        not_implemented();
    245249        return 0;
    246250}
  • uspace/lib/posix/source/stdlib/strtol.c

    r80445cf r4c53333  
    3434
    3535#define LIBPOSIX_INTERNAL
     36#define __POSIX_DEF__(x) posix_##x
    3637
    3738#include "../internal/common.h"
    38 #include "../stdlib.h"
    39 
    40 #include "../ctype.h"
    41 #include "../errno.h"
    42 #include "../inttypes.h"
    43 #include "../limits.h"
     39#include "posix/stdlib.h"
     40
     41#include "posix/ctype.h"
     42#include "posix/errno.h"
     43#include "posix/inttypes.h"
     44#include "posix/limits.h"
    4445
    4546#define intmax_t posix_intmax_t
  • uspace/lib/posix/source/stdlib/strtold.c

    r80445cf r4c53333  
    3434
    3535#define LIBPOSIX_INTERNAL
    36 
    37 /* Must be first. */
    38 #include "../stdbool.h"
     36#define __POSIX_DEF__(x) posix_##x
    3937
    4038#include "../internal/common.h"
    41 #include "../stdlib.h"
    42 
    43 #include "../assert.h"
    44 #include "../ctype.h"
    45 #include "../stdint.h"
    46 #include "../strings.h"
    47 #include "../errno.h"
    48 #include "../limits.h"
    49 
    50 #include "../float.h"
     39#include "libc/stdbool.h"
     40#include "posix/stdlib.h"
     41
     42#include "posix/assert.h"
     43#include "posix/ctype.h"
     44#include "posix/stdint.h"
     45#include "posix/strings.h"
     46#include "posix/errno.h"
     47#include "posix/limits.h"
     48
     49#include "posix/float.h"
    5150
    5251#ifndef HUGE_VALL
  • uspace/lib/posix/source/string.c

    r80445cf r4c53333  
    3535
    3636#define LIBPOSIX_INTERNAL
     37#define __POSIX_DEF__(x) posix_##x
    3738
    3839#include "internal/common.h"
    39 #include "string.h"
    40 
    41 #include "assert.h"
    42 #include "errno.h"
    43 #include "limits.h"
    44 #include "stdlib.h"
    45 #include "signal.h"
     40#include "posix/string.h"
     41
     42#include "posix/assert.h"
     43#include "posix/errno.h"
     44#include "posix/limits.h"
     45#include "posix/stdlib.h"
     46#include "posix/signal.h"
    4647
    4748#include "libc/str_error.h"
  • uspace/lib/posix/source/strings.c

    r80445cf r4c53333  
    3535
    3636#define LIBPOSIX_INTERNAL
     37#define __POSIX_DEF__(x) posix_##x
    3738
    3839#include "internal/common.h"
    39 #include "strings.h"
     40#include "posix/strings.h"
    4041
    41 #include "string.h"
    42 #include "ctype.h"
     42#include "posix/string.h"
     43#include "posix/ctype.h"
    4344
    4445#include "libc/mem.h"
     
    131132int posix_bcmp(const void *mem1, const void *mem2, size_t n)
    132133{
    133         return bcmp(mem1, mem2, n);
     134        return memcmp(mem1, mem2, n);
    134135}
    135136
     
    155156void posix_bzero(void *mem, size_t n)
    156157{
    157         bzero(mem, n);
     158        memset(mem, 0, n);
    158159}
    159160
  • uspace/lib/posix/source/sys/stat.c

    r80445cf r4c53333  
    3535
    3636#define LIBPOSIX_INTERNAL
     37#define __POSIX_DEF__(x) posix_##x
    3738
    3839#include "../internal/common.h"
    39 #include "stat.h"
     40#include "posix/sys/stat.h"
     41#include "libc/sys/stat.h"
    4042
    41 #include "../errno.h"
    42 #include "../libc/mem.h"
     43#include "posix/errno.h"
     44#include "libc/mem.h"
    4345
    4446/**
  • uspace/lib/posix/source/sys/wait.c

    r80445cf r4c53333  
    3535
    3636#define LIBPOSIX_INTERNAL
     37#define __POSIX_DEF__(x) posix_##x
    3738
    3839#include "../internal/common.h"
    39 #include "wait.h"
     40#include "posix/sys/wait.h"
    4041
    41 #include "../libc/task.h"
    42 #include "../assert.h"
    43 #include "../errno.h"
    44 #include "../limits.h"
    45 #include "../signal.h"
     42#include "libc/task.h"
     43#include "posix/assert.h"
     44#include "posix/errno.h"
     45#include "posix/limits.h"
     46#include "posix/signal.h"
    4647
    4748int __posix_wifexited(int status) {
  • uspace/lib/posix/source/unistd.c

    r80445cf r4c53333  
    3535
    3636#define LIBPOSIX_INTERNAL
     37#define __POSIX_DEF__(x) posix_##x
    3738
    3839#include "internal/common.h"
    39 #include "unistd.h"
    40 
    41 #include "errno.h"
    42 #include "string.h"
    43 #include "fcntl.h"
     40#include "posix/unistd.h"
     41
     42#include "posix/errno.h"
     43#include "posix/string.h"
     44#include "posix/fcntl.h"
    4445
    4546#include "libc/task.h"
     
    4950/* Array of environment variable strings (NAME=VALUE). */
    5051char **posix_environ = NULL;
     52char *posix_optarg;
    5153
    5254/**
     
    420422}
    421423
     424unsigned int posix_alarm(unsigned int seconds)
     425{
     426        not_implemented();
     427        return 0;
     428}
     429
    422430/** @}
    423431 */
Note: See TracChangeset for help on using the changeset viewer.