Module: xenomai-forge
Branch: master
Commit: 6cde7fd192ebfde43da3563eab0780743182ab63
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=6cde7fd192ebfde43da3563eab0780743182ab63

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sun Jan 29 12:33:04 2012 +0100

cobalt, copperplate, testsuite: cleanup SHM wrapping leftovers

---

 configure                              |    2 +-
 configure.in                           |    2 +-
 include/cobalt/posix.h                 |    1 -
 include/cobalt/sys/Makefile.am         |    1 -
 include/cobalt/sys/Makefile.in         |    1 -
 include/cobalt/sys/mman.h              |   88 --------------------------------
 include/cobalt/unistd.h                |   28 ----------
 kernel/cobalt/internal.h               |    1 -
 lib/cobalt/wrappers.c                  |   60 ----------------------
 lib/copperplate/heapobj-pshared.c      |   12 ++--
 lib/include/xeno_config.h.in           |   12 ----
 testsuite/regression/posix/Makefile.am |    2 +-
 testsuite/regression/posix/Makefile.in |   14 +----
 testsuite/regression/posix/leaks.c     |   13 -----
 testsuite/regression/posix/shm.c       |   72 --------------------------
 15 files changed, 12 insertions(+), 297 deletions(-)

diff --git a/configure b/configure
index 9e849e7..d620643 100755
--- a/configure
+++ b/configure
@@ -13332,7 +13332,7 @@ done
 
 save_LIBS="$LIBS"
 LIBS="$LIBS -lrt -lpthread"
-for ac_func in shm_open shm_unlink mmap64 ftruncate64 
pthread_mutexattr_setprotocol pthread_condattr_setclock pthread_spin_lock fork
+for ac_func in pthread_mutexattr_setprotocol pthread_condattr_setclock 
pthread_spin_lock fork
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/configure.in b/configure.in
index 21d6b9e..c0a7d17 100644
--- a/configure.in
+++ b/configure.in
@@ -396,7 +396,7 @@ AC_CHECK_HEADERS(mqueue.h)
 dnl Check for presence of some routines we need
 save_LIBS="$LIBS"
 LIBS="$LIBS -lrt -lpthread"
-AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64 
pthread_mutexattr_setprotocol pthread_condattr_setclock pthread_spin_lock fork])
+AC_CHECK_FUNCS([pthread_mutexattr_setprotocol pthread_condattr_setclock 
pthread_spin_lock fork])
 LIBS="$save_LIBS"
 
 dnl
diff --git a/include/cobalt/posix.h b/include/cobalt/posix.h
index 269fa2d..ad9b41e 100644
--- a/include/cobalt/posix.h
+++ b/include/cobalt/posix.h
@@ -30,7 +30,6 @@
 #include <time.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <sys/mman.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 
diff --git a/include/cobalt/sys/Makefile.am b/include/cobalt/sys/Makefile.am
index ad1f03b..64d72bc 100644
--- a/include/cobalt/sys/Makefile.am
+++ b/include/cobalt/sys/Makefile.am
@@ -2,7 +2,6 @@ includesubdir = $(includedir)/cobalt/sys
 
 includesub_HEADERS = \
        ioctl.h \
-       mman.h \
        select.h \
        socket.h \
        time.h
diff --git a/include/cobalt/sys/Makefile.in b/include/cobalt/sys/Makefile.in
index 44fc518..ee2d0d1 100644
--- a/include/cobalt/sys/Makefile.in
+++ b/include/cobalt/sys/Makefile.in
@@ -243,7 +243,6 @@ top_srcdir = @top_srcdir@
 includesubdir = $(includedir)/cobalt/sys
 includesub_HEADERS = \
        ioctl.h \
-       mman.h \
        select.h \
        socket.h \
        time.h
