[Glibc-bsd-commits] r4779 - trunk/glibc-ports

Petr Salinger ps-guest at alioth.debian.org
Sun Jul 21 13:52:05 UTC 2013


Author: ps-guest
Date: 2013-07-21 13:52:05 +0000 (Sun, 21 Jul 2013)
New Revision: 4779

Added:
   trunk/glibc-ports/mq.diff
Log:
unfinished wrappers for mq_* family



Added: trunk/glibc-ports/mq.diff
===================================================================
--- trunk/glibc-ports/mq.diff	                        (rev 0)
+++ trunk/glibc-ports/mq.diff	2013-07-21 13:52:05 UTC (rev 4779)
@@ -0,0 +1,338 @@
+
+unfinished wrappers for mq_* family
+
+first is needed to fixup implementation of
+2.4.1 Signal Generation and Delivery
+
+http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04_01
+
+It might/should be common with aio, gai and timers
+
+See lio_listio(), getaddrinfo_a(), timer_create(), mq_notify()
+
+
+Index: mq_close.c
+===================================================================
+--- mq_close.c	(revision 0)
++++ mq_close.c	(revision 0)
+@@ -0,0 +1,28 @@
++/* Copyright (C) 2004-2013 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library 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
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#include <errno.h>
++#include <mqueue.h>
++#include <sysdep.h>
++
++/* Removes the association between message queue descriptor MQDES and its
++   message queue.  */
++int
++mq_close (mqd_t mqdes)
++{
++  return INLINE_SYSCALL (close, 1, mqdes);
++}
+Index: mq_getattr.c
+===================================================================
+--- mq_getattr.c	(revision 0)
++++ mq_getattr.c	(revision 0)
+@@ -0,0 +1,28 @@
++/* Copyright (C) 2004-2013 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library 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
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#include <errno.h>
++#include <mqueue.h>
++#include <stddef.h>
++#include <sysdep.h>
++
++/* Query status and attributes of message queue MQDES.  */
++int
++mq_getattr (mqd_t mqdes, struct mq_attr *mqstat)
++{
++  return __kmq_setattr (mqdes, NULL, mqstat);
++}
+Index: syscalls.list
+===================================================================
+--- syscalls.list	(revision 4772)
++++ syscalls.list	(working copy)
+@@ -77,6 +77,12 @@
+ kldsym			-	kldsym			i:iip		kldsym
+ kldunload		-	kldunload		i:i		kldunload
+ kldunloadf		-	kldunloadf		i:ii		kldunloadf
++sys_kmq_notify		-	kmq_notify		i:ip		__syscall_kmq_notify
++mq_open			-	kmq_open		i:piip		__kmq_open mq_open
++mq_setattr		-	kmq_setattr		i:ipp		__kmq_setattr mq_setattr
++mq_timedsend		-	kmq_timedsend		Ci:ipiip	__kmq_timedsend mq_timedsend
++mq_timedreceive		-	kmq_timedreceive	Ci:ipipp	__kmq_timedreceive mq_timedreceive
++sys_kmq_unlink		-	kmq_unlink		i:p		__syscall_kmq_unlink
+ kqueue			EXTRA	kqueue			i:		__kqueue kqueue
+ sys_ktimer_create	-	ktimer_create		i:iPp		__syscall_ktimer_create
+ sys_ktimer_delete	-	ktimer_delete		i:i		__syscall_ktimer_delete
+Index: Makefile
+===================================================================
+--- Makefile	(revision 4772)
++++ Makefile	(working copy)
+@@ -131,3 +131,7 @@
+ ifeq ($(subdir),sunrpc)
+ sysdep_headers += nfs/nfs.h
+ endif
++
++ifeq ($(subdir),rt)
++librt-routines += sys_kmq_notify mq_open2 sys_kmq_unlink
++endif
+Index: mq_unlink.c
+===================================================================
+--- mq_unlink.c	(revision 0)
++++ mq_unlink.c	(revision 0)
+@@ -0,0 +1,38 @@
++/* Copyright (C) 2004-2013 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library 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
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#include <errno.h>
++#include <mqueue.h>
++#include <sysdep.h>
++
++/* Remove message queue named NAME.  */
++int
++mq_unlink (const char *name)
++{
++  int ret = INLINE_SYSCALL (kmq_unlink, err, 1, name );
++
++  /* While unlink can return either EPERM or EACCES, mq_unlink should
++     return just EACCES.  */
++  if ( ret == -1 )
++    {
++      if (errno == EPERM)
++        __set_errno (EACCES);
++      ret = -1;
++    }
++
++  return ret;
++}
+Index: mq_send.c
+===================================================================
+--- mq_send.c	(revision 0)
++++ mq_send.c	(revision 0)
+@@ -0,0 +1,29 @@
++/* Copyright (C) 2004-2013 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library 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
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#include <errno.h>
++#include <mqueue.h>
++#include <stddef.h>
++#include <sysdep.h>
++
++/* Add message pointed by MSG_PTR to message queue MQDES.  */
++int
++mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len,
++	 unsigned int msg_prio)
++{
++  return __kmq_timedsend (mqdes, msg_ptr, msg_len, msg_prio, NULL);
++}
+Index: mq_notify.c
+===================================================================
+--- mq_notify.c	(revision 0)
++++ mq_notify.c	(revision 0)
+@@ -0,0 +1,38 @@
++/* Copyright (C) 2004-2013 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library 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
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#include <errno.h>
++#include <mqueue.h>
++#include <stddef.h>
++#include <sysdep.h>
++
++/* Register notification upon message arrival to an empty message queue
++   MQDES.  */
++int
++mq_notify (mqd_t mqdes, const struct sigevent *notification)
++{
++  /* mq_notify which handles SIGEV_THREAD is included in the thread
++     add-on.  */
++  if (notification != NULL
++      && notification->sigev_notify == SIGEV_THREAD)
++    {
++# warning not yet mq_notify SIGEV_THREAD    
++      __set_errno (ENOSYS);
++      return -1;
++    }
++  return INLINE_SYSCALL (kmq_notify, 2, mqdes, notification);
++}
+Index: mq_receive.c
+===================================================================
+--- mq_receive.c	(revision 0)
++++ mq_receive.c	(revision 0)
+@@ -0,0 +1,30 @@
++/* Copyright (C) 2004-2013 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library 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
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#include <errno.h>
++#include <mqueue.h>
++#include <stddef.h>
++#include <sysdep.h>
++
++/* Receive the oldest from highest priority messages in message queue
++   MQDES.  */
++ssize_t
++mq_receive (mqd_t mqdes, char *msg_ptr, size_t msg_len,
++	    unsigned int *msg_prio)
++{
++  return __kmq_timedreceive (mqdes, msg_ptr, msg_len, msg_prio, NULL);
++}
+Index: bits/mqueue.h
+===================================================================
+--- bits/mqueue.h	(revision 0)
++++ bits/mqueue.h	(revision 0)
+@@ -0,0 +1,33 @@
++/* Copyright (C) 2004-2013 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library 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
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#ifndef _MQUEUE_H
++# error "Never use <bits/mqueue.h> directly; include <mqueue.h> instead."
++#endif
++
++#include <bits/types.h>
++
++typedef int mqd_t;
++
++struct mq_attr
++{
++  long mq_flags;	/* Message queue flags.  */
++  long mq_maxmsg;	/* Maximum number of messages.  */
++  long mq_msgsize;	/* Maximum message size.  */
++  long mq_curmsgs;	/* Number of messages currently queued.  */
++  long __pad[4];
++};
+Index: mq_open2.c
+===================================================================
+--- mq_open2.c	(revision 0)
++++ mq_open2.c	(revision 0)
+@@ -0,0 +1,32 @@
++/* Copyright (C) 2004-2013 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library 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
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#include <errno.h>
++#include <mqueue.h>
++#include <stdarg.h>
++#include <stddef.h>
++#include <stdio.h>
++#include <sysdep.h>
++
++mqd_t
++__mq_open_2 (const char *name, int oflag)
++{
++  if (oflag & O_CREAT)
++    __fortify_fail ("invalid mq_open call: O_CREAT without mode and attr");
++
++  return __kmq_open (name, oflag);
++}




More information about the Glibc-bsd-commits mailing list