Changeset 04803bf in mainline for uspace/app/netecho/print_error.h
- Timestamp:
- 2011-03-21T22:00:17Z (15 years ago)
- 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. - File:
-
- 1 moved
-
uspace/app/netecho/print_error.h (moved) (moved from uspace/lib/libc/arch/ia64/include/atomic.h ) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/netecho/print_error.h
rb50b5af2 r04803bf 1 1 /* 2 * Copyright (c) 200 5 Jakub Jermar2 * Copyright (c) 2009 Lukas Mejdrech 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup libcia6429 /** @addtogroup net_app 30 30 * @{ 31 31 */ 32 32 33 /** @file 34 * Generic application error printing functions. 33 35 */ 34 36 35 #ifndef LIBC_ia64_ATOMIC_H_36 #define LIBC_ia64_ATOMIC_H_37 #ifndef NET_APP_PRINT_ 38 #define NET_APP_PRINT_ 37 39 38 /** Atomic addition. 40 #include <stdio.h> 41 42 /** Returns whether the error code may be an ICMP error code. 39 43 * 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. 42 50 * 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. 44 53 */ 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) 48 55 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); } 56 extern void icmp_print_error(FILE *, int, const char *, const char *); 57 extern void print_error(FILE *, int, const char *, const char *); 58 extern void socket_print_error(FILE *, int, const char *, const char *); 62 59 63 60 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
