Changeset 04803bf in mainline for uspace/app/netecho/print_error.h


Ignore:
Timestamp:
2011-03-21T22:00:17Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
143932e3
Parents:
b50b5af2 (diff), 7308e84 (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 (needs fixes).

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/netecho/print_error.h

    rb50b5af2 r04803bf  
    11/*
    2  * Copyright (c) 2005 Jakub Jermar
     2 * Copyright (c) 2009 Lukas Mejdrech
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libcia64       
     29/** @addtogroup net_app
    3030 * @{
    3131 */
     32
    3233/** @file
     34 * Generic application error printing functions.
    3335 */
    3436
    35 #ifndef LIBC_ia64_ATOMIC_H_
    36 #define LIBC_ia64_ATOMIC_H_
     37#ifndef NET_APP_PRINT_
     38#define NET_APP_PRINT_
    3739
    38 /** Atomic addition.
     40#include <stdio.h>
     41
     42/** Returns whether the error code may be an ICMP error code.
    3943 *
    40  * @param val Atomic value.
    41  * @param imm Value to add.
     44 * @param[in] error_code The error code.
     45 * @return A value indicating whether the error code may be an ICMP error code.
     46 */
     47#define IS_ICMP_ERROR(error_code)       ((error_code) > 0)
     48
     49/** Returns whether the error code may be socket error code.
    4250 *
    43  * @return Value before addition.
     51 * @param[in] error_code The error code.
     52 * @return A value indicating whether the error code may be a socket error code.
    4453 */
    45 static inline long atomic_add(atomic_t *val, int imm)
    46 {
    47         long v;
     54#define IS_SOCKET_ERROR(error_code)     ((error_code) < 0)
    4855
    49         asm volatile ("fetchadd8.rel %0 = %1, %2\n" : "=r" (v), "+m" (val->count) : "i" (imm));
    50  
    51         return v;
    52 }
    53 
    54 static inline void atomic_inc(atomic_t *val) { atomic_add(val, 1); }
    55 static inline void atomic_dec(atomic_t *val) { atomic_add(val, -1); }
    56 
    57 static inline long atomic_preinc(atomic_t *val) { return atomic_add(val, 1) + 1; }
    58 static inline long atomic_predec(atomic_t *val) { return atomic_add(val, -1) - 1; }
    59 
    60 static inline long atomic_postinc(atomic_t *val) { return atomic_add(val, 1); }
    61 static inline long atomic_postdec(atomic_t *val) { return atomic_add(val, -1); }
     56extern void icmp_print_error(FILE *, int, const char *, const char *);
     57extern void print_error(FILE *, int, const char *, const char *);
     58extern void socket_print_error(FILE *, int, const char *, const char *);
    6259
    6360#endif
Note: See TracChangeset for help on using the changeset viewer.