Changeset a46da63 in mainline


Ignore:
Timestamp:
2006-06-16T20:50:51Z (19 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
153a209
Parents:
b34fab6
Message:

big code cleanup, compile with -Wall -Werror to enforce better coding
there is currently one warning that requires attention, please review

Files:
17 edited

Legend:

Unmodified
Added
Removed
  • fb/sysio.c

    rb34fab6 ra46da63  
    121121                return;
    122122        }
     123       
    123124        client_connected = 1;
    124125        ipc_answer_fast(iid, 0, 0, 0); /* Accept connection */
    125126        while (1) {
    126127                callid = async_get_call(&call);
    127                 switch (IPC_GET_METHOD(call)) {
    128                 case IPC_M_PHONE_HUNGUP:
    129                         client_connected = 0;
    130                         ipc_answer_fast(callid,0,0,0);
    131                         return; /* Exit thread */
    132                 case FB_PUTCHAR:
    133                         c = IPC_GET_ARG1(call);
    134                         newrow = IPC_GET_ARG2(call);
    135                         newcol = IPC_GET_ARG3(call);
    136                         if (lastcol != newcol || lastrow!=newrow)
     128                switch (IPC_GET_METHOD(call)) {
     129                        case IPC_M_PHONE_HUNGUP:
     130                                client_connected = 0;
     131                                ipc_answer_fast(callid, 0, 0, 0);
     132                                return; /* Exit thread */
     133                        case FB_PUTCHAR:
     134                                c = IPC_GET_ARG1(call);
     135                                newrow = IPC_GET_ARG2(call);
     136                                newcol = IPC_GET_ARG3(call);
     137                                if ((lastcol != newcol) || (lastrow != newrow))
     138                                        curs_goto(newrow, newcol);
     139                                lastcol = newcol + 1;
     140                                lastrow = newrow;
     141                                sysput(c);
     142                                retval = 0;
     143                                break;
     144                        case FB_CURSOR_GOTO:
     145                                newrow = IPC_GET_ARG1(call);
     146                                newcol = IPC_GET_ARG2(call);
    137147                                curs_goto(newrow, newcol);
    138                         lastcol = newcol + 1;
    139                         lastrow = newrow;
    140                         sysput(c);
    141                         retval = 0;
    142                         break;
    143                 case FB_CURSOR_GOTO:
    144                         newrow = IPC_GET_ARG1(call);
    145                         newcol = IPC_GET_ARG2(call);
    146                         curs_goto(newrow, newcol);
    147                         lastrow = newrow;
    148                         lastcol = newcol;
    149                         break;
    150                 case FB_GET_CSIZE:
    151                         ipc_answer_fast(callid, 0, HEIGHT, WIDTH);
    152                         continue;
    153                 case FB_CLEAR:
    154                         clrscr();
    155                         retval = 0;
    156                         break;
    157                 case FB_SET_STYLE:
    158                         fgcolor = IPC_GET_ARG1(call);
    159                         bgcolor = IPC_GET_ARG2(call);
    160                         if (fgcolor < bgcolor)
    161                                 set_style(0);
    162                         else
    163                                 set_style(7);
    164                         retval = 0;
    165                         break;
    166                 case FB_SCROLL:
    167                         i = IPC_GET_ARG1(call);
    168                         if (i > HEIGHT || i < -HEIGHT) {
    169                                 retval = EINVAL;
     148                                lastrow = newrow;
     149                                lastcol = newcol;
     150                                retval = 0;
    170151                                break;
    171                         }
    172                         scroll(i);
    173                         curs_goto(lastrow, lastcol);
    174                         retval = 0;
    175                         break;
    176 
    177                 default:
    178                         retval = ENOENT;
     152                        case FB_GET_CSIZE:
     153                                ipc_answer_fast(callid, 0, HEIGHT, WIDTH);
     154                                continue;
     155                        case FB_CLEAR:
     156                                clrscr();
     157                                retval = 0;
     158                                break;
     159                        case FB_SET_STYLE:
     160                                fgcolor = IPC_GET_ARG1(call);
     161                                bgcolor = IPC_GET_ARG2(call);
     162                                if (fgcolor < bgcolor)
     163                                        set_style(0);
     164                                else
     165                                        set_style(7);
     166                                retval = 0;
     167                                break;
     168                        case FB_SCROLL:
     169                                i = IPC_GET_ARG1(call);
     170                                if ((i > HEIGHT) || (i < -HEIGHT)) {
     171                                        retval = EINVAL;
     172                                        break;
     173                                }
     174                                scroll(i);
     175                                curs_goto(lastrow, lastcol);
     176                                retval = 0;
     177                                break;
     178                        default:
     179                                retval = ENOENT;
    179180                }
    180                 ipc_answer_fast(callid,retval,0,0);
     181               
     182                ipc_answer_fast(callid, retval, 0, 0);
    181183        }
    182184}
     
    194196/**
    195197 * @}
    196  */
    197 
     198 */
  • libc/Makefile.toolchain

    rb34fab6 ra46da63  
    2828
    2929DEFS = -DARCH=$(ARCH)
    30 CFLAGS = -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -O3 -nostdlib -nostdinc -I$(LIBC_PREFIX)/include
     30CFLAGS = -fno-builtin -Wall -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -nostdlib -nostdinc -I$(LIBC_PREFIX)/include
    3131LFLAGS = -M -N $(SOFTINT_PREFIX)/libsoftint.a
    3232AFLAGS =
  • libc/generic/as.c

    rb34fab6 ra46da63  
    2727 */
    2828
    29  /** @addtogroup libc
     29/** @addtogroup libc
    3030 * @{
    3131 */
     
    7676
    7777static size_t heapsize = 0;
    78 static size_t maxheapsize = (size_t)(-1);
     78static size_t maxheapsize = (size_t) (-1);
    7979
    8080static void * last_allocated = 0;
     
    9393        int rc;
    9494        void *res;
     95       
    9596        /* Check for invalid values */
    9697        if (incr < 0 && -incr > heapsize)
    9798                return NULL;
     99       
    98100        /* Check for too large value */
    99101        if (incr > 0 && incr+heapsize < heapsize)
    100102                return NULL;
     103       
    101104        /* Check for too small values */
    102105        if (incr < 0 && incr+heapsize > heapsize)
    103106                return NULL;
     107       
    104108        /* Check for user limit */
    105         if ((maxheapsize!=(size_t)(-1)) && (heapsize + incr)>maxheapsize) return NULL;
    106 
    107         rc = as_area_resize(&_heap, heapsize + incr,0);
     109        if ((maxheapsize != (size_t) (-1)) && (heapsize + incr) > maxheapsize)
     110                return NULL;
     111       
     112        rc = as_area_resize(&_heap, heapsize + incr, 0);
    108113        if (rc != 0)
    109114                return NULL;
    110115       
    111116        /* Compute start of new area */
    112         res = (void *)&_heap + heapsize;
     117        res = (void *) &_heap + heapsize;
    113118
    114119        heapsize += incr;
     
    120125void *set_maxheapsize(size_t mhs)
    121126{
    122         maxheapsize=mhs;
     127        maxheapsize = mhs;
    123128        /* Return pointer to area not managed by sbrk */
    124         return (void *)&_heap + maxheapsize;
     129        return ((void *) &_heap + maxheapsize);
    125130
    126131}
     
    137142        /* Set heapsize to some meaningful value */
    138143        if (maxheapsize == -1)
    139                 set_maxheapsize(ALIGN_UP(USER_ADDRESS_SPACE_SIZE_ARCH>>1,PAGE_SIZE));
     144                set_maxheapsize(ALIGN_UP(USER_ADDRESS_SPACE_SIZE_ARCH >> 1, PAGE_SIZE));
     145       
    140146        if (!last_allocated)
    141                 last_allocated = ALIGN_UP((void *)&_heap + maxheapsize, PAGE_SIZE);
     147                last_allocated = (void *) ALIGN_UP((void *) &_heap + maxheapsize, PAGE_SIZE);
    142148       
    143149        sz = ALIGN_UP(sz, PAGE_SIZE);
     
    148154}
    149155
    150 
    151  /** @}
     156/** @}
    152157 */
    153  
    154  
  • libc/generic/async.c

    rb34fab6 ra46da63  
    2727 */
    2828
    29  /** @addtogroup libc
     29/** @addtogroup libc
    3030 * @{
    3131 */
     
    374374        PS_connection = (connection_t *)arg;
    375375        PS_connection->cthread(PS_connection->callid, &PS_connection->call);
     376       
    376377        /* Remove myself from connection hash table */
    377378        futex_down(&async_futex);
     
    379380        hash_table_remove(&conn_hash_table, &key, 1);
    380381        futex_up(&async_futex);
     382       
    381383        /* Answer all remaining messages with ehangup */
    382384        while (!list_empty(&PS_connection->msg_queue)) {
     
    390392        if (PS_connection->close_callid)
    391393                ipc_answer_fast(PS_connection->close_callid, 0, 0, 0);
     394       
     395        return 0;
    392396}
    393397
     
    406410 * @return New thread id
    407411 */
    408 pstid_t async_new_connection(ipcarg_t in_phone_hash,ipc_callid_t callid,
    409                              ipc_call_t *call,
    410                              void (*cthread)(ipc_callid_t,ipc_call_t *))
    411 {
    412         pstid_t ptid;
     412pstid_t async_new_connection(ipcarg_t in_phone_hash,ipc_callid_t callid, ipc_call_t *call, void (*cthread)(ipc_callid_t, ipc_call_t *))
     413{
    413414        connection_t *conn;
    414415        unsigned long key;
     
    515516        while (1) {
    516517                if (psthread_schedule_next_adv(PS_FROM_MANAGER)) {
    517                         futex_up(&async_futex); /* async_futex is always held
    518                                                 * when entering manager thread
    519                                                 */
     518                        futex_up(&async_futex);
     519                        /* async_futex is always held
     520                         * when entering manager thread
     521                         */
    520522                        continue;
    521523                }
     
    547549                handle_call(callid, &call);
    548550        }
     551       
     552        return 0;
    549553}
    550554
     
    558562static int async_manager_thread(void *arg)
    559563{
    560         futex_up(&async_futex); /* async_futex is always locked when entering
    561                                 * manager */
     564        futex_up(&async_futex);
     565        /* async_futex is always locked when entering
     566         * manager */
    562567        async_manager_worker();
     568       
     569        return 0;
    563570}
    564571
     
    586593        }
    587594       
     595        return 0;
    588596}
    589597
     
    680688{
    681689        amsg_t *msg = (amsg_t *) amsgid;
    682         connection_t *conn;
    683690
    684691        futex_down(&async_futex);
     
    712719{
    713720        amsg_t *msg = (amsg_t *) amsgid;
    714         connection_t *conn;
    715721
    716722        /* TODO: Let it go through the event read at least once */
     
    803809
    804810
    805  /** @}
    806  */
    807  
    808  
     811/** @}
     812 */
  • libc/generic/cap.c

    rb34fab6 ra46da63  
    2727 */
    2828
    29  /** @addtogroup libc
     29/** @addtogroup libc
    3030 * @{
    3131 */
     
    5353        arg.value = (unsigned long long) id;
    5454
    55         __SYSCALL2(SYS_CAP_GRANT, (sysarg_t) &arg, (sysarg_t) caps);
     55        return __SYSCALL2(SYS_CAP_GRANT, (sysarg_t) &arg, (sysarg_t) caps);
    5656}
    5757
     
    6969        arg.value = (unsigned long long) id;
    7070
    71         __SYSCALL2(SYS_CAP_REVOKE, (sysarg_t) &arg, (sysarg_t) caps);
     71        return __SYSCALL2(SYS_CAP_REVOKE, (sysarg_t) &arg, (sysarg_t) caps);
    7272}
    7373
    7474
    75  /** @}
     75/** @}
    7676 */
    77  
    78  
  • libc/generic/ddi.c

    rb34fab6 ra46da63  
    2727 */
    2828
    29  /** @addtogroup libc
     29/** @addtogroup libc
    3030 * @{
    3131 */
     
    7070int iospace_enable(task_id_t id, void *ioaddr, unsigned long size)
    7171{
    72         task_id_t task_id;
    7372        ddi_ioarg_t arg;
    7473
     
    9089
    9190
    92  /** @}
     91/** @}
    9392 */
    94  
    95  
  • libc/generic/err.c

    rb34fab6 ra46da63  
    2727 */
    2828
    29  /** @addtogroup libc
     29/** @addtogroup libc
    3030 * @{
    3131 */
     
    3636#include <stdlib.h>
    3737
    38 void errx (int __status, __const char *__format, ...)
     38/* TODO
     39void errx(int __status, __const char *__format, ...)
    3940{
    40         printf("TODO...errx\n");
    4141        _exit(0);
    4242}
     43*/
    4344
    4445
    45  /** @}
     46/** @}
    4647 */
    47  
    48  
  • libc/generic/io/stream.c

    rb34fab6 ra46da63  
    2828 */
    2929
    30  /** @addtogroup libc
     30/** @addtogroup libc
    3131 * @{
    3232 */
     
    7474                        return -1;
    7575                }
    76                 ((char *)buf)[i++] = r0;
     76                ((char *) buf)[i++] = r0;
    7777        }
    7878        return i;
     
    8282{
    8383        int i;
    84         ipcarg_t r0,r1;
    8584
    8685        for (i = 0; i < count; i++)
    87                 async_msg(streams[1].phone, CONSOLE_PUTCHAR, ((const char *)buf)[i]);
     86                async_msg(streams[1].phone, CONSOLE_PUTCHAR, ((const char *) buf)[i]);
    8887       
    8988        return count;
     
    9190
    9291
    93 
    9492static stream_t open_stdin(void)
    9593{
    9694        stream_t stream;
    97         int phoneid;
    98         int res;
    9995       
    10096        if (console_phone < 0) {
     
    105101       
    106102        stream.r = read_stdin;
     103        stream.w = NULL;
    107104        stream.param = 0;
    108105        stream.phone = console_phone;
     
    114111{
    115112        stream_t stream;
    116         int res;
    117113
    118114        if (console_phone < 0) {
     
    122118        }
    123119       
     120        stream.r = NULL;
    124121        stream.w = write_stdout;
    125122        stream.phone = console_phone;
    126123        stream.param = 0;
     124       
    127125        return stream;
    128126}
     
    140138        while (((streams[c].w) || (streams[c].r)) && (c < FDS))
    141139                c++;
     140       
    142141        if (c == FDS)
    143142                return EMFILE;
     
    157156                return c;
    158157        }
     158       
    159159        if (!strcmp(fname, "null")) {
    160160                streams[c].w = write_null;
    161161                return c;
    162162        }
     163       
     164        return -1;
    163165}
    164166
     
    190192
    191193
    192  /** @}
     194/** @}
    193195 */
    194  
    195  
  • libc/generic/libc.c

    rb34fab6 ra46da63  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28  /** @addtogroup lc Libc
    29   * @brief      HelenOS C library
    30   * @{
    31   * @}
    32   */
    33  /** @addtogroup libc generic
    34   * @ingroup lc
     28
     29/** @addtogroup lc Libc
     30 * @brief       HelenOS C library
     31 * @{
     32 * @}
     33 */
     34/** @addtogroup libc generic
     35 * @ingroup lc
    3536 * @{
    3637 */
     
    5051extern char _heap;
    5152
    52 void _exit(int status) {
     53void _exit(int status)
     54{
    5355        thread_exit(status);
    5456}
    5557
    56 void __main(void) {
     58void __main(void)
     59{
    5760        psthread_data_t *pt;
    5861
     
    6366}
    6467
    65 void __io_init(void) {
     68void __io_init(void)
     69{
    6670        open("stdin", 0);
    6771        open("stdout", 0);
     
    6973}
    7074
    71 void __exit(void) {
     75void __exit(void)
     76{
    7277        psthread_teardown(__tcb_get()->pst_data);
    7378        _exit(0);
    7479}
    7580
    76 
    77  /** @}
     81/** @}
    7882 */
    79  
    80  
  • libc/generic/mmap.c

    rb34fab6 ra46da63  
    2727 */
    2828
    29  /** @addtogroup libc
     29/** @addtogroup libc
    3030 * @{
    3131 */
     
    3737#include <unistd.h>
    3838
    39 void *mmap(void  *start, size_t length, int prot, int flags, int fd,
    40            off_t offset)
     39void *mmap(void  *start, size_t length, int prot, int flags, int fd, off_t offset)
    4140{
    42         int rc;
    43 
    4441        if (!start)
    4542                start = as_get_mappable_page(length);
     
    5956
    6057
    61  /** @}
     58/** @}
    6259 */
    63  
    64  
  • libc/generic/psthread.c

    rb34fab6 ra46da63  
    2727 */
    2828
    29  /** @addtogroup libc
     29/** @addtogroup libc
    3030 * @{
    3131 */
     
    5252static LIST_INITIALIZE(manager_list);
    5353
    54 static void psthread_exit(void) __attribute__ ((noinline));
    5554static void psthread_main(void);
    5655
     
    192191int psthread_join(pstid_t psthrid)
    193192{
    194         volatile psthread_data_t *pt, *mypt;
     193        volatile psthread_data_t *pt;
    195194        volatile int retval;
    196195
     
    239238
    240239        context_save(&pt->ctx);
    241         context_set(&pt->ctx, FADDR(psthread_main), pt->stack, PSTHREAD_INITIAL_STACK_PAGES_NO*getpagesize(),
    242                     pt->tcb);
     240        context_set(&pt->ctx, FADDR(psthread_main), pt->stack, PSTHREAD_INITIAL_STACK_PAGES_NO*getpagesize(), pt->tcb);
    243241
    244242        return (pstid_t )pt;
     
    308306
    309307
    310  /** @}
    311  */
    312  
    313  
     308/** @}
     309 */
  • libc/generic/string.c

    rb34fab6 ra46da63  
    2727 */
    2828
    29  /** @addtogroup libc
     29/** @addtogroup libc
    3030 * @{
    3131 */
     
    4242/* Dummy implementation of mem/ functions */
    4343
    44 void * memset(void *s, int c, size_t n)
     44void *memset(void *s, int c, size_t n)
    4545{
    4646        char *os = s;
     47       
    4748        while (n--)
    4849                *(os++) = c;
     50       
    4951        return s;
    5052}
    5153
    52 struct along {unsigned long n; } __attribute__ ((packed));
    53 
    54 static void * unaligned_memcpy(void *dst, const void *src, size_t n)
     54struct along {
     55        unsigned long n;
     56} __attribute__ ((packed));
     57
     58static void *unaligned_memcpy(void *dst, const void *src, size_t n)
    5559{
    5660        int i, j;
     
    5862        const struct along *asrc = src;
    5963
    60         for (i = 0; i < n/sizeof(unsigned long); i++)
     64        for (i = 0; i < n / sizeof(unsigned long); i++)
    6165                adst[i].n = asrc[i].n;
    6266               
    63         for (j = 0; j < n%sizeof(unsigned long); j++)
    64                 ((unsigned char *)(((unsigned long *) dst) + i))[j] = ((unsigned char *)(((unsigned long *) src) + i))[j];
    65                
    66         return (char *)src;
    67 }
    68 
    69 void * memcpy(void *dst, const void *src, size_t n)
     67        for (j = 0; j < n % sizeof(unsigned long); j++)
     68                ((unsigned char *) (((unsigned long *) dst) + i))[j] = ((unsigned char *) (((unsigned long *) src) + i))[j];
     69               
     70        return (char *) src;
     71}
     72
     73void *memcpy(void *dst, const void *src, size_t n)
    7074{
    7175        int i, j;
    7276
    73         if (((long)dst & (sizeof(long)-1)) || ((long)src & (sizeof(long)-1)))
     77        if (((long) dst & (sizeof(long) - 1)) || ((long) src & (sizeof(long) - 1)))
    7478                return unaligned_memcpy(dst, src, n);
    7579
    76         for (i = 0; i < n/sizeof(unsigned long); i++)
     80        for (i = 0; i < n / sizeof(unsigned long); i++)
    7781                ((unsigned long *) dst)[i] = ((unsigned long *) src)[i];
    7882               
    79         for (j = 0; j < n%sizeof(unsigned long); j++)
    80                 ((unsigned char *)(((unsigned long *) dst) + i))[j] = ((unsigned char *)(((unsigned long *) src) + i))[j];
    81                
    82         return (char *)src;
    83 }
    84 
    85 void * memmove(void *dst, const void *src, size_t n)
     83        for (j = 0; j < n % sizeof(unsigned long); j++)
     84                ((unsigned char *) (((unsigned long *) dst) + i))[j] = ((unsigned char *) (((unsigned long *) src) + i))[j];
     85               
     86        return (char *) src;
     87}
     88
     89void *memmove(void *dst, const void *src, size_t n)
    8690{
    8791        int i, j;
     
    9094                return memcpy(dst, src, n);
    9195
    92         for (j = (n%sizeof(unsigned long))-1; j >= 0; j--)
    93                 ((unsigned char *)(((unsigned long *) dst) + i))[j] = ((unsigned char *)(((unsigned long *) src) + i))[j];
    94 
    95         for (i = n/sizeof(unsigned long)-1; i >=0 ; i--)
     96        for (j = (n % sizeof(unsigned long)) - 1; j >= 0; j--)
     97                ((unsigned char *) ((unsigned long *) dst))[j] = ((unsigned char *) ((unsigned long *) src))[j];
     98
     99        for (i = n / sizeof(unsigned long) - 1; i >=0 ; i--)
    96100                ((unsigned long *) dst)[i] = ((unsigned long *) src)[i];
    97101               
    98         return (char *)src;
     102        return (char *) src;
    99103}
    100104
     
    108112        size_t counter = 0;
    109113
    110         while (str[counter] != 0) {
     114        while (str[counter] != 0)
    111115                counter++;
    112         }
    113116
    114117        return counter;
    115118}
    116119
    117 int strcmp(const char *a,const char *b)
    118 {
    119         int c=0;
    120        
    121         while(a[c]&&b[c]&&(!(a[c]-b[c]))) c++;
    122        
    123         return a[c]-b[c];
    124        
    125 }
    126 
     120int strcmp(const char *a, const char *b)
     121{
     122        int c = 0;
     123       
     124        while (a[c] && b[c] && (!(a[c] - b[c])))
     125                c++;
     126       
     127        return (a[c] - b[c]);
     128       
     129}
    127130
    128131
     
    135138{
    136139        while (*str != '\0') {
    137                 if (*str == (char)c)
    138                         return (char *)str;
     140                if (*str == (char) c)
     141                        return (char *) str;
    139142                str++;
    140143        }
     
    153156
    154157        while (*str != '\0') {
    155                 if (*str == (char)c)
    156                         retval = (char *)str;
     158                if (*str == (char) c)
     159                        retval = (char *) str;
    157160                str++;
    158161        }
    159162
    160         return (char *)retval;
     163        return (char *) retval;
    161164}
    162165
     
    210213        while (*str) {
    211214                c = *str;
    212                 c = ( c >= 'a'? c-'a'+10:(c >= 'A'?c-'A'+10:(c <= '9'?c-'0':0xff)));
     215                c = (c >= 'a' ? c - 'a' + 10 : (c >= 'A' ? c - 'A' + 10 : (c <= '9' ? c - '0' : 0xff)));
    213216                if (c > base) {
    214217                        break;
     
    236239       
    237240        if (endptr)
    238                 *endptr = (char *)str;
     241                *endptr = (char *) str;
    239242
    240243        if (nptr == str) {
     
    264267
    265268        if (number > LONG_MAX) {
    266                 if ((sgn) && (number == (unsigned long)(LONG_MAX) + 1)) {
     269                if ((sgn) && (number == (unsigned long) (LONG_MAX) + 1)) {
    267270                        /* FIXME: set 0 to errno */
    268271                        return number;         
    269272                }
    270273                /* FIXME: set ERANGE to errno */
    271                 return (sgn?LONG_MIN:LONG_MAX);
    272         }
    273        
    274         return (sgn?-number:number);
     274                return (sgn ? LONG_MIN : LONG_MAX);     
     275        }
     276       
     277        return (sgn ? -number : number);
    275278}
    276279
     
    293296        number = _strtoul(nptr, endptr, base, &sgn);
    294297
    295         return (sgn?-number:number);
     298        return (sgn ? -number : number);
    296299}
    297300
    298301char *strcpy(char *dest, const char *src)
    299302{
    300         while (*(dest++) = *(src++))
    301                 ;
     303        char *orig = dest;
     304       
     305        while ((*(dest++) = *(src++)));
     306        return orig;
    302307}
    303308
    304309char *strncpy(char *dest, const char *src, size_t n)
    305310{
    306         while ((*(dest++) = *(src++)) && --n)
    307                 ;
    308 }
    309 
    310 
    311  /** @}
    312  */
    313  
    314  
     311        char *orig = dest;
     312       
     313        while ((*(dest++) = *(src++)) && --n);
     314        return orig;
     315}
     316
     317
     318/** @}
     319 */
  • libc/generic/time.c

    rb34fab6 ra46da63  
    2727 */
    2828
    29  /** @addtogroup libc
     29/** @addtogroup libc
    3030 * @{
    3131 */
     
    7474                mapping = as_get_mappable_page(PAGE_SIZE);
    7575                /* Get the mapping of kernel clock */
    76                 res = ipc_call_sync_3(PHONE_NS, IPC_M_AS_AREA_RECV,
    77                                       mapping, PAGE_SIZE, SERVICE_MEM_REALTIME,
    78                                       NULL,&rights,NULL);
     76                res = ipc_call_sync_3(PHONE_NS, IPC_M_AS_AREA_RECV, (sysarg_t) mapping, PAGE_SIZE, SERVICE_MEM_REALTIME, NULL, &rights, NULL);
    7977                if (res) {
    8078                        printf("Failed to initialize timeofday memarea\n");
     
    118116
    119117
    120  /** @}
     118/** @}
    121119 */
    122  
    123  
  • libc/include/err.h

    rb34fab6 ra46da63  
    2727 */
    2828
    29  /** @addtogroup libc
     29/** @addtogroup libc
    3030 * @{
    3131 */
     
    3636#define _libc__ERR_H_
    3737
    38 #define errx(status,fmt,...) { printf((fmt),##__VA_ARGS__);_exit(status);}
     38#define errx(status, fmt, ...) { \
     39        printf((fmt), ##__VA_ARGS__); \
     40        _exit(status); \
     41}
    3942
    4043#endif
    4144
    4245
    43  /** @}
     46/** @}
    4447 */
    45  
    46  
  • libc/include/libc.h

    rb34fab6 ra46da63  
    2727 */
    2828
    29  /** @addtogroup libc
     29/** @addtogroup libc
    3030 * @{
    3131 */
     
    4242#define __SYSCALL1(id, p1) __syscall(p1, 0, 0, 0, id)
    4343#define __SYSCALL2(id, p1, p2) __syscall(p1, p2, 0, 0, id)
    44 #define __SYSCALL3(id, p1, p2, p3) __syscall(p1,p2,p3, 0, id)
    45 #define __SYSCALL4(id, p1, p2, p3, p4) __syscall(p1,p2,p3,p4,id)
     44#define __SYSCALL3(id, p1, p2, p3) __syscall(p1, p2, p3, 0, id)
     45#define __SYSCALL4(id, p1, p2, p3, p4) __syscall(p1, p2, p3, p4, id)
    4646
    4747extern void __main(void);
     48extern void __io_init(void);
    4849extern void __exit(void);
    49 extern sysarg_t __syscall(const sysarg_t p1, const sysarg_t p2,
    50                           const sysarg_t p3, const sysarg_t p4,
    51                           const syscall_t id);
     50extern sysarg_t __syscall(const sysarg_t p1, const sysarg_t p2, const sysarg_t p3, const sysarg_t p4, const syscall_t id);
    5251
    5352
    5453#endif
    5554
    56 
    57  /** @}
     55/** @}
    5856 */
    59  
    60  
  • libc/malloc/malloc.c

    rb34fab6 ra46da63  
    29312931              sp->size >= extra &&
    29322932              !has_segment_link(m, sp)) { /* can't shrink if pinned */
    2933             size_t newsize = sp->size - extra;
    29342933            /* Prefer mremap, fall back to munmap */
    2935             if ((CALL_MREMAP(sp->base, sp->size, newsize, 0) != MFAIL) ||
    2936                 (CALL_MUNMAP(sp->base + newsize, extra) == 0)) {
     2934            if ((CALL_MREMAP(sp->base, sp->size, sp->size - extra, 0) != MFAIL) ||
     2935                (CALL_MUNMAP(sp->base + sp->size - extra, extra) == 0)) {
    29372936              released = extra;
    29382937            }
  • ns/ns.c

    rb34fab6 ra46da63  
    8282} hashed_service_t;
    8383
    84 int static ping_phone;
    85 
    8684static void *clockaddr = NULL;
    8785static void *klogaddr = NULL;
     
    107105        ipc_call_t call;
    108106        ipc_callid_t callid;
    109         char *as_area;
    110107       
    111         ipcarg_t retval, arg1, arg2;
     108        ipcarg_t retval;
    112109
    113110        if (!hash_table_create(&ns_hash_table, NS_HASH_TABLE_CHAINS, 3, &ns_hash_table_ops)) {
     
    150147                }
    151148                if (! (callid & IPC_CALLID_NOTIFICATION)) {
    152                         ipc_answer_fast(callid, retval, arg1, arg2);
     149                        ipc_answer_fast(callid, retval, 0, 0);
    153150                }
    154151        }
     
    258255        free(hash_table_get_instance(item, hashed_service_t, link));
    259256}
     257
    260258/**
    261259 * @}
Note: See TracChangeset for help on using the changeset viewer.