diff --git a/include/cobalt/sys/mman.h b/include/cobalt/sys/mman.h
deleted file mode 100644
index 0e77075..0000000
--- a/include/cobalt/sys/mman.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2006 Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef _XENO_POSIX_SYS_MMAN_H
-#define _XENO_POSIX_SYS_MMAN_H
-
-#ifdef __KERNEL__
-
-#include <asm/mman.h>
-
-#define MAP_FAILED ((void *) -1)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int shm_open(const char *name, int oflag, mode_t mode);
-
-int shm_unlink(const char *name);
-
-void *mmap(void *addr, size_t len, int prot, int flags,
-          int fildes, off_t off);
-
-int munmap(void *addr, size_t len);
-
-#ifdef __cplusplus
-}
-#endif
-
-#else /* !__KERNEL__ */
-
-#include_next <sys/mman.h>
-#include <cobalt/wrappers.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-COBALT_DECL(int, shm_open(const char *name, int oflag, mode_t mode));
-
-COBALT_DECL(int, shm_unlink(const char *name));
-
-COBALT_DECL(void *, mmap(void *addr,
-                        size_t len,
-                        int prot,
-                        int flags,
-                        int fildes,
-                        long off));
-#if __WORDSIZE == 32
-#if defined(_LARGEFILE64_SOURCE) \
-       || defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
-COBALT_DECL(void *, mmap64(void *addr,
-                          size_t len,
-                          int prot,
-                          int flags,
-                          int fildes,
-                          long long off));
-#endif
-
-#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
-#define __real_mmap __real_mmap64
-#endif
-#endif
-
-COBALT_DECL(int, munmap(void *addr, size_t len));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !__KERNEL__ */
-
-#endif /* _XENO_POSIX_SYS_MMAN_H */
diff --git a/include/cobalt/unistd.h b/include/cobalt/unistd.h
index 7965813..7e1be94 100644
--- a/include/cobalt/unistd.h
+++ b/include/cobalt/unistd.h
@@ -23,21 +23,6 @@
 
 #include <linux/types.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#undef close
-#define close cobalt_shm_close
-
-int cobalt_shm_close(int fildes);
-
-int ftruncate(int fildes, off_t length);
-
-#ifdef __cplusplus
-}
-#endif
-
 #else /* !__KERNEL__ */
 
 #include_next <unistd.h>
