Changeset b8e72fd1 in mainline for uspace/lib/c


Ignore:
Timestamp:
2013-05-30T17:13:02Z (12 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
98abd40
Parents:
be2bb4f (diff), 94dfb92 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

Location:
uspace/lib/c
Files:
5 added
13 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/Makefile

    rbe2bb4f rb8e72fd1  
    7575        generic/device/pci.c \
    7676        generic/device/ahci.c \
     77        generic/dnsr.c \
    7778        generic/dlfcn.c \
    7879        generic/elf/elf_load.c \
     
    9293        generic/task.c \
    9394        generic/futex.c \
     95        generic/inet/addr.c \
    9496        generic/inet.c \
    9597        generic/inetcfg.c \
     
    162164
    163165$(LIBC_PREFIX)/arch/$(UARCH)/_link.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
    164         $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -E -x c $< | grep -v "^\#" > $@
     166        $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -E -x c $< | grep -v "^\#" > $@
    165167
    166168$(LIBC_PREFIX)/arch/$(UARCH)/_link-loader.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
    167         $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DLOADER -E -x c $< | grep -v "^\#" > $@
     169        $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DLOADER -E -x c $< | grep -v "^\#" > $@
    168170
    169171$(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
    170         $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DSHLIB -E -x c $< | grep -v "^\#" > $@
     172        $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DSHLIB -E -x c $< | grep -v "^\#" > $@
    171173
    172174$(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
    173         $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DDLEXE -E -x c $< | grep -v "^\#" > $@
     175        $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DDLEXE -E -x c $< | grep -v "^\#" > $@
    174176
    175177$(COMMON_HEADER_ARCH): $(COMMON_HEADER)
  • uspace/lib/c/arch/amd64/Makefile.common

    rbe2bb4f rb8e72fd1  
    2828
    2929CLANG_ARCH = x86_64
     30CLANG_TARGET = x86_64-unknown-linux
    3031GCC_CFLAGS += -fno-omit-frame-pointer
     32CLANG_CFLAGS += -fno-omit-frame-pointer
    3133
    3234ENDIANESS = LE
  • uspace/lib/c/arch/ia32/Makefile.common

    rbe2bb4f rb8e72fd1  
    2828
    2929CLANG_ARCH = i386
     30CLANG_TARGET = i386-unknown-linux
    3031
    3132ifeq ($(PROCESSOR),i486)
     
    3435        GCC_CFLAGS += -march=pentium -fno-omit-frame-pointer
    3536endif
     37CLANG_CFLAGS += -fno-omit-frame-pointer
    3638
    3739ENDIANESS = LE
  • uspace/lib/c/generic/device/hw_res_parsed.c

    rbe2bb4f rb8e72fd1  
    188188        hw_resource_list_t hw_resources;
    189189        hw_res_list_parsed_clean(hw_res_parsed);
    190         bzero(&hw_resources, sizeof(hw_resource_list_t));
     190        memset(&hw_resources, 0, sizeof(hw_resource_list_t));
    191191       
    192192        int rc = hw_res_get_resource_list(sess, &hw_resources);
  • uspace/lib/c/generic/mem.c

    rbe2bb4f rb8e72fd1  
    224224 * @param s1  Pointer to the first area to compare.
    225225 * @param s2  Pointer to the second area to compare.
    226  * @param len Size of the first area in bytes. Both areas must have
    227  *            the same length.
    228  *
    229  * @return If len is 0, return zero. If the areas match, return
    230  *         zero. Otherwise return non-zero.
    231  *
    232  */
    233 int bcmp(const void *s1, const void *s2, size_t len)
     226 * @param len Size of the areas in bytes.
     227 *
     228 * @return Zero if areas have the same contents. If they differ,
     229 *         the sign of the result is the same as the sign of the
     230 *         difference of the first pair of different bytes.
     231 *
     232 */
     233int memcmp(const void *s1, const void *s2, size_t len)
    234234{
    235235        uint8_t *u1 = (uint8_t *) s1;
    236236        uint8_t *u2 = (uint8_t *) s2;
    237        
    238         for (; (len != 0) && (*u1++ == *u2++); len--);
    239        
    240         return len;
     237        size_t i;
     238
     239        for (i = 0; i < len; i++) {
     240                if (*u1 != *u2)
     241                        return (int)(*u1) - (int)(*u2);
     242                ++u1;
     243                ++u2;
     244        }
     245
     246        return 0;
    241247}
    242248
  • uspace/lib/c/generic/net/inet.c

    rbe2bb4f rb8e72fd1  
    144144        /* Erase if no address */
    145145        if (!address) {
    146                 bzero(data, count);
     146                memset(data, 0, count);
    147147                return ENOENT;
    148148        }
     
    181181                } else {
    182182                        /* Erase the rest of the address */
    183                         bzero(data + index, count - index);
     183                        memset(data + index, 0, count - index);
    184184                        return EOK;
    185185                }
  • uspace/lib/c/generic/net/socket_client.c

    rbe2bb4f rb8e72fd1  
    446446                return ENOMEM;
    447447
    448         bzero(socket, sizeof(*socket));
     448        memset(socket, 0, sizeof(*socket));
    449449        fibril_rwlock_write_lock(&socket_globals.lock);
    450450
     
    657657                return ENOMEM;
    658658        }
    659         bzero(new_socket, sizeof(*new_socket));
     659        memset(new_socket, 0, sizeof(*new_socket));
    660660        socket_id = socket_generate_new_id();
    661661        if (socket_id <= 0) {
  • uspace/lib/c/include/device/hw_res_parsed.h

    rbe2bb4f rb8e72fd1  
    127127        free(list->dma_channels.channels);
    128128       
    129         bzero(list, sizeof(hw_res_list_parsed_t));
     129        memset(list, 0, sizeof(hw_res_list_parsed_t));
    130130}
    131131
     
    136136static inline void hw_res_list_parsed_init(hw_res_list_parsed_t *list)
    137137{
    138         bzero(list, sizeof(hw_res_list_parsed_t));
     138        memset(list, 0, sizeof(hw_res_list_parsed_t));
    139139}
    140140
  • uspace/lib/c/include/inet/inet.h

    rbe2bb4f rb8e72fd1  
    3636#define LIBC_INET_INET_H_
    3737
     38#include <inet/addr.h>
    3839#include <sys/types.h>
    3940
    4041#define INET_TTL_MAX 255
    41 
    42 typedef struct {
    43         uint32_t ipv4;
    44 } inet_addr_t;
    4542
    4643typedef struct {
  • uspace/lib/c/include/inet/inetcfg.h

    rbe2bb4f rb8e72fd1  
    3838#include <inet/inet.h>
    3939#include <sys/types.h>
    40 
    41 /** Network address */
    42 typedef struct {
    43         /** Address */
    44         uint32_t ipv4;
    45         /** Number of valid bits in @c ipv4 */
    46         int bits;
    47 } inet_naddr_t;
    4840
    4941/** Address object info */
  • uspace/lib/c/include/io/verify.h

    rbe2bb4f rb8e72fd1  
    3838#ifndef NVERIFY_PRINTF
    3939
     40#ifdef __clang__
     41#define PRINTF_ATTRIBUTE(start, end) \
     42        __attribute__((format(__printf__, start, end)))
     43#else
    4044#define PRINTF_ATTRIBUTE(start, end) \
    4145        __attribute__((format(gnu_printf, start, end)))
     46#endif
    4247
    4348#else /* NVERIFY_PRINTF */
  • uspace/lib/c/include/ipc/services.h

    rbe2bb4f rb8e72fd1  
    5353} services_t;
    5454
     55#define SERVICE_NAME_DNSR     "net/dnsr"
    5556#define SERVICE_NAME_INET     "net/inet"
    5657#define SERVICE_NAME_INETCFG  "net/inetcfg"
  • uspace/lib/c/include/mem.h

    rbe2bb4f rb8e72fd1  
    3838#include <sys/types.h>
    3939
    40 #define bzero(ptr, len)  memset((ptr), 0, (len))
    41 
    4240extern void *memset(void *, int, size_t)
    4341    __attribute__ ((optimize("-fno-tree-loop-distribute-patterns")));
     
    4543    __attribute__ ((optimize("-fno-tree-loop-distribute-patterns")));
    4644extern void *memmove(void *, const void *, size_t);
    47 
    48 extern int bcmp(const void *, const void *, size_t);
     45extern int memcmp(const void *, const void *, size_t);
    4946
    5047#endif
Note: See TracChangeset for help on using the changeset viewer.