<div dir="ltr">Dear Joel,<div><br></div><div>I am sorry. please let me know how to download these patch codes(source code, <a href="http://makefile.am">makefile.am</a>, <a href="http://pre-install.am">pre-install.am</a>, etc) for mmap implementation.</div><div><br></div><div>At this time, I am modified <a href="http://makefile.am">makefile.am</a> for integrating mmp source code in gsoc2011-rtems-mmu-support-project. but, I was failed in building process.</div><div><br></div><div><br></div><div>Please advise me.</div><div><br></div><div>Best Regards.</div><div>Thomas Kim</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-11-20 11:37 GMT+09:00 Joel Sherrill <span dir="ltr"><<a href="mailto:joel.sherrill@oarcorp.com" target="_blank">joel.sherrill@oarcorp.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
On November 19, 2014 8:31:46 PM CST, Gedare Bloom <<a href="mailto:gedare@rtems.org">gedare@rtems.org</a>> wrote:<br>
>OK great<br>
<br>
I have an updated version of the patch. Something wasn't right with the mskefile that showed up later. Not sure how it built before. :(<br>
<br>
<br>
>On Wed, Nov 19, 2014 at 5:04 PM, Joel Sherrill<br>
><<a href="mailto:joel.sherrill@oarcorp.com">joel.sherrill@oarcorp.com</a>> wrote:<br>
>><br>
>> On 11/19/2014 2:55 PM, Gedare Bloom wrote:<br>
>>> Is this the same one that Chris has had in use before? (I think that<br>
>>> is who had one in use..)<br>
>> Yes. You wanted it in rtems to avoid me having to add a prototype to<br>
>a file<br>
>> to avoid a warning.<br>
>><br>
>> I didn't integrate his implementation but only his .h file and stubs.<br>
>His<br>
>> implementation will need the addition of tests and code in<br>
>confdefs.h.<br>
>><br>
>> --joel<br>
>><br>
>>> -Gedare<br>
>>><br>
>>> On Wed, Nov 19, 2014 at 2:59 PM, Joel Sherrill<br>
>>> <<a href="mailto:joel.sherrill@oarcorp.com">joel.sherrill@oarcorp.com</a>> wrote:<br>
>>>> * Makefile.am updated and <a href="http://preinstall.am" target="_blank">preinstall.am</a> regenerated.<br>
>>>> * mprotect.c had a prototype removed now that we have<br>
>mman.h<br>
>>>> * mmap.c, munmap.c: New stub files.<br>
>>>> ---<br>
>>>> cpukit/posix/Makefile.am | 5 ++<br>
>>>> cpukit/posix/include/sys/mman.h | 189<br>
>++++++++++++++++++++++++++++++++++++++++<br>
>>>> cpukit/posix/<a href="http://preinstall.am" target="_blank">preinstall.am</a> | 9 ++<br>
>>>> cpukit/posix/src/mmap.c | 26 ++++++<br>
>>>> cpukit/posix/src/mprotect.c | 10 +--<br>
>>>> cpukit/posix/src/munmap.c | 30 +++++++<br>
>>>> 6 files changed, 261 insertions(+), 8 deletions(-)<br>
>>>> create mode 100644 cpukit/posix/include/sys/mman.h<br>
>>>> create mode 100644 cpukit/posix/src/mmap.c<br>
>>>> create mode 100644 cpukit/posix/src/munmap.c<br>
>>>><br>
>>>> diff --git a/cpukit/posix/Makefile.am b/cpukit/posix/Makefile.am<br>
>>>> index 346b65a..b3be07c 100644<br>
>>>> --- a/cpukit/posix/Makefile.am<br>
>>>> +++ b/cpukit/posix/Makefile.am<br>
>>>> @@ -21,6 +21,9 @@ include_rtems_posix_HEADERS +=<br>
>include/rtems/posix/keyimpl.h<br>
>>>> include_rtems_posix_HEADERS += include/rtems/posix/config.h<br>
>>>> include_rtems_posix_HEADERS += include/rtems/posix/posixapi.h<br>
>>>><br>
>>>> +include_sysdir = $(includedir)/sys<br>
>>>> +include_sys_HEADERS = include/sys/mman.h<br>
>>>> +<br>
>>>> if HAS_PTHREADS<br>
>>>> # include<br>
>>>> include_HEADERS = include/aio.h<br>
>>>> @@ -91,7 +94,9 @@ libposix_a_SOURCES += src/cond.c<br>
>src/condattrdestroy.c \<br>
>>>> src/condtimedwait.c src/condwait.c src/condwaitsupp.c<br>
>src/condget.c<br>
>>>><br>
>>>> ## MEMORY_C_FILES<br>
>>>> +libposix_a_SOURCES += src/mmap.c<br>
>>>> libposix_a_SOURCES += src/mprotect.c<br>
>>>> +libposix_a_SOURCES += src/munmap.c<br>
>>>><br>
>>>> ## MESSAGE_QUEUE_C_FILES<br>
>>>> libposix_a_SOURCES += src/mqueue.c src/mqueueclose.c \<br>
>>>> diff --git a/cpukit/posix/include/sys/mman.h<br>
>b/cpukit/posix/include/sys/mman.h<br>
>>>> new file mode 100644<br>
>>>> index 0000000..ddf34cc<br>
>>>> --- /dev/null<br>
>>>> +++ b/cpukit/posix/include/sys/mman.h<br>
>>>> @@ -0,0 +1,189 @@<br>
>>>> +/* $NetBSD: mman.h,v 1.36 2005/09/13 01:42:51 christos Exp $<br>
> */<br>
>>>> +<br>
>>>> +/*-<br>
>>>> + * Copyright (c) 1982, 1986, 1993<br>
>>>> + * The Regents of the University of California. All rights<br>
>reserved.<br>
>>>> + *<br>
>>>> + * Redistribution and use in source and binary forms, with or<br>
>without<br>
>>>> + * modification, are permitted provided that the following<br>
>conditions<br>
>>>> + * are met:<br>
>>>> + * 1. Redistributions of source code must retain the above<br>
>copyright<br>
>>>> + * notice, this list of conditions and the following<br>
>disclaimer.<br>
>>>> + * 2. Redistributions in binary form must reproduce the above<br>
>copyright<br>
>>>> + * notice, this list of conditions and the following disclaimer<br>
>in the<br>
>>>> + * documentation and/or other materials provided with the<br>
>distribution.<br>
>>>> + * 3. Neither the name of the University nor the names of its<br>
>contributors<br>
>>>> + * may be used to endorse or promote products derived from this<br>
>software<br>
>>>> + * without specific prior written permission.<br>
>>>> + *<br>
>>>> + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS<br>
>IS'' AND<br>
>>>> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED<br>
>TO, THE<br>
>>>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A<br>
>PARTICULAR PURPOSE<br>
>>>> + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS<br>
>BE LIABLE<br>
>>>> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR<br>
>CONSEQUENTIAL<br>
>>>> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF<br>
>SUBSTITUTE GOODS<br>
>>>> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS<br>
>INTERRUPTION)<br>
>>>> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN<br>
>CONTRACT, STRICT<br>
>>>> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING<br>
>IN ANY WAY<br>
>>>> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE<br>
>POSSIBILITY OF<br>
>>>> + * SUCH DAMAGE.<br>
>>>> + *<br>
>>>> + * @(#)mman.h 8.2 (Berkeley) 1/9/95<br>
>>>> + */<br>
>>>> +<br>
>>>> +#ifndef _SYS_MMAN_H_<br>
>>>> +#define _SYS_MMAN_H_<br>
>>>> +<br>
>>>> +#ifdef __rtems__<br>
>>>> +<br>
>>>> +#include <inttypes.h><br>
>>>> +#include <stddef.h><br>
>>>> +#include <sys/types.h><br>
>>>> +<br>
>>>> +#else /* __rtems__ */<br>
>>>> +#include <sys/featuretest.h><br>
>>>> +<br>
>>>> +#include <machine/ansi.h><br>
>>>> +<br>
>>>> +#ifdef _BSD_SIZE_T_<br>
>>>> +typedef _BSD_SIZE_T_ size_t;<br>
>>>> +#undef _BSD_SIZE_T_<br>
>>>> +#endif<br>
>>>> +<br>
>>>> +#include <sys/ansi.h><br>
>>>> +<br>
>>>> +#ifndef mode_t<br>
>>>> +typedef __mode_t mode_t;<br>
>>>> +#define mode_t __mode_t<br>
>>>> +#endif<br>
>>>> +<br>
>>>> +#ifndef off_t<br>
>>>> +typedef __off_t off_t; /* file offset */<br>
>>>> +#define off_t __off_t<br>
>>>> +#endif<br>
>>>> +#endif /* __rtems__ */<br>
>>>> +<br>
>>>> +<br>
>>>> +/*<br>
>>>> + * Protections are chosen from these bits, or-ed together<br>
>>>> + */<br>
>>>> +#define PROT_NONE 0x00 /* no permissions */<br>
>>>> +#define PROT_READ 0x01 /* pages can be read */<br>
>>>> +#define PROT_WRITE 0x02 /* pages can be written */<br>
>>>> +#define PROT_EXEC 0x04 /* pages can be executed */<br>
>>>> +<br>
>>>> +/*<br>
>>>> + * Flags contain sharing type and options.<br>
>>>> + * Sharing types; choose one.<br>
>>>> + */<br>
>>>> +#define MAP_SHARED 0x0001 /* share changes */<br>
>>>> +#define MAP_PRIVATE 0x0002 /* changes are private */<br>
>>>> +<br>
>>>> +#ifdef _KERNEL<br>
>>>> +/*<br>
>>>> + * Deprecated flag; these are treated as MAP_PRIVATE internally by<br>
>>>> + * the kernel.<br>
>>>> + */<br>
>>>> +#define MAP_COPY 0x0004 /* "copy" region at mmap<br>
>time */<br>
>>>> +#endif<br>
>>>> +<br>
>>>> +/*<br>
>>>> + * Other flags<br>
>>>> + */<br>
>>>> +#define MAP_FIXED 0x0010 /* map addr must be exactly<br>
>as requested */<br>
>>>> +#define MAP_RENAME 0x0020 /* Sun: rename private<br>
>pages to file */<br>
>>>> +#define MAP_NORESERVE 0x0040 /* Sun: don't reserve<br>
>needed swap area */<br>
>>>> +#define MAP_INHERIT 0x0080 /* region is retained after<br>
>exec */<br>
>>>> +#define MAP_HASSEMAPHORE 0x0200 /* region may contain<br>
>semaphores */<br>
>>>> +#define MAP_TRYFIXED 0x0400 /* attempt hint address,<br>
>even within break */<br>
>>>> +#define MAP_WIRED 0x0800 /* mlock() mapping when it<br>
>is established */<br>
>>>> +<br>
>>>> +/*<br>
>>>> + * Mapping type<br>
>>>> + */<br>
>>>> +#define MAP_FILE 0x0000 /* map from file (default)<br>
>*/<br>
>>>> +#define MAP_ANON 0x1000 /* allocated from memory,<br>
>swap space */<br>
>>>> +<br>
>>>> +/*<br>
>>>> + * Alignment (expressed in log2). Must be >= log2(PAGE_SIZE) and<br>
>>>> + * < # bits in a pointer (26 (acorn26), 32 or 64).<br>
>>>> + */<br>
>>>> +#define MAP_ALIGNED(n) ((n) <<<br>
>MAP_ALIGNMENT_SHIFT)<br>
>>>> +#define MAP_ALIGNMENT_SHIFT 24<br>
>>>> +#define MAP_ALIGNMENT_MASK MAP_ALIGNED(0xff)<br>
>>>> +#define MAP_ALIGNMENT_64KB MAP_ALIGNED(16) /* 2^16 */<br>
>>>> +#define MAP_ALIGNMENT_16MB MAP_ALIGNED(24) /* 2^24 */<br>
>>>> +#define MAP_ALIGNMENT_4GB MAP_ALIGNED(32) /* 2^32 */<br>
>>>> +#define MAP_ALIGNMENT_1TB MAP_ALIGNED(40) /* 2^40 */<br>
>>>> +#define MAP_ALIGNMENT_256TB MAP_ALIGNED(48) /* 2^48 */<br>
>>>> +#define MAP_ALIGNMENT_64PB MAP_ALIGNED(56) /* 2^56 */<br>
>>>> +<br>
>>>> +/*<br>
>>>> + * Error indicator returned by mmap(2)<br>
>>>> + */<br>
>>>> +#define MAP_FAILED ((void *) -1) /* mmap() failed */<br>
>>>> +<br>
>>>> +/*<br>
>>>> + * Flags to msync<br>
>>>> + */<br>
>>>> +#define MS_ASYNC 0x01 /* perform asynchronous<br>
>writes */<br>
>>>> +#define MS_INVALIDATE 0x02 /* invalidate cached data<br>
>*/<br>
>>>> +#define MS_SYNC 0x04 /* perform synchronous<br>
>writes */<br>
>>>> +<br>
>>>> +/*<br>
>>>> + * Flags to mlockall<br>
>>>> + */<br>
>>>> +#define MCL_CURRENT 0x01 /* lock all pages currently<br>
>mapped */<br>
>>>> +#define MCL_FUTURE 0x02 /* lock all pages mapped in<br>
>the future */<br>
>>>> +<br>
>>>> +#if defined(_NETBSD_SOURCE)<br>
>>>> +/*<br>
>>>> + * Advice to madvise<br>
>>>> + */<br>
>>>> +#define MADV_NORMAL 0 /* no further special<br>
>treatment */<br>
>>>> +#define MADV_RANDOM 1 /* expect random page<br>
>references */<br>
>>>> +#define MADV_SEQUENTIAL 2 /* expect sequential page<br>
>references */<br>
>>>> +#define MADV_WILLNEED 3 /* will need these pages */<br>
>>>> +#define MADV_DONTNEED 4 /* dont need these pages */<br>
>>>> +#define MADV_SPACEAVAIL 5 /* insure that resources<br>
>are reserved */<br>
>>>> +#define MADV_FREE 6 /* pages are empty, free<br>
>them */<br>
>>>> +/*<br>
>>>> + * Flags to minherit<br>
>>>> + */<br>
>>>> +#define MAP_INHERIT_SHARE 0 /* share with child<br>
>*/<br>
>>>> +#define MAP_INHERIT_COPY 1 /* copy into child<br>
>*/<br>
>>>> +#define MAP_INHERIT_NONE 2 /* absent from<br>
>child */<br>
>>>> +#define MAP_INHERIT_DONATE_COPY 3 /* copy and delete<br>
>-- not<br>
>>>> + implemented in UVM */<br>
>>>> +#define MAP_INHERIT_DEFAULT MAP_INHERIT_COPY<br>
>>>> +#endif<br>
>>>> +<br>
>>>> +#ifndef _KERNEL<br>
>>>> +<br>
>>>> +#include <sys/cdefs.h><br>
>>>> +<br>
>>>> +__BEGIN_DECLS<br>
>>>> +void *mmap(void *, size_t, int, int, int, off_t);<br>
>>>> +int munmap(void *, size_t);<br>
>>>> +int mprotect(void *, size_t, int);<br>
>>>> +#ifndef __LIBC12_SOURCE__<br>
>>>> +#if defined(__rtems__)<br>
>>>> +int msync(void *, size_t, int);<br>
>>>> +#else<br>
>>>> +int msync(void *, size_t, int) __RENAME(__msync13);<br>
>>>> +#endif<br>
>>>> +#endif<br>
>>>> +int mlock(const void *, size_t);<br>
>>>> +int munlock(const void *, size_t);<br>
>>>> +int mlockall(int);<br>
>>>> +int munlockall(void);<br>
>>>> +#if defined(_NETBSD_SOURCE)<br>
>>>> +int madvise(void *, size_t, int);<br>
>>>> +int mincore(void *, size_t, char *);<br>
>>>> +int minherit(void *, size_t, int);<br>
>>>> +#endif<br>
>>>> +__END_DECLS<br>
>>>> +<br>
>>>> +#endif /* !_KERNEL */<br>
>>>> +<br>
>>>> +#endif /* !_SYS_MMAN_H_ */<br>
>>>> diff --git a/cpukit/posix/<a href="http://preinstall.am" target="_blank">preinstall.am</a><br>
>b/cpukit/posix/<a href="http://preinstall.am" target="_blank">preinstall.am</a><br>
>>>> index 6e3f2a2..1b65213 100644<br>
>>>> --- a/cpukit/posix/<a href="http://preinstall.am" target="_blank">preinstall.am</a><br>
>>>> +++ b/cpukit/posix/<a href="http://preinstall.am" target="_blank">preinstall.am</a><br>
>>>> @@ -43,6 +43,15 @@ $(PROJECT_INCLUDE)/rtems/posix/posixapi.h:<br>
>include/rtems/posix/posixapi.h $(PROJ<br>
>>>> $(INSTALL_DATA) $<<br>
>$(PROJECT_INCLUDE)/rtems/posix/posixapi.h<br>
>>>> PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/posixapi.h<br>
>>>><br>
>>>> +$(PROJECT_INCLUDE)/sys/$(dirstamp):<br>
>>>> + @$(MKDIR_P) $(PROJECT_INCLUDE)/sys<br>
>>>> + @: > $(PROJECT_INCLUDE)/sys/$(dirstamp)<br>
>>>> +PREINSTALL_DIRS += $(PROJECT_INCLUDE)/sys/$(dirstamp)<br>
>>>> +<br>
>>>> +$(PROJECT_INCLUDE)/sys/mman.h: include/sys/mman.h<br>
>$(PROJECT_INCLUDE)/sys/$(dirstamp)<br>
>>>> + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/mman.h<br>
>>>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/mman.h<br>
>>>> +<br>
>>>> if HAS_PTHREADS<br>
>>>> $(PROJECT_INCLUDE)/aio.h: include/aio.h<br>
>$(PROJECT_INCLUDE)/$(dirstamp)<br>
>>>> $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/aio.h<br>
>>>> diff --git a/cpukit/posix/src/mmap.c b/cpukit/posix/src/mmap.c<br>
>>>> new file mode 100644<br>
>>>> index 0000000..2798326<br>
>>>> --- /dev/null<br>
>>>> +++ b/cpukit/posix/src/mmap.c<br>
>>>> @@ -0,0 +1,26 @@<br>
>>>> +/**<br>
>>>> + * @file<br>
>>>> + */<br>
>>>> +<br>
>>>> +/*<br>
>>>> + * COPYRIGHT (c) 2014.<br>
>>>> + * On-Line Applications Research Corporation (OAR).<br>
>>>> + *<br>
>>>> + * The license and distribution terms for this file may be<br>
>>>> + * found in the file LICENSE in this distribution or at<br>
>>>> + * <a href="http://www.rtems.org/license/LICENSE" target="_blank">http://www.rtems.org/license/LICENSE</a>.<br>
>>>> + */<br>
>>>> +<br>
>>>> +#if HAVE_CONFIG_H<br>
>>>> +#include "config.h"<br>
>>>> +#endif<br>
>>>> +<br>
>>>> +#include <sys/mman.h><br>
>>>> +<br>
>>>> +int munmap(<br>
>>>> + void *addr __attribute__((unused)),<br>
>>>> + size_t length __attribute__((unused))<br>
>>>> +)<br>
>>>> +{<br>
>>>> + return -1;<br>
>>>> +}<br>
>>>> diff --git a/cpukit/posix/src/mprotect.c<br>
>b/cpukit/posix/src/mprotect.c<br>
>>>> index 51b565e..94bd316 100644<br>
>>>> --- a/cpukit/posix/src/mprotect.c<br>
>>>> +++ b/cpukit/posix/src/mprotect.c<br>
>>>> @@ -28,16 +28,10 @@<br>
>>>> #endif<br>
>>>><br>
>>>> #include <unistd.h><br>
>>>> -<br>
>>>> -/*<br>
>>>> - * RTEMS does not have <sys/mman.h> so we need a prototype here to<br>
>>>> - * avoid warnings.<br>
>>>> - */<br>
>>>> -<br>
>>>> -int mprotect( const void *, size_t, int );<br>
>>>> +#include <sys/mman.h><br>
>>>><br>
>>>> int mprotect(<br>
>>>> - const void *addr __attribute__((unused)),<br>
>>>> + void *addr __attribute__((unused)),<br>
>>>> size_t len __attribute__((unused)),<br>
>>>> int prot __attribute__((unused)) )<br>
>>>> {<br>
>>>> diff --git a/cpukit/posix/src/munmap.c b/cpukit/posix/src/munmap.c<br>
>>>> new file mode 100644<br>
>>>> index 0000000..3ebb2f4<br>
>>>> --- /dev/null<br>
>>>> +++ b/cpukit/posix/src/munmap.c<br>
>>>> @@ -0,0 +1,30 @@<br>
>>>> +/**<br>
>>>> + * @file<br>
>>>> + */<br>
>>>> +<br>
>>>> +/*<br>
>>>> + * COPYRIGHT (c) 2014.<br>
>>>> + * On-Line Applications Research Corporation (OAR).<br>
>>>> + *<br>
>>>> + * The license and distribution terms for this file may be<br>
>>>> + * found in the file LICENSE in this distribution or at<br>
>>>> + * <a href="http://www.rtems.org/license/LICENSE" target="_blank">http://www.rtems.org/license/LICENSE</a>.<br>
>>>> + */<br>
>>>> +<br>
>>>> +#if HAVE_CONFIG_H<br>
>>>> +#include "config.h"<br>
>>>> +#endif<br>
>>>> +<br>
>>>> +#include <sys/mman.h><br>
>>>> +<br>
>>>> +void *mmap(<br>
>>>> + void *addr __attribute__((unused)),<br>
>>>> + size_t lenhth __attribute__((unused)),<br>
>>>> + int prot __attribute__((unused)),<br>
>>>> + int flags __attribute__((unused)),<br>
>>>> + int fildes __attribute__((unused)),<br>
>>>> + off_t off<br>
>>>> +)<br>
>>>> +{<br>
>>>> + return NULL;<br>
>>>> +}<br>
>>>> --<br>
>>>> 1.9.3<br>
>>>><br>
>>>> _______________________________________________<br>
>>>> devel mailing list<br>
>>>> <a href="mailto:devel@rtems.org">devel@rtems.org</a><br>
>>>> <a href="http://lists.rtems.org/mailman/listinfo/devel" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
>><br>
>> --<br>
>> Joel Sherrill, Ph.D. Director of Research & Development<br>
>> joel.sherrill@OARcorp.com On-Line Applications Research<br>
>> Ask me about RTEMS: a free RTOS Huntsville AL 35805<br>
>> Support Available (256) 722-9985<br>
>><br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div><br></div>