Changeset bc56f30 in mainline


Ignore:
Timestamp:
2019-05-27T12:38:26Z (5 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0d14c25
Parents:
4d51c60
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-13 16:06:49)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-05-27 12:38:26)
Message:

Make some libc and libposix headers usable in C++

These headers either get included from standard C++ headers,
or are standard themselves, which means any unnamespaced nonstandard
identifiers are a problem. This commit attempts to fix those
issues, and removes hacks previously used in libcpp to work around it.

Files:
1 added
77 edited

Legend:

Unmodified
Added
Removed
  • abi/include/_bits/errno.h

    r4d51c60 rbc56f30  
    4141#define _BITS_ERRNO_H_
    4242
     43#include <_bits/native.h>
     44#include <_bits/decls.h>
     45
    4346#ifdef __OPAQUE_ERRNO__
    4447#include <_bits/__opaque_handle.h>
    4548
     49__HELENOS_DECLS_BEGIN;
    4650__opaque_handle(errno_t);
    4751typedef errno_t sys_errno_t;
     52__HELENOS_DECLS_END;
     53
    4854#define __errno_t(val) ((errno_t) val)
    4955
    5056#else
    5157
    52 #include <_bits/native.h>
     58__HELENOS_DECLS_BEGIN;
    5359
    5460/**
     
    6571typedef sysarg_t sys_errno_t;
    6672
     73__HELENOS_DECLS_END;
     74
    6775/**
    6876 * A C++-style "cast" to `errno_t`.
  • abi/include/_bits/native.h

    r4d51c60 rbc56f30  
    4747
    4848#include <inttypes.h>
     49#include <_bits/decls.h>
     50
     51__HELENOS_DECLS_BEGIN;
    4952
    5053typedef uintptr_t pfn_t;
     
    5356typedef intptr_t  native_t;
    5457
    55 #define PRIdn  PRIdPTR  /**< Format for native_t. */
    56 #define PRIun  PRIuPTR  /**< Format for sysarg_t. */
    57 #define PRIxn  PRIxPTR  /**< Format for hexadecimal sysarg_t. */
     58__HELENOS_DECLS_END;
    5859
    5960#endif
  • abi/include/_bits/ssize_t.h

    r4d51c60 rbc56f30  
    4242
    4343#include <stdint.h>
     44#include <_bits/decls.h>
    4445
     46__C_DECLS_BEGIN;
    4547typedef intptr_t ssize_t;
    46 
    47 #define SSIZE_MIN  INTPTR_MIN
    48 #define SSIZE_MAX  INTPTR_MAX
     48__C_DECLS_END;
    4949
    5050#endif
  • abi/include/inttypes.h

    r4d51c60 rbc56f30  
    4343#include <stdint.h>
    4444#include <_bits/wchar_t.h>
     45#include <_bits/decls.h>
    4546
    4647/*
     
    311312#endif
    312313
    313 #ifdef _HELENOS_SOURCE
    314 #define UINT8_MIN   0
    315 #define UINT16_MIN  0
    316 #define UINT32_MIN  0
    317 #define UINT64_MIN  0
    318 #endif
    319 
    320314#define PRIdMAX  "lld"
    321315#define PRIiMAX  "lli"
     
    330324#define SCNxMAX  "llx"
    331325
    332 #ifdef __cplusplus
    333 extern "C" {
     326#if defined(_HELENOS_SOURCE) && !defined(__cplusplus)
     327#define PRIdn  PRIdPTR  /**< Format for native_t. */
     328#define PRIun  PRIuPTR  /**< Format for sysarg_t. */
     329#define PRIxn  PRIxPTR  /**< Format for hexadecimal sysarg_t. */
    334330#endif
     331
     332__C_DECLS_BEGIN;
    335333
    336334typedef struct {
     
    343341intmax_t strtoimax(const char *__restrict__, char **__restrict__, int);
    344342uintmax_t strtoumax(const char *__restrict__, char **__restrict__, int);
    345 
    346 #ifdef __cplusplus
    347 }
     343intmax_t wcstoimax(const wchar_t *__restrict__, wchar_t **__restrict__, int);
     344uintmax_t wcstoumax(const wchar_t *__restrict__, wchar_t **__restrict__, int);
     345
     346__C_DECLS_END;
     347
    348348#endif
    349349
    350 #endif
    351 
    352350/** @}
    353351 */
  • abi/include/limits.h

    r4d51c60 rbc56f30  
    8484#define MB_LEN_MAX 4
    8585
     86#define __NAME_MAX  256
     87
     88#ifdef _HELENOS_SOURCE
    8689#define UCHAR_MIN   0
    8790#define USHRT_MIN   0
     
    8992#define ULONG_MIN   (0ul)
    9093#define ULLONG_MIN  (0ull)
     94#define SSIZE_MIN   INTPTR_MIN
     95#define UINT8_MIN   0
     96#define UINT16_MIN  0
     97#define UINT32_MIN  0
     98#define UINT64_MIN  0
     99#endif
     100
     101#if defined(_HELENOS_SOURCE) || defined(_POSIX_SOURCE) || \
     102    defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
     103    defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
     104
     105#define SSIZE_MAX  INTPTR_MAX
     106#define NAME_MAX   __NAME_MAX
     107
     108#endif
    91109
    92110/* GCC's <limits.h> doesn't define these for C++11, even though it should. */
  • kernel/Makefile

    r4d51c60 rbc56f30  
    8787INCLUDES_FLAGS = $(addprefix -I,$(INCLUDES))
    8888
    89 DEFS = -DKERNEL -DRELEASE=$(RELEASE) "-DCOPYRIGHT=$(COPYRIGHT)" "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
     89DEFS = -D_HELENOS_SOURCE -DKERNEL -DRELEASE=$(RELEASE) "-DCOPYRIGHT=$(COPYRIGHT)" "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
    9090
    9191COMMON_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
  • uspace/lib/c/generic/private/stdio.h

    r4d51c60 rbc56f30  
    4040#include <async.h>
    4141#include <stddef.h>
     42#include <offset.h>
    4243
    4344/** Maximum characters that can be pushed back by ungetc() */
     
    5455        int (*flush)(FILE *stream);
    5556} __stream_ops_t;
     57
     58enum __buffer_state {
     59        /** Buffer is empty */
     60        _bs_empty,
     61
     62        /** Buffer contains data to be written */
     63        _bs_write,
     64
     65        /** Buffer contains prefetched data for reading */
     66        _bs_read
     67};
    5668
    5769struct _IO_FILE {
     
    8799
    88100        /** Buffering type */
    89         enum _buffer_type btype;
     101        enum __buffer_type btype;
    90102
    91103        /** Buffer */
     
    96108
    97109        /** Buffer state */
    98         enum _buffer_state buf_state;
     110        enum __buffer_state buf_state;
    99111
    100112        /** Buffer I/O pointer */
  • uspace/lib/c/include/adt/list.h

    r4d51c60 rbc56f30  
    4242#include <stdint.h>
    4343#include <trace.h>
    44 
    45 /** Doubly linked list link. */
    46 typedef struct link {
    47         struct link *prev;  /**< Pointer to the previous item in the list. */
    48         struct link *next;  /**< Pointer to the next item in the list. */
    49 } link_t;
    50 
    51 /** Doubly linked list. */
    52 typedef struct list {
    53         link_t head;  /**< List head. Does not have any data. */
    54 } list_t;
    55 
    56 extern bool list_member(const link_t *, const list_t *);
    57 extern void list_splice(list_t *, link_t *);
    58 extern unsigned long list_count(const list_t *);
     44#include <_bits/decls.h>
     45
     46#ifndef __cplusplus
     47
     48/**
     49 * We don't define the macros in C++ to avoid polluting headers with
     50 * namespaceless names. We don't actually need them, so this is fine.
     51 * We still allow including the rest of the file (in `helenos` namespace)
     52 * so that we can expose publicly visible types that have list_t members.
     53 */
    5954
    6055/** Declare and initialize statically allocated list.
     
    138133        assert(!link_used(link))
    139134
     135#define list_pop(list, type, member) \
     136        ((type *) list_pop_internal(list, \
     137            (list_link_to_void(&(((type *) NULL)->member)) - NULL)))
     138
     139#endif  /* !__cplusplus */
     140
     141__HELENOS_DECLS_BEGIN;
     142
     143/** Doubly linked list link. */
     144typedef struct __adt_list_link {
     145        struct __adt_list_link *prev;  /**< Pointer to the previous item in the list. */
     146        struct __adt_list_link *next;  /**< Pointer to the next item in the list. */
     147} link_t;
     148
     149/** Doubly linked list. */
     150typedef struct {
     151        link_t head;  /**< List head. Does not have any data. */
     152} list_t;
     153
     154extern bool list_member(const link_t *, const list_t *);
     155extern void list_splice(list_t *, link_t *);
     156extern unsigned long list_count(const list_t *);
     157
    140158/** Returns true if the link is definitely part of a list. False if not sure. */
    141159static inline bool link_in_use(const link_t *link)
     
    425443}
    426444
    427 #define list_pop(list, type, member) \
    428         ((type *) list_pop_internal(list, \
    429             (list_link_to_void(&(((type *) NULL)->member)) - NULL)))
     445__HELENOS_DECLS_END;
    430446
    431447#endif
  • uspace/lib/c/include/assert.h

    r4d51c60 rbc56f30  
    4141#define _LIBC_ASSERT_H_
    4242
     43#include <_bits/decls.h>
     44
    4345#ifndef __cplusplus
    4446#define static_assert _Static_assert
    4547#endif
     48
     49__C_DECLS_BEGIN;
    4650
    4751extern void __helenos_assert_abort(const char *, const char *, unsigned int)
     
    5054extern void __helenos_assert_quick_abort(const char *, const char *, unsigned int)
    5155    __attribute__((noreturn));
     56
     57__C_DECLS_END;
    5258
    5359#endif
  • uspace/lib/c/include/bsearch.h

    r4d51c60 rbc56f30  
    3737
    3838#include <stddef.h>
     39#include <_bits/decls.h>
     40
     41__C_DECLS_BEGIN;
    3942
    4043extern void *bsearch(const void *, const void *, size_t, size_t,
    4144    int (*)(const void *, const void *));
     45
     46__C_DECLS_END;
    4247
    4348#endif
  • uspace/lib/c/include/ctype.h

    r4d51c60 rbc56f30  
    3030#define _LIBC_CTYPE_H_
    3131
     32#include <_bits/decls.h>
     33
     34__C_DECLS_BEGIN;
    3235int islower(int);
    3336int isupper(int);
     
    4447int tolower(int);
    4548int toupper(int);
     49__C_DECLS_END;
    4650
    4751#endif
  • uspace/lib/c/include/dirent.h

    r4d51c60 rbc56f30  
    3636#define _LIBC_DIRENT_H_
    3737
    38 #define NAME_MAX  256
     38#include <limits.h>
     39#include <_bits/decls.h>
     40
     41__C_DECLS_BEGIN;
    3942
    4043struct dirent {
    41         char d_name[NAME_MAX + 1];
     44        char d_name[__NAME_MAX + 1];
    4245};
    4346
     
    4952extern int closedir(DIR *);
    5053
     54__C_DECLS_END;
     55
    5156#endif
    5257
  • uspace/lib/c/include/dlfcn.h

    r4d51c60 rbc56f30  
    3737#define _LIBC_DLFCN_H_
    3838
     39#include <_bits/decls.h>
     40
     41__C_DECLS_BEGIN;
     42
    3943void *dlopen(const char *, int);
    4044void *dlsym(void *, const char *);
     45
     46__C_DECLS_END;
    4147
    4248#endif
  • uspace/lib/c/include/errno.h

    r4d51c60 rbc56f30  
    3838#include <_bits/errno.h>
    3939#include <abi/errno.h>
     40#include <_bits/decls.h>
    4041
    41 #define errno  (*(__errno()))
     42__HELENOS_DECLS_BEGIN;
    4243
    4344extern errno_t *__errno(void) __attribute__((const));
     45
     46__HELENOS_DECLS_END;
     47
     48#ifdef __cplusplus
     49#define errno  (*(::helenos::__errno()))
     50#else
     51#define errno  (*(__errno()))
     52#endif
    4453
    4554#endif
  • uspace/lib/c/include/fibril.h

    r4d51c60 rbc56f30  
    3636#define _LIBC_FIBRIL_H_
    3737
    38 #include <types/common.h>
    3938#include <time.h>
     39#include <_bits/errno.h>
    4040#include <_bits/__noreturn.h>
     41#include <_bits/decls.h>
     42
     43__HELENOS_DECLS_BEGIN;
    4144
    4245typedef struct fibril fibril_t;
     
    7174extern __noreturn void fibril_exit(long);
    7275
     76__HELENOS_DECLS_END;
     77
    7378#endif
    7479
  • uspace/lib/c/include/fibril_synch.h

    r4d51c60 rbc56f30  
    4040#include <time.h>
    4141#include <stdbool.h>
    42 
    43 typedef struct {
    44         fibril_owner_info_t oi;  /**< Keep this the first thing. */
    45         int counter;
    46         list_t waiters;
    47 } fibril_mutex_t;
     42#include <_bits/decls.h>
     43
     44#ifndef __cplusplus
    4845
    4946#define FIBRIL_MUTEX_INITIALIZER(name) \
     
    5855#define FIBRIL_MUTEX_INITIALIZE(name) \
    5956        fibril_mutex_t name = FIBRIL_MUTEX_INITIALIZER(name)
    60 
    61 typedef struct {
    62         fibril_owner_info_t oi;  /**< Keep this the first thing. */
    63         unsigned int writers;
    64         unsigned int readers;
    65         list_t waiters;
    66 } fibril_rwlock_t;
    6757
    6858#define FIBRIL_RWLOCK_INITIALIZER(name) \
     
    7969        fibril_rwlock_t name = FIBRIL_RWLOCK_INITIALIZER(name)
    8070
    81 typedef struct {
    82         list_t waiters;
    83 } fibril_condvar_t;
    84 
    8571#define FIBRIL_CONDVAR_INITIALIZER(name) \
    8672        { \
     
    9076#define FIBRIL_CONDVAR_INITIALIZE(name) \
    9177        fibril_condvar_t name = FIBRIL_CONDVAR_INITIALIZER(name)
     78
     79#define FIBRIL_SEMAPHORE_INITIALIZER(name, cnt) \
     80        { \
     81                .count = (cnt), \
     82                .waiters = LIST_INITIALIZER((name).waiters), \
     83        }
     84
     85#define FIBRIL_SEMAPHORE_INITIALIZE(name, cnt) \
     86        fibril_semaphore_t name = FIBRIL_SEMAPHORE_INITIALIZER(name, cnt)
     87
     88#endif
     89
     90__HELENOS_DECLS_BEGIN;
     91
     92typedef struct {
     93        fibril_owner_info_t oi;  /**< Keep this the first thing. */
     94        int counter;
     95        list_t waiters;
     96} fibril_mutex_t;
     97
     98typedef struct {
     99        fibril_owner_info_t oi;  /**< Keep this the first thing. */
     100        unsigned int writers;
     101        unsigned int readers;
     102        list_t waiters;
     103} fibril_rwlock_t;
     104
     105typedef struct {
     106        list_t waiters;
     107} fibril_condvar_t;
    92108
    93109typedef void (*fibril_timer_fun_t)(void *);
     
    134150} fibril_semaphore_t;
    135151
    136 #define FIBRIL_SEMAPHORE_INITIALIZER(name, cnt) \
    137         { \
    138                 .count = (cnt), \
    139                 .waiters = LIST_INITIALIZER((name).waiters), \
    140         }
    141 
    142 #define FIBRIL_SEMAPHORE_INITIALIZE(name, cnt) \
    143         fibril_semaphore_t name = FIBRIL_SEMAPHORE_INITIALIZER(name, cnt)
    144 
    145152extern void __fibril_synch_init(void);
    146153extern void __fibril_synch_fini(void);
     
    190197extern void mpsc_close(mpsc_t *);
    191198
     199__HELENOS_DECLS_END;
     200
    192201#endif
    193202
  • uspace/lib/c/include/malloc.h

    r4d51c60 rbc56f30  
    3737
    3838#include <stddef.h>
     39#include <_bits/decls.h>
     40
     41__C_DECLS_BEGIN;
    3942
    4043extern void *malloc(size_t size)
     
    4245extern void *calloc(size_t nmemb, size_t size)
    4346    __attribute__((malloc));
    44 extern void *memalign(size_t align, size_t size)
    45     __attribute__((malloc));
    4647extern void *realloc(void *addr, size_t size)
    4748    __attribute__((warn_unused_result));
    4849extern void free(void *addr);
     50
     51__C_DECLS_END;
     52
     53#ifdef _HELENOS_SOURCE
     54__HELENOS_DECLS_BEGIN;
     55
     56extern void *memalign(size_t align, size_t size)
     57    __attribute__((malloc));
    4958extern void *heap_check(void);
     59
     60__HELENOS_DECLS_END;
     61#endif
    5062
    5163#endif
  • uspace/lib/c/include/mem.h

    r4d51c60 rbc56f30  
    3838
    3939#include <stddef.h>
     40#include <_bits/decls.h>
     41
     42__C_DECLS_BEGIN;
    4043
    4144extern void *memset(void *, int, size_t)
     
    5053    __attribute__((nonnull(1)));
    5154
     55__C_DECLS_END;
     56
    5257#endif
    5358
  • uspace/lib/c/include/offset.h

    r4d51c60 rbc56f30  
    3636#define _LIBC_OFFSET_H_
    3737
     38#ifndef _HELENOS_SOURCE
     39#error This file should only be included from HelenOS sources
     40#endif
     41
    3842#include <stdint.h>
     43#include <_bits/decls.h>
     44#include <_bits/off64_t.h>
    3945
    4046/* off64_t */
     
    5258#define PRIXOFF64 PRIX64
    5359
    54 /** Relative offset */
    55 typedef int64_t off64_t;
     60__HELENOS_DECLS_BEGIN;
    5661
    5762/** Absolute offset */
    5863typedef uint64_t aoff64_t;
     64
     65__HELENOS_DECLS_END;
    5966
    6067#endif
  • uspace/lib/c/include/qsort.h

    r4d51c60 rbc56f30  
    3737
    3838#include <stddef.h>
     39#include <_bits/decls.h>
    3940
     41__C_DECLS_BEGIN;
    4042extern void qsort(void *, size_t, size_t, int (*)(const void *,
    4143    const void *));
     44__C_DECLS_END;
     45
     46#ifdef _HELENOS_SOURCE
     47__HELENOS_DECLS_BEGIN;
    4248extern void qsort_r(void *, size_t, size_t, int (*)(const void *,
    4349    const void *, void *), void *);
     50__HELENOS_DECLS_END;
     51#endif
    4452
    4553#endif
  • uspace/lib/c/include/setjmp.h

    r4d51c60 rbc56f30  
    3434#define _LIBC_SETJMP_H_
    3535
    36 #ifdef __cplusplus
    37 extern "C" {
    38 #endif
    39 
    4036#include <libarch/fibril_context.h>
    4137#include <_bits/__noreturn.h>
     38#include <_bits/decls.h>
     39
     40__C_DECLS_BEGIN;
    4241
    4342typedef __context_t jmp_buf[1];
     
    4645extern __noreturn void __context_restore(__context_t *, int);
    4746
    48 #define setjmp __context_save
    4947extern __noreturn void longjmp(jmp_buf, int);
    5048
    51 #ifdef __cplusplus
    52 }
    53 #endif
     49__C_DECLS_END;
     50
     51#define setjmp __context_save
    5452
    5553#endif
  • uspace/lib/c/include/stdio.h

    r4d51c60 rbc56f30  
    3737#define _LIBC_STDIO_H_
    3838
    39 #ifdef __cplusplus
    40 extern "C" {
    41 #endif
    42 
    43 #include <offset.h>
    4439#include <stdarg.h>
    4540#include <io/verify.h>
     
    4843#include <_bits/wchar_t.h>
    4944#include <_bits/wint_t.h>
    50 
    51 /** Forward declaration */
    52 struct _IO_FILE;
    53 typedef struct _IO_FILE FILE;
    54 
    55 /** File position */
    56 typedef struct {
    57         off64_t pos;
    58 } fpos_t;
     45#include <_bits/decls.h>
    5946
    6047#ifndef _HELENOS_SOURCE
     
    7057
    7158/** Max number of files that is guaranteed to be able to open at the same time */
    72 #define FOPEN_MAX VFS_MAX_OPEN_FILES
     59#define FOPEN_MAX 16
    7360
    7461/** Recommended size of fixed-size array for holding file names. */
     
    9279/** Minimum number of unique temporary file names */
    9380#define TMP_MAX 1000000
     81
     82__C_DECLS_BEGIN;
     83
     84/** Forward declaration */
     85struct _IO_FILE;
     86typedef struct _IO_FILE FILE;
     87
     88/** File position */
     89typedef struct {
     90        long long pos;
     91} fpos_t;
    9492
    9593extern FILE *stdin;
     
    9896
    9997/* Character and string input functions */
    100 #define getc fgetc
    10198extern int fgetc(FILE *);
    10299extern char *fgets(char *, int, FILE *);
    103100extern char *gets(char *, size_t) __attribute__((deprecated));
    104101
     102static inline int getc(FILE *f)
     103{
     104        return fgetc(f);
     105}
     106
    105107extern int getchar(void);
    106108
    107109/* Character and string output functions */
    108 #define putc fputc
    109110extern int fputc(int, FILE *);
    110111extern int fputs(const char *, FILE *);
     112
     113static inline int putc(int i, FILE *f)
     114{
     115        return fputc(i, f);
     116}
    111117
    112118extern int putchar(int);
     
    180186extern char *tmpnam(char *s);
    181187
     188__C_DECLS_END;
     189
    182190#ifdef _HELENOS_SOURCE
    183191
     192#include <_bits/off64_t.h>
     193
     194__HELENOS_DECLS_BEGIN;
     195
    184196/* Nonstandard extensions. */
    185197
    186 enum _buffer_type {
     198enum __buffer_type {
    187199        /** No buffering */
    188200        _IONBF,
     
    193205};
    194206
    195 enum _buffer_state {
    196         /** Buffer is empty */
    197         _bs_empty,
    198 
    199         /** Buffer contains data to be written */
    200         _bs_write,
    201 
    202         /** Buffer contains prefetched data for reading */
    203         _bs_read
    204 };
    205 
    206207extern int vprintf_length(const char *, va_list);
    207208extern int printf_length(const char *, ...)
     
    210211extern int fileno(FILE *);
    211212
    212 #include <offset.h>
    213 
    214213extern int fseek64(FILE *, off64_t, int);
    215214extern off64_t ftell64(FILE *);
    216215
    217 #endif
    218 
    219 #ifdef __cplusplus
    220 }
     216__HELENOS_DECLS_END;
    221217#endif
    222218
  • uspace/lib/c/include/stdlib.h

    r4d51c60 rbc56f30  
    3636#define _LIBC_STDLIB_H_
    3737
    38 #ifdef __cplusplus
    39 extern "C" {
    40 #endif
    41 
    4238#include <_bits/size_t.h>
    4339#include <_bits/wchar_t.h>
     40#include <_bits/decls.h>
    4441#include <bsearch.h>
    4542#include <malloc.h>
    4643#include <qsort.h>
     44
     45#define EXIT_SUCCESS 0
     46#define EXIT_FAILURE 1
     47
     48#define RAND_MAX  714025
     49
     50#define MB_CUR_MAX 4
     51
     52__C_DECLS_BEGIN;
    4753
    4854/** Type returned by the div function */
     
    6975        long long rem;
    7076} lldiv_t;
    71 
    72 #define EXIT_FAILURE 1
    73 #define EXIT_SUCCESS 0
    74 
    75 #define RAND_MAX  714025
    76 
    77 #define MB_CUR_MAX 4
    7877
    7978extern long double strtold(const char *, char **);
     
    109108extern lldiv_t lldiv(long long, long long);
    110109
    111 #ifdef __cplusplus
    112 }
    113 #endif
     110__C_DECLS_END;
    114111
    115112#endif
  • uspace/lib/c/include/str.h

    r4d51c60 rbc56f30  
    3838#define _LIBC_STR_H_
    3939
    40 #ifdef __cplusplus
    41 extern "C" {
    42 #endif
    43 
    4440#include <errno.h>
    4541#include <stdbool.h>
     
    4844
    4945#include <mem.h>
     46#include <_bits/decls.h>
     47
     48#ifndef __cplusplus
    5049
    5150/* Common Unicode characters */
     
    6362 */
    6463#define SPASCII_STR_BUFSIZE(spa_size) ((spa_size) + 1)
     64
     65#endif
     66
     67__HELENOS_DECLS_BEGIN;
    6568
    6669extern wchar_t str_decode(const char *str, size_t *offset, size_t sz);
     
    147150extern unsigned long strtoul(const char *, char **, int);
    148151
    149 #ifdef __cplusplus
    150 }
    151 #endif
     152__HELENOS_DECLS_END;
    152153
    153154#endif
  • uspace/lib/c/include/string.h

    r4d51c60 rbc56f30  
    4141#endif
    4242
     43#include <_bits/decls.h>
    4344#include <_bits/size_t.h>
    4445#include <_bits/NULL.h>
    4546#include <mem.h>
     47
     48__C_DECLS_BEGIN;
    4649
    4750extern char *strcpy(char *, const char *);
     
    7073#endif
    7174
     75__C_DECLS_END;
     76
    7277#endif
    7378
  • uspace/lib/c/include/time.h

    r4d51c60 rbc56f30  
    3636#define _LIBC_TIME_H_
    3737
    38 #ifdef __cplusplus
    39 extern "C" {
    40 #endif
     38#include <_bits/decls.h>
    4139
    4240/* ISO/IEC 9899:2011 7.27.1 (2) */
     
    5149
    5250#include <_bits/size_t.h>
     51
     52__C_DECLS_BEGIN;
    5353
    5454/* ISO/IEC 9899:2011 7.27.1 (3), (4) */
     
    106106    const struct tm *__restrict__);
    107107
     108__C_DECLS_END;
     109
    108110#ifdef _HELENOS_SOURCE
    109111
     
    114116#include <stdbool.h>
    115117#include <_bits/errno.h>
     118
     119__HELENOS_DECLS_BEGIN;
    116120
    117121typedef long long sec_t;
     
    155159extern void udelay(sysarg_t);
    156160
     161__HELENOS_DECLS_END;
     162
    157163#endif /* _HELENOS_SOURCE */
    158 
    159 #ifdef __cplusplus
    160 }
    161 #endif
    162164
    163165#endif
  • uspace/lib/c/include/vfs/vfs.h

    r4d51c60 rbc56f30  
    4444#include <async.h>
    4545#include <offset.h>
    46 
    47 #define VFS_MAX_OPEN_FILES  128
    4846
    4947enum vfs_change_state_type {
  • uspace/lib/cpp/include/__bits/chrono.hpp

    r4d51c60 rbc56f30  
    611611            static time_point now()
    612612            {
    613                 hel::timespec ts{};
    614                 hel::getrealtime(&ts);
     613                ::std::timespec ts{};
     614                ::helenos::getrealtime(&ts);
    615615
    616616                rep time = NSEC2USEC(ts.tv_nsec);
     
    654654            static time_point now()
    655655            {
    656                 hel::timespec ts{};
    657                 hel::getuptime(&ts);
     656                ::std::timespec ts{};
     657                ::helenos::getuptime(&ts);
    658658
    659659                rep time = NSEC2USEC(ts.tv_nsec);
  • uspace/lib/cpp/include/__bits/io/ios.hpp

    r4d51c60 rbc56f30  
    4141{
    4242    using streamoff = long long;
    43     using streamsize = hel::ssize_t;
     43    using streamsize = ::ssize_t;
    4444
    4545    /**
  • uspace/lib/cpp/include/__bits/limits.hpp

    r4d51c60 rbc56f30  
    528528            static constexpr unsigned short min()
    529529            {
    530                 return USHRT_MIN;
     530                return 0;
    531531            }
    532532
     
    552552            static constexpr unsigned int min()
    553553            {
    554                 return UINT_MIN;
     554                return 0;
    555555            }
    556556
     
    576576            static constexpr unsigned long min()
    577577            {
    578                 return ULONG_MIN;
     578                return 0;
    579579            }
    580580
     
    600600            static constexpr unsigned long long min()
    601601            {
    602                 return ULLONG_MIN;
     602                return 0;
    603603            }
    604604
  • uspace/lib/cpp/include/__bits/locale/num_get.hpp

    r4d51c60 rbc56f30  
    301301                if (size > 0)
    302302                {
    303                     int ret{};
     303                    int olderrno{errno};
     304                    errno = EOK;
     305
    304306                    if constexpr (is_signed<BaseType>::value)
    305                         ret = std::hel::str_int64_t(base.buffer_, nullptr, num_base, false, &res);
    306                     else
    307                         ret = std::hel::str_uint64_t(base.buffer_, nullptr, num_base, false, &res);
    308 
    309                     if (ret != EOK)
    310                     {
     307                        res = ::strtoll(base.buffer_, nullptr, num_base);
     308                    else
     309                        res = ::strtoull(base.buffer_, nullptr, num_base);
     310
     311                    if (errno != EOK)
    311312                        err |= ios_base::failbit;
    312                         v = 0;
    313                     }
    314                     else if (res > static_cast<BaseType>(numeric_limits<T>::max()))
     313
     314                    errno = olderrno;
     315
     316                    if (res > static_cast<BaseType>(numeric_limits<T>::max()))
    315317                    {
    316318                        err |= ios_base::failbit;
  • uspace/lib/cpp/include/__bits/random.hpp

    r4d51c60 rbc56f30  
    10301030             *       something better.
    10311031             */
    1032             hel::srand(hel::time(nullptr));
     1032            ::srand(::time(nullptr));
    10331033        }
    10341034
    10351035        result_type operator()()
    10361036        {
    1037             return hel::rand();
     1037            return ::rand();
    10381038        }
    10391039
  • uspace/lib/cpp/include/__bits/string/string.hpp

    r4d51c60 rbc56f30  
    8282        static int compare(const char_type* s1, const char_type* s2, size_t n)
    8383        {
    84             return hel::str_lcmp(s1, s2, n);
     84            return ::strncmp(s1, s2, n);
    8585        }
    8686
    8787        static size_t length(const char_type* s)
    8888        {
    89             return hel::str_size(s);
     89            return ::strlen(s);
    9090        }
    9191
     
    367367            // TODO: This function does not exits...
    368368            __unimplemented();
    369             //return hel::wstr_lcmp(s1, s2, n);
    370369            return 0;
    371370        }
     
    373372        static size_t length(const char_type* s)
    374373        {
    375             return hel::wstr_size(s);
     374            size_t i = 0;
     375            while (s[i] != 0)
     376                i++;
     377            return i;
    376378        }
    377379
  • uspace/lib/cpp/include/__bits/thread/condition_variable.hpp

    r4d51c60 rbc56f30  
    3535namespace std
    3636{
    37     extern "C" {
    38         #include <fibril.h>
    39         #include <fibril_synch.h>
    40     }
    41 
    4237    enum class cv_status
    4338    {
  • uspace/lib/cpp/include/__bits/thread/threading.hpp

    r4d51c60 rbc56f30  
    3030#define LIBCPP_BITS_THREAD_THREADING
    3131
    32 namespace std::hel
    33 {
    34     extern "C" {
    35         #include <fibril.h>
    36         #include <fibril_synch.h>
    37     }
    38 }
    39 
    4032#include <chrono>
     33
     34#include <fibril.h>
     35#include <fibril_synch.h>
    4136
    4237namespace std::aux
     
    5449    struct threading_policy<fibril_tag>
    5550    {
    56         using mutex_type        = hel::fibril_mutex_t;
    57         using thread_type       = hel::fid_t;
    58         using condvar_type      = hel::fibril_condvar_t;
    59         using time_unit         = hel::usec_t;
    60         using shared_mutex_type = hel::fibril_rwlock_t;
     51        using mutex_type        = ::helenos::fibril_mutex_t;
     52        using thread_type       = ::helenos::fid_t;
     53        using condvar_type      = ::helenos::fibril_condvar_t;
     54        using time_unit         = ::helenos::usec_t;
     55        using shared_mutex_type = ::helenos::fibril_rwlock_t;
    6156
    6257        struct thread
     
    6560            static thread_type create(Callable clbl, Payload& pld)
    6661            {
    67                 return hel::fibril_create(clbl, (void*)&pld);
     62                return ::helenos::fibril_create(clbl, (void*)&pld);
    6863            }
    6964
    7065            static void start(thread_type thr)
    7166            {
    72                 hel::fibril_add_ready(thr);
     67                ::helenos::fibril_add_ready(thr);
    7368            }
    7469
    7570            static thread_type this_thread()
    7671            {
    77                 return hel::fibril_get_id();
     72                return ::helenos::fibril_get_id();
    7873            }
    7974
    8075            static void yield()
    8176            {
    82                 hel::fibril_yield();
     77                ::helenos::fibril_yield();
    8378            }
    8479
     
    9489            static void init(mutex_type& mtx)
    9590            {
    96                 hel::fibril_mutex_initialize(&mtx);
     91                ::helenos::fibril_mutex_initialize(&mtx);
    9792            }
    9893
    9994            static void lock(mutex_type& mtx)
    10095            {
    101                 hel::fibril_mutex_lock(&mtx);
     96                ::helenos::fibril_mutex_lock(&mtx);
    10297            }
    10398
    10499            static void unlock(mutex_type& mtx)
    105100            {
    106                 hel::fibril_mutex_unlock(&mtx);
     101                ::helenos::fibril_mutex_unlock(&mtx);
    107102            }
    108103
    109104            static bool try_lock(mutex_type& mtx)
    110105            {
    111                 return hel::fibril_mutex_trylock(&mtx);
     106                return ::helenos::fibril_mutex_trylock(&mtx);
    112107            }
    113108
     
    123118            static void init(condvar_type& cv)
    124119            {
    125                 hel::fibril_condvar_initialize(&cv);
     120                ::helenos::fibril_condvar_initialize(&cv);
    126121            }
    127122
    128123            static void wait(condvar_type& cv, mutex_type& mtx)
    129124            {
    130                 hel::fibril_condvar_wait(&cv, &mtx);
     125                ::helenos::fibril_condvar_wait(&cv, &mtx);
    131126            }
    132127
    133128            static int wait_for(condvar_type& cv, mutex_type& mtx, time_unit timeout)
    134129            {
    135                 return hel::fibril_condvar_wait_timeout(&cv, &mtx, timeout);
     130                return ::helenos::fibril_condvar_wait_timeout(&cv, &mtx, timeout);
    136131            }
    137132
    138133            static void signal(condvar_type& cv)
    139134            {
    140                 hel::fibril_condvar_signal(&cv);
     135                ::helenos::fibril_condvar_signal(&cv);
    141136            }
    142137
    143138            static void broadcast(condvar_type& cv)
    144139            {
    145                 hel::fibril_condvar_broadcast(&cv);
     140                ::helenos::fibril_condvar_broadcast(&cv);
    146141            }
    147142        };
     
    157152            static void sleep(time_unit time)
    158153            {
    159                 hel::fibril_usleep(time);
     154                ::helenos::fibril_usleep(time);
    160155            }
    161156        };
     
    165160            static void init(shared_mutex_type& mtx)
    166161            {
    167                 hel::fibril_rwlock_initialize(&mtx);
     162                ::helenos::fibril_rwlock_initialize(&mtx);
    168163            }
    169164
    170165            static void lock(shared_mutex_type& mtx)
    171166            {
    172                 hel::fibril_rwlock_write_lock(&mtx);
     167                ::helenos::fibril_rwlock_write_lock(&mtx);
    173168            }
    174169
    175170            static void unlock(shared_mutex_type& mtx)
    176171            {
    177                 hel::fibril_rwlock_write_unlock(&mtx);
     172                ::helenos::fibril_rwlock_write_unlock(&mtx);
    178173            }
    179174
    180175            static void lock_shared(shared_mutex_type& mtx)
    181176            {
    182                 hel::fibril_rwlock_read_lock(&mtx);
     177                ::helenos::fibril_rwlock_read_lock(&mtx);
    183178            }
    184179
    185180            static void unlock_shared(shared_mutex_type& mtx)
    186181            {
    187                 hel::fibril_rwlock_read_unlock(&mtx);
     182                ::helenos::fibril_rwlock_read_unlock(&mtx);
    188183            }
    189184
  • uspace/lib/cpp/include/cassert

    r4d51c60 rbc56f30  
    3030#define LIBCPP_CASSERT
    3131
    32 
    33 extern "C" {
    34     #include <assert.h>
    35 }
    36 
    37 // TODO: For some reason, this function isn't visible (maybe the
    38 //       noreturn attribute?), adding a redeclaration here for the
    39 //       time being.
    40 
    41 extern void __helenos_assert_abort(const char *, const char *, unsigned int);
     32#include <assert.h>
    4233
    4334#define __unimplemented() assert(!"Not implemented!")
  • uspace/lib/cpp/include/cctype

    r4d51c60 rbc56f30  
    3030#define LIBCPP_CCTYPE
    3131
    32 
    33 namespace std::hel
    34 {
    35     extern "C" {
    36         #include <ctype.h>
    37     }
    38 }
     32#include <ctype.h>
    3933
    4034namespace std
    4135{
    42     using std::hel::isalnum;
    43     using std::hel::isalpha;
    44     using std::hel::islower;
    45     using std::hel::isupper;
    46     using std::hel::isdigit;
    47     /* using std::hel::isxdigit; */
    48     /* using std::hel::iscntrl; */
    49     /* using std::hel::isgraph; */
    50     using std::hel::isspace;
    51     /* using std::hel::isblank; */
    52     /* using std::hel::isprint; */
    53     /* using std::hel::ispunct; */
    54     using std::hel::tolower;
    55     using std::hel::toupper;
     36    using ::isalnum;
     37    using ::isalpha;
     38    using ::islower;
     39    using ::isupper;
     40    using ::isdigit;
     41    using ::isxdigit;
     42    using ::iscntrl;
     43    using ::isgraph;
     44    using ::isspace;
     45    using ::isblank;
     46    using ::isprint;
     47    using ::ispunct;
     48    using ::tolower;
     49    using ::toupper;
    5650}
    5751
  • uspace/lib/cpp/include/cerrno

    r4d51c60 rbc56f30  
    3030#define LIBCPP_CERRNO
    3131
    32 
    33 namespace std::hel
    34 {
    35     extern "C" {
    36         #include <errno.h>
    37     }
    38 }
    39 
    40 namespace std
    41 {
    42     // Note: Only macros are imported here.
    43 }
     32#include <errno.h>
    4433
    4534#endif
  • uspace/lib/cpp/include/cinttypes

    r4d51c60 rbc56f30  
    3030#define LIBCPP_CINTTYPES
    3131
    32 
    33 namespace std::hel
    34 {
    35     extern "C" {
    36         #include <inttypes.h>
    37     }
    38 }
     32#include <cstdint>
     33#include <inttypes.h>
    3934
    4035namespace std
    4136{
    42     using std::hel::imaxdiv_t;
    43     /* using std::hel::abs; */
    44     /* using std::hel::div; */
    45     /* using std::hel::imaxabs; */
    46     /* using std::hel::imaxdiv; */
    47     /* using std::hel::strtoimax; */
    48     /* using std::hel::strtoumax; */
    49     /* using std::hel::wcstoimax; */
    50     /* using std::hel::wcstoumax; */
     37    using ::imaxdiv_t;
     38    using ::imaxabs;
     39    using ::imaxdiv;
     40    using ::strtoimax;
     41    using ::strtoumax;
     42    using ::wcstoimax;
     43    using ::wcstoumax;
    5144}
    5245
    53 using std::hel::imaxdiv_t;
    54 /* using std::hel::abs; */
    55 /* using std::hel::div; */
    56 /* using std::hel::imaxabs; */
    57 /* using std::hel::imaxdiv; */
    58 /* using std::hel::strtoimax; */
    59 /* using std::hel::strtoumax; */
    60 /* using std::hel::wcstoimax; */
    61 /* using std::hel::wcstoumax; */
    62 
    63 #include <cstdint>
    64 
    6546#endif
  • uspace/lib/cpp/include/climits

    r4d51c60 rbc56f30  
    3030#define LIBCPP_CLIMITS
    3131
    32 
    33 namespace std::hel
    34 {
    35     extern "C" {
    36         #include <limits.h>
    37     }
    38 }
    39 
    40 namespace std
    41 {
    42     // Note: Only macros imported here.
    43 }
     32#include <limits.h>
    4433
    4534#endif
  • uspace/lib/cpp/include/csetjmp

    r4d51c60 rbc56f30  
    3030#define LIBCPP_CSETJMP
    3131
    32 
    33 /**
    34  * TODO: Currently the <setjmp.h> header uses
    35  *       _Noreturn, which is not available in C++.
    36  */
    37 
    38 namespace std::hel
    39 {
    40     extern "C" {
    41         //#include <setjmp.h>
    42     }
    43 }
     32#include <setjmp.h>
    4433
    4534namespace std
    4635{
    47     /* using std::hel::jmp_buf; */
    48     /* using std::hel::longjmp; */
     36    using ::jmp_buf;
     37    using ::longjmp;
    4938}
    5039
    51 /* using std::hel::jmp_buf; */
    52 /* using std::hel::longjmp; */
    53 
    5440#endif
  • uspace/lib/cpp/include/cstdarg

    r4d51c60 rbc56f30  
    3030#define LIBCPP_CSTDARG
    3131
    32 
    33 namespace std::hel
    34 {
    35     extern "C" {
    36         #include <stdarg.h>
    37     }
    38 }
     32#include <stdarg.h>
    3933
    4034namespace std
    4135{
    42     using std::hel::va_list;
     36    using ::va_list;
    4337}
    4438
    45 using std::hel::va_list;
    46 
    4739#endif
  • uspace/lib/cpp/include/cstddef

    r4d51c60 rbc56f30  
    3030#define LIBCPP_CSTDDEF
    3131
    32 
    33 namespace std::hel
    34 {
    35     extern "C" {
    36         #include <stddef.h>
    37     }
    38 }
    39 
     32#include <stddef.h>
    4033
    4134namespace std
    4235{
    43     using nullptr_t = decltype(nullptr);
    44 
    45     using std::hel::size_t;
    46     using std::hel::ptrdiff_t;
    47     /* using std::hel::max_align_t; */
     36    using ::nullptr_t;
     37    using ::size_t;
     38    using ::ptrdiff_t;
     39    using ::max_align_t;
    4840}
    4941
    50 using std::nullptr_t;
    51 using std::hel::size_t;
    52 using std::hel::ptrdiff_t;
    53 /* using std::hel::max_align_t; */
    54 
    5542#endif
  • uspace/lib/cpp/include/cstdint

    r4d51c60 rbc56f30  
    3030#define LIBCPP_CSTDINT
    3131
    32 
    33 namespace std::hel
    34 {
    35     extern "C" {
    36         #include <stdint.h>
    37     }
    38 }
     32#include <stdint.h>
    3933
    4034namespace std
    4135{
    42     using int8_t  = std::hel::int8_t;
    43     using int16_t = std::hel::int16_t;
    44     using int32_t = std::hel::int32_t;
    45     using int64_t = std::hel::int64_t;
     36    using ::int8_t;
     37    using ::int16_t;
     38    using ::int32_t;
     39    using ::int64_t;
    4640
    47     using intmax_t = std::hel::intmax_t;
    48     using intptr_t = std::hel::intptr_t;
     41    using ::intmax_t;
     42    using ::intptr_t;
    4943
    50     using int_fast8_t  = std::hel::int_fast8_t;
    51     using int_fast16_t = std::hel::int_fast16_t;
    52     using int_fast32_t = std::hel::int_fast32_t;
    53     using int_fast64_t = std::hel::int_fast64_t;
     44    using ::int_fast8_t;
     45    using ::int_fast16_t;
     46    using ::int_fast32_t;
     47    using ::int_fast64_t;
    5448
    55     using int_least8_t  = std::hel::int_least8_t;
    56     using int_least16_t = std::hel::int_least16_t;
    57     using int_least32_t = std::hel::int_least32_t;
    58     using int_least64_t = std::hel::int_least64_t;
     49    using ::int_least8_t;
     50    using ::int_least16_t;
     51    using ::int_least32_t;
     52    using ::int_least64_t;
    5953
    60     using uint8_t  = std::hel::uint8_t;
    61     using uint16_t = std::hel::uint16_t;
    62     using uint32_t = std::hel::uint32_t;
    63     using uint64_t = std::hel::uint64_t;
     54    using ::uint8_t;
     55    using ::uint16_t;
     56    using ::uint32_t;
     57    using ::uint64_t;
    6458
    65     using uintmax_t = std::hel::uintmax_t;
    66     using uintptr_t = std::hel::uintptr_t;
     59    using ::uintmax_t;
     60    using ::uintptr_t;
    6761
    68     using uint_fast8_t  = std::hel::uint_fast8_t;
    69     using uint_fast16_t = std::hel::uint_fast16_t;
    70     using uint_fast32_t = std::hel::uint_fast32_t;
    71     using uint_fast64_t = std::hel::uint_fast64_t;
     62    using ::uint_fast8_t;
     63    using ::uint_fast16_t;
     64    using ::uint_fast32_t;
     65    using ::uint_fast64_t;
    7266
    73     using uint_least8_t  = std::hel::uint_least8_t;
    74     using uint_least16_t = std::hel::uint_least16_t;
    75     using uint_least32_t = std::hel::uint_least32_t;
    76     using uint_least64_t = std::hel::uint_least64_t;
     67    using ::uint_least8_t;
     68    using ::uint_least16_t;
     69    using ::uint_least32_t;
     70    using ::uint_least64_t;
    7771}
    7872
    79 using int8_t  = std::hel::int8_t;
    80 using int16_t = std::hel::int16_t;
    81 using int32_t = std::hel::int32_t;
    82 using int64_t = std::hel::int64_t;
    83 
    84 using intmax_t = std::hel::intmax_t;
    85 using intptr_t = std::hel::intptr_t;
    86 
    87 using int_fast8_t  = std::hel::int_fast8_t;
    88 using int_fast16_t = std::hel::int_fast16_t;
    89 using int_fast32_t = std::hel::int_fast32_t;
    90 using int_fast64_t = std::hel::int_fast64_t;
    91 
    92 using int_least8_t  = std::hel::int_least8_t;
    93 using int_least16_t = std::hel::int_least16_t;
    94 using int_least32_t = std::hel::int_least32_t;
    95 using int_least64_t = std::hel::int_least64_t;
    96 
    97 using uint8_t  = std::hel::uint8_t;
    98 using uint16_t = std::hel::uint16_t;
    99 using uint32_t = std::hel::uint32_t;
    100 using uint64_t = std::hel::uint64_t;
    101 
    102 using uintmax_t = std::hel::uintmax_t;
    103 using uintptr_t = std::hel::uintptr_t;
    104 
    105 using uint_fast8_t  = std::hel::uint_fast8_t;
    106 using uint_fast16_t = std::hel::uint_fast16_t;
    107 using uint_fast32_t = std::hel::uint_fast32_t;
    108 using uint_fast64_t = std::hel::uint_fast64_t;
    109 
    110 using uint_least8_t  = std::hel::uint_least8_t;
    111 using uint_least16_t = std::hel::uint_least16_t;
    112 using uint_least32_t = std::hel::uint_least32_t;
    113 using uint_least64_t = std::hel::uint_least64_t;
    114 
    11573#endif
  • uspace/lib/cpp/include/cstdio

    r4d51c60 rbc56f30  
    3030#define LIBCPP_CSTDIO
    3131
    32 
    33 namespace std::hel
    34 {
    35     extern "C" {
    36         #include <stdio.h>
    37     }
    38 }
     32#include <stdio.h>
    3933
    4034namespace std
    4135{
    42     using std::hel::FILE;
    43     using std::hel::stdin;
    44     using std::hel::stdout;
    45     using std::hel::stderr;
    46     /* using std::hel::fpos_t */
    47     using std::hel::size_t;
     36    using ::FILE;
     37    using ::stdin;
     38    using ::stdout;
     39    using ::stderr;
     40    using ::fpos_t;
     41    using ::size_t;
    4842
    49     using std::hel::clearerr;
    50     using std::hel::fclose;
    51     using std::hel::feof;
    52     using std::hel::ferror;
    53     using std::hel::fflush;
    54     using std::hel::fgetc;
    55     /* using std::hel::fgetpos; */
    56     using std::hel::fgets;
    57     using std::hel::fopen;
    58     using std::hel::fprintf;
    59     using std::hel::fputc;
    60     using std::hel::fputs;
    61     using std::hel::fread;
    62     using std::hel::freopen;
    63     /* using std::hel::fscanf; */
    64     using std::hel::fseek;
    65     /* using std::hel::fsetpos; */
    66     using std::hel::ftell;
    67     using std::hel::fwrite;
    68     /* using std::hel::getc; */
    69     using std::hel::getchar;
    70     /* using std::hel::perror; */
    71     using std::hel::printf;
    72     /* using std::hel::putc; */
    73     using std::hel::putchar;
    74     using std::hel::puts;
    75     using std::hel::remove;
    76     using std::hel::rename;
    77     using std::hel::rewind;
    78     /* using std::hel::scanf; */
    79     using std::hel::setbuf;
    80     using std::hel::setvbuf;
    81     using std::hel::snprintf;
    82     /* using std::hel::sprintf; */
    83     /* using std::hel::sscanf; */
    84     /* using std::hel::tmpfile; */
    85     /* using std::hel::tmpnam; */
    86     using std::hel::ungetc;
    87     using std::hel::vfprintf;
    88     using std::hel::vprintf;
    89     /* using std::hel::vscanf; */
    90     using std::hel::vsnprintf;
    91     /* using std::hel::vsprintf; */
    92     /* using std::hel::vsscanf; */
     43    using ::clearerr;
     44    using ::fclose;
     45    using ::feof;
     46    using ::ferror;
     47    using ::fflush;
     48    using ::fgetc;
     49    using ::fgetpos;
     50    using ::fgets;
     51    using ::fopen;
     52    using ::fprintf;
     53    using ::fputc;
     54    using ::fputs;
     55    using ::fread;
     56    using ::freopen;
     57    using ::fscanf;
     58    using ::fseek;
     59    using ::fsetpos;
     60    using ::ftell;
     61    using ::fwrite;
     62    using ::getc;
     63    using ::getchar;
     64    using ::perror;
     65    using ::printf;
     66    using ::putc;
     67    using ::putchar;
     68    using ::puts;
     69    using ::remove;
     70    using ::rename;
     71    using ::rewind;
     72    using ::scanf;
     73    using ::setbuf;
     74    using ::setvbuf;
     75    using ::snprintf;
     76    /* using ::sprintf; */
     77    /* using ::sscanf; */
     78    /* using ::tmpfile; */
     79    /* using ::tmpnam; */
     80    using ::ungetc;
     81    using ::vfprintf;
     82    using ::vprintf;
     83    /* using ::vscanf; */
     84    using ::vsnprintf;
     85    /* using ::vsprintf; */
     86    /* using ::vsscanf; */
    9387}
    9488
    95 using std::hel::FILE;
    96 /* using std::hel::fpos_t */
    97 using std::hel::size_t;
    98 
    99 using std::hel::clearerr;
    100 using std::hel::fclose;
    101 using std::hel::feof;
    102 using std::hel::ferror;
    103 using std::hel::fflush;
    104 using std::hel::fgetc;
    105 /* using std::hel::fgetpos; */
    106 using std::hel::fgets;
    107 using std::hel::fopen;
    108 using std::hel::fprintf;
    109 using std::hel::fputc;
    110 using std::hel::fputs;
    111 using std::hel::fread;
    112 using std::hel::freopen;
    113 /* using std::hel::fscanf; */
    114 using std::hel::fseek;
    115 /* using std::hel::fsetpos; */
    116 using std::hel::ftell;
    117 using std::hel::fwrite;
    118 /* using std::hel::getc; */
    119 using std::hel::getchar;
    120 /* using std::hel::perror; */
    121 using std::hel::printf;
    122 /* using std::hel::putc; */
    123 using std::hel::putchar;
    124 using std::hel::puts;
    125 using std::hel::remove;
    126 using std::hel::rename;
    127 using std::hel::rewind;
    128 /* using std::hel::scanf; */
    129 using std::hel::setbuf;
    130 using std::hel::setvbuf;
    131 using std::hel::snprintf;
    132 /* using std::hel::sprintf; */
    133 /* using std::hel::sscanf; */
    134 /* using std::hel::tmpfile; */
    135 /* using std::hel::tmpnam; */
    136 using std::hel::ungetc;
    137 using std::hel::vfprintf;
    138 using std::hel::vprintf;
    139 /* using std::hel::vscanf; */
    140 using std::hel::vsnprintf;
    141 /* using std::hel::vsprintf; */
    142 /* using std::hel::vsscanf; */
    143 
    14489#endif
  • uspace/lib/cpp/include/cstdlib

    r4d51c60 rbc56f30  
    3030#define LIBCPP_CSTDLIB
    3131
    32 
    33 namespace std::hel
    34 {
    35     extern "C" {
    36         #include <stdlib.h>
    37         #include <_bits/ssize_t.h>
    38     }
    39 }
     32#include <stdlib.h>
     33#include <_bits/ssize_t.h>
    4034
    4135namespace std
    4236{
    43     /* using std::hel::div_t; */
    44     /* using std::hel::ldiv_t; */
    45     /* using std::hel::lldiv_t; */
    46     using std::hel::size_t;
     37    /* using ::div_t; */
     38    /* using ::ldiv_t; */
     39    /* using ::lldiv_t; */
     40    using ::size_t;
    4741
    48     using std::hel::abort;
    49     using std::hel::exit;
    50     /* using std::hel::quick_exit; */
    51     /* using std::hel::_Exit; */
    52     using std::hel::atexit;
    53     /* using std::hel::at_quick_exit; */
    54     /* using std::hel::system; */
    55     /* using std::hel::getenv; */
     42    using ::abort;
     43    using ::exit;
     44    /* using ::quick_exit; */
     45    /* using ::_Exit; */
     46    using ::atexit;
     47    /* using ::at_quick_exit; */
     48    /* using ::system; */
     49    /* using ::getenv; */
    5650
    57     using std::hel::malloc;
    58     using std::hel::calloc;
    59     using std::hel::realloc;
    60     using std::hel::free;
     51    using ::malloc;
     52    using ::calloc;
     53    using ::realloc;
     54    using ::free;
    6155
    62     /* using std::hel::atof; */
    63     /* using std::hel::atoi; */
    64     /* using std::hel::atol; */
    65     /* using std::hel::atoll; */
    66     /* using std::hel::strtol; */
    67     /* using std::hel::strtoll; */
    68     /* using std::hel::strtoul; */
    69     /* using std::hel::strtoull; */
    70     /* using std::hel::strtof; */
    71     /* using std::hel::strtod; */
    72     /* using std::hel::strtold; */
     56    /* using ::atof; */
     57    /* using ::atoi; */
     58    /* using ::atol; */
     59    /* using ::atoll; */
     60    /* using ::strtol; */
     61    /* using ::strtoll; */
     62    /* using ::strtoul; */
     63    /* using ::strtoull; */
     64    /* using ::strtof; */
     65    /* using ::strtod; */
     66    /* using ::strtold; */
    7367
    74     /* using std::hel::mblen; */
    75     /* using std::hel::mbtowc; */
    76     /* using std::hel::wctomb; */
    77     /* using std::hel::mbstowcs; */
    78     /* using std::hel::wcstombs; */
     68    /* using ::mblen; */
     69    /* using ::mbtowc; */
     70    /* using ::wctomb; */
     71    /* using ::mbstowcs; */
     72    /* using ::wcstombs; */
    7973
    80     using std::hel::rand;
    81     using std::hel::srand;
    82     using std::hel::qsort;
    83     /* using std::hel::bsearch; */
    84     /* using std::hel::abs; */
    85     /* using std::hel::labs; */
    86     /* using std::hel::llabs; */
    87     /* using std::hel::div; */
    88     /* using std::hel::ldiv; */
    89     /* using std::hel::lldiv; */
     74    using ::rand;
     75    using ::srand;
     76    using ::qsort;
     77    /* using ::bsearch; */
     78    /* using ::abs; */
     79    /* using ::labs; */
     80    /* using ::llabs; */
     81    /* using ::div; */
     82    /* using ::ldiv; */
     83    /* using ::lldiv; */
    9084}
    9185
    92 /* using std::hel::div_t; */
    93 /* using std::hel::ldiv_t; */
    94 /* using std::hel::lldiv_t; */
    95 using std::hel::size_t;
    96 
    97 using std::hel::abort;
    98 using std::hel::exit;
    99 /* using std::hel::quick_exit; */
    100 /* using std::hel::_Exit; */
    101 using std::hel::atexit;
    102 /* using std::hel::at_quick_exit; */
    103 /* using std::hel::system; */
    104 /* using std::hel::getenv; */
    105 
    106 using std::hel::malloc;
    107 using std::hel::calloc;
    108 using std::hel::realloc;
    109 using std::hel::free;
    110 
    111 /* using std::hel::atof; */
    112 /* using std::hel::atoi; */
    113 /* using std::hel::atol; */
    114 /* using std::hel::atoll; */
    115 /* using std::hel::strtol; */
    116 /* using std::hel::strtoll; */
    117 /* using std::hel::strtoul; */
    118 /* using std::hel::strtoull; */
    119 /* using std::hel::strtof; */
    120 /* using std::hel::strtod; */
    121 /* using std::hel::strtold; */
    122 
    123 /* using std::hel::mblen; */
    124 /* using std::hel::mbtowc; */
    125 /* using std::hel::wctomb; */
    126 /* using std::hel::mbstowcs; */
    127 /* using std::hel::wcstombs; */
    128 
    129 using std::hel::rand;
    130 using std::hel::srand;
    131 using std::hel::qsort;
    132 /* using std::hel::bsearch; */
    133 /* using std::hel::abs; */
    134 /* using std::hel::labs; */
    135 /* using std::hel::llabs; */
    136 /* using std::hel::div; */
    137 /* using std::hel::ldiv; */
    138 /* using std::hel::lldiv; */
    139 
    14086#endif
  • uspace/lib/cpp/include/cstring

    r4d51c60 rbc56f30  
    3030#define LIBCPP_CSTRING
    3131
    32 
    33 namespace std::hel
    34 {
    35     extern "C" {
    36         #include <str.h>
    37     }
    38 }
     32#define _REALLY_WANT_STRING_H
     33#include <string.h>
    3934
    4035namespace std
    4136{
    42     using std::hel::size_t;
     37    using ::size_t;
    4338
    44     /* using std::hel::strcpy; */
    45     /* using std::hel::strncpy; */
    46     /* using std::hel::strcat; */
    47     /* using std::hel::strncat; */
    48     /* using std::hel::strxfrm; */
     39    using ::strcpy;
     40    using ::strncpy;
     41    using ::strcat;
     42    using ::strncat;
     43    using ::strxfrm;
    4944
    50     /* using std::hel::strlen; */
    51     /* using std::hel::strcmp; */
    52     /* using std::hel::strncmp; */
    53     /* using std::hel::strcoll; */
    54     /* using std::hel::strchr; */
    55     /* using std::hel::strrchr; */
    56     /* using std::hel::strspn; */
    57     /* using std::hel::strcspn; */
    58     /* using std::hel::strpbrk; */
    59     /* using std::hel::strstr; */
    60     /* using std::hel::strok; */
     45    using ::strlen;
     46    using ::strcmp;
     47    using ::strncmp;
     48    using ::strcoll;
     49    using ::strchr;
     50    using ::strrchr;
     51    using ::strspn;
     52    using ::strcspn;
     53    using ::strpbrk;
     54    using ::strstr;
     55    using ::strtok;
    6156
    62     /* using std::hel::memchr; */
    63     using std::hel::memcmp;
    64     using std::hel::memset;
    65     using std::hel::memcpy;
    66     using std::hel::memmove;
     57    using ::memchr;
     58    using ::memcmp;
     59    using ::memset;
     60    using ::memcpy;
     61    using ::memmove;
    6762
    68     /* using std::hel::strerror; */
     63    using ::strerror;
    6964}
    7065
    71 using std::hel::size_t;
    72 
    73 /* using std::hel::strcpy; */
    74 /* using std::hel::strncpy; */
    75 /* using std::hel::strcat; */
    76 /* using std::hel::strncat; */
    77 /* using std::hel::strxfrm; */
    78 
    79 /* using std::hel::strlen; */
    80 /* using std::hel::strcmp; */
    81 /* using std::hel::strncmp; */
    82 /* using std::hel::strcoll; */
    83 /* using std::hel::strchr; */
    84 /* using std::hel::strrchr; */
    85 /* using std::hel::strspn; */
    86 /* using std::hel::strcspn; */
    87 /* using std::hel::strpbrk; */
    88 /* using std::hel::strstr; */
    89 /* using std::hel::strok; */
    90 
    91 /* using std::hel::memchr; */
    92 using std::hel::memcmp;
    93 using std::hel::memset;
    94 using std::hel::memcpy;
    95 using std::hel::memmove;
    96 
    97 /* using std::hel::strerror; */
    98 
    9966#endif
  • uspace/lib/cpp/include/ctime

    r4d51c60 rbc56f30  
    3030#define LIBCPP_CTIME
    3131
    32 
    33 namespace std::hel
    34 {
    35     extern "C" {
    36         #include <time.h>
    37     }
    38 }
     32#include <time.h>
    3933
    4034namespace std
    4135{
    42     /* using std::hel::clock_t; */
    43     using std::hel::size_t;
    44     using std::hel::time_t;
    45     using std::hel::tm;
    46     /* using std::hel::timespec; */
     36    using ::clock_t;
     37    using ::size_t;
     38    using ::time_t;
     39    using ::tm;
     40    using ::timespec;
    4741
    48     /* using std::hel::clock; */
    49     using std::hel::time;
    50     using std::hel::difftime;
     42    using ::clock;
     43    using ::time;
     44    using ::difftime;
    5145
    52     /* using std::hel::ctime; */
    53     /* using std::hel::asctime; */
    54     using std::hel::strftime;
    55     /* using std::hel::wcsftime; */
    56     /* using std::hel::gmtime; */
    57     /* using std::hel::localtime; */
    58     using std::hel::mktime;
     46    using ::ctime;
     47    using ::asctime;
     48    using ::strftime;
     49    /* using ::wcsftime; */
     50    /* using ::gmtime; */
     51    /* using ::localtime; */
     52    using ::mktime;
    5953}
    6054
    61 /* using std::hel::clock_t; */
    62 using std::hel::size_t;
    63 using std::hel::time_t;
    64 using std::hel::tm;
    65 /* using std::hel::timespec; */
    66 
    67 /* using std::hel::clock; */
    68 using std::hel::time;
    69 using std::hel::difftime;
    70 
    71 /* using std::hel::ctime; */
    72 /* using std::hel::asctime; */
    73 using std::hel::strftime;
    74 /* using std::hel::wcsftime; */
    75 /* using std::hel::gmtime; */
    76 /* using std::hel::localtime; */
    77 using std::hel::mktime;
    78 
    7955#endif
  • uspace/lib/cpp/include/cwchar

    r4d51c60 rbc56f30  
    3030#define LIBCPP_WCHAR
    3131
    32 
    33 namespace std::hel
    34 {
    35     extern "C" {
    36         #include <wchar.h>
    37         #include <time.h>
    38     }
    39 }
     32#include <wchar.h>
     33#include <time.h>
    4034
    4135namespace std
    4236{
    43     /* using std::hel::mbstate_t; */
    44     using std::hel::size_t;
    45     using std::hel::wint_t;
    46     using std::hel::tm;
     37    /* using ::mbstate_t; */
     38    using ::size_t;
     39    using ::wint_t;
     40    using ::tm;
    4741
    48     /* using std::hel::wcscpy; */
    49     /* using std::hel::wcsncpy; */
    50     /* using std::hel::wcscat; */
    51     /* using std::hel::wcsncat; */
    52     /* using std::hel::wcsnxfrm; */
     42    /* using ::wcscpy; */
     43    /* using ::wcsncpy; */
     44    /* using ::wcscat; */
     45    /* using ::wcsncat; */
     46    /* using ::wcsnxfrm; */
    5347
    54     /* using std::hel::wcslen; */
    55     /* using std::hel::wcscmp; */
    56     /* using std::hel::wcsncmp; */
    57     /* using std::hel::wcscoll; */
    58     /* using std::hel::wcschr; */
    59     /* using std::hel::wcsrchr; */
    60     /* using std::hel::wcsspn; */
    61     /* using std::hel::wcscspn; */
    62     /* using std::hel::wcspbrk; */
    63     /* using std::hel::wcsstr; */
    64     /* using std::hel::wcstok; */
     48    /* using ::wcslen; */
     49    /* using ::wcscmp; */
     50    /* using ::wcsncmp; */
     51    /* using ::wcscoll; */
     52    /* using ::wcschr; */
     53    /* using ::wcsrchr; */
     54    /* using ::wcsspn; */
     55    /* using ::wcscspn; */
     56    /* using ::wcspbrk; */
     57    /* using ::wcsstr; */
     58    /* using ::wcstok; */
    6559
    66     /* using std::hel::wmemcpy; */
    67     /* using std::hel::wmemmove; */
    68     /* using std::hel::wmemcmp; */
    69     /* using std::hel::wmemchr; */
    70     /* using std::hel::wmemset; */
     60    /* using ::wmemcpy; */
     61    /* using ::wmemmove; */
     62    /* using ::wmemcmp; */
     63    /* using ::wmemchr; */
     64    /* using ::wmemset; */
    7165
    72     /* using std::hel::msbinit; */
    73     /* using std::hel::btowc; */
    74     /* using std::hel::wctob; */
    75     /* using std::hel::mbrlen; */
    76     /* using std::hel::mbrtowc; */
    77     /* using std::hel::wctomb; */
    78     /* using std::hel::mbsrtowcs; */
    79     /* using std::hel::wcsrtombs; */
     66    /* using ::msbinit; */
     67    /* using ::btowc; */
     68    /* using ::wctob; */
     69    /* using ::mbrlen; */
     70    /* using ::mbrtowc; */
     71    /* using ::wctomb; */
     72    /* using ::mbsrtowcs; */
     73    /* using ::wcsrtombs; */
    8074
    81     /* using std::hel::fgetwc; */
    82     /* using std::hel::getwc; */
    83     /* using std::hel::fgetws; */
    84     /* using std::hel::fputwc; */
    85     /* using std::hel::putwc; */
    86     /* using std::hel::fputws; */
    87     /* using std::hel::getwchar; */
    88     /* using std::hel::putwchar; */
    89     /* using std::hel::ungetwc; */
    90     /* using std::hel::fwide; */
    91     /* using std::hel::wscanf; */
    92     /* using std::hel::fwscanf; */
    93     /* using std::hel::swscanf; */
    94     /* using std::hel::vwscanf; */
    95     /* using std::hel::vfwscanf; */
    96     /* using std::hel::vswscanf; */
    97     /* using std::hel::wprintf; */
    98     /* using std::hel::fwprintf; */
    99     /* using std::hel::swprintf; */
     75    /* using ::fgetwc; */
     76    /* using ::getwc; */
     77    /* using ::fgetws; */
     78    /* using ::fputwc; */
     79    /* using ::putwc; */
     80    /* using ::fputws; */
     81    /* using ::getwchar; */
     82    /* using ::putwchar; */
     83    /* using ::ungetwc; */
     84    /* using ::fwide; */
     85    /* using ::wscanf; */
     86    /* using ::fwscanf; */
     87    /* using ::swscanf; */
     88    /* using ::vwscanf; */
     89    /* using ::vfwscanf; */
     90    /* using ::vswscanf; */
     91    /* using ::wprintf; */
     92    /* using ::fwprintf; */
     93    /* using ::swprintf; */
    10094
    101     /* using std::hel::wcsftime; */
    102     /* using std::hel::wcstol; */
    103     /* using std::hel::wcstoll; */
    104     /* using std::hel::wcstoul; */
    105     /* using std::hel::wcstoull; */
    106     /* using std::hel::wcstof; */
    107     /* using std::hel::wcstod; */
    108     /* using std::hel::wcstold; */
     95    /* using ::wcsftime; */
     96    /* using ::wcstol; */
     97    /* using ::wcstoll; */
     98    /* using ::wcstoul; */
     99    /* using ::wcstoull; */
     100    /* using ::wcstof; */
     101    /* using ::wcstod; */
     102    /* using ::wcstold; */
    109103}
    110104
    111 /* using std::hel::mbstate_t; */
    112 using std::hel::size_t;
    113 using std::hel::wint_t;
    114 using std::hel::tm;
    115 
    116 /* using std::hel::wcscpy; */
    117 /* using std::hel::wcsncpy; */
    118 /* using std::hel::wcscat; */
    119 /* using std::hel::wcsncat; */
    120 /* using std::hel::wcsnxfrm; */
    121 
    122 /* using std::hel::wcslen; */
    123 /* using std::hel::wcscmp; */
    124 /* using std::hel::wcsncmp; */
    125 /* using std::hel::wcscoll; */
    126 /* using std::hel::wcschr; */
    127 /* using std::hel::wcsrchr; */
    128 /* using std::hel::wcsspn; */
    129 /* using std::hel::wcscspn; */
    130 /* using std::hel::wcspbrk; */
    131 /* using std::hel::wcsstr; */
    132 /* using std::hel::wcstok; */
    133 
    134 /* using std::hel::wmemcpy; */
    135 /* using std::hel::wmemmove; */
    136 /* using std::hel::wmemcmp; */
    137 /* using std::hel::wmemchr; */
    138 /* using std::hel::wmemset; */
    139 
    140 /* using std::hel::msbinit; */
    141 /* using std::hel::btowc; */
    142 /* using std::hel::wctob; */
    143 /* using std::hel::mbrlen; */
    144 /* using std::hel::mbrtowc; */
    145 /* using std::hel::wctomb; */
    146 /* using std::hel::mbsrtowcs; */
    147 /* using std::hel::wcsrtombs; */
    148 
    149 /* using std::hel::fgetwc; */
    150 /* using std::hel::getwc; */
    151 /* using std::hel::fgetws; */
    152 /* using std::hel::fputwc; */
    153 /* using std::hel::putwc; */
    154 /* using std::hel::fputws; */
    155 /* using std::hel::getwchar; */
    156 /* using std::hel::putwchar; */
    157 /* using std::hel::ungetwc; */
    158 /* using std::hel::fwide; */
    159 /* using std::hel::wscanf; */
    160 /* using std::hel::fwscanf; */
    161 /* using std::hel::swscanf; */
    162 /* using std::hel::vwscanf; */
    163 /* using std::hel::vfwscanf; */
    164 /* using std::hel::vswscanf; */
    165 /* using std::hel::wprintf; */
    166 /* using std::hel::fwprintf; */
    167 /* using std::hel::swprintf; */
    168 
    169 /* using std::hel::wcsftime; */
    170 /* using std::hel::wcstol; */
    171 /* using std::hel::wcstoll; */
    172 /* using std::hel::wcstoul; */
    173 /* using std::hel::wcstoull; */
    174 /* using std::hel::wcstof; */
    175 /* using std::hel::wcstod; */
    176 /* using std::hel::wcstold; */
    177 
    178105#endif
  • uspace/lib/cpp/src/stdexcept.cpp

    r4d51c60 rbc56f30  
    3131#include <stdexcept>
    3232#include <string>
     33#include <str.h>
    3334
    3435namespace std
    3536{
    3637    logic_error::logic_error(const string& what)
    37         : what_{hel::str_dup(what.c_str())}
     38        : what_{::helenos::str_dup(what.c_str())}
    3839    { /* DUMMY BODY */ }
    3940
    4041    logic_error::logic_error(const char* what)
    41         : what_{hel::str_dup(what)}
     42        : what_{::helenos::str_dup(what)}
    4243    { /* DUMMY BODY */ }
    4344
    4445    logic_error::logic_error(const logic_error& other) noexcept
    45         : exception{other}, what_{hel::str_dup(other.what_)}
     46        : exception{other}, what_{::helenos::str_dup(other.what_)}
    4647    { /* DUMMY BODY */ }
    4748
     
    5051        if (what_)
    5152            free(what_);
    52         what_ = hel::str_dup(other.what_);
     53        what_ = ::helenos::str_dup(other.what_);
    5354
    5455        return *this;
     
    114115
    115116    runtime_error::runtime_error(const string& what)
    116         : what_{hel::str_dup(what.c_str())}
     117        : what_{::helenos::str_dup(what.c_str())}
    117118    { /* DUMMY BODY */ }
    118119
    119120    runtime_error::runtime_error(const char* what)
    120         : what_{hel::str_dup(what)}
     121        : what_{::helenos::str_dup(what)}
    121122    { /* DUMMY BODY */ }
    122123
    123124    runtime_error::runtime_error(const runtime_error& other) noexcept
    124         : exception{other}, what_{hel::str_dup(other.what_)}
     125        : exception{other}, what_{::helenos::str_dup(other.what_)}
    125126    { /* DUMMY BODY */ }
    126127
     
    129130        if (what_)
    130131            free(what_);
    131         what_ = hel::str_dup(other.what_);
     132        what_ = ::helenos::str_dup(other.what_);
    132133
    133134        return *this;
  • uspace/lib/cpp/src/string.cpp

    r4d51c60 rbc56f30  
    4242    {
    4343        char* end;
    44         long result = hel::strtol(str.c_str(), &end, base);
     44        long result = ::strtol(str.c_str(), &end, base);
    4545
    4646        if (end != str.c_str())
     
    5858    {
    5959        char* end;
    60         unsigned long result = hel::strtoul(str.c_str(), &end, base);
     60        unsigned long result = ::strtoul(str.c_str(), &end, base);
    6161
    6262        if (end != str.c_str())
     
    106106    }
    107107
    108     namespace hel
    109     {
    110         extern "C" int asprintf(char**, const char*, ...);
    111     }
    112 
    113108    string to_string(int val)
    114109    {
    115110        char* tmp;
    116         hel::asprintf(&tmp, "%d", val);
     111        ::asprintf(&tmp, "%d", val);
    117112
    118113        std::string res{tmp};
     
    125120    {
    126121        char* tmp;
    127         hel::asprintf(&tmp, "%u", val);
     122        ::asprintf(&tmp, "%u", val);
    128123
    129124        std::string res{tmp};
     
    136131    {
    137132        char* tmp;
    138         hel::asprintf(&tmp, "%ld", val);
     133        ::asprintf(&tmp, "%ld", val);
    139134
    140135        std::string res{tmp};
     
    147142    {
    148143        char* tmp;
    149         hel::asprintf(&tmp, "%lu", val);
     144        ::asprintf(&tmp, "%lu", val);
    150145
    151146        std::string res{tmp};
     
    158153    {
    159154        char* tmp;
    160         hel::asprintf(&tmp, "%lld", val);
     155        ::asprintf(&tmp, "%lld", val);
    161156
    162157        std::string res{tmp};
     
    169164    {
    170165        char* tmp;
    171         hel::asprintf(&tmp, "%llu", val);
     166        ::asprintf(&tmp, "%llu", val);
    172167
    173168        std::string res{tmp};
     
    180175    {
    181176        char* tmp;
    182         hel::asprintf(&tmp, "%f", val);
     177        ::asprintf(&tmp, "%f", val);
    183178
    184179        std::string res{tmp};
     
    191186    {
    192187        char* tmp;
    193         hel::asprintf(&tmp, "%f", val);
     188        ::asprintf(&tmp, "%f", val);
    194189
    195190        std::string res{tmp};
     
    202197    {
    203198        char* tmp;
    204         hel::asprintf(&tmp, "%Lf", val);
     199        ::asprintf(&tmp, "%Lf", val);
    205200
    206201        std::string res{tmp};
  • uspace/lib/cpp/src/typeinfo.cpp

    r4d51c60 rbc56f30  
    3838    bool type_info::operator==(const type_info& other) const noexcept
    3939    {
    40         return (this == &other) ||
    41                std::hel::str_cmp(name(), other.name());
     40        return (this == &other) || ::strcmp(name(), other.name()) == 0;
    4241    }
    4342
  • uspace/lib/pcm/src/format.c

    r4d51c60 rbc56f30  
    4040#include <stdio.h>
    4141#include <inttypes.h>
     42#include <limits.h>
    4243
    4344#include "format.h"
  • uspace/lib/posix/Makefile

    r4d51c60 rbc56f30  
    4141        ../hound/libhound.a \
    4242        ../pcm/libpcm.a \
     43        ../cpp/libcpp.a \
    4344        $(LIBC_PREFIX)/libc.a \
    4445        $(LIBC_PREFIX)/crt0.o \
     
    9697        $(COMMON_CFLAGS)
    9798
     99EXPORT_CXXFLAGS = \
     100        $(COMMON_CXXFLAGS)
     101
    98102include $(USPACE_PREFIX)/Makefile.common
    99103
     
    109113        echo 'HELENOS_CPPFLAGS="$(EXPORT_CPPFLAGS)"' >> $@.new
    110114        echo 'HELENOS_CFLAGS="$(EXPORT_CFLAGS)"' >> $@.new
    111         echo 'HELENOS_CXXFLAGS="$(EXPORT_CFLAGS)"' >> $@.new
     115        echo 'HELENOS_CXXFLAGS="$(EXPORT_CXXFLAGS)"' >> $@.new
    112116        echo 'HELENOS_LDFLAGS="$(EXPORT_LDFLAGS)"' >> $@.new
    113117        echo 'HELENOS_LDLIBS="$(EXPORT_LDLIBS)"' >> $@.new
     
    146150        mkdir -p $(EXPORT_DIR)/include.new/libpcm
    147151        cp -r -L -t $(EXPORT_DIR)/include.new/libpcm ../pcm/include/*
     152        mkdir -p $(EXPORT_DIR)/include.new/libcpp
     153        cp -r -L -t $(EXPORT_DIR)/include.new/libcpp ../cpp/include/*
    148154        mv $(EXPORT_DIR)/include.new $(EXPORT_DIR)/include
  • uspace/lib/posix/include/posix/ctype.h

    r4d51c60 rbc56f30  
    3939#include <libc/ctype.h>
    4040
     41__C_DECLS_BEGIN;
     42
    4143/* Obsolete Functions and Macros */
    4244extern int isascii(int c);
     
    4648#define _toupper(c) ((c) - 'a' + 'A')
    4749
     50__C_DECLS_END;
     51
    4852#endif /* POSIX_CTYPE_H_ */
    4953
  • uspace/lib/posix/include/posix/dlfcn.h

    r4d51c60 rbc56f30  
    4141#define RTLD_LOCAL 0
    4242
     43__C_DECLS_BEGIN;
     44
    4345extern void *dlopen(const char *, int);
    4446extern void *dlsym(void *, const char *);
    4547extern int dlclose(void *);
    4648extern char *dlerror(void);
     49
     50__C_DECLS_END;
    4751
    4852#endif
  • uspace/lib/posix/include/posix/fcntl.h

    r4d51c60 rbc56f30  
    3838#include <sys/types.h>
    3939
    40 #undef O_CREAT
    41 #undef O_EXCL
    42 #undef O_TRUNC
    43 #undef O_APPEND
    44 #undef O_RDONLY
    45 #undef O_RDWR
    46 #undef O_WRONLY
    4740#define O_CREAT   1
    4841#define O_EXCL    2
     
    5447
    5548/* Mask for file access modes. */
    56 #undef O_ACCMODE
    5749#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
    5850
    5951/* Dummy compatibility flag */
    60 #undef O_NOCTTY
    6152#define O_NOCTTY 0
    6253
    6354/* fcntl commands */
    64 #undef F_DUPFD
    65 #undef F_DUPFD_CLOEXEC
    66 #undef F_GETFD
    67 #undef F_SETFD
    68 #undef F_GETFL
    69 #undef F_SETFL
    70 #undef F_GETOWN
    71 #undef F_SETOWN
    72 #undef F_GETLK
    73 #undef F_SETLK
    74 #undef F_SETLKW
    7555#define F_DUPFD            0 /* Duplicate file descriptor. */
    7656#define F_DUPFD_CLOEXEC    1 /* Same as F_DUPFD but with FD_CLOEXEC flag set. */
     
    8666
    8767/* File descriptor flags used with F_GETFD and F_SETFD. */
    88 #undef FD_CLOEXEC
    8968#define FD_CLOEXEC         1 /* Close on exec. */
     69
     70__C_DECLS_BEGIN;
    9071
    9172extern int open(const char *pathname, int flags, ...);
    9273extern int fcntl(int fd, int cmd, ...);
     74
     75__C_DECLS_END;
    9376
    9477#endif /* POSIX_FCNTL_H_ */
  • uspace/lib/posix/include/posix/fnmatch.h

    r4d51c60 rbc56f30  
    3636#define POSIX_FNMATCH_H_
    3737
     38#include <_bits/decls.h>
     39
    3840/* Error Values */
    39 #undef FNM_NOMATCH
    4041#define FNM_NOMATCH 1
    4142
    4243/* Flags */
    43 #undef FNM_PATHNAME
    44 #undef FNM_PERIOD
    45 #undef FNM_NOESCAPE
    4644#define FNM_PATHNAME 1
    4745#define FNM_PERIOD 2
     
    4947
    5048/* GNU Extensions */
    51 #undef FNM_FILE_NAME
    52 #undef FNM_LEADING_DIR
    53 #undef FNM_CASEFOLD
    5449#define FNM_FILE_NAME FNM_PATHNAME
    5550#define FNM_LEADING_DIR 8
    5651#define FNM_CASEFOLD 16
    5752
     53__C_DECLS_BEGIN;
     54
    5855extern int fnmatch(const char *pattern, const char *string, int flags);
     56
     57__C_DECLS_END;
    5958
    6059#endif /* POSIX_FNMATCH_H_ */
  • uspace/lib/posix/include/posix/locale.h

    r4d51c60 rbc56f30  
    3737
    3838#include <stddef.h>
     39#include <_bits/decls.h>
    3940
    40 #ifndef __locale_t_defined
    41 #define __locale_t_defined
    42 typedef struct __posix_locale *locale_t;
    43 #endif
    44 
    45 #undef LC_ALL
    46 #undef LC_COLLATE
    47 #undef LC_CTYPE
    48 #undef LC_MESSAGES
    49 #undef LC_MONETARY
    50 #undef LC_NUMERIC
    51 #undef LC_TIME
    5241#define LC_ALL 0
    5342#define LC_COLLATE 1
     
    5847#define LC_TIME 6
    5948
    60 #undef LC_COLLATE_MASK
    61 #undef LC_CTYPE_MASK
    62 #undef LC_MESSAGES_MASK
    63 #undef LC_MONETARY_MASK
    64 #undef LC_NUMERIC_MASK
    65 #undef LC_TIME_MASK
    66 #undef LC_ALL_MASK
    6749#define LC_COLLATE_MASK (1 << 0)
    6850#define LC_CTYPE_MASK (1 << 1)
     
    7456    LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
    7557
    76 #undef LC_GLOBAL_LOCALE
    7758#define LC_GLOBAL_LOCALE NULL
     59
     60__C_DECLS_BEGIN;
     61
     62#ifndef __locale_t_defined
     63#define __locale_t_defined
     64typedef struct __posix_locale *locale_t;
     65#endif
    7866
    7967struct lconv {
     
    114102extern locale_t uselocale(locale_t newloc);
    115103
     104__C_DECLS_END;
     105
    116106#endif /* POSIX_LOCALE_H_ */
    117107
  • uspace/lib/posix/include/posix/pthread.h

    r4d51c60 rbc56f30  
    3434
    3535#include <time.h>
     36#include <_bits/decls.h>
     37
     38#define PTHREAD_MUTEX_RECURSIVE 1
     39
     40#define PTHREAD_MUTEX_INITIALIZER { 0 }
     41
     42#define PTHREAD_COND_INITIALIZER { 0 }
     43
     44__C_DECLS_BEGIN;
    3645
    3746typedef void *pthread_t;
     
    4352typedef int pthread_key_t;
    4453
    45 #define PTHREAD_MUTEX_RECURSIVE 1
    46 
    4754typedef struct pthread_mutex {
    4855        int dummy;
    4956} pthread_mutex_t;
    50 
    51 #define PTHREAD_MUTEX_INITIALIZER { 0 }
    5257
    5358typedef struct {
     
    6267        int dummy;
    6368} pthread_cond_t;
    64 
    65 #define PTHREAD_COND_INITIALIZER { 0 }
    6669
    6770extern pthread_t pthread_self(void);
     
    106109extern int pthread_key_create(pthread_key_t *, void (*)(void *));
    107110
     111__C_DECLS_END;
     112
    108113#endif
    109114
  • uspace/lib/posix/include/posix/pwd.h

    r4d51c60 rbc56f30  
    3737
    3838#include <sys/types.h>
     39#include <_bits/decls.h>
     40
     41__C_DECLS_BEGIN;
    3942
    4043struct passwd {
     
    5861    char *buffer, size_t bufsize, struct passwd **result);
    5962
     63__C_DECLS_END;
     64
    6065#endif /* POSIX_PWD_H_ */
    6166
  • uspace/lib/posix/include/posix/signal.h

    r4d51c60 rbc56f30  
    3939#include <ucontext.h>
    4040
    41 extern void __posix_default_signal_handler(int signo);
    42 extern void __posix_hold_signal_handler(int signo);
    43 extern void __posix_ignore_signal_handler(int signo);
    44 
    45 #undef SIG_DFL
    4641#define SIG_DFL ((void (*)(int)) __posix_default_signal_handler)
    47 #undef SIG_ERR
    4842#define SIG_ERR ((void (*)(int)) NULL)
    49 #undef SIG_HOLD
    5043#define SIG_HOLD ((void (*)(int)) __posix_hold_signal_handler)
    51 #undef SIG_IGN
    5244#define SIG_IGN ((void (*)(int)) __posix_ignore_signal_handler)
    5345
    54 typedef struct {
    55         int si_signo;
    56         int si_code;
    57 
    58         int si_errno;
    59 
    60         pid_t si_pid;
    61         uid_t si_uid;
    62         void *si_addr;
    63         int si_status;
    64 
    65         long si_band;
    66 
    67         union sigval si_value;
    68 } siginfo_t;
    69 
    70 struct sigaction {
    71         void (*sa_handler)(int);
    72         sigset_t sa_mask;
    73         int sa_flags;
    74         void (*sa_sigaction)(int, siginfo_t *, void *);
    75 };
    76 
    7746/* Values of sigevent::sigev_notify */
    78 #undef SIGEV_NONE
    79 #undef SIGEV_SIGNAL
    80 #undef SIGEV_THREAD
    8147#define SIGEV_NONE 0
    8248#define SIGEV_SIGNAL 0
    8349#define SIGEV_THREAD 0
    8450
    85 #undef SIGRT_MIN
    86 #undef SIGRT_MAX
    8751#define SIGRT_MIN 0
    8852#define SIGRT_MAX 0
    8953
    90 #undef SIG_BLOCK
    91 #undef SIG_UNBLOCK
    92 #undef SIG_SETMASK
    9354#define SIG_BLOCK 0
    9455#define SIG_UNBLOCK 1
    9556#define SIG_SETMASK 2
    9657
    97 #undef SA_NOCLDSTOP
    98 #undef SA_ONSTACK
    99 #undef SA_RESETHAND
    100 #undef SA_RESTART
    101 #undef SA_SIGINFO
    102 #undef SA_NOCLDWAIT
    103 #undef SA_NODEFER
    10458#define SA_NOCLDSTOP (1 << 0)
    10559#define SA_ONSTACK (1 << 1)
     
    11064#define SA_NODEFER (1 << 6)
    11165
    112 #undef SS_ONSTACK
    113 #undef SS_DISABLE
    11466#define SS_ONSTACK 0
    11567#define SS_DISABLE 0
    11668
    117 #undef MINSIGSTKSZ
    118 #undef SIGSTKSZ
    11969#define MINSIGSTKSZ 0
    12070#define SIGSTKSZ 0
     71
     72__C_DECLS_BEGIN;
     73
     74extern void __posix_default_signal_handler(int signo);
     75extern void __posix_hold_signal_handler(int signo);
     76extern void __posix_ignore_signal_handler(int signo);
     77
     78typedef struct {
     79        int si_signo;
     80        int si_code;
     81
     82        int si_errno;
     83
     84        pid_t si_pid;
     85        uid_t si_uid;
     86        void *si_addr;
     87        int si_status;
     88
     89        long si_band;
     90
     91        union sigval si_value;
     92} siginfo_t;
     93
     94struct sigaction {
     95        void (*sa_handler)(int);
     96        sigset_t sa_mask;
     97        int sa_flags;
     98        void (*sa_sigaction)(int, siginfo_t *, void *);
     99};
    121100
    122101/* Full POSIX set */
     
    245224    sigset_t *__restrict__ oset);
    246225
     226__C_DECLS_END;
     227
    247228#endif /* POSIX_SIGNAL_H_ */
    248229
  • uspace/lib/posix/include/posix/stdio.h

    r4d51c60 rbc56f30  
    4545#include <limits.h>
    4646
     47#define P_tmpdir "/tmp"
     48
     49#define L_ctermid PATH_MAX
     50
     51__C_DECLS_BEGIN;
     52
    4753extern FILE *fdopen(int, const char *);
    4854extern int fileno(FILE *);
    4955
    50 #define P_tmpdir "/tmp"
    51 
    5256/* Identifying the Terminal */
    53 #undef L_ctermid
    54 #define L_ctermid PATH_MAX
    5557extern char *ctermid(char *s);
    5658
     
    98100extern char *tempnam(const char *dir, const char *pfx);
    99101
     102__C_DECLS_END;
     103
    100104#endif /* POSIX_STDIO_H_ */
    101105
  • uspace/lib/posix/include/posix/stdlib.h

    r4d51c60 rbc56f30  
    4242#include <stddef.h>
    4343
     44__C_DECLS_BEGIN;
     45
    4446/* Environment Access */
    4547extern int putenv(char *string);
     
    6062extern int bsd_getloadavg(double loadavg[], int nelem);
    6163
     64__C_DECLS_END;
     65
    6266#endif  // POSIX_STDLIB_H_
    6367
  • uspace/lib/posix/include/posix/string.h

    r4d51c60 rbc56f30  
    4747
    4848#include <libc/mem.h>
    49 #ifdef _HELENOS_SOURCE
    50 #undef _HELENOS_SOURCE
     49
     50#define _REALLY_WANT_STRING_H
    5151#include <libc/string.h>
    52 #define _HELENOS_SOURCE
    53 #else
    54 #include <libc/string.h>
    55 #endif
     52
     53__C_DECLS_BEGIN;
    5654
    5755/* Copying and Concatenation */
     
    7371
    7472/* Legacy Declarations */
    75 #ifndef POSIX_STRINGS_H_
    7673extern int ffs(int i);
    7774extern int strcasecmp(const char *s1, const char *s2);
    7875extern int strncasecmp(const char *s1, const char *s2, size_t n);
    79 #endif
     76
     77__C_DECLS_END;
    8078
    8179#endif  // POSIX_STRING_H_
  • uspace/lib/posix/include/posix/strings.h

    r4d51c60 rbc56f30  
    3939#include <types/common.h>
    4040
     41__C_DECLS_BEGIN;
     42
    4143/* Search Functions */
    42 #ifndef POSIX_STRING_H_
    4344extern int ffs(int i);
    44 #endif
    4545
    4646/* String/Array Comparison */
    47 #ifndef POSIX_STRING_H_
    4847extern int strcasecmp(const char *s1, const char *s2);
    4948extern int strncasecmp(const char *s1, const char *s2, size_t n);
    50 #endif
    5149
    5250/*
     
    6462extern char *rindex(const char *s, int c);
    6563
     64__C_DECLS_END;
     65
    6666#endif  // POSIX_STRINGS_H_
    6767
  • uspace/lib/posix/include/posix/sys/mman.h

    r4d51c60 rbc56f30  
    3737
    3838#include <sys/types.h>
    39 #include <abi/mm/as.h>
     39#include <_bits/decls.h>
    4040
    41 #define MAP_FAILED ((void *) -1)
     41#define MAP_FAILED  ((void *) -1)
    4242
    4343#define MAP_SHARED     (1 << 0)
     
    4545#define MAP_FIXED      (1 << 2)
    4646#define MAP_ANONYMOUS  (1 << 3)
    47 #define MAP_ANON MAP_ANONYMOUS
     47#define MAP_ANON       MAP_ANONYMOUS
    4848
    49 #undef PROT_NONE
    50 #undef PROT_READ
    51 #undef PROT_WRITE
    52 #undef PROT_EXEC
    53 #define PROT_NONE  0
    54 #define PROT_READ  AS_AREA_READ
    55 #define PROT_WRITE AS_AREA_WRITE
    56 #define PROT_EXEC  AS_AREA_EXEC
     49#define PROT_NONE   0
     50#define PROT_READ   1
     51#define PROT_WRITE  2
     52#define PROT_EXEC   4
     53
     54__C_DECLS_BEGIN;
    5755
    5856extern void *mmap(void *start, size_t length, int prot, int flags, int fd,
     
    6058extern int munmap(void *start, size_t length);
    6159
     60__C_DECLS_END;
     61
    6262#endif /* POSIX_SYS_MMAN_H_ */
    6363
  • uspace/lib/posix/include/posix/sys/stat.h

    r4d51c60 rbc56f30  
    3939#include <sys/types.h>
    4040#include <time.h>
     41#include <_bits/decls.h>
    4142
    4243/* values are the same as on Linux */
    4344
    44 #undef S_IFMT
    45 #undef S_IFSOCK
    46 #undef S_IFLNK
    47 #undef S_IFREG
    48 #undef S_IFBLK
    49 #undef S_IFDIR
    50 #undef S_IFCHR
    51 #undef S_IFIFO
    5245#define S_IFMT     0170000   /* all file types */
    5346#define S_IFSOCK   0140000   /* socket */
     
    5952#define S_IFIFO    0010000   /* FIFO */
    6053
    61 #undef S_ISUID
    62 #undef S_ISGID
    63 #undef S_ISVTX
    6454#define S_ISUID    0004000   /* SUID */
    6555#define S_ISGID    0002000   /* SGID */
    6656#define S_ISVTX    0001000   /* sticky */
    6757
    68 #undef S_IRWXU
    69 #undef S_IRUSR
    70 #undef S_IWUSR
    71 #undef S_IXUSR
    7258#define S_IRWXU    00700     /* owner permissions */
    7359#define S_IRUSR    00400
     
    7561#define S_IXUSR    00100
    7662
    77 #undef S_IRWXG
    78 #undef S_IRGRP
    79 #undef S_IWGRP
    80 #undef S_IXGRP
    8163#define S_IRWXG    00070     /* group permissions */
    8264#define S_IRGRP    00040
     
    8466#define S_IXGRP    00010
    8567
    86 #undef S_IRWXO
    87 #undef S_IROTH
    88 #undef S_IWOTH
    89 #undef S_IXOTH
    9068#define S_IRWXO    00007     /* other permissions */
    9169#define S_IROTH    00004
     
    9371#define S_IXOTH    00001
    9472
    95 #undef S_ISREG
    96 #undef S_ISDIR
    97 #undef S_ISCHR
    98 #undef S_ISBLK
    99 #undef S_ISFIFO
    100 #undef S_ISLNK
    101 #undef S_ISSOCK
    10273#define S_ISREG(m) ((m & S_IFREG) != 0)
    10374#define S_ISDIR(m) ((m & S_IFDIR) != 0)
     
    10778#define S_ISLNK(m) ((m & S_IFLNK) != 0) /* symbolic link? (Not in POSIX.1-1996.) */
    10879#define S_ISSOCK(m) ((m & S_IFSOCK) != 0) /* socket? (Not in POSIX.1-1996.) */
     80
     81__C_DECLS_BEGIN;
    10982
    11083struct stat {
     
    131104extern int mkdir(const char *path, mode_t mode);
    132105
     106__C_DECLS_END;
     107
    133108#endif /* POSIX_SYS_STAT_H */
    134109
  • uspace/lib/posix/include/posix/sys/time.h

    r4d51c60 rbc56f30  
    3535
    3636#include <time.h>
     37#include <_bits/decls.h>
     38
     39__C_DECLS_BEGIN;
    3740
    3841struct timeval {
     
    4346extern int gettimeofday(struct timeval *, void *);
    4447
     48__C_DECLS_END;
     49
    4550#endif
    4651
  • uspace/lib/posix/include/posix/sys/types.h

    r4d51c60 rbc56f30  
    3737#define POSIX_SYS_TYPES_H_
    3838
    39 #include <types/common.h>
     39#include <stddef.h>
     40#include <stdint.h>
     41#include <_bits/ssize_t.h>
     42#include <_bits/decls.h>
     43
     44__C_DECLS_BEGIN;
    4045
    4146typedef unsigned int ino_t;
     
    4651typedef long blkcnt_t;
    4752typedef int pid_t;
    48 typedef sysarg_t dev_t;
     53typedef unsigned long dev_t;
    4954typedef unsigned int mode_t;
    5055
     
    6772typedef long suseconds_t;
    6873
     74__C_DECLS_END;
     75
    6976#endif /* POSIX_SYS_TYPES_H_ */
    7077
  • uspace/lib/posix/include/posix/sys/wait.h

    r4d51c60 rbc56f30  
    3737
    3838#include <sys/types.h>
     39#include <_bits/decls.h>
    3940
    40 #undef WIFEXITED
    41 #undef WEXITSTATUS
    42 #undef WIFSIGNALED
    43 #undef WTERMSIG
    4441#define WIFEXITED(status) __posix_wifexited(status)
    4542#define WEXITSTATUS(status) __posix_wexitstatus(status)
    4643#define WIFSIGNALED(status) __posix_wifsignaled(status)
    4744#define WTERMSIG(status) __posix_wtermsig(status)
     45
     46__C_DECLS_BEGIN;
    4847
    4948extern int __posix_wifexited(int status);
     
    5554extern pid_t waitpid(pid_t pid, int *stat_ptr, int options);
    5655
     56__C_DECLS_END;
     57
    5758#endif /* POSIX_SYS_WAIT_H_ */
    5859
  • uspace/lib/posix/include/posix/time.h

    r4d51c60 rbc56f30  
    4141#include <libc/time.h>
    4242
     43#define CLOCK_REALTIME ((clockid_t) 0)
     44
     45#define ASCTIME_BUF_LEN  26
     46
     47__C_DECLS_BEGIN;
     48
    4349#ifndef __locale_t_defined
    4450#define __locale_t_defined
     
    4652#endif
    4753
    48 #ifndef POSIX_SIGNAL_H_
    4954struct sigevent;
    50 #endif
    51 
    52 #undef CLOCK_REALTIME
    53 #define CLOCK_REALTIME ((clockid_t) 0)
    54 
    55 #define ASCTIME_BUF_LEN  26
    5655
    5756struct itimerspec {
     
    9796    const struct timespec *rqtp, struct timespec *rmtp);
    9897
     98__C_DECLS_END;
     99
    99100#endif  // POSIX_TIME_H_
    100101
  • uspace/lib/posix/include/posix/ucontext.h

    r4d51c60 rbc56f30  
    3737
    3838#include <sys/types.h>
     39#include <_bits/decls.h>
     40
     41__C_DECLS_BEGIN;
    3942
    4043typedef int sig_atomic_t;
     
    7174} ucontext_t;
    7275
     76__C_DECLS_END;
     77
    7378#endif
    7479
  • uspace/lib/posix/include/posix/unistd.h

    r4d51c60 rbc56f30  
    4646/* Process Termination */
    4747#define _exit exit
     48
     49/* Standard Streams */
     50#define STDIN_FILENO (fileno(stdin))
     51#define STDOUT_FILENO (fileno(stdout))
     52#define STDERR_FILENO (fileno(stderr))
     53
     54#define F_OK 0 /* Test for existence. */
     55#define X_OK 1 /* Test for execute permission. */
     56#define W_OK 2 /* Test for write permission. */
     57#define R_OK 4 /* Test for read permission. */
     58
     59__C_DECLS_BEGIN;
    4860
    4961extern char *optarg;
     
    106118#endif
    107119
    108 /* Standard Streams */
    109 #undef STDIN_FILENO
    110 #define STDIN_FILENO (fileno(stdin))
    111 #undef STDOUT_FILENO
    112 #define STDOUT_FILENO (fileno(stdout))
    113 #undef STDERR_FILENO
    114 #define STDERR_FILENO (fileno(stderr))
    115 
    116120/* File Accessibility */
    117 #undef F_OK
    118 #undef X_OK
    119 #undef W_OK
    120 #undef R_OK
    121 #define F_OK 0 /* Test for existence. */
    122 #define X_OK 1 /* Test for execute permission. */
    123 #define W_OK 2 /* Test for write permission. */
    124 #define R_OK 4 /* Test for read permission. */
    125121extern int access(const char *path, int amode);
    126122
     
    171167extern unsigned int alarm(unsigned int);
    172168
     169__C_DECLS_END;
     170
    173171#endif /* POSIX_UNISTD_H_ */
    174172
  • uspace/lib/posix/src/internal/common.h

    r4d51c60 rbc56f30  
    6767}
    6868
     69// TODO: Remove this arbitrary limit.
     70#define VFS_MAX_OPEN_FILES 128
     71
    6972extern aoff64_t posix_pos[VFS_MAX_OPEN_FILES];
    7073
  • uspace/lib/posix/src/sys/mman.c

    r4d51c60 rbc56f30  
    3939#include <unistd.h>
    4040
     41static int _prot_to_as(int prot)
     42{
     43        int ret = 0;
     44
     45        if (prot & PROT_READ)
     46                ret |= AS_AREA_READ;
     47
     48        if (prot & PROT_WRITE)
     49                ret |= AS_AREA_WRITE;
     50
     51        if (prot & PROT_EXEC)
     52                ret |= AS_AREA_EXEC;
     53
     54        return ret;
     55}
     56
    4157void *mmap(void *start, size_t length, int prot, int flags, int fd,
    4258    off_t offset)
     
    5369                return MAP_FAILED;
    5470
    55         return as_area_create(start, length, prot, AS_AREA_UNPAGED);
     71        return as_area_create(start, length, _prot_to_as(prot), AS_AREA_UNPAGED);
    5672}
    5773
  • uspace/srv/vfs/vfs.h

    r4d51c60 rbc56f30  
    4949#define dprintf(...)
    5050#endif
     51
     52// TODO: Remove this arbitrary limit.
     53/** Maximum number of open files per client. */
     54#define VFS_MAX_OPEN_FILES  128
    5155
    5256/**
Note: See TracChangeset for help on using the changeset viewer.