forked from nuttx/nuttx-update
POSIX message queues: Move mq_setattr() and mq_getattr() from nuttx/libc/mqueue to nuttx/sched/mqueue. Also add sysyscall support for mq_setattr() and mq_getattr(). This is necessary in protected and kernel builds because in those cases the message queue structure is protect and cannot be accessed directly from user mode code. Noted by Jouko Holopainen.
This commit is contained in:
parent
3ee2902c3e
commit
d8db596b3b
11 changed files with 23 additions and 105 deletions
|
@ -379,14 +379,16 @@
|
|||
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
# define SYS_mq_close (__SYS_mqueue+0)
|
||||
# define SYS_mq_notify (__SYS_mqueue+1)
|
||||
# define SYS_mq_open (__SYS_mqueue+2)
|
||||
# define SYS_mq_receive (__SYS_mqueue+3)
|
||||
# define SYS_mq_send (__SYS_mqueue+4)
|
||||
# define SYS_mq_timedreceive (__SYS_mqueue+5)
|
||||
# define SYS_mq_timedsend (__SYS_mqueue+6)
|
||||
# define SYS_mq_unlink (__SYS_mqueue+7)
|
||||
# define __SYS_environ (__SYS_mqueue+8)
|
||||
# define SYS_mq_getattr (__SYS_mqueue+1)
|
||||
# define SYS_mq_notify (__SYS_mqueue+2)
|
||||
# define SYS_mq_open (__SYS_mqueue+3)
|
||||
# define SYS_mq_receive (__SYS_mqueue+4)
|
||||
# define SYS_mq_send (__SYS_mqueue+5)
|
||||
# define SYS_mq_setattr (__SYS_mqueue+6)
|
||||
# define SYS_mq_timedreceive (__SYS_mqueue+7)
|
||||
# define SYS_mq_timedsend (__SYS_mqueue+8)
|
||||
# define SYS_mq_unlink (__SYS_mqueue+9)
|
||||
# define __SYS_environ (__SYS_mqueue+10)
|
||||
#else
|
||||
# define __SYS_environ __SYS_mqueue
|
||||
#endif
|
||||
|
|
|
@ -71,7 +71,6 @@ include aio/Make.defs
|
|||
include pthread/Make.defs
|
||||
include semaphore/Make.defs
|
||||
include signal/Make.defs
|
||||
include mqueue/Make.defs
|
||||
include math/Make.defs
|
||||
include fixedmath/Make.defs
|
||||
include net/Make.defs
|
||||
|
|
|
@ -32,7 +32,6 @@ we have:
|
|||
libgen - libgen.h
|
||||
fixedmath - fixedmath.h
|
||||
math - math.h
|
||||
mqueue - pthread.h
|
||||
net - Various network-related header files: netinet/ether.h, arpa/inet.h
|
||||
pthread - pthread.h
|
||||
queue - queue.h
|
||||
|
|
|
@ -75,8 +75,6 @@
|
|||
"memmove","string.h","","FAR void","FAR void *","FAR const void *","size_t"
|
||||
"memset","string.h","","FAR void","FAR void *","int c","size_t"
|
||||
"mktime","time.h","","time_t","const struct tm *"
|
||||
"mq_getattr","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","struct mq_attr *"
|
||||
"mq_setattr","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","const struct mq_attr *","struct mq_attr *"
|
||||
"ntohl","arpa/inet.h","","uint32_t","uint32_t"
|
||||
"ntohs","arpa/inet.h","","uint16_t","uint16_t"
|
||||
"perror","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","void","FAR const char *"
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
@ -1,48 +0,0 @@
|
|||
############################################################################
|
||||
# libc/mqueue/Make.defs
|
||||
#
|
||||
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
ifneq ($(CONFIG_DISABLE_MQUEUE),y)
|
||||
|
||||
# Add the mqueue C files to the build
|
||||
|
||||
CSRCS += mq_setattr.c mq_getattr.c
|
||||
|
||||
# Add the mqueue directory to the build
|
||||
|
||||
DEPPATH += --dep-path mqueue
|
||||
VPATH += :mqueue
|
||||
|
||||
endif
|
||||
|
|
@ -38,7 +38,8 @@ ifneq ($(CONFIG_DISABLE_MQUEUE),y)
|
|||
CSRCS += mq_send.c mq_timedsend.c mq_sndinternal.c mq_receive.c
|
||||
CSRCS += mq_timedreceive.c mq_rcvinternal.c mq_initialize.c
|
||||
CSRCS += mq_descreate.c mq_desclose.c mq_msgfree.c mq_msgqalloc.c
|
||||
CSRCS += mq_msgqfree.c mq_release.c mq_recover.c
|
||||
CSRCS += mq_msgqfree.c mq_release.c mq_recover.c mq_setattr.c
|
||||
CSRCS += mq_getattr.c
|
||||
|
||||
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
|
||||
CSRCS += mq_waitirq.c mq_notify.c
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/************************************************************************
|
||||
* libc/mqueue/mq_getattr.c
|
||||
* sched/mqueue/mq_getattr.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2009, 2011, 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -42,26 +42,6 @@
|
|||
#include <mqueue.h>
|
||||
#include <nuttx/mqueue.h>
|
||||
|
||||
/************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Private Type Declarations
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Global Variables
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Private Variables
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************/
|
|
@ -1,7 +1,7 @@
|
|||
/************************************************************************
|
||||
* libc/mqueue/mq_setattr.c
|
||||
* sched/mqueue/mq_setattr.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2009, 2011, 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -44,26 +44,6 @@
|
|||
|
||||
#include <nuttx/mqueue.h>
|
||||
|
||||
/************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Private Type Declarations
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Global Variables
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Private Variables
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************/
|
|
@ -36,10 +36,12 @@
|
|||
"mmap","sys/mman.h","CONFIG_NFILE_DESCRIPTORS > 0","FAR void*","FAR void*","size_t","int","int","int","off_t"
|
||||
"mount","sys/mount.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_READABLE)","int","const char*","const char*","const char*","unsigned long","const void*"
|
||||
"mq_close","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t"
|
||||
"mq_getattr","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","struct mq_attr *"
|
||||
"mq_notify","mqueue.h","!defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","const struct sigevent*"
|
||||
"mq_open","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","mqd_t","const char*","int","..."
|
||||
"mq_receive","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","ssize_t","mqd_t","char*","size_t","int*"
|
||||
"mq_send","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","const char*","size_t","int"
|
||||
"mq_setattr","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","const struct mq_attr *","struct mq_attr *"
|
||||
"mq_timedreceive","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","ssize_t","mqd_t","char*","size_t","int*","const struct timespec*"
|
||||
"mq_timedsend","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","const char*","size_t","int","const struct timespec*"
|
||||
"mq_unlink","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","const char*"
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
@ -277,10 +277,12 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert)
|
|||
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
SYSCALL_LOOKUP(mq_close, 1, STUB_mq_close)
|
||||
SYSCALL_LOOKUP(mq_getattr, 2, STUB_mq_getattr)
|
||||
SYSCALL_LOOKUP(mq_notify, 2, STUB_mq_notify)
|
||||
SYSCALL_LOOKUP(mq_open, 6, STUB_mq_open)
|
||||
SYSCALL_LOOKUP(mq_receive, 4, STUB_mq_receive)
|
||||
SYSCALL_LOOKUP(mq_send, 4, STUB_mq_send)
|
||||
SYSCALL_LOOKUP(mq_setattr, 3, STUB_mq_setattr)
|
||||
SYSCALL_LOOKUP(mq_timedreceive, 5, STUB_mq_timedreceive)
|
||||
SYSCALL_LOOKUP(mq_timedsend, 5, STUB_mq_timedsend)
|
||||
SYSCALL_LOOKUP(mq_unlink, 1, STUB_mq_unlink)
|
||||
|
|
|
@ -289,6 +289,7 @@ uintptr_t STUB_pthread_sigmask(int nbr, uintptr_t parm1, uintptr_t parm2,
|
|||
/* The following are defined only if message queues are enabled */
|
||||
|
||||
uintptr_t STUB_mq_close(int nbr, uintptr_t parm1);
|
||||
uintptr_t STUB_mq_getattr(int nbr, uintptr_t parm1, uintptr_t parm2);
|
||||
uintptr_t STUB_mq_notify(int nbr, uintptr_t parm1, uintptr_t parm2);
|
||||
uintptr_t STUB_mq_open(int nbr, uintptr_t parm1, uintptr_t parm2,
|
||||
uintptr_t parm3, uintptr_t parm4, uintptr_t parm5,
|
||||
|
@ -297,6 +298,8 @@ uintptr_t STUB_mq_receive(int nbr, uintptr_t parm1, uintptr_t parm2,
|
|||
uintptr_t parm3, uintptr_t parm4);
|
||||
uintptr_t STUB_mq_send(int nbr, uintptr_t parm1, uintptr_t parm2,
|
||||
uintptr_t parm3, uintptr_t parm4);
|
||||
uintptr_t STUB_mq_setattr(int nbr, uintptr_t parm1, uintptr_t parm2,
|
||||
uintptr_t parm3);
|
||||
uintptr_t STUB_mq_timedreceive(int nbr, uintptr_t parm1, uintptr_t parm2,
|
||||
uintptr_t parm3, uintptr_t parm4, uintptr_t parm5);
|
||||
uintptr_t STUB_mq_timedsend(int nbr, uintptr_t parm1, uintptr_t parm2,
|
||||
|
|
Loading…
Reference in a new issue