On 9/4/2014 11:19 AM, Gedare Bloom wrote:
On Wed, Sep 3, 2014 at 11:26 AM, Joel Sherrill
<joel.sherr...@oarcorp.com> wrote:
---
  cpukit/posix/src/mprotect.c | 23 ++++++++++++++---------
  1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/cpukit/posix/src/mprotect.c b/cpukit/posix/src/mprotect.c
index f2f8af6..51b565e 100644
--- a/cpukit/posix/src/mprotect.c
+++ b/cpukit/posix/src/mprotect.c
@@ -3,10 +3,19 @@
   *
   * @brief Change Memory Protection
   * @ingroup POSIXAPI
+ *
+ * 12.2.3 Change Memory Protection, P1003.1b-1996, p. 277.
+ *
+ * This is not a functional version of mprotect() but the SPARC backend
+ * for at least gcc 2.8.1 plus gnat 3.13p and gcc 3.0.1 require it to
+ * be there and return 0.
+ *
+ * As of gcc 4.2.2, the gcc SPARC backend doesn't appear to have a
+ * way to call this for RTEMS anymore but it doesn't hurt to leave it.
   */

  /*
- *  COPYRIGHT (c) 1989-2007.
+ *  COPYRIGHT (c) 1989-2014.
   *  On-Line Applications Research Corporation (OAR).
   *
   *  The license and distribution terms for this file may be
@@ -21,16 +30,12 @@
  #include <unistd.h>

  /*
- *  12.2.3 Change Memory Protection, P1003.1b-1996, p. 277.
- *
- *  This is not a functional version but the SPARC backend for at least
- *  gcc 2.8.1 plus gnat 3.13p and gcc 3.0.1 require it to be there and
- *  return 0.
- *
- *  As of gcc 4.2.2, the gcc SPARC backend doesn't appear to have a
- *  way to call this for RTEMS anymore but it doesn't hurt to leave it.
+ * RTEMS does not have <sys/mman.h> so we need a prototype here to
+ * avoid warnings.
   */

+int mprotect( const void *, size_t, int );
+
I don't like (despise) adding prototypes to C files just to get rid of
this warning. The prototype should be coming from whatever header
provides the function, or the function should be declared static.
We can't make it static as it doesn't solve the problem of providing a public
symbol to satisfy linking. As the comments indicate, this was added to let
gcc produced SPARC executables actually link.

Also I didn't see adding <sys/mman.h> when we don't support any of it.

http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/mman.h.html

However, that doesn't mean that adding <sys/mman.h> and a bunch of
stubs that return ENOSYS isn't an acceptable option. I just don't want to
invest the effort now.

  int mprotect(
    const void *addr __attribute__((unused)),
    size_t len __attribute__((unused)),
--
1.9.3

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


--
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherr...@oarcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to