procps/proc/procps.h

54 lines
1.6 KiB
C
Raw Normal View History

2002-11-25 15:46:33 +05:30
#ifndef PROCPS_PROC_PROCPS_H
#define PROCPS_PROC_PROCPS_H
2002-02-02 04:17:29 +05:30
/* The shadow of the original with only common prototypes now. */
#include <stdio.h>
#include <sys/types.h>
/* The HZ constant from <asm/param.h> is replaced by the Hertz variable
* available from "proc/sysinfo.h".
*/
/* get page info */
#include <asm/page.h>
2002-11-25 10:35:52 +05:30
#if !defined(restrict) && __STDC_VERSION__ < 199901
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 // maybe 92 or 95 ?
#define restrict __restrict__
#else
#warning No restrict keyword?
#define restrict
#endif
#endif
2002-11-25 15:46:33 +05:30
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 96
2002-12-03 02:35:22 +05:30
// won't alias anything, and aligned enough for anything
2002-11-25 15:46:33 +05:30
#define MALLOC __attribute__ ((__malloc__))
2002-12-03 02:35:22 +05:30
// tell gcc what to expect: if(unlikely(err)) die(err);
2002-12-04 09:34:19 +05:30
#define likely(x) __builtin_expect(!!(x),1)
#define unlikely(x) __builtin_expect(!!(x),0)
2002-11-25 15:46:33 +05:30
#else
#define MALLOC
2002-12-03 02:35:22 +05:30
#define likely(x) (x)
#define unlikely(x) (x)
2002-11-25 15:46:33 +05:30
#endif
2002-11-25 10:35:52 +05:30
2002-11-25 15:46:33 +05:30
extern void *xrealloc(void *oldp, unsigned int size) MALLOC;
extern void *xmalloc(unsigned int size) MALLOC;
extern void *xcalloc(void *pointer, int size) MALLOC;
2002-02-02 04:17:29 +05:30
2002-05-30 12:38:15 +05:30
extern int mult_lvl_cmp(void* a, void* b);
2002-02-02 04:17:29 +05:30
2002-05-30 12:38:15 +05:30
extern char *user_from_uid(uid_t uid);
extern char *group_from_gid(gid_t gid);
2002-02-02 04:17:29 +05:30
2002-05-30 12:38:15 +05:30
extern const char * wchan(unsigned long address);
2002-11-25 15:46:33 +05:30
extern int open_psdb(const char *restrict override);
extern int open_psdb_message(const char *restrict override, void (*message)(const char *, ...));
extern unsigned print_str (FILE *restrict file, const char *restrict s, unsigned max);
extern unsigned print_strlist(FILE *restrict file, const char *restrict const *restrict strs, unsigned max);
2002-02-02 04:17:29 +05:30
2002-11-25 15:46:33 +05:30
#endif