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.
This commit is contained in:
Craig Small 2012-01-09 21:44:51 +11:00
parent 1928653399
commit a909f6e917
7 changed files with 27 additions and 27 deletions

View File

@ -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

View File

@ -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 " <defunct>"
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

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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