2002-11-25 10:16:33 +00:00
|
|
|
#ifndef PROCPS_PROC_PROCPS_H
|
|
|
|
#define PROCPS_PROC_PROCPS_H
|
|
|
|
|
2015-06-20 07:43:02 +10:00
|
|
|
#include <features.h>
|
2002-02-01 22:47:29 +00:00
|
|
|
|
2003-01-16 08:03:40 +00:00
|
|
|
#define KLONG long
|
|
|
|
#define KLF "l"
|
|
|
|
#define STRTOUKL strtoul
|
|
|
|
|
2003-02-11 08:19:12 +00:00
|
|
|
// since gcc-2.5
|
|
|
|
#define NORETURN __attribute__((__noreturn__))
|
|
|
|
#define FUNCTION __attribute__((__const__)) // no access to global mem, even via ptr, and no side effect
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
2011-10-11 22:01:19 +02:00
|
|
|
#ifdef SHARED
|
|
|
|
# if SHARED==1 && (__GNUC__ > 2 || __GNUC_MINOR__ >= 96)
|
|
|
|
# define LABEL_OFFSET
|
|
|
|
# endif
|
2003-02-17 00:57:15 +00:00
|
|
|
#endif
|
|
|
|
|
2004-01-24 22:33:56 +00:00
|
|
|
#define STRINGIFY_ARG(a) #a
|
|
|
|
#define STRINGIFY(a) STRINGIFY_ARG(a)
|
2003-02-17 00:57:15 +00:00
|
|
|
|
2011-06-04 19:40:29 +02:00
|
|
|
// marks old junk, to warn non-procps-ng library users
|
2003-01-15 10:52:39 +00:00
|
|
|
#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3
|
|
|
|
#define OBSOLETE __attribute__((deprecated))
|
|
|
|
#else
|
|
|
|
#define OBSOLETE
|
|
|
|
#endif
|
|
|
|
|
2003-01-22 08:31:50 +00:00
|
|
|
// 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 10:52:39 +00:00
|
|
|
#endif
|
|
|
|
|
2011-11-16 10:49:02 -06:00
|
|
|
|
2012-01-09 21:44:51 +11:00
|
|
|
typedef void (*message_fn)(const char *__restrict, ...) __attribute__((format(printf,1,2)));
|
2011-11-16 10:49:02 -06:00
|
|
|
|
2002-11-25 10:16:33 +00:00
|
|
|
#endif
|