@@ -47,19 +32,6 @@ int ftruncate(int fildes, off_t length);
 extern "C" {
 #endif
 
-COBALT_DECL(int, ftruncate(int fildes, long length));
-
-#if __WORDSIZE == 32
-#if defined(_LARGEFILE64_SOURCE) \
-       || defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
-COBALT_DECL(int, ftruncate64(int fildes, long long length));
-#endif
-
-#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
-#define __real_ftruncate __real_ftruncate64
-#endif
-#endif
-
 COBALT_DECL(ssize_t, read(int fd, void *buf, size_t nbyte));
 
 COBALT_DECL(ssize_t, write(int fd, const void *buf, size_t nbyte));
diff --git a/kernel/cobalt/internal.h b/kernel/cobalt/internal.h
index 65d54d7..27da84c 100644
--- a/kernel/cobalt/internal.h
+++ b/kernel/cobalt/internal.h
@@ -45,7 +45,6 @@
 #define COBALT_MQD_MAGIC         COBALT_MAGIC(0B)
 #define COBALT_INTR_MAGIC        COBALT_MAGIC(0C)
 #define COBALT_TIMER_MAGIC       COBALT_MAGIC(0E)
-#define COBALT_SHM_MAGIC         COBALT_MAGIC(0F)
 
 #define COBALT_MIN_PRIORITY      XNSCHED_LOW_PRIO
 #define COBALT_MAX_PRIORITY      XNSCHED_HIGH_PRIO
diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c
index cfd3341..272cfb4 100644
--- a/lib/cobalt/wrappers.c
+++ b/lib/cobalt/wrappers.c
@@ -25,7 +25,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
-#include <sys/mman.h>
 #include <sys/select.h>
 #include <sys/socket.h>
 #include <sys/time.h>
@@ -40,9 +39,6 @@
 #include <unistd.h>
 #include <malloc.h>
 
-#undef __real_ftruncate
-#undef __real_mmap
-
 /* sched */
 __attribute__ ((weak))
 int __real_pthread_setschedparam(pthread_t thread,
@@ -263,62 +259,6 @@ int __real_shutdown(int fd, int how)
        return shutdown(fd, how);
 }
 
-/* shm */
-#ifdef HAVE_SHM_OPEN
-__attribute__ ((weak))
-int __real_shm_open(const char *name, int oflag, mode_t mode)
-{
-       return shm_open(name, oflag, mode);
-}
-#endif
-
-#ifdef HAVE_SHM_UNLINK
-__attribute__ ((weak))
-int __real_shm_unlink(const char *name)
-{
-       return shm_unlink(name);
-}
-#endif
-
-__attribute__ ((weak))
-int __real_ftruncate(int fildes, long length)
-{
-       return ftruncate(fildes, length);
-}
-
-__attribute__ ((weak))
-void *__real_mmap(void *addr,
-                 size_t len, int prot, int flags, int fd, long off)
-{
-       return mmap(addr, len, prot, flags, fd, off);
-}
-
-/* 32 bits platform */
-#if __WORDSIZE == 32
-#ifdef HAVE_FTRUNCATE64
-__attribute__ ((weak))
-int __real_ftruncate64(int fildes, long long length)
-{
-       return ftruncate64(fildes, length);
-}
-#endif /* HAVE_FTRUNCATE64 */
-
-#ifdef HAVE_MMAP64
-__attribute__ ((weak))
-void *__real_mmap64(void *addr,
-                   size_t len, int prot, int flags, int fd, long long off)
-{
-       return mmap64(addr, len, prot, flags, fd, off);
-}
-#endif /* HAVE_MMAP64 */
-#endif /* 32 bits */
-
-__attribute__ ((weak))
-int __real_munmap(void *addr, size_t len)
-{
-       return munmap(addr, len);
-}
-
 __attribute__ ((weak))
 int __real_select (int __nfds, fd_set *__restrict __readfds,
                   fd_set *__restrict __writefds,
diff --git a/lib/copperplate/heapobj-pshared.c 
b/lib/copperplate/heapobj-pshared.c
index 3f47c26..5f04bfa 100644
--- a/lib/copperplate/heapobj-pshared.c
+++ b/lib/copperplate/heapobj-pshared.c
@@ -613,7 +613,7 @@ static int create_heap(struct heapobj *hobj, const char 
*session,
                goto errno_fail;
 
        if (sbuf.st_size > 0) {
-               heap = __STD(mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, 
fd, 0));
+               heap = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
                if (heap == MAP_FAILED)
                        goto errno_fail;
                if (heap->cpid && kill(heap->cpid, 0) == 0) {
@@ -622,14 +622,14 @@ static int create_heap(struct heapobj *hobj, const char 
*session,
                        __STD(close(fd));
                        return __bt(-EEXIST);
                }
-               __STD(munmap(heap, len));
+               munmap(heap, len);
        }
 
-       ret = __STD(ftruncate(fd, len));
+       ret = ftruncate(fd, len);
        if (ret)
                goto unlink_fail;
 
-       heap = __STD(mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0));
+       heap = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
        if (heap == MAP_FAILED)
                goto unlink_fail;
 
@@ -707,7 +707,7 @@ void heapobj_destroy(struct heapobj *hobj)
        }
 
        cpid = heap->cpid;
-       __STD(munmap(heap, hobj->size + sizeof(*heap)));
+       munmap(heap, hobj->size + sizeof(*heap));
        __STD(close(hobj->fd));
 
        if (cpid == copperplate_get_tid() || (cpid && kill(cpid, 0)))
@@ -730,7 +730,7 @@ int heapobj_extend(struct heapobj *hobj, size_t size, void 
*mem)
 
        write_lock_safe(&heap->lock, state);
        newsize = size + hobj->size + sizeof(*heap) + sizeof(*extent);
-       ret = __STD(ftruncate(hobj->fd, newsize));
+       ret = ftruncate(hobj->fd, newsize);
        if (ret) {
                ret = __bt(-errno);
                goto out;
diff --git a/lib/include/xeno_config.h.in b/lib/include/xeno_config.h.in
index bfcb306..3611c7c 100644
--- a/lib/include/xeno_config.h.in
+++ b/lib/include/xeno_config.h.in
@@ -71,9 +71,6 @@
 /* Define to 1 if you have the `fork' function. */
 #undef HAVE_FORK
 
-/* Define to 1 if you have the `ftruncate64' function. */
-#undef HAVE_FTRUNCATE64
-
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
@@ -83,9 +80,6 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
-/* Define to 1 if you have the `mmap64' function. */
-#undef HAVE_MMAP64
-
 /* Define to 1 if you have the <mqueue.h> header file. */
 #undef HAVE_MQUEUE_H
 
@@ -104,12 +98,6 @@
 /* config */
 #undef HAVE_RECENT_SETAFFINITY
 
-/* Define to 1 if you have the `shm_open' function. */
-#undef HAVE_SHM_OPEN
-
-/* Define to 1 if you have the `shm_unlink' function. */
-#undef HAVE_SHM_UNLINK
-
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
diff --git a/testsuite/regression/posix/Makefile.am 
b/testsuite/regression/posix/Makefile.am
index 12f9c75..fc88e1b 100644
--- a/testsuite/regression/posix/Makefile.am
+++ b/testsuite/regression/posix/Makefile.am
@@ -4,7 +4,7 @@ CCLD = $(top_srcdir)/scripts/wrap-link.sh $(CC)
 
 noinst_HEADERS = check.h
 
-test_PROGRAMS = leaks shm
+test_PROGRAMS = leaks
 
 CPPFLAGS = $(XENO_USER_CFLAGS) \
        -I$(top_srcdir)/include
diff --git a/testsuite/regression/posix/Makefile.in 
b/testsuite/regression/posix/Makefile.in
index dbd60c8..f8db59b 100644
--- a/testsuite/regression/posix/Makefile.in
+++ b/testsuite/regression/posix/Makefile.in
@@ -36,7 +36,7 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-test_PROGRAMS = leaks$(EXEEXT) shm$(EXEEXT)
+test_PROGRAMS = leaks$(EXEEXT)
 subdir = testsuite/regression/posix
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
        $(srcdir)/Makefile.in
@@ -61,10 +61,6 @@ leaks_SOURCES = leaks.c
 leaks_OBJECTS = leaks.$(OBJEXT)
 leaks_LDADD = $(LDADD)
 leaks_DEPENDENCIES = ../../../lib/cobalt/libcobalt.la
-shm_SOURCES = shm.c
-shm_OBJECTS = shm.$(OBJEXT)
-shm_LDADD = $(LDADD)
-shm_DEPENDENCIES = ../../../lib/cobalt/libcobalt.la
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/lib/include
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
@@ -77,8 +73,8 @@ LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) 
$(LIBTOOLFLAGS) \
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
        --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
        $(LDFLAGS) -o $@
-SOURCES = leaks.c shm.c
-DIST_SOURCES = leaks.c shm.c
+SOURCES = leaks.c
+DIST_SOURCES = leaks.c
 HEADERS = $(noinst_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -331,9 +327,6 @@ clean-testPROGRAMS:
 leaks$(EXEEXT): $(leaks_OBJECTS) $(leaks_DEPENDENCIES) 
        @rm -f leaks$(EXEEXT)
        $(LINK) $(leaks_OBJECTS) $(leaks_LDADD) $(LIBS)
-shm$(EXEEXT): $(shm_OBJECTS) $(shm_DEPENDENCIES) 
-       @rm -f shm$(EXEEXT)
-       $(LINK) $(shm_OBJECTS) $(shm_LDADD) $(LIBS)
 
 mostlyclean-compile:
        -rm -f *.$(OBJEXT)
@@ -342,7 +335,6 @@ distclean-compile:
        -rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/leaks.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shm.Po@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ 
$<
diff --git a/testsuite/regression/posix/leaks.c 
b/testsuite/regression/posix/leaks.c
index b741c98..7822fb1 100644
--- a/testsuite/regression/posix/leaks.c
+++ b/testsuite/regression/posix/leaks.c
@@ -15,8 +15,6 @@
 #include "check.h"
 
 #define SEM_NAME "/sem"
-#define SHM_NAME "/shm"
-#define SHM_SZ 16384
 #define MQ_NAME "/mq"
 
 #define check_used(object, before, failed)                             \
@@ -62,7 +60,6 @@ int main(void)
        pthread_t thread;
        sem_t sem, *psem;
        timer_t tm;
-       void *shm;
 
        mlockall(MCL_CURRENT|MCL_FUTURE);
 
@@ -103,16 +100,6 @@ int main(void)
        check_used("timer", before, failed);
 
        before = get_used();
-       check_unix(fd = shm_open(SHM_NAME, O_CREAT | O_RDWR, 0644));
-       check_unix(ftruncate(fd, SHM_SZ));
-       shm = mmap(NULL, SHM_SZ, PROT_READ, MAP_SHARED, fd, 0);
-       check_unix(shm == MAP_FAILED ? -1 : 0);
-       check_unix(munmap(shm, SHM_SZ));
-       check_unix(close(fd));
-       check_unix(shm_unlink(SHM_NAME));
-       check_used("shm", before, failed);
-
-       before = get_used();
        check_unix(fd = mq_open(MQ_NAME, O_RDWR | O_CREAT, 0644, NULL));
        check_unix(mq_close(fd));
        check_unix(mq_unlink(MQ_NAME));
diff --git a/testsuite/regression/posix/shm.c b/testsuite/regression/posix/shm.c
deleted file mode 100644
index 260d3c1..0000000
--- a/testsuite/regression/posix/shm.c
+++ /dev/null
@@ -1,72 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-
-#include "check.h"
-
-#define SHM_NAME "/shm"
-#define SHM_SZ 16384
-
-int main(void)
-{
-       unsigned i;
-       void *shm;
-       int fd;
-
-       fprintf(stderr, "Checking posix skin shared memories\n");
-
-       fd = shm_open(SHM_NAME, O_RDWR | O_CREAT | O_EXCL, 0644);
-       if (fd == -1 && errno == EEXIST) {
-               fprintf(stderr, "Removing previous shared memory\n");
-               check_unix(shm_unlink(SHM_NAME));
-               check_unix(fd = shm_open(SHM_NAME,
-                                        O_RDWR | O_CREAT | O_EXCL, 0644));
-       }
-       check_unix(ftruncate(fd, SHM_SZ));
-       shm = mmap(NULL, SHM_SZ, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
-       check_unix(shm == MAP_FAILED ? -1 : 0);
-       for (i = 0; i < SHM_SZ; i++)
-               if (((unsigned char *)shm)[i] != 0) {
-                       fprintf(stderr, "Test 1 failed at byte %u\n", i);
-                       check_unix(shm_unlink(SHM_NAME));
-                       exit(EXIT_FAILURE);
-               }
-
-       /* Fill the shared memory */
-       memset(shm, 0xA5, SHM_SZ);
-       check_unix(munmap(shm, SHM_SZ));
-       check_unix(close(fd));
-
-       check_unix(fd = shm_open(SHM_NAME, O_CREAT | O_RDWR, 0644));
-
-       /* Resize it */
-       check_unix(ftruncate(fd, 2 * SHM_SZ));
-       shm = mmap(NULL, 2 * SHM_SZ, PROT_READ, MAP_SHARED, fd, 0);
-       check_unix(shm == MAP_FAILED ? -1 : 0);
-
-       /* Check contents */
-       for (i = 0; i < SHM_SZ; i++)
-               if (((unsigned char *)shm)[i] != 0xA5) {
-                       fprintf(stderr, "Test 2 failed at byte %u (%x)\n",
-                               i, ((unsigned char *)shm)[i]);
-                       check_unix(shm_unlink(SHM_NAME));
-                       exit(EXIT_FAILURE);
-               }
-       for (i = SHM_SZ; i < 2 * SHM_SZ; i++)
-               if (((unsigned char *)shm)[i] != 0) {
-                       fprintf(stderr, "Test 2 failed at byte %u (%x)\n",
-                               i, ((unsigned char *)shm)[i]);
-                       check_unix(shm_unlink(SHM_NAME));
-                       exit(EXIT_FAILURE);
-               }
-       check_unix(munmap(shm, 2 * SHM_SZ));
-       check_unix(close(fd));
-       check_unix(shm_unlink(SHM_NAME));
-
-       fprintf(stderr, "posix skin shared memories: success\n");
-       return EXIT_SUCCESS;
-}


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to