summaryrefslogtreecommitdiff
path: root/usr/src/uts
diff options
context:
space:
mode:
authorraf <none@none>2006-06-20 19:21:46 -0700
committerraf <none@none>2006-06-20 19:21:46 -0700
commitf841f6ad96ea6675d6c6b35c749eaac601799fdf (patch)
tree698db5d44fc99bd070613c93a497f5e93e803bc5 /usr/src/uts
parent545e5dad7996785cfebf226c5ef410c1b154740f (diff)
downloadillumos-joyent-f841f6ad96ea6675d6c6b35c749eaac601799fdf.tar.gz
6416832 libaio and librt can and should be folded into libc
--HG-- rename : usr/src/cmd/perl/5.8.4/distrib/ext/Time/HiRes/hints/solaris.pl => deleted_files/usr/src/cmd/perl/5.8.4/distrib/ext/Time/HiRes/hints/solaris.pl rename : usr/src/lib/libaio/common/Makefile => deleted_files/usr/src/lib/libaio/common/Makefile rename : usr/src/lib/libaio/common/scalls.c => deleted_files/usr/src/lib/libaio/common/scalls.c rename : usr/src/lib/libaio/common/sig.c => deleted_files/usr/src/lib/libaio/common/sig.c rename : usr/src/lib/libaio/common/subr.c => deleted_files/usr/src/lib/libaio/common/subr.c rename : usr/src/lib/libaio/spec/Makefile => deleted_files/usr/src/lib/libaio/spec/Makefile rename : usr/src/lib/libaio/spec/Makefile.targ => deleted_files/usr/src/lib/libaio/spec/Makefile.targ rename : usr/src/lib/libaio/spec/amd64/Makefile => deleted_files/usr/src/lib/libaio/spec/amd64/Makefile rename : usr/src/lib/libaio/spec/i386/Makefile => deleted_files/usr/src/lib/libaio/spec/i386/Makefile rename : usr/src/lib/libaio/spec/sparc/Makefile => deleted_files/usr/src/lib/libaio/spec/sparc/Makefile rename : usr/src/lib/libaio/spec/sparcv9/Makefile => deleted_files/usr/src/lib/libaio/spec/sparcv9/Makefile rename : usr/src/lib/libaio/spec/versions => deleted_files/usr/src/lib/libaio/spec/versions rename : usr/src/lib/librt/common/Makefile => deleted_files/usr/src/lib/librt/common/Makefile rename : usr/src/lib/librt/common/aio.c => deleted_files/usr/src/lib/librt/common/aio.c rename : usr/src/lib/librt/common/fdatasync.c => deleted_files/usr/src/lib/librt/common/fdatasync.c rename : usr/src/lib/librt/common/mqlib.h => deleted_files/usr/src/lib/librt/common/mqlib.h rename : usr/src/lib/librt/common/pos4.c => deleted_files/usr/src/lib/librt/common/pos4.c rename : usr/src/lib/librt/common/pos4.h => deleted_files/usr/src/lib/librt/common/pos4.h rename : usr/src/lib/librt/common/sigrt.c => deleted_files/usr/src/lib/librt/common/sigrt.c rename : usr/src/lib/librt/req.flg => deleted_files/usr/src/lib/librt/req.flg rename : usr/src/lib/librt/spec/Makefile => deleted_files/usr/src/lib/librt/spec/Makefile rename : usr/src/lib/librt/spec/Makefile.targ => deleted_files/usr/src/lib/librt/spec/Makefile.targ rename : usr/src/lib/librt/spec/amd64/Makefile => deleted_files/usr/src/lib/librt/spec/amd64/Makefile rename : usr/src/lib/librt/spec/i386/Makefile => deleted_files/usr/src/lib/librt/spec/i386/Makefile rename : usr/src/lib/librt/spec/sparc/Makefile => deleted_files/usr/src/lib/librt/spec/sparc/Makefile rename : usr/src/lib/librt/spec/sparcv9/Makefile => deleted_files/usr/src/lib/librt/spec/sparcv9/Makefile rename : usr/src/lib/librt/spec/versions => deleted_files/usr/src/lib/librt/spec/versions rename : usr/src/lib/libaio/common/libaio.h => usr/src/lib/libc/inc/asyncio.h rename : usr/src/lib/librt/common/thread_pool.h => usr/src/lib/libc/inc/thread_pool.h rename : usr/src/lib/libaio/common/aio.c => usr/src/lib/libc/port/aio/aio.c rename : usr/src/lib/libaio/common/ma.c => usr/src/lib/libc/port/aio/aio_alloc.c rename : usr/src/lib/libaio/common/posix_aio.c => usr/src/lib/libc/port/aio/posix_aio.c rename : usr/src/lib/librt/common/clock_timer.c => usr/src/lib/libc/port/rt/clock_timer.c rename : usr/src/lib/librt/common/fallocate.c => usr/src/lib/libc/port/rt/fallocate.c rename : usr/src/lib/librt/common/mqueue.c => usr/src/lib/libc/port/rt/mqueue.c rename : usr/src/lib/librt/common/pos4obj.c => usr/src/lib/libc/port/rt/pos4obj.c rename : usr/src/lib/librt/common/pos4obj.h => usr/src/lib/libc/port/rt/pos4obj.h rename : usr/src/lib/librt/common/sched.c => usr/src/lib/libc/port/rt/sched.c rename : usr/src/lib/librt/common/sem.c => usr/src/lib/libc/port/rt/sem.c rename : usr/src/lib/librt/common/shm.c => usr/src/lib/libc/port/rt/shm.c rename : usr/src/lib/librt/common/sigev_thread.c => usr/src/lib/libc/port/rt/sigev_thread.c rename : usr/src/lib/librt/common/sigev_thread.h => usr/src/lib/libc/port/rt/sigev_thread.h rename : usr/src/lib/librt/common/thread_pool.c => usr/src/lib/libc/port/tpool/thread_pool.c rename : usr/src/lib/librt/common/thread_pool_impl.h => usr/src/lib/libc/port/tpool/thread_pool_impl.h rename : usr/src/lib/libaio/spec/aio.spec => usr/src/lib/libc/spec/aio.spec rename : usr/src/lib/librt/spec/rt.spec => usr/src/lib/libc/spec/rt.spec rename : usr/src/lib/libaio/asynch.h => usr/src/uts/common/sys/asynch.h
Diffstat (limited to 'usr/src/uts')
-rw-r--r--usr/src/uts/common/os/sig.c11
-rw-r--r--usr/src/uts/common/os/sysent.c5
-rw-r--r--usr/src/uts/common/sys/Makefile2
-rw-r--r--usr/src/uts/common/sys/asynch.h79
-rw-r--r--usr/src/uts/common/sys/priocntl.h13
-rw-r--r--usr/src/uts/common/sys/signal.h11
-rw-r--r--usr/src/uts/common/syscall/sigqueue.c76
7 files changed, 148 insertions, 49 deletions
diff --git a/usr/src/uts/common/os/sig.c b/usr/src/uts/common/os/sig.c
index 8d36458701..872039c362 100644
--- a/usr/src/uts/common/os/sig.c
+++ b/usr/src/uts/common/os/sig.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -21,7 +20,7 @@
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -2372,6 +2371,7 @@ sigqhdralloc(size_t size, uint_t maxcount)
sq = next;
}
sq->sq_next = NULL;
+ cv_init(&sqh->sqb_cv, NULL, CV_DEFAULT, NULL);
mutex_init(&sqh->sqb_lock, NULL, MUTEX_DEFAULT, NULL);
return (sqh);
}
@@ -2422,6 +2422,7 @@ sigqrel(sigqueue_t *sq)
mutex_enter(&sqh->sqb_lock);
if (sqh->sqb_pexited && sqh->sqb_sent == 1) {
mutex_exit(&sqh->sqb_lock);
+ cv_destroy(&sqh->sqb_cv);
mutex_destroy(&sqh->sqb_lock);
kmem_free(sqh, sqh->sqb_size);
} else {
@@ -2430,6 +2431,7 @@ sigqrel(sigqueue_t *sq)
sq->sq_next = sqh->sqb_free;
sq->sq_backptr = NULL;
sqh->sqb_free = sq;
+ cv_signal(&sqh->sqb_cv);
mutex_exit(&sqh->sqb_lock);
}
}
@@ -2463,6 +2465,7 @@ sigqhdrfree(sigqhdr_t *sqh)
mutex_enter(&sqh->sqb_lock);
if (sqh->sqb_sent == 0) {
mutex_exit(&sqh->sqb_lock);
+ cv_destroy(&sqh->sqb_cv);
mutex_destroy(&sqh->sqb_lock);
kmem_free(sqh, sqh->sqb_size);
} else {
diff --git a/usr/src/uts/common/os/sysent.c b/usr/src/uts/common/os/sysent.c
index e1caaaa778..80761e102c 100644
--- a/usr/src/uts/common/os/sysent.c
+++ b/usr/src/uts/common/os/sysent.c
@@ -18,6 +18,7 @@
*
* CDDL HEADER END
*/
+
/* ONC_PLUS EXTRACT START */
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
@@ -670,7 +671,7 @@ struct sysent sysent[NSYSCALL] =
/* 187 */ SYSENT_CI("processor_bind", processor_bind, 4),
/* 188 */ SYSENT_CI("processor_info", processor_info, 2),
/* 189 */ SYSENT_CI("p_online", p_online, 2),
- /* 190 */ SYSENT_CI("sigqueue", sigqueue, 4),
+ /* 190 */ SYSENT_CI("sigqueue", sigqueue, 5),
/* 191 */ SYSENT_CI("clock_gettime", clock_gettime, 2),
/* 192 */ SYSENT_CI("clock_settime", clock_settime, 2),
/* 193 */ SYSENT_CI("clock_getres", clock_getres, 2),
@@ -1048,7 +1049,7 @@ struct sysent sysent32[NSYSCALL] =
/* 187 */ SYSENT_CI("processor_bind", processor_bind, 4),
/* 188 */ SYSENT_CI("processor_info", processor_info, 2),
/* 189 */ SYSENT_CI("p_online", p_online, 2),
- /* 190 */ SYSENT_CI("sigqueue", sigqueue32, 4),
+ /* 190 */ SYSENT_CI("sigqueue", sigqueue32, 5),
/* 191 */ SYSENT_CI("clock_gettime", clock_gettime, 2),
/* 192 */ SYSENT_CI("clock_settime", clock_settime, 2),
/* 193 */ SYSENT_CI("clock_getres", clock_getres, 2),
diff --git a/usr/src/uts/common/sys/Makefile b/usr/src/uts/common/sys/Makefile
index d1630796e8..e6d9bf1e4e 100644
--- a/usr/src/uts/common/sys/Makefile
+++ b/usr/src/uts/common/sys/Makefile
@@ -18,7 +18,6 @@
#
# CDDL HEADER END
#
-
#
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
@@ -82,6 +81,7 @@ CHKHDRS= \
aio_req.h \
aiocb.h \
ascii.h \
+ asynch.h \
atomic.h \
audio.h \
audiodebug.h \
diff --git a/usr/src/uts/common/sys/asynch.h b/usr/src/uts/common/sys/asynch.h
new file mode 100644
index 0000000000..48dc3dc622
--- /dev/null
+++ b/usr/src/uts/common/sys/asynch.h
@@ -0,0 +1,79 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 1991 by Sun Microsystems, Inc.
+ */
+
+#ifndef _SYS_ASYNCH_H
+#define _SYS_ASYNCH_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <sys/feature_tests.h>
+#include <sys/types.h>
+#include <sys/aio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define AIO_INPROGRESS -2 /* values not set by the system */
+
+/* large file compilation environment setup */
+#if !defined(_LP64) && _FILE_OFFSET_BITS == 64
+#ifdef __PRAGMA_REDEFINE_EXTNAME
+#pragma redefine_extname aioread aioread64
+#pragma redefine_extname aiowrite aiowrite64
+#else
+#define aioread aioread64
+#define aiowrite aiowrite64
+#endif
+#endif /* _FILE_OFFSET_BITS */
+
+#if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
+#ifdef __PRAGMA_REDEFINE_EXTNAME
+#pragma redefine_extname aioread64 aioread
+#pragma redefine_extname aiowrite64 aiowrite
+#else
+#define aioread64 aioread
+#define aiowrite64 aiowrite
+#endif
+#endif /* _LP64 && _LARGEFILE64_SOURCE */
+extern int aioread(int, caddr_t, int, off_t, int, aio_result_t *);
+extern int aiowrite(int, caddr_t, int, off_t, int, aio_result_t *);
+extern int aiocancel(aio_result_t *);
+extern aio_result_t *aiowait(struct timeval *);
+
+/* transitional large file interfaces */
+#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
+ !defined(__PRAGMA_REDEFINE_EXTNAME))
+extern int aioread64(int, caddr_t, int, off64_t, int, aio_result_t *);
+extern int aiowrite64(int, caddr_t, int, off64_t, int, aio_result_t *);
+#endif /* _LARGEFILE64_SOURCE... */
+
+#define MAXASYNCHIO 200 /* maxi.number of outstanding i/o's */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_ASYNCH_H */
diff --git a/usr/src/uts/common/sys/priocntl.h b/usr/src/uts/common/sys/priocntl.h
index 019b47875d..ca1a92400a 100644
--- a/usr/src/uts/common/sys/priocntl.h
+++ b/usr/src/uts/common/sys/priocntl.h
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -19,12 +18,12 @@
*
* CDDL HEADER END
*/
+
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
-
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -135,8 +134,8 @@ typedef struct {
#endif /* _SYSCALL32 && ... */
/*
- * The following is used by the library librt for
- * posix.4 scheduler interfaces and is not for general use.
+ * The following is used by libc for posix.4
+ * scheduler interfaces and is not for general use.
*/
typedef struct pcpri {
diff --git a/usr/src/uts/common/sys/signal.h b/usr/src/uts/common/sys/signal.h
index 50885d1fd5..ad9c1b93fc 100644
--- a/usr/src/uts/common/sys/signal.h
+++ b/usr/src/uts/common/sys/signal.h
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -19,8 +18,9 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -213,7 +213,7 @@ typedef struct sigaltstack32 {
#if defined(__EXTENSIONS__) || defined(_KERNEL) || \
(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
-/* signotify id used only by librt for mq_notify()/aio_notify() */
+/* signotify id used only by libc for mq_notify()/aio_notify() */
typedef struct signotify_id { /* signotify id struct */
pid_t sn_pid; /* pid of proc to be notified */
int sn_index; /* index in preallocated pool */
@@ -318,6 +318,7 @@ typedef struct sigqhdr { /* sigqueue pool header */
ushort_t sqb_size; /* size of header+free structs */
uchar_t sqb_pexited; /* process has exited */
uchar_t sqb_sent; /* number of sigq sent */
+ kcondvar_t sqb_cv; /* waiting for a sigq struct */
kmutex_t sqb_lock; /* lock for sigq pool */
} sigqhdr_t;
diff --git a/usr/src/uts/common/syscall/sigqueue.c b/usr/src/uts/common/syscall/sigqueue.c
index 38c5b91202..cb38bafbd9 100644
--- a/usr/src/uts/common/syscall/sigqueue.c
+++ b/usr/src/uts/common/syscall/sigqueue.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -19,14 +18,13 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright (c) 1998-2000 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-
-
+/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -43,13 +41,13 @@
#include <sys/debug.h>
static int
-sigqkill(pid_t pid, int signo, sigsend_t *sigsend)
+sigqkill(pid_t pid, sigsend_t *sigsend)
{
- register proc_t *p;
+ proc_t *p;
int error;
- if (signo < 0 || signo >= NSIG)
- return (set_errno(EINVAL));
+ if ((uint_t)sigsend->sig >= NSIG)
+ return (EINVAL);
if (pid == -1) {
procset_t set;
@@ -90,9 +88,7 @@ sigqkill(pid_t pid, int signo, sigsend_t *sigsend)
error = EPERM;
}
- if (error)
- return (set_errno(error));
- return (0);
+ return (error);
}
@@ -104,35 +100,39 @@ sigqkill(pid_t pid, int signo, sigsend_t *sigsend)
int
kill(pid_t pid, int sig)
{
+ int error;
sigsend_t v;
bzero(&v, sizeof (v));
v.sig = sig;
v.checkperm = 1;
v.sicode = SI_USER;
-
- return (sigqkill(pid, sig, &v));
+ if ((error = sigqkill(pid, &v)) != 0)
+ return (set_errno(error));
+ return (0);
}
/*
* The handling of small unions, like the sigval argument to sigqueue,
- * is architecture dependent. We have adapted the convention that the
+ * is architecture dependent. We have adopted the convention that the
* value itself is passed in the storage which crosses the kernel
* protection boundary. This procedure will accept a scalar argument,
* and store it in the appropriate value member of the sigsend_t structure.
*/
int
-sigqueue(pid_t pid, int signo, /* union sigval */ void *value, int si_code)
+sigqueue(pid_t pid, int sig, /* union sigval */ void *value,
+ int si_code, int block)
{
+ int error;
sigsend_t v;
sigqhdr_t *sqh;
proc_t *p = curproc;
/* The si_code value must indicate the signal will be queued */
- if (pid <= 0 || !sigwillqueue(signo, si_code))
+ if (pid <= 0 || !sigwillqueue(sig, si_code))
return (set_errno(EINVAL));
- if (p->p_sigqhdr == NULL) {
+ if ((sqh = p->p_sigqhdr) == NULL) {
/* Allocate sigqueue pool first time */
sqh = sigqhdralloc(sizeof (sigqueue_t), _SIGQUEUE_MAX);
mutex_enter(&p->p_lock);
@@ -142,17 +142,33 @@ sigqueue(pid_t pid, int signo, /* union sigval */ void *value, int si_code)
} else {
/* another lwp allocated the pool, free ours */
sigqhdrfree(sqh);
+ sqh = p->p_sigqhdr;
}
mutex_exit(&p->p_lock);
}
- bzero(&v, sizeof (v));
- v.sig = signo;
- v.checkperm = 1;
- v.sicode = si_code;
- v.value.sival_ptr = value;
+ do {
+ bzero(&v, sizeof (v));
+ v.sig = sig;
+ v.checkperm = 1;
+ v.sicode = si_code;
+ v.value.sival_ptr = value;
+ if ((error = sigqkill(pid, &v)) != EAGAIN || !block)
+ break;
+ /* block waiting for another chance to allocate a sigqueue_t */
+ mutex_enter(&sqh->sqb_lock);
+ while (sqh->sqb_count == 0) {
+ if (!cv_wait_sig(&sqh->sqb_cv, &sqh->sqb_lock)) {
+ error = EINTR;
+ break;
+ }
+ }
+ mutex_exit(&sqh->sqb_lock);
+ } while (error == EAGAIN);
- return (sigqkill(pid, signo, &v));
+ if (error)
+ return (set_errno(error));
+ return (0);
}
#ifdef _SYSCALL32_IMPL
@@ -173,13 +189,13 @@ sigqueue(pid_t pid, int signo, /* union sigval */ void *value, int si_code)
* models is unclear.
*/
int
-sigqueue32(pid_t pid, int signo, /* union sigval32 */ caddr32_t value,
- int si_code)
+sigqueue32(pid_t pid, int sig, /* union sigval32 */ caddr32_t value,
+ int si_code, int block)
{
union sigval sv;
bzero(&sv, sizeof (sv));
sv.sival_int = (int)value;
- return (sigqueue(pid, signo, sv.sival_ptr, si_code));
+ return (sigqueue(pid, sig, sv.sival_ptr, si_code, block));
}
#endif