Changeset c5b59ce in mainline for uspace/lib


Ignore:
Timestamp:
2010-09-26T12:28:09Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7390870
Parents:
e98b1d5
Message:

Integrate net_err.h into the standard library's err.h.

Location:
uspace/lib
Files:
1 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/err.h

    re98b1d5 rc5b59ce  
    3636#define LIBC_ERR_H_
    3737
     38#include <stdio.h>
     39#include <errno.h>
     40
     41#ifdef CONFIG_DEBUG
     42#include <str_error.h>
     43#endif
     44
    3845#define errx(status, fmt, ...) { \
    3946        printf((fmt), ##__VA_ARGS__); \
     
    4148}
    4249
     50
     51/** An actual stored error code.  */
     52#define ERROR_CODE  error_check_return_value
     53
     54/** An error processing routines declaration.
     55 *
     56 * This has to be declared in the block where the error processing
     57 * is desired.
     58 */
     59#define ERROR_DECLARE  int ERROR_CODE
     60
     61/** Store the value as an error code and checks if an error occurred.
     62 *
     63 * @param[in] value     The value to be checked. May be a function call.
     64 * @return              False if the value indicates success (EOK).
     65 * @return              True otherwise.
     66 */
     67#ifdef CONFIG_DEBUG
     68
     69#define ERROR_OCCURRED(value) \
     70        (((ERROR_CODE = (value)) != EOK) && \
     71        ({ \
     72                fprintf(stderr, "libsocket error at %s:%d (%s)\n", \
     73                __FILE__, __LINE__, str_error(ERROR_CODE)); \
     74                1; \
     75        }))
     76
     77#else
     78
     79#define ERROR_OCCURRED(value)   ((ERROR_CODE = (value)) != EOK)
     80
     81#endif
     82
     83#define ERROR_NONE(value)       !ERROR_OCCURRED((value))
     84
     85/** Error propagation
     86 *
     87 * Check if an error occurred and immediately exit the actual
     88 * function returning the error code.
     89 *
     90 * @param[in] value     The value to be checked. May be a function call.
     91 *
     92 */
     93
     94#define ERROR_PROPAGATE(value) \
     95        if (ERROR_OCCURRED(value)) \
     96                return ERROR_CODE
     97
    4398#endif
    4499
  • uspace/lib/net/adt/module_map.c

    re98b1d5 rc5b59ce  
    3838#include <task.h>
    3939#include <unistd.h>
     40#include <err.h>
    4041
    4142#include <ipc/services.h>
    4243
    43 #include <net_err.h>
    4444#include <net_modules.h>
    4545
  • uspace/lib/net/generic/packet_remote.c

    re98b1d5 rc5b59ce  
    3838#include <async.h>
    3939#include <errno.h>
     40#include <err.h>
    4041#include <ipc/ipc.h>
    4142#include <sys/mman.h>
    4243
    43 #include <net_err.h>
    4444#include <net_messages.h>
    4545#include <packet/packet.h>
  • uspace/lib/net/include/netif_local.h

    re98b1d5 rc5b59ce  
    4444#include <ipc/ipc.h>
    4545#include <ipc/services.h>
     46#include <err.h>
    4647
    4748#include <adt/measured_strings.h>
    48 #include <net_err.h>
    4949#include <net_device.h>
    5050#include <packet/packet.h>
  • uspace/lib/net/netif/netif_local.c

    re98b1d5 rc5b59ce  
    4242#include <ipc/ipc.h>
    4343#include <ipc/services.h>
    44 
    45 #include <net_err.h>
     44#include <err.h>
     45
    4646#include <net_messages.h>
    4747#include <net_modules.h>
  • uspace/lib/net/tl/tl_common.c

    re98b1d5 rc5b59ce  
    3939#include <ipc/services.h>
    4040#include <errno.h>
    41 
    42 #include <net_err.h>
     41#include <err.h>
     42
    4343#include <packet/packet.h>
    4444#include <packet/packet_client.h>
  • uspace/lib/socket/adt/measured_strings.c

    re98b1d5 rc5b59ce  
    3636 */
    3737
    38 #include <errno.h>
    3938#include <malloc.h>
    4039#include <mem.h>
    4140#include <unistd.h>
     41#include <errno.h>
     42#include <err.h>
    4243
    4344#include <ipc/ipc.h>
    4445
    45 #include <net_err.h>
    4646#include <net_modules.h>
    4747#include <adt/measured_strings.h>
  • uspace/lib/socket/generic/net_modules.c

    re98b1d5 rc5b59ce  
    3737#include <async.h>
    3838#include <malloc.h>
     39#include <err.h>
    3940
    4041#include <ipc/ipc.h>
     
    4344#include <sys/time.h>
    4445
    45 #include <net_err.h>
    4646#include <net_modules.h>
    4747
  • uspace/lib/socket/generic/socket_client.c

    re98b1d5 rc5b59ce  
    4343#include <stdlib.h>
    4444#include <errno.h>
     45#include <err.h>
    4546
    4647#include <ipc/services.h>
    4748
    48 #include <net_err.h>
    4949#include <net_modules.h>
    5050#include <in.h>
  • uspace/lib/socket/generic/socket_core.c

    re98b1d5 rc5b59ce  
    3838#include <stdlib.h>
    3939#include <errno.h>
    40 
    41 #include <net_err.h>
     40#include <err.h>
     41
    4242#include <in.h>
    4343#include <inet.h>
  • uspace/lib/socket/include/adt/generic_char_map.h

    re98b1d5 rc5b59ce  
    3838#define __GENERIC_CHAR_MAP_H__
    3939
     40#include <unistd.h>
    4041#include <errno.h>
    41 #include <unistd.h>
    42 
    43 #include <net_err.h>
     42#include <err.h>
    4443
    4544#include <adt/char_map.h>
  • uspace/lib/socket/packet/packet.c

    re98b1d5 rc5b59ce  
    3636 */
    3737
    38 #include <errno.h>
    3938#include <malloc.h>
    4039#include <mem.h>
    4140#include <fibril_synch.h>
    4241#include <unistd.h>
     42#include <errno.h>
     43#include <err.h>
    4344
    4445#include <sys/mman.h>
    4546
    46 #include <net_err.h>
    4747#include <adt/generic_field.h>
    4848#include <packet/packet.h>
  • uspace/lib/socket/packet/packet_server.c

    re98b1d5 rc5b59ce  
    3939#include <async.h>
    4040#include <errno.h>
     41#include <err.h>
    4142#include <fibril_synch.h>
    4243#include <unistd.h>
     
    4546#include <sys/mman.h>
    4647
    47 #include <net_err.h>
    4848#include <net_messages.h>
    4949#include <packet/packet.h>
Note: See TracChangeset for help on using the changeset viewer.