Changeset db24058 in mainline for uspace/lib/libc/include


Ignore:
Timestamp:
2009-06-30T15:53:15Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2d11a7d8
Parents:
6db6fd1
Message:

small fixes and coding style changes related to the new memory allocator

Location:
uspace/lib/libc/include
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/include/async.h

    r6db6fd1 rdb24058  
    4747extern atomic_t async_futex;
    4848
     49extern int __async_init(void);
     50extern ipc_callid_t async_get_call_timeout(ipc_call_t *call, suseconds_t usecs);
     51
     52static inline ipc_callid_t async_get_call(ipc_call_t *data)
     53{
     54        return async_get_call_timeout(data, 0);
     55}
     56
    4957static inline void async_manager(void)
    5058{
    5159        fibril_switch(FIBRIL_TO_MANAGER);
    52 }
    53 
    54 extern ipc_callid_t async_get_call_timeout(ipc_call_t *call, suseconds_t usecs);
    55 
    56 static inline ipc_callid_t async_get_call(ipc_call_t *data)
    57 {
    58         return async_get_call_timeout(data, 0);
    5960}
    6061
     
    9596extern void async_create_manager(void);
    9697extern void async_destroy_manager(void);
    97 extern int _async_init(void);
    9898
    9999extern void async_set_client_connection(async_client_conn_t conn);
  • uspace/lib/libc/include/bitops.h

    r6db6fd1 rdb24058  
    2727 */
    2828
    29 /** @addtogroup generic 
     29/** @addtogroup generic
    3030 * @{
    3131 */
     
    4343 * If number is zero, it returns 0
    4444 */
    45 static inline int fnzb32(uint32_t arg)
     45static inline unsigned int fnzb32(uint32_t arg)
    4646{
    47         int n = 0;
    48 
     47        unsigned int n = 0;
     48       
    4949        if (arg >> 16) {
    5050                arg >>= 16;
     
    7575}
    7676
    77 static inline int fnzb64(uint64_t arg)
     77static inline unsigned int fnzb64(uint64_t arg)
    7878{
    79         int n = 0;
    80 
     79        unsigned int n = 0;
     80       
    8181        if (arg >> 32) {
    8282                arg >>= 32;
     
    8484        }
    8585       
    86         return n + fnzb32((uint32_t) arg);
     86        return (n + fnzb32((uint32_t) arg));
    8787}
    8888
    89 #define fnzb(x) fnzb32(x)
     89static inline unsigned int fnzb(size_t arg)
     90{
     91        return fnzb64(arg);
     92}
    9093
    9194#endif
  • uspace/lib/libc/include/errno.h

    r6db6fd1 rdb24058  
    3636#define LIBC_ERRNO_H_
    3737
    38 /* TODO: support threads/fibrils */
     38#include <kernel/errno.h>
     39#include <fibril.h>
     40
    3941extern int _errno;
     42
    4043#define errno _errno
    41 
    42 #include <kernel/errno.h>
    4344
    4445#define EMFILE        (-17)
  • uspace/lib/libc/include/getopt.h

    r6db6fd1 rdb24058  
    5959
    6060/* HelenOS Port - These need to be exposed for legacy getopt() */
    61 extern char *optarg;
     61extern const char *optarg;
    6262extern int optind, opterr, optopt;
    6363extern int optreset;
  • uspace/lib/libc/include/macros.h

    r6db6fd1 rdb24058  
    3636#define LIBC_MACROS_H_
    3737
     38#define min(a, b)  ((a) < (b) ? (a) : (b))
     39#define max(a, b)  ((a) > (b) ? (a) : (b))
     40
    3841#define SIZE2KB(size)  ((size) >> 10)
    3942#define SIZE2MB(size)  ((size) >> 20)
  • uspace/lib/libc/include/mem.h

    r6db6fd1 rdb24058  
    4040#define bzero(ptr, len)  memset((ptr), 0, (len))
    4141
    42 extern void * memset(void *, int, size_t);
    43 extern void * memcpy(void *, const void *, size_t);
    44 extern void * memmove(void *, const void *, size_t);
     42extern void *memset(void *, int, size_t);
     43extern void *memcpy(void *, const void *, size_t);
     44extern void *memmove(void *, const void *, size_t);
    4545
    4646extern int bcmp(const char *, const char *, size_t);
  • uspace/lib/libc/include/stdio.h

    r6db6fd1 rdb24058  
    3838#include <sys/types.h>
    3939#include <stdarg.h>
     40#include <string.h>
    4041#include <adt/list.h>
    4142
     
    4344
    4445/** Default size for stream I/O buffers */
    45 #define BUFSIZ 4096
     46#define BUFSIZ  4096
    4647
    4748#define DEBUG(fmt, ...) \
    48 { \
    49         char buf[256]; \
    50         int n = snprintf(buf, sizeof(buf), fmt, ##__VA_ARGS__); \
    51         if (n > 0) \
    52                 (void) __SYSCALL3(SYS_KLOG, 1, (sysarg_t) buf, str_size(buf)); \
    53 }
     49        { \
     50                char _buf[256]; \
     51                int _n = snprintf(_buf, sizeof(_buf), fmt, ##__VA_ARGS__); \
     52                if (_n > 0) \
     53                        (void) __SYSCALL3(SYS_KLOG, 1, (sysarg_t) _buf, str_size(_buf)); \
     54        }
    5455
    5556#ifndef SEEK_SET
  • uspace/lib/libc/include/stdlib.h

    r6db6fd1 rdb24058  
    3939#include <malloc.h>
    4040
    41 #define abort() _exit(1)
    42 #define exit(status)    _exit((status))
     41#define abort()       _exit(1)
     42#define exit(status)  _exit((status))
    4343
    44 #define RAND_MAX 714025
     44#define RAND_MAX  714025
    4545
    4646extern long int random(void);
     
    5151        return random();
    5252}
     53
    5354static inline void srand(unsigned int seed)
    5455{
  • uspace/lib/libc/include/unistd.h

    r6db6fd1 rdb24058  
    6666
    6767extern void _exit(int status) __attribute__ ((noreturn));
    68 extern void *sbrk(ssize_t incr);
    6968extern int usleep(unsigned long usec);
    7069extern unsigned int sleep(unsigned int seconds);
  • uspace/lib/libc/include/vfs/vfs.h

    r6db6fd1 rdb24058  
    5656    unsigned int);
    5757
    58 extern void stdio_init(int filc, fdi_node_t *filv[]);
    59 extern void stdio_done(void);
     58extern void __stdio_init(int filc, fdi_node_t *filv[]);
     59extern void __stdio_done(void);
    6060
    6161extern int open_node(fdi_node_t *, int);
Note: See TracChangeset for help on using the changeset viewer.