library: replace the troublesome '__BEGIN_DECLS' macro
When 'newlib' was introduced, in the commit referenced below, the use of that glibc '__BEGIN_DECLS' macro was standardized. However, as issue #88 revealed, this may result in a fatal build error with other environments. So, this patch just trades that macro for the standard '#ifdef __cplusplus' conventions (thus avoiding use of all those '#include <features.h>' directives as well). Reference(s): . newlib introduced commit a410e236abb47c7c43194e61d0566686f81513af . procps-ng-3.3.13 issue https://gitlab.com/procps-ng/procps/issues/88 . some additional discussion https://www.freelists.org/post/procps/PATCH-Replace-glibcspecific-macros-in-procnumah,1 . musl wiki (see: sys/cdefs.h error messages) https://wiki.musl-libc.org/faq.html Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
bae272fe22
commit
b0908eec4b
@ -23,9 +23,9 @@
|
|||||||
#ifndef PROCPS_DISKSTATS_H
|
#ifndef PROCPS_DISKSTATS_H
|
||||||
#define PROCPS_DISKSTATS_H
|
#define PROCPS_DISKSTATS_H
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
__BEGIN_DECLS
|
#endif
|
||||||
|
|
||||||
enum diskstats_item {
|
enum diskstats_item {
|
||||||
DISKSTATS_noop, // ( never altered )
|
DISKSTATS_noop, // ( never altered )
|
||||||
@ -126,5 +126,7 @@ struct diskstats_stack **procps_diskstats_sort (
|
|||||||
enum diskstats_item sortitem,
|
enum diskstats_item sortitem,
|
||||||
enum diskstats_sort_order order);
|
enum diskstats_sort_order order);
|
||||||
|
|
||||||
__END_DECLS
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
#ifndef PROCPS_MEMINFO_H
|
#ifndef PROCPS_MEMINFO_H
|
||||||
#define PROCPS_MEMINFO_H
|
#define PROCPS_MEMINFO_H
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
__BEGIN_DECLS
|
#endif
|
||||||
|
|
||||||
enum meminfo_item {
|
enum meminfo_item {
|
||||||
MEMINFO_noop, // ( never altered )
|
MEMINFO_noop, // ( never altered )
|
||||||
@ -171,5 +171,7 @@ struct meminfo_stack *procps_meminfo_select (
|
|||||||
enum meminfo_item *items,
|
enum meminfo_item *items,
|
||||||
int numitems);
|
int numitems);
|
||||||
|
|
||||||
__END_DECLS
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,7 +23,9 @@
|
|||||||
#ifndef PROC_NAMESPACE_H
|
#ifndef PROC_NAMESPACE_H
|
||||||
#define PROC_NAMESPACE_H
|
#define PROC_NAMESPACE_H
|
||||||
|
|
||||||
__BEGIN_DECLS
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
enum namespace_type {
|
enum namespace_type {
|
||||||
PROCPS_NS_IPC,
|
PROCPS_NS_IPC,
|
||||||
@ -44,6 +46,8 @@ const char *procps_ns_get_name(const int id);
|
|||||||
int procps_ns_get_id(const char *name);
|
int procps_ns_get_id(const char *name);
|
||||||
|
|
||||||
int procps_ns_read_pid(const int pid, struct procps_namespaces *nsp);
|
int procps_ns_read_pid(const int pid, struct procps_namespaces *nsp);
|
||||||
__END_DECLS
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
10
proc/pids.h
10
proc/pids.h
@ -23,9 +23,9 @@
|
|||||||
#ifndef PROCPS_PIDS_H
|
#ifndef PROCPS_PIDS_H
|
||||||
#define PROCPS_PIDS_H
|
#define PROCPS_PIDS_H
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
__BEGIN_DECLS
|
#endif
|
||||||
|
|
||||||
enum pids_item {
|
enum pids_item {
|
||||||
PIDS_noop, // ( never altered )
|
PIDS_noop, // ( never altered )
|
||||||
@ -233,5 +233,7 @@ struct pids_stack **procps_pids_sort (
|
|||||||
enum pids_item sortitem,
|
enum pids_item sortitem,
|
||||||
enum pids_sort_order order);
|
enum pids_sort_order order);
|
||||||
|
|
||||||
__END_DECLS
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,9 +23,9 @@
|
|||||||
#ifndef PROCPS_SLABINFO_H
|
#ifndef PROCPS_SLABINFO_H
|
||||||
#define PROCPS_SLABINFO_H
|
#define PROCPS_SLABINFO_H
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
__BEGIN_DECLS
|
#endif
|
||||||
|
|
||||||
enum slabinfo_item {
|
enum slabinfo_item {
|
||||||
SLABINFO_noop, // ( never altered )
|
SLABINFO_noop, // ( never altered )
|
||||||
@ -130,5 +130,7 @@ struct slabinfo_stack **procps_slabinfo_sort (
|
|||||||
enum slabinfo_item sortitem,
|
enum slabinfo_item sortitem,
|
||||||
enum slabinfo_sort_order order);
|
enum slabinfo_sort_order order);
|
||||||
|
|
||||||
__END_DECLS
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
10
proc/stat.h
10
proc/stat.h
@ -19,9 +19,9 @@
|
|||||||
#ifndef PROCPS_STAT_H
|
#ifndef PROCPS_STAT_H
|
||||||
#define PROCPS_STAT_H
|
#define PROCPS_STAT_H
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
__BEGIN_DECLS
|
#endif
|
||||||
|
|
||||||
enum stat_item {
|
enum stat_item {
|
||||||
STAT_noop, // ( never altered )
|
STAT_noop, // ( never altered )
|
||||||
@ -154,5 +154,7 @@ struct stat_stack **procps_stat_sort (
|
|||||||
enum stat_item sortitem,
|
enum stat_item sortitem,
|
||||||
enum stat_sort_order order);
|
enum stat_sort_order order);
|
||||||
|
|
||||||
__END_DECLS
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,13 +3,16 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
#include <features.h>
|
#ifdef __cplusplus
|
||||||
__BEGIN_DECLS
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
long procps_cpu_count(void);
|
long procps_cpu_count(void);
|
||||||
long procps_hertz_get(void);
|
long procps_hertz_get(void);
|
||||||
int procps_loadavg(double *av1, double *av5, double *av15);
|
int procps_loadavg(double *av1, double *av5, double *av15);
|
||||||
unsigned int procps_pid_length(void);
|
unsigned int procps_pid_length(void);
|
||||||
|
|
||||||
__END_DECLS
|
#ifdef __cplusplus
|
||||||
#endif /* SYSINFO_H */
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
@ -25,13 +25,15 @@
|
|||||||
#ifndef PROC_UPTIME_H
|
#ifndef PROC_UPTIME_H
|
||||||
#define PROC_UPTIME_H
|
#define PROC_UPTIME_H
|
||||||
|
|
||||||
#include <features.h>
|
#ifdef __cplusplus
|
||||||
__BEGIN_DECLS
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
int procps_uptime(double *uptime_secs, double *idle_secs);
|
int procps_uptime(double *uptime_secs, double *idle_secs);
|
||||||
char *procps_uptime_sprint(void);
|
char *procps_uptime_sprint(void);
|
||||||
char *procps_uptime_sprint_short(void);
|
char *procps_uptime_sprint_short(void);
|
||||||
|
|
||||||
__END_DECLS
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,10 +23,9 @@
|
|||||||
#ifndef PROC_VERSION_H
|
#ifndef PROC_VERSION_H
|
||||||
#define PROC_VERSION_H
|
#define PROC_VERSION_H
|
||||||
|
|
||||||
#include <features.h>
|
#ifdef __cplusplus
|
||||||
__BEGIN_DECLS
|
extern "C" {
|
||||||
|
#endif
|
||||||
int procps_linux_version(void);
|
|
||||||
|
|
||||||
/* Convenience macros for composing/decomposing version codes */
|
/* Convenience macros for composing/decomposing version codes */
|
||||||
#define LINUX_VERSION(x,y,z) (0x10000*((x)&0x7fff) + 0x100*((y)&0xff) + ((z)&0xff))
|
#define LINUX_VERSION(x,y,z) (0x10000*((x)&0x7fff) + 0x100*((y)&0xff) + ((z)&0xff))
|
||||||
@ -34,6 +33,9 @@ int procps_linux_version(void);
|
|||||||
#define LINUX_VERSION_MINOR(x) (((x)>> 8) & 0xFF)
|
#define LINUX_VERSION_MINOR(x) (((x)>> 8) & 0xFF)
|
||||||
#define LINUX_VERSION_PATCH(x) ( (x) & 0xFF)
|
#define LINUX_VERSION_PATCH(x) ( (x) & 0xFF)
|
||||||
|
|
||||||
__END_DECLS
|
int procps_linux_version(void);
|
||||||
|
|
||||||
#endif /* PROC_VERSION_H */
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
@ -24,9 +24,9 @@
|
|||||||
#ifndef PROCPS_VMSTAT_H
|
#ifndef PROCPS_VMSTAT_H
|
||||||
#define PROCPS_VMSTAT_H
|
#define PROCPS_VMSTAT_H
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
__BEGIN_DECLS
|
#endif
|
||||||
|
|
||||||
enum vmstat_item {
|
enum vmstat_item {
|
||||||
VMSTAT_noop, // ( never altered )
|
VMSTAT_noop, // ( never altered )
|
||||||
@ -308,5 +308,7 @@ struct vmstat_stack *procps_vmstat_select (
|
|||||||
enum vmstat_item *items,
|
enum vmstat_item *items,
|
||||||
int numitems);
|
int numitems);
|
||||||
|
|
||||||
__END_DECLS
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user