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>
#ifndef PROCPS_DISKSTATS_H
#define PROCPS_DISKSTATS_H
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
enum diskstats_item {
DISKSTATS_noop, // ( never altered )
enum diskstats_item sortitem,
enum diskstats_sort_order order);
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif
#ifndef PROCPS_MEMINFO_H
#define PROCPS_MEMINFO_H
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
enum meminfo_item {
MEMINFO_noop, // ( never altered )
enum meminfo_item *items,
int numitems);
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif
#ifndef PROC_NAMESPACE_H
#define PROC_NAMESPACE_H
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
enum namespace_type {
PROCPS_NS_IPC,
int procps_ns_get_id(const char *name);
int procps_ns_read_pid(const int pid, struct procps_namespaces *nsp);
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif
#ifndef PROCPS_PIDS_H
#define PROCPS_PIDS_H
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
enum pids_item {
PIDS_noop, // ( never altered )
enum pids_item sortitem,
enum pids_sort_order order);
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif
#ifndef PROCPS_SLABINFO_H
#define PROCPS_SLABINFO_H
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
enum slabinfo_item {
SLABINFO_noop, // ( never altered )
enum slabinfo_item sortitem,
enum slabinfo_sort_order order);
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif
#ifndef PROCPS_STAT_H
#define PROCPS_STAT_H
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
enum stat_item {
STAT_noop, // ( never altered )
enum stat_item sortitem,
enum stat_sort_order order);
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif
#include <sys/types.h>
#include <dirent.h>
-#include <features.h>
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
long procps_cpu_count(void);
long procps_hertz_get(void);
int procps_loadavg(double *av1, double *av5, double *av15);
unsigned int procps_pid_length(void);
-__END_DECLS
-#endif /* SYSINFO_H */
+#ifdef __cplusplus
+}
+#endif
+#endif
#ifndef PROC_UPTIME_H
#define PROC_UPTIME_H
-#include <features.h>
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
int procps_uptime(double *uptime_secs, double *idle_secs);
char *procps_uptime_sprint(void);
char *procps_uptime_sprint_short(void);
-__END_DECLS
-
+#ifdef __cplusplus
+}
+#endif
#endif
#ifndef PROC_VERSION_H
#define PROC_VERSION_H
-#include <features.h>
-__BEGIN_DECLS
-
-int procps_linux_version(void);
+#ifdef __cplusplus
+extern "C" {
+#endif
/* Convenience macros for composing/decomposing version codes */
#define LINUX_VERSION(x,y,z) (0x10000*((x)&0x7fff) + 0x100*((y)&0xff) + ((z)&0xff))
#define LINUX_VERSION_MINOR(x) (((x)>> 8) & 0xFF)
#define LINUX_VERSION_PATCH(x) ( (x) & 0xFF)
-__END_DECLS
+int procps_linux_version(void);
-#endif /* PROC_VERSION_H */
+#ifdef __cplusplus
+}
+#endif
+#endif
#ifndef PROCPS_VMSTAT_H
#define PROCPS_VMSTAT_H
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
enum vmstat_item {
VMSTAT_noop, // ( never altered )
enum vmstat_item *items,
int numitems);
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif