From a909f6e9170b0885928b9af3b86d47e5faf89fd5 Mon Sep 17 00:00:00 2001 From: Craig Small Date: Mon, 9 Jan 2012 21:44:51 +1100 Subject: [PATCH] Change restrict to __restrict in public includes procps automake defines restrict which means the binaries for procps binaries compile. However external programs may not of defined restrict which means they will not complie if they include files found in /usr/include/proc. Includes from libc6 use __restrict and if is good enough for them, its good enough for us. --- proc/devname.h | 4 ++-- proc/escape.h | 8 ++++---- proc/procps.h | 2 +- proc/readproc.h | 20 ++++++++++---------- proc/sig.h | 6 +++--- proc/sysinfo.h | 10 +++++----- proc/wchan.h | 4 ++-- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/proc/devname.h b/proc/devname.h index d54de1cd..a725f156 100644 --- a/proc/devname.h +++ b/proc/devname.h @@ -10,9 +10,9 @@ EXTERN_C_BEGIN #define ABBREV_TTY 2 /* remove tty */ #define ABBREV_PTS 4 /* remove pts/ */ -extern unsigned dev_to_tty(char *restrict ret, unsigned chop, dev_t dev_t_dev, int pid, unsigned int flags); +extern unsigned dev_to_tty(char *__restrict ret, unsigned chop, dev_t dev_t_dev, int pid, unsigned int flags); -extern int tty_to_dev(const char *restrict const name); +extern int tty_to_dev(const char *__restrict const name); EXTERN_C_END #endif diff --git a/proc/escape.h b/proc/escape.h index 8ef7b2f2..80d16f1d 100644 --- a/proc/escape.h +++ b/proc/escape.h @@ -14,10 +14,10 @@ EXTERN_C_BEGIN #define ESC_BRACKETS 0x2 // if using cmd, put '[' and ']' around it #define ESC_DEFUNCT 0x4 // mark zombies with " " -extern int escape_strlist(char *restrict dst, char *restrict const *restrict src, size_t n, int *cells); -extern int escape_str(char *restrict dst, const char *restrict src, int bufsize, int *maxcells); -extern int escape_command(char *restrict const outbuf, const proc_t *restrict const pp, int bytes, int *cells, unsigned flags); -extern int escaped_copy(char *restrict dst, const char *restrict src, int bufsize, int *maxroom); +extern int escape_strlist(char *__restrict dst, char *__restrict const *__restrict src, size_t n, int *cells); +extern int escape_str(char *__restrict dst, const char *__restrict src, int bufsize, int *maxcells); +extern int escape_command(char *__restrict const outbuf, const proc_t *__restrict const pp, int bytes, int *cells, unsigned flags); +extern int escaped_copy(char *__restrict dst, const char *__restrict src, int bufsize, int *maxroom); EXTERN_C_END #endif diff --git a/proc/procps.h b/proc/procps.h index 70514b41..42325a38 100644 --- a/proc/procps.h +++ b/proc/procps.h @@ -103,6 +103,6 @@ #endif -typedef void (*message_fn)(const char *restrict, ...) __attribute__((format(printf,1,2))); +typedef void (*message_fn)(const char *__restrict, ...) __attribute__((format(printf,1,2))); #endif diff --git a/proc/readproc.h b/proc/readproc.h index 9d781404..2bfbfb08 100644 --- a/proc/readproc.h +++ b/proc/readproc.h @@ -173,10 +173,10 @@ typedef struct PROCTAB { // char deBug1[64]; pid_t taskdir_user; // for threads int did_fake; // used when taskdir is missing - int(*finder)(struct PROCTAB *restrict const, proc_t *restrict const); - proc_t*(*reader)(struct PROCTAB *restrict const, proc_t *restrict const); - int(*taskfinder)(struct PROCTAB *restrict const, const proc_t *restrict const, proc_t *restrict const, char *restrict const); - proc_t*(*taskreader)(struct PROCTAB *restrict const, const proc_t *restrict const, proc_t *restrict const, char *restrict const); + int(*finder)(struct PROCTAB *__restrict const, proc_t *__restrict const); + proc_t*(*reader)(struct PROCTAB *__restrict const, proc_t *__restrict const); + int(*taskfinder)(struct PROCTAB *__restrict const, const proc_t *__restrict const, proc_t *__restrict const, char *__restrict const); + proc_t*(*taskreader)(struct PROCTAB *__restrict const, const proc_t *__restrict const, proc_t *__restrict const, char *__restrict const); pid_t* pids; // pids of the procs uid_t* uids; // uids of procs int nuid; // cannot really sentinel-terminate unsigned short[] @@ -200,8 +200,8 @@ typedef struct proc_data_t { // valued by: (else zero) int ntask; // * readproctab2 } proc_data_t; // * when PROC_LOOSE_TASKS set -extern proc_data_t *readproctab2(int(*want_proc)(proc_t *buf), int(*want_task)(proc_t *buf), PROCTAB *restrict const PT); -extern proc_data_t *readproctab3(int(*want_task)(proc_t *buf), PROCTAB *restrict const PT); +extern proc_data_t *readproctab2(int(*want_proc)(proc_t *buf), int(*want_task)(proc_t *buf), PROCTAB *__restrict const PT); +extern proc_data_t *readproctab3(int(*want_task)(proc_t *buf), PROCTAB *__restrict const PT); // Convenient wrapper around openproc and readproc to slurp in the whole process // table subset satisfying the constraints of flags and the optional PID list. @@ -222,12 +222,12 @@ extern void closeproc(PROCTAB* PT); // only before first use. Thereafter, the library will manage such // a passed proc_t, freeing any additional acquired memory associated // with the previous process or thread. -extern proc_t* readproc(PROCTAB *restrict const PT, proc_t *restrict p); -extern proc_t* readtask(PROCTAB *restrict const PT, const proc_t *restrict const p, proc_t *restrict t); -extern proc_t* readeither(PROCTAB *restrict const PT, proc_t *restrict x); +extern proc_t* readproc(PROCTAB *__restrict const PT, proc_t *__restrict p); +extern proc_t* readtask(PROCTAB *__restrict const PT, const proc_t *__restrict const p, proc_t *__restrict t); +extern proc_t* readeither(PROCTAB *__restrict const PT, proc_t *__restrict x); // warning: interface may change -extern int read_cmdline(char *restrict const dst, unsigned sz, unsigned pid); +extern int read_cmdline(char *__restrict const dst, unsigned sz, unsigned pid); extern void look_up_our_self(proc_t *p); diff --git a/proc/sig.h b/proc/sig.h index 0c842ab7..3b77f642 100644 --- a/proc/sig.h +++ b/proc/sig.h @@ -16,13 +16,13 @@ EXTERN_C_BEGIN /* return -1 on failure */ -extern int signal_name_to_number(const char *restrict name); +extern int signal_name_to_number(const char *__restrict name); extern const char *signal_number_to_name(int signo); -extern int print_given_signals(int argc, const char *restrict const *restrict argv, int max_line); +extern int print_given_signals(int argc, const char *__restrict const *__restrict argv, int max_line); -extern char *strtosig(const char *restrict s); +extern char *strtosig(const char *__restrict s); extern void pretty_print_signals(void); diff --git a/proc/sysinfo.h b/proc/sysinfo.h index 8dbb9795..1eb34727 100644 --- a/proc/sysinfo.h +++ b/proc/sysinfo.h @@ -57,11 +57,11 @@ extern unsigned long kb_pagetables; #define BUFFSIZE (64*1024) typedef unsigned long long jiff; -extern void getstat(jiff *restrict cuse, jiff *restrict cice, jiff *restrict csys, jiff *restrict cide, jiff *restrict ciow, jiff *restrict cxxx, jiff *restrict cyyy, jiff *restrict czzz, - unsigned long *restrict pin, unsigned long *restrict pout, unsigned long *restrict s_in, unsigned long *restrict sout, - unsigned *restrict intr, unsigned *restrict ctxt, - unsigned int *restrict running, unsigned int *restrict blocked, - unsigned int *restrict btime, unsigned int *restrict processes); +extern void getstat(jiff *__restrict cuse, jiff *__restrict cice, jiff *__restrict csys, jiff *__restrict cide, jiff *__restrict ciow, jiff *__restrict cxxx, jiff *__restrict cyyy, jiff *__restrict czzz, + unsigned long *__restrict pin, unsigned long *__restrict pout, unsigned long *__restrict s_in, unsigned long *__restrict sout, + unsigned *__restrict intr, unsigned *__restrict ctxt, + unsigned int *__restrict running, unsigned int *__restrict blocked, + unsigned int *__restrict btime, unsigned int *__restrict processes); extern void meminfo(void); diff --git a/proc/wchan.h b/proc/wchan.h index aa50fc5f..e3d0b310 100644 --- a/proc/wchan.h +++ b/proc/wchan.h @@ -6,8 +6,8 @@ EXTERN_C_BEGIN extern const char * lookup_wchan(unsigned KLONG address, unsigned pid); -extern int open_psdb(const char *restrict override); -extern int open_psdb_message(const char *restrict override, message_fn message); +extern int open_psdb(const char *__restrict override); +extern int open_psdb_message(const char *__restrict override, message_fn message); EXTERN_C_END -- 2.40.0