Changeset 2b3dd78 in mainline for uspace/lib/c


Ignore:
Timestamp:
2018-01-31T12:02:00Z (7 years ago)
Author:
Jenda <jenda.jzqk73@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5595841
Parents:
a0a9cc2 (diff), 14d789c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge remote-tracking branch 'upstream/master' into forwardport

change tmon includes because of new stdlib

Location:
uspace/lib/c
Files:
1 added
40 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/Makefile

    ra0a9cc2 r2b3dd78  
    8585        generic/str.c \
    8686        generic/str_error.c \
     87        generic/strtol.c \
    8788        generic/l18n/langs.c \
    8889        generic/fibril.c \
  • uspace/lib/c/arch/ia32/include/libarch/syscall.h

    ra0a9cc2 r2b3dd78  
    4848#define __syscall6  __syscall_slow
    4949
    50 extern sysarg_t (* __syscall_fast_func)(const sysarg_t, const sysarg_t,
     50extern sysarg_t (*__syscall_fast_func)(const sysarg_t, const sysarg_t,
    5151    const sysarg_t, const sysarg_t, const sysarg_t, const sysarg_t,
    5252    const syscall_t);
  • uspace/lib/c/arch/ia32/src/rtld/reloc.c

    ra0a9cc2 r2b3dd78  
    3838#include <stdlib.h>
    3939#include <inttypes.h>
     40#include <str.h>
    4041
    4142#include <libarch/rtld/elf_dyn.h>
  • uspace/lib/c/generic/getopt.c

    ra0a9cc2 r2b3dd78  
    4949int     optopt = '?';           /* character checked for validity */
    5050int     optreset;               /* reset getopt */
    51 const char *optarg;             /* argument associated with option */
     51char    *optarg;                /* argument associated with option */
    5252
    5353
     
    6767#define INORDER (int)1
    6868
    69 #define EMSG    ""
     69static char EMSG[] = "";
    7070
    7171static int getopt_internal(int, char **, const char *);
     
    7373static void permute_args(int, int, int, char **);
    7474
    75 static const char *place = EMSG; /* option letter processing */
     75static char *place = EMSG; /* option letter processing */
    7676
    7777/* XXX: set optreset to 1 rather than these two */
     
    336336        if (retval == -2) {
    337337                char *current_argv;
    338                 const char *has_equal;
     338                char *has_equal;
    339339                size_t current_argv_len;
    340340                int i, ambiguous, match;
  • uspace/lib/c/generic/inet/addr.c

    ra0a9cc2 r2b3dd78  
    4242#include <bitops.h>
    4343#include <inttypes.h>
     44#include <str.h>
    4445
    4546#define INET_PREFIXSTRSIZE  5
  • uspace/lib/c/generic/io/io.c

    ra0a9cc2 r2b3dd78  
    799799}
    800800
    801 int fseek(FILE *stream, long offset, int whence)
     801int fseek64(FILE *stream, off64_t offset, int whence)
    802802{
    803803        errno_t rc;
     
    814814        stream->ungetc_chars = 0;
    815815
    816         struct stat st;
     816        vfs_stat_t st;
    817817        switch (whence) {
    818818        case SEEK_SET:
     
    837837}
    838838
    839 long ftell(FILE *stream)
    840 {
    841         /* The native position is too large for the C99-ish interface. */
    842         if (stream->pos - stream->ungetc_chars > LONG_MAX)
    843                 return EOF;
    844 
     839off64_t ftell64(FILE *stream)
     840{
    845841        if (stream->error)
    846842                return EOF;
     
    853849
    854850        return stream->pos - stream->ungetc_chars;
     851}
     852
     853int fseek(FILE *stream, long offset, int whence)
     854{
     855        return fseek64(stream, offset, whence);
     856}
     857
     858long ftell(FILE *stream)
     859{
     860        off64_t off = ftell64(stream);
     861
     862        /* The native position is too large for the C99-ish interface. */
     863        if (off > LONG_MAX)
     864                return EOF;
     865
     866        return off;
    855867}
    856868
  • uspace/lib/c/generic/io/log.c

    ra0a9cc2 r2b3dd78  
    4141#include <io/log.h>
    4242#include <ipc/logger.h>
     43#include <str.h>
    4344#include <ns.h>
    4445
  • uspace/lib/c/generic/io/table.c

    ra0a9cc2 r2b3dd78  
    4040#include <stdio.h>
    4141#include <stdlib.h>
     42#include <str.h>
    4243
    4344static table_column_t *table_column_first(table_t *);
  • uspace/lib/c/generic/malloc.c

    ra0a9cc2 r2b3dd78  
    3333/** @file
    3434 */
    35 
    36 #define _HELENOS_SOURCE
    3735
    3836#include <malloc.h>
     
    876874 *
    877875 */
    878 void *realloc(const void *addr, const size_t size)
    879 {
     876void *realloc(void * const addr, const size_t size)
     877{
     878        if (size == 0) {
     879                free(addr);
     880                return NULL;
     881        }
     882
    880883        if (addr == NULL)
    881884                return malloc(size);
     
    985988 *
    986989 */
    987 void free(const void *addr)
     990void free(void * const addr)
    988991{
    989992        if (addr == NULL)
  • uspace/lib/c/generic/rtld/dynamic.c

    ra0a9cc2 r2b3dd78  
    3737#include <stdio.h>
    3838#include <inttypes.h>
     39#include <str.h>
    3940
    4041#include <rtld/elf_dyn.h>
  • uspace/lib/c/generic/rtld/module.c

    ra0a9cc2 r2b3dd78  
    4141#include <stdio.h>
    4242#include <stdlib.h>
     43#include <str.h>
    4344
    4445#include <rtld/rtld.h>
  • uspace/lib/c/generic/rtld/rtld.c

    ra0a9cc2 r2b3dd78  
    4040#include <rtld/rtld_debug.h>
    4141#include <stdlib.h>
     42#include <str.h>
    4243
    4344rtld_t *runtime_env;
  • uspace/lib/c/generic/rtld/symbol.c

    ra0a9cc2 r2b3dd78  
    3737#include <stdio.h>
    3838#include <stdlib.h>
     39#include <str.h>
    3940
    4041#include <elf/elf.h>
  • uspace/lib/c/generic/stdlib.c

    ra0a9cc2 r2b3dd78  
    3535#include <stdlib.h>
    3636
    37 static long glbl_seed = 1;
     37static int glbl_seed = 1;
    3838
    39 long int random(void)
     39int rand(void)
    4040{
    4141        return glbl_seed = ((1366 * glbl_seed + 150889) % RAND_MAX);
    4242}
    4343
    44 void srandom(unsigned int seed)
     44void srand(unsigned int seed)
    4545{
    4646        glbl_seed = seed % RAND_MAX;
  • uspace/lib/c/generic/str.c

    ra0a9cc2 r2b3dd78  
    12731273}
    12741274
    1275 /** Convert string to a number.
    1276  * Core of strtol and strtoul functions.
    1277  *
    1278  * @param nptr          Pointer to string.
    1279  * @param endptr        If not NULL, function stores here pointer to the first
    1280  *                      invalid character.
    1281  * @param base          Zero or number between 2 and 36 inclusive.
    1282  * @param sgn           It's set to 1 if minus found.
    1283  * @return              Result of conversion.
    1284  */
    1285 static unsigned long
    1286 _strtoul(const char *nptr, char **endptr, int base, char *sgn)
    1287 {
    1288         unsigned char c;
    1289         unsigned long result = 0;
    1290         unsigned long a, b;
    1291         const char *str = nptr;
    1292         const char *tmpptr;
    1293        
    1294         while (isspace(*str))
    1295                 str++;
    1296        
    1297         if (*str == '-') {
    1298                 *sgn = 1;
    1299                 ++str;
    1300         } else if (*str == '+')
    1301                 ++str;
    1302        
    1303         if (base) {
    1304                 if ((base == 1) || (base > 36)) {
    1305                         /* FIXME: set errno to EINVAL */
    1306                         return 0;
    1307                 }
    1308                 if ((base == 16) && (*str == '0') && ((str[1] == 'x') ||
    1309                     (str[1] == 'X'))) {
    1310                         str += 2;
    1311                 }
    1312         } else {
    1313                 base = 10;
    1314                
    1315                 if (*str == '0') {
    1316                         base = 8;
    1317                         if ((str[1] == 'X') || (str[1] == 'x'))  {
    1318                                 base = 16;
    1319                                 str += 2;
    1320                         }
    1321                 }
    1322         }
    1323        
    1324         tmpptr = str;
    1325 
    1326         while (*str) {
    1327                 c = *str;
    1328                 c = (c >= 'a' ? c - 'a' + 10 : (c >= 'A' ? c - 'A' + 10 :
    1329                     (c <= '9' ? c - '0' : 0xff)));
    1330                 if (c >= base) {
    1331                         break;
    1332                 }
    1333                
    1334                 a = (result & 0xff) * base + c;
    1335                 b = (result >> 8) * base + (a >> 8);
    1336                
    1337                 if (b > (ULONG_MAX >> 8)) {
    1338                         /* overflow */
    1339                         /* FIXME: errno = ERANGE*/
    1340                         return ULONG_MAX;
    1341                 }
    1342        
    1343                 result = (b << 8) + (a & 0xff);
    1344                 ++str;
    1345         }
    1346        
    1347         if (str == tmpptr) {
    1348                 /*
    1349                  * No number was found => first invalid character is the first
    1350                  * character of the string.
    1351                  */
    1352                 /* FIXME: set errno to EINVAL */
    1353                 str = nptr;
    1354                 result = 0;
    1355         }
    1356        
    1357         if (endptr)
    1358                 *endptr = (char *) str;
    1359 
    1360         if (nptr == str) {
    1361                 /*FIXME: errno = EINVAL*/
    1362                 return 0;
    1363         }
    1364 
    1365         return result;
    1366 }
    1367 
    1368 /** Convert initial part of string to long int according to given base.
    1369  * The number may begin with an arbitrary number of whitespaces followed by
    1370  * optional sign (`+' or `-'). If the base is 0 or 16, the prefix `0x' may be
    1371  * inserted and the number will be taken as hexadecimal one. If the base is 0
    1372  * and the number begin with a zero, number will be taken as octal one (as with
    1373  * base 8). Otherwise the base 0 is taken as decimal.
    1374  *
    1375  * @param nptr          Pointer to string.
    1376  * @param endptr        If not NULL, function stores here pointer to the first
    1377  *                      invalid character.
    1378  * @param base          Zero or number between 2 and 36 inclusive.
    1379  * @return              Result of conversion.
    1380  */
    1381 long int strtol(const char *nptr, char **endptr, int base)
    1382 {
    1383         char sgn = 0;
    1384         unsigned long number = 0;
    1385        
    1386         number = _strtoul(nptr, endptr, base, &sgn);
    1387 
    1388         if (number > LONG_MAX) {
    1389                 if ((sgn) && (number == (unsigned long) (LONG_MAX) + 1)) {
    1390                         /* FIXME: set 0 to errno */
    1391                         return number;
    1392                 }
    1393                 /* FIXME: set ERANGE to errno */
    1394                 return (sgn ? LONG_MIN : LONG_MAX);
    1395         }
    1396        
    1397         return (sgn ? -number : number);
    1398 }
    13991275
    14001276/** Duplicate string.
     
    14571333        str_ncpy(dest, size + 1, src, size);
    14581334        return dest;
    1459 }
    1460 
    1461 /** Convert initial part of string to unsigned long according to given base.
    1462  * The number may begin with an arbitrary number of whitespaces followed by
    1463  * optional sign (`+' or `-'). If the base is 0 or 16, the prefix `0x' may be
    1464  * inserted and the number will be taken as hexadecimal one. If the base is 0
    1465  * and the number begin with a zero, number will be taken as octal one (as with
    1466  * base 8). Otherwise the base 0 is taken as decimal.
    1467  *
    1468  * @param nptr          Pointer to string.
    1469  * @param endptr        If not NULL, function stores here pointer to the first
    1470  *                      invalid character
    1471  * @param base          Zero or number between 2 and 36 inclusive.
    1472  * @return              Result of conversion.
    1473  */
    1474 unsigned long strtoul(const char *nptr, char **endptr, int base)
    1475 {
    1476         char sgn = 0;
    1477         unsigned long number = 0;
    1478        
    1479         number = _strtoul(nptr, endptr, base, &sgn);
    1480 
    1481         return (sgn ? -number : number);
    14821335}
    14831336
  • uspace/lib/c/generic/uuid.c

    ra0a9cc2 r2b3dd78  
    5252        /* XXX This is a rather poor way of generating random numbers */
    5353        gettimeofday(&tv, NULL);
    54         srandom(tv.tv_sec ^ tv.tv_usec);
     54        srand(tv.tv_sec ^ tv.tv_usec);
    5555
    5656        for (i = 0; i < uuid_bytes; i++)
    57                 uuid->b[i] = random();
     57                uuid->b[i] = rand();
    5858
    5959        /* Version 4 UUID from random or pseudo-random numbers */
  • uspace/lib/c/generic/vfs/mtab.c

    ra0a9cc2 r2b3dd78  
    4040#include <errno.h>
    4141#include <assert.h>
     42#include <str.h>
    4243
    43 static void process_mp(const char *path, struct stat *stat, list_t *mtab_list)
     44static void process_mp(const char *path, vfs_stat_t *stat, list_t *mtab_list)
    4445{
    4546        mtab_ent_t *ent;
     
    5354        ent->service_id = stat->service_id;
    5455
    55         struct statfs stfs;
     56        vfs_statfs_t stfs;
    5657        if (vfs_statfs_path(path, &stfs) == EOK)
    5758                str_cpy(ent->fs_name, sizeof(ent->fs_name), stfs.fs_name);
     
    7475        while ((dirent = readdir(dir)) != NULL) {
    7576                char *child;
    76                 struct stat st;
     77                vfs_stat_t st;
    7778                errno_t rc;
    7879                int ret;
     
    122123errno_t vfs_get_mtab_list(list_t *mtab_list)
    123124{
    124         struct stat st;
     125        vfs_stat_t st;
    125126
    126127        errno_t rc = vfs_stat_path("/", &st);
  • uspace/lib/c/generic/vfs/vfs.c

    ra0a9cc2 r2b3dd78  
    352352async_sess_t *vfs_fd_session(int file, iface_t iface)
    353353{
    354         struct stat stat;
     354        vfs_stat_t stat;
    355355        errno_t rc = vfs_stat(file, &stat);
    356356        if (rc != EOK)
     
    10521052 * @return              EOK on success or an error code
    10531053 */
    1054 errno_t vfs_stat(int file, struct stat *stat)
     1054errno_t vfs_stat(int file, vfs_stat_t *stat)
    10551055{
    10561056        errno_t rc;
     
    10601060       
    10611061        req = async_send_1(exch, VFS_IN_STAT, file, NULL);
    1062         rc = async_data_read_start(exch, (void *) stat, sizeof(struct stat));
     1062        rc = async_data_read_start(exch, (void *) stat, sizeof(vfs_stat_t));
    10631063        if (rc != EOK) {
    10641064                vfs_exchange_end(exch);
     
    10861086 * @return              EOK on success or an error code
    10871087 */
    1088 errno_t vfs_stat_path(const char *path, struct stat *stat)
     1088errno_t vfs_stat_path(const char *path, vfs_stat_t *stat)
    10891089{
    10901090        int file;
     
    11071107 * @return              EOK on success or an error code
    11081108 */
    1109 errno_t vfs_statfs(int file, struct statfs *st)
     1109errno_t vfs_statfs(int file, vfs_statfs_t *st)
    11101110{
    11111111        errno_t rc, ret;
     
    11321132 * @return              EOK on success or an error code
    11331133 */
    1134 errno_t vfs_statfs_path(const char *path, struct statfs *st)
     1134errno_t vfs_statfs_path(const char *path, vfs_statfs_t *st)
    11351135{
    11361136        int file;
  • uspace/lib/c/include/adt/hash_table.h

    ra0a9cc2 r2b3dd78  
    8484        member_to_inst((item), type, member)
    8585
    86 extern bool hash_table_create(hash_table_t *, size_t, size_t, 
    87         hash_table_ops_t *);
     86extern bool hash_table_create(hash_table_t *, size_t, size_t,
     87    hash_table_ops_t *);
    8888extern void hash_table_destroy(hash_table_t *);
    8989
     
    9898extern size_t hash_table_remove(hash_table_t *, void *);
    9999extern void hash_table_remove_item(hash_table_t *, ht_link_t *);
    100 extern void hash_table_apply(hash_table_t *, bool (*)(ht_link_t *, void *), 
    101         void *);
     100extern void hash_table_apply(hash_table_t *, bool (*)(ht_link_t *, void *),
     101    void *);
    102102
    103103
  • uspace/lib/c/include/async.h

    ra0a9cc2 r2b3dd78  
    3434
    3535#if ((defined(LIBC_IPC_H_)) && (!defined(LIBC_ASYNC_C_)))
    36         #error Do not intermix low-level IPC interface and async framework
     36#error Do not intermix low-level IPC interface and async framework
    3737#endif
    3838
  • uspace/lib/c/include/ctype.h

    ra0a9cc2 r2b3dd78  
    6161}
    6262
     63static inline int isblank(int c)
     64{
     65        return c == ' ' || c == '\t';
     66}
     67
     68static inline int iscntrl(int c)
     69{
     70        return (c >= 0 && c < 0x20) || c == 0x7E;
     71}
     72
     73static inline int isprint(int c)
     74{
     75        return c >= 0 && c < 0x80 && !iscntrl(c);
     76}
     77
     78static inline int isgraph(int c)
     79{
     80        return isprint(c) && c != ' ';
     81}
     82
    6383static inline int isspace(int c)
    6484{
     
    7595                return 0;
    7696        }
     97}
     98
     99static inline int ispunct(int c)
     100{
     101        return !isspace(c) && !isalnum(c) && isprint(c);
     102}
     103
     104static inline int isxdigit(int c)
     105{
     106        return isdigit(c) ||
     107            (c >= 'a' && c <= 'f') ||
     108            (c >= 'A' && c <= 'F');
    77109}
    78110
  • uspace/lib/c/include/getopt.h

    ra0a9cc2 r2b3dd78  
    5757
    5858/* HelenOS Port - These need to be exposed for legacy getopt() */
    59 extern const char *optarg;
     59extern char *optarg;
    6060extern int optind, opterr, optopt;
    6161extern int optreset;
  • uspace/lib/c/include/gsort.h

    ra0a9cc2 r2b3dd78  
    3939#include <stdbool.h>
    4040
    41 typedef int (* sort_cmp_t)(void *, void *, void *);
     41typedef int (*sort_cmp_t)(void *, void *, void *);
    4242
    4343extern bool gsort(void *, size_t, size_t, sort_cmp_t, void *);
  • uspace/lib/c/include/inttypes.h

    ra0a9cc2 r2b3dd78  
    3838#include <_bits/inttypes.h>
    3939
     40#ifndef __HELENOS_DISABLE_INTMAX__
     41intmax_t strtoimax(const char *__restrict__ nptr,
     42    char **__restrict__ endptr, int base);
     43uintmax_t strtoumax(const char *__restrict__ nptr,
     44    char **__restrict__ endptr, int base);
     45#endif
     46
    4047#endif
    4148
  • uspace/lib/c/include/io/kio.h

    ra0a9cc2 r2b3dd78  
    3939#include <stdarg.h>
    4040#include <io/verify.h>
     41#include <_bits/errno.h>
     42#include <_bits/size_t.h>
    4143
    4244extern errno_t kio_write(const void *, size_t, size_t *);
     
    4446extern void kio_command(const void *, size_t);
    4547extern int kio_printf(const char *, ...)
    46     PRINTF_ATTRIBUTE(1, 2);
     48    _HELENOS_PRINTF_ATTRIBUTE(1, 2);
    4749extern int kio_vprintf(const char *, va_list);
    4850
  • uspace/lib/c/include/io/log.h

    ra0a9cc2 r2b3dd78  
    6060
    6161extern void log_msg(log_t, log_level_t, const char *, ...)
    62     PRINTF_ATTRIBUTE(3, 4);
     62    _HELENOS_PRINTF_ATTRIBUTE(3, 4);
    6363extern void log_msgv(log_t, log_level_t, const char *, va_list);
    6464
  • uspace/lib/c/include/io/verify.h

    ra0a9cc2 r2b3dd78  
    3636#define LIBC_IO_VERIFY_H_
    3737
    38 #ifndef NVERIFY_PRINTF
     38#ifndef _HELENOS_NVERIFY_PRINTF
    3939
    4040#ifdef __clang__
    41 #define PRINTF_ATTRIBUTE(start, end) \
     41#define _HELENOS_PRINTF_ATTRIBUTE(start, end) \
    4242        __attribute__((format(__printf__, start, end)))
    4343#else
    44 #define PRINTF_ATTRIBUTE(start, end) \
     44#define _HELENOS_PRINTF_ATTRIBUTE(start, end) \
    4545        __attribute__((format(gnu_printf, start, end)))
    4646#endif
    4747
    48 #else /* NVERIFY_PRINTF */
     48#else /* _HELENOS_NVERIFY_PRINTF */
    4949
    50 #define PRINTF_ATTRIBUTE(start, end)
     50#define _HELENOS_PRINTF_ATTRIBUTE(start, end)
    5151
    52 #endif /* NVERIFY_PRINTF */
     52#endif /* _HELENOS_NVERIFY_PRINTF */
    5353
    5454#endif
  • uspace/lib/c/include/ipc/devman.h

    ra0a9cc2 r2b3dd78  
    7474        /** Id of device model.
    7575         */
    76         const char *id;
     76        char *id;
    7777        /** Relevancy of device-to-driver match.
    7878         * The higher is the product of scores specified for the device by the bus driver and by the leaf driver,
  • uspace/lib/c/include/ipc/ipc.h

    ra0a9cc2 r2b3dd78  
    3434
    3535#if ((defined(LIBC_ASYNC_H_)) && (!defined(LIBC_ASYNC_C_)))
    36         #error Do not intermix low-level IPC interface and async framework
     36#error Do not intermix low-level IPC interface and async framework
    3737#endif
    3838
  • uspace/lib/c/include/ipc/logger.h

    ra0a9cc2 r2b3dd78  
    5454         * Returns: error code
    5555         * Followed by: vfs_pass_handle() request.
    56          */ 
     56         */
    5757        LOGGER_CONTROL_SET_ROOT
    5858} logger_control_request_t;
  • uspace/lib/c/include/malloc.h

    ra0a9cc2 r2b3dd78  
    3838#include <stddef.h>
    3939
    40 extern void *malloc(const size_t size)
     40extern void *malloc(size_t size)
    4141    __attribute__((malloc));
    42 extern void *calloc(const size_t nmemb, const size_t size)
     42extern void *calloc(size_t nmemb, size_t size)
    4343    __attribute__((malloc));
    44 extern void *memalign(const size_t align, const size_t size)
     44extern void *memalign(size_t align, size_t size)
    4545    __attribute__((malloc));
    46 extern void *realloc(const void *addr, const size_t size)
     46extern void *realloc(void *addr, size_t size)
    4747    __attribute__((warn_unused_result));
    48 extern void free(const void *addr);
     48extern void free(void *addr);
    4949extern void *heap_check(void);
    5050
  • uspace/lib/c/include/rtld/rtld_debug.h

    ra0a9cc2 r2b3dd78  
    4242
    4343#ifdef RTLD_DEBUG
    44         #define DPRINTF(format, ...) printf(format, ##__VA_ARGS__)
     44#define DPRINTF(format, ...) printf(format, ##__VA_ARGS__)
    4545#else
    46         #define DPRINTF(format, ...) if (0) printf(format, ##__VA_ARGS__)
     46#define DPRINTF(format, ...) if (0) printf(format, ##__VA_ARGS__)
    4747#endif
    4848
  • uspace/lib/c/include/stdio.h

    ra0a9cc2 r2b3dd78  
    3737
    3838#include <stdarg.h>
    39 #include <str.h>
    4039#include <io/verify.h>
    41 #include <abi/kio.h>
     40#include <_bits/size_t.h>
     41#include <_bits/wchar_t.h>
    4242
    4343#define EOF  (-1)
     
    5858#define BUFSIZ  4096
    5959
    60 #define DEBUG(fmt, ...) \
    61         { \
    62                 char _buf[256]; \
    63                 int _n = snprintf(_buf, sizeof(_buf), fmt, ##__VA_ARGS__); \
    64                 if (_n > 0) \
    65                         (void) __SYSCALL3(SYS_KIO, KIO_WRITE, (sysarg_t) _buf, str_size(_buf)); \
    66         }
     60/** Forward declaration */
     61struct _IO_FILE;
     62typedef struct _IO_FILE FILE;
     63
     64extern FILE *stdin;
     65extern FILE *stdout;
     66extern FILE *stderr;
     67
     68/* Character and string input functions */
     69extern int fgetc(FILE *);
     70extern char *fgets(char *, int, FILE *);
     71
     72extern int getchar(void);
     73
     74/* Character and string output functions */
     75extern int fputc(wchar_t, FILE *);
     76extern int fputs(const char *, FILE *);
     77
     78extern int putchar(wchar_t);
     79extern int puts(const char *);
     80
     81extern int ungetc(int, FILE *);
     82
     83/* Formatted string output functions */
     84extern int fprintf(FILE *, const char*, ...)
     85    _HELENOS_PRINTF_ATTRIBUTE(2, 3);
     86extern int vfprintf(FILE *, const char *, va_list);
     87
     88extern int printf(const char *, ...)
     89    _HELENOS_PRINTF_ATTRIBUTE(1, 2);
     90extern int vprintf(const char *, va_list);
     91
     92extern int snprintf(char *, size_t , const char *, ...)
     93    _HELENOS_PRINTF_ATTRIBUTE(3, 4);
     94extern int vasprintf(char **, const char *, va_list);
     95extern int asprintf(char **, const char *, ...)
     96    _HELENOS_PRINTF_ATTRIBUTE(2, 3);
     97extern int vsnprintf(char *, size_t, const char *, va_list);
     98
     99/* File stream functions */
     100extern FILE *fopen(const char *, const char *);
     101extern FILE *freopen(const char *, const char *, FILE *);
     102extern int fclose(FILE *);
     103
     104extern size_t fread(void *, size_t, size_t, FILE *);
     105extern size_t fwrite(const void *, size_t, size_t, FILE *);
     106
     107extern int fseek(FILE *, long, int);
     108extern void rewind(FILE *);
     109extern long ftell(FILE *);
     110extern int feof(FILE *);
     111
     112extern int fflush(FILE *);
     113extern int ferror(FILE *);
     114extern void clearerr(FILE *);
     115
     116extern void setvbuf(FILE *, void *, int, size_t);
     117extern void setbuf(FILE *, void *);
     118
     119/* Misc file functions */
     120extern int rename(const char *, const char *);
     121extern int remove(const char *);
     122
     123#ifndef _HELENOS_SOURCE
     124#define _IONBF 0
     125#define _IOLBF 1
     126#define _IOFBF 2
     127#endif
     128
     129#ifdef _HELENOS_SOURCE
     130
     131/* Nonstandard extensions. */
    67132
    68133enum _buffer_type {
     
    86151};
    87152
    88 /** Forward declaration */
    89 struct _IO_FILE;
    90 typedef struct _IO_FILE FILE;
    91 
    92 extern FILE *stdin;
    93 extern FILE *stdout;
    94 extern FILE *stderr;
    95 
    96 /* Character and string input functions */
    97 extern int fgetc(FILE *);
    98 extern char *fgets(char *, int, FILE *);
    99 
    100 extern int getchar(void);
     153extern int vprintf_size(const char *, va_list);
     154extern int printf_size(const char *, ...)
     155    _HELENOS_PRINTF_ATTRIBUTE(1, 2);
     156extern FILE *fdopen(int, const char *);
     157extern int fileno(FILE *);
    101158extern char *gets(char *, size_t);
    102159
    103 /* Character and string output functions */
    104 extern int fputc(wchar_t, FILE *);
    105 extern int fputs(const char *, FILE *);
     160#include <offset.h>
    106161
    107 extern int putchar(wchar_t);
    108 extern int puts(const char *);
     162extern int fseek64(FILE *, off64_t, int);
     163extern off64_t ftell64(FILE *);
    109164
    110 extern int ungetc(int, FILE *);
     165#endif
    111166
    112 /* Formatted string output functions */
    113 extern int fprintf(FILE *, const char*, ...)
    114     PRINTF_ATTRIBUTE(2, 3);
    115 extern int vfprintf(FILE *, const char *, va_list);
    116 
    117 extern int printf(const char *, ...)
    118     PRINTF_ATTRIBUTE(1, 2);
    119 extern int vprintf(const char *, va_list);
    120 
    121 extern int snprintf(char *, size_t , const char *, ...)
    122     PRINTF_ATTRIBUTE(3, 4);
    123 extern int vasprintf(char **, const char *, va_list);
    124 extern int asprintf(char **, const char *, ...)
    125     PRINTF_ATTRIBUTE(2, 3);
    126 extern int vsnprintf(char *, size_t, const char *, va_list);
    127 
    128 extern int printf_size(const char *, ...)
    129     PRINTF_ATTRIBUTE(1, 2);
    130 extern int vprintf_size(const char *, va_list);
    131 
    132 /* File stream functions */
    133 extern FILE *fopen(const char *, const char *);
    134 extern FILE *fdopen(int, const char *);
    135 extern FILE *freopen(const char *, const char *, FILE *);
    136 extern int fclose(FILE *);
    137 
    138 extern size_t fread(void *, size_t, size_t, FILE *);
    139 extern size_t fwrite(const void *, size_t, size_t, FILE *);
    140 
    141 extern int fseek(FILE *, long, int);
    142 extern void rewind(FILE *);
    143 extern long ftell(FILE *);
    144 extern int feof(FILE *);
    145 extern int fileno(FILE *);
    146 
    147 extern int fflush(FILE *);
    148 extern int ferror(FILE *);
    149 extern void clearerr(FILE *);
    150 
    151 extern void setvbuf(FILE *, void *, int, size_t);
    152 extern void setbuf(FILE *, void *);
    153 
    154 /* Misc file functions */
    155 extern int rename(const char *, const char *);
    156 extern int remove(const char *);
    157167
    158168#endif
  • uspace/lib/c/include/stdlib.h

    ra0a9cc2 r2b3dd78  
    4242#define RAND_MAX  714025
    4343
    44 #define rand()       random()
    45 #define srand(seed)  srandom(seed)
    46 
    47 extern long int random(void);
    48 extern void srandom(unsigned int seed);
     44extern int rand(void);
     45extern void srand(unsigned int seed);
    4946
    5047extern void abort(void) __attribute__((noreturn));
    5148extern void exit(int) __attribute__((noreturn));
     49
     50extern int atoi(const char *);
     51extern long atol(const char *);
     52extern long long atoll(const char *);
     53
     54extern long strtol(const char *__restrict__, char **__restrict__, int);
     55extern long long strtoll(const char *__restrict__, char **__restrict__, int);
     56extern unsigned long strtoul(const char *__restrict__, char **__restrict__, int);
     57extern unsigned long long strtoull(const char *__restrict__, char **__restrict__, int);
    5258
    5359#endif
  • uspace/lib/c/include/syscall.h

    ra0a9cc2 r2b3dd78  
    4141
    4242#ifndef LIBARCH_SYSCALL_GENERIC
    43         #error You cannot include this file directly
     43#error You cannot include this file directly
    4444#endif
    4545
  • uspace/lib/c/include/time.h

    ra0a9cc2 r2b3dd78  
    3131 */
    3232/** @file
    33  */ 
     33 */
    3434
    3535#ifndef LIBC_TIME_H_
  • uspace/lib/c/include/udebug.h

    ra0a9cc2 r2b3dd78  
    4646extern errno_t udebug_end(async_sess_t *);
    4747extern errno_t udebug_set_evmask(async_sess_t *, udebug_evmask_t);
    48 extern errno_t udebug_thread_read(async_sess_t *, void *, size_t , size_t *,
     48extern errno_t udebug_thread_read(async_sess_t *, void *, size_t, size_t *,
    4949    size_t *);
    5050extern errno_t udebug_name_read(async_sess_t *, void *, size_t, size_t *,
  • uspace/lib/c/include/vfs/inbox.h

    ra0a9cc2 r2b3dd78  
    2929/** @addtogroup libc
    3030 * @{
    31  */ 
     31 */
    3232
    3333/**
  • uspace/lib/c/include/vfs/vfs.h

    ra0a9cc2 r2b3dd78  
    5757
    5858
    59 struct stat {
     59typedef struct {
    6060        fs_handle_t fs_handle;
    6161        service_id_t service_id;
     
    6666        aoff64_t size;
    6767        service_id_t service;
    68 };
     68} vfs_stat_t;
    6969
    70 struct statfs {
     70typedef struct {
    7171        char fs_name[FS_NAME_MAXLEN + 1];
    7272        uint32_t f_bsize;    /* fundamental file system block size */
    7373        uint64_t f_blocks;   /* total data blocks in file system */
    7474        uint64_t f_bfree;    /* free blocks in fs */
    75 };
     75} vfs_statfs_t;
    7676
    7777/** List of file system types */
     
    111111extern int vfs_root(void);
    112112extern errno_t vfs_root_set(int);
    113 extern errno_t vfs_stat(int, struct stat *);
    114 extern errno_t vfs_stat_path(const char *, struct stat *);
    115 extern errno_t vfs_statfs(int, struct statfs *);
    116 extern errno_t vfs_statfs_path(const char *, struct statfs *);
     113extern errno_t vfs_stat(int, vfs_stat_t *);
     114extern errno_t vfs_stat_path(const char *, vfs_stat_t *);
     115extern errno_t vfs_statfs(int, vfs_statfs_t *);
     116extern errno_t vfs_statfs_path(const char *, vfs_statfs_t *);
    117117extern errno_t vfs_sync(int);
    118118extern errno_t vfs_unlink(int, const char *, int);
  • uspace/lib/c/test/sprintf.c

    ra0a9cc2 r2b3dd78  
    2828
    2929#include <stdio.h>
     30#include <str.h>
    3031#include <pcut/pcut.h>
    3132
Note: See TracChangeset for help on using the changeset viewer.