2002-11-25 15:46:33 +05:30
|
|
|
#ifndef PROCPS_PROC_PROCPS_H
|
|
|
|
#define PROCPS_PROC_PROCPS_H
|
|
|
|
|
2002-12-09 12:30:07 +05:30
|
|
|
#ifdef __cplusplus
|
|
|
|
#define EXTERN_C_BEGIN extern "C" {
|
|
|
|
#define EXTERN_C_END }
|
|
|
|
#else
|
|
|
|
#define EXTERN_C_BEGIN
|
|
|
|
#define EXTERN_C_END
|
|
|
|
#endif
|
2002-02-02 04:17:29 +05:30
|
|
|
|
2003-01-16 13:33:40 +05:30
|
|
|
// Some ports make the mistake of running a 32-bit userspace
|
|
|
|
// on a 64-bit kernel. Shame on them. It's not at all OK to
|
|
|
|
// make everything "long long", since that causes unneeded
|
|
|
|
// slowness on 32-bit hardware.
|
|
|
|
//
|
|
|
|
// SPARC: 32-bit kernel is an ex-penguin, so use "long long".
|
|
|
|
//
|
|
|
|
// MIPS: Used for embedded systems and obsolete hardware.
|
|
|
|
// Oh, there's a 64-bit version? SGI is headed toward IA-64,
|
|
|
|
// so don't worry about 64-bit MIPS.
|
|
|
|
//
|
|
|
|
// PowerPC: Big ugly problem! Macs are popular. :-/
|
|
|
|
//
|
2003-01-21 15:28:15 +05:30
|
|
|
// Unknown: PA-RISC, zSeries, and x86-64
|
2003-01-16 13:33:40 +05:30
|
|
|
//
|
2003-01-21 15:28:15 +05:30
|
|
|
#if defined(k64test) || defined(__sparc__) // || defined(__mips__) || defined(__powerpc__)
|
2003-01-16 13:33:40 +05:30
|
|
|
#define KLONG long long // not typedef; want "unsigned KLONG" to work
|
|
|
|
#define KLF "L"
|
|
|
|
#define STRTOUKL strtoull
|
|
|
|
#else
|
|
|
|
#define KLONG long
|
|
|
|
#define KLF "l"
|
|
|
|
#define STRTOUKL strtoul
|
|
|
|
#endif
|
|
|
|
|
2003-02-11 13:49:12 +05:30
|
|
|
// since gcc-2.5
|
|
|
|
#define NORETURN __attribute__((__noreturn__))
|
|
|
|
#define FUNCTION __attribute__((__const__)) // no access to global mem, even via ptr, and no side effect
|
|
|
|
|
2002-11-25 10:35:52 +05:30
|
|
|
#if !defined(restrict) && __STDC_VERSION__ < 199901
|
2003-02-11 13:49:12 +05:30
|
|
|
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 92
|
2002-11-25 10:35:52 +05:30
|
|
|
#define restrict __restrict__
|
|
|
|
#else
|
|
|
|
#warning No restrict keyword?
|
|
|
|
#define restrict
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2003-02-11 13:49:12 +05:30
|
|
|
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 96
|
|
|
|
// won't alias anything, and aligned enough for anything
|
|
|
|
#define MALLOC __attribute__ ((__malloc__))
|
|
|
|
// no side effect, may read globals
|
|
|
|
#define PURE __attribute__ ((__pure__))
|
|
|
|
// tell gcc what to expect: if(unlikely(err)) die(err);
|
|
|
|
#define likely(x) __builtin_expect(!!(x),1)
|
|
|
|
#define unlikely(x) __builtin_expect(!!(x),0)
|
|
|
|
#define expected(x,y) __builtin_expect((x),(y))
|
|
|
|
#else
|
|
|
|
#define MALLOC
|
|
|
|
#define PURE
|
|
|
|
#define likely(x) (x)
|
|
|
|
#define unlikely(x) (x)
|
|
|
|
#define expected(x,y) (x)
|
|
|
|
#endif
|
|
|
|
|
2003-02-17 06:27:15 +05:30
|
|
|
#if SHARED==1 && (__GNUC__ > 2 || __GNUC_MINOR__ >= 96)
|
|
|
|
#define LABEL_OFFSET
|
|
|
|
#endif
|
|
|
|
|
2004-01-25 04:03:56 +05:30
|
|
|
#define STRINGIFY_ARG(a) #a
|
|
|
|
#define STRINGIFY(a) STRINGIFY_ARG(a)
|
2003-02-17 06:27:15 +05:30
|
|
|
|
2003-01-15 16:22:39 +05:30
|
|
|
// marks old junk, to warn non-procps library users
|
|
|
|
#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3
|
|
|
|
#define OBSOLETE __attribute__((deprecated))
|
|
|
|
#else
|
|
|
|
#define OBSOLETE
|
|
|
|
#endif
|
|
|
|
|
2003-02-11 13:49:12 +05:30
|
|
|
#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 1 ) || __GNUC__ > 3
|
2003-01-15 16:22:39 +05:30
|
|
|
// Tells gcc that function is library-internal;
|
|
|
|
// so no need to do dynamic linking at run-time.
|
2003-01-22 14:01:50 +05:30
|
|
|
// This might work with slightly older compilers too.
|
|
|
|
#define HIDDEN __attribute__((visibility("hidden")))
|
2003-02-11 13:49:12 +05:30
|
|
|
// Tell g++ that a function won't throw exceptions.
|
|
|
|
#define NOTHROW __attribute__((__nothrow__))
|
2003-01-15 16:22:39 +05:30
|
|
|
#else
|
2003-01-22 14:01:50 +05:30
|
|
|
#define HIDDEN
|
2003-02-11 13:49:12 +05:30
|
|
|
#define NOTHROW
|
2003-01-22 14:01:50 +05:30
|
|
|
#endif
|
|
|
|
|
|
|
|
// Like HIDDEN, but for an alias that gets created.
|
|
|
|
// In gcc-3.2 there is an alias+hidden conflict.
|
|
|
|
// Many will have patched this bug, but oh well.
|
|
|
|
#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 2 ) || __GNUC__ > 3
|
|
|
|
#define HIDDEN_ALIAS(x) extern __typeof(x) x##_direct __attribute__((alias(#x),visibility("hidden")))
|
|
|
|
#else
|
|
|
|
#define HIDDEN_ALIAS(x) extern __typeof(x) x##_direct __attribute__((alias(#x)))
|
2003-01-15 16:22:39 +05:30
|
|
|
#endif
|
|
|
|
|
2002-11-25 15:46:33 +05:30
|
|
|
#endif
|