strace/negated_errno.h
Dmitry V. Levin d6c71dd061 Fix preprocessor indentation
Indent the C preprocessor directives to reflect their nesting
using the following script:

$ cppi -l $(git grep -El '^[[:space:]]*#[[:space:]]*(if|ifdef|ifndef|elif|else|endif|define|pragma)[[:space:]]' |grep -v '\.sh$') |while read f; do
	cppi < "$f" > "$f".cppi; mv "$f".cppi "$f"
done
2018-12-30 15:35:21 +00:00

32 lines
730 B
C

/*
* Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2017-2018 The strace developers.
* All rights reserved.
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#ifndef STRACE_NEGATED_ERRNO_H
# define STRACE_NEGATED_ERRNO_H
/*
* Check the syscall return value register value for whether it is
* a negated errno code indicating an error, or a success return value.
*/
static inline bool
is_negated_errno(kernel_ulong_t val)
{
kernel_ulong_t max = -(kernel_long_t) MAX_ERRNO_VALUE;
# ifndef current_klongsize
if (current_klongsize < sizeof(val)) {
val = (uint32_t) val;
max = (uint32_t) max;
}
# endif /* !current_klongsize */
return val >= max;
}
#endif /* !STRACE_NEGATED_ERRNO_H */