Date: Thu, 20 Jun 2002 00:10:05 -0700 (PDT) From: "Chris Knight" <chris@aims.com.au> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/30464: pthread mutex attributes -- pshared Message-ID: <200206200710.g5K7A5u15013@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/30464; it has been noted by GNATS.
From: "Chris Knight" <chris@aims.com.au>
To: <freebsd-gnats-submit@FreeBSD.org>, <steve@Watt.COM>
Cc: <deischen@FreeBSD.org>
Subject: Re: bin/30464: pthread mutex attributes -- pshared
Date: Thu, 20 Jun 2002 17:02:47 +1000
Howdy,
The following patch should help.
I created it based on the prototypes in /usr/include/pthread.h and by looking
at similar code in the devel/linuxthreads port and the Darwin CVS repository.
Feel free to make it look like the functions in uthread_rwlockattr.c if you
like.
Regards,
Chris Knight
--- lib/libc_r/uthread/Makefile.inc.old Wed Sep 20 21:28:52 2000
+++ lib/libc_r/uthread/Makefile.inc Thu Jun 20 16:47:39 2002
@@ -31,6 +31,7 @@
uthread_cond.c \
uthread_condattr_destroy.c \
uthread_condattr_init.c \
+ uthread_condattr_pshared.c \
uthread_connect.c \
uthread_creat.c \
uthread_create.c \
@@ -77,6 +78,7 @@
uthread_mutex_prioceiling.c \
uthread_mutex_protocol.c \
uthread_mutexattr_destroy.c \
+ uthread_mutexattr_pshared.c \
uthread_nanosleep.c \
uthread_once.c \
uthread_open.c \
--- /dev/null Thu Jun 20 16:03:00 2002
+++ lib/libc_r/uthread/uthread_condattr_pshared.c Thu Jun 20 16:34:23 2002
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2002 Chris Knight <chris@aims.com.au>.
+ * All rights reserved.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ * the first lines of this file unmodified other than the possible
+ * addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice(s), this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``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 HOLDER(S) 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.
+ *
+ * $FreeBSD$
+ */
+#include <stdlib.h>
+#include <errno.h>
+#ifdef _THREAD_SAFE
+#include <pthread.h>
+#include "pthread_private.h"
+
+#if defined(_POSIX_THREAD_PROCESS_SHARED)
+int
+pthread_condattr_getpshared(pthread_condattr_t *attr, int *pshared)
+{
+ /* not possible to share a condvar, return private */
+ *pshared = PTHREAD_PROCESS_PRIVATE;
+ return (ESUCCESS);
+}
+
+int
+pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared)
+{
+ int ret = EINVAL;
+
+ /* not possible to share a condvar, return success if set private */
+ if (pshared == PTHREAD_PROCESS_PRIVATE)
+ ret = ESUCCESS;
+ return (ret);
+}
+#endif
+#endif
--- /dev/null Thu Jun 20 16:03:00 2002
+++ lib/libc_r/uthread/uthread_mutexattr_pshared.c Thu Jun 20 16:36:55 2002
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2002 Chris Knight <chris@aims.com.au>.
+ * All rights reserved.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ * the first lines of this file unmodified other than the possible
+ * addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice(s), this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``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 HOLDER(S) 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.
+ *
+ * $FreeBSD$
+ */
+#include <stdlib.h>
+#include <errno.h>
+#ifdef _THREAD_SAFE
+#include <pthread.h>
+#include "pthread_private.h"
+
+#if defined(_POSIX_THREAD_PROCESS_SHARED)
+int
+pthread_mutexattr_getpshared(pthread_mutexattr_t *attr, int *pshared)
+{
+ /* not possible to share a mutex, return private */
+ *pshared = PTHREAD_PROCESS_PRIVATE;
+ return (ESUCCESS);
+}
+
+int
+pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared)
+{
+ int ret = EINVAL;
+
+ /* not possible to share a mutex, return success if set private */
+ if (pshared == PTHREAD_PROCESS_PRIVATE)
+ ret = ESUCCESS;
+ return (ret);
+}
+#endif
+#endif
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206200710.g5K7A5u15013>
