Discussion:
[PATCH] newlib/libc/sys/rtems/include/machine/param.h: Add _KERNEL to stop method leakage
Joel Sherrill
2018-10-18 23:31:17 UTC
Permalink
The following FreeBSD kernel methods are not in any standard and
prototypes/definitions were leaking into application space:

+ round_page()
+ trunc_page()
+ atop()
+ ptoa()
+ pgtok()
---
newlib/libc/sys/rtems/include/machine/param.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/machine/param.h b/newlib/libc/sys/rtems/include/machine/param.h
index 4892b61..e37d056 100644
--- a/newlib/libc/sys/rtems/include/machine/param.h
+++ b/newlib/libc/sys/rtems/include/machine/param.h
@@ -71,6 +71,7 @@

#define MAXPAGESIZES 1 /* maximum number of supported page sizes */

+#ifdef _KERNEL
/*
* Mach derived conversion macros
*/
@@ -82,4 +83,6 @@

#define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024))

+#endif
+
#endif /* !_MACHINE_PARAM_H_ */
--
1.8.3.1
Corinna Vinschen
2018-10-19 08:52:13 UTC
Permalink
Post by Joel Sherrill
The following FreeBSD kernel methods are not in any standard and
+ round_page()
+ trunc_page()
+ atop()
+ ptoa()
+ pgtok()
---
newlib/libc/sys/rtems/include/machine/param.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/newlib/libc/sys/rtems/include/machine/param.h b/newlib/libc/sys/rtems/include/machine/param.h
index 4892b61..e37d056 100644
--- a/newlib/libc/sys/rtems/include/machine/param.h
+++ b/newlib/libc/sys/rtems/include/machine/param.h
@@ -71,6 +71,7 @@
#define MAXPAGESIZES 1 /* maximum number of supported page sizes */
+#ifdef _KERNEL
/*
* Mach derived conversion macros
*/
@@ -82,4 +83,6 @@
#define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024))
+#endif
+
#endif /* !_MACHINE_PARAM_H_ */
--
1.8.3.1
Please push.


Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
Loading...