summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
Diffstat (limited to 'usr')
-rw-r--r--usr/src/Targetdirs20
-rw-r--r--usr/src/cmd/busstat/Makefile13
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/Makefile9
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/Makefile9
-rw-r--r--usr/src/cmd/cpc/cpustat/Makefile9
-rw-r--r--usr/src/cmd/fm/fmd/Makefile.fmd2
-rw-r--r--usr/src/cmd/fm/modules/SUNW,SPARC-Enterprise/cpumem-retire/Makefile4
-rw-r--r--usr/src/cmd/fm/modules/SUNW,SPARC-Enterprise/event-transport/Makefile2
-rw-r--r--usr/src/cmd/fm/modules/common/cpumem-retire/Makefile2
-rw-r--r--usr/src/cmd/fm/modules/i86pc/sfx4500-disk/Makefile4
-rw-r--r--usr/src/cmd/fm/modules/sun4u/datapath-retire/Makefile2
-rw-r--r--usr/src/cmd/fm/modules/sun4v/cpumem-retire/Makefile4
-rw-r--r--usr/src/cmd/fm/modules/sun4v/etm/Makefile2
-rw-r--r--usr/src/cmd/fm/schemes/mem/Makefile.com2
-rw-r--r--usr/src/cmd/fs.d/nfs/nfsmapid/Makefile6
-rw-r--r--usr/src/cmd/fs.d/nfs/nfsstat/Makefile13
-rw-r--r--usr/src/cmd/fs.d/ufs/mkfs/Makefile11
-rw-r--r--usr/src/cmd/intrstat/Makefile.com9
-rw-r--r--usr/src/cmd/lockstat/Makefile.com12
-rw-r--r--usr/src/cmd/perl/5.8.4/distrib/ext/Time/HiRes/hints/solaris.pl3
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/daktari/psvcplugin/Makefile9
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/daktari/psvcpolicy/Makefile9
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/psvc/psvcplugin/Makefile13
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/snowbird/envmond/Makefile9
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/snowbird/watchdog/Makefile9
-rw-r--r--usr/src/cmd/picl/plugins/sun4v/mdesc/Makefile2
-rw-r--r--usr/src/cmd/picl/plugins/sun4v/ontario/piclsbl/Makefile11
-rw-r--r--usr/src/cmd/rcap/rcapd/Makefile.rcapd9
-rw-r--r--usr/src/cmd/rcm_daemon/Makefile.com7
-rw-r--r--usr/src/cmd/scadm/sparc/mpxu/Makefile9
-rw-r--r--usr/src/cmd/stat/iostat/Makefile11
-rw-r--r--usr/src/cmd/trapstat/sun4u/Makefile10
-rw-r--r--usr/src/cmd/trapstat/sun4v/Makefile10
-rw-r--r--usr/src/cmd/truss/systable.c3
-rw-r--r--usr/src/cmd/xntpd/Makefile.cmd6
-rw-r--r--usr/src/lib/Makefile3
-rw-r--r--usr/src/lib/common/inc/c_synonyms.h29
-rw-r--r--usr/src/lib/efcode/engine/Makefile.com9
-rw-r--r--usr/src/lib/libaio/Makefile45
-rw-r--r--usr/src/lib/libaio/Makefile.com46
-rw-r--r--usr/src/lib/libaio/amd64/Makefile11
-rw-r--r--usr/src/lib/libaio/amd64/mapfile-vers (renamed from usr/src/lib/libaio/spec/versions)66
-rw-r--r--usr/src/lib/libaio/common/llib-laio43
-rw-r--r--usr/src/lib/libaio/common/scalls.c59
-rw-r--r--usr/src/lib/libaio/common/sig.c296
-rw-r--r--usr/src/lib/libaio/common/subr.c58
-rw-r--r--usr/src/lib/libaio/i386/Makefile9
-rw-r--r--usr/src/lib/libaio/i386/mapfile-vers (renamed from usr/src/lib/libaio/common/Makefile)55
-rw-r--r--usr/src/lib/libaio/sparc/Makefile9
-rw-r--r--usr/src/lib/libaio/sparc/mapfile-vers66
-rw-r--r--usr/src/lib/libaio/sparcv9/Makefile11
-rw-r--r--usr/src/lib/libaio/sparcv9/mapfile-vers (renamed from usr/src/lib/libaio/spec/amd64/Makefile)49
-rw-r--r--usr/src/lib/libaio/spec/Makefile30
-rw-r--r--usr/src/lib/libaio/spec/Makefile.targ37
-rw-r--r--usr/src/lib/libaio/spec/aio.spec202
-rw-r--r--usr/src/lib/libaio/spec/i386/Makefile44
-rw-r--r--usr/src/lib/libaio/spec/sparc/Makefile44
-rw-r--r--usr/src/lib/libaio/spec/sparcv9/Makefile45
-rw-r--r--usr/src/lib/libc/Makefile.targ22
-rw-r--r--usr/src/lib/libc/README53
-rw-r--r--usr/src/lib/libc/amd64/Makefile29
-rw-r--r--usr/src/lib/libc/amd64/gen/siglongjmp.c13
-rw-r--r--usr/src/lib/libc/common/sys/__clock_timer.s14
-rw-r--r--usr/src/lib/libc/common/sys/__signotify.s13
-rw-r--r--usr/src/lib/libc/common/sys/__sigrt.s16
-rw-r--r--usr/src/lib/libc/common/sys/kaio.s21
-rw-r--r--usr/src/lib/libc/i386/Makefile.com29
-rw-r--r--usr/src/lib/libc/i386/gen/siglongjmp.c13
-rw-r--r--usr/src/lib/libc/inc/asyncio.h (renamed from usr/src/lib/libaio/common/libaio.h)90
-rw-r--r--usr/src/lib/libc/inc/mtlib.h11
-rw-r--r--usr/src/lib/libc/inc/rtsched.h (renamed from usr/src/lib/librt/common/fdatasync.c)22
-rw-r--r--usr/src/lib/libc/inc/synonyms.h47
-rw-r--r--usr/src/lib/libc/inc/thr_debug.h (renamed from usr/src/lib/librt/common/sigrt.c)41
-rw-r--r--usr/src/lib/libc/inc/thr_uberdata.h69
-rw-r--r--usr/src/lib/libc/inc/thread_pool.h (renamed from usr/src/lib/librt/common/thread_pool.h)0
-rw-r--r--usr/src/lib/libc/port/aio/aio.c (renamed from usr/src/lib/libaio/common/aio.c)341
-rw-r--r--usr/src/lib/libc/port/aio/aio_alloc.c (renamed from usr/src/lib/libaio/common/ma.c)72
-rw-r--r--usr/src/lib/libc/port/aio/posix_aio.c (renamed from usr/src/lib/libaio/common/posix_aio.c)175
-rw-r--r--usr/src/lib/libc/port/gen/event_port.c11
-rw-r--r--usr/src/lib/libc/port/llib-lc5
-rw-r--r--usr/src/lib/libc/port/rt/clock_timer.c (renamed from usr/src/lib/librt/common/clock_timer.c)57
-rw-r--r--usr/src/lib/libc/port/rt/fallocate.c (renamed from usr/src/lib/librt/common/fallocate.c)10
-rw-r--r--usr/src/lib/libc/port/rt/mqueue.c (renamed from usr/src/lib/librt/common/mqueue.c)175
-rw-r--r--usr/src/lib/libc/port/rt/pos4obj.c (renamed from usr/src/lib/librt/common/pos4obj.c)34
-rw-r--r--usr/src/lib/libc/port/rt/pos4obj.h (renamed from usr/src/lib/librt/common/pos4obj.h)0
-rw-r--r--usr/src/lib/libc/port/rt/sched.c (renamed from usr/src/lib/librt/common/sched.c)50
-rw-r--r--usr/src/lib/libc/port/rt/sem.c (renamed from usr/src/lib/librt/common/sem.c)68
-rw-r--r--usr/src/lib/libc/port/rt/shm.c (renamed from usr/src/lib/librt/common/shm.c)32
-rw-r--r--usr/src/lib/libc/port/rt/sigev_thread.c (renamed from usr/src/lib/librt/common/sigev_thread.c)270
-rw-r--r--usr/src/lib/libc/port/rt/sigev_thread.h (renamed from usr/src/lib/librt/common/sigev_thread.h)22
-rw-r--r--usr/src/lib/libc/port/sys/fsync.c19
-rw-r--r--usr/src/lib/libc/port/sys/sigstack.c7
-rw-r--r--usr/src/lib/libc/port/threads/assfail.c43
-rw-r--r--usr/src/lib/libc/port/threads/pthr_attr.c5
-rw-r--r--usr/src/lib/libc/port/threads/pthread.c4
-rw-r--r--usr/src/lib/libc/port/threads/rtsched.c120
-rw-r--r--usr/src/lib/libc/port/threads/scalls.c48
-rw-r--r--usr/src/lib/libc/port/threads/sigaction.c57
-rw-r--r--usr/src/lib/libc/port/threads/spawn.c16
-rw-r--r--usr/src/lib/libc/port/threads/synch.c71
-rw-r--r--usr/src/lib/libc/port/threads/thr.c30
-rw-r--r--usr/src/lib/libc/port/tpool/thread_pool.c (renamed from usr/src/lib/librt/common/thread_pool.c)197
-rw-r--r--usr/src/lib/libc/port/tpool/thread_pool_impl.h (renamed from usr/src/lib/librt/common/thread_pool_impl.h)9
-rw-r--r--usr/src/lib/libc/sparc/Makefile29
-rw-r--r--usr/src/lib/libc/sparcv9/Makefile29
-rw-r--r--usr/src/lib/libc/spec/Makefile.targ11
-rw-r--r--usr/src/lib/libc/spec/aio.spec83
-rw-r--r--usr/src/lib/libc/spec/gen.spec25
-rw-r--r--usr/src/lib/libc/spec/private.spec99
-rw-r--r--usr/src/lib/libc/spec/rt.spec (renamed from usr/src/lib/librt/spec/rt.spec)170
-rw-r--r--usr/src/lib/libc/spec/sys.spec7
-rw-r--r--usr/src/lib/libc/spec/threads.spec14
-rw-r--r--usr/src/lib/librt/Makefile48
-rw-r--r--usr/src/lib/librt/Makefile.com90
-rw-r--r--usr/src/lib/librt/amd64/Makefile11
-rw-r--r--usr/src/lib/librt/amd64/mapfile-vers141
-rw-r--r--usr/src/lib/librt/common/Makefile49
-rw-r--r--usr/src/lib/librt/common/aio.c336
-rw-r--r--usr/src/lib/librt/common/llib-lrt9
-rw-r--r--usr/src/lib/librt/common/mqlib.h117
-rw-r--r--usr/src/lib/librt/common/pos4.c159
-rw-r--r--usr/src/lib/librt/common/pos4.h91
-rw-r--r--usr/src/lib/librt/i386/Makefile9
-rw-r--r--usr/src/lib/librt/i386/mapfile-vers150
-rw-r--r--usr/src/lib/librt/req.flg27
-rw-r--r--usr/src/lib/librt/sparc/Makefile9
-rw-r--r--usr/src/lib/librt/sparc/mapfile-vers150
-rw-r--r--usr/src/lib/librt/sparcv9/Makefile11
-rw-r--r--usr/src/lib/librt/sparcv9/mapfile-vers141
-rw-r--r--usr/src/lib/librt/spec/Makefile29
-rw-r--r--usr/src/lib/librt/spec/Makefile.targ32
-rw-r--r--usr/src/lib/librt/spec/amd64/Makefile44
-rw-r--r--usr/src/lib/librt/spec/i386/Makefile44
-rw-r--r--usr/src/lib/librt/spec/sparc/Makefile44
-rw-r--r--usr/src/lib/librt/spec/sparcv9/Makefile45
-rw-r--r--usr/src/lib/librt/spec/versions63
-rw-r--r--usr/src/lib/libtsol/common/call_labeld.c9
-rw-r--r--usr/src/ucbcmd/sbcp/Makefile9
-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.h (renamed from usr/src/lib/libaio/asynch.h)0
-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
145 files changed, 2732 insertions, 3702 deletions
diff --git a/usr/src/Targetdirs b/usr/src/Targetdirs
index 3d3f11ec79..121a668fea 100644
--- a/usr/src/Targetdirs
+++ b/usr/src/Targetdirs
@@ -18,15 +18,12 @@
#
# CDDL HEADER END
#
-
#
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
#
-
-#
# The list is built of owner-group combinations. ROOT.SYS occurs twice
# because some directories owned by root and in group sys are subdirectories
# of directories having other owner-group attributes.
@@ -767,6 +764,10 @@ $(SYM.USRCCSLIB64:%=$(ROOT)%):= \
# Special symlinks to direct libraries that have been moved
# from /usr/lib to /lib in order to live in the root filesystem.
+$(ROOT)/lib/libposix4.so.1:= REALPATH=librt.so.1
+$(ROOT)/lib/libposix4.so:= REALPATH=libposix4.so.1
+$(ROOT)/lib/llib-lposix4:= REALPATH=llib-lrt
+$(ROOT)/lib/llib-lposix4.ln:= REALPATH=llib-lrt.ln
$(ROOT)/lib/libthread_db.so.1:= REALPATH=libc_db.so.1
$(ROOT)/lib/libthread_db.so:= REALPATH=libc_db.so.1
$(ROOT)/usr/lib/ld.so.1:= REALPATH=../../lib/ld.so.1
@@ -997,6 +998,12 @@ $(ROOT)/usr/lib/nss_nis.so.1:= REALPATH=../../lib/nss_nis.so.1
$(ROOT)/usr/lib/nss_nisplus.so.1:= REALPATH=../../lib/nss_nisplus.so.1
$(ROOT)/usr/lib/nss_user.so.1:= REALPATH=../../lib/nss_user.so.1
+$(ROOT)/lib/$(MACH64)/libposix4.so.1:= \
+ REALPATH=librt.so.1
+$(ROOT)/lib/$(MACH64)/libposix4.so:= \
+ REALPATH=libposix4.so.1
+$(ROOT)/lib/$(MACH64)/llib-lposix4.ln:= \
+ REALPATH=llib-lrt.ln
$(ROOT)/lib/$(MACH64)/libthread_db.so.1:= \
REALPATH=libc_db.so.1
$(ROOT)/lib/$(MACH64)/libthread_db.so:= \
@@ -1345,6 +1352,10 @@ $(ROOT)/usr/platform/sun4u/sbin/wrsmconf:= \
REALPATH=../../../../platform/sun4u/sbin/wrsmconf
SYM.USRLIB= \
+ /lib/libposix4.so \
+ /lib/libposix4.so.1 \
+ /lib/llib-lposix4 \
+ /lib/llib-lposix4.ln \
/lib/libthread_db.so \
/lib/libthread_db.so.1 \
/usr/lib/ld.so.1 \
@@ -1586,6 +1597,9 @@ amd64_SYM.USRLIB64=
SYM.USRLIB64= \
$($(MACH64)_SYM.USRLIB64) \
+ /lib/$(MACH64)/libposix4.so \
+ /lib/$(MACH64)/libposix4.so.1 \
+ /lib/$(MACH64)/llib-lposix4.ln \
/lib/$(MACH64)/libthread_db.so \
/lib/$(MACH64)/libthread_db.so.1 \
/usr/lib/$(MACH64)/ld.so.1 \
diff --git a/usr/src/cmd/busstat/Makefile b/usr/src/cmd/busstat/Makefile
index 157a4b1d07..975706afcd 100644
--- a/usr/src/cmd/busstat/Makefile
+++ b/usr/src/cmd/busstat/Makefile
@@ -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.
@@ -20,16 +19,16 @@
# CDDL HEADER END
#
#
-# Copyright (c) 1999 by Sun Microsystems, Inc.
-# All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
#
-#pragma ident "%Z%%M% %I% %E% SMI"
+# ident "%Z%%M% %I% %E% SMI"
PROG= busstat
include ../Makefile.cmd
-LDLIBS += -lkstat -lrt
+LDLIBS += -lkstat
.KEEP_STATE:
diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/Makefile b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/Makefile
index d226e5abb4..0b36ed8a25 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/Makefile
@@ -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.
@@ -20,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -52,7 +51,7 @@ $(ROOTMANIFEST) := FILEMODE= 444
CPPFLAGS += -DNDEBUG -DNPROBE -D_REENTRANT -I./ -I$(CMN_DIR)
LINTFLAGS += -u
LDFLAGS += -L$(NSU_DIR) -R/usr/lib/inet/dhcp/nsu
-LDLIBS += $(NSU_DIR)/rfc2136.so.1 -lrt -ldhcpsvc -ldhcputil -linetutil \
+LDLIBS += $(NSU_DIR)/rfc2136.so.1 -ldhcpsvc -ldhcputil -linetutil \
-lsocket -lnsl -lmtmalloc -lresolv
lint := LDLIBS = $(LDLIBS.cmd) -ldhcpsvc -ldhcputil -linetutil -lsocket -lnsl
diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/Makefile b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/Makefile
index 2e62fe343e..7e016815e5 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/Makefile
@@ -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.
@@ -20,7 +19,7 @@
# 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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -44,7 +43,7 @@ MSRCS = $(OBJS:%.o=%.c)
include ../../../../Makefile.cmd
-DLIBS = -lrt -linetutil -ldhcpsvc -lsocket -lnsl -lmtmalloc
+DLIBS = -linetutil -ldhcpsvc -lsocket -lnsl -lmtmalloc
LDLIBS += $(DLIBS)
CPPFLAGS += -g -DNDEBUG -D_REENTRANT -I$(COMMON_NET)
LINTFLAGS += -Xt
diff --git a/usr/src/cmd/cpc/cpustat/Makefile b/usr/src/cmd/cpc/cpustat/Makefile
index 097b3b0c3b..1c0b06524b 100644
--- a/usr/src/cmd/cpc/cpustat/Makefile
+++ b/usr/src/cmd/cpc/cpustat/Makefile
@@ -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.
@@ -20,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -34,7 +33,7 @@ include ../../Makefile.cmd
CFLAGS += $(CCVERBOSE) $(CTF_FLAGS)
CPPFLAGS += -D_REENTRANT -I$(SRC)/lib/libcpc/common
-LDLIBS += -lcpc -lposix4 -lkstat
+LDLIBS += -lcpc -lkstat
.KEEP_STATE:
diff --git a/usr/src/cmd/fm/fmd/Makefile.fmd b/usr/src/cmd/fm/fmd/Makefile.fmd
index 102d2a6806..00a325b6eb 100644
--- a/usr/src/cmd/fm/fmd/Makefile.fmd
+++ b/usr/src/cmd/fm/fmd/Makefile.fmd
@@ -112,7 +112,7 @@ CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST)
LINTFLAGS += -mu
LDFLAGS += -R/usr/lib/fm
LDLIBS += -L$(ROOTLIB)/fm -ltopo -ldiagcode -lsysevent -lsmbios -luuid -lnvpair
-LDLIBS += -lexacct -lnsl -lrt -lumem -ldevinfo
+LDLIBS += -lexacct -lnsl -lumem -ldevinfo
$(DMOD) := CFLAGS += $(CC_PICFLAGS) -G $(XREGSFLAG)
$(DMOD) := LDFLAGS += $(ZTEXT) -z combreloc
diff --git a/usr/src/cmd/fm/modules/SUNW,SPARC-Enterprise/cpumem-retire/Makefile b/usr/src/cmd/fm/modules/SUNW,SPARC-Enterprise/cpumem-retire/Makefile
index e698c839eb..6421720389 100644
--- a/usr/src/cmd/fm/modules/SUNW,SPARC-Enterprise/cpumem-retire/Makefile
+++ b/usr/src/cmd/fm/modules/SUNW,SPARC-Enterprise/cpumem-retire/Makefile
@@ -22,7 +22,7 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-#ident "%Z%%M% %I% %E% SMI"
+# ident "%Z%%M% %I% %E% SMI"
PLATFORMS = SUNW,SPARC-Enterprise
CLASS = plat
@@ -47,7 +47,7 @@ CMA_VERSION = "1.1"
LIBDIRS = $(ROOT)/usr/platform/$(PLATFORMS)/lib
CPPFLAGS += $(INCDIRS:%=-I%) -DCMA_VERSION='$(CMA_VERSION)'
LDFLAGS += -R/usr/lib/fm
-LDLIBS += -L$(ROOTLIB)/fm -ltopo -lrt
+LDLIBS += -L$(ROOTLIB)/fm -ltopo
%.o: $(CPUMEM_RETIRE_COMMON)/%.c
$(COMPILE.c) -o $@ $<
diff --git a/usr/src/cmd/fm/modules/SUNW,SPARC-Enterprise/event-transport/Makefile b/usr/src/cmd/fm/modules/SUNW,SPARC-Enterprise/event-transport/Makefile
index 3b0ffcdc95..c45119ca68 100644
--- a/usr/src/cmd/fm/modules/SUNW,SPARC-Enterprise/event-transport/Makefile
+++ b/usr/src/cmd/fm/modules/SUNW,SPARC-Enterprise/event-transport/Makefile
@@ -30,7 +30,7 @@ $(PLATFORMS)_SRCS = ex_dscp.c
LIBDIRS = $(ROOT)/usr/platform/$(PLATFORMS)/lib
LIBFLAGS = \$$ORIGIN/../../../../lib
-XPORTLIBS = -lsocket -lnsl -ldscp -lrt
+XPORTLIBS = -lsocket -lnsl -ldscp
include ../../common/event-transport/Makefile.etm
diff --git a/usr/src/cmd/fm/modules/common/cpumem-retire/Makefile b/usr/src/cmd/fm/modules/common/cpumem-retire/Makefile
index 9e59800ea7..6ad343fce7 100644
--- a/usr/src/cmd/fm/modules/common/cpumem-retire/Makefile
+++ b/usr/src/cmd/fm/modules/common/cpumem-retire/Makefile
@@ -39,4 +39,4 @@ INCDIRS = .
CPPFLAGS += $(INCDIRS:%=-I%) -DCMA_VERSION='$(CMA_VERSION)'
LDFLAGS += -R/usr/lib/fm
-LDLIBS += -L$(ROOTLIB)/fm -ltopo -lrt
+LDLIBS += -L$(ROOTLIB)/fm -ltopo
diff --git a/usr/src/cmd/fm/modules/i86pc/sfx4500-disk/Makefile b/usr/src/cmd/fm/modules/i86pc/sfx4500-disk/Makefile
index f3a8b01a38..8da3c04e49 100644
--- a/usr/src/cmd/fm/modules/i86pc/sfx4500-disk/Makefile
+++ b/usr/src/cmd/fm/modules/i86pc/sfx4500-disk/Makefile
@@ -22,7 +22,7 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-#ident "%Z%%M% %I% %E% SMI"
+# ident "%Z%%M% %I% %E% SMI"
MODULE = sfx4500-disk
CLASS = arch
@@ -34,5 +34,5 @@ SRCS = sfx4500-disk.c diskmon_conf.c topo_gather.c \
include ../../Makefile.plugin
LINTFLAGS += -I. -I$(SRC)/lib/fm/topo/modules/i86pc/sata -L$(ROOT)/usr/lib/fm
CFLAGS += -I. -I$(SRC)/lib/fm/topo/modules/i86pc/sata
-LDLIBS += -lsysevent -lnvpair -lsmbios -ldl -lrt -lcfgadm -ltopo -luutil
+LDLIBS += -lsysevent -lnvpair -lsmbios -ldl -lcfgadm -ltopo -luutil
LDFLAGS += -L$(ROOT)/usr/lib/fm -R/usr/lib/fm
diff --git a/usr/src/cmd/fm/modules/sun4u/datapath-retire/Makefile b/usr/src/cmd/fm/modules/sun4u/datapath-retire/Makefile
index 040b4e5338..e7a58cc4d8 100644
--- a/usr/src/cmd/fm/modules/sun4u/datapath-retire/Makefile
+++ b/usr/src/cmd/fm/modules/sun4u/datapath-retire/Makefile
@@ -38,5 +38,3 @@ CDA_VERSION = "1.0"
INCDIRS = .
CPPFLAGS += $(INCDIRS:%=-I%) -DCDA_VERSION='$(CDA_VERSION)'
-
-LDLIBS += -lrt
diff --git a/usr/src/cmd/fm/modules/sun4v/cpumem-retire/Makefile b/usr/src/cmd/fm/modules/sun4v/cpumem-retire/Makefile
index 91e81799ca..76bd020411 100644
--- a/usr/src/cmd/fm/modules/sun4v/cpumem-retire/Makefile
+++ b/usr/src/cmd/fm/modules/sun4v/cpumem-retire/Makefile
@@ -22,7 +22,7 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-#ident "%Z%%M% %I% %E% SMI"
+# ident "%Z%%M% %I% %E% SMI"
MODULE = cpumem-retire
CLASS = arch
@@ -43,4 +43,4 @@ INCDIRS = . \
CPPFLAGS += $(INCDIRS:%=-I%) -DCMA_VERSION='$(CMA_VERSION)'
LDFLAGS += -R/usr/lib/fm
-LDLIBS += -L$(ROOTLIB)/fm -ltopo -lrt -lldom
+LDLIBS += -L$(ROOTLIB)/fm -ltopo -lldom
diff --git a/usr/src/cmd/fm/modules/sun4v/etm/Makefile b/usr/src/cmd/fm/modules/sun4v/etm/Makefile
index 6da80e63a5..35a58794ce 100644
--- a/usr/src/cmd/fm/modules/sun4v/etm/Makefile
+++ b/usr/src/cmd/fm/modules/sun4v/etm/Makefile
@@ -33,5 +33,5 @@ SRCS = etm.c etm_xport_api_dd.c
include ../../Makefile.plugin
CPPFLAGS += -I$(SRC)/uts/sun4v -I$(ROOT)/usr/platform/sun4v/include
-LDLIBS += -lrt -L$(ROOT)/usr/lib/fm -lldom
+LDLIBS += -L$(ROOT)/usr/lib/fm -lldom
LDFLAGS += -R/usr/lib/fm
diff --git a/usr/src/cmd/fm/schemes/mem/Makefile.com b/usr/src/cmd/fm/schemes/mem/Makefile.com
index bc1ca1a6bf..49e6a9ae0c 100644
--- a/usr/src/cmd/fm/schemes/mem/Makefile.com
+++ b/usr/src/cmd/fm/schemes/mem/Makefile.com
@@ -34,5 +34,3 @@ SRCS = \
mem_read.c \
mem_unum.c \
mem_util.c
-
-LDLIBS += -lrt
diff --git a/usr/src/cmd/fs.d/nfs/nfsmapid/Makefile b/usr/src/cmd/fs.d/nfs/nfsmapid/Makefile
index defc5fe500..b6a8658279 100644
--- a/usr/src/cmd/fs.d/nfs/nfsmapid/Makefile
+++ b/usr/src/cmd/fs.d/nfs/nfsmapid/Makefile
@@ -19,8 +19,8 @@
# CDDL HEADER END
#
#
-# Copyright 2006 Sun Microsystems, Inc.
-# All rights reserved. Use is subject to license terms.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
#
@@ -33,7 +33,7 @@ ATTMK = $(TYPEPROG)
include ../../Makefile.fstype
LDLIBS += -L$(ROOT)/usr/lib/nfs -R/usr/lib/nfs
-LDLIBS += -lnsl -lmapid -lrt -ldoor -ldtrace
+LDLIBS += -lnsl -lmapid -ldoor -ldtrace
SRCS = nfsmapid.c nfsmapid_server.c
DSRC = nfsmapid_dt.d
DOBJ = $(DSRC:%.d=%.o)
diff --git a/usr/src/cmd/fs.d/nfs/nfsstat/Makefile b/usr/src/cmd/fs.d/nfs/nfsstat/Makefile
index 9a6007c46f..1b3ed73df6 100644
--- a/usr/src/cmd/fs.d/nfs/nfsstat/Makefile
+++ b/usr/src/cmd/fs.d/nfs/nfsstat/Makefile
@@ -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.
@@ -20,11 +19,11 @@
# CDDL HEADER END
#
#
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.12 */
-#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
+# ident "%Z%%M% %I% %E% SMI"
+#
# cmd/fs.d/nfs/nfsstat/Makefile
PROG= nfsstat
@@ -36,7 +35,7 @@ COMMON= nfs_sec.o
OBJS= nfsstat.o $(COMMON)
SRCS= nfsstat.c ../lib/nfs_sec.c
-LDLIBS += -lkstat -lnsl -lrt
+LDLIBS += -lkstat -lnsl
$(PROG): $(OBJS)
$(LINK.c) -o $@ $(LDLIBS) $(OBJS)
diff --git a/usr/src/cmd/fs.d/ufs/mkfs/Makefile b/usr/src/cmd/fs.d/ufs/mkfs/Makefile
index ce73fdda24..a14f423d07 100644
--- a/usr/src/cmd/fs.d/ufs/mkfs/Makefile
+++ b/usr/src/cmd/fs.d/ufs/mkfs/Makefile
@@ -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.
@@ -20,9 +19,9 @@
# CDDL HEADER END
#
#
-#ident "%Z%%M% %I% %E% SMI"
+# ident "%Z%%M% %I% %E% SMI"
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
@@ -51,7 +50,7 @@ $(POFILE): $(SRCS)
$(RM) $(POFILE).i messages.po
CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-LDLIBS += -ladm -laio -lefi
+LDLIBS += -ladm -lefi
$(LIBPROG): $(OBJS)
$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
diff --git a/usr/src/cmd/intrstat/Makefile.com b/usr/src/cmd/intrstat/Makefile.com
index 7bec33d71d..7aeddc3caf 100644
--- a/usr/src/cmd/intrstat/Makefile.com
+++ b/usr/src/cmd/intrstat/Makefile.com
@@ -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.
@@ -20,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -34,7 +33,7 @@ include ../../Makefile.cmd
CFLAGS += $(CCVERBOSE)
CFLAGS64 += $(CCVERBOSE)
-LDLIBS += -ldtrace -lrt
+LDLIBS += -ldtrace
FILEMODE = 0555
GROUP = bin
diff --git a/usr/src/cmd/lockstat/Makefile.com b/usr/src/cmd/lockstat/Makefile.com
index 9a4131e876..fe4c39adbe 100644
--- a/usr/src/cmd/lockstat/Makefile.com
+++ b/usr/src/cmd/lockstat/Makefile.com
@@ -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.
@@ -20,10 +19,11 @@
# 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.
#
-#ident "%Z%%M% %I% %E% SMI"
+# ident "%Z%%M% %I% %E% SMI"
+#
PROG= lockstat
OBJS= lockstat.o sym.o
@@ -31,7 +31,7 @@ SRCS= $(OBJS:%.o=../%.c)
include ../../Makefile.cmd
-LDLIBS += -lelf -lkstat -ldtrace -lrt
+LDLIBS += -lelf -lkstat -ldtrace
CFLAGS += $(CCVERBOSE)
CFLAGS64 += $(CCVERBOSE)
LINTFLAGS += -xerroff=E_SEC_SPRINTF_UNBOUNDED_COPY
diff --git a/usr/src/cmd/perl/5.8.4/distrib/ext/Time/HiRes/hints/solaris.pl b/usr/src/cmd/perl/5.8.4/distrib/ext/Time/HiRes/hints/solaris.pl
deleted file mode 100644
index b19d149e70..0000000000
--- a/usr/src/cmd/perl/5.8.4/distrib/ext/Time/HiRes/hints/solaris.pl
+++ /dev/null
@@ -1,3 +0,0 @@
-# needs to explicitly link against librt to pull in nanosleep
-$self->{LIBS} = ['-lrt'];
-
diff --git a/usr/src/cmd/picl/plugins/sun4u/daktari/psvcplugin/Makefile b/usr/src/cmd/picl/plugins/sun4u/daktari/psvcplugin/Makefile
index dbeda01518..0a6a71d21c 100644
--- a/usr/src/cmd/picl/plugins/sun4u/daktari/psvcplugin/Makefile
+++ b/usr/src/cmd/picl/plugins/sun4u/daktari/psvcplugin/Makefile
@@ -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.
@@ -20,7 +19,7 @@
# 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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -60,7 +59,7 @@ LDLIBS += -L$(SRC)/cmd/picl/plugins/sun4u/psvc/psvcobj
LDLIBS += -L$(SRC)/cmd/picl/plugins/sun4u/psvc/psvcplugin
DYNFLAGS += -R$(DYNFLAGS_PLAT):$(DYNFLAGS_SUN4U):$(DYNFLAGS_COM)
-LDLIBS += -lc -lpicltree -lpicl -lrt -lpsvcobj -lpsvcplugin
+LDLIBS += -lc -lpicltree -lpicl -lpsvcobj -lpsvcplugin
LINTFLAGS +=
diff --git a/usr/src/cmd/picl/plugins/sun4u/daktari/psvcpolicy/Makefile b/usr/src/cmd/picl/plugins/sun4u/daktari/psvcpolicy/Makefile
index 0ece2694da..1d70cb512d 100644
--- a/usr/src/cmd/picl/plugins/sun4u/daktari/psvcpolicy/Makefile
+++ b/usr/src/cmd/picl/plugins/sun4u/daktari/psvcpolicy/Makefile
@@ -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.
@@ -20,7 +19,7 @@
# 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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -62,7 +61,7 @@ LDLIBS += -L$(SRC)/cmd/picl/plugins/sun4u/psvc/psvcobj
LDLIBS += -L$(SRC)/cmd/picl/plugins/sun4u/psvc/psvcplugin
DYNFLAGS += -R$(DYNFLAGS_PLAT):$(DYNFLAGS_SUN4U):$(DYNFLAGS_COM)
-LDLIBS += -lpicltree -lrt -lpsvcobj -lpsvcplugin
+LDLIBS += -lpicltree -lpsvcobj -lpsvcplugin
LDLIBS += -lc -ldevice -lcfgadm
LINTFLAGS +=
diff --git a/usr/src/cmd/picl/plugins/sun4u/psvc/psvcplugin/Makefile b/usr/src/cmd/picl/plugins/sun4u/psvc/psvcplugin/Makefile
index 2b9953bf00..dd0a15440a 100644
--- a/usr/src/cmd/picl/plugins/sun4u/psvc/psvcplugin/Makefile
+++ b/usr/src/cmd/picl/plugins/sun4u/psvc/psvcplugin/Makefile
@@ -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.
@@ -20,11 +19,11 @@
# CDDL HEADER END
#
#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
+# ident "%Z%%M% %I% %E% SMI"
+#
# cmd/picl/plugins/sun4u/psvc/psvcplugin/Makefile
#
LIBRARY= libpsvcplugin.a
@@ -80,7 +79,7 @@ LDLIBS += -L$(SRC)/lib/libpicl/$(MACH) -L$(SRC)/lib/libpicltree/$(MACH)
LDLIBS += -L $(ROOT)/usr/platform/$(PLATFORM)/lib
LDLIBS += -L$(SRC)/cmd/picl/plugins/sun4u/psvc/psvcobj
LDLIBS += -R/usr/platform/sun4u/lib
-LDLIBS += -lc -lpicltree -lpicl -lrt -lpsvcobj
+LDLIBS += -lc -lpicltree -lpicl -lpsvcobj
DYNFLAGS += -Wl,-f/usr/platform/\$$PLATFORM/lib/$(DYNLIBPSR)
LINTFLAGS +=
diff --git a/usr/src/cmd/picl/plugins/sun4u/snowbird/envmond/Makefile b/usr/src/cmd/picl/plugins/sun4u/snowbird/envmond/Makefile
index 013e9c3c88..1179ebfdcf 100644
--- a/usr/src/cmd/picl/plugins/sun4u/snowbird/envmond/Makefile
+++ b/usr/src/cmd/picl/plugins/sun4u/snowbird/envmond/Makefile
@@ -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.
@@ -20,7 +19,7 @@
# 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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -60,7 +59,7 @@ CLEANFILES = $(LINTOUT) $(LINTLIB)
LDLIBS += -L$(SRC)/lib/libptree/$(MACH)
LDLIBS += -L$(SRC)/cmd/picl/plugins/sun4u/snowbird/lib/libctsmc
-LDLIBS += -L$(ROOT)/usr/lib/picl/plugins -lrt -lc -lpicltree \
+LDLIBS += -L$(ROOT)/usr/lib/picl/plugins -lc -lpicltree \
-lpicl -lnvpair -lm -ldevinfo -lcfgadm \
-lpiclfrutree -lrcm -lctsmc
LDLIBS += -R/usr/platform/$(PLATFORM)/lib
diff --git a/usr/src/cmd/picl/plugins/sun4u/snowbird/watchdog/Makefile b/usr/src/cmd/picl/plugins/sun4u/snowbird/watchdog/Makefile
index 9cd83aa123..9961bdd915 100644
--- a/usr/src/cmd/picl/plugins/sun4u/snowbird/watchdog/Makefile
+++ b/usr/src/cmd/picl/plugins/sun4u/snowbird/watchdog/Makefile
@@ -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.
@@ -20,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -61,7 +60,7 @@ LDLIBS += -L $(ROOT)/usr/platform/$(PLATFORM)/lib
LDLIBS += -L$(ROOT_PLATFORM)/lib/picl/plugins
LDLIBS += -L$(SRC)/cmd/picl/plugins/sun4u/snowbird/lib/libctsmc
LDLIBS += -L$(ROOT)/usr/lib/picl/plugins -lnvpair -lpicltree
-LDLIBS += -ldevinfo -lctsmc -lpiclfrutree -lc -lrt
+LDLIBS += -ldevinfo -lctsmc -lpiclfrutree -lc
.KEEP_STATE:
diff --git a/usr/src/cmd/picl/plugins/sun4v/mdesc/Makefile b/usr/src/cmd/picl/plugins/sun4v/mdesc/Makefile
index 2fc2704617..e2adc58af5 100644
--- a/usr/src/cmd/picl/plugins/sun4v/mdesc/Makefile
+++ b/usr/src/cmd/picl/plugins/sun4v/mdesc/Makefile
@@ -85,7 +85,7 @@ LDLIBS += -L$(SRC)/lib/libpicl/$(MACH) -L$(SRC)/lib/libpicltree/$(MACH)
LDLIBS += -L$(ROOT)/usr/lib/picl/plugins -L$(ROOT)/usr/lib/sparcv9
DYNFLAGS += -R$(DYNFLAGS_COM)
-LDLIBS += -lc -lpicltree -ldevinfo -lrt -lpicldevtree -lcfgadm -lnvpair
+LDLIBS += -lc -lpicltree -ldevinfo -lpicldevtree -lcfgadm -lnvpair
LINTFLAGS += -erroff=E_BAD_PTR_CAST_ALIGN -v
diff --git a/usr/src/cmd/picl/plugins/sun4v/ontario/piclsbl/Makefile b/usr/src/cmd/picl/plugins/sun4v/ontario/piclsbl/Makefile
index ffdfafef68..5b30386427 100644
--- a/usr/src/cmd/picl/plugins/sun4v/ontario/piclsbl/Makefile
+++ b/usr/src/cmd/picl/plugins/sun4v/ontario/piclsbl/Makefile
@@ -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.
@@ -20,10 +19,10 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-#pragma ident "%Z%%M% %I% %E% SMI"
+# ident "%Z%%M% %I% %E% SMI"
#
# cmd/picl/plugins/sun4v/ontario/piclsbl/Makefile
@@ -71,7 +70,7 @@ LDLIBS += -L$(SRC)/lib/libpicl/$(MACH) -L$(SRC)/lib/libpicltree/$(MACH)
LDLIBS += -L$(ROOT)/usr/lib/picl/plugins
DYNFLAGS += -R$(DYNFLAGS_COM)
-LDLIBS += -lc -lpicltree -lrt -lumem -lnvpair
+LDLIBS += -lc -lpicltree -lumem -lnvpair
LINTFLAGS += -erroff=E_BAD_PTR_CAST_ALIGN -v
diff --git a/usr/src/cmd/rcap/rcapd/Makefile.rcapd b/usr/src/cmd/rcap/rcapd/Makefile.rcapd
index 3c020f271f..5fd0d01416 100644
--- a/usr/src/cmd/rcap/rcapd/Makefile.rcapd
+++ b/usr/src/cmd/rcap/rcapd/Makefile.rcapd
@@ -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.
@@ -20,7 +19,7 @@
# 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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -54,7 +53,7 @@ LINTSRCS = ../rcapd_main.c \
$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
CPPFLAGS += -DDEBUG_MSG
CPPFLAGS += -I$(COMMON_DIR)
-LDLIBS += -lkstat -ll -lproc -lproject -lrt -lumem
+LDLIBS += -lkstat -ll -lproc -lproject -lumem
LDLIBS += $(EXTRA_LDLIBS)
LINTFLAGS += -u
diff --git a/usr/src/cmd/rcm_daemon/Makefile.com b/usr/src/cmd/rcm_daemon/Makefile.com
index 399dab44be..a25a4d32c2 100644
--- a/usr/src/cmd/rcm_daemon/Makefile.com
+++ b/usr/src/cmd/rcm_daemon/Makefile.com
@@ -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.
@@ -111,7 +110,7 @@ SUNW_network_rcm.so := LDLIBS_MODULES += -L$(ROOT)/lib -llaadm
SUNW_ip_rcm.so := LDLIBS_MODULES += -L$(ROOT)/lib -linetutil
SUNW_ip_anon_rcm.so := LDLIBS_MODULES += -L$(ROOT)/lib -linetutil
-LDLIBS += -lgen -lelf -lcmd -lrcm -lnvpair -ldevinfo -lnsl -lsocket -lrt
+LDLIBS += -lgen -lelf -lcmd -lrcm -lnvpair -ldevinfo -lnsl -lsocket
SRCS = $(RCM_SRC) $(COMMON_MOD_SRC)
diff --git a/usr/src/cmd/scadm/sparc/mpxu/Makefile b/usr/src/cmd/scadm/sparc/mpxu/Makefile
index a865d221b5..05b76975bf 100644
--- a/usr/src/cmd/scadm/sparc/mpxu/Makefile
+++ b/usr/src/cmd/scadm/sparc/mpxu/Makefile
@@ -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.
@@ -20,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -45,7 +44,7 @@ include $(SRCDIR)/Makefile.com
CFLAGS += -R /usr/platform/$(PLATFORM)/lib
LDLIBS += -L$(ROOT)/usr/platform/$(PLATFORM)/lib
-LDLIBS += -lrsc -lcurses -lrt
+LDLIBS += -lrsc -lcurses
LINTFLAGS += -u
.KEEP_STATE:
diff --git a/usr/src/cmd/stat/iostat/Makefile b/usr/src/cmd/stat/iostat/Makefile
index 54c8ae6540..a73b220be1 100644
--- a/usr/src/cmd/stat/iostat/Makefile
+++ b/usr/src/cmd/stat/iostat/Makefile
@@ -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.
@@ -20,10 +19,10 @@
# 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.
#
-#ident "%Z%%M% %I% %E% SMI"
+# ident "%Z%%M% %I% %E% SMI"
#
PROG = iostat
@@ -33,7 +32,7 @@ SRCS =$(OBJS:%.o=%.c) $(COMMON_SRCS)
include $(SRC)/cmd/Makefile.cmd
include $(SRC)/cmd/stat/Makefile.stat
-LDLIBS += -lkstat -ldevinfo -lrt
+LDLIBS += -lkstat -ldevinfo
CFLAGS += $(CCVERBOSE) -I${STATCOMMONDIR}
FILEMODE= 0555
GROUP= bin
diff --git a/usr/src/cmd/trapstat/sun4u/Makefile b/usr/src/cmd/trapstat/sun4u/Makefile
index bd1aa80f00..79d0e7a86c 100644
--- a/usr/src/cmd/trapstat/sun4u/Makefile
+++ b/usr/src/cmd/trapstat/sun4u/Makefile
@@ -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.
@@ -20,10 +19,10 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-#ident "%Z%%M% %I% %E% SMI"
+# ident "%Z%%M% %I% %E% SMI"
#
PLATFORM = sun4u
@@ -39,7 +38,6 @@ OBJS= trapstat.o
SRCS= $(OBJS:%.o=$(SRCDIR)/%.c)
CFLAGS += $(CCVERBOSE)
-LDLIBS += -lrt
IFLAGS = -I$(USR_PSM_INCL_DIR)
CPPFLAGS += $(IFLAGS) $(ARCHOPTS)
LINTFLAGS += $(LDLIBS) -u
diff --git a/usr/src/cmd/trapstat/sun4v/Makefile b/usr/src/cmd/trapstat/sun4v/Makefile
index 05c0aa5a97..c82cf45905 100644
--- a/usr/src/cmd/trapstat/sun4v/Makefile
+++ b/usr/src/cmd/trapstat/sun4v/Makefile
@@ -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.
@@ -20,10 +19,10 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-#ident "%Z%%M% %I% %E% SMI"
+# ident "%Z%%M% %I% %E% SMI"
#
PLATFORM = sun4v
@@ -39,7 +38,6 @@ OBJS= trapstat.o
SRCS= $(OBJS:%.o=$(SRCDIR)/%.c)
CFLAGS += -v -Dsun4v
-LDLIBS += -lrt
IFLAGS = -I$(USR_PSM_INCL_DIR)
CPPFLAGS += $(IFLAGS) $(ARCHOPTS) -Dsun4v
LINTFLAGS += $(LDLIBS) -u
diff --git a/usr/src/cmd/truss/systable.c b/usr/src/cmd/truss/systable.c
index d6779c63d7..7c2ce826b9 100644
--- a/usr/src/cmd/truss/systable.c
+++ b/usr/src/cmd/truss/systable.c
@@ -18,6 +18,7 @@
*
* CDDL HEADER END
*/
+
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
@@ -415,7 +416,7 @@ const struct systable systable[] = {
{"processor_bind", 4, DEC, NOV, IDT, DEC, DEC, HEX}, /* 187 */
{"processor_info", 2, DEC, NOV, DEC, HEX}, /* 188 */
{"p_online", 2, DEC, NOV, DEC, DEC}, /* 189 */
-{"sigqueue", 4, DEC, NOV, DEC, SIG, HEX, SQC}, /* 190 */
+{"sigqueue", 5, DEC, NOV, DEC, SIG, HEX, SQC, DEC}, /* 190 */
{"clock_gettime", 2, DEC, NOV, DEC, HEX}, /* 191 */
{"clock_settime", 2, DEC, NOV, DEC, HEX}, /* 192 */
{"clock_getres", 2, DEC, NOV, DEC, HEX}, /* 193 */
diff --git a/usr/src/cmd/xntpd/Makefile.cmd b/usr/src/cmd/xntpd/Makefile.cmd
index 1066b30dca..6ff5f300d1 100644
--- a/usr/src/cmd/xntpd/Makefile.cmd
+++ b/usr/src/cmd/xntpd/Makefile.cmd
@@ -1,11 +1,11 @@
#
-#ident "%Z%%M% %I% %E% SMI"
-#
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
+# ident "%Z%%M% %I% %E% SMI"
+#
-LIBS = -lsocket -lnsl -lrt -lmd
+LIBS = -lsocket -lnsl -lmd
LIBNTP_A= libntp/libntp.a
LIBPARSE_A= libparse/libparse.a
diff --git a/usr/src/lib/Makefile b/usr/src/lib/Makefile
index 8ab84c0df2..fd687773f4 100644
--- a/usr/src/lib/Makefile
+++ b/usr/src/lib/Makefile
@@ -292,7 +292,7 @@ sparc_MSGSUBDIRS= \
libprtdiag \
libprtdiag_psr
-HDRSUBDIRS= libaio \
+HDRSUBDIRS= \
auditd_plugins \
libbsm \
libc \
@@ -459,7 +459,6 @@ libmacadm: libdevinfo
libuuid: libsocket
libinetutil: libsocket
libsecdb: libcmd libnsl
-librt: libaio libmd
libsasl: libgss libsocket pkcs11 libmd
sasl_plugins: pkcs11 libgss libsocket libsasl
libsctp: libsocket
diff --git a/usr/src/lib/common/inc/c_synonyms.h b/usr/src/lib/common/inc/c_synonyms.h
index 2143bb8d06..b101e1c918 100644
--- a/usr/src/lib/common/inc/c_synonyms.h
+++ b/usr/src/lib/common/inc/c_synonyms.h
@@ -187,6 +187,10 @@ extern "C" {
#define chown _chown
#define chroot _chroot
#define _cladm __cladm
+#define clock_getres _clock_getres
+#define clock_gettime _clock_gettime
+#define clock_nanosleep _clock_nanosleep
+#define clock_settime _clock_settime
#define close _close
#define closedir _closedir
#define closefrom _closefrom
@@ -416,7 +420,6 @@ extern "C" {
#define issetugid _issetugid
#define is_system_labeled _is_system_labeled
#define jrand48 _jrand48
-#define kaio _kaio
#define kill _kill
#define l64a _l64a
#define ladd _ladd
@@ -512,6 +515,7 @@ extern "C" {
#define mutex_trylock __mutex_trylock
#define _mutex_unlock __mutex_unlock
#define mutex_unlock __mutex_unlock
+#define nanosleep _nanosleep
#define nfs_getfh _nfs_getfh
#define nfssvc _nfssvc
#define nftw _nftw
@@ -540,7 +544,6 @@ extern "C" {
#define port_alert _port_alert
#define port_associate _port_associate
#define port_create _port_create
-#define port_dispatch _port_dispatch
#define port_dissociate _port_dissociate
#define port_getn _port_getn
#define port_get _port_get
@@ -760,12 +763,23 @@ extern "C" {
#define sema_timedwait _sema_timedwait
#define sema_trywait _sema_trywait
#define sema_wait _sema_wait
+#define sem_close _sem_close
#define semctl64 _semctl64
#define semctl _semctl
+#define sem_destroy _sem_destroy
#define semget _semget
+#define sem_getvalue _sem_getvalue
#define semids _semids
+#define sem_init _sem_init
+#define sem_open _sem_open
#define semop _semop
+#define sem_post _sem_post
+#define sem_reltimedwait_np _sem_reltimedwait_np
#define semtimedop _semtimedop
+#define sem_timedwait _sem_timedwait
+#define sem_trywait _sem_trywait
+#define sem_unlink _sem_unlink
+#define sem_wait _sem_wait
#define setcontext _setcontext
#define setegid _setegid
#define setenv _setenv
@@ -794,7 +808,6 @@ extern "C" {
#define setustack _setustack
#define setutent _setutent
#define setutxent _setutxent
-#define s_fcntl _s_fcntl
#define sfconvert _sfconvert
#define sgconvert _sgconvert
#define shmat _shmat
@@ -821,12 +834,16 @@ extern "C" {
#define sigpause _sigpause
#define sigpending _sigpending
#define sigprocmask _sigprocmask
+#define sigqueue _sigqueue
#define sigrelse _sigrelse
#define sigsendset _sigsendset
#define sigsend _sigsend
#define sigsetjmp _sigsetjmp
#define sigset _sigset
+#define sigstack _sigstack
#define sigsuspend _sigsuspend
+#define sigtimedwait _sigtimedwait
+#define sigwaitinfo _sigwaitinfo
#define sigwait _sigwait
#define single_to_decimal _single_to_decimal
#define sleep _sleep
@@ -902,6 +919,11 @@ extern "C" {
#define thr_suspend _thr_suspend
#define thr_wait_mutator _thr_wait_mutator
#define thr_yield _thr_yield
+#define timer_create _timer_create
+#define timer_delete _timer_delete
+#define timer_getoverrun _timer_getoverrun
+#define timer_gettime _timer_gettime
+#define timer_settime _timer_settime
#define times _times
#define time _time
#define tmpnam_r _tmpnam_r
@@ -1011,6 +1033,7 @@ extern "C" {
#define tell64 _tell64
#define truncate64 _truncate64
#define ptrace _ptrace
+#define s_fcntl _s_fcntl
#define sys_errlist _sys_errlist
#define sys_nerr _sys_nerr
#endif /* !_LP64 */
diff --git a/usr/src/lib/efcode/engine/Makefile.com b/usr/src/lib/efcode/engine/Makefile.com
index fc8c6135b5..c28c95732f 100644
--- a/usr/src/lib/efcode/engine/Makefile.com
+++ b/usr/src/lib/efcode/engine/Makefile.com
@@ -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.
@@ -20,7 +19,7 @@
# 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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -34,5 +33,3 @@ OBJECTS = init.o interface.o signal.o forth.o fcode.o interp.o debug.o \
LIBRARY = fcode.a
include ../../Makefile.efcode
-
-LDLIBS += -lrt
diff --git a/usr/src/lib/libaio/Makefile b/usr/src/lib/libaio/Makefile
index cb0baf37ea..91de6ce168 100644
--- a/usr/src/lib/libaio/Makefile
+++ b/usr/src/lib/libaio/Makefile
@@ -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.
@@ -20,15 +19,15 @@
# CDDL HEADER END
#
#
-# Copyright 1997-2003 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
#
-include ../Makefile.lib
+include ../Makefile.lib
-SUBDIRS = $(MACH)
+SUBDIRS = $(MACH)
$(BUILD64)SUBDIRS += $(MACH64)
all := TARGET= all
@@ -39,41 +38,11 @@ lint := TARGET= lint
.KEEP_STATE:
-all clean clobber install: spec .WAIT $(SUBDIRS)
+all clean clobber install: $(SUBDIRS)
lint: $(SUBDIRS)
-LIBRARY= libaio.a
-XGETFLAGS= -a
-POFILE= $(LIBRARY:.a=.po)
-POFILES= generic.po
-
-# definitions for install_h target
-HDRS= asynch.h
-HDRDIR= .
-ROOTHDRDIR= $(ROOT)/usr/include/sys
-
-install_h: $(ROOTHDRS)
-
-check: $(CHECKHDRS)
-
-spec $(SUBDIRS): FRC
+$(SUBDIRS): FRC
@cd $@; pwd; $(MAKE) $(TARGET)
-_msg: $(MSGDOMAIN) $(POFILE)
- $(RM) $(MSGDOMAIN)/$(POFILE)
- $(CP) $(POFILE) $(MSGDOMAIN)
-
-$(POFILE): $(POFILES)
- $(RM) $@
- $(CAT) $(POFILES) > $@
-
-$(POFILES):
- $(RM) messages.po
- $(XGETTEXT) $(XGETFLAGS) *.[ch]* */*.[ch]*
- $(SED) -e '/^# msg/d' -e '/^domain/d' messages.po > $@
- $(RM) messages.po
-
FRC:
-
-include ../Makefile.targ
diff --git a/usr/src/lib/libaio/Makefile.com b/usr/src/lib/libaio/Makefile.com
index cef6f44b91..1842670697 100644
--- a/usr/src/lib/libaio/Makefile.com
+++ b/usr/src/lib/libaio/Makefile.com
@@ -25,50 +25,36 @@
# ident "%Z%%M% %I% %E% SMI"
#
-LIBRARY= libaio.a
-VERS= .1
-
-COBJS= aio.o \
- posix_aio.o \
- scalls.o \
- sig.o \
- subr.o \
- ma.o
-
-OBJECTS= $(COBJS) $(MOBJS)
+LIBRARY = libaio.a
+VERS = .1
include ../../Makefile.lib
include ../../Makefile.rootfs
-SRCS= $(COBJS:%.o=../common/%.c)
+MAPFILES= mapfile-vers $(MAPFILE-FLTR)
+MAPOPTS= $(MAPFILES:%=-M %)
+
+DYNFLAGS += -F libc.so.1 $(MAPOPTS)
LIBS = $(DYNLIB) $(LINTLIB)
-LDLIBS += -lc
-$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
SRCDIR = ../common
-MAPDIR = ../spec/$(TRANSMACH)
-SPECMAPFILE = $(MAPDIR)/mapfile
+$(LINTLIB) := SRCS = $(SRCDIR)/llib-laio
-# Setting LIBAIO_DEBUG = -DDEBUG (make LIBAIO_DEBUG=-DDEBUG ...)
-# enables ASSERT() checking and other verification in the library.
-# This is automatically enabled for DEBUG builds, not for non-debug builds.
-LIBAIO_DEBUG =
-$(NOT_RELEASE_BUILD)LIBAIO_DEBUG = -DDEBUG
-CFLAGS += $(CCVERBOSE)
-CPPFLAGS += $(LIBAIO_DEBUG) -D_REENTRANT -I.. -I$(SRCDIR) -I../../common/inc
+# Redefine shared object build rule to use $(LD) directly (this avoids .init
+# and .fini sections being added). Also, since there are no OBJECTS, turn
+# off CTF.
-DYNFLAGS += $(ZINTERPOSE)
+BUILD.SO= $(LD) -o $@ -G $(DYNFLAGS)
+CTFMERGE_LIB= :
.KEEP_STATE:
-all: $(LIBS) fnamecheck
+include ../../Makefile.targ
-lint: lintcheck
+all: $(LIBS)
-include ../../Makefile.targ
+lint:
-pics/%.o: $(MDIR)/%.s
- $(BUILD.s)
- $(POST_PROCESS_O)
+$(DYNLIB): $(MAPFILES)
diff --git a/usr/src/lib/libaio/amd64/Makefile b/usr/src/lib/libaio/amd64/Makefile
index cb39a2beff..249f249362 100644
--- a/usr/src/lib/libaio/amd64/Makefile
+++ b/usr/src/lib/libaio/amd64/Makefile
@@ -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.
@@ -20,7 +19,7 @@
# 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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -29,4 +28,6 @@
include ../Makefile.com
include ../../Makefile.lib.64
-install: all $(ROOTLIBS64) $(ROOTLINKS64)
+BUILD.SO= $(LD) -o $@ -G -64 $(DYNFLAGS)
+
+install: all $(ROOTLIBDIR64) .WAIT $(ROOTLIBS64) $(ROOTLINKS64)
diff --git a/usr/src/lib/libaio/spec/versions b/usr/src/lib/libaio/amd64/mapfile-vers
index fd8cb78ec8..f2ab03aef4 100644
--- a/usr/src/lib/libaio/spec/versions
+++ b/usr/src/lib/libaio/amd64/mapfile-vers
@@ -1,13 +1,9 @@
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
# 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.
@@ -22,34 +18,44 @@
#
# CDDL HEADER END
#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
# ident "%Z%%M% %I% %E% SMI"
#
-i386 {
- SUNW_1.1: {SUNW_1.0};
- SUNW_1.0: {SUNW_0.7};
- SUNW_0.7;
- SUNWprivate_1.1;
-}
+#
+# DO NOT TOUCH THIS FILE.
+# This file declares interfaces that are cast in stone.
+# They offer interfaces that will never change.
+# DO NOT TOUCH THIS FILE.
+#
-sparc {
- SUNW_1.1: {SUNW_1.0};
- SUNW_1.0: {SUNW_0.7};
- SUNW_0.7: {SISCD_2.3};
- SISCD_2.3;
- SUNWprivate_1.1;
-}
+SUNW_1.1 {
+ global:
+ assfail = FUNCTION;
+ local:
+ *;
+} SUNW_1.0;
-sparcv9 {
- SUNW_1.1: {SUNW_1.0};
- SUNW_1.0: {SUNW_0.7};
+SUNW_1.0 {
+ global:
SUNW_1.0;
- SUNWprivate_1.1;
-}
+} SUNW_0.7;
-amd64 {
- SUNW_1.1: {SUNW_1.0};
- SUNW_1.0: {SUNW_0.7};
- SUNW_1.0;
- SUNWprivate_1.1;
-}
+SUNW_0.7 {
+ global:
+ aiocancel = FUNCTION;
+ aioread = FUNCTION;
+ aiowait = FUNCTION;
+ aiowrite = FUNCTION;
+ close = FUNCTION;
+ fork = FUNCTION;
+ sigaction = FUNCTION;
+};
+
+SUNWprivate_1.1 {
+ global:
+ _sigaction = FUNCTION;
+};
diff --git a/usr/src/lib/libaio/common/llib-laio b/usr/src/lib/libaio/common/llib-laio
index e3737a4b41..02d00ba1db 100644
--- a/usr/src/lib/libaio/common/llib-laio
+++ b/usr/src/lib/libaio/common/llib-laio
@@ -19,58 +19,27 @@
* CDDL HEADER END
*/
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
+/* LINTLIBRARY */
+/* PROTOLIB1 */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <signal.h>
-#include <libaio.h>
+#pragma ident "%Z%%M% %I% %E% SMI"
-/*
- * usr/src/lib/libaio/common
- */
+#include <sys/asynch.h>
-/* aio.c */
int aioread(int fd, caddr_t buf, int bufsz, off_t offset, int whence,
aio_result_t *resultp);
int aiowrite(int fd, caddr_t buf, int bufsz, off_t offset, int whence,
aio_result_t *resultp);
+#if !defined(_LP64)
int aioread64(int fd, caddr_t buf, int bufsz, off64_t offset, int whence,
aio_result_t *resultp);
int aiowrite64(int fd, caddr_t buf, int bufsz, off64_t offset, int whence,
aio_result_t *resultp);
+#endif /* !_LP64 */
int aiocancel(aio_result_t *resultp);
aio_result_t *aiowait(struct timeval *uwait);
-
-/* scalls.c */
-int _libaio_close(int fd);
-
-/* posix_aio.c */
-int __aio_read(aiocb_t *cb);
-int __aio_write(aiocb_t *cb);
-int __lio_listio(int mode, aiocb_t * const list[],
- int nent, struct sigevent *sig);
-int __aio_suspend(void **list, int nent, const timespec_t *timo, int lf);
-int __aio_error(aiocb_t *cb);
-ssize_t __aio_return(aiocb_t *cb);
-int __aio_fsync(int op, aiocb_t *aiocbp);
-int __aio_cancel(int fd, aiocb_t *aiocbp);
-int __aio_waitn(void **list, uint_t nent, uint_t *nwait,
- const struct timespec *timeout);
-int __aio_read64(aiocb64_t *cb);
-int __aio_write64(aiocb64_t *cb);
-int __lio_listio64(int mode, aiocb64_t *const list[],
- int nent, struct sigevent *sig);
-int __aio_error64(aiocb64_t *cb);
-ssize_t __aio_return64(aiocb64_t *cb);
-int __aio_fsync64(int op, aiocb64_t *aiocbp);
-int __aio_cancel64(int fd, aiocb64_t *aiocbp);
diff --git a/usr/src/lib/libaio/common/scalls.c b/usr/src/lib/libaio/common/scalls.c
deleted file mode 100644
index adb7cdceb5..0000000000
--- a/usr/src/lib/libaio/common/scalls.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * 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.
- * 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 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#pragma weak close = _libaio_close
-
-#include "libaio.h"
-
-extern void _cancel_prologue(void);
-extern void _cancel_epilogue(void);
-
-int
-_libaio_close(int fd)
-{
- int rc;
-
- /*
- * Cancel all outstanding aio requests for this file descriptor.
- */
- if (fd >= 0 && __uaio_ok)
- (void) aiocancel_all(fd);
- /*
- * If we have allocated the bit array, clear the bit for this file.
- * The next open may re-use this file descriptor and the new file
- * may have different kaio() behaviour.
- */
- if (_kaio_supported != NULL)
- CLEAR_KAIO_SUPPORTED(fd);
-
- _cancel_prologue();
- rc = _close(fd);
- _cancel_epilogue();
-
- return (rc);
-}
diff --git a/usr/src/lib/libaio/common/sig.c b/usr/src/lib/libaio/common/sig.c
deleted file mode 100644
index ea75bf9513..0000000000
--- a/usr/src/lib/libaio/common/sig.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * 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.
- * 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 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "libaio.h"
-
-void
-sig_mutex_lock(mutex_t *mp)
-{
- _sigoff();
- (void) mutex_lock(mp);
-}
-
-void
-sig_mutex_unlock(mutex_t *mp)
-{
- (void) mutex_unlock(mp);
- _sigon();
-}
-
-int
-sig_mutex_trylock(mutex_t *mp)
-{
- int error;
-
- _sigoff();
- if ((error = mutex_trylock(mp)) != 0)
- _sigon();
- return (error);
-}
-
-/*
- * sig_cond_wait() is a cancellation point.
- */
-int
-sig_cond_wait(cond_t *cv, mutex_t *mp)
-{
- int error;
-
- pthread_testcancel();
- error = cond_wait(cv, mp);
- if (error == EINTR && _sigdeferred() != 0) {
- sig_mutex_unlock(mp);
- /* take the deferred signal here */
- sig_mutex_lock(mp);
- }
- pthread_testcancel();
- return (error);
-}
-
-/*
- * sig_cond_reltimedwait() is a cancellation point.
- */
-int
-sig_cond_reltimedwait(cond_t *cv, mutex_t *mp, const timespec_t *ts)
-{
- int error;
-
- pthread_testcancel();
- error = cond_reltimedwait(cv, mp, ts);
- if (error == EINTR && _sigdeferred() != 0) {
- sig_mutex_unlock(mp);
- /* take the deferred signal here */
- sig_mutex_lock(mp);
- }
- pthread_testcancel();
- return (error);
-}
-
-int
-_aio_create_worker(aio_req_t *reqp, int mode)
-{
- aio_worker_t *aiowp, **workers, **nextworker;
- int *aio_workerscnt;
- void *(*func)(void *);
- sigset_t oset;
- int error;
-
- /*
- * Put the new worker thread in the right queue.
- */
- switch (mode) {
- case AIOREAD:
- case AIOWRITE:
- case AIOAREAD:
- case AIOAWRITE:
-#if !defined(_LP64)
- case AIOAREAD64:
- case AIOAWRITE64:
-#endif
- workers = &__workers_rw;
- nextworker = &__nextworker_rw;
- aio_workerscnt = &__rw_workerscnt;
- func = _aio_do_request;
- break;
- case AIONOTIFY:
- workers = &__workers_no;
- nextworker = &__nextworker_no;
- func = _aio_do_notify;
- aio_workerscnt = &__no_workerscnt;
- break;
- default:
- _aiopanic("_aio_create_worker: invalid mode");
- break;
- }
-
- if ((aiowp = _aio_worker_alloc()) == NULL)
- return (-1);
-
- if (reqp) {
- reqp->req_state = AIO_REQ_QUEUED;
- reqp->req_worker = aiowp;
- aiowp->work_head1 = reqp;
- aiowp->work_tail1 = reqp;
- aiowp->work_next1 = reqp;
- aiowp->work_count1 = 1;
- aiowp->work_minload1 = 1;
- }
-
- (void) pthread_sigmask(SIG_SETMASK, &_full_set, &oset);
- error = thr_create(NULL, AIOSTKSIZE, func, aiowp,
- THR_DAEMON | THR_SUSPENDED, &aiowp->work_tid);
- (void) pthread_sigmask(SIG_SETMASK, &oset, NULL);
- if (error) {
- if (reqp) {
- reqp->req_state = 0;
- reqp->req_worker = NULL;
- }
- _aio_worker_free(aiowp);
- return (-1);
- }
-
- sig_mutex_lock(&__aio_mutex);
- (*aio_workerscnt)++;
- if (*workers == NULL) {
- aiowp->work_forw = aiowp;
- aiowp->work_backw = aiowp;
- *nextworker = aiowp;
- *workers = aiowp;
- } else {
- aiowp->work_backw = (*workers)->work_backw;
- aiowp->work_forw = (*workers);
- (*workers)->work_backw->work_forw = aiowp;
- (*workers)->work_backw = aiowp;
- }
- _aio_worker_cnt++;
- sig_mutex_unlock(&__aio_mutex);
-
- (void) thr_continue(aiowp->work_tid);
-
- return (0);
-}
-
-/*
- * This is the application's AIOSIGCANCEL sigaction setting.
- */
-static struct sigaction sigcanact;
-
-/*
- * This is our AIOSIGCANCEL handler.
- * If the signal is not meant for us, call the application's handler.
- */
-void
-aiosigcancelhndlr(int sig, siginfo_t *sip, void *uap)
-{
- aio_worker_t *aiowp;
- void (*func)(int, siginfo_t *, void *);
-
- if (sip != NULL && sip->si_code == SI_LWP &&
- (aiowp = pthread_getspecific(_aio_key)) != NULL) {
- /*
- * Only aio worker threads get here (with aiowp != NULL).
- */
- siglongjmp(aiowp->work_jmp_buf, 1);
- } else if (sigcanact.sa_handler != SIG_IGN &&
- sigcanact.sa_handler != SIG_DFL) {
- /*
- * Call the application signal handler.
- */
- func = sigcanact.sa_sigaction;
- if (sigcanact.sa_flags & SA_RESETHAND)
- sigcanact.sa_handler = SIG_DFL;
- if (!(sigcanact.sa_flags & SA_SIGINFO))
- sip = NULL;
- (void) func(sig, sip, uap);
- }
- /*
- * SIGLWP is ignored by default.
- */
-}
-
-/* consolidation private interface in libc */
-extern int _libc_sigaction(int sig, const struct sigaction *act,
- struct sigaction *oact);
-
-#pragma weak sigaction = _sigaction
-int
-_sigaction(int sig, const struct sigaction *nact, struct sigaction *oact)
-{
- struct sigaction tact;
- struct sigaction oldact;
-
- /*
- * We detect SIGIO just to set the _sigio_enabled flag.
- */
- if (sig == SIGIO && nact != NULL)
- _sigio_enabled =
- (nact->sa_handler != SIG_DFL &&
- nact->sa_handler != SIG_IGN);
-
- /*
- * We interpose on SIGAIOCANCEL (aka SIGLWP). Although SIGLWP
- * is a 'reserved' signal that no application should be using, we
- * honor the application's handler (see aiosigcancelhndlr(), above).
- */
- if (sig == SIGAIOCANCEL) {
- oldact = sigcanact;
- if (nact != NULL) {
- sigcanact = tact = *nact;
- if (tact.sa_handler == SIG_DFL ||
- tact.sa_handler == SIG_IGN) {
- tact.sa_flags = SA_SIGINFO;
- (void) sigemptyset(&tact.sa_mask);
- } else {
- tact.sa_flags |= SA_SIGINFO;
- tact.sa_flags &= ~(SA_NODEFER | SA_RESETHAND);
- }
- tact.sa_sigaction = aiosigcancelhndlr;
- if (_libc_sigaction(sig, &tact, NULL) == -1) {
- sigcanact = oldact;
- return (-1);
- }
- }
- if (oact)
- *oact = oldact;
- return (0);
- }
-
- /*
- * Everything else, just call the real sigaction().
- */
- return (_libc_sigaction(sig, nact, oact));
-}
-
-void
-init_signals(void)
-{
- struct sigaction act;
-
- /*
- * See if the application has set up a handler for SIGIO.
- */
- (void) _libc_sigaction(SIGIO, NULL, &act);
- _sigio_enabled =
- (act.sa_handler != SIG_DFL && act.sa_handler != SIG_IGN);
-
- /*
- * Arrange to catch SIGAIOCANCEL (SIGLWP).
- * If the application has already set up a handler, preserve it.
- */
- (void) _libc_sigaction(SIGAIOCANCEL, NULL, &sigcanact);
- act = sigcanact;
- if (act.sa_handler == SIG_DFL || act.sa_handler == SIG_IGN) {
- act.sa_flags = SA_SIGINFO;
- (void) sigemptyset(&act.sa_mask);
- } else {
- act.sa_flags |= SA_SIGINFO;
- act.sa_flags &= ~(SA_NODEFER | SA_RESETHAND);
- }
- act.sa_sigaction = aiosigcancelhndlr;
- (void) _libc_sigaction(SIGAIOCANCEL, &act, NULL);
-}
diff --git a/usr/src/lib/libaio/common/subr.c b/usr/src/lib/libaio/common/subr.c
deleted file mode 100644
index add99471d4..0000000000
--- a/usr/src/lib/libaio/common/subr.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * 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.
- * 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 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "libaio.h"
-
-void
-_aiopanic(char *s)
-{
- sigset_t sigmask;
- char buf[256];
-
- (void) snprintf(buf, sizeof (buf),
- "AIO PANIC (thread = %d): %s\n", thr_self(), s);
- (void) write(2, buf, strlen(buf));
- (void) sigset(SIGABRT, SIG_DFL);
- (void) sigemptyset(&sigmask);
- (void) sigaddset(&sigmask, SIGABRT);
- (void) sigprocmask(SIG_UNBLOCK, &sigmask, NULL);
- (void) thr_kill(thr_self(), SIGABRT);
- (void) kill(getpid(), SIGABRT);
- _exit(127);
-}
-
-int
-assfail(char *a, char *f, int l)
-{
- char buf[256];
-
- (void) snprintf(buf, sizeof (buf),
- "assertion failed: %s, file: %s, line:%d", a, f, l);
- _aiopanic(buf);
- return (0);
-}
diff --git a/usr/src/lib/libaio/i386/Makefile b/usr/src/lib/libaio/i386/Makefile
index af76f5ab90..b3157e385b 100644
--- a/usr/src/lib/libaio/i386/Makefile
+++ b/usr/src/lib/libaio/i386/Makefile
@@ -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.
@@ -20,7 +19,7 @@
# 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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -28,4 +27,4 @@
include ../Makefile.com
-install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
+install: all $(ROOTLIBDIR) .WAIT $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/usr/src/lib/libaio/common/Makefile b/usr/src/lib/libaio/i386/mapfile-vers
index 5a58f96bc0..606354068a 100644
--- a/usr/src/lib/libaio/common/Makefile
+++ b/usr/src/lib/libaio/i386/mapfile-vers
@@ -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.
@@ -20,30 +19,44 @@
# 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.
#
# ident "%Z%%M% %I% %E% SMI"
#
-# lib/libaio/common/Makefile
-LINTSRC32= lintsrc32
-LINTOUT32= lint32.out
-LINTLIB32= $(LIBNAME)32
-$(LINTSRC32):= LINTFLAGS +=
-
-LINTSRC64= lintsrc64
-LINTOUT64= lint64.out
-LINTLIB64= $(LIBNAME)64
-$(LINTSRC64):= LINTFLAGS64 += -fd -Xtransition=yes
-
-lints : $(LINTSRC32) $(LINTSRC64)
+#
+# DO NOT TOUCH THIS FILE.
+# This file declares interfaces that are cast in stone.
+# They offer interfaces that will never change.
+# DO NOT TOUCH THIS FILE.
+#
-$(LINTSRC32): $$(SRCS)
- $(LINT.c) -o $(LINTLIB32) $(SRCS) > $(LINTOUT32) 2>&1
+SUNW_1.1 {
+ global:
+ assfail = FUNCTION;
+ local:
+ *;
+} SUNW_1.0;
-$(LINTSRC64): $$(SRCS)
- $(LINT64.c) -o $(LINTLIB64) $(SRCS) > $(LINTOUT64) 2>&1
+SUNW_1.0 {
+ global:
+ aioread64 = FUNCTION;
+ aiowrite64 = FUNCTION;
+} SUNW_0.7;
-include ../Makefile.com
+SUNW_0.7 {
+ global:
+ aiocancel = FUNCTION;
+ aioread = FUNCTION;
+ aiowait = FUNCTION;
+ aiowrite = FUNCTION;
+ close = FUNCTION;
+ fork = FUNCTION;
+ sigaction = FUNCTION;
+};
+SUNWprivate_1.1 {
+ global:
+ _sigaction = FUNCTION;
+};
diff --git a/usr/src/lib/libaio/sparc/Makefile b/usr/src/lib/libaio/sparc/Makefile
index af76f5ab90..b3157e385b 100644
--- a/usr/src/lib/libaio/sparc/Makefile
+++ b/usr/src/lib/libaio/sparc/Makefile
@@ -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.
@@ -20,7 +19,7 @@
# 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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -28,4 +27,4 @@
include ../Makefile.com
-install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
+install: all $(ROOTLIBDIR) .WAIT $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/usr/src/lib/libaio/sparc/mapfile-vers b/usr/src/lib/libaio/sparc/mapfile-vers
new file mode 100644
index 0000000000..fd7a0afe13
--- /dev/null
+++ b/usr/src/lib/libaio/sparc/mapfile-vers
@@ -0,0 +1,66 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# 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.
+# 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 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+#
+# DO NOT TOUCH THIS FILE.
+# This file declares interfaces that are cast in stone.
+# They offer interfaces that will never change.
+# DO NOT TOUCH THIS FILE.
+#
+
+SUNW_1.1 {
+ global:
+ assfail = FUNCTION;
+ local:
+ *;
+} SUNW_1.0;
+
+SUNW_1.0 {
+ global:
+ aioread64 = FUNCTION;
+ aiowrite64 = FUNCTION;
+} SUNW_0.7;
+
+SUNW_0.7 {
+ global:
+ close = FUNCTION;
+ fork = FUNCTION;
+ sigaction = FUNCTION;
+} SISCD_2.3;
+
+SISCD_2.3 {
+ global:
+ aiocancel = FUNCTION;
+ aioread = FUNCTION;
+ aiowait = FUNCTION;
+ aiowrite = FUNCTION;
+};
+
+SUNWprivate_1.1 {
+ global:
+ _sigaction = FUNCTION;
+};
diff --git a/usr/src/lib/libaio/sparcv9/Makefile b/usr/src/lib/libaio/sparcv9/Makefile
index cb39a2beff..249f249362 100644
--- a/usr/src/lib/libaio/sparcv9/Makefile
+++ b/usr/src/lib/libaio/sparcv9/Makefile
@@ -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.
@@ -20,7 +19,7 @@
# 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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -29,4 +28,6 @@
include ../Makefile.com
include ../../Makefile.lib.64
-install: all $(ROOTLIBS64) $(ROOTLINKS64)
+BUILD.SO= $(LD) -o $@ -G -64 $(DYNFLAGS)
+
+install: all $(ROOTLIBDIR64) .WAIT $(ROOTLIBS64) $(ROOTLINKS64)
diff --git a/usr/src/lib/libaio/spec/amd64/Makefile b/usr/src/lib/libaio/sparcv9/mapfile-vers
index d334868181..f2ab03aef4 100644
--- a/usr/src/lib/libaio/spec/amd64/Makefile
+++ b/usr/src/lib/libaio/sparcv9/mapfile-vers
@@ -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.
@@ -20,25 +19,43 @@
# 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.
#
# ident "%Z%%M% %I% %E% SMI"
#
-.KEEP_STATE:
-
-include ../Makefile.targ
-
-# Add arch specific objects here
-OBJECTS +=
+#
+# DO NOT TOUCH THIS FILE.
+# This file declares interfaces that are cast in stone.
+# They offer interfaces that will never change.
+# DO NOT TOUCH THIS FILE.
+#
-include $(SRC)/lib/Makefile.lib
-include $(SRC)/lib/Makefile.lib.64
+SUNW_1.1 {
+ global:
+ assfail = FUNCTION;
+ local:
+ *;
+} SUNW_1.0;
-# Uncomment the following if the linker complains
-#amd64_C_PICFLAGS = $(amd64_C_BIGPICFLAGS)
+SUNW_1.0 {
+ global:
+ SUNW_1.0;
+} SUNW_0.7;
-include $(SRC)/lib/Makefile.spec
+SUNW_0.7 {
+ global:
+ aiocancel = FUNCTION;
+ aioread = FUNCTION;
+ aiowait = FUNCTION;
+ aiowrite = FUNCTION;
+ close = FUNCTION;
+ fork = FUNCTION;
+ sigaction = FUNCTION;
+};
-install: $(ROOTABILIB64)
+SUNWprivate_1.1 {
+ global:
+ _sigaction = FUNCTION;
+};
diff --git a/usr/src/lib/libaio/spec/Makefile b/usr/src/lib/libaio/spec/Makefile
deleted file mode 100644
index 1ab4a810d6..0000000000
--- a/usr/src/lib/libaio/spec/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# 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
-#
-#
-#ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright (c) 1998-1999 by Sun Microsystems, Inc.
-# All rights reserved.
-#
-# lib/libaio/spec/Makefile
-
-include $(SRC)/lib/Makefile.spec.arch
diff --git a/usr/src/lib/libaio/spec/Makefile.targ b/usr/src/lib/libaio/spec/Makefile.targ
deleted file mode 100644
index 5fd6ef49cf..0000000000
--- a/usr/src/lib/libaio/spec/Makefile.targ
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# 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
-#
-#
-#ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright (c) 1998-1999 by Sun Microsystems, Inc.
-# All rights reserved.
-#
-# lib/libaio/spec/Makefile.targ
-
-
-.KEEP_STATE:
-
-LIBRARY = libaio.a
-VERS = .1
-
-OBJECTS = aio.o
-
diff --git a/usr/src/lib/libaio/spec/aio.spec b/usr/src/lib/libaio/spec/aio.spec
deleted file mode 100644
index 336c8e682d..0000000000
--- a/usr/src/lib/libaio/spec/aio.spec
+++ /dev/null
@@ -1,202 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# 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.
-# 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 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-function aiocancel
-include <sys/asynch.h>, <aio.h>
-declaration int aiocancel(aio_result_t *resultp)
-version sparc=SISCD_2.3 sparcv9=SUNW_0.7 i386=SUNW_0.7 amd64=SUNW_0.7
-errno EACCES EFAULT EINVAL
-exception $return == -1
-end
-
-function aioread
-include <sys/types.h>, <sys/asynch.h>, <aio.h>
-declaration int aioread(int fildes, char *bufp, int bufs, \
- off_t offset, int whence, aio_result_t *resultp)
-version sparc=SISCD_2.3 sparcv9=SUNW_0.7 i386=SUNW_0.7 amd64=SUNW_0.7
-errno EAGAIN EBADF EFAULT EINVAL ENOMEM
-exception $return == -1
-end
-
-function aioread64
-declaration int aioread64(int fd, caddr_t buf, int bufsz, off64_t offset, \
- int whence, aio_result_t *resultp)
-arch i386 sparc
-version i386=SUNW_1.0 sparc=SUNW_1.0
-end
-
-function aiowait
-include <sys/asynch.h>, <aio.h>, <sys/time.h>
-declaration aio_result_t *aiowait(struct timeval *timeout)
-version sparc=SISCD_2.3 sparcv9=SUNW_0.7 i386=SUNW_0.7 amd64=SUNW_0.7
-errno EFAULT EINTR EINVAL
-exception $return == (aio_result_t *)-1
-end
-
-function aiowrite
-include <sys/types.h>, <sys/asynch.h>, <aio.h>
-declaration int aiowrite(int fildes, char *bufp, int bufs, \
- off_t offset, int whence, aio_result_t *resultp)
-version sparc=SISCD_2.3 sparcv9=SUNW_0.7 i386=SUNW_0.7 amd64=SUNW_0.7
-errno EAGAIN EBADF EFAULT EINVAL ENOMEM
-exception $return == -1
-end
-
-function aiowrite64
-include <sys/types.h>, <sys/asynch.h>, <aio.h>
-declaration int aiowrite64(int fildes, char *bufp, int bufs, \
- off64_t offset, int whence, aio_result_t *resultp)
-arch sparc i386
-version sparc=SUNW_1.0 i386=SUNW_1.0
-errno EAGAIN EBADF EFAULT EINVAL ENOMEM
-exception $return == -1
-end
-
-function assfail
-declaration int assfail(char *a, char *f, int l)
-version SUNW_1.1
-end
-
-function close
-include <unistd.h>
-declaration int close(int fildes)
-version SUNW_0.7
-errno EBADF EINTR ENOLINK EIO
-exception $return == -1
-binding nodirect
-end
-
-function fork
-version SUNW_0.7
-filter libc.so.1
-end
-
-function sigaction extends libc/spec/sys.spec sigaction
-version SUNW_0.7
-binding nodirect
-end
-
-function _sigaction
-weak sigaction
-version SUNWprivate_1.1
-binding nodirect
-end
-
-function __lio_listio
-declaration int __lio_listio(int mode, aiocb_t * const list[], int nent, \
- struct sigevent *sig)
-version SUNWprivate_1.1
-end
-
-function __aio_suspend
-declaration int __aio_suspend(void **list, int nent, \
- const timespec_t *timo, int largefile)
-version SUNWprivate_1.1
-end
-
-function __aio_error
-declaration int __aio_error(aiocb_t *cb)
-version SUNWprivate_1.1
-end
-
-function __aio_return
-declaration ssize_t __aio_return(aiocb_t *cb)
-version SUNWprivate_1.1
-end
-
-function __aio_read
-declaration int __aio_read(aiocb_t *cb)
-version SUNWprivate_1.1
-end
-
-function __aio_write
-declaration int __aio_write(aiocb_t *cb)
-version SUNWprivate_1.1
-end
-
-function __aio_fsync
-declaration int __aio_fsync(int op, aiocb_t *aiocbp)
-version SUNWprivate_1.1
-end
-
-function __aio_cancel
-declaration int __aio_cancel(int fd, aiocb_t *aiocbp)
-version SUNWprivate_1.1
-end
-
-function __aio_waitn
-declaration int __aio_waitn(void **list, uint_t nent, uint_t *nwait, \
- const struct timespec *timeout, int mode)
-version SUNWprivate_1.1
-end
-
-function __lio_listio64
-declaration int __lio_listio64(int mode, aiocb64_t * const list[], \
- int nent, struct sigevent *sig)
-arch sparc i386
-version sparc=SUNWprivate_1.1 i386=SUNWprivate_1.1
-end
-
-function __aio_error64
-declaration int __aio_error64(aiocb64_t *cb)
-arch sparc i386
-version sparc=SUNWprivate_1.1 i386=SUNWprivate_1.1
-end
-
-function __aio_return64
-declaration ssize_t __aio_return64(aiocb64_t *cb)
-arch sparc i386
-version sparc=SUNWprivate_1.1 i386=SUNWprivate_1.1
-end
-
-function __aio_read64
-declaration int __aio_read64(aiocb64_t *cb)
-arch sparc i386
-version sparc=SUNWprivate_1.1 i386=SUNWprivate_1.1
-end
-
-function __aio_write64
-declaration int __aio_write64(aiocb64_t *cb)
-arch sparc i386
-version sparc=SUNWprivate_1.1 i386=SUNWprivate_1.1
-end
-
-function __aio_fsync64
-declaration int __aio_fsync64(int op, aiocb64_t *aiocbp)
-arch sparc i386
-version sparc=SUNWprivate_1.1 i386=SUNWprivate_1.1
-end
-
-function __aio_cancel64
-declaration int __aio_cancel64(int fd, aiocb64_t *aiocbp)
-arch sparc i386
-version sparc=SUNWprivate_1.1 i386=SUNWprivate_1.1
-end
-
-function _libaio_close
-version SUNWprivate_1.1
-end
diff --git a/usr/src/lib/libaio/spec/i386/Makefile b/usr/src/lib/libaio/spec/i386/Makefile
deleted file mode 100644
index 19268499ce..0000000000
--- a/usr/src/lib/libaio/spec/i386/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# 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
-#
-#
-#ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright (c) 1998-1999 by Sun Microsystems, Inc.
-# All rights reserved.
-#
-# lib/libaio/spec/i386/Makefile
-
-.KEEP_STATE:
-
-include ../Makefile.targ
-
-# Add arch specific objects here
-OBJECTS +=
-
-include $(SRC)/lib/Makefile.lib
-
-# Uncomment the following if the linker complains
-#i386_C_PICFLAGS = -K PIC
-
-include $(SRC)/lib/Makefile.spec
-
-install: $(ROOTABILIB)
diff --git a/usr/src/lib/libaio/spec/sparc/Makefile b/usr/src/lib/libaio/spec/sparc/Makefile
deleted file mode 100644
index 9f95f97dc7..0000000000
--- a/usr/src/lib/libaio/spec/sparc/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# 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
-#
-#
-#ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright (c) 1998-1999 by Sun Microsystems, Inc.
-# All rights reserved.
-#
-# lib/libaio/spec/sparc/Makefile
-
-.KEEP_STATE:
-
-include ../Makefile.targ
-
-# Add arch specific objects here
-OBJECTS +=
-
-include $(SRC)/lib/Makefile.lib
-
-# Uncomment the following if the linker complains
-#sparc_C_PICFLAGS = -K PIC
-
-include $(SRC)/lib/Makefile.spec
-
-install: $(ROOTABILIB)
diff --git a/usr/src/lib/libaio/spec/sparcv9/Makefile b/usr/src/lib/libaio/spec/sparcv9/Makefile
deleted file mode 100644
index a90d93da31..0000000000
--- a/usr/src/lib/libaio/spec/sparcv9/Makefile
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# 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
-#
-#
-#ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright (c) 1998-1999 by Sun Microsystems, Inc.
-# All rights reserved.
-#
-# lib/libaio/spec/sparcv9/Makefile
-
-.KEEP_STATE:
-
-include ../Makefile.targ
-
-# Add arch specific objects here
-OBJECTS +=
-
-include $(SRC)/lib/Makefile.lib
-include $(SRC)/lib/Makefile.lib.64
-
-# Uncomment the following if the linker complains
-#sparcv9_C_PICFLAGS = -K PIC
-
-include $(SRC)/lib/Makefile.spec
-
-install: $(ROOTABILIB64)
diff --git a/usr/src/lib/libc/Makefile.targ b/usr/src/lib/libc/Makefile.targ
index e3bb69581a..26e8812bd7 100644
--- a/usr/src/lib/libc/Makefile.targ
+++ b/usr/src/lib/libc/Makefile.targ
@@ -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.
@@ -20,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -200,6 +199,21 @@ pics/%_c89.o: $(LIBCBASE)/../port/stdio/%.c
$(COMPILE.c) -o $@ $<
$(POST_PROCESS_O)
+# aio rules
+pics/%.o: $(LIBCBASE)/../port/aio/%.c
+ $(COMPILE.c) -o $@ $<
+ $(POST_PROCESS_O)
+
+# rt rules
+pics/%.o: $(LIBCBASE)/../port/rt/%.c
+ $(COMPILE.c) -o $@ $<
+ $(POST_PROCESS_O)
+
+# tpool rules
+pics/%.o: $(LIBCBASE)/../port/tpool/%.c
+ $(COMPILE.c) -o $@ $<
+ $(POST_PROCESS_O)
+
# threads rules
pics/%.o: $(LIBCBASE)/../port/threads/%.c
$(COMPILE.c) -o $@ $<
diff --git a/usr/src/lib/libc/README b/usr/src/lib/libc/README
index f3c5ab146d..289f766aef 100644
--- a/usr/src/lib/libc/README
+++ b/usr/src/lib/libc/README
@@ -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.
@@ -20,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -64,9 +63,12 @@ fork-safe) and in which the calling thread has all signals deferred
However, certain rules apply to the code within these critical regions:
- - The code must be of guaranteed short duration; no
- calls to interfaces that might block indefinitely are
- allowed. This means no calls into stdio or syslog().
+ - The code must be of guaranteed short duration; no calls
+ to interfaces that might block indefinitely are allowed.
+ This means no calls into stdio or syslog() and no calls
+ to cond_wait() unless there is a guarantee of an almost-
+ immediate call to cond_signal() or cond_broadcast()
+ from elsewhere.
- The code cannot call any non-l* synchronization
primitives (mutex_lock(), _private_mutex_lock(),
@@ -197,3 +199,40 @@ conditions such as the setting of CFLAGS and CPPFLAGS for the libc_i18n
stuff need to be compatible with the ones for the libc stuff. Whenever
changes that affect the compilation conditions of libc occur, the changes
should be propagated to libc_i18n.
+
+-----
+
+The putback of the project:
+ 6416832 libaio and librt can and should be folded into libc
+introduced several libc-private locking interfaces:
+ void sig_mutex_lock(mutex_t *);
+ void sig_mutex_unlock(mutex_t *);
+ int sig_mutex_trylock(mutex_t *);
+ int sig_cond_wait(cond_t *, mutex_t *);
+ int sig_cond_reltimedwait(cond_t *, mutex_t *, const timespec_t *);
+which are declared in both "thr_uberdata.h" and "mtlib.h".
+
+They are used in specialized code in libc, like the asynchronous i/o code.
+Unlike the lmutex_lock() and lmutex_unlock() interfaces described above,
+these interfaces do not define critical regions, but signals are
+deferred while locks acquired by these functions are held, making
+their use be async-signal safe. Calls to malloc(), calloc(), realloc(),
+and free() are permissible while holding such locks.
+
+These interfaces were brought over from code in the former libaio
+and librt and are necessary because, where they are used, the code
+must execute potentially long-term waits and must be cancelable.
+sig_cond_wait() and sig_cond_reltimedwait() are cancellation points.
+
+These interfaces are available for other uses inside libc, as
+the need arises. (There is no need if the code does not perform
+long-term waits.) Just follow a few rules to be self-consistent:
+ - Don't mix calls to mutex_[un]lock(), lmutex_[un]lock() and
+ sig_mutex_[un]lock() on the same mutex.
+ - Don't call cond_wait() with a mutex acquired by sig_mutex_lock();
+ call sig_cond_wait() or sig_cond_reltimedwait().
+ - Use pthread_cleanup_push() and pthread_cleanup_pop() to make
+ your code cancellation-safe.
+ - The sig_*() interfaces are not in themselves fork-safe.
+ You have to employ other logic to make your code fork-safe.
+ See the tail of postfork1_child() for examples.
diff --git a/usr/src/lib/libc/amd64/Makefile b/usr/src/lib/libc/amd64/Makefile
index 0238a550ed..4db5f28fcb 100644
--- a/usr/src/lib/libc/amd64/Makefile
+++ b/usr/src/lib/libc/amd64/Makefile
@@ -711,6 +711,24 @@ PORTI18N_COND= \
wcstol_longlong.o \
wcstoul_longlong.o
+AIOOBJS= \
+ aio.o \
+ aio_alloc.o \
+ posix_aio.o \
+
+RTOBJS= \
+ clock_timer.o \
+ fallocate.o \
+ mqueue.o \
+ pos4obj.o \
+ sched.o \
+ sem.o \
+ shm.o \
+ sigev_thread.o
+
+TPOOLOBJS= \
+ thread_pool.o
+
THREADSOBJS= \
alloc.o \
assfail.o \
@@ -836,6 +854,9 @@ MOSTOBJS= \
$(PORTSTDIO_W) \
$(PORTSYS) \
$(PORTSYS64) \
+ $(AIOOBJS) \
+ $(RTOBJS) \
+ $(TPOOLOBJS) \
$(THREADSOBJS) \
$(THREADSMACHOBJS) \
$(THREADSASMOBJS) \
@@ -939,6 +960,9 @@ SRCS= \
$(PORTREGEX:%.o=../port/regex/%.c) \
$(PORTSTDIO:%.o=../port/stdio/%.c) \
$(PORTSYS:%.o=../port/sys/%.c) \
+ $(AIOOBJS:%.o=../port/aio/%.c) \
+ $(RTOBJS:%.o=../port/rt/%.c) \
+ $(TPOOLOBJS:%.o=../port/tpool/%.c) \
$(THREADSOBJS:%.o=../port/threads/%.c) \
$(THREADSMACHOBJS:%.o=threads/%.c) \
$(UNWINDMACHOBJS:%.o=unwind/%.c) \
@@ -966,6 +990,7 @@ $(MAPFILE):
# Files which need the threads .il inline template
TIL= \
+ aio.o \
alloc.o \
assfail.o \
atexit.o \
@@ -974,7 +999,9 @@ TIL= \
door_calls.o \
errno.o \
lwp.o \
+ ma.o \
machdep.o \
+ posix_aio.o \
pthr_attr.o \
pthr_barrier.o \
pthr_cond.o \
@@ -987,12 +1014,14 @@ TIL= \
scalls.o \
sema.o \
sigaction.o \
+ sigev_thread.o \
spawn.o \
stack.o \
synch.o \
tdb_agent.o \
thr.o \
thread_interface.o \
+ thread_pool.o \
thrp_unwind.o \
tls.o \
tsd.o
diff --git a/usr/src/lib/libc/amd64/gen/siglongjmp.c b/usr/src/lib/libc/amd64/gen/siglongjmp.c
index fd9860aad8..4bc4c579a4 100644
--- a/usr/src/lib/libc/amd64/gen/siglongjmp.c
+++ b/usr/src/lib/libc/amd64/gen/siglongjmp.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,13 +18,17 @@
*
* 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
+#pragma weak siglongjmp = _siglongjmp
+
+#include "synonyms.h"
#include <sys/types.h>
#include <sys/ucontext.h>
#include <setjmp.h>
@@ -33,8 +36,6 @@
extern int _setcontext(const ucontext_t *);
-#pragma weak siglongjmp = _siglongjmp
-
void
_siglongjmp(sigjmp_buf env, int val)
{
diff --git a/usr/src/lib/libc/common/sys/__clock_timer.s b/usr/src/lib/libc/common/sys/__clock_timer.s
index 4c4e917836..5188262570 100644
--- a/usr/src/lib/libc/common/sys/__clock_timer.s
+++ b/usr/src/lib/libc/common/sys/__clock_timer.s
@@ -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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -110,11 +110,11 @@
/*
* int
- * ___nanosleep(const timespec_t *rqtp, timespec_t *rmtp)
+ * __nanosleep(const timespec_t *rqtp, timespec_t *rmtp)
*/
- ENTRY(___nanosleep)
+ ENTRY(__nanosleep)
SYSTRAP_RVAL1(nanosleep)
SYSLWPERR
RET
- SET_SIZE(___nanosleep)
+ SET_SIZE(__nanosleep)
diff --git a/usr/src/lib/libc/common/sys/__signotify.s b/usr/src/lib/libc/common/sys/__signotify.s
index f49d5eb297..057a00ad45 100644
--- a/usr/src/lib/libc/common/sys/__signotify.s
+++ b/usr/src/lib/libc/common/sys/__signotify.s
@@ -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.
*/
@@ -28,9 +28,8 @@
.file "%M%"
-/* unpublished system call for librt -- __signotify */
-/* int _signotify (int cmd, siginfo_t *siginfo, */
-/* signotify_id_t *sn_id); */
+/* unpublished system call for POSIX message queues -- __signotify */
+/* int __signotify (int cmd, siginfo_t *siginfo, signotify_id_t *sn_id); */
#include "SYS.h"
diff --git a/usr/src/lib/libc/common/sys/__sigrt.s b/usr/src/lib/libc/common/sys/__sigrt.s
index df1154abd0..0ce63adb4e 100644
--- a/usr/src/lib/libc/common/sys/__sigrt.s
+++ b/usr/src/lib/libc/common/sys/__sigrt.s
@@ -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.
*/
@@ -32,7 +32,7 @@
/*
* int
- * __sigqueue(pid_t pid, int signo, void *value, int si_code)
+ * __sigqueue(pid_t pid, int signo, void *value, int si_code, int block)
*/
SYSCALL2_RVAL1(__sigqueue,sigqueue)
RETC
@@ -40,9 +40,9 @@
/*
* int
- * ___sigtimedwait(const sigset_t *set, siginfo_t *info,
+ * __sigtimedwait(const sigset_t *set, siginfo_t *info,
* const timespec_t *timeout)
*/
- SYSCALL2_RVAL1(___sigtimedwait,sigtimedwait)
+ SYSCALL2_RVAL1(__sigtimedwait,sigtimedwait)
RET
- SET_SIZE(___sigtimedwait)
+ SET_SIZE(__sigtimedwait)
diff --git a/usr/src/lib/libc/common/sys/kaio.s b/usr/src/lib/libc/common/sys/kaio.s
index cb75d3e2d5..1cd3810403 100644
--- a/usr/src/lib/libc/common/sys/kaio.s
+++ b/usr/src/lib/libc/common/sys/kaio.s
@@ -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) 1988 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.
*/
@@ -33,14 +32,12 @@
.file "%M%"
/* C library -- kaio */
-/* intptr_t kaio (); */
-
-#include <sys/asm_linkage.h>
-
- ANSI_PRAGMA_WEAK(kaio,function)
+/* intptr_t _kaio (); */
#include "SYS.h"
- SYSCALL_RVAL1(kaio)
+ ENTRY(_kaio)
+ SYSTRAP_RVAL1(kaio)
+ SYSCERROR
RET
- SET_SIZE(kaio)
+ SET_SIZE(_kaio)
diff --git a/usr/src/lib/libc/i386/Makefile.com b/usr/src/lib/libc/i386/Makefile.com
index 4c40fc780e..8613ab3972 100644
--- a/usr/src/lib/libc/i386/Makefile.com
+++ b/usr/src/lib/libc/i386/Makefile.com
@@ -751,6 +751,24 @@ PORTI18N_COND= \
wcstol_longlong.o \
wcstoul_longlong.o
+AIOOBJS= \
+ aio.o \
+ aio_alloc.o \
+ posix_aio.o \
+
+RTOBJS= \
+ clock_timer.o \
+ fallocate.o \
+ mqueue.o \
+ pos4obj.o \
+ sched.o \
+ sem.o \
+ shm.o \
+ sigev_thread.o
+
+TPOOLOBJS= \
+ thread_pool.o
+
THREADSOBJS= \
alloc.o \
assfail.o \
@@ -871,6 +889,9 @@ MOSTOBJS= \
$(PORTSTDIO_W) \
$(PORTSYS) \
$(PORTSYS64) \
+ $(AIOOBJS) \
+ $(RTOBJS) \
+ $(TPOOLOBJS) \
$(THREADSOBJS) \
$(THREADSMACHOBJS) \
$(THREADSASMOBJS) \
@@ -988,6 +1009,9 @@ SRCS= \
$(PORTREGEX:%.o=../port/regex/%.c) \
$(PORTSTDIO:%.o=../port/stdio/%.c) \
$(PORTSYS:%.o=../port/sys/%.c) \
+ $(AIOOBJS:%.o=../port/aio/%.c) \
+ $(RTOBJS:%.o=../port/rt/%.c) \
+ $(TPOOLOBJS:%.o=../port/tpool/%.c) \
$(THREADSOBJS:%.o=../port/threads/%.c) \
$(THREADSMACHOBJS:%.o=../$(MACH)/threads/%.c) \
$(UNWINDMACHOBJS:%.o=../port/unwind/%.c) \
@@ -1016,6 +1040,7 @@ $(MAPFILE):
# Files which need the threads .il inline template
TIL= \
+ aio.o \
alloc.o \
assfail.o \
atexit.o \
@@ -1024,7 +1049,9 @@ TIL= \
door_calls.o \
errno.o \
lwp.o \
+ ma.o \
machdep.o \
+ posix_aio.o \
pthr_attr.o \
pthr_barrier.o \
pthr_cond.o \
@@ -1037,12 +1064,14 @@ TIL= \
scalls.o \
sema.o \
sigaction.o \
+ sigev_thread.o \
spawn.o \
stack.o \
synch.o \
tdb_agent.o \
thr.o \
thread_interface.o \
+ thread_pool.o \
tls.o \
tsd.o \
unwind.o
diff --git a/usr/src/lib/libc/i386/gen/siglongjmp.c b/usr/src/lib/libc/i386/gen/siglongjmp.c
index ff40ea8f98..1b3296d93d 100644
--- a/usr/src/lib/libc/i386/gen/siglongjmp.c
+++ b/usr/src/lib/libc/i386/gen/siglongjmp.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,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.
*/
@@ -30,6 +30,9 @@
#pragma ident "%Z%%M% %I% %E% SMI"
+#pragma weak siglongjmp = _siglongjmp
+
+#include "synonyms.h"
#include <sys/types.h>
#include <sys/ucontext.h>
#include <setjmp.h>
@@ -37,8 +40,6 @@
extern int _setcontext(const ucontext_t *);
-#pragma weak siglongjmp = _siglongjmp
-
void
_siglongjmp(sigjmp_buf env, int val)
{
diff --git a/usr/src/lib/libaio/common/libaio.h b/usr/src/lib/libc/inc/asyncio.h
index dfbc1dd19f..02d33cd700 100644
--- a/usr/src/lib/libaio/common/libaio.h
+++ b/usr/src/lib/libc/inc/asyncio.h
@@ -24,8 +24,8 @@
* Use is subject to license terms.
*/
-#ifndef _LIBAIO_H
-#define _LIBAIO_H
+#ifndef _ASYNCIO_H
+#define _ASYNCIO_H
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -33,7 +33,6 @@
extern "C" {
#endif
-#include "c_synonyms.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -43,22 +42,15 @@ extern "C" {
#include <sys/stat.h>
#include <thread.h>
#include <pthread.h>
-#include <asynch.h>
#include <setjmp.h>
#include <signal.h>
#include <siginfo.h>
#include <aio.h>
#include <limits.h>
#include <ucontext.h>
+#include <sys/asynch.h>
#include <sys/mman.h>
-#if defined(DEBUG)
-extern int assfail(char *, char *, int);
-#define ASSERT(EX) ((void)((EX) || assfail(#EX, __FILE__, __LINE__)))
-#else
-#define ASSERT(EX)
-#endif
-
#if !defined(_LP64)
#define AIOSTKSIZE (64 * 1024)
#else
@@ -185,19 +177,12 @@ struct aio_req {
/* values for _aio_flags */
-/*
- * if set, _aiodone() notifies aio_waitn about done requests
- * from the threads
- */
+/* if set, _aiodone() notifies aio_waitn about done requests */
#define AIO_WAIT_INPROGRESS 0x1
-
-/*
- * if set, _aiodone() wakes up functions waiting for completed I/Os
- */
+/* if set, _aiodone() wakes up functions waiting for completed I/Os */
#define AIO_IO_WAITING 0x2
-
-#define AIO_LIB_WAITN 0x4 /* aio_waitn in progress */
-#define AIO_LIB_WAITN_PENDING 0x8 /* aio_waitn requests pending */
+#define AIO_LIB_WAITN 0x4 /* aio_waitn in progress */
+#define AIO_LIB_WAITN_PENDING 0x8 /* aio_waitn requests pending */
/*
* Before a kaio() system call, the fd will be checked
@@ -277,29 +262,6 @@ extern aio_hash_t *_aio_hash;
((uintptr_t)(resultp) >> 2)) & (HASHSZ - 1))
#define POSIX_AIO(x) ((x)->req_type == AIO_POSIX_REQ)
-/*
- * _sigoff(), _sigon(), and _sigdeferred() are consolidation-private
- * interfaces in libc that defer signals, enable signals, and return
- * the deferred signal number (if any), respectively.
- * Calls to _sigoff() and _sigon() can nest but must be balanced,
- * so nested calls to these functions work properly.
- */
-extern void _sigoff(void);
-extern void _sigon(void);
-extern int _sigdeferred(void);
-
-/*
- * The following five functions are the same as the corresponding
- * libc functions without the 'sig_' prefix, except that all signals
- * are deferred while the lock is held. Their use in the library
- * makes the aio interfaces async-signal safe.
- */
-extern void sig_mutex_lock(mutex_t *);
-extern void sig_mutex_unlock(mutex_t *);
-extern int sig_mutex_trylock(mutex_t *);
-extern int sig_cond_wait(cond_t *, mutex_t *);
-extern int sig_cond_reltimedwait(cond_t *, mutex_t *, const timespec_t *);
-
extern int __uaio_init(void);
extern void _kaio_init(void);
extern intptr_t _kaio(int, ...);
@@ -309,42 +271,32 @@ extern int _aio_rw(aiocb_t *, aio_lio_t *, aio_worker_t **, int, int);
extern int _aio_rw64(aiocb64_t *, aio_lio_t *, aio_worker_t **, int, int);
#endif
extern int _aio_create_worker(aio_req_t *, int);
-
extern int _aio_cancel_req(aio_worker_t *, aio_req_t *, int *, int *);
extern int aiocancel_all(int);
-extern void init_signals(void);
-
-extern void _aiopanic(char *);
+extern void aio_panic(const char *);
extern aio_req_t *_aio_hash_find(aio_result_t *);
extern aio_req_t *_aio_hash_del(aio_result_t *);
extern void _aio_req_mark_done(aio_req_t *);
extern void _aio_waitn_wakeup(void);
-
extern aio_worker_t *_aio_worker_alloc(void);
extern void _aio_worker_free(void *);
extern aio_req_t *_aio_req_alloc(void);
extern void _aio_req_free(aio_req_t *);
extern aio_lio_t *_aio_lio_alloc(void);
extern void _aio_lio_free(aio_lio_t *);
-
-extern void _aio_idle(aio_worker_t *);
+extern int _aio_idle(aio_worker_t *);
extern void *_aio_do_request(void *);
extern void *_aio_do_notify(void *);
extern void _lio_remove(aio_req_t *);
extern aio_req_t *_aio_req_remove(aio_req_t *);
extern int _aio_get_timedelta(timespec_t *, timespec_t *);
-
-extern int _close(int);
-extern int __sigqueue(pid_t pid, int signo,
- /* const union sigval */ void *value, int si_code);
-extern int _sigaction(int sig, const struct sigaction *act,
- struct sigaction *oact);
-extern int _sigemptyset(sigset_t *set);
-extern int _sigaddset(sigset_t *set, int signo);
-extern int _sigismember(const sigset_t *set, int signo);
-
extern aio_result_t *_aio_req_done(void);
extern void _aio_set_result(aio_req_t *, ssize_t, int);
+extern int _aio_sigev_thread_init(struct sigevent *);
+extern int _aio_sigev_thread(aiocb_t *);
+#if !defined(_LP64)
+extern int _aio_sigev_thread64(aiocb64_t *);
+#endif
extern aio_worker_t *_kaiowp; /* points to kaio cleanup thread */
extern aio_worker_t *__workers_rw; /* list of all rw workers */
@@ -354,20 +306,20 @@ extern aio_worker_t *__workers_no; /* list of all notification workers */
extern aio_worker_t *__nextworker_no; /* worker chosen, next notification */
extern int __no_workerscnt; /* number of notification workers */
extern mutex_t __aio_initlock; /* makes aio initialization atomic */
+extern cond_t __aio_initcv;
+extern int __aio_initbusy;
extern mutex_t __aio_mutex; /* global aio lock */
extern cond_t _aio_iowait_cv; /* wait for userland I/Os */
extern cond_t _aio_waitn_cv; /* wait for end of aio_waitn */
extern int _max_workers; /* max number of workers permitted */
extern int _min_workers; /* min number of workers */
extern sigset_t _worker_set; /* worker's signal mask */
-extern sigset_t _full_set; /* all signals (sigfillset()) */
extern int _aio_worker_cnt; /* number of AIO workers */
extern int _sigio_enabled; /* when set, send SIGIO signal */
extern pid_t __pid; /* process's PID */
extern int __uaio_ok; /* indicates if aio is initialized */
extern int _kaio_ok; /* indicates if kaio is initialized */
extern pthread_key_t _aio_key; /* for thread-specific data */
-
extern aio_req_t *_aio_done_tail; /* list of done requests */
extern aio_req_t *_aio_done_head;
extern aio_req_t *_aio_doneq;
@@ -382,15 +334,13 @@ extern int _aio_req_done_cnt; /* req. done but not in "done queue" */
extern int _aio_kernel_suspend; /* active kernel kaio calls */
extern int _aio_suscv_cnt; /* aio_suspend calls waiting on cv's */
extern int _aiowait_flag; /* when set, aiowait() is inprogress */
-extern int _aio_flags; /* see libaio.h defines for */
-
-/*
- * Array for determining whether or not a file supports kaio
- */
+extern int _aio_flags; /* see defines, above */
extern uint32_t *_kaio_supported;
+extern const sigset_t maskset; /* all maskable signals */
+
#ifdef __cplusplus
}
#endif
-#endif /* _LIBAIO_H */
+#endif /* _ASYNCIO_H */
diff --git a/usr/src/lib/libc/inc/mtlib.h b/usr/src/lib/libc/inc/mtlib.h
index 89c2376949..d864e8e75a 100644
--- a/usr/src/lib/libc/inc/mtlib.h
+++ b/usr/src/lib/libc/inc/mtlib.h
@@ -57,6 +57,15 @@ extern int __rw_unlock(rwlock_t *);
extern void lrw_rdlock(rwlock_t *);
extern void lrw_wrlock(rwlock_t *);
extern void lrw_unlock(rwlock_t *);
+extern void sig_mutex_lock(mutex_t *);
+extern void sig_mutex_unlock(mutex_t *);
+extern int sig_mutex_trylock(mutex_t *);
+extern int sig_cond_wait(cond_t *, mutex_t *);
+extern int sig_cond_reltimedwait(cond_t *, mutex_t *, const timespec_t *);
+
+/* the private libc thread-safe allocator */
+extern void *lmalloc(size_t);
+extern void lfree(void *, size_t);
/* the rest are public functions */
extern int _mutex_init(mutex_t *, int, void *);
@@ -91,6 +100,8 @@ extern thread_t _thr_self(void);
extern void _thr_exit(void *);
extern size_t _thr_min_stack(void);
extern int _thr_kill(thread_t, int);
+extern int _thr_create(void *, size_t, void *(*)(void *), void *, long,
+ thread_t *);
extern int _thr_keycreate(thread_key_t *, void (*)(void *));
extern int _thr_setspecific(thread_key_t, void *);
extern int _thr_getspecific(thread_key_t, void **);
diff --git a/usr/src/lib/librt/common/fdatasync.c b/usr/src/lib/libc/inc/rtsched.h
index c79ddb0ffa..90ae11c3b2 100644
--- a/usr/src/lib/librt/common/fdatasync.c
+++ b/usr/src/lib/libc/inc/rtsched.h
@@ -24,15 +24,21 @@
* Use is subject to license terms.
*/
+#ifndef _RTSCHED_H
+#define _RTSCHED_H
+
#pragma ident "%Z%%M% %I% %E% SMI"
-#include "c_synonyms.h"
-#include <sys/file.h>
+#include <sys/priocntl.h>
-extern int __fdsync(int fd, int mode);
+/*
+ * This definition is private to libc but is used in more than one subsystem.
+ */
+struct pcclass {
+ short pcc_state;
+ pri_t pcc_primin;
+ pri_t pcc_primax;
+ pcinfo_t pcc_info;
+};
-int
-fdatasync(int fd)
-{
- return (__fdsync(fd, FDSYNC));
-}
+#endif /* _RTSCHED_H */
diff --git a/usr/src/lib/libc/inc/synonyms.h b/usr/src/lib/libc/inc/synonyms.h
index 179f25f627..4de926dc9f 100644
--- a/usr/src/lib/libc/inc/synonyms.h
+++ b/usr/src/lib/libc/inc/synonyms.h
@@ -223,6 +223,10 @@ extern "C" {
#define chown _chown
#define chroot _chroot
#define _cladm __cladm
+#define clock_getres _clock_getres
+#define clock_gettime _clock_gettime
+#define clock_nanosleep _clock_nanosleep
+#define clock_settime _clock_settime
#define close _close
#define closedir _closedir
#define closefrom _closefrom
@@ -264,8 +268,8 @@ extern "C" {
#define decimal_to_single _decimal_to_single
#define dgettext _dgettext
#define dirname _dirname
-#define dladdr _dladdr
#define dladdr1 _dladdr1
+#define dladdr _dladdr
#define dlamd64getunwind _dlamd64getunwind
#define dlclose _dlclose
#define dldump _dldump
@@ -495,7 +499,6 @@ extern "C" {
#define iswupper _iswupper
#define iswxdigit _iswxdigit
#define jrand48 _jrand48
-#define kaio _kaio
#define kill _kill
#define l64a _l64a
#define ladd _ladd
@@ -590,12 +593,19 @@ extern "C" {
#define munlockall _munlockall
#define munlock _munlock
#define munmap _munmap
-#define mutex_destroy _mutex_destroy
-#define mutex_held _mutex_held
-#define mutex_init _mutex_init
-#define mutex_lock _mutex_lock
-#define mutex_trylock _mutex_trylock
-#define mutex_unlock _mutex_unlock
+#define _mutex_destroy __mutex_destroy
+#define mutex_destroy __mutex_destroy
+#define _mutex_held __mutex_held
+#define mutex_held __mutex_held
+#define _mutex_init __mutex_init
+#define mutex_init __mutex_init
+#define _mutex_lock __mutex_lock
+#define mutex_lock __mutex_lock
+#define _mutex_trylock __mutex_trylock
+#define mutex_trylock __mutex_trylock
+#define _mutex_unlock __mutex_unlock
+#define mutex_unlock __mutex_unlock
+#define nanosleep _nanosleep
#define nfs_getfh _nfs_getfh
#define nfssvc _nfssvc
#define nftw64 _nftw64
@@ -627,7 +637,6 @@ extern "C" {
#define port_alert _port_alert
#define port_associate _port_associate
#define port_create _port_create
-#define port_dispatch _port_dispatch
#define port_dissociate _port_dissociate
#define port_getn _port_getn
#define port_get _port_get
@@ -865,12 +874,23 @@ extern "C" {
#define sema_timedwait _sema_timedwait
#define sema_trywait _sema_trywait
#define sema_wait _sema_wait
+#define sem_close _sem_close
#define semctl64 _semctl64
#define semctl _semctl
+#define sem_destroy _sem_destroy
#define semget _semget
+#define sem_getvalue _sem_getvalue
#define semids _semids
+#define sem_init _sem_init
+#define sem_open _sem_open
#define semop _semop
+#define sem_post _sem_post
+#define sem_reltimedwait_np _sem_reltimedwait_np
#define semtimedop _semtimedop
+#define sem_timedwait _sem_timedwait
+#define sem_trywait _sem_trywait
+#define sem_unlink _sem_unlink
+#define sem_wait _sem_wait
#define setcontext _setcontext
#define setegid _setegid
#define setenv _setenv
@@ -927,12 +947,16 @@ extern "C" {
#define sigpause _sigpause
#define sigpending _sigpending
#define sigprocmask _sigprocmask
+#define sigqueue _sigqueue
#define sigrelse _sigrelse
#define sigsendset _sigsendset
#define sigsend _sigsend
#define sigsetjmp _sigsetjmp
#define sigset _sigset
+#define sigstack _sigstack
#define sigsuspend _sigsuspend
+#define sigtimedwait _sigtimedwait
+#define sigwaitinfo _sigwaitinfo
#define sigwait _sigwait
#define single_to_decimal _single_to_decimal
#define s_ioctl _s_ioctl
@@ -1018,6 +1042,11 @@ extern "C" {
#define thr_suspend _thr_suspend
#define thr_wait_mutator _thr_wait_mutator
#define thr_yield _thr_yield
+#define timer_create _timer_create
+#define timer_delete _timer_delete
+#define timer_getoverrun _timer_getoverrun
+#define timer_gettime _timer_gettime
+#define timer_settime _timer_settime
#define times _times
#define time _time
#define tmpnam_r _tmpnam_r
diff --git a/usr/src/lib/librt/common/sigrt.c b/usr/src/lib/libc/inc/thr_debug.h
index 0e1100057c..5e8de4ef0a 100644
--- a/usr/src/lib/librt/common/sigrt.c
+++ b/usr/src/lib/libc/inc/thr_debug.h
@@ -24,30 +24,21 @@
* Use is subject to license terms.
*/
+#ifndef _THR_DEBUG_H
+#define _THR_DEBUG_H
+
#pragma ident "%Z%%M% %I% %E% SMI"
-#pragma weak sigwaitinfo = _sigwaitinfo
-#pragma weak sigtimedwait = _sigtimedwait
-#pragma weak sigqueue = _sigqueue
-
-#include "c_synonyms.h"
-#include <sys/types.h>
-#include "pos4.h"
-
-int
-_sigwaitinfo(const sigset_t *set, siginfo_t *info)
-{
- return (__sigtimedwait(set, info, NULL));
-}
-
-int
-_sigtimedwait(const sigset_t *set, siginfo_t *info, const timespec_t *timeout)
-{
- return (__sigtimedwait(set, info, timeout));
-}
-
-int
-_sigqueue(pid_t pid, int signo, const union sigval value)
-{
- return (__sigqueue(pid, signo, value.sival_ptr, SI_QUEUE));
-}
+#if defined(THREAD_DEBUG)
+
+extern void __assfail(const char *, const char *, int);
+#pragma rarely_called(__assfail)
+#define ASSERT(EX) (void)((EX) || (__assfail(#EX, __FILE__, __LINE__), 0))
+
+#else
+
+#define ASSERT(EX) ((void)0)
+
+#endif
+
+#endif /* _THR_DEBUG_H */
diff --git a/usr/src/lib/libc/inc/thr_uberdata.h b/usr/src/lib/libc/inc/thr_uberdata.h
index c7b6001926..2671ac0a69 100644
--- a/usr/src/lib/libc/inc/thr_uberdata.h
+++ b/usr/src/lib/libc/inc/thr_uberdata.h
@@ -53,12 +53,10 @@
#include <schedctl.h>
#include <sys/priocntl.h>
#include <thread_db.h>
+#include <setjmp.h>
#include "libc_int.h"
#include "tdb_agent.h"
-
-/* belongs in <pthread.h> */
-#define PTHREAD_CREATE_DAEMON_NP 0x100 /* = THR_DAEMON */
-#define PTHREAD_CREATE_NONDAEMON_NP 0
+#include "thr_debug.h"
/*
* This is an implementation-specific include file for threading support.
@@ -208,14 +206,6 @@ typedef union {
#define PRIO_INHERIT 2
#define PRIO_DISINHERIT 3
-struct pcclass {
- short pcc_state;
- pri_t pcc_primin;
- pri_t pcc_primax;
- pcinfo_t pcc_info;
-};
-extern struct pcclass ts_class, rt_class;
-
#define MUTEX_TRY 0
#define MUTEX_LOCK 1
@@ -608,7 +598,7 @@ typedef struct ulwp {
#define MASKSET0 (FILLSET0 & ~CANTMASK0)
#define MASKSET1 (FILLSET1 & ~CANTMASK1)
-extern const sigset_t maskset; /* set of all maskable signals */
+extern const sigset_t maskset; /* set of all maskable signals */
extern int thread_adaptive_spin;
extern uint_t thread_max_spinners;
@@ -1048,7 +1038,7 @@ extern greg_t stkptr(void);
/*
* Implementation functions. Not visible outside of the library itself.
*/
-extern int ___nanosleep(const timespec_t *, timespec_t *);
+extern int __nanosleep(const timespec_t *, timespec_t *);
extern void getgregs(ulwp_t *, gregset_t);
extern void setgregs(ulwp_t *, gregset_t);
extern void thr_panic(const char *);
@@ -1092,18 +1082,6 @@ extern void _flush_windows(void);
#endif
extern void set_curthread(void *);
-#if defined(THREAD_DEBUG)
-
-extern void __assfail(const char *, const char *, int);
-#pragma rarely_called(__assfail)
-#define ASSERT(EX) (void)((EX) || (__assfail(#EX, __FILE__, __LINE__), 0))
-
-#else /* THREAD_DEBUG */
-
-#define ASSERT(EX) ((void)0)
-
-#endif /* THREAD_DEBUG */
-
/* enter a critical section */
#define enter_critical(self) (self->ul_critical++)
@@ -1174,21 +1152,35 @@ extern void *_thr_setup(ulwp_t *);
extern void _fpinherit(ulwp_t *);
extern void _lwp_start(void);
extern void _lwp_terminate(void);
-extern void lmutex_unlock(mutex_t *);
extern void lmutex_lock(mutex_t *);
+extern void lmutex_unlock(mutex_t *);
+extern void sig_mutex_lock(mutex_t *);
+extern void sig_mutex_unlock(mutex_t *);
+extern int sig_mutex_trylock(mutex_t *);
+extern int sig_cond_wait(cond_t *, mutex_t *);
+extern int sig_cond_reltimedwait(cond_t *, mutex_t *, const timespec_t *);
extern void _prefork_handler(void);
extern void _postfork_parent_handler(void);
extern void _postfork_child_handler(void);
-extern void _postfork1_child(void);
+extern void postfork1_child(void);
+extern void postfork1_child_aio(void);
+extern void postfork1_child_sigev_aio(void);
+extern void postfork1_child_sigev_mq(void);
+extern void postfork1_child_sigev_timer(void);
+extern void postfork1_child_tpool(void);
extern int fork_lock_enter(const char *);
extern void fork_lock_exit(void);
extern void suspend_fork(void);
extern void continue_fork(int);
extern void do_sigcancel(void);
-extern void init_sigcancel(void);
+extern void setup_cancelsig(int);
+extern void init_sigev_thread(void);
+extern void init_aio(void);
extern void _cancelon(void);
extern void _canceloff(void);
extern void _canceloff_nocancel(void);
+extern void _cancel_prologue(void);
+extern void _cancel_epilogue(void);
extern void no_preempt(ulwp_t *);
extern void preempt(ulwp_t *);
extern void _thrp_unwind(void *);
@@ -1249,8 +1241,18 @@ extern int __lwp_sigmask(int, const sigset_t *, sigset_t *);
extern void __sighndlr(int, siginfo_t *, ucontext_t *, void (*)());
extern caddr_t __sighndlrend;
#pragma unknown_control_flow(__sighndlr)
+extern void _siglongjmp(sigjmp_buf, int);
+extern int _pthread_setspecific(pthread_key_t, const void *);
+extern void *_pthread_getspecific(pthread_key_t);
extern void _pthread_exit(void *);
+extern void _private_testcancel(void);
+
+/* belongs in <pthread.h> */
+#define PTHREAD_CREATE_DAEMON_NP 0x100 /* = THR_DAEMON */
+#define PTHREAD_CREATE_NONDAEMON_NP 0
+extern int _pthread_attr_setdaemonstate_np(pthread_attr_t *, int);
+extern int _pthread_attr_getdaemonstate_np(const pthread_attr_t *, int *);
/* these are private to the library */
extern int _private_mutex_init(mutex_t *, int, void *);
@@ -1293,8 +1295,10 @@ extern int rw_read_is_held(rwlock_t *);
extern int rw_write_is_held(rwlock_t *);
extern int _thr_continue(thread_t);
-extern int _thrp_create(void *, size_t, void *(*func)(void *), void *,
- long, thread_t *, pri_t, int, size_t);
+extern int _thr_create(void *, size_t, void *(*)(void *), void *, long,
+ thread_t *);
+extern int _thrp_create(void *, size_t, void *(*)(void *), void *, long,
+ thread_t *, pri_t, int, size_t);
extern int _thr_getprio(thread_t, int *);
extern int _thr_getspecific(thread_key_t, void **);
extern int _thr_join(thread_t, thread_t *, void **);
@@ -1320,7 +1324,8 @@ extern int _thread_setschedparam_main(pthread_t, int,
const struct sched_param *, int);
extern int _validate_rt_prio(int, int);
extern int _thrp_setlwpprio(lwpid_t, int, int);
-extern pri_t _map_rtpri_to_gp(pri_t);
+extern pri_t map_rtpri_to_gp(pri_t);
+extern int get_info_by_policy(int);
/*
* System call wrappers (direct interfaces to the kernel)
diff --git a/usr/src/lib/librt/common/thread_pool.h b/usr/src/lib/libc/inc/thread_pool.h
index 200323703c..200323703c 100644
--- a/usr/src/lib/librt/common/thread_pool.h
+++ b/usr/src/lib/libc/inc/thread_pool.h
diff --git a/usr/src/lib/libaio/common/aio.c b/usr/src/lib/libc/port/aio/aio.c
index 6108245fa4..28d425d702 100644
--- a/usr/src/lib/libaio/common/aio.c
+++ b/usr/src/lib/libc/port/aio/aio.c
@@ -26,7 +26,9 @@
#pragma ident "%Z%%M% %I% %E% SMI"
-#include "libaio.h"
+#include "synonyms.h"
+#include "thr_uberdata.h"
+#include "asyncio.h"
#include <atomic.h>
#include <sys/param.h>
#include <sys/file.h>
@@ -37,7 +39,6 @@ static aio_req_t *_aio_req_get(aio_worker_t *);
static void _aio_req_add(aio_req_t *, aio_worker_t **, int);
static void _aio_req_del(aio_worker_t *, aio_req_t *, int);
static void _aio_work_done(aio_worker_t *);
-aio_req_t *_aio_req_remove(aio_req_t *);
static void _aio_enq_doneq(aio_req_t *);
extern void _aio_lio_free(aio_lio_t *);
@@ -85,6 +86,9 @@ aio_req_t *_aio_done_tail; /* list of done requests */
aio_req_t *_aio_done_head;
mutex_t __aio_initlock = DEFAULTMUTEX; /* makes aio initialization atomic */
+cond_t __aio_initcv = DEFAULTCV;
+int __aio_initbusy = 0;
+
mutex_t __aio_mutex = DEFAULTMUTEX; /* protects counts, and linked lists */
cond_t _aio_iowait_cv = DEFAULTCV; /* wait for userland I/Os */
@@ -105,17 +109,16 @@ int _aio_kernel_suspend = 0; /* active kernel kaio calls */
int _aio_suscv_cnt = 0; /* aio_suspend calls waiting on cv's */
int _max_workers = 256; /* max number of workers permitted */
-int _min_workers = 8; /* min number of workers */
+int _min_workers = 4; /* min number of workers */
int _minworkload = 2; /* min number of request in q */
int _aio_worker_cnt = 0; /* number of workers to do requests */
int __uaio_ok = 0; /* AIO has been enabled */
sigset_t _worker_set; /* worker's signal mask */
-sigset_t _full_set; /* all signals (sigfillset()) */
int _aiowait_flag = 0; /* when set, aiowait() is inprogress */
-int _aio_flags = 0; /* see libaio.h defines for */
+int _aio_flags = 0; /* see asyncio.h defines for */
-aio_worker_t *_kaiowp; /* points to kaio cleanup thread */
+aio_worker_t *_kaiowp = NULL; /* points to kaio cleanup thread */
int hz; /* clock ticks per second */
@@ -138,29 +141,32 @@ _kaio_supported_init(void)
}
/*
- * libaio is initialized when an AIO request is made. Important
- * constants are initialized like the max number of workers that
- * libaio can create, and the minimum number of workers permitted before
- * imposing some restrictions. Also, some workers are created.
+ * The aio subsystem is initialized when an AIO request is made.
+ * Constants are initialized like the max number of workers that
+ * the subsystem can create, and the minimum number of workers
+ * permitted before imposing some restrictions. Also, some
+ * workers are created.
*/
int
__uaio_init(void)
{
+ int ret = -1;
int i;
- int ret;
- sig_mutex_lock(&__aio_initlock);
+ lmutex_lock(&__aio_initlock);
+ while (__aio_initbusy)
+ (void) _cond_wait(&__aio_initcv, &__aio_initlock);
if (__uaio_ok) { /* already initialized */
- sig_mutex_unlock(&__aio_initlock);
+ lmutex_unlock(&__aio_initlock);
return (0);
}
-
- ret = -1;
+ __aio_initbusy = 1;
+ lmutex_unlock(&__aio_initlock);
hz = (int)sysconf(_SC_CLK_TCK);
__pid = getpid();
- init_signals();
+ setup_cancelsig(SIGAIOCANCEL);
if (_kaio_supported_init() != 0)
goto out;
@@ -182,12 +188,11 @@ __uaio_init(void)
/*
* Initialize worker's signal mask to only catch SIGAIOCANCEL.
*/
- (void) sigfillset(&_full_set);
(void) sigfillset(&_worker_set);
(void) sigdelset(&_worker_set, SIGAIOCANCEL);
/*
- * Create the minimum number of workers.
+ * Create the minimum number of read/write workers.
*/
for (i = 0; i < _min_workers; i++)
(void) _aio_create_worker(NULL, AIOREAD);
@@ -197,15 +202,40 @@ __uaio_init(void)
*/
(void) _aio_create_worker(NULL, AIONOTIFY);
- __uaio_ok = 1;
ret = 0;
-
out:
- sig_mutex_unlock(&__aio_initlock);
+ lmutex_lock(&__aio_initlock);
+ if (ret == 0)
+ __uaio_ok = 1;
+ __aio_initbusy = 0;
+ (void) cond_broadcast(&__aio_initcv);
+ lmutex_unlock(&__aio_initlock);
return (ret);
}
/*
+ * Called from close() before actually performing the real _close().
+ */
+void
+_aio_close(int fd)
+{
+ if (fd < 0) /* avoid cancelling everything */
+ return;
+ /*
+ * Cancel all outstanding aio requests for this file descriptor.
+ */
+ if (__uaio_ok)
+ (void) aiocancel_all(fd);
+ /*
+ * If we have allocated the bit array, clear the bit for this file.
+ * The next open may re-use this file descriptor and the new file
+ * may have different kaio() behaviour.
+ */
+ if (_kaio_supported != NULL)
+ CLEAR_KAIO_SUPPORTED(fd);
+}
+
+/*
* special kaio cleanup thread sits in a loop in the
* kernel waiting for pending kaio requests to complete.
*/
@@ -213,7 +243,7 @@ void *
_kaio_cleanup_thread(void *arg)
{
if (pthread_setspecific(_aio_key, arg) != 0)
- _aiopanic("_kaio_cleanup_thread, pthread_setspecific()");
+ aio_panic("_kaio_cleanup_thread, pthread_setspecific()");
(void) _kaio(AIOSTART);
return (arg);
}
@@ -225,37 +255,41 @@ void
_kaio_init()
{
int error;
- sigset_t set;
sigset_t oset;
- sig_mutex_lock(&__aio_initlock);
+ lmutex_lock(&__aio_initlock);
+ while (__aio_initbusy)
+ (void) _cond_wait(&__aio_initcv, &__aio_initlock);
+ if (_kaio_ok) { /* already initialized */
+ lmutex_unlock(&__aio_initlock);
+ return;
+ }
+ __aio_initbusy = 1;
+ lmutex_unlock(&__aio_initlock);
+
if (_kaio_supported_init() != 0)
- _kaio_ok = -1;
- if (_kaio_ok == 0) {
- if ((_kaiowp = _aio_worker_alloc()) == NULL) {
- error = ENOMEM;
- } else {
- if ((error = (int)_kaio(AIOINIT)) == 0) {
- (void) sigfillset(&set);
- (void) pthread_sigmask(SIG_SETMASK,
- &set, &oset);
- error = thr_create(NULL, AIOSTKSIZE,
- _kaio_cleanup_thread, _kaiowp,
- THR_DAEMON, &_kaiowp->work_tid);
- (void) pthread_sigmask(SIG_SETMASK,
- &oset, NULL);
- }
- if (error) {
- _aio_worker_free(_kaiowp);
- _kaiowp = NULL;
- }
- }
- if (error)
- _kaio_ok = -1;
- else
- _kaio_ok = 1;
+ error = ENOMEM;
+ else if ((_kaiowp = _aio_worker_alloc()) == NULL)
+ error = ENOMEM;
+ else if ((error = (int)_kaio(AIOINIT)) == 0) {
+ (void) pthread_sigmask(SIG_SETMASK, &maskset, &oset);
+ error = thr_create(NULL, AIOSTKSIZE, _kaio_cleanup_thread,
+ _kaiowp, THR_DAEMON, &_kaiowp->work_tid);
+ (void) pthread_sigmask(SIG_SETMASK, &oset, NULL);
+ }
+ if (error && _kaiowp != NULL) {
+ _aio_worker_free(_kaiowp);
+ _kaiowp = NULL;
}
- sig_mutex_unlock(&__aio_initlock);
+
+ lmutex_lock(&__aio_initlock);
+ if (error)
+ _kaio_ok = -1;
+ else
+ _kaio_ok = 1;
+ __aio_initbusy = 0;
+ (void) cond_broadcast(&__aio_initcv);
+ lmutex_unlock(&__aio_initlock);
}
int
@@ -770,6 +804,90 @@ _aio_cancel_req(aio_worker_t *aiowp, aio_req_t *reqp, int *canceled, int *done)
return (1);
}
+int
+_aio_create_worker(aio_req_t *reqp, int mode)
+{
+ aio_worker_t *aiowp, **workers, **nextworker;
+ int *aio_workerscnt;
+ void *(*func)(void *);
+ sigset_t oset;
+ int error;
+
+ /*
+ * Put the new worker thread in the right queue.
+ */
+ switch (mode) {
+ case AIOREAD:
+ case AIOWRITE:
+ case AIOAREAD:
+ case AIOAWRITE:
+#if !defined(_LP64)
+ case AIOAREAD64:
+ case AIOAWRITE64:
+#endif
+ workers = &__workers_rw;
+ nextworker = &__nextworker_rw;
+ aio_workerscnt = &__rw_workerscnt;
+ func = _aio_do_request;
+ break;
+ case AIONOTIFY:
+ workers = &__workers_no;
+ nextworker = &__nextworker_no;
+ func = _aio_do_notify;
+ aio_workerscnt = &__no_workerscnt;
+ break;
+ default:
+ aio_panic("_aio_create_worker: invalid mode");
+ break;
+ }
+
+ if ((aiowp = _aio_worker_alloc()) == NULL)
+ return (-1);
+
+ if (reqp) {
+ reqp->req_state = AIO_REQ_QUEUED;
+ reqp->req_worker = aiowp;
+ aiowp->work_head1 = reqp;
+ aiowp->work_tail1 = reqp;
+ aiowp->work_next1 = reqp;
+ aiowp->work_count1 = 1;
+ aiowp->work_minload1 = 1;
+ }
+
+ (void) pthread_sigmask(SIG_SETMASK, &maskset, &oset);
+ error = thr_create(NULL, AIOSTKSIZE, func, aiowp,
+ THR_DAEMON | THR_SUSPENDED, &aiowp->work_tid);
+ (void) pthread_sigmask(SIG_SETMASK, &oset, NULL);
+ if (error) {
+ if (reqp) {
+ reqp->req_state = 0;
+ reqp->req_worker = NULL;
+ }
+ _aio_worker_free(aiowp);
+ return (-1);
+ }
+
+ lmutex_lock(&__aio_mutex);
+ (*aio_workerscnt)++;
+ if (*workers == NULL) {
+ aiowp->work_forw = aiowp;
+ aiowp->work_backw = aiowp;
+ *nextworker = aiowp;
+ *workers = aiowp;
+ } else {
+ aiowp->work_backw = (*workers)->work_backw;
+ aiowp->work_forw = (*workers);
+ (*workers)->work_backw->work_forw = aiowp;
+ (*workers)->work_backw = aiowp;
+ }
+ _aio_worker_cnt++;
+ lmutex_unlock(&__aio_mutex);
+
+ (void) thr_continue(aiowp->work_tid);
+
+ return (0);
+}
+
/*
* This is the worker's main routine.
* The task of this function is to execute all queued requests;
@@ -841,13 +959,14 @@ void *
_aio_do_request(void *arglist)
{
aio_worker_t *aiowp = (aio_worker_t *)arglist;
+ ulwp_t *self = curthread;
struct aio_args *arg;
aio_req_t *reqp; /* current AIO request */
ssize_t retval;
int error;
if (pthread_setspecific(_aio_key, aiowp) != 0)
- _aiopanic("_aio_do_request, pthread_setspecific()");
+ aio_panic("_aio_do_request, pthread_setspecific()");
(void) pthread_sigmask(SIG_SETMASK, &_worker_set, NULL);
ASSERT(aiowp->work_req == NULL);
@@ -857,8 +976,9 @@ _aio_do_request(void *arglist)
* we do is block SIGAIOCANCEL.
*/
(void) sigsetjmp(aiowp->work_jmp_buf, 0);
+ ASSERT(self->ul_sigdefer == 0);
- _sigoff(); /* block SIGAIOCANCEL */
+ sigoff(self); /* block SIGAIOCANCEL */
if (aiowp->work_req != NULL)
_aio_finish_request(aiowp, -1, ECANCELED);
@@ -873,11 +993,13 @@ _aio_do_request(void *arglist)
top:
/* consume any deferred SIGAIOCANCEL signal here */
- _sigon();
- _sigoff();
+ sigon(self);
+ sigoff(self);
- while ((reqp = _aio_req_get(aiowp)) == NULL)
- _aio_idle(aiowp);
+ while ((reqp = _aio_req_get(aiowp)) == NULL) {
+ if (_aio_idle(aiowp) != 0)
+ goto top;
+ }
arg = &reqp->req_args;
ASSERT(reqp->req_state == AIO_REQ_INPROGRESS ||
reqp->req_state == AIO_REQ_CANCELED);
@@ -886,7 +1008,7 @@ top:
switch (reqp->req_op) {
case AIOREAD:
case AIOAREAD:
- _sigon(); /* unblock SIGAIOCANCEL */
+ sigon(self); /* unblock SIGAIOCANCEL */
retval = pread(arg->fd, arg->buf,
arg->bufsz, arg->offset);
if (retval == -1) {
@@ -899,11 +1021,11 @@ top:
error = errno;
}
}
- _sigoff(); /* block SIGAIOCANCEL */
+ sigoff(self); /* block SIGAIOCANCEL */
break;
case AIOWRITE:
case AIOAWRITE:
- _sigon(); /* unblock SIGAIOCANCEL */
+ sigon(self); /* unblock SIGAIOCANCEL */
retval = pwrite(arg->fd, arg->buf,
arg->bufsz, arg->offset);
if (retval == -1) {
@@ -916,11 +1038,11 @@ top:
error = errno;
}
}
- _sigoff(); /* block SIGAIOCANCEL */
+ sigoff(self); /* block SIGAIOCANCEL */
break;
#if !defined(_LP64)
case AIOAREAD64:
- _sigon(); /* unblock SIGAIOCANCEL */
+ sigon(self); /* unblock SIGAIOCANCEL */
retval = pread64(arg->fd, arg->buf,
arg->bufsz, arg->offset);
if (retval == -1) {
@@ -933,10 +1055,10 @@ top:
error = errno;
}
}
- _sigoff(); /* block SIGAIOCANCEL */
+ sigoff(self); /* block SIGAIOCANCEL */
break;
case AIOAWRITE64:
- _sigon(); /* unblock SIGAIOCANCEL */
+ sigon(self); /* unblock SIGAIOCANCEL */
retval = pwrite64(arg->fd, arg->buf,
arg->bufsz, arg->offset);
if (retval == -1) {
@@ -949,7 +1071,7 @@ top:
error = errno;
}
}
- _sigoff(); /* block SIGAIOCANCEL */
+ sigoff(self); /* block SIGAIOCANCEL */
break;
#endif /* !defined(_LP64) */
case AIOFSYNC:
@@ -971,11 +1093,11 @@ top:
error = errno;
}
if (_aio_hash_insert(reqp->req_resultp, reqp) != 0)
- _aiopanic("_aio_do_request(): AIOFSYNC: "
+ aio_panic("_aio_do_request(): AIOFSYNC: "
"request already in hash table");
break;
default:
- _aiopanic("_aio_do_request, bad op");
+ aio_panic("_aio_do_request, bad op");
}
_aio_finish_request(aiowp, retval, error);
@@ -1050,34 +1172,22 @@ _aio_delay(int ticks)
static void
send_notification(notif_param_t *npp)
{
- int backoff;
-
- if (npp->np_signo) {
- backoff = 0;
- while (__sigqueue(__pid, npp->np_signo, npp->np_user,
- SI_ASYNCIO) == -1) {
- ASSERT(errno == EAGAIN);
- if (++backoff > 10)
- backoff = 10;
- _aio_delay(backoff);
- }
- } else if (npp->np_port >= 0) {
+ extern int __sigqueue(pid_t pid, int signo,
+ /* const union sigval */ void *value, int si_code, int block);
+
+ if (npp->np_signo)
+ (void) __sigqueue(__pid, npp->np_signo, npp->np_user,
+ SI_ASYNCIO, 1);
+ else if (npp->np_port >= 0)
(void) _port_dispatch(npp->np_port, 0, PORT_SOURCE_AIO,
npp->np_event, npp->np_object, npp->np_user);
- }
- if (npp->np_lio_signo) {
- backoff = 0;
- while (__sigqueue(__pid, npp->np_lio_signo, npp->np_lio_user,
- SI_ASYNCIO) == -1) {
- ASSERT(errno == EAGAIN);
- if (++backoff > 10)
- backoff = 10;
- _aio_delay(backoff);
- }
- } else if (npp->np_lio_port >= 0) {
+
+ if (npp->np_lio_signo)
+ (void) __sigqueue(__pid, npp->np_lio_signo, npp->np_lio_user,
+ SI_ASYNCIO, 1);
+ else if (npp->np_lio_port >= 0)
(void) _port_dispatch(npp->np_lio_port, 0, PORT_SOURCE_AIO,
npp->np_lio_event, npp->np_lio_object, npp->np_lio_user);
- }
}
/*
@@ -1093,16 +1203,17 @@ _aio_do_notify(void *arg)
* This isn't really necessary. All signals are blocked.
*/
if (pthread_setspecific(_aio_key, aiowp) != 0)
- _aiopanic("_aio_do_notify, pthread_setspecific()");
+ aio_panic("_aio_do_notify, pthread_setspecific()");
/*
* Notifications are never cancelled.
* All signals remain blocked, forever.
*/
-
for (;;) {
- while ((reqp = _aio_req_get(aiowp)) == NULL)
- _aio_idle(aiowp);
+ while ((reqp = _aio_req_get(aiowp)) == NULL) {
+ if (_aio_idle(aiowp) != 0)
+ aio_panic("_aio_do_notify: _aio_idle() failed");
+ }
send_notification(&reqp->req_notify);
_aio_req_free(reqp);
}
@@ -1155,7 +1266,7 @@ _aiodone(aio_req_t *reqp, ssize_t retval, int error)
sigev_port = 1;
break;
default:
- _aiopanic("_aiodone: improper sigev_notify");
+ aio_panic("_aiodone: improper sigev_notify");
break;
}
@@ -1328,11 +1439,11 @@ _aio_fsync_del(aio_worker_t *aiowp, aio_req_t *reqp)
}
/*
- * worker is set idle when its work queue is empty.
- * The worker checks again that it has no more work and then
- * goes to sleep waiting for more work.
+ * A worker is set idle when its work queue is empty.
+ * The worker checks again that it has no more work
+ * and then goes to sleep waiting for more work.
*/
-void
+int
_aio_idle(aio_worker_t *aiowp)
{
int error = 0;
@@ -1355,6 +1466,7 @@ _aio_idle(aio_worker_t *aiowp)
aiowp->work_idleflg = 0;
}
sig_mutex_unlock(&aiowp->work_qlock1);
+ return (error);
}
/*
@@ -1470,6 +1582,7 @@ _aio_set_result(aio_req_t *reqp, ssize_t retval, int error)
void
_aio_req_add(aio_req_t *reqp, aio_worker_t **nextworker, int mode)
{
+ ulwp_t *self = curthread;
aio_worker_t *aiowp;
aio_worker_t *first;
int load_bal_flg = 1;
@@ -1483,7 +1596,7 @@ _aio_req_add(aio_req_t *reqp, aio_worker_t **nextworker, int mode)
* or until the list is completely traversed at which point another
* worker will be created.
*/
- _sigoff(); /* defer SIGIO */
+ sigoff(self); /* defer SIGIO */
sig_mutex_lock(&__aio_mutex);
first = aiowp = *nextworker;
if (mode != AIONOTIFY)
@@ -1532,8 +1645,8 @@ _aio_req_add(aio_req_t *reqp, aio_worker_t **nextworker, int mode)
if (!found) {
if (_aio_worker_cnt < _max_workers) {
if (_aio_create_worker(reqp, mode))
- _aiopanic("_aio_req_add: add worker");
- _sigon(); /* reenable SIGIO */
+ aio_panic("_aio_req_add: add worker");
+ sigon(self); /* reenable SIGIO */
return;
}
@@ -1559,8 +1672,8 @@ _aio_req_add(aio_req_t *reqp, aio_worker_t **nextworker, int mode)
*nextworker = aiowp->work_forw;
sig_mutex_unlock(&__aio_mutex);
if (_aio_create_worker(reqp, mode))
- _aiopanic("aio_req_add: add worker");
- _sigon(); /* reenable SIGIO */
+ aio_panic("aio_req_add: add worker");
+ sigon(self); /* reenable SIGIO */
return;
}
aiowp->work_minload1++;
@@ -1571,7 +1684,7 @@ _aio_req_add(aio_req_t *reqp, aio_worker_t **nextworker, int mode)
sig_mutex_lock(&aiowp->work_qlock1);
break;
default:
- _aiopanic("_aio_req_add: invalid mode");
+ aio_panic("_aio_req_add: invalid mode");
break;
}
/*
@@ -1603,7 +1716,7 @@ _aio_req_add(aio_req_t *reqp, aio_worker_t **nextworker, int mode)
*nextworker = aiowp->work_forw;
sig_mutex_unlock(&__aio_mutex);
}
- _sigon(); /* reenable SIGIO */
+ sigon(self); /* reenable SIGIO */
}
/*
@@ -1788,18 +1901,18 @@ _aio_hash_insert(aio_result_t *resultp, aio_req_t *reqp)
aio_req_t *next;
hashp = _aio_hash + AIOHASH(resultp);
- sig_mutex_lock(&hashp->hash_lock);
+ lmutex_lock(&hashp->hash_lock);
prev = &hashp->hash_ptr;
while ((next = *prev) != NULL) {
if (resultp == next->req_resultp) {
- sig_mutex_unlock(&hashp->hash_lock);
+ lmutex_unlock(&hashp->hash_lock);
return (-1);
}
prev = &next->req_link;
}
*prev = reqp;
ASSERT(reqp->req_link == NULL);
- sig_mutex_unlock(&hashp->hash_lock);
+ lmutex_unlock(&hashp->hash_lock);
return (0);
}
@@ -1815,7 +1928,7 @@ _aio_hash_del(aio_result_t *resultp)
if (_aio_hash != NULL) {
hashp = _aio_hash + AIOHASH(resultp);
- sig_mutex_lock(&hashp->hash_lock);
+ lmutex_lock(&hashp->hash_lock);
prev = &hashp->hash_ptr;
while ((next = *prev) != NULL) {
if (resultp == next->req_resultp) {
@@ -1825,7 +1938,7 @@ _aio_hash_del(aio_result_t *resultp)
}
prev = &next->req_link;
}
- sig_mutex_unlock(&hashp->hash_lock);
+ lmutex_unlock(&hashp->hash_lock);
}
return (next);
}
@@ -1842,14 +1955,14 @@ _aio_hash_find(aio_result_t *resultp)
if (_aio_hash != NULL) {
hashp = _aio_hash + AIOHASH(resultp);
- sig_mutex_lock(&hashp->hash_lock);
+ lmutex_lock(&hashp->hash_lock);
prev = &hashp->hash_ptr;
while ((next = *prev) != NULL) {
if (resultp == next->req_resultp)
break;
prev = &next->req_link;
}
- sig_mutex_unlock(&hashp->hash_lock);
+ lmutex_unlock(&hashp->hash_lock);
}
return (next);
}
@@ -1965,7 +2078,7 @@ _aio_rw(aiocb_t *aiocbp, aio_lio_t *lio_head, aio_worker_t **nextworker,
if ((flg & AIO_NO_DUPS) &&
_aio_hash_insert(&aiocbp->aio_resultp, reqp) != 0) {
- _aiopanic("_aio_rw(): request already in hash table");
+ aio_panic("_aio_rw(): request already in hash table");
_aio_req_free(reqp);
errno = EINVAL;
return (-1);
@@ -2078,7 +2191,7 @@ _aio_rw64(aiocb64_t *aiocbp, aio_lio_t *lio_head, aio_worker_t **nextworker,
if ((flg & AIO_NO_DUPS) &&
_aio_hash_insert(&aiocbp->aio_resultp, reqp) != 0) {
- _aiopanic("_aio_rw64(): request already in hash table");
+ aio_panic("_aio_rw64(): request already in hash table");
_aio_req_free(reqp);
errno = EINVAL;
return (-1);
diff --git a/usr/src/lib/libaio/common/ma.c b/usr/src/lib/libc/port/aio/aio_alloc.c
index e5b26be616..db919872e4 100644
--- a/usr/src/lib/libaio/common/ma.c
+++ b/usr/src/lib/libc/port/aio/aio_alloc.c
@@ -26,10 +26,12 @@
#pragma ident "%Z%%M% %I% %E% SMI"
-#include "libaio.h"
+#include "synonyms.h"
+#include "thr_uberdata.h"
+#include "asyncio.h"
/*
- * libaio memory allocation strategy:
+ * The aio subsystem memory allocation strategy:
*
* For each of the structure types we wish to allocate/free
* (aio_worker_t, aio_req_t, aio_lio_t), we use mmap() to allocate
@@ -69,12 +71,12 @@ chunk_alloc(size_t size)
ptr = mmap(NULL, size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON, -1, (off_t)0);
if (ptr != MAP_FAILED) {
- sig_mutex_lock(&chunk_lock);
+ lmutex_lock(&chunk_lock);
chp = ptr;
chp->chunk_next = chunk_list;
chunk_list = chp;
chp->chunk_size = size;
- sig_mutex_unlock(&chunk_lock);
+ lmutex_unlock(&chunk_lock);
}
return (chp);
@@ -97,12 +99,12 @@ _aio_worker_alloc(void)
int nelem;
int i;
- sig_mutex_lock(&worker_lock);
+ lmutex_lock(&worker_lock);
if ((aiowp = worker_freelist) == NULL) {
if ((chunksize = 2 * worker_chunksize) == 0)
chunksize = INITIAL_CHUNKSIZE;
if ((chp = chunk_alloc(chunksize)) == NULL) {
- sig_mutex_unlock(&worker_lock);
+ lmutex_unlock(&worker_lock);
return (NULL);
}
worker_chunksize = chunksize;
@@ -116,7 +118,7 @@ _aio_worker_alloc(void)
}
if ((worker_freelist = aiowp->work_forw) == NULL)
worker_freelast = NULL;
- sig_mutex_unlock(&worker_lock);
+ lmutex_unlock(&worker_lock);
aiowp->work_forw = NULL;
(void) mutex_init(&aiowp->work_qlock1, USYNC_THREAD, NULL);
@@ -138,14 +140,14 @@ _aio_worker_free(void *arg)
(void) cond_destroy(&aiowp->work_idle_cv);
(void) memset(aiowp, 0, sizeof (*aiowp));
- sig_mutex_lock(&worker_lock);
+ lmutex_lock(&worker_lock);
if (worker_freelast == NULL) {
worker_freelist = worker_freelast = aiowp;
} else {
worker_freelast->work_forw = aiowp;
worker_freelast = aiowp;
}
- sig_mutex_unlock(&worker_lock);
+ lmutex_unlock(&worker_lock);
}
aio_req_t *_aio_freelist = NULL; /* free list of request structures */
@@ -167,12 +169,12 @@ _aio_req_alloc(void)
int nelem;
int i;
- sig_mutex_lock(&__aio_cache_lock);
+ lmutex_lock(&__aio_cache_lock);
if ((reqp = _aio_freelist) == NULL) {
if ((chunksize = 2 * request_chunksize) == 0)
chunksize = INITIAL_CHUNKSIZE;
if ((chp = chunk_alloc(chunksize)) == NULL) {
- sig_mutex_unlock(&__aio_cache_lock);
+ lmutex_unlock(&__aio_cache_lock);
return (NULL);
}
request_chunksize = chunksize;
@@ -191,7 +193,7 @@ _aio_req_alloc(void)
_aio_freelast = NULL;
_aio_freelist_cnt--;
_aio_allocated_cnt++;
- sig_mutex_unlock(&__aio_cache_lock);
+ lmutex_unlock(&__aio_cache_lock);
ASSERT(reqp->req_state == AIO_REQ_FREE);
reqp->req_state = 0;
@@ -212,7 +214,7 @@ _aio_req_free(aio_req_t *reqp)
(void) memset(reqp, 0, sizeof (*reqp));
reqp->req_state = AIO_REQ_FREE;
- sig_mutex_lock(&__aio_cache_lock);
+ lmutex_lock(&__aio_cache_lock);
if (_aio_freelast == NULL) {
_aio_freelist = _aio_freelast = reqp;
} else {
@@ -221,7 +223,7 @@ _aio_req_free(aio_req_t *reqp)
}
_aio_freelist_cnt++;
_aio_allocated_cnt--;
- sig_mutex_unlock(&__aio_cache_lock);
+ lmutex_unlock(&__aio_cache_lock);
}
aio_lio_t *_lio_head_freelist = NULL; /* free list of lio head structures */
@@ -243,12 +245,12 @@ _aio_lio_alloc(void)
int nelem;
int i;
- sig_mutex_lock(&__lio_mutex);
+ lmutex_lock(&__lio_mutex);
if ((head = _lio_head_freelist) == NULL) {
if ((chunksize = 2 * lio_head_chunksize) == 0)
chunksize = INITIAL_CHUNKSIZE;
if ((chp = chunk_alloc(chunksize)) == NULL) {
- sig_mutex_unlock(&__lio_mutex);
+ lmutex_unlock(&__lio_mutex);
return (NULL);
}
lio_head_chunksize = chunksize;
@@ -265,7 +267,7 @@ _aio_lio_alloc(void)
if ((_lio_head_freelist = head->lio_next) == NULL)
_lio_head_freelast = NULL;
_lio_free--;
- sig_mutex_unlock(&__lio_mutex);
+ lmutex_unlock(&__lio_mutex);
ASSERT(head->lio_nent == 0 && head->lio_refcnt == 0);
head->lio_next = NULL;
@@ -287,7 +289,7 @@ _aio_lio_free(aio_lio_t *head)
(void) cond_destroy(&head->lio_cond_cv);
(void) memset(head, 0, sizeof (*head));
- sig_mutex_lock(&__lio_mutex);
+ lmutex_lock(&__lio_mutex);
if (_lio_head_freelast == NULL) {
_lio_head_freelist = _lio_head_freelast = head;
} else {
@@ -295,30 +297,14 @@ _aio_lio_free(aio_lio_t *head)
_lio_head_freelast = head;
}
_lio_free++;
- sig_mutex_unlock(&__lio_mutex);
+ lmutex_unlock(&__lio_mutex);
}
-static void
-_aio_prepare_fork(void)
-{
- /* acquire locks */
- sig_mutex_lock(&chunk_lock);
-}
-
-static void
-_aio_parent_fork(void)
-{
- /* release locks */
- sig_mutex_unlock(&chunk_lock);
-}
-
-static void
-_aio_child_fork(void)
+void
+postfork1_child_aio(void)
{
chunk_t *chp;
- _aio_parent_fork(); /* release locks */
-
/*
* All of the workers are gone; free their structures.
*/
@@ -360,6 +346,9 @@ _aio_child_fork(void)
(void) mutex_init(&__lio_mutex, USYNC_THREAD, NULL);
(void) mutex_init(&__aio_initlock, USYNC_THREAD, NULL);
+ (void) cond_init(&__aio_initcv, USYNC_THREAD, NULL);
+ __aio_initbusy = 0;
+
(void) mutex_init(&__aio_mutex, USYNC_THREAD, NULL);
(void) cond_init(&_aio_iowait_cv, USYNC_THREAD, NULL);
(void) cond_init(&_aio_waitn_cv, USYNC_THREAD, NULL);
@@ -425,18 +414,15 @@ _aio_exit_info(void)
DISPLAY(_aio_flags);
}
-#pragma init(_aio_init)
-static void
-_aio_init(void)
+void
+init_aio(void)
{
char *str;
(void) pthread_key_create(&_aio_key, _aio_worker_free);
- (void) pthread_atfork(_aio_prepare_fork,
- _aio_parent_fork, _aio_child_fork);
if ((str = getenv("_AIO_MIN_WORKERS")) != NULL) {
if ((_min_workers = atoi(str)) <= 0)
- _min_workers = 8;
+ _min_workers = 4;
}
if ((str = getenv("_AIO_MAX_WORKERS")) != NULL) {
if ((_max_workers = atoi(str)) <= 0)
diff --git a/usr/src/lib/libaio/common/posix_aio.c b/usr/src/lib/libc/port/aio/posix_aio.c
index c72acbd5ac..5e3c3ac41d 100644
--- a/usr/src/lib/libaio/common/posix_aio.c
+++ b/usr/src/lib/libc/port/aio/posix_aio.c
@@ -27,8 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
/*
- * posix_aio.c implements the POSIX async. I/O
- * functions for librt
+ * posix_aio.c implements the POSIX async. I/O functions.
*
* aio_read
* aio_write
@@ -40,7 +39,9 @@
* aio_cancel
*/
-#include "libaio.h"
+#include "synonyms.h"
+#include "thr_uberdata.h"
+#include "asyncio.h"
#include <atomic.h>
#include <sys/file.h>
#include <sys/port.h>
@@ -64,7 +65,7 @@ static void _lio_list_decr(aio_lio_t *);
static long aio_list_max = 0;
int
-__aio_read(aiocb_t *aiocbp)
+aio_read(aiocb_t *aiocbp)
{
if (aiocbp == NULL || aiocbp->aio_reqprio < 0) {
errno = EINVAL;
@@ -74,13 +75,15 @@ __aio_read(aiocb_t *aiocbp)
errno = EBUSY;
return (-1);
}
+ if (_aio_sigev_thread(aiocbp) != 0)
+ return (-1);
aiocbp->aio_lio_opcode = LIO_READ;
return (_aio_rw(aiocbp, NULL, &__nextworker_rw, AIOAREAD,
(AIO_KAIO | AIO_NO_DUPS)));
}
int
-__aio_write(aiocb_t *aiocbp)
+aio_write(aiocb_t *aiocbp)
{
if (aiocbp == NULL || aiocbp->aio_reqprio < 0) {
errno = EINVAL;
@@ -90,6 +93,8 @@ __aio_write(aiocb_t *aiocbp)
errno = EBUSY;
return (-1);
}
+ if (_aio_sigev_thread(aiocbp) != 0)
+ return (-1);
aiocbp->aio_lio_opcode = LIO_WRITE;
return (_aio_rw(aiocbp, NULL, &__nextworker_rw, AIOAWRITE,
(AIO_KAIO | AIO_NO_DUPS)));
@@ -116,8 +121,8 @@ _lio_listio_cleanup(aio_lio_t *head)
}
int
-__lio_listio(int mode, aiocb_t *const list[],
- int nent, struct sigevent *sigev)
+lio_listio(int mode, aiocb_t *_RESTRICT_KYWD const *_RESTRICT_KYWD list,
+ int nent, struct sigevent *_RESTRICT_KYWD sigevp)
{
int aio_ufs = 0;
int oerrno = 0;
@@ -160,6 +165,8 @@ __lio_listio(int mode, aiocb_t *const list[],
errno = EBUSY;
return (-1);
}
+ if (_aio_sigev_thread(aiocbp) != 0)
+ return (-1);
if (aiocbp->aio_lio_opcode == LIO_NOP)
aiocbp->aio_state = NOCHECK;
else {
@@ -170,9 +177,11 @@ __lio_listio(int mode, aiocb_t *const list[],
aiocbp->aio_resultp.aio_errno = ENOTSUP;
}
}
+ if (_aio_sigev_thread_init(sigevp) != 0)
+ return (-1);
if (do_kaio) {
- error = (int)_kaio(AIOLIO, mode, list, nent, sigev);
+ error = (int)_kaio(AIOLIO, mode, list, nent, sigevp);
if (error == 0)
return (0);
oerrno = errno;
@@ -187,34 +196,34 @@ __lio_listio(int mode, aiocb_t *const list[],
* If LIO_WAIT, or notification required, allocate a list head.
*/
if (mode == LIO_WAIT ||
- (sigev != NULL &&
- (sigev->sigev_notify == SIGEV_SIGNAL ||
- sigev->sigev_notify == SIGEV_THREAD ||
- sigev->sigev_notify == SIGEV_PORT)))
+ (sigevp != NULL &&
+ (sigevp->sigev_notify == SIGEV_SIGNAL ||
+ sigevp->sigev_notify == SIGEV_THREAD ||
+ sigevp->sigev_notify == SIGEV_PORT)))
head = _aio_lio_alloc();
if (head) {
sig_mutex_lock(&head->lio_mutex);
head->lio_mode = mode;
head->lio_largefile = 0;
- if (mode == LIO_NOWAIT && sigev != NULL) {
- if (sigev->sigev_notify == SIGEV_THREAD) {
- head->lio_port = sigev->sigev_signo;
+ if (mode == LIO_NOWAIT && sigevp != NULL) {
+ if (sigevp->sigev_notify == SIGEV_THREAD) {
+ head->lio_port = sigevp->sigev_signo;
head->lio_event = AIOLIO;
- head->lio_sigevent = sigev;
+ head->lio_sigevent = sigevp;
head->lio_sigval.sival_ptr =
- sigev->sigev_value.sival_ptr;
- } else if (sigev->sigev_notify == SIGEV_PORT) {
+ sigevp->sigev_value.sival_ptr;
+ } else if (sigevp->sigev_notify == SIGEV_PORT) {
port_notify_t *pn =
- sigev->sigev_value.sival_ptr;
+ sigevp->sigev_value.sival_ptr;
head->lio_port = pn->portnfy_port;
head->lio_event = AIOLIO;
- head->lio_sigevent = sigev;
+ head->lio_sigevent = sigevp;
head->lio_sigval.sival_ptr =
pn->portnfy_user;
} else { /* SIGEV_SIGNAL */
- head->lio_signo = sigev->sigev_signo;
+ head->lio_signo = sigevp->sigev_signo;
head->lio_sigval.sival_ptr =
- sigev->sigev_value.sival_ptr;
+ sigevp->sigev_value.sival_ptr;
}
}
head->lio_nent = head->lio_refcnt = nent;
@@ -276,7 +285,7 @@ __lio_listio(int mode, aiocb_t *const list[],
* kernel AIO requests
*/
if ((nent - aio_ufs) > 0)
- (void) _kaio(AIOLIOWAIT, mode, list, nent, sigev);
+ (void) _kaio(AIOLIOWAIT, mode, list, nent, sigevp);
if (head != NULL && head->lio_nent > 0) {
sig_mutex_lock(&head->lio_mutex);
while (head->lio_refcnt > 0) {
@@ -318,9 +327,6 @@ _lio_list_decr(aio_lio_t *head)
sig_mutex_unlock(&head->lio_mutex);
}
-extern void _cancel_prologue(void);
-extern void _cancel_epilogue(void);
-
/*
* __aio_suspend() cancellation handler.
*/
@@ -333,7 +339,7 @@ _aio_suspend_cleanup(int *counter)
sig_mutex_unlock(&__aio_mutex);
}
-int
+static int
__aio_suspend(void **list, int nent, const timespec_t *timo, int largefile)
{
int cv_err; /* error code from cond_xxx() */
@@ -355,7 +361,7 @@ __aio_suspend(void **list, int nent, const timespec_t *timo, int largefile)
#if defined(_LP64)
if (largefile)
- _aiopanic("__aio_suspend: largefile set when _LP64 defined");
+ aio_panic("__aio_suspend: largefile set when _LP64 defined");
#endif
if (nent <= 0) {
@@ -618,9 +624,16 @@ __aio_suspend(void **list, int nent, const timespec_t *timo, int largefile)
}
int
-__aio_error(aiocb_t *aiocbp)
+aio_suspend(const aiocb_t * const list[], int nent,
+ const timespec_t *timeout)
{
- aio_result_t *resultp = &aiocbp->aio_resultp;
+ return (__aio_suspend((void **)list, nent, timeout, 0));
+}
+
+int
+aio_error(const aiocb_t *aiocbp)
+{
+ const aio_result_t *resultp = &aiocbp->aio_resultp;
int error;
if ((error = resultp->aio_errno) == EINPROGRESS) {
@@ -637,14 +650,14 @@ __aio_error(aiocb_t *aiocbp)
}
error = resultp->aio_errno;
} else if (aiocbp->aio_state == CHECKED) {
- aiocbp->aio_state = CHECK;
+ ((aiocb_t *)aiocbp)->aio_state = CHECK;
}
}
return (error);
}
ssize_t
-__aio_return(aiocb_t *aiocbp)
+aio_return(aiocb_t *aiocbp)
{
aio_result_t *resultp = &aiocbp->aio_resultp;
aio_req_t *reqp;
@@ -745,11 +758,8 @@ __aio_fsync_bar(aiocb_t *aiocbp, aio_lio_t *head, aio_worker_t *aiowp,
return (i);
}
-/*
- * This function is called from aio_fsync(3RT).
- */
int
-__aio_fsync(int op, aiocb_t *aiocbp)
+aio_fsync(int op, aiocb_t *aiocbp)
{
aio_lio_t *head;
struct stat statb;
@@ -757,7 +767,6 @@ __aio_fsync(int op, aiocb_t *aiocbp)
if (aiocbp == NULL)
return (0);
-
if (aiocbp->aio_reqprio < 0 || (op != O_DSYNC && op != O_SYNC)) {
errno = EINVAL;
return (-1);
@@ -768,6 +777,8 @@ __aio_fsync(int op, aiocb_t *aiocbp)
}
if (fstat(aiocbp->aio_fildes, &statb) < 0)
return (-1);
+ if (_aio_sigev_thread(aiocbp) != 0)
+ return (-1);
/*
* Kernel aio_fsync() is not supported.
@@ -835,7 +846,7 @@ __aio_fsync(int op, aiocb_t *aiocbp)
}
int
-__aio_cancel(int fd, aiocb_t *aiocbp)
+aio_cancel(int fd, aiocb_t *aiocbp)
{
aio_req_t *reqp;
aio_worker_t *aiowp;
@@ -907,7 +918,7 @@ _aio_waitn_cleanup(void *arg)
* return if the timeout expires. Additionally, aio_waitn returns 0 if
* successful or -1 if an error occurred.
*/
-int
+static int
__aio_waitn(void **list, uint_t nent, uint_t *nwait, const timespec_t *utimo)
{
int error = 0;
@@ -1129,7 +1140,7 @@ __aio_waitn(void **list, uint_t nent, uint_t *nwait, const timespec_t *utimo)
* _aio_waitn_wakeup() will wake up this thread when:
* - _aio_waitncnt requests are completed or
* - _aio_outstand_cnt becomes zero.
- * cond_reltimedwait() could also return with
+ * sig_cond_reltimedwait() could also return with
* a timeout error (ETIME).
*/
if (*nwait < _aio_outstand_cnt)
@@ -1176,6 +1187,13 @@ out:
return (error);
}
+int
+aio_waitn(aiocb_t *list[], uint_t nent, uint_t *nwait,
+ const timespec_t *timeout)
+{
+ return (__aio_waitn((void **)list, nent, nwait, timeout));
+}
+
void
_aio_waitn_wakeup(void)
{
@@ -1253,7 +1271,7 @@ _aio_check_timeout(const timespec_t *utimo, timespec_t *end, int *timedwait)
#if !defined(_LP64)
int
-__aio_read64(aiocb64_t *aiocbp)
+aio_read64(aiocb64_t *aiocbp)
{
if (aiocbp == NULL || aiocbp->aio_reqprio < 0) {
errno = EINVAL;
@@ -1263,13 +1281,15 @@ __aio_read64(aiocb64_t *aiocbp)
errno = EBUSY;
return (-1);
}
+ if (_aio_sigev_thread64(aiocbp) != 0)
+ return (-1);
aiocbp->aio_lio_opcode = LIO_READ;
return (_aio_rw64(aiocbp, NULL, &__nextworker_rw, AIOAREAD64,
(AIO_KAIO | AIO_NO_DUPS)));
}
int
-__aio_write64(aiocb64_t *aiocbp)
+aio_write64(aiocb64_t *aiocbp)
{
if (aiocbp == NULL || aiocbp->aio_reqprio < 0) {
errno = EINVAL;
@@ -1279,14 +1299,16 @@ __aio_write64(aiocb64_t *aiocbp)
errno = EBUSY;
return (-1);
}
+ if (_aio_sigev_thread64(aiocbp) != 0)
+ return (-1);
aiocbp->aio_lio_opcode = LIO_WRITE;
return (_aio_rw64(aiocbp, NULL, &__nextworker_rw, AIOAWRITE64,
(AIO_KAIO | AIO_NO_DUPS)));
}
int
-__lio_listio64(int mode, aiocb64_t *const list[],
- int nent, struct sigevent *sigev)
+lio_listio64(int mode, aiocb64_t *_RESTRICT_KYWD const *_RESTRICT_KYWD list,
+ int nent, struct sigevent *_RESTRICT_KYWD sigevp)
{
int aio_ufs = 0;
int oerrno = 0;
@@ -1329,6 +1351,8 @@ __lio_listio64(int mode, aiocb64_t *const list[],
errno = EBUSY;
return (-1);
}
+ if (_aio_sigev_thread64(aiocbp) != 0)
+ return (-1);
if (aiocbp->aio_lio_opcode == LIO_NOP)
aiocbp->aio_state = NOCHECK;
else {
@@ -1339,9 +1363,11 @@ __lio_listio64(int mode, aiocb64_t *const list[],
aiocbp->aio_resultp.aio_errno = ENOTSUP;
}
}
+ if (_aio_sigev_thread_init(sigevp) != 0)
+ return (-1);
if (do_kaio) {
- error = (int)_kaio(AIOLIO64, mode, list, nent, sigev);
+ error = (int)_kaio(AIOLIO64, mode, list, nent, sigevp);
if (error == 0)
return (0);
oerrno = errno;
@@ -1356,34 +1382,34 @@ __lio_listio64(int mode, aiocb64_t *const list[],
* If LIO_WAIT, or notification required, allocate a list head.
*/
if (mode == LIO_WAIT ||
- (sigev != NULL &&
- (sigev->sigev_notify == SIGEV_SIGNAL ||
- sigev->sigev_notify == SIGEV_THREAD ||
- sigev->sigev_notify == SIGEV_PORT)))
+ (sigevp != NULL &&
+ (sigevp->sigev_notify == SIGEV_SIGNAL ||
+ sigevp->sigev_notify == SIGEV_THREAD ||
+ sigevp->sigev_notify == SIGEV_PORT)))
head = _aio_lio_alloc();
if (head) {
sig_mutex_lock(&head->lio_mutex);
head->lio_mode = mode;
head->lio_largefile = 1;
- if (mode == LIO_NOWAIT && sigev != NULL) {
- if (sigev->sigev_notify == SIGEV_THREAD) {
- head->lio_port = sigev->sigev_signo;
+ if (mode == LIO_NOWAIT && sigevp != NULL) {
+ if (sigevp->sigev_notify == SIGEV_THREAD) {
+ head->lio_port = sigevp->sigev_signo;
head->lio_event = AIOLIO64;
- head->lio_sigevent = sigev;
+ head->lio_sigevent = sigevp;
head->lio_sigval.sival_ptr =
- sigev->sigev_value.sival_ptr;
- } else if (sigev->sigev_notify == SIGEV_PORT) {
+ sigevp->sigev_value.sival_ptr;
+ } else if (sigevp->sigev_notify == SIGEV_PORT) {
port_notify_t *pn =
- sigev->sigev_value.sival_ptr;
+ sigevp->sigev_value.sival_ptr;
head->lio_port = pn->portnfy_port;
head->lio_event = AIOLIO64;
- head->lio_sigevent = sigev;
+ head->lio_sigevent = sigevp;
head->lio_sigval.sival_ptr =
pn->portnfy_user;
} else { /* SIGEV_SIGNAL */
- head->lio_signo = sigev->sigev_signo;
+ head->lio_signo = sigevp->sigev_signo;
head->lio_sigval.sival_ptr =
- sigev->sigev_value.sival_ptr;
+ sigevp->sigev_value.sival_ptr;
}
}
head->lio_nent = head->lio_refcnt = nent;
@@ -1445,7 +1471,7 @@ __lio_listio64(int mode, aiocb64_t *const list[],
* kernel AIO requests
*/
if ((nent - aio_ufs) > 0)
- (void) _kaio(AIOLIOWAIT, mode, list, nent, sigev);
+ (void) _kaio(AIOLIOWAIT, mode, list, nent, sigevp);
if (head != NULL && head->lio_nent > 0) {
sig_mutex_lock(&head->lio_mutex);
while (head->lio_refcnt > 0) {
@@ -1479,9 +1505,16 @@ __lio_listio64(int mode, aiocb64_t *const list[],
}
int
-__aio_error64(aiocb64_t *aiocbp)
+aio_suspend64(const aiocb64_t * const list[], int nent,
+ const timespec_t *timeout)
{
- aio_result_t *resultp = &aiocbp->aio_resultp;
+ return (__aio_suspend((void **)list, nent, timeout, 1));
+}
+
+int
+aio_error64(const aiocb64_t *aiocbp)
+{
+ const aio_result_t *resultp = &aiocbp->aio_resultp;
int error;
if ((error = resultp->aio_errno) == EINPROGRESS) {
@@ -1498,14 +1531,14 @@ __aio_error64(aiocb64_t *aiocbp)
}
error = resultp->aio_errno;
} else if (aiocbp->aio_state == CHECKED) {
- aiocbp->aio_state = CHECK;
+ ((aiocb64_t *)aiocbp)->aio_state = CHECK;
}
}
return (error);
}
ssize_t
-__aio_return64(aiocb64_t *aiocbp)
+aio_return64(aiocb64_t *aiocbp)
{
aio_result_t *resultp = &aiocbp->aio_resultp;
aio_req_t *reqp;
@@ -1586,7 +1619,7 @@ __aio_fsync_bar64(aiocb64_t *aiocbp, aio_lio_t *head, aio_worker_t *aiowp,
}
int
-__aio_fsync64(int op, aiocb64_t *aiocbp)
+aio_fsync64(int op, aiocb64_t *aiocbp)
{
aio_lio_t *head;
struct stat statb;
@@ -1594,7 +1627,6 @@ __aio_fsync64(int op, aiocb64_t *aiocbp)
if (aiocbp == NULL)
return (0);
-
if (aiocbp->aio_reqprio < 0 || (op != O_DSYNC && op != O_SYNC)) {
errno = EINVAL;
return (-1);
@@ -1605,6 +1637,8 @@ __aio_fsync64(int op, aiocb64_t *aiocbp)
}
if (fstat(aiocbp->aio_fildes, &statb) < 0)
return (-1);
+ if (_aio_sigev_thread64(aiocbp) != 0)
+ return (-1);
/*
* Kernel aio_fsync() is not supported.
@@ -1672,7 +1706,7 @@ __aio_fsync64(int op, aiocb64_t *aiocbp)
}
int
-__aio_cancel64(int fd, aiocb64_t *aiocbp)
+aio_cancel64(int fd, aiocb64_t *aiocbp)
{
aio_req_t *reqp;
aio_worker_t *aiowp;
@@ -1714,4 +1748,11 @@ __aio_cancel64(int fd, aiocb64_t *aiocbp)
return (aiocancel_all(fd));
}
+int
+aio_waitn64(aiocb64_t *list[], uint_t nent, uint_t *nwait,
+ const timespec_t *timeout)
+{
+ return (__aio_waitn((void **)list, nent, nwait, timeout));
+}
+
#endif /* !defined(_LP64) */
diff --git a/usr/src/lib/libc/port/gen/event_port.c b/usr/src/lib/libc/port/gen/event_port.c
index 84ade99164..f4eb057dec 100644
--- a/usr/src/lib/libc/port/gen/event_port.c
+++ b/usr/src/lib/libc/port/gen/event_port.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,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.
*/
@@ -34,7 +34,6 @@
#pragma weak port_get = _port_get
#pragma weak port_getn = _port_getn
#pragma weak port_alert = _port_alert
-#pragma weak port_dispatch = _port_dispatch
#include "lint.h"
#include <sys/types.h>
@@ -128,7 +127,7 @@ _port_send(int port, int events, void *user)
}
/*
- * port_dispatch() will block if there are not resources available to
+ * _port_dispatch() will block if there are not resources available to
* satisfy the request.
*/
diff --git a/usr/src/lib/libc/port/llib-lc b/usr/src/lib/libc/port/llib-lc
index 0c213a116c..502aa4cb33 100644
--- a/usr/src/lib/libc/port/llib-lc
+++ b/usr/src/lib/libc/port/llib-lc
@@ -29,6 +29,7 @@
/* LINTLIBRARY */
/* PROTOLIB1 */
+#include <aio.h>
#include <alloca.h>
#include <atomic.h>
#include <ctype.h>
@@ -51,6 +52,7 @@
#include <locale.h>
#include <memory.h>
#include <mon.h>
+#include <mqueue.h>
#include <nan.h>
#include <ndbm.h>
#include <limits.h>
@@ -61,7 +63,9 @@
#include <rctl.h>
#include <regex.h>
#include <rpcsvc/ypclnt.h>
+#include <sched.h>
#include <search.h>
+#include <semaphore.h>
#include <setjmp.h>
#include <shadow.h>
#include <siginfo.h>
@@ -80,6 +84,7 @@
#include <synch.h>
#include <sys/acctctl.h>
#include <sys/acl.h>
+#include <sys/asynch.h>
#include <sys/byteorder.h>
#include <sys/cladm.h>
#include <sys/corectl.h>
diff --git a/usr/src/lib/librt/common/clock_timer.c b/usr/src/lib/libc/port/rt/clock_timer.c
index 4e9ba1124f..8dfb35be91 100644
--- a/usr/src/lib/librt/common/clock_timer.c
+++ b/usr/src/lib/libc/port/rt/clock_timer.c
@@ -35,19 +35,27 @@
#pragma weak timer_gettime = _timer_gettime
#pragma weak timer_settime = _timer_settime
-#pragma weak clock_nanosleep = _clock_nanosleep
-#pragma weak nanosleep = _nanosleep
-
-#include "c_synonyms.h"
+#include "synonyms.h"
#include <time.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include "pos4.h"
#include "sigev_thread.h"
/*
+ * System call wrappers found elsewhere in libc (common/sys/__clock_timer.s).
+ */
+extern int __clock_getres(clockid_t, timespec_t *);
+extern int __clock_gettime(clockid_t, timespec_t *);
+extern int __clock_settime(clockid_t, const timespec_t *);
+extern int __timer_create(clockid_t, struct sigevent *, timer_t *);
+extern int __timer_delete(timer_t);
+extern int __timer_getoverrun(timer_t);
+extern int __timer_gettime(timer_t, itimerspec_t *);
+extern int __timer_settime(timer_t, int, const itimerspec_t *, itimerspec_t *);
+
+/*
* Array of pointers to tcd's, indexed by timer id.
* No more than 'timer_max' timers can be created by any process.
*/
@@ -108,14 +116,17 @@ _timer_create(clockid_t clock_id, struct sigevent *sigevp, timer_t *timerid)
}
rc = __timer_create(clock_id, sigevp, timerid);
- if (rc == 0 && sigev_thread) {
- if ((rc = launch_spawner(tcdp)) != 0)
- __timer_delete(*timerid);
- else
- timer_tcd[*timerid] = tcdp;
+
+ if (sigev_thread) {
+ if (rc == 0) {
+ if ((rc = launch_spawner(tcdp)) != 0)
+ __timer_delete(*timerid);
+ else
+ timer_tcd[*timerid] = tcdp;
+ }
+ if (rc != 0)
+ free_sigev_handler(tcdp);
}
- if (rc != 0 && sigev_thread)
- free_sigev_handler(tcdp);
return (rc);
}
@@ -150,15 +161,19 @@ _timer_settime(timer_t timerid, int flags, const itimerspec_t *value,
return (__timer_settime(timerid, flags, value, ovalue));
}
-int
-_clock_nanosleep(clockid_t clock_id, int flags,
- const timespec_t *rqtp, timespec_t *rmtp)
+/*
+ * Cleanup after fork1() in the child process.
+ */
+void
+postfork1_child_sigev_timer(void)
{
- return (__clock_nanosleep(clock_id, flags, rqtp, rmtp));
-}
+ thread_communication_data_t *tcdp;
+ int timer;
-int
-_nanosleep(const timespec_t *rqtp, timespec_t *rmtp)
-{
- return (__nanosleep(rqtp, rmtp));
+ for (timer = 0; timer < timer_max; timer++) {
+ if ((tcdp = timer_tcd[timer]) != NULL) {
+ timer_tcd[timer] = NULL;
+ tcd_teardown(tcdp);
+ }
+ }
}
diff --git a/usr/src/lib/librt/common/fallocate.c b/usr/src/lib/libc/port/rt/fallocate.c
index d4b1d0de1f..17b9088052 100644
--- a/usr/src/lib/librt/common/fallocate.c
+++ b/usr/src/lib/libc/port/rt/fallocate.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.
@@ -27,11 +26,10 @@
#pragma ident "%Z%%M% %I% %E% SMI"
-#include "c_synonyms.h"
+#include "synonyms.h"
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
-#include "pos4.h"
#include <stdio.h>
@@ -52,7 +50,7 @@ posix_fallocate(int fd, off_t offset, off_t len)
return (0);
}
-#if defined(_LARGEFILE64_SOURCE) && !defined(_LP64)
+#if !defined(_LP64)
int
posix_fallocate64(int fd, off64_t offset, off64_t len)
diff --git a/usr/src/lib/librt/common/mqueue.c b/usr/src/lib/libc/port/rt/mqueue.c
index c06b4d1760..ebab58a259 100644
--- a/usr/src/lib/librt/common/mqueue.c
+++ b/usr/src/lib/libc/port/rt/mqueue.c
@@ -39,16 +39,8 @@
#pragma weak mq_setattr = _mq_setattr
#pragma weak mq_getattr = _mq_getattr
-#include "c_synonyms.h"
-#if !defined(__lint) /* need a *_synonyms.h file */
-#define sem_getvalue _sem_getvalue
-#define sem_init _sem_init
-#define sem_post _sem_post
-#define sem_reltimedwait_np _sem_reltimedwait_np
-#define sem_timedwait _sem_timedwait
-#define sem_trywait _sem_trywait
-#define sem_wait _sem_wait
-#endif
+#include "synonyms.h"
+#include "mtlib.h"
#define _KMEMUSER
#include <sys/param.h> /* _MQ_OPEN_MAX, _MQ_PRIO_MAX, _SEM_VALUE_MAX */
#undef _KMEMUSER
@@ -66,10 +58,71 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <inttypes.h>
-
-#include "mqlib.h"
+#include "sigev_thread.h"
#include "pos4obj.h"
-#include "pos4.h"
+
+/*
+ * Default values per message queue
+ */
+#define MQ_MAXMSG 128
+#define MQ_MAXSIZE 1024
+
+#define MQ_MAGIC 0x4d534751 /* "MSGQ" */
+
+/*
+ * Message header which is part of messages in link list
+ */
+typedef struct {
+ uint64_t msg_next; /* offset of next message in the link */
+ uint64_t msg_len; /* length of the message */
+} msghdr_t;
+
+/*
+ * message queue description
+ */
+struct mq_dn {
+ size_t mqdn_flags; /* open description flags */
+};
+
+/*
+ * message queue descriptor structure
+ */
+typedef struct mq_des {
+ struct mq_des *mqd_next; /* list of all open mq descriptors, */
+ struct mq_des *mqd_prev; /* needed for fork-safety */
+ int mqd_magic; /* magic # to identify mq_des */
+ int mqd_flags; /* operation flag per open */
+ struct mq_header *mqd_mq; /* address pointer of message Q */
+ struct mq_dn *mqd_mqdn; /* open description */
+ thread_communication_data_t *mqd_tcd; /* SIGEV_THREAD notification */
+} mqdes_t;
+
+/*
+ * message queue common header, part of the mmap()ed file.
+ * Since message queues may be shared between 32- and 64-bit processes,
+ * care must be taken to make sure that the elements of this structure
+ * are identical for both _LP64 and _ILP32 cases.
+ */
+typedef struct mq_header {
+ /* first field must be mq_totsize, DO NOT insert before this */
+ int64_t mq_totsize; /* total size of the Queue */
+ int64_t mq_maxsz; /* max size of each message */
+ uint32_t mq_maxmsg; /* max messages in the queue */
+ uint32_t mq_maxprio; /* maximum mqueue priority */
+ uint32_t mq_curmaxprio; /* current maximum MQ priority */
+ uint32_t mq_mask; /* priority bitmask */
+ uint64_t mq_freep; /* free message's head pointer */
+ uint64_t mq_headpp; /* pointer to head pointers */
+ uint64_t mq_tailpp; /* pointer to tail pointers */
+ signotify_id_t mq_sigid; /* notification id (3 int's) */
+ uint32_t mq_ntype; /* notification type (SIGEV_*) */
+ uint64_t mq_des; /* pointer to msg Q descriptor */
+ mutex_t mq_exclusive; /* acquire for exclusive access */
+ sem_t mq_rblocked; /* number of processes rblocked */
+ sem_t mq_notfull; /* mq_send()'s block on this */
+ sem_t mq_notempty; /* mq_receive()'s block on this */
+ sem_t mq_spawner; /* spawner thread blocks on this */
+} mqhdr_t;
/*
* The code assumes that _MQ_OPEN_MAX == -1 or "no fixed implementation limit".
@@ -79,14 +132,13 @@
* by checking _MQ_OPEN_MAX at compile time.
*/
#if _MQ_OPEN_MAX != -1
-#error "librt:mq_open() no longer enforces _MQ_OPEN_MAX and needs fixing."
+#error "mq_open() no longer enforces _MQ_OPEN_MAX and needs fixing."
#endif
#define MQ_ALIGNSIZE 8 /* 64-bit alignment */
#ifdef DEBUG
-#define MQ_ASSERT(x) \
- assert(x);
+#define MQ_ASSERT(x) assert(x);
#define MQ_ASSERT_PTR(_m, _p) \
assert((_p) != NULL && !((uintptr_t)(_p) & (MQ_ALIGNSIZE -1)) && \
@@ -114,8 +166,10 @@
#define ABS_TIME 0
#define REL_TIME 1
-mutex_t mq_list_lock = DEFAULTMUTEX;
-mqdes_t *mq_list = NULL;
+static mutex_t mq_list_lock = DEFAULTMUTEX;
+static mqdes_t *mq_list = NULL;
+
+extern int __signotify(int cmd, siginfo_t *sigonfo, signotify_id_t *sn_id);
static int
mq_is_valid(mqdes_t *mqdp)
@@ -458,13 +512,13 @@ _mq_open(const char *path, int oflag, /* mode_t mode, mq_attr *attr */ ...)
mqdp->mqd_magic = MQ_MAGIC;
mqdp->mqd_tcd = NULL;
if (__pos4obj_unlock(path, MQ_LOCK_TYPE) == 0) {
- (void) mutex_lock(&mq_list_lock);
+ lmutex_lock(&mq_list_lock);
mqdp->mqd_next = mq_list;
mqdp->mqd_prev = NULL;
if (mq_list)
mq_list->mqd_prev = mqdp;
mq_list = mqdp;
- (void) mutex_unlock(&mq_list_lock);
+ lmutex_unlock(&mq_list_lock);
return ((mqd_t)mqdp);
}
@@ -489,12 +543,35 @@ out:
return ((mqd_t)-1);
}
+static void
+mq_close_cleanup(mqdes_t *mqdp)
+{
+ mqhdr_t *mqhp = mqdp->mqd_mq;
+ struct mq_dn *mqdnp = mqdp->mqd_mqdn;
+
+ /* invalidate the descriptor before freeing it */
+ mqdp->mqd_magic = 0;
+ (void) mutex_unlock(&mqhp->mq_exclusive);
+
+ lmutex_lock(&mq_list_lock);
+ if (mqdp->mqd_next)
+ mqdp->mqd_next->mqd_prev = mqdp->mqd_prev;
+ if (mqdp->mqd_prev)
+ mqdp->mqd_prev->mqd_next = mqdp->mqd_next;
+ if (mq_list == mqdp)
+ mq_list = mqdp->mqd_next;
+ lmutex_unlock(&mq_list_lock);
+
+ free(mqdp);
+ (void) munmap((caddr_t)mqdnp, sizeof (struct mq_dn));
+ (void) munmap((caddr_t)mqhp, (size_t)mqhp->mq_totsize);
+}
+
int
_mq_close(mqd_t mqdes)
{
mqdes_t *mqdp = (mqdes_t *)mqdes;
mqhdr_t *mqhp;
- struct mq_dn *mqdnp;
thread_communication_data_t *tcdp;
if (!mq_is_valid(mqdp)) {
@@ -503,9 +580,8 @@ _mq_close(mqd_t mqdes)
}
mqhp = mqdp->mqd_mq;
- mqdnp = mqdp->mqd_mqdn;
-
(void) mutex_lock(&mqhp->mq_exclusive);
+
if (mqhp->mq_des == (uintptr_t)mqdp &&
mqhp->mq_sigid.sn_pid == getpid()) {
/* notification is set for this descriptor, remove it */
@@ -513,26 +589,15 @@ _mq_close(mqd_t mqdes)
mqhp->mq_ntype = 0;
mqhp->mq_des = 0;
}
+
+ pthread_cleanup_push(mq_close_cleanup, mqdp);
if ((tcdp = mqdp->mqd_tcd) != NULL) {
mqdp->mqd_tcd = NULL;
- del_sigev_mq(tcdp);
+ del_sigev_mq(tcdp); /* possible cancellation point */
}
- /* invalidate the descriptor before freeing it */
- mqdp->mqd_magic = 0;
- (void) mutex_unlock(&mqhp->mq_exclusive);
-
- (void) mutex_lock(&mq_list_lock);
- if (mqdp->mqd_next)
- mqdp->mqd_next->mqd_prev = mqdp->mqd_prev;
- if (mqdp->mqd_prev)
- mqdp->mqd_prev->mqd_next = mqdp->mqd_next;
- if (mq_list == mqdp)
- mq_list = mqdp->mqd_next;
- (void) mutex_unlock(&mq_list_lock);
+ pthread_cleanup_pop(1); /* finish in the cleanup handler */
- free(mqdp);
- (void) munmap((caddr_t)mqdnp, sizeof (struct mq_dn));
- return (munmap((caddr_t)mqhp, (size_t)mqhp->mq_totsize));
+ return (0);
}
int
@@ -843,6 +908,7 @@ _mq_notify(mqd_t mqdes, const struct sigevent *sigevp)
struct stat64 statb;
port_notify_t *pn;
void *userval;
+ int rval = -1;
int ntype;
int port;
@@ -861,7 +927,7 @@ _mq_notify(mqd_t mqdes, const struct sigevent *sigevp)
/* notification is set for this descriptor, remove it */
(void) __signotify(SN_CANCEL, NULL, &mqhp->mq_sigid);
if ((tcdp = mqdp->mqd_tcd) != NULL) {
- (void) mutex_lock(&tcdp->tcd_lock);
+ sig_mutex_lock(&tcdp->tcd_lock);
if (tcdp->tcd_msg_enabled) {
/* cancel the spawner thread */
tcdp = mqdp->mqd_tcd;
@@ -869,7 +935,7 @@ _mq_notify(mqd_t mqdes, const struct sigevent *sigevp)
(void) pthread_cancel(
tcdp->tcd_server_id);
}
- (void) mutex_unlock(&tcdp->tcd_lock);
+ sig_mutex_unlock(&tcdp->tcd_lock);
}
mqhp->mq_ntype = 0;
mqhp->mq_des = 0;
@@ -949,20 +1015,18 @@ _mq_notify(mqd_t mqdes, const struct sigevent *sigevp)
tcdp->tcd_port = port;
tcdp->tcd_msg_object = mqdp;
tcdp->tcd_msg_userval = userval;
- (void) mutex_lock(&tcdp->tcd_lock);
+ sig_mutex_lock(&tcdp->tcd_lock);
tcdp->tcd_msg_enabled = ntype;
- (void) mutex_unlock(&tcdp->tcd_lock);
+ sig_mutex_unlock(&tcdp->tcd_lock);
(void) cond_broadcast(&tcdp->tcd_cv);
break;
}
}
- (void) mutex_unlock(&mqhp->mq_exclusive);
- return (0);
-
+ rval = 0; /* success */
bad:
(void) mutex_unlock(&mqhp->mq_exclusive);
- return (-1);
+ return (rval);
}
int
@@ -1018,3 +1082,20 @@ _mq_getattr(mqd_t mqdes, struct mq_attr *mqstat)
mqstat->mq_curmsgs = count;
return (0);
}
+
+/*
+ * Cleanup after fork1() in the child process.
+ */
+void
+postfork1_child_sigev_mq(void)
+{
+ thread_communication_data_t *tcdp;
+ mqdes_t *mqdp;
+
+ for (mqdp = mq_list; mqdp; mqdp = mqdp->mqd_next) {
+ if ((tcdp = mqdp->mqd_tcd) != NULL) {
+ mqdp->mqd_tcd = NULL;
+ tcd_teardown(tcdp);
+ }
+ }
+}
diff --git a/usr/src/lib/librt/common/pos4obj.c b/usr/src/lib/libc/port/rt/pos4obj.c
index 7c344d3a43..86f5a07595 100644
--- a/usr/src/lib/librt/common/pos4obj.c
+++ b/usr/src/lib/libc/port/rt/pos4obj.c
@@ -26,7 +26,8 @@
#pragma ident "%Z%%M% %I% %E% SMI"
-#include "c_synonyms.h"
+#include "synonyms.h"
+#include "mtlib.h"
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
@@ -41,7 +42,6 @@
#include <stdio.h>
#include <dlfcn.h>
#include <md5.h>
-#include "pos4.h"
#include "pos4obj.h"
#define HASHSTRLEN 32
@@ -95,20 +95,12 @@ __close_nc(int fildes)
typedef void (*md5_calc_t)(unsigned char *, unsigned char *, unsigned int);
static void *md5_handle = NULL;
static md5_calc_t real_md5_calc = NULL;
-mutex_t md5_lock = DEFAULTMUTEX;
+static mutex_t md5_lock = DEFAULTMUTEX;
static void
load_md5_calc(void)
{
- /*
- * _sigoff() and _sigon() are consolidation-private interfaces
- * in libc that defer and then reenable signals.
- */
- extern void _sigoff(void);
- extern void _sigon(void);
-
- _sigoff();
- (void) mutex_lock(&md5_lock);
+ lmutex_lock(&md5_lock);
if (real_md5_calc == NULL) {
md5_handle = dlopen("libmd.so.1", RTLD_LAZY);
if (md5_handle == NULL)
@@ -123,21 +115,7 @@ load_md5_calc(void)
}
}
}
- (void) mutex_unlock(&md5_lock);
- _sigon();
-}
-
-/*
- * If librt.so.1 is dlclose()d, take libmd.so.1 down with us.
- */
-#pragma fini(unload_md5_calc)
-static void
-unload_md5_calc(void)
-{
- if (md5_handle != NULL)
- (void) dlclose(md5_handle);
- md5_handle = NULL;
- real_md5_calc = NULL;
+ lmutex_unlock(&md5_lock);
}
static char *
@@ -222,7 +200,7 @@ __pos4obj_name(const char *path, const char *type)
/*
* Errno must be preserved across the following calls to
* mkdir. This needs to be done to prevent incorrect error
- * reporting in certain cases. When librt attempts to open a
+ * reporting in certain cases. When we attempt to open a
* non-existent object without the O_CREAT flag, it will
* always create a lock file first. The lock file is created
* and then the open is attempted, but fails with ENOENT. The
diff --git a/usr/src/lib/librt/common/pos4obj.h b/usr/src/lib/libc/port/rt/pos4obj.h
index 609a43f64c..609a43f64c 100644
--- a/usr/src/lib/librt/common/pos4obj.h
+++ b/usr/src/lib/libc/port/rt/pos4obj.h
diff --git a/usr/src/lib/librt/common/sched.c b/usr/src/lib/libc/port/rt/sched.c
index 1ca2f9801e..58b793f2e2 100644
--- a/usr/src/lib/librt/common/sched.c
+++ b/usr/src/lib/libc/port/rt/sched.c
@@ -26,7 +26,8 @@
#pragma ident "%Z%%M% %I% %E% SMI"
-#include "c_synonyms.h"
+#include "synonyms.h"
+#include "mtlib.h"
#include <sys/types.h>
#include <sched.h>
#include <errno.h>
@@ -40,18 +41,16 @@
#include <thread.h>
#include <string.h>
#include <stdlib.h>
-#include "pos4.h"
+#include "rtsched.h"
/*
* The following variables are used for caching information
* for priocntl scheduling classes.
*/
-static struct pcclass {
- short pcc_state;
- pri_t pcc_primin;
- pri_t pcc_primax;
- pcinfo_t pcc_info;
-} rt_class, ts_class, sys_class, ia_class;
+struct pcclass ts_class;
+struct pcclass rt_class;
+struct pcclass ia_class;
+struct pcclass sys_class;
static rtdpent_t *rt_dptbl; /* RT class parameter table */
@@ -64,7 +63,7 @@ static int map_gp_to_rtpri(pri_t);
/*
* cache priocntl information on scheduling classes by policy
*/
-static int
+int
get_info_by_policy(int policy)
{
char *pccname;
@@ -122,7 +121,7 @@ get_info_by_policy(int policy)
return (-1);
rtdpsize = (size_t)(rtadmin.rt_ndpents * sizeof (rtdpent_t));
if (rt_dptbl == NULL &&
- (rt_dptbl = (rtdpent_t *)malloc(rtdpsize)) == NULL) {
+ (rt_dptbl = lmalloc(rtdpsize)) == NULL) {
errno = EAGAIN;
return (-1);
}
@@ -189,6 +188,35 @@ map_gp_to_rtpri(pri_t gpri)
return (pri);
}
+/*
+ * Translate RT class's user priority to global scheduling priority.
+ */
+pri_t
+map_rtpri_to_gp(pri_t pri)
+{
+ rtdpent_t *rtdp;
+ pri_t gpri;
+
+ if (rt_class.pcc_state == 0)
+ (void) get_info_by_policy(SCHED_FIFO);
+
+ /* First case is the default case, other two are seldomly taken */
+ if (pri <= rt_dptbl[rt_class.pcc_primin].rt_globpri) {
+ gpri = pri + rt_dptbl[rt_class.pcc_primin].rt_globpri -
+ rt_class.pcc_primin;
+ } else if (pri >= rt_dptbl[rt_class.pcc_primax].rt_globpri) {
+ gpri = pri + rt_dptbl[rt_class.pcc_primax].rt_globpri -
+ rt_class.pcc_primax;
+ } else {
+ gpri = rt_dptbl[rt_class.pcc_primin].rt_globpri + 1;
+ for (rtdp = rt_dptbl+1; rtdp->rt_globpri < pri; ++rtdp, ++gpri)
+ ;
+ if (rtdp->rt_globpri > pri)
+ --gpri;
+ }
+ return (gpri);
+}
+
static int
get_info_by_class(id_t classid)
{
@@ -435,7 +463,7 @@ sched_getscheduler(pid_t pid)
int
sched_yield(void)
{
- _thr_yield();
+ thr_yield();
return (0);
}
diff --git a/usr/src/lib/librt/common/sem.c b/usr/src/lib/libc/port/rt/sem.c
index 89f2e36991..af3bdcc06a 100644
--- a/usr/src/lib/librt/common/sem.c
+++ b/usr/src/lib/libc/port/rt/sem.c
@@ -38,7 +38,8 @@
#pragma weak sem_post = _sem_post
#pragma weak sem_getvalue = _sem_getvalue
-#include "c_synonyms.h"
+#include "synonyms.h"
+#include "mtlib.h"
#include <sys/types.h>
#include <semaphore.h>
#include <synch.h>
@@ -52,7 +53,6 @@
#include <unistd.h>
#include <thread.h>
#include "pos4obj.h"
-#include "pos4.h"
typedef struct semaddr {
struct semaddr *sad_next; /* next in the link */
@@ -63,7 +63,7 @@ typedef struct semaddr {
static long semvaluemax = 0;
static semaddr_t *semheadp = NULL;
-mutex_t semlock = DEFAULTMUTEX;
+static mutex_t semlock = DEFAULTMUTEX;
sem_t *
_sem_open(const char *path, int oflag, /* mode_t mode, int value */ ...)
@@ -122,34 +122,30 @@ _sem_open(const char *path, int oflag, /* mode_t mode, int value */ ...)
if ((cr_flag & DFILE_CREATE) != 0) {
if (ftruncate64(fd, (off64_t)sizeof (sem_t)) < 0)
goto out;
-
} else {
- (void) mutex_lock(&semlock);
-
/*
* if this semaphore has already been opened, inode
* will indicate then return the same semaphore address
*/
+ lmutex_lock(&semlock);
for (next = semheadp; next != NULL; next = next->sad_next) {
if (statbuf.st_ino == next->sad_inode &&
- strcmp(path, next->sad_name) == 0) {
-
+ strcmp(path, next->sad_name) == 0) {
(void) __close_nc(fd);
- (void) mutex_unlock(&semlock);
+ lmutex_unlock(&semlock);
(void) __pos4obj_unlock(path, SEM_LOCK_TYPE);
- return ((sem_t *)next->sad_addr);
+ return (next->sad_addr);
}
}
- (void) mutex_unlock(&semlock);
+ lmutex_unlock(&semlock);
}
/* new sem descriptor to be allocated and new address to be mapped */
- if ((next = (semaddr_t *)malloc(sizeof (semaddr_t))) == NULL) {
+ if ((next = malloc(sizeof (semaddr_t))) == NULL) {
errno = ENOMEM;
goto out;
}
-
cr_flag |= ALLOC_MEM;
/* LINTED */
@@ -157,33 +153,31 @@ _sem_open(const char *path, int oflag, /* mode_t mode, int value */ ...)
MAP_SHARED, fd, (off64_t)0);
(void) __close_nc(fd);
cr_flag &= ~DFILE_OPEN;
-
if (sem == MAP_FAILED)
goto out;
-
cr_flag |= DFILE_MMAP;
- /* add to the list pointed by semheadp */
- next->sad_next = semheadp;
- semheadp = next;
- next->sad_addr = sem;
- next->sad_inode = statbuf.st_ino;
- (void) strcpy(next->sad_name, path);
-
- /* initialize it by jumping through the jump table */
+ /* if created, initialize */
if (cr_flag & DFILE_CREATE) {
- if ((error = sema_init((sema_t *)sem, value, USYNC_PROCESS, 0))
- != 0) {
+ error = sema_init((sema_t *)sem, value, USYNC_PROCESS, 0);
+ if (error) {
errno = error;
goto out;
}
}
- if (__pos4obj_unlock(path, SEM_LOCK_TYPE) < 0)
- return (SEM_FAILED);
-
- return (sem);
-
+ if (__pos4obj_unlock(path, SEM_LOCK_TYPE) == 0) {
+ /* add to the list pointed by semheadp */
+ lmutex_lock(&semlock);
+ next->sad_next = semheadp;
+ semheadp = next;
+ next->sad_addr = sem;
+ next->sad_inode = statbuf.st_ino;
+ (void) strcpy(next->sad_name, path);
+ lmutex_unlock(&semlock);
+ return (sem);
+ }
+ /* fall into the error case */
out:
error = errno;
if ((cr_flag & DFILE_OPEN) != 0)
@@ -191,12 +185,11 @@ out:
if ((cr_flag & DFILE_CREATE) != 0)
(void) __pos4obj_unlink(path, SEM_DATA_TYPE);
if ((cr_flag & ALLOC_MEM) != 0)
- free((caddr_t)next);
+ free(next);
if ((cr_flag & DFILE_MMAP) != 0)
(void) munmap((caddr_t)sem, sizeof (sem_t));
-
- errno = error;
(void) __pos4obj_unlock(path, SEM_LOCK_TYPE);
+ errno = error;
return (SEM_FAILED);
}
@@ -206,18 +199,17 @@ _sem_close(sem_t *sem)
semaddr_t **next;
semaddr_t *freeit;
- (void) mutex_lock(&semlock);
-
+ lmutex_lock(&semlock);
for (next = &semheadp; (freeit = *next) != NULL;
next = &(freeit->sad_next)) {
if (freeit->sad_addr == sem) {
*next = freeit->sad_next;
- free((caddr_t)freeit);
- (void) mutex_unlock(&semlock);
+ lmutex_unlock(&semlock);
+ free(freeit);
return (munmap((caddr_t)sem, sizeof (sem_t)));
}
}
- (void) mutex_unlock(&semlock);
+ lmutex_unlock(&semlock);
errno = EINVAL;
return (-1);
}
diff --git a/usr/src/lib/librt/common/shm.c b/usr/src/lib/libc/port/rt/shm.c
index bd27c0ed48..53c59d9424 100644
--- a/usr/src/lib/librt/common/shm.c
+++ b/usr/src/lib/libc/port/rt/shm.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.
@@ -27,7 +26,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
-#include "c_synonyms.h"
+#include "synonyms.h"
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
@@ -38,41 +37,38 @@
int
shm_open(const char *path, int oflag, mode_t mode)
{
- int flag, fd, flags;
+ int crflag;
+ int fd;
+ int flags;
- if (__pos4obj_check(path) == -1) {
+ if (__pos4obj_check(path) == -1)
return (-1);
- }
/* acquire semaphore lock to have atomic operation */
- if ((__pos4obj_lock(path, SHM_LOCK_TYPE)) < 0) {
+ if (__pos4obj_lock(path, SHM_LOCK_TYPE) < 0)
return (-1);
- }
- fd = __pos4obj_open(path, SHM_DATA_TYPE, oflag, mode, &flag);
+ fd = __pos4obj_open(path, SHM_DATA_TYPE, oflag, mode, &crflag);
if (fd < 0) {
(void) __pos4obj_unlock(path, SHM_LOCK_TYPE);
return (-1);
}
-
- if ((flags = fcntl(fd, F_GETFD)) < 0) {
- (void) __pos4obj_unlock(path, SHM_LOCK_TYPE);
- return (-1);
- }
-
- if ((fcntl(fd, F_SETFD, flags|FD_CLOEXEC)) < 0) {
+ if ((flags = fcntl(fd, F_GETFD)) < 0 ||
+ fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) {
(void) __pos4obj_unlock(path, SHM_LOCK_TYPE);
+ (void) __close_nc(fd);
return (-1);
}
/* relase semaphore lock operation */
if (__pos4obj_unlock(path, SHM_LOCK_TYPE) < 0) {
+ (void) __close_nc(fd);
return (-1);
}
- return (fd);
+ return (fd);
}
int
diff --git a/usr/src/lib/librt/common/sigev_thread.c b/usr/src/lib/libc/port/rt/sigev_thread.c
index 5388a1dd4c..0ab6eaccdf 100644
--- a/usr/src/lib/librt/common/sigev_thread.c
+++ b/usr/src/lib/libc/port/rt/sigev_thread.c
@@ -26,11 +26,8 @@
#pragma ident "%Z%%M% %I% %E% SMI"
-#include "c_synonyms.h"
-#if !defined(__lint) /* need a *_synonyms.h file */
-#define nanosleep _nanosleep
-#define sem_wait _sem_wait
-#endif
+#include "synonyms.h"
+#include "thr_uberdata.h"
#include <sys/types.h>
#include <pthread.h>
#include <unistd.h>
@@ -50,73 +47,46 @@
#include <fcntl.h>
#include "sigev_thread.h"
-mutex_t free_tcd_lock = DEFAULTMUTEX;
-static thread_communication_data_t *free_tcd_head = NULL;
-static thread_communication_data_t *free_tcd_tail = NULL;
-static freelist_t *std_freelist = NULL;
+/*
+ * There is but one spawner for all aio operations.
+ */
+thread_communication_data_t *sigev_aio_tcd = NULL;
/*
- * Set non-zero via LIBRT_DEBUG to enable debugging printf's.
+ * Set non-zero via _RT_DEBUG to enable debugging printf's.
*/
-static int _librt_debug = 0;
+static int _rt_debug = 0;
-#pragma init(__init_sigev_thread)
-static void __init_sigev_thread(void)
+void
+init_sigev_thread(void)
{
char *ldebug;
- if ((ldebug = getenv("_LIBRT_DEBUG")) != NULL)
- _librt_debug = atoi(ldebug);
+ if ((ldebug = getenv("_RT_DEBUG")) != NULL)
+ _rt_debug = atoi(ldebug);
}
/*
* Routine to print debug messages:
- * If _librt_debug is set, printf the debug message to stderr
+ * If _rt_debug is set, printf the debug message to stderr
* with an appropriate prefix.
*/
/*PRINTFLIKE1*/
static void
dprintf(const char *format, ...)
{
- if (_librt_debug) {
+ if (_rt_debug) {
va_list alist;
va_start(alist, format);
flockfile(stderr);
- (void) fputs("librt DEBUG: ", stderr);
+ (void) fputs("DEBUG: ", stderr);
(void) vfprintf(stderr, format, alist);
funlockfile(stderr);
va_end(alist);
}
}
-static sigev_thread_data_t *
-std_alloc(void)
-{
- freelist_t *ptr;
-
- (void) mutex_lock(&free_tcd_lock);
- if ((ptr = std_freelist) == NULL) {
- (void) mutex_unlock(&free_tcd_lock);
- ptr = malloc(sizeof (sigev_thread_data_t));
- } else {
- std_freelist = ptr->fl_next;
- (void) mutex_unlock(&free_tcd_lock);
- }
- return ((sigev_thread_data_t *)ptr);
-}
-
-static void
-std_free(sigev_thread_data_t *stdp)
-{
- freelist_t *ptr = (freelist_t *)stdp;
-
- (void) mutex_lock(&free_tcd_lock);
- ptr->fl_next = std_freelist;
- std_freelist = ptr;
- (void) mutex_unlock(&free_tcd_lock);
-}
-
/*
* The notify_thread() function can be used as the start function of a new
* thread but it is normally called from notifier(), below, in the context
@@ -131,7 +101,7 @@ notify_thread(void *arg)
void (*function)(union sigval) = stdp->std_func;
union sigval argument = stdp->std_arg;
- std_free(stdp);
+ lfree(stdp, sizeof (*stdp));
function(argument);
return (NULL);
}
@@ -159,12 +129,12 @@ sigev_add_work(thread_communication_data_t *tcdp,
if (tpool == NULL)
return (EINVAL);
- if ((stdp = std_alloc()) == NULL)
+ if ((stdp = lmalloc(sizeof (*stdp))) == NULL)
return (errno);
stdp->std_func = function;
stdp->std_arg = argument;
if (tpool_dispatch(tpool, notifier, stdp) != 0) {
- std_free(stdp);
+ lfree(stdp, sizeof (*stdp));
return (errno);
}
return (0);
@@ -181,14 +151,14 @@ sigev_destroy_pool(thread_communication_data_t *tcdp)
/*
* synchronize with del_sigev_mq()
*/
- (void) mutex_lock(&tcdp->tcd_lock);
+ sig_mutex_lock(&tcdp->tcd_lock);
tcdp->tcd_server_id = 0;
if (tcdp->tcd_msg_closing) {
(void) cond_broadcast(&tcdp->tcd_cv);
- (void) mutex_unlock(&tcdp->tcd_lock);
+ sig_mutex_unlock(&tcdp->tcd_lock);
return; /* del_sigev_mq() will free the tcd */
}
- (void) mutex_unlock(&tcdp->tcd_lock);
+ sig_mutex_unlock(&tcdp->tcd_lock);
}
/*
@@ -268,26 +238,18 @@ mqueue_spawner(void *arg)
pthread_cleanup_push(sigev_destroy_pool, tcdp);
while (ret == 0) {
- /*
- * This kludge is to call _pthread_cond_wait(), not
- * _cond_wait(), because _cond_wait() is not a
- * cancellation point. *Ugh*
- */
- pthread_cond_t *cv = (pthread_cond_t *)&tcdp->tcd_cv;
- pthread_mutex_t *mx = (pthread_mutex_t *)&tcdp->tcd_lock;
-
- (void) mutex_lock(&tcdp->tcd_lock);
- pthread_cleanup_push(mutex_unlock, &tcdp->tcd_lock);
+ sig_mutex_lock(&tcdp->tcd_lock);
+ pthread_cleanup_push(sig_mutex_unlock, &tcdp->tcd_lock);
while ((ntype = tcdp->tcd_msg_enabled) == 0)
- (void) pthread_cond_wait(cv, mx);
+ (void) sig_cond_wait(&tcdp->tcd_cv, &tcdp->tcd_lock);
pthread_cleanup_pop(1);
while (sem_wait(tcdp->tcd_msg_avail) == -1)
continue;
- (void) mutex_lock(&tcdp->tcd_lock);
+ sig_mutex_lock(&tcdp->tcd_lock);
tcdp->tcd_msg_enabled = 0;
- (void) mutex_unlock(&tcdp->tcd_lock);
+ sig_mutex_unlock(&tcdp->tcd_lock);
/* ASSERT(ntype == SIGEV_THREAD || ntype == SIGEV_PORT); */
if (ntype == SIGEV_THREAD) {
@@ -300,7 +262,7 @@ mqueue_spawner(void *arg)
tcdp->tcd_msg_userval);
}
}
- (void) mutex_unlock(&tcdp->tcd_lock);
+ sig_mutex_unlock(&tcdp->tcd_lock);
pthread_cleanup_pop(1);
return (NULL);
@@ -392,7 +354,7 @@ aio_spawner(void *arg)
pthread_attr_t local_attr;
sigev_thread_data_t *stdp;
- if ((stdp = std_alloc()) == NULL)
+ if ((stdp = lmalloc(sizeof (*stdp))) == NULL)
error = ENOMEM;
else
error = _pthread_attr_clone(&local_attr, attrp);
@@ -409,7 +371,7 @@ aio_spawner(void *arg)
(void) pthread_attr_destroy(&local_attr);
}
if (error && stdp != NULL)
- std_free(stdp);
+ lfree(stdp, sizeof (*stdp));
}
if (error) {
@@ -442,29 +404,12 @@ alloc_sigev_handler(subsystem_t caller)
{
thread_communication_data_t *tcdp;
- (void) mutex_lock(&free_tcd_lock);
- if ((tcdp = free_tcd_head) == NULL) {
- (void) mutex_unlock(&free_tcd_lock);
- tcdp = malloc(sizeof (thread_communication_data_t));
- if (tcdp != NULL) {
- (void) memset(tcdp, 0, sizeof (*tcdp));
- tcdp->tcd_subsystem = caller;
- tcdp->tcd_port = -1;
- (void) mutex_init(&tcdp->tcd_lock,
- USYNC_THREAD, NULL);
- (void) cond_init(&tcdp->tcd_cv,
- USYNC_THREAD, NULL);
- }
- return (tcdp);
+ if ((tcdp = lmalloc(sizeof (*tcdp))) != NULL) {
+ tcdp->tcd_subsystem = caller;
+ tcdp->tcd_port = -1;
+ (void) mutex_init(&tcdp->tcd_lock, USYNC_THREAD, NULL);
+ (void) cond_init(&tcdp->tcd_cv, USYNC_THREAD, NULL);
}
- if ((free_tcd_head = tcdp->tcd_next) == NULL)
- free_tcd_tail = NULL;
- (void) mutex_unlock(&free_tcd_lock);
- tcdp->tcd_next = NULL;
- tcdp->tcd_subsystem = caller;
- tcdp->tcd_port = -1;
- tcdp->tcd_server_id = 0;
- tcdp->tcd_poolp = NULL;
return (tcdp);
}
@@ -493,17 +438,8 @@ free_sigev_handler(thread_communication_data_t *tcdp)
tcdp->tcd_msg_enabled = 0;
break;
}
- tcdp->tcd_port = -1;
- tcdp->tcd_next = NULL;
- (void) mutex_lock(&free_tcd_lock);
- if (free_tcd_head == NULL)
- free_tcd_head = free_tcd_tail = tcdp;
- else {
- free_tcd_tail->tcd_next = tcdp;
- free_tcd_tail = tcdp;
- }
- (void) mutex_unlock(&free_tcd_lock);
+ lfree(tcdp, sizeof (*tcdp));
}
/*
@@ -616,7 +552,7 @@ del_sigev_timer(timer_t timer)
thread_communication_data_t *tcdp;
if ((uint_t)timer < timer_max && (tcdp = timer_tcd[timer]) != NULL) {
- (void) mutex_lock(&tcdp->tcd_lock);
+ sig_mutex_lock(&tcdp->tcd_lock);
if (tcdp->tcd_port >= 0) {
if ((rc = port_alert(tcdp->tcd_port,
PORT_ALERT_SET, SIGEV_THREAD_TERM, NULL)) == 0) {
@@ -624,7 +560,7 @@ del_sigev_timer(timer_t timer)
}
}
timer_tcd[timer] = NULL;
- (void) mutex_unlock(&tcdp->tcd_lock);
+ sig_mutex_unlock(&tcdp->tcd_lock);
}
return (rc);
}
@@ -639,6 +575,13 @@ sigev_timer_getoverrun(timer_t timer)
return (0);
}
+static void
+del_sigev_mq_cleanup(thread_communication_data_t *tcdp)
+{
+ sig_mutex_unlock(&tcdp->tcd_lock);
+ free_sigev_handler(tcdp);
+}
+
/*
* Delete the data associated with the sigev_thread message queue,
* if the message queue is associated with such a notification option.
@@ -650,20 +593,123 @@ del_sigev_mq(thread_communication_data_t *tcdp)
pthread_t server_id;
int rc;
- (void) mutex_lock(&tcdp->tcd_lock);
+ sig_mutex_lock(&tcdp->tcd_lock);
+
server_id = tcdp->tcd_server_id;
tcdp->tcd_msg_closing = 1;
- if ((rc = pthread_cancel(server_id)) != 0) {
+ if ((rc = pthread_cancel(server_id)) != 0) { /* "can't happen" */
+ sig_mutex_unlock(&tcdp->tcd_lock);
dprintf("Fail to cancel %u with error %d <%s>.\n",
server_id, rc, strerror(rc));
- } else {
- /*
- * wait for sigev_destroy_pool() to finish
- */
- while (tcdp->tcd_server_id == server_id)
- (void) cond_wait(&tcdp->tcd_cv, &tcdp->tcd_lock);
+ return;
+ }
+
+ /*
+ * wait for sigev_destroy_pool() to finish
+ */
+ pthread_cleanup_push(del_sigev_mq_cleanup, tcdp);
+ while (tcdp->tcd_server_id == server_id)
+ (void) sig_cond_wait(&tcdp->tcd_cv, &tcdp->tcd_lock);
+ pthread_cleanup_pop(1);
+}
+
+/*
+ * POSIX aio:
+ * If the notification type is SIGEV_THREAD, set up
+ * the port number for notifications. Create the
+ * thread pool and launch the spawner if necessary.
+ * If the notification type is not SIGEV_THREAD, do nothing.
+ */
+int
+_aio_sigev_thread_init(struct sigevent *sigevp)
+{
+ static mutex_t sigev_aio_lock = DEFAULTMUTEX;
+ static cond_t sigev_aio_cv = DEFAULTCV;
+ static int sigev_aio_busy = 0;
+
+ thread_communication_data_t *tcdp;
+ int port;
+ int rc = 0;
+
+ if (sigevp == NULL ||
+ sigevp->sigev_notify != SIGEV_THREAD ||
+ sigevp->sigev_notify_function == NULL)
+ return (0);
+
+ lmutex_lock(&sigev_aio_lock);
+ while (sigev_aio_busy)
+ (void) _cond_wait(&sigev_aio_cv, &sigev_aio_lock);
+ if ((tcdp = sigev_aio_tcd) != NULL)
+ port = tcdp->tcd_port;
+ else {
+ sigev_aio_busy = 1;
+ lmutex_unlock(&sigev_aio_lock);
+
+ tcdp = setup_sigev_handler(sigevp, AIO);
+ if (tcdp == NULL) {
+ port = -1;
+ rc = -1;
+ } else if (launch_spawner(tcdp) != 0) {
+ free_sigev_handler(tcdp);
+ tcdp = NULL;
+ port = -1;
+ rc = -1;
+ } else {
+ port = tcdp->tcd_port;
+ }
+
+ lmutex_lock(&sigev_aio_lock);
+ sigev_aio_tcd = tcdp;
+ sigev_aio_busy = 0;
+ (void) cond_broadcast(&sigev_aio_cv);
+ }
+ lmutex_unlock(&sigev_aio_lock);
+ sigevp->sigev_signo = port;
+ return (rc);
+}
+
+int
+_aio_sigev_thread(aiocb_t *aiocbp)
+{
+ if (aiocbp == NULL)
+ return (0);
+ return (_aio_sigev_thread_init(&aiocbp->aio_sigevent));
+}
+
+#if !defined(_LP64)
+int
+_aio_sigev_thread64(aiocb64_t *aiocbp)
+{
+ if (aiocbp == NULL)
+ return (0);
+ return (_aio_sigev_thread_init(&aiocbp->aio_sigevent));
+}
+#endif
+
+/*
+ * Cleanup POSIX aio after fork1() in the child process.
+ */
+void
+postfork1_child_sigev_aio(void)
+{
+ thread_communication_data_t *tcdp;
+
+ if ((tcdp = sigev_aio_tcd) != NULL) {
+ sigev_aio_tcd = NULL;
+ tcd_teardown(tcdp);
}
- (void) mutex_unlock(&tcdp->tcd_lock);
- if (rc == 0)
- free_sigev_handler(tcdp);
+}
+
+/*
+ * Utility function for the various postfork1_child_sigev_*() functions.
+ * Clean up the tcdp data structure and close the port.
+ */
+void
+tcd_teardown(thread_communication_data_t *tcdp)
+{
+ if (tcdp->tcd_poolp != NULL)
+ tpool_abandon(tcdp->tcd_poolp);
+ tcdp->tcd_poolp = NULL;
+ tcdp->tcd_server_id = 0;
+ free_sigev_handler(tcdp);
}
diff --git a/usr/src/lib/librt/common/sigev_thread.h b/usr/src/lib/libc/port/rt/sigev_thread.h
index 0d09bd0525..943cb8ab23 100644
--- a/usr/src/lib/librt/common/sigev_thread.h
+++ b/usr/src/lib/libc/port/rt/sigev_thread.h
@@ -39,7 +39,7 @@ extern "C" {
#include <time.h>
#include <limits.h>
#include <semaphore.h>
-#include "thread_pool.h"
+#include <thread_pool.h>
#define SIGEV_THREAD_TERM 1
@@ -85,18 +85,12 @@ typedef struct thread_communication_data {
#define tcd_msg_object tcd_object.mqueue.msg_object
#define tcd_msg_userval tcd_object.mqueue.msg_userval
-/*
- * Generic freelist data structure.
- */
-typedef struct {
- void *fl_next;
-} freelist_t;
-
/* Generic functions common to all entities */
extern thread_communication_data_t *setup_sigev_handler(
const struct sigevent *, subsystem_t);
extern void free_sigev_handler(thread_communication_data_t *);
extern int launch_spawner(thread_communication_data_t *);
+extern void tcd_teardown(thread_communication_data_t *);
/* Additional functions for different entities */
extern void *timer_spawner(void *);
@@ -106,26 +100,16 @@ extern void *mqueue_spawner(void *);
extern void del_sigev_mq(thread_communication_data_t *);
extern void *aio_spawner(void *);
-/* Consolidation-private interfaces from libc */
-#define PTHREAD_CREATE_DAEMON_NP 0x100 /* = THR_DAEMON */
-#define PTHREAD_CREATE_NONDAEMON_NP 0
-extern int _pthread_attr_setdaemonstate_np(pthread_attr_t *, int);
-extern int _pthread_attr_getdaemonstate_np(const pthread_attr_t *, int *);
+/* Private interfaces elsewhere in libc */
extern int _pthread_attr_clone(pthread_attr_t *, const pthread_attr_t *);
extern int _pthread_attr_equal(const pthread_attr_t *, const pthread_attr_t *);
extern int _port_dispatch(int, int, int, int, uintptr_t, void *);
extern thread_communication_data_t *sigev_aio_tcd;
-extern mutex_t sigev_aio_lock;
-extern cond_t sigev_aio_cv;
-extern int sigev_aio_busy;
-
extern int timer_max;
extern thread_communication_data_t **timer_tcd;
-extern mutex_t free_tcd_lock;
-
#ifdef __cplusplus
}
#endif
diff --git a/usr/src/lib/libc/port/sys/fsync.c b/usr/src/lib/libc/port/sys/fsync.c
index d6827f60f3..f727d5914f 100644
--- a/usr/src/lib/libc/port/sys/fsync.c
+++ b/usr/src/lib/libc/port/sys/fsync.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,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.
*/
@@ -31,15 +31,20 @@
/*
* fsync(int fd)
- *
+ * fdatasync(int fd)
*/
#include "synonyms.h"
-#include <sys/types.h>
#include "libc.h"
-#include "sys/file.h"
+#include <sys/file.h>
int
_fsync(int fd)
{
return (__fdsync(fd, FSYNC));
}
+
+int
+fdatasync(int fd)
+{
+ return (__fdsync(fd, FDSYNC));
+}
diff --git a/usr/src/lib/libc/port/sys/sigstack.c b/usr/src/lib/libc/port/sys/sigstack.c
index cf4335f2a2..9f34b2386a 100644
--- a/usr/src/lib/libc/port/sys/sigstack.c
+++ b/usr/src/lib/libc/port/sys/sigstack.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.
@@ -30,6 +29,8 @@
#pragma ident "%Z%%M% %I% %E% SMI"
+#pragma weak sigstack = _sigstack
+
#include "synonyms.h"
#include <sys/types.h>
#include <sys/ucontext.h>
diff --git a/usr/src/lib/libc/port/threads/assfail.c b/usr/src/lib/libc/port/threads/assfail.c
index e64aaa87a5..989a36923a 100644
--- a/usr/src/lib/libc/port/threads/assfail.c
+++ b/usr/src/lib/libc/port/threads/assfail.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,8 +18,9 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -91,8 +91,8 @@ Abort(const char *msg)
* Write a panic message w/o grabbing any locks other than assert_lock.
* We have no idea what locks are held at this point.
*/
-void
-thr_panic(const char *why)
+static void
+common_panic(const char *head, const char *why)
{
char msg[400]; /* no panic() message in the library is this long */
ulwp_t *self;
@@ -103,7 +103,7 @@ thr_panic(const char *why)
(void) _private_lwp_mutex_lock(&assert_lock);
(void) _private_memset(msg, 0, sizeof (msg));
- (void) strcpy(msg, "*** libc thread failure: ");
+ (void) strcpy(msg, head);
len1 = strlen(msg);
len2 = strlen(why);
if (len1 + len2 >= sizeof (msg))
@@ -116,6 +116,18 @@ thr_panic(const char *why)
Abort(msg);
}
+void
+thr_panic(const char *why)
+{
+ common_panic("*** libc thread failure: ", why);
+}
+
+void
+aio_panic(const char *why)
+{
+ common_panic("*** libc aio system failure: ", why);
+}
+
/*
* Utility function for converting a long integer to a string, avoiding stdio.
* 'base' must be one of 10 or 16
@@ -370,7 +382,8 @@ thread_error(const char *msg)
* We use __assfail() because the libc __assert() calls
* gettext() which calls malloc() which grabs a mutex.
* We do everything without calling standard i/o.
- * _assfail() is an exported function, __assfail() is private to libc.
+ * assfail() and _assfail() are exported functions;
+ * __assfail() is private to libc.
*/
#pragma weak _assfail = __assfail
void
@@ -416,3 +429,17 @@ __assfail(const char *assertion, const char *filename, int line_num)
*/
Abort(buf);
}
+
+/*
+ * We define and export this version of assfail() just because libaio
+ * used to define and export it, needlessly. Now that libaio is folded
+ * into libc, we need to continue this for ABI/version reasons.
+ * We don't use "#pragma weak assfail __assfail" in order to avoid
+ * warnings from the check_fnames utility at build time for libraries
+ * that define their own version of assfail().
+ */
+void
+assfail(const char *assertion, const char *filename, int line_num)
+{
+ __assfail(assertion, filename, line_num);
+}
diff --git a/usr/src/lib/libc/port/threads/pthr_attr.c b/usr/src/lib/libc/port/threads/pthr_attr.c
index 865c573dd0..bcae664e13 100644
--- a/usr/src/lib/libc/port/threads/pthr_attr.c
+++ b/usr/src/lib/libc/port/threads/pthr_attr.c
@@ -88,7 +88,6 @@ _pthread_attr_destroy(pthread_attr_t *attr)
/*
* _pthread_attr_clone: make a copy of a pthread_attr_t.
- * This is a consolidation-private interface, for librt.
*/
int
_pthread_attr_clone(pthread_attr_t *attr, const pthread_attr_t *old_attr)
@@ -231,7 +230,7 @@ _pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
/*
* pthread_attr_setdaemonstate_np: sets the daemon state to DAEMON or NONDAEMON.
* PTHREAD_CREATE_DAEMON is equivalent to thr_create(THR_DAEMON).
- * For now, this is a consolidation-private interface for librt.
+ * For now, this is a private interface in libc.
*/
int
_pthread_attr_setdaemonstate_np(pthread_attr_t *attr, int daemonstate)
@@ -249,7 +248,7 @@ _pthread_attr_setdaemonstate_np(pthread_attr_t *attr, int daemonstate)
/*
* pthread_attr_getdaemonstate_np: gets the daemon state.
- * For now, this is a consolidation-private interface for librt.
+ * For now, this is a private interface in libc.
*/
int
_pthread_attr_getdaemonstate_np(const pthread_attr_t *attr, int *daemonstate)
diff --git a/usr/src/lib/libc/port/threads/pthread.c b/usr/src/lib/libc/port/threads/pthread.c
index 5838a5aff7..2215647391 100644
--- a/usr/src/lib/libc/port/threads/pthread.c
+++ b/usr/src/lib/libc/port/threads/pthread.c
@@ -84,7 +84,7 @@ _pthread_create(pthread_t *thread, const pthread_attr_t *attr,
return (EINVAL);
mapped = 1;
mappedpri = priority;
- priority = _map_rtpri_to_gp(priority);
+ priority = map_rtpri_to_gp(priority);
ASSERT(priority >= THREAD_MIN_PRIORITY &&
priority <= THREAD_MAX_PRIORITY);
}
@@ -236,7 +236,7 @@ _thread_setschedparam_main(pthread_t tid, int policy,
}
mapped = 1;
mappedprio = prio;
- prio = _map_rtpri_to_gp(prio);
+ prio = map_rtpri_to_gp(prio);
ASSERT(prio >= THREAD_MIN_PRIORITY &&
prio <= THREAD_MAX_PRIORITY);
}
diff --git a/usr/src/lib/libc/port/threads/rtsched.c b/usr/src/lib/libc/port/threads/rtsched.c
index 60d3357655..a85118dc5c 100644
--- a/usr/src/lib/libc/port/threads/rtsched.c
+++ b/usr/src/lib/libc/port/threads/rtsched.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,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.
*/
@@ -39,9 +39,6 @@
* The following variables are used for caching information
* for priocntl TS and RT scheduling classs.
*/
-struct pcclass ts_class, rt_class;
-
-static rtdpent_t *rt_dptbl; /* RT class parameter table */
static int rt_rrmin;
static int rt_rrmax;
static int rt_fifomin;
@@ -50,87 +47,6 @@ static int rt_othermin;
static int rt_othermax;
/*
- * Get the RT class parameter table
- */
-static void
-_get_rt_dptbl()
-{
- struct pcclass *pccp;
- pcadmin_t pcadmin;
- rtadmin_t rtadmin;
- size_t rtdpsize;
-
- pccp = &ts_class;
- /* get class's info */
- (void) strcpy(pccp->pcc_info.pc_clname, "TS");
- if (priocntl(P_PID, 0, PC_GETCID, (caddr_t)&(pccp->pcc_info)) < 0)
- goto out;
-
- pccp = &rt_class;
- /* get class's info */
- (void) strcpy(pccp->pcc_info.pc_clname, "RT");
- if (priocntl(P_PID, 0, PC_GETCID, (caddr_t)&(pccp->pcc_info)) < 0)
- goto out;
-
- /* get RT class dispatch table in rt_dptbl */
- pcadmin.pc_cid = rt_class.pcc_info.pc_cid;
- pcadmin.pc_cladmin = (caddr_t)&rtadmin;
- rtadmin.rt_cmd = RT_GETDPSIZE;
- if (priocntl(P_PID, 0, PC_ADMIN, (caddr_t)&pcadmin) < 0)
- goto out;
- rtdpsize = rtadmin.rt_ndpents * sizeof (rtdpent_t);
- if (rt_dptbl == NULL && (rt_dptbl = lmalloc(rtdpsize)) == NULL)
- goto out;
- rtadmin.rt_dpents = rt_dptbl;
- rtadmin.rt_cmd = RT_GETDPTBL;
- if (priocntl(P_PID, 0, PC_ADMIN, (caddr_t)&pcadmin) < 0)
- goto out;
- pccp->pcc_primin = 0;
- pccp->pcc_primax = ((rtinfo_t *)rt_class.pcc_info.pc_clinfo)->rt_maxpri;
- return;
-out:
- thr_panic("get_rt_dptbl failed");
-}
-
-/*
- * Translate RT class's user priority to global scheduling priority.
- * This is for priorities coming from librt.
- */
-pri_t
-_map_rtpri_to_gp(pri_t pri)
-{
- static mutex_t map_lock = DEFAULTMUTEX;
- static int mapped = 0;
- rtdpent_t *rtdp;
- pri_t gpri;
-
- if (!mapped) {
- lmutex_lock(&map_lock);
- if (!mapped) { /* do this only once */
- _get_rt_dptbl();
- mapped = 1;
- }
- lmutex_unlock(&map_lock);
- }
-
- /* First case is the default case, other two are seldomly taken */
- if (pri <= rt_dptbl[rt_class.pcc_primin].rt_globpri) {
- gpri = pri + rt_dptbl[rt_class.pcc_primin].rt_globpri -
- rt_class.pcc_primin;
- } else if (pri >= rt_dptbl[rt_class.pcc_primax].rt_globpri) {
- gpri = pri + rt_dptbl[rt_class.pcc_primax].rt_globpri -
- rt_class.pcc_primax;
- } else {
- gpri = rt_dptbl[rt_class.pcc_primin].rt_globpri + 1;
- for (rtdp = rt_dptbl+1; rtdp->rt_globpri < pri; ++rtdp, ++gpri)
- ;
- if (rtdp->rt_globpri > pri)
- --gpri;
- }
- return (gpri);
-}
-
-/*
* Set the RT priority/policy of a lwp/thread.
*/
int
@@ -175,30 +91,16 @@ _thrp_setlwpprio(lwpid_t lwpid, int policy, int pri)
static void
_init_rt_prio_ranges()
{
- pcinfo_t info;
-
- (void) strcpy(info.pc_clname, "RT");
- if (priocntl(P_PID, 0, PC_GETCID, (caddr_t)&info) == -1L)
- rt_fifomin = rt_rrmin = rt_fifomax = rt_rrmax = 0;
- else {
- rtinfo_t *rtinfop = (rtinfo_t *)info.pc_clinfo;
- rt_fifomin = rt_rrmin = 0;
- rt_fifomax = rt_rrmax = rtinfop->rt_maxpri;
- }
-
- (void) strcpy(info.pc_clname, "TS");
- if (priocntl(P_PID, 0, PC_GETCID, (caddr_t)&info) == -1L)
- rt_othermin = rt_othermax = 0;
- else {
- tsinfo_t *tsinfop = (tsinfo_t *)info.pc_clinfo;
- pri_t pri = tsinfop->ts_maxupri / 3;
- rt_othermin = -pri;
- rt_othermax = pri;
- }
+ rt_rrmin = sched_get_priority_min(SCHED_RR);
+ rt_rrmax = sched_get_priority_max(SCHED_RR);
+ rt_fifomin = sched_get_priority_min(SCHED_FIFO);
+ rt_fifomax = sched_get_priority_max(SCHED_FIFO);
+ rt_othermin = sched_get_priority_min(SCHED_OTHER);
+ rt_othermax = sched_get_priority_max(SCHED_OTHER);
}
/*
- * Validate priorities from librt.
+ * Validate priorities.
*/
int
_validate_rt_prio(int policy, int pri)
diff --git a/usr/src/lib/libc/port/threads/scalls.c b/usr/src/lib/libc/port/threads/scalls.c
index b3287040f1..67a2a6341f 100644
--- a/usr/src/lib/libc/port/threads/scalls.c
+++ b/usr/src/lib/libc/port/threads/scalls.c
@@ -206,7 +206,7 @@ _fork1(void)
self->ul_siginfo.si_signo = 0;
udp->pid = _private_getpid();
/* reset the library's data structures to reflect one thread */
- _postfork1_child();
+ postfork1_child();
restore_signals(self);
_postfork_child_handler();
} else {
@@ -375,8 +375,8 @@ _forkall(void)
}
/*
- * Externally-callable cancellation prologue and epilogue
- * functions, for cancellation points outside of libc.
+ * Cancellation prologue and epilogue functions,
+ * for cancellation points too complex to include here.
*/
void
_cancel_prologue(void)
@@ -504,13 +504,14 @@ __xpg4_putpmsg(int fd, const struct strbuf *ctlptr,
PERFORM(_putpmsg(fd, ctlptr, dataptr, band, flags|MSG_XPG4))
}
+#pragma weak nanosleep = _nanosleep
int
-__nanosleep(const timespec_t *rqtp, timespec_t *rmtp)
+_nanosleep(const timespec_t *rqtp, timespec_t *rmtp)
{
int error;
PROLOGUE
- error = ___nanosleep(rqtp, rmtp);
+ error = __nanosleep(rqtp, rmtp);
EPILOGUE
if (error) {
errno = error;
@@ -519,8 +520,9 @@ __nanosleep(const timespec_t *rqtp, timespec_t *rmtp)
return (0);
}
+#pragma weak clock_nanosleep = _clock_nanosleep
int
-__clock_nanosleep(clockid_t clock_id, int flags,
+_clock_nanosleep(clockid_t clock_id, int flags,
const timespec_t *rqtp, timespec_t *rmtp)
{
timespec_t reltime;
@@ -550,7 +552,7 @@ __clock_nanosleep(clockid_t clock_id, int flags,
}
restart:
PROLOGUE
- error = ___nanosleep(&reltime, rmtp);
+ error = __nanosleep(&reltime, rmtp);
EPILOGUE
if (error == 0 && clock_id == CLOCK_HIGHRES) {
/*
@@ -607,7 +609,7 @@ _sleep(unsigned int sec)
ts.tv_sec = (time_t)sec;
ts.tv_nsec = 0;
PROLOGUE
- error = ___nanosleep(&ts, &tsr);
+ error = __nanosleep(&ts, &tsr);
EPILOGUE
if (error == EINTR) {
rem = (unsigned int)tsr.tv_sec;
@@ -626,7 +628,7 @@ _usleep(useconds_t usec)
ts.tv_sec = usec / MICROSEC;
ts.tv_nsec = (long)(usec % MICROSEC) * 1000;
PROLOGUE
- (void) ___nanosleep(&ts, NULL);
+ (void) __nanosleep(&ts, NULL);
EPILOGUE
return (0);
}
@@ -634,9 +636,11 @@ _usleep(useconds_t usec)
int
close(int fildes)
{
+ extern void _aio_close(int);
extern int _close(int);
int rv;
+ _aio_close(fildes);
PERFORM(_close(fildes))
}
@@ -856,17 +860,17 @@ _pollsys(struct pollfd *fds, nfds_t nfd, const timespec_t *timeout,
return (rv);
}
+#pragma weak sigtimedwait = _sigtimedwait
int
-__sigtimedwait(const sigset_t *set, siginfo_t *infop,
- const timespec_t *timeout)
+_sigtimedwait(const sigset_t *set, siginfo_t *infop, const timespec_t *timeout)
{
- extern int ___sigtimedwait(const sigset_t *, siginfo_t *,
+ extern int __sigtimedwait(const sigset_t *, siginfo_t *,
const timespec_t *);
siginfo_t info;
int sig;
PROLOGUE
- sig = ___sigtimedwait(set, &info, timeout);
+ sig = __sigtimedwait(set, &info, timeout);
if (sig == SIGCANCEL &&
(SI_FROMKERNEL(&info) || info.si_code == SI_LWP)) {
do_sigcancel();
@@ -883,7 +887,23 @@ __sigtimedwait(const sigset_t *set, siginfo_t *infop,
int
_sigwait(sigset_t *set)
{
- return (__sigtimedwait(set, NULL, NULL));
+ return (_sigtimedwait(set, NULL, NULL));
+}
+
+#pragma weak sigwaitinfo = _sigwaitinfo
+int
+_sigwaitinfo(const sigset_t *set, siginfo_t *info)
+{
+ return (_sigtimedwait(set, info, NULL));
+}
+
+#pragma weak sigqueue = _sigqueue
+int
+_sigqueue(pid_t pid, int signo, const union sigval value)
+{
+ extern int __sigqueue(pid_t pid, int signo,
+ /* const union sigval */ void *value, int si_code, int block);
+ return (__sigqueue(pid, signo, value.sival_ptr, SI_QUEUE, 0));
}
int
diff --git a/usr/src/lib/libc/port/threads/sigaction.c b/usr/src/lib/libc/port/threads/sigaction.c
index 670598961f..101b730af3 100644
--- a/usr/src/lib/libc/port/threads/sigaction.c
+++ b/usr/src/lib/libc/port/threads/sigaction.c
@@ -28,6 +28,7 @@
#include "lint.h"
#include "thr_uberdata.h"
+#include "asyncio.h"
#include <signal.h>
#include <siginfo.h>
#include <ucontext.h>
@@ -154,6 +155,22 @@ call_user_handler(int sig, siginfo_t *sip, ucontext_t *ucp)
do_sigcancel();
goto out;
}
+ /* SIGCANCEL is ignored by default */
+ if (uact.sa_sigaction == SIG_DFL ||
+ uact.sa_sigaction == SIG_IGN)
+ goto out;
+ }
+
+ /*
+ * If this thread has been sent SIGAIOCANCEL (SIGLWP) and
+ * we are an aio worker thread, cancel the aio request.
+ */
+ if (sig == SIGAIOCANCEL) {
+ aio_worker_t *aiowp = _pthread_getspecific(_aio_key);
+
+ if (sip != NULL && sip->si_code == SI_LWP && aiowp != NULL)
+ _siglongjmp(aiowp->work_jmp_buf, 1);
+ /* SIGLWP is ignored by default */
if (uact.sa_sigaction == SIG_DFL ||
uact.sa_sigaction == SIG_IGN)
goto out;
@@ -289,10 +306,9 @@ sigacthandler(int sig, siginfo_t *sip, void *uvp)
thr_panic("sigacthandler(): __setcontext() returned");
}
-#pragma weak sigaction = _libc_sigaction
-#pragma weak _sigaction = _libc_sigaction
+#pragma weak sigaction = _sigaction
int
-_libc_sigaction(int sig, const struct sigaction *nact, struct sigaction *oact)
+_sigaction(int sig, const struct sigaction *nact, struct sigaction *oact)
{
ulwp_t *self = curthread;
uberdata_t *udp = self->ul_uberdata;
@@ -341,10 +357,11 @@ _libc_sigaction(int sig, const struct sigaction *nact, struct sigaction *oact)
if (self->ul_vfork) {
if (tact.sa_sigaction != SIG_IGN)
tact.sa_sigaction = SIG_DFL;
- } else if (sig == SIGCANCEL) {
+ } else if (sig == SIGCANCEL || sig == SIGAIOCANCEL) {
/*
- * Always catch SIGCANCEL.
- * We need it for pthread_cancel() to work.
+ * Always catch these signals.
+ * We need SIGCANCEL for pthread_cancel() to work.
+ * We need SIGAIOCANCEL for aio_cancel() to work.
*/
udp->siguaction[sig].sig_uaction = tact;
if (tact.sa_sigaction == SIG_DFL ||
@@ -372,6 +389,16 @@ _libc_sigaction(int sig, const struct sigaction *nact, struct sigaction *oact)
oact->sa_sigaction != SIG_IGN)
*oact = oaction;
+ /*
+ * We detect setting the disposition of SIGIO just to set the
+ * _sigio_enabled flag for the asynchronous i/o (aio) code.
+ */
+ if (sig == SIGIO && rv == 0 && tactp != NULL) {
+ _sigio_enabled =
+ (tactp->sa_handler != SIG_DFL &&
+ tactp->sa_handler != SIG_IGN);
+ }
+
if (!self->ul_vfork)
lmutex_unlock(&udp->siguaction[sig].sig_lock);
return (rv);
@@ -619,18 +646,22 @@ do_sigcancel()
}
/*
- * Set up the SIGCANCEL handler for threads cancellation
- * (needed only when we have more than one thread).
- * We need no locks here because we are called from
- * finish_init() while still single-threaded.
+ * Set up the SIGCANCEL handler for threads cancellation,
+ * needed only when we have more than one thread,
+ * or the SIGAIOCANCEL handler for aio cancellation,
+ * called when aio is initialized, in __uaio_init().
*/
void
-init_sigcancel()
+setup_cancelsig(int sig)
{
uberdata_t *udp = curthread->ul_uberdata;
+ mutex_t *mp = &udp->siguaction[sig].sig_lock;
struct sigaction act;
- act = udp->siguaction[SIGCANCEL].sig_uaction;
+ ASSERT(sig == SIGCANCEL || sig == SIGAIOCANCEL);
+ lmutex_lock(mp);
+ act = udp->siguaction[sig].sig_uaction;
+ lmutex_unlock(mp);
if (act.sa_sigaction == SIG_DFL ||
act.sa_sigaction == SIG_IGN)
act.sa_flags = SA_SIGINFO;
@@ -640,5 +671,5 @@ init_sigcancel()
}
act.sa_sigaction = udp->sigacthandler;
act.sa_mask = maskset;
- (void) __sigaction(SIGCANCEL, &act, NULL);
+ (void) __sigaction(sig, &act, NULL);
}
diff --git a/usr/src/lib/libc/port/threads/spawn.c b/usr/src/lib/libc/port/threads/spawn.c
index 18a6d68e0b..143db8cf49 100644
--- a/usr/src/lib/libc/port/threads/spawn.c
+++ b/usr/src/lib/libc/port/threads/spawn.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,8 +18,9 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -35,6 +35,7 @@
#include <sys/ts.h>
#include <alloca.h>
#include <spawn.h>
+#include "rtsched.h"
#define ALL_POSIX_SPAWN_FLAGS \
(POSIX_SPAWN_RESETIDS | \
@@ -65,6 +66,8 @@ typedef struct file_attr {
int fa_newfiledes; /* new file descriptor for dup2() */
} file_attr_t;
+extern struct pcclass ts_class, rt_class;
+
extern pid_t _vfork(void);
#pragma unknown_control_flow(_vfork)
extern void *_private_memset(void *, int, size_t);
@@ -631,7 +634,10 @@ _posix_spawnattr_setflags(
* Populate ts_class and rt_class.
* We will need them in the child of vfork().
*/
- (void) _map_rtpri_to_gp(0);
+ if (rt_class.pcc_state == 0)
+ (void) get_info_by_policy(SCHED_FIFO);
+ if (ts_class.pcc_state == 0)
+ (void) get_info_by_policy(SCHED_OTHER);
}
sap->sa_psflags = flags;
diff --git a/usr/src/lib/libc/port/threads/synch.c b/usr/src/lib/libc/port/threads/synch.c
index 6856ebcc6b..9c6e918620 100644
--- a/usr/src/lib/libc/port/threads/synch.c
+++ b/usr/src/lib/libc/port/threads/synch.c
@@ -2184,6 +2184,77 @@ lmutex_unlock(mutex_t *mp)
exit_critical(self);
}
+/*
+ * For specialized code in libc, like the asynchronous i/o code,
+ * the following sig_*() locking primitives are used in order
+ * to make the code asynchronous signal safe. Signals are
+ * deferred while locks acquired by these functions are held.
+ */
+void
+sig_mutex_lock(mutex_t *mp)
+{
+ sigoff(curthread);
+ (void) _private_mutex_lock(mp);
+}
+
+void
+sig_mutex_unlock(mutex_t *mp)
+{
+ (void) _private_mutex_unlock(mp);
+ sigon(curthread);
+}
+
+int
+sig_mutex_trylock(mutex_t *mp)
+{
+ int error;
+
+ sigoff(curthread);
+ if ((error = _private_mutex_trylock(mp)) != 0)
+ sigon(curthread);
+ return (error);
+}
+
+/*
+ * sig_cond_wait() is a cancellation point.
+ */
+int
+sig_cond_wait(cond_t *cv, mutex_t *mp)
+{
+ int error;
+
+ ASSERT(curthread->ul_sigdefer != 0);
+ _private_testcancel();
+ error = _cond_wait(cv, mp);
+ if (error == EINTR && curthread->ul_cursig) {
+ sig_mutex_unlock(mp);
+ /* take the deferred signal here */
+ sig_mutex_lock(mp);
+ }
+ _private_testcancel();
+ return (error);
+}
+
+/*
+ * sig_cond_reltimedwait() is a cancellation point.
+ */
+int
+sig_cond_reltimedwait(cond_t *cv, mutex_t *mp, const timespec_t *ts)
+{
+ int error;
+
+ ASSERT(curthread->ul_sigdefer != 0);
+ _private_testcancel();
+ error = _cond_reltimedwait(cv, mp, ts);
+ if (error == EINTR && curthread->ul_cursig) {
+ sig_mutex_unlock(mp);
+ /* take the deferred signal here */
+ sig_mutex_lock(mp);
+ }
+ _private_testcancel();
+ return (error);
+}
+
static int
shared_mutex_held(mutex_t *mparg)
{
diff --git a/usr/src/lib/libc/port/threads/thr.c b/usr/src/lib/libc/port/threads/thr.c
index 37310cea56..2a9f9e89e1 100644
--- a/usr/src/lib/libc/port/threads/thr.c
+++ b/usr/src/lib/libc/port/threads/thr.c
@@ -1490,6 +1490,9 @@ libc_init(void)
if (self->ul_primarymap && __tnf_probe_notify != NULL)
__tnf_probe_notify();
/* PROBE_SUPPORT end */
+
+ init_sigev_thread();
+ init_aio();
}
#pragma fini(libc_fini)
@@ -1562,7 +1565,7 @@ finish_init()
/*
* Set up the SIGCANCEL handler for threads cancellation.
*/
- init_sigcancel();
+ setup_cancelsig(SIGCANCEL);
/*
* Arrange to do special things on exit --
@@ -1596,7 +1599,7 @@ mark_dead_and_buried(ulwp_t *ulwp)
* Reset our data structures to reflect one lwp.
*/
void
-_postfork1_child()
+postfork1_child()
{
ulwp_t *self = curthread;
uberdata_t *udp = self->ul_uberdata;
@@ -1668,6 +1671,15 @@ _postfork1_child()
udp->nzombies = 0;
}
trim_stack_cache(0);
+
+ /*
+ * Do post-fork1 processing for subsystems that need it.
+ */
+ postfork1_child_tpool();
+ postfork1_child_sigev_aio();
+ postfork1_child_sigev_mq();
+ postfork1_child_sigev_timer();
+ postfork1_child_aio();
}
#pragma weak thr_setprio = _thr_setprio
@@ -1761,7 +1773,7 @@ force_continue(ulwp_t *ulwp)
if (ulwp->ul_stopping) { /* he is stopping himself */
ts.tv_sec = 0; /* give him a chance to run */
ts.tv_nsec = 100000; /* 100 usecs or clock tick */
- (void) ___nanosleep(&ts, NULL);
+ (void) __nanosleep(&ts, NULL);
}
if (!ulwp->ul_stopping) /* he is running now */
break; /* so we are done */
@@ -2203,10 +2215,8 @@ _ti_bind_clear(int bindflag)
* Also, signals are deferred at thread startup until TLS constructors
* have all been called, at which time _thr_setup() calls sigon().
*
- * _sigoff() and _sigon() are external consolidation-private interfaces
- * to sigoff() and sigon(), respectively, in libc. _sigdeferred() is
- * a consolidation-private interface that returns the deferred signal
- * number, if any. These are used in libnsl, librt, and libaio.
+ * _sigoff() and _sigon() are external consolidation-private interfaces to
+ * sigoff() and sigon(), respectively, in libc. These are used in libnsl.
* Also, _sigoff() and _sigon() are called from dbx's run-time checking
* (librtc.so) to defer signals during its critical sections (not to be
* confused with libc critical sections [see exit_critical() above]).
@@ -2223,12 +2233,6 @@ _sigon(void)
sigon(curthread);
}
-int
-_sigdeferred(void)
-{
- return (curthread->ul_cursig);
-}
-
void
sigon(ulwp_t *self)
{
diff --git a/usr/src/lib/librt/common/thread_pool.c b/usr/src/lib/libc/port/tpool/thread_pool.c
index 7ea7aa19ee..5042f60301 100644
--- a/usr/src/lib/librt/common/thread_pool.c
+++ b/usr/src/lib/libc/port/tpool/thread_pool.c
@@ -26,7 +26,8 @@
#pragma ident "%Z%%M% %I% %E% SMI"
-#include "c_synonyms.h"
+#include "synonyms.h"
+#include "thr_uberdata.h"
#include <stdlib.h>
#include <signal.h>
#include <errno.h>
@@ -34,53 +35,18 @@
static mutex_t thread_pool_lock = DEFAULTMUTEX;
static tpool_t *thread_pools = NULL;
-static tpool_job_t *job_freelist = NULL;
-
-static pthread_once_t once_control = PTHREAD_ONCE_INIT;
-static sigset_t fillset;
-
-static void
-do_fillset(void)
-{
- (void) sigfillset(&fillset);
-}
-
-static tpool_job_t *
-job_alloc(void)
-{
- tpool_job_t *job;
-
- (void) mutex_lock(&thread_pool_lock);
- if ((job = job_freelist) == NULL) {
- (void) mutex_unlock(&thread_pool_lock);
- job = malloc(sizeof (tpool_job_t));
- } else {
- job_freelist = job->tpj_next;
- (void) mutex_unlock(&thread_pool_lock);
- }
- return (job);
-}
-
-static void
-job_free(tpool_job_t *job)
-{
- (void) mutex_lock(&thread_pool_lock);
- job->tpj_next = job_freelist;
- job_freelist = job;
- (void) mutex_unlock(&thread_pool_lock);
-}
static void
delete_pool(tpool_t *tpool)
{
tpool_job_t *job;
- /* ASSERT(tpool->tp_current == 0 && tpool->tp_active == NULL); */
+ ASSERT(tpool->tp_current == 0 && tpool->tp_active == NULL);
/*
* Unlink the pool from the global list of all pools.
*/
- (void) mutex_lock(&thread_pool_lock);
+ lmutex_lock(&thread_pool_lock);
if (thread_pools == tpool)
thread_pools = tpool->tp_forw;
if (thread_pools == tpool)
@@ -89,17 +55,17 @@ delete_pool(tpool_t *tpool)
tpool->tp_back->tp_forw = tpool->tp_forw;
tpool->tp_forw->tp_back = tpool->tp_back;
}
- (void) mutex_unlock(&thread_pool_lock);
+ lmutex_unlock(&thread_pool_lock);
/*
* There should be no pending jobs, but just in case...
*/
for (job = tpool->tp_head; job != NULL; job = tpool->tp_head) {
tpool->tp_head = job->tpj_next;
- job_free(job);
+ lfree(job, sizeof (*job));
}
(void) pthread_attr_destroy(&tpool->tp_attr);
- free(tpool);
+ lfree(tpool, sizeof (*tpool));
}
/*
@@ -108,17 +74,19 @@ delete_pool(tpool_t *tpool)
static void
worker_cleanup(tpool_t *tpool)
{
+ ASSERT(MUTEX_HELD(&tpool->tp_mutex));
+
if (--tpool->tp_current == 0 &&
(tpool->tp_flags & (TP_DESTROY | TP_ABANDON))) {
if (tpool->tp_flags & TP_ABANDON) {
- (void) mutex_unlock(&tpool->tp_mutex);
+ sig_mutex_unlock(&tpool->tp_mutex);
delete_pool(tpool);
return;
}
if (tpool->tp_flags & TP_DESTROY)
(void) cond_broadcast(&tpool->tp_busycv);
}
- (void) mutex_unlock(&tpool->tp_mutex);
+ sig_mutex_unlock(&tpool->tp_mutex);
}
static void
@@ -136,15 +104,15 @@ notify_waiters(tpool_t *tpool)
static void
job_cleanup(tpool_t *tpool)
{
- pthread_t self = pthread_self();
+ pthread_t my_tid = pthread_self();
tpool_active_t *activep;
tpool_active_t **activepp;
- (void) mutex_lock(&tpool->tp_mutex);
+ sig_mutex_lock(&tpool->tp_mutex);
/* CSTYLED */
for (activepp = &tpool->tp_active;; activepp = &activep->tpa_next) {
activep = *activepp;
- if (activep->tpa_tid == self) {
+ if (activep->tpa_tid == my_tid) {
*activepp = activep->tpa_next;
break;
}
@@ -162,7 +130,7 @@ tpool_worker(void *arg)
void (*func)(void *);
tpool_active_t active;
- (void) mutex_lock(&tpool->tp_mutex);
+ sig_mutex_lock(&tpool->tp_mutex);
pthread_cleanup_push(worker_cleanup, tpool);
/*
@@ -180,15 +148,15 @@ tpool_worker(void *arg)
!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON))) {
if (tpool->tp_current <= tpool->tp_minimum ||
tpool->tp_linger == 0) {
- (void) cond_wait(&tpool->tp_workcv,
+ (void) sig_cond_wait(&tpool->tp_workcv,
&tpool->tp_mutex);
} else {
timestruc_t timeout;
timeout.tv_sec = tpool->tp_linger;
timeout.tv_nsec = 0;
- if (cond_reltimedwait(&tpool->tp_workcv,
- &tpool->tp_mutex, &timeout) == ETIME) {
+ if (sig_cond_reltimedwait(&tpool->tp_workcv,
+ &tpool->tp_mutex, &timeout) != 0) {
elapsed = 1;
break;
}
@@ -217,9 +185,9 @@ tpool_worker(void *arg)
tpool->tp_njobs--;
active.tpa_next = tpool->tp_active;
tpool->tp_active = &active;
- (void) mutex_unlock(&tpool->tp_mutex);
- job_free(job);
+ sig_mutex_unlock(&tpool->tp_mutex);
pthread_cleanup_push(job_cleanup, tpool);
+ lfree(job, sizeof (*job));
/*
* Call the specified function.
*/
@@ -229,7 +197,7 @@ tpool_worker(void *arg)
* so we reset its signal mask and cancellation
* state back to the initial values.
*/
- (void) pthread_sigmask(SIG_SETMASK, &fillset, NULL);
+ (void) pthread_sigmask(SIG_SETMASK, &maskset, NULL);
(void) pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED,
NULL);
(void) pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,
@@ -258,8 +226,7 @@ create_worker(tpool_t *tpool)
sigset_t oset;
int error;
- (void) pthread_once(&once_control, do_fillset);
- (void) pthread_sigmask(SIG_SETMASK, &fillset, &oset);
+ (void) pthread_sigmask(SIG_SETMASK, &maskset, &oset);
error = pthread_create(NULL, &tpool->tp_attr, tpool_worker, tpool);
(void) pthread_sigmask(SIG_SETMASK, &oset, NULL);
return (error);
@@ -300,7 +267,7 @@ tpool_create(uint_t min_threads, uint_t max_threads, uint_t linger,
}
}
- tpool = calloc(1, sizeof (tpool_t));
+ tpool = lmalloc(sizeof (*tpool));
if (tpool == NULL) {
errno = ENOMEM;
return (NULL);
@@ -322,7 +289,7 @@ tpool_create(uint_t min_threads, uint_t max_threads, uint_t linger,
*/
error = _pthread_attr_clone(&tpool->tp_attr, attr);
if (error) {
- free(tpool);
+ lfree(tpool, sizeof (*tpool));
errno = error;
return (NULL);
}
@@ -334,7 +301,7 @@ tpool_create(uint_t min_threads, uint_t max_threads, uint_t linger,
PTHREAD_CREATE_DAEMON_NP);
/* insert into the global list of all thread pools */
- (void) mutex_lock(&thread_pool_lock);
+ lmutex_lock(&thread_pool_lock);
if (thread_pools == NULL) {
tpool->tp_forw = tpool;
tpool->tp_back = tpool;
@@ -345,7 +312,7 @@ tpool_create(uint_t min_threads, uint_t max_threads, uint_t linger,
tpool->tp_back = thread_pools->tp_back;
thread_pools->tp_back = tpool;
}
- (void) mutex_unlock(&thread_pool_lock);
+ lmutex_unlock(&thread_pool_lock);
return (tpool);
}
@@ -362,14 +329,15 @@ tpool_dispatch(tpool_t *tpool, void (*func)(void *), void *arg)
{
tpool_job_t *job;
- if ((job = job_alloc()) == NULL)
+ ASSERT(!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON)));
+
+ if ((job = lmalloc(sizeof (*job))) == NULL)
return (-1);
job->tpj_next = NULL;
job->tpj_func = func;
job->tpj_arg = arg;
- (void) mutex_lock(&tpool->tp_mutex);
- /* ASSERT(!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON))); */
+ sig_mutex_lock(&tpool->tp_mutex);
if (tpool->tp_head == NULL)
tpool->tp_head = job;
@@ -386,7 +354,7 @@ tpool_dispatch(tpool_t *tpool, void (*func)(void *), void *arg)
tpool->tp_current++;
}
- (void) mutex_unlock(&tpool->tp_mutex);
+ sig_mutex_unlock(&tpool->tp_mutex);
return (0);
}
@@ -400,10 +368,11 @@ tpool_destroy(tpool_t *tpool)
{
tpool_active_t *activep;
- /* ASSERT(!tpool_member(tpool)); */
- /* ASSERT(!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON))); */
+ ASSERT(!tpool_member(tpool));
+ ASSERT(!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON)));
- (void) mutex_lock(&tpool->tp_mutex);
+ sig_mutex_lock(&tpool->tp_mutex);
+ pthread_cleanup_push(sig_mutex_unlock, &tpool->tp_mutex);
/* mark the pool as being destroyed; wakeup idle workers */
tpool->tp_flags |= TP_DESTROY;
@@ -417,14 +386,14 @@ tpool_destroy(tpool_t *tpool)
/* wait for all active workers to finish */
while (tpool->tp_active != NULL) {
tpool->tp_flags |= TP_WAIT;
- (void) cond_wait(&tpool->tp_waitcv, &tpool->tp_mutex);
+ (void) sig_cond_wait(&tpool->tp_waitcv, &tpool->tp_mutex);
}
/* the last worker to terminate will wake us up */
while (tpool->tp_current != 0)
- (void) cond_wait(&tpool->tp_busycv, &tpool->tp_mutex);
+ (void) sig_cond_wait(&tpool->tp_busycv, &tpool->tp_mutex);
- (void) mutex_unlock(&tpool->tp_mutex);
+ pthread_cleanup_pop(1); /* sig_mutex_unlock(&tpool->tp_mutex); */
delete_pool(tpool);
}
@@ -435,18 +404,19 @@ tpool_destroy(tpool_t *tpool)
void
tpool_abandon(tpool_t *tpool)
{
- (void) mutex_lock(&tpool->tp_mutex);
- /* ASSERT(!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON))); */
+ ASSERT(!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON)));
+
+ sig_mutex_lock(&tpool->tp_mutex);
if (tpool->tp_current == 0) {
/* no workers, just delete the pool */
- (void) mutex_unlock(&tpool->tp_mutex);
+ sig_mutex_unlock(&tpool->tp_mutex);
delete_pool(tpool);
} else {
/* wake up all workers, last one will delete the pool */
tpool->tp_flags |= TP_ABANDON;
tpool->tp_flags &= ~TP_SUSPEND;
(void) cond_broadcast(&tpool->tp_workcv);
- (void) mutex_unlock(&tpool->tp_mutex);
+ sig_mutex_unlock(&tpool->tp_mutex);
}
}
@@ -457,24 +427,27 @@ tpool_abandon(tpool_t *tpool)
void
tpool_wait(tpool_t *tpool)
{
- /* ASSERT(!tpool_member(tpool)); */
- (void) mutex_lock(&tpool->tp_mutex);
- /* ASSERT(!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON))); */
+ ASSERT(!tpool_member(tpool));
+ ASSERT(!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON)));
+
+ sig_mutex_lock(&tpool->tp_mutex);
+ pthread_cleanup_push(sig_mutex_unlock, &tpool->tp_mutex);
while (tpool->tp_head != NULL || tpool->tp_active != NULL) {
tpool->tp_flags |= TP_WAIT;
- (void) cond_wait(&tpool->tp_waitcv, &tpool->tp_mutex);
- /* ASSERT(!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON))); */
+ (void) sig_cond_wait(&tpool->tp_waitcv, &tpool->tp_mutex);
+ ASSERT(!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON)));
}
- (void) mutex_unlock(&tpool->tp_mutex);
+ pthread_cleanup_pop(1); /* sig_mutex_unlock(&tpool->tp_mutex); */
}
void
tpool_suspend(tpool_t *tpool)
{
- (void) mutex_lock(&tpool->tp_mutex);
- /* ASSERT(!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON))); */
+ ASSERT(!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON)));
+
+ sig_mutex_lock(&tpool->tp_mutex);
tpool->tp_flags |= TP_SUSPEND;
- (void) mutex_unlock(&tpool->tp_mutex);
+ sig_mutex_unlock(&tpool->tp_mutex);
}
int
@@ -482,10 +455,12 @@ tpool_suspended(tpool_t *tpool)
{
int suspended;
- (void) mutex_lock(&tpool->tp_mutex);
- /* ASSERT(!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON))); */
+ ASSERT(!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON)));
+
+ sig_mutex_lock(&tpool->tp_mutex);
suspended = (tpool->tp_flags & TP_SUSPEND) != 0;
- (void) mutex_unlock(&tpool->tp_mutex);
+ sig_mutex_unlock(&tpool->tp_mutex);
+
return (suspended);
}
@@ -494,10 +469,11 @@ tpool_resume(tpool_t *tpool)
{
int excess;
- (void) mutex_lock(&tpool->tp_mutex);
- /* ASSERT(!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON))); */
+ ASSERT(!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON)));
+
+ sig_mutex_lock(&tpool->tp_mutex);
if (!(tpool->tp_flags & TP_SUSPEND)) {
- (void) mutex_unlock(&tpool->tp_mutex);
+ sig_mutex_unlock(&tpool->tp_mutex);
return;
}
tpool->tp_flags &= ~TP_SUSPEND;
@@ -508,62 +484,35 @@ tpool_resume(tpool_t *tpool)
break; /* pthread_create() failed */
tpool->tp_current++;
}
- (void) mutex_unlock(&tpool->tp_mutex);
+ sig_mutex_unlock(&tpool->tp_mutex);
}
int
tpool_member(tpool_t *tpool)
{
- pthread_t self = pthread_self();
+ pthread_t my_tid = pthread_self();
tpool_active_t *activep;
- (void) mutex_lock(&tpool->tp_mutex);
- /* ASSERT(!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON))); */
+ ASSERT(!(tpool->tp_flags & (TP_DESTROY | TP_ABANDON)));
+
+ sig_mutex_lock(&tpool->tp_mutex);
for (activep = tpool->tp_active; activep; activep = activep->tpa_next) {
- if (activep->tpa_tid == self) {
- (void) mutex_unlock(&tpool->tp_mutex);
+ if (activep->tpa_tid == my_tid) {
+ sig_mutex_unlock(&tpool->tp_mutex);
return (1);
}
}
- (void) mutex_unlock(&tpool->tp_mutex);
+ sig_mutex_unlock(&tpool->tp_mutex);
return (0);
}
void
-prefork1_tpool(void)
-{
- tpool_t *tpool;
-
- (void) mutex_lock(&thread_pool_lock);
- if ((tpool = thread_pools) != NULL) {
- do {
- (void) mutex_lock(&tpool->tp_mutex);
- } while ((tpool = tpool->tp_forw) != thread_pools);
- }
-}
-
-void
-postfork1_parent_tpool(void)
-{
- tpool_t *tpool;
-
- if ((tpool = thread_pools) != NULL) {
- do {
- (void) mutex_unlock(&tpool->tp_mutex);
- } while ((tpool = tpool->tp_forw) != thread_pools);
- }
- (void) mutex_unlock(&thread_pool_lock);
-}
-
-void
postfork1_child_tpool(void)
{
pthread_t my_tid = pthread_self();
tpool_t *tpool;
tpool_job_t *job;
- postfork1_parent_tpool(); /* release locks */
-
/*
* All of the thread pool workers are gone, except possibly
* for the current thread, if it is a thread pool worker thread.
@@ -583,7 +532,7 @@ top:
(void) cond_init(&tpool->tp_waitcv, USYNC_THREAD, NULL);
for (job = tpool->tp_head; job; job = tpool->tp_head) {
tpool->tp_head = job->tpj_next;
- job_free(job);
+ lfree(job, sizeof (*job));
}
tpool->tp_tail = NULL;
tpool->tp_njobs = 0;
diff --git a/usr/src/lib/librt/common/thread_pool_impl.h b/usr/src/lib/libc/port/tpool/thread_pool_impl.h
index 6c25b3c45f..66611778a0 100644
--- a/usr/src/lib/librt/common/thread_pool_impl.h
+++ b/usr/src/lib/libc/port/tpool/thread_pool_impl.h
@@ -29,7 +29,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
-#include "thread_pool.h"
+#include <thread_pool.h>
#ifdef __cplusplus
extern "C" {
@@ -88,13 +88,10 @@ struct tpool {
#define TP_DESTROY 0x04 /* pool is being destroyed */
#define TP_ABANDON 0x08 /* pool is abandoned (auto-destroy) */
-/* Consolidation-private interfaces from libc */
-#define PTHREAD_CREATE_DAEMON_NP 0x100 /* = THR_DAEMON */
-#define PTHREAD_CREATE_NONDAEMON_NP 0
-extern int _pthread_attr_setdaemonstate_np(pthread_attr_t *, int);
-extern int _pthread_attr_getdaemonstate_np(const pthread_attr_t *, int *);
extern int _pthread_attr_clone(pthread_attr_t *, const pthread_attr_t *);
+extern const sigset_t maskset; /* set of all maskable signals */
+
#ifdef __cplusplus
}
#endif
diff --git a/usr/src/lib/libc/sparc/Makefile b/usr/src/lib/libc/sparc/Makefile
index 7ce71b3756..50fa5f8c45 100644
--- a/usr/src/lib/libc/sparc/Makefile
+++ b/usr/src/lib/libc/sparc/Makefile
@@ -777,6 +777,24 @@ PORTI18N_COND= \
wcstol_longlong.o \
wcstoul_longlong.o
+AIOOBJS= \
+ aio.o \
+ aio_alloc.o \
+ posix_aio.o \
+
+RTOBJS= \
+ clock_timer.o \
+ fallocate.o \
+ mqueue.o \
+ pos4obj.o \
+ sched.o \
+ sem.o \
+ shm.o \
+ sigev_thread.o
+
+TPOOLOBJS= \
+ thread_pool.o
+
THREADSOBJS= \
alloc.o \
assfail.o \
@@ -899,6 +917,9 @@ MOSTOBJS= \
$(PORTSTDIO_W) \
$(PORTSYS) \
$(PORTSYS64) \
+ $(AIOOBJS) \
+ $(RTOBJS) \
+ $(TPOOLOBJS) \
$(THREADSOBJS) \
$(THREADSMACHOBJS) \
$(THREADSASMOBJS) \
@@ -1004,6 +1025,9 @@ SRCS= \
$(PORTREGEX:%.o=../port/regex/%.c) \
$(PORTSTDIO:%.o=../port/stdio/%.c) \
$(PORTSYS:%.o=../port/sys/%.c) \
+ $(AIOOBJS:%.o=../port/aio/%.c) \
+ $(RTOBJS:%.o=../port/rt/%.c) \
+ $(TPOOLOBJS:%.o=../port/tpool/%.c) \
$(THREADSOBJS:%.o=../port/threads/%.c) \
$(THREADSMACHOBJS:%.o=../$(MACH)/threads/%.c) \
$(UNWINDMACHOBJS:%.o=../port/unwind/%.c) \
@@ -1033,6 +1057,7 @@ $(MAPFILE):
# Files which need the threads .il inline template
TIL= \
+ aio.o \
alloc.o \
assfail.o \
atexit.o \
@@ -1042,7 +1067,9 @@ TIL= \
errno.o \
getctxt.o \
lwp.o \
+ ma.o \
machdep.o \
+ posix_aio.o \
pthr_attr.o \
pthr_barrier.o \
pthr_cond.o \
@@ -1055,6 +1082,7 @@ TIL= \
scalls.o \
sema.o \
sigaction.o \
+ sigev_thread.o \
spawn.o \
stack.o \
swapctxt.o \
@@ -1062,6 +1090,7 @@ TIL= \
tdb_agent.o \
thr.o \
thread_interface.o \
+ thread_pool.o \
tls.o \
tsd.o \
unwind.o
diff --git a/usr/src/lib/libc/sparcv9/Makefile b/usr/src/lib/libc/sparcv9/Makefile
index e5810b8bd2..3918386307 100644
--- a/usr/src/lib/libc/sparcv9/Makefile
+++ b/usr/src/lib/libc/sparcv9/Makefile
@@ -725,6 +725,24 @@ PORTI18N_COND= \
wcstol_longlong.o \
wcstoul_longlong.o
+AIOOBJS= \
+ aio.o \
+ aio_alloc.o \
+ posix_aio.o \
+
+RTOBJS= \
+ clock_timer.o \
+ fallocate.o \
+ mqueue.o \
+ pos4obj.o \
+ sched.o \
+ sem.o \
+ shm.o \
+ sigev_thread.o
+
+TPOOLOBJS= \
+ thread_pool.o
+
THREADSOBJS= \
alloc.o \
assfail.o \
@@ -844,6 +862,9 @@ MOSTOBJS= \
$(PORTSTDIO_W) \
$(PORTSYS) \
$(PORTSYS64) \
+ $(AIOOBJS) \
+ $(RTOBJS) \
+ $(TPOOLOBJS) \
$(THREADSOBJS) \
$(THREADSMACHOBJS) \
$(THREADSASMOBJS) \
@@ -949,6 +970,9 @@ SRCS= \
$(PORTREGEX:%.o=../port/regex/%.c) \
$(PORTSTDIO:%.o=../port/stdio/%.c) \
$(PORTSYS:%.o=../port/sys/%.c) \
+ $(AIOOBJS:%.o=../port/aio/%.c) \
+ $(RTOBJS:%.o=../port/rt/%.c) \
+ $(TPOOLOBJS:%.o=../port/tpool/%.c) \
$(THREADSOBJS:%.o=../port/threads/%.c) \
$(THREADSMACHOBJS:%.o=../$(MACH)/threads/%.c) \
$(UNWINDMACHOBJS:%.o=../port/unwind/%.c) \
@@ -977,6 +1001,7 @@ $(MAPFILE):
# Files which need the threads .il inline template
TIL= \
+ aio.o \
alloc.o \
assfail.o \
atexit.o \
@@ -986,7 +1011,9 @@ TIL= \
errno.o \
getctxt.o \
lwp.o \
+ ma.o \
machdep.o \
+ posix_aio.o \
pthr_attr.o \
pthr_barrier.o \
pthr_cond.o \
@@ -999,6 +1026,7 @@ TIL= \
scalls.o \
sema.o \
sigaction.o \
+ sigev_thread.o \
spawn.o \
stack.o \
swapctxt.o \
@@ -1006,6 +1034,7 @@ TIL= \
tdb_agent.o \
thr.o \
thread_interface.o \
+ thread_pool.o \
tls.o \
tsd.o \
unwind.o
diff --git a/usr/src/lib/libc/spec/Makefile.targ b/usr/src/lib/libc/spec/Makefile.targ
index 7b8d73ce11..4243823247 100644
--- a/usr/src/lib/libc/spec/Makefile.targ
+++ b/usr/src/lib/libc/spec/Makefile.targ
@@ -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.
@@ -20,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -30,7 +29,8 @@
LIBRARY = libc.a
VERS = .1
-OBJECTS = atomic.o \
+OBJECTS = aio.o \
+ atomic.o \
data.o \
door.o \
fmtmsg.o \
@@ -43,6 +43,7 @@ OBJECTS = atomic.o \
private.o \
privatedata.o \
regex.o \
+ rt.o \
stdio.o \
sys.o \
threads.o \
diff --git a/usr/src/lib/libc/spec/aio.spec b/usr/src/lib/libc/spec/aio.spec
new file mode 100644
index 0000000000..6b2612210e
--- /dev/null
+++ b/usr/src/lib/libc/spec/aio.spec
@@ -0,0 +1,83 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# 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.
+# 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 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+function aiocancel
+include <sys/asynch.h>, <aio.h>
+declaration int aiocancel(aio_result_t *resultp)
+version SUNW_1.23
+errno EACCES EFAULT EINVAL
+exception $return == -1
+end
+
+function aioread
+include <sys/types.h>, <sys/asynch.h>, <aio.h>
+declaration int aioread(int fildes, char *bufp, int bufs, \
+ off_t offset, int whence, aio_result_t *resultp)
+version SUNW_1.23
+errno EAGAIN EBADF EFAULT EINVAL ENOMEM
+exception $return == -1
+end
+
+function aioread64
+declaration int aioread64(int fd, caddr_t buf, int bufsz, off64_t offset, \
+ int whence, aio_result_t *resultp)
+arch i386 sparc
+version SUNW_1.23
+end
+
+function aiowait
+include <sys/asynch.h>, <aio.h>, <sys/time.h>
+declaration aio_result_t *aiowait(struct timeval *timeout)
+version SUNW_1.23
+errno EFAULT EINTR EINVAL
+exception $return == (aio_result_t *)-1
+end
+
+function aiowrite
+include <sys/types.h>, <sys/asynch.h>, <aio.h>
+declaration int aiowrite(int fildes, char *bufp, int bufs, \
+ off_t offset, int whence, aio_result_t *resultp)
+version SUNW_1.23
+errno EAGAIN EBADF EFAULT EINVAL ENOMEM
+exception $return == -1
+end
+
+function aiowrite64
+include <sys/types.h>, <sys/asynch.h>, <aio.h>
+declaration int aiowrite64(int fildes, char *bufp, int bufs, \
+ off64_t offset, int whence, aio_result_t *resultp)
+arch sparc i386
+version SUNW_1.23
+errno EAGAIN EBADF EFAULT EINVAL ENOMEM
+exception $return == -1
+end
+
+function assfail
+declaration int assfail(char *a, char *f, int l)
+version SUNW_1.23
+end
+
diff --git a/usr/src/lib/libc/spec/gen.spec b/usr/src/lib/libc/spec/gen.spec
index 9c547e1a37..2b14689e7a 100644
--- a/usr/src/lib/libc/spec/gen.spec
+++ b/usr/src/lib/libc/spec/gen.spec
@@ -1,7 +1,4 @@
#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
@@ -21,6 +18,10 @@
#
# CDDL HEADER END
#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
# ident "%Z%%M% %I% %E% SMI"
#
@@ -3281,6 +3282,11 @@ errno EPERM
exception $return == -1
end
+function _sigstack
+weak sigstack
+version SUNWprivate_1.1
+end
+
function sleep
include <unistd.h>
declaration unsigned sleep(unsigned seconds)
@@ -4842,19 +4848,6 @@ weak port_alert
version SUNWprivate_1.1
end
-function port_dispatch
-include <port.h>
-declaration int port_dispatch(int port, int flags, int source, int events, \
- uintptr_t object, void *user)
-version SUNWprivate_1.1
-errno EBADF EBADFD EINTR
-end
-
-function _port_dispatch
-weak port_dispatch
-version SUNWprivate_1.1
-end
-
function ucred_size
include <ucred.h>
declaration size_t ucred_size(void)
diff --git a/usr/src/lib/libc/spec/private.spec b/usr/src/lib/libc/spec/private.spec
index 2e26e10c8b..9868be02cf 100644
--- a/usr/src/lib/libc/spec/private.spec
+++ b/usr/src/lib/libc/spec/private.spec
@@ -41,26 +41,6 @@ function __class_quadruple # used by Sun's old Fortran 77 runtime libraries
version SUNWprivate_1.1
end
-function __clock_getres
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
-function __clock_gettime
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
-function __clock_nanosleep
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
-function __clock_settime
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
function __collate_init
#Declaration /* Unknown. */
version SUNWprivate_1.1
@@ -82,11 +62,6 @@ function __eucpctowc_gen
version SUNWprivate_1.1
end
-function __fdsync
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
function __fgetwc_dense
#Declaration /* Unknown. */
version SUNWprivate_1.1
@@ -319,11 +294,6 @@ function __multi_innetgr
version SUNWprivate_1.1
end
-function __nanosleep
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
function __nl_langinfo_std
#Declaration /* Unknown. */
version SUNWprivate_1.1
@@ -364,21 +334,6 @@ function __regfree_std
version SUNWprivate_1.1
end
-function __signotify
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
-function __sigqueue
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
-function __sigtimedwait
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
function __strcoll_C
#Declaration /* Unknown. */
version SUNWprivate_1.1
@@ -436,31 +391,6 @@ function __time_init
version SUNWprivate_1.1
end
-function __timer_create
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
-function __timer_delete
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
-function __timer_getoverrun
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
-function __timer_gettime
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
-function __timer_settime
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
function __towctrans_bc
#Declaration /* Unknown. */
version SUNWprivate_1.1
@@ -1376,11 +1306,6 @@ weak jrand48
version SUNWprivate_1.1
end
-function _kaio
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
function _l64a # extends libc/spec/gen.spec l64a
weak l64a
#Declaration /* Unknown. */
@@ -1744,16 +1669,6 @@ weak pthread_atfork
version SUNWprivate_1.1
end
-function _pthread_attr_clone
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
-function _pthread_attr_equal
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
function _pthread_attr_destroy
#Declaration /* Unknown. */
version SUNWprivate_1.1
@@ -1764,11 +1679,6 @@ function _pthread_attr_getdetachstate
version SUNWprivate_1.1
end
-function _pthread_attr_getdaemonstate_np
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
function _pthread_attr_getinheritsched
#Declaration /* Unknown. */
version SUNWprivate_1.1
@@ -1814,11 +1724,6 @@ function _pthread_attr_setdetachstate
version SUNWprivate_1.1
end
-function _pthread_attr_setdaemonstate_np
-#Declaration /* Unknown. */
-version SUNWprivate_1.1
-end
-
function _pthread_attr_setinheritsched
#Declaration /* Unknown. */
version SUNWprivate_1.1
@@ -2992,10 +2897,6 @@ arch sparc sparcv9
version SUNWprivate_1.1
end
-function kaio
-version SUNWprivate_1.1
-end
-
function makeut
version SUNWprivate_1.1
end
diff --git a/usr/src/lib/librt/spec/rt.spec b/usr/src/lib/libc/spec/rt.spec
index e008eb8686..52de0469bd 100644
--- a/usr/src/lib/librt/spec/rt.spec
+++ b/usr/src/lib/libc/spec/rt.spec
@@ -28,42 +28,42 @@
function aio_cancel
include <aio.h>
declaration int aio_cancel(int fildes, struct aiocb *aiocbp)
-version SUNW_0.7
+version SUNW_1.23
errno EBADF ENOSYS
end
function aio_fsync
include <aio.h>
declaration int aio_fsync(int op, aiocb_t *aiocbp)
-version SUNW_0.7
+version SUNW_1.23
errno EAGAIN EBADF EINVAL ENOSYS
end
function aio_read
include <aio.h>
declaration int aio_read(struct aiocb *aiocbp)
-version SUNW_0.7
+version SUNW_1.23
errno EAGAIN ENOSYS EBADF EINVAL ECANCELED EFBIG
end
function aio_write
include <aio.h>
declaration int aio_write(struct aiocb *aiocbp)
-version SUNW_0.7
+version SUNW_1.23
errno EAGAIN ENOSYS EBADF EINVAL ECANCELED EFBIG
end
function aio_return
include <aio.h>
declaration ssize_t aio_return(struct aiocb * aiocbp)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS
end
function aio_error
include <aio.h>
declaration int aio_error(const struct aiocb *aiocbp)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS
end
@@ -71,21 +71,21 @@ function aio_suspend
include <aio.h>
declaration int aio_suspend(const struct aiocb *const list[], int nent, \
const struct timespec *timeout)
-version SUNW_0.7
+version SUNW_1.23
errno EAGAIN EINTR ENOSYS
end
function posix_fallocate
include <fcntl.h>
declaration int posix_fallocate(int fd, off_t offset, off_t len)
-version SUNW_1.5
+version SUNW_1.23
errno EBADF EFBIG EINTR EINVAL EIO ENODEV ENOSPC ESPIPE
end
function fdatasync
include <unistd.h>
declaration int fdatasync(int fildes)
-version SUNW_0.7
+version SUNW_1.23
errno EBADF EINVAL ENOSYS
end
@@ -93,7 +93,7 @@ function lio_listio
include <aio.h>
declaration int lio_listio(int mode, struct aiocb *const list[], int nent, \
struct sigevent *sig)
-version SUNW_0.7
+version SUNW_1.23
errno EAGAIN EINVAL EINTR EIO ENOSYS ECANCELED \
EINPROGRESS EOVERFLOW EFBIG
end
@@ -102,77 +102,77 @@ function aio_waitn
include <aio.h>
declaration int aio_waitn(struct aiocb *list[], uint_t nent, \
uint_t *nwait, const struct timespec *timeout)
-version SUNW_1.3
+version SUNW_1.23
errno EAGAIN EINTR ETIME ENOMEM EFAULT EINVAL
end
-function aio_cancel64 extends librt/spec/rt.spec aio_cancel
+function aio_cancel64 extends libc/spec/rt.spec aio_cancel
declaration int aio_cancel64(int fildes, struct aiocb64 *aiocbp)
arch i386 sparc
-version SUNW_1.1
+version SUNW_1.23
end
-function aio_error64 extends librt/spec/rt.spec aio_error
+function aio_error64 extends libc/spec/rt.spec aio_error
declaration int aio_error64(const struct aiocb64 *aiocbp)
arch i386 sparc
-version SUNW_1.1
+version SUNW_1.23
end
-function aio_fsync64 extends librt/spec/rt.spec aio_fsync
+function aio_fsync64 extends libc/spec/rt.spec aio_fsync
declaration int aio_fsync64(int op, struct aiocb64 *aiocbp)
arch i386 sparc
-version SUNW_1.1
+version SUNW_1.23
end
-function aio_read64 extends librt/spec/rt.spec aio_read
+function aio_read64 extends libc/spec/rt.spec aio_read
declaration int aio_read64(struct aiocb64 *aiocbp)
arch i386 sparc
-version SUNW_1.1
+version SUNW_1.23
end
-function aio_return64 extends librt/spec/rt.spec aio_return
+function aio_return64 extends libc/spec/rt.spec aio_return
declaration ssize_t aio_return64(struct aiocb64 * aiocbp)
arch i386 sparc
-version SUNW_1.1
+version SUNW_1.23
end
-function aio_suspend64 extends librt/spec/rt.spec aio_suspend
+function aio_suspend64 extends libc/spec/rt.spec aio_suspend
declaration int aio_suspend64(const struct aiocb64 *const list[], \
int nent, const struct timespec *timeout)
arch i386 sparc
-version SUNW_1.1
+version SUNW_1.23
end
-function aio_write64 extends librt/spec/rt.spec aio_write
+function aio_write64 extends libc/spec/rt.spec aio_write
declaration int aio_write64(struct aiocb64 *aiocbp)
arch i386 sparc
-version SUNW_1.1
+version SUNW_1.23
end
-function lio_listio64 extends librt/spec/rt.spec lio_listio
+function lio_listio64 extends libc/spec/rt.spec lio_listio
declaration int lio_listio64(int mode, struct aiocb64 *const list[], \
int nent, struct sigevent *sig)
arch i386 sparc
-version SUNW_1.1
+version SUNW_1.23
end
-function aio_waitn64 extends librt/spec/rt.spec aio_waitn
+function aio_waitn64 extends libc/spec/rt.spec aio_waitn
declaration int aio_waitn64(struct aiocb64 *list[], uint_t nent, \
uint_t *nwait, const struct timespec *timeout)
arch i386 sparc
-version SUNW_1.3
+version SUNW_1.23
end
-function posix_fallocate64 extends librt/spec/rt.spec posix_fallocate
-declaration int posix_fallocate(int fd, off64_t offset, off64_t len)
+function posix_fallocate64 extends libc/spec/rt.spec posix_fallocate
+declaration int posix_fallocate64(int fd, off64_t offset, off64_t len)
arch i386 sparc
-version SUNW_1.5
+version SUNW_1.23
end
function mq_close
include <mqueue.h>
declaration int mq_close(mqd_t mqdes)
-version SUNW_0.7
+version SUNW_1.23
errno EBADF ENOSYS
exception $return == -1
end
@@ -180,7 +180,7 @@ end
function mq_notify
include <mqueue.h>
declaration int mq_notify(mqd_t mqdes, const struct sigevent *notification)
-version SUNW_0.7
+version SUNW_1.23
errno EBADF EBUSY ENOSYS
exception $return == -1
end
@@ -188,7 +188,7 @@ end
function mq_open
include <mqueue.h>
declaration mqd_t mq_open(const char *name, int oflag, ...)
-version SUNW_0.7
+version SUNW_1.23
errno EACCESS EEXIST EINTR EINVAL EMFILE ENAMETOOLONG ENFILE \
ENOENT ENOSPC ENOSYS
exception $return == (mqd_t)(-1)
@@ -198,7 +198,7 @@ function mq_receive
include <mqueue.h>
declaration ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, \
size_t msg_len, unsigned int *msg_prio)
-version SUNW_0.7
+version SUNW_1.23
errno EAGAIN EBADF EMSGSIZE EINTR
exception $return == (ssize_t)(-1)
end
@@ -208,7 +208,7 @@ include <mqueue.h>, <time.h>
declaration ssize_t mq_timedreceive(mqd_t mqdes, char *msg_ptr, \
size_t msg_len, unsigned int *msg_prio, \
const struct timespec *abs_timeout)
-version SUNW_1.4
+version SUNW_1.23
errno EAGAIN EBADF EMSGSIZE EINTR ETIMEDOUT
exception $return == (ssize_t)(-1)
end
@@ -218,7 +218,7 @@ include <mqueue.h>, <time.h>
declaration ssize_t mq_reltimedreceive_np(mqd_t mqdes, char *msg_ptr, \
size_t msg_len, unsigned int *msg_prio, \
const struct timespec *rel_timeout)
-version SUNW_1.4
+version SUNW_1.23
errno EAGAIN EBADF EMSGSIZE EINTR ETIMEDOUT
exception $return == (ssize_t)(-1)
end
@@ -227,7 +227,7 @@ function mq_send
include <mqueue.h>
declaration int mq_send(mqd_t mqdes, const char *msg_ptr, \
size_t msg_len, unsigned int msg_prio)
-version SUNW_0.7
+version SUNW_1.23
errno EAGAIN EBADF EINTR EMSGSIZE
exception $return == -1
end
@@ -237,7 +237,7 @@ include <mqueue.h>, <time.h>
declaration int mq_timedsend(mqd_t mqdes, const char *msg_ptr, \
size_t msg_len, unsigned int msg_prio, \
const struct timespec *abs_timeout)
-version SUNW_1.4
+version SUNW_1.23
errno EAGAIN EBADF EINTR EMSGSIZE ETIMEDOUT
exception $return == -1
end
@@ -247,7 +247,7 @@ include <mqueue.h>, <time.h>
declaration int mq_reltimedsend_np(mqd_t mqdes, const char *msg_ptr, \
size_t msg_len, unsigned int msg_prio, \
const struct timespec *rel_timeout)
-version SUNW_1.4
+version SUNW_1.23
errno EAGAIN EBADF EINTR EMSGSIZE ETIMEDOUT
exception $return == -1
end
@@ -257,7 +257,7 @@ include <mqueue.h>
declaration int mq_setattr(mqd_t mqdes, \
const struct mq_attr *_RESTRICT_KYWD mqstat, \
struct mq_attr *_RESTRICT_KYWD omqstat)
-version SUNW_0.7
+version SUNW_1.23
errno EBADF ENOSYS
exception $return == -1
end
@@ -265,7 +265,7 @@ end
function mq_getattr
include <mqueue.h>
declaration int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat)
-version SUNW_0.7
+version SUNW_1.23
errno EBADF ENOSYS
exception $return == -1
end
@@ -273,7 +273,7 @@ end
function mq_unlink
include <mqueue.h>
declaration int mq_unlink(const char *name)
-version SUNW_0.7
+version SUNW_1.23
errno EACCESS ENAMETOOLONG ENOENT ENOSYS
exception $return == -1
end
@@ -282,7 +282,7 @@ function nanosleep
include <time.h>
declaration int nanosleep(const struct timespec *rqtp, \
struct timespec *rmtp)
-version SUNW_0.7
+version SUNW_1.23
errno EINTR EINVAL
end
@@ -290,42 +290,42 @@ function clock_nanosleep
include <time.h>
declaration int clock_nanosleep(clockid_t clock_id, int flags, \
const struct timespec *rqtp, struct timespec *rmtp)
-version SUNW_1.4
+version SUNW_1.23
errno EINTR EINVAL
end
function sched_get_priority_max
include <sched.h>
declaration int sched_get_priority_max(int policy)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS ESRCH
end
function sched_get_priority_min
include <sched.h>
declaration int sched_get_priority_min(int policy)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS ESRCH
end
function sched_rr_get_interval
include <sched.h>
declaration int sched_rr_get_interval(pid_t pid, struct timespec *interval)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS ESRCH
end
function sched_setparam
include <sched.h>
declaration int sched_setparam(pid_t pid, const struct sched_param *param)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS EPERM ESRCH
end
function sched_getparam
include <sched.h>
declaration int sched_getparam(pid_t pid, struct sched_param *param)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS EPERM ESRCH
end
@@ -333,56 +333,56 @@ function sched_setscheduler
include <sched.h>
declaration int sched_setscheduler(pid_t pid, int policy, \
const struct sched_param *param)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS EPERM ESRCH
end
function sched_getscheduler
include <sched.h>
declaration int sched_getscheduler(pid_t pid)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS EPERM ESRCH
end
function sched_yield
include <sched.h>
declaration int sched_yield(void)
-version SUNW_0.7
+version SUNW_1.23
errno ENOSYS
end
function sem_close
include <semaphore.h>
declaration int sem_close(sem_t *sem)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS
end
function sem_destroy
include <semaphore.h>
declaration int sem_destroy(sem_t *sem)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS EBUSY
end
function sem_getvalue
include <semaphore.h>
declaration int sem_getvalue(sem_t *sem, int *sval)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS
end
function sem_init
include <semaphore.h>, <unistd.h>
declaration int sem_init(sem_t *sem, int pshared, unsigned int value)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSPC ENOSYS EPERM
end
function sem_open
include <semaphore.h>, <unistd.h>, <sys/stat.h>
declaration sem_t *sem_open(const char *name, int oflag, ...)
-version SUNW_0.7
+version SUNW_1.23
errno EACCES EEXIST EINTR EINVAL EMFILE ENAMETOOLONG ENFILE \
ENOENT ENOSPC ENOSYS
end
@@ -390,63 +390,63 @@ end
function sem_post
include <semaphore.h>
declaration int sem_post(sem_t *sem)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS
end
function sem_unlink
include <semaphore.h>
declaration int sem_unlink(const char *name)
-version SUNW_0.7
+version SUNW_1.23
errno EACCES ENAMETOOLONG ENOENT ENOSYS
end
function sem_wait
include <semaphore.h>
declaration int sem_wait(sem_t *sem)
-version SUNW_0.7
+version SUNW_1.23
errno EAGAIN EINVAL EINTR ENOSYS EDEADLK
end
function sem_timedwait
include <semaphore.h> <time.h>
declaration int sem_timedwait(sem_t *sem, const timespec_t *abstime)
-version SUNW_1.4
+version SUNW_1.23
errno EAGAIN EINVAL EINTR ETIMEDOUT EDEADLK
end
function sem_reltimedwait_np
include <semaphore.h> <time.h>
declaration int sem_reltimedwait_np(sem_t *sem, const timespec_t *reltime)
-version SUNW_1.4
+version SUNW_1.23
errno EAGAIN EINVAL EINTR ETIMEDOUT EDEADLK
end
function sem_trywait
include <semaphore.h>
declaration int sem_trywait(sem_t *sem)
-version SUNW_0.7
+version SUNW_1.23
errno EAGAIN EINVAL EINTR ENOSYS EDEADLK
end
function shm_open
include <sys/mman.h>, <sys/types.h>, <sys/stat.h>, <fcntl.h>
declaration int shm_open(const char *name, int oflag, mode_t mode)
-version SUNW_0.7
+version SUNW_1.23
errno EACCES EEXIST EINTR EINVAL EMFILE ENAMETOOLONG ENFILE \
ENOENT ENOSPC ENOSYS
end
function shm_unlink
declaration int shm_unlink(const char *name)
-version SUNW_0.7
+version SUNW_1.23
errno EACCES ENAMETOOLONG ENOENT ENOSYS
end
function sigqueue
include <signal.h>
declaration int sigqueue(pid_t pid, int signo, const union sigval value)
-version SUNW_0.7
+version SUNW_1.23
errno EAGAIN EINVAL ENOSYS EPERM ESRCH
end
@@ -454,7 +454,7 @@ function sigwaitinfo
include <signal.h>
declaration int sigwaitinfo(const sigset_t *_RESTRICT_KYWD set, \
siginfo_t *_RESTRICT_KYWD info)
-version SUNW_0.7
+version SUNW_1.23
errno EINTR ENOSYS EAGAIN EINVAL
end
@@ -463,7 +463,7 @@ include <signal.h>
declaration int sigtimedwait(const sigset_t *_RESTRICT_KYWD set, \
siginfo_t *_RESTRICT_KYWD info, \
const struct timespec *_RESTRICT_KYWD timeout)
-version SUNW_0.7
+version SUNW_1.23
errno EINTR ENOSYS EAGAIN EINVAL
end
@@ -471,14 +471,14 @@ function timer_create
include <signal.h>, <time.h>
declaration int timer_create(clockid_t clock_id, struct sigevent *evp, \
timer_t *timerid)
-version SUNW_0.7
+version SUNW_1.23
errno EAGAIN EINVAL ENOSYS
end
function timer_delete
include <time.h>
declaration int timer_delete(timer_t timerid)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS
end
@@ -487,42 +487,42 @@ include <time.h>
declaration int timer_settime(timer_t timerid, int flags, \
const struct itimerspec *value, \
struct itimerspec *ovalue)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS
end
function timer_gettime
include <time.h>
declaration int timer_gettime(timer_t timerid, struct itimerspec *value)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS
end
function timer_getoverrun
include <time.h>
declaration int timer_getoverrun(timer_t timerid)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS
end
function clock_settime
include <time.h>
declaration int clock_settime(clockid_t clock_id, const struct timespec *tp)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS EPERM
end
function clock_gettime
include <time.h>
declaration int clock_gettime(clockid_t clock_id, struct timespec *tp)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS EPERM
end
function clock_getres
include <time.h>
declaration int clock_getres(clockid_t clock_id, struct timespec *res)
-version SUNW_0.7
+version SUNW_1.23
errno EINVAL ENOSYS EPERM
end
@@ -566,16 +566,6 @@ function _timer_settime
version SUNWprivate_1.1
end
-function fork
-version SUNW_1.1
-filter libc.so.1
-end
-
-function close extends libc/spec/sys.spec
-version SUNW_1.2
-binding nodirect
-end
-
#
# Weak Specs
#
@@ -649,7 +639,3 @@ weak sigqueue
version SUNWprivate_1.1
end
-function __posix_aio_close
-weak close
-version SUNWprivate_1.1
-end
diff --git a/usr/src/lib/libc/spec/sys.spec b/usr/src/lib/libc/spec/sys.spec
index e780453a1d..89aa86beb9 100644
--- a/usr/src/lib/libc/spec/sys.spec
+++ b/usr/src/lib/libc/spec/sys.spec
@@ -1,3 +1,4 @@
+#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
@@ -17,6 +18,7 @@
#
# CDDL HEADER END
#
+#
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
@@ -2377,11 +2379,6 @@ version sparc=SYSVABI_1.3 i386=SYSVABI_1.3 sparcv9=SUNW_0.7 \
binding nodirect
end
-function _libc_sigaction
-weak sigaction
-version SUNWprivate_1.1
-end
-
function sigaltstack
include <signal.h>
declaration int sigaltstack(const stack_t *_RESTRICT_KYWD ss, \
diff --git a/usr/src/lib/libc/spec/threads.spec b/usr/src/lib/libc/spec/threads.spec
index 1bd84cfbeb..21e22d308a 100644
--- a/usr/src/lib/libc/spec/threads.spec
+++ b/usr/src/lib/libc/spec/threads.spec
@@ -1,4 +1,6 @@
#
+# CDDL HEADER START
+#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
@@ -951,14 +953,6 @@ arch i386
version i386=SUNWprivate_1.1
end
-function _cancel_prologue
-version SUNWprivate_1.1
-end
-
-function _cancel_epilogue
-version SUNWprivate_1.1
-end
-
function _sigoff
version SUNWprivate_1.1
end
@@ -967,10 +961,6 @@ function _sigon
version SUNWprivate_1.1
end
-function _sigdeferred
-version SUNWprivate_1.1
-end
-
function _thr_detach
version SUNWprivate_1.1
end
diff --git a/usr/src/lib/librt/Makefile b/usr/src/lib/librt/Makefile
index 309ff2fa5f..91de6ce168 100644
--- a/usr/src/lib/librt/Makefile
+++ b/usr/src/lib/librt/Makefile
@@ -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.
@@ -20,59 +19,30 @@
# CDDL HEADER END
#
#
-# Copyright 1997-2003 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-#pragma ident "%Z%%M% %I% %E% SMI"
+# ident "%Z%%M% %I% %E% SMI"
#
-# lib/librt/Makefile
-#
-LIBRARY = librt.a
-VERS = .1
-include ../Makefile.lib
+include ../Makefile.lib
-SUBDIRS = $(MACH)
+SUBDIRS = $(MACH)
$(BUILD64)SUBDIRS += $(MACH64)
-# conditional assignments
all := TARGET= all
-install := TARGET= install
clean := TARGET= clean
clobber := TARGET= clobber
+install := TARGET= install
lint := TARGET= lint
-catalog := TARGET= catalog
-package := TARGET= package
-
-# include common library definitions
-
-#HDRS =
-ROOTHDRDIR = $(ROOT)/usr/include/sys
-ROOTHDRS = $(HDRS:%=$(ROOTHDRDIR)/%)
-
-$(ROOTHDRS) := FILEMODE = 644
.KEEP_STATE:
-all install clean clobber: spec .WAIT $(SUBDIRS)
+all clean clobber install: $(SUBDIRS)
lint: $(SUBDIRS)
-spec $(SUBDIRS): FRC
+$(SUBDIRS): FRC
@cd $@; pwd; $(MAKE) $(TARGET)
-install: $(ROOTLIBS) $(ROOTLINKS)
-
-$(ROOTHDRDIR)/% : %
- $(INS.file)
-
-install_h: $(ROOTHDRS)
-
-clean clobber: FRC
- @cd $(MACH); pwd; $(MAKE) $@
-
-links:
- -$(RM) $(MACH)
- $(SYMLINK) `mach` $(MACH)
-
FRC:
diff --git a/usr/src/lib/librt/Makefile.com b/usr/src/lib/librt/Makefile.com
index 3a5e1bee02..66458cd5b4 100644
--- a/usr/src/lib/librt/Makefile.com
+++ b/usr/src/lib/librt/Makefile.com
@@ -24,93 +24,37 @@
#
# ident "%Z%%M% %I% %E% SMI"
#
-# lib/librt/Makefile.com
-LIBRARY= librt.a
-VERS= .1
-
-OBJECTS= \
- aio.o \
- clock_timer.o \
- fallocate.o \
- fdatasync.o \
- mqueue.o \
- pos4.o \
- pos4obj.o \
- sched.o \
- sem.o \
- shm.o \
- sigev_thread.o \
- sigrt.o \
- thread_pool.o
+LIBRARY = librt.a
+VERS = .1
include ../../Makefile.lib
include ../../Makefile.rootfs
-LIBS = $(DYNLIB) $(LINTLIB)
-LDLIBS += -laio -lc
-$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
-
-SRCDIR= ../common
-MAPDIR= ../spec/$(TRANSMACH)
-SPECMAPFILE= $(MAPDIR)/mapfile
-
-ROOTLINTDIR64= $(ROOTLIBDIR64)
-ROOTLINKS64= $(ROOTLIBDIR64)/$(LIBLINKS)
-
-# Setting LIBRT_DEBUG = -DDEBUG (make LIBRT_DEBUG=-DDEBUG ...)
-# enables ASSERT() checking in the library.
-# This is automatically enabled for DEBUG builds, not for non-debug builds.
-LIBRT_DEBUG =
-$(NOT_RELEASE_BUILD)LIBRT_DEBUG = -DDEBUG
+MAPFILES= mapfile-vers $(MAPFILE-FLTR)
+MAPOPTS= $(MAPFILES:%=-M %)
-CFLAGS += $(CCVERBOSE)
-CPPFLAGS += $(LIBRT_DEBUG) -D_REENTRANT -I../../common/inc
+DYNFLAGS += -F libc.so.1 $(MAPOPTS)
-#
-# If and when somebody gets around to messaging this, CLOBBERFILE should not
-# be cleared (so that any .po file will be clobbered.
-#
-CLOBBERFILES= test
+LIBS = $(DYNLIB) $(LINTLIB)
-.KEEP_STATE:
+SRCDIR = ../common
+$(LINTLIB) := SRCS = $(SRCDIR)/llib-lrt
-all: $(LIBS) fnamecheck
-lint: lintcheck
+# Redefine shared object build rule to use $(LD) directly (this avoids .init
+# and .fini sections being added). Also, since there are no OBJECTS, turn
+# off CTF.
-# install rule for 64 bit lint library target
-$(ROOTLINTDIR64)/%.ln: %.ln
- $(INS.file)
- cd $(ROOTLINTDIR64); \
- $(RM) llib-lposix4.ln ; \
- $(SYMLINK) ./llib-lrt.ln llib-lposix4.ln ;
+BUILD.SO= $(LD) -o $@ -G $(DYNFLAGS)
+CTFMERGE_LIB= :
-# install rule for lint library target
-$(ROOTLINTDIR)/%.ln: %.ln
- $(INS.file)
- cd $(ROOTLINTDIR); \
- $(RM) llib-lposix4 ; \
- $(SYMLINK) ./llib-lrt llib-lposix4 ; \
- $(RM) llib-lposix4.ln ; \
- $(SYMLINK) ./llib-lrt.ln llib-lposix4.ln ;
+.KEEP_STATE:
include ../../Makefile.targ
-# install rules for 32-bit librt.so in /usr/lib
-$(ROOTLINKS) := INS.liblink= \
- $(RM) $@; $(SYMLINK) $(LIBLINKPATH)$(LIBLINKS)$(VERS) $@; \
- cd $(ROOTLIBDIR); \
- $(RM) libposix4.so$(VERS) libposix4.so; \
- $(SYMLINK) librt.so$(VERS) libposix4.so$(VERS); \
- $(SYMLINK) libposix4.so$(VERS) libposix4.so;
+all: $(LIBS)
-# install rules for 64-bit librt.so in /usr/lib/sparcv9
-$(ROOTLIBDIR64)/$(LIBLINKS) := INS.liblink64 = \
- -$(RM) $@; \
- cd $(ROOTLIBDIR64); \
- $(RM) libposix4.so$(VERS) libposix4.so ; \
- $(SYMLINK) $(LIBLINKS)$(VERS) $(LIBLINKS); \
- $(SYMLINK) librt.so$(VERS) libposix4.so$(VERS); \
- $(SYMLINK) libposix4.so$(VERS) libposix4.so
+lint:
+$(DYNLIB): $(MAPFILES)
diff --git a/usr/src/lib/librt/amd64/Makefile b/usr/src/lib/librt/amd64/Makefile
index 0c6326a6de..249f249362 100644
--- a/usr/src/lib/librt/amd64/Makefile
+++ b/usr/src/lib/librt/amd64/Makefile
@@ -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.
@@ -20,7 +19,7 @@
# 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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -29,4 +28,6 @@
include ../Makefile.com
include ../../Makefile.lib.64
-install: all $(ROOTLIBS64) $(ROOTLINKS64)
+BUILD.SO= $(LD) -o $@ -G -64 $(DYNFLAGS)
+
+install: all $(ROOTLIBDIR64) .WAIT $(ROOTLIBS64) $(ROOTLINKS64)
diff --git a/usr/src/lib/librt/amd64/mapfile-vers b/usr/src/lib/librt/amd64/mapfile-vers
new file mode 100644
index 0000000000..c7120c1d89
--- /dev/null
+++ b/usr/src/lib/librt/amd64/mapfile-vers
@@ -0,0 +1,141 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# 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.
+# 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 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+#
+# DO NOT TOUCH THIS FILE.
+# This file declares interfaces that are cast in stone.
+# They offer interfaces that will never change.
+# DO NOT TOUCH THIS FILE.
+#
+
+SUNW_1.4 {
+ global:
+ clock_nanosleep = FUNCTION;
+ mq_reltimedreceive_np = FUNCTION;
+ mq_reltimedsend_np = FUNCTION;
+ mq_timedreceive = FUNCTION;
+ mq_timedsend = FUNCTION;
+ sem_reltimedwait_np = FUNCTION;
+ sem_timedwait = FUNCTION;
+ local:
+ *;
+} SUNW_1.3;
+
+SUNW_1.3 {
+ global:
+ aio_waitn = FUNCTION;
+} SUNW_1.2;
+
+SUNW_1.2 {
+ global:
+ close = FUNCTION;
+} SUNW_1.1;
+
+SUNW_1.1 {
+ global:
+ fork = FUNCTION;
+} SUNW_0.7;
+
+SUNW_0.7 {
+ global:
+ aio_cancel = FUNCTION;
+ aio_error = FUNCTION;
+ aio_fsync = FUNCTION;
+ aio_read = FUNCTION;
+ aio_return = FUNCTION;
+ aio_suspend = FUNCTION;
+ aio_write = FUNCTION;
+ clock_getres = FUNCTION;
+ clock_gettime = FUNCTION;
+ clock_settime = FUNCTION;
+ fdatasync = FUNCTION;
+ lio_listio = FUNCTION;
+ mq_close = FUNCTION;
+ mq_getattr = FUNCTION;
+ mq_notify = FUNCTION;
+ mq_open = FUNCTION;
+ mq_receive = FUNCTION;
+ mq_send = FUNCTION;
+ mq_setattr = FUNCTION;
+ mq_unlink = FUNCTION;
+ nanosleep = FUNCTION;
+ sched_getparam = FUNCTION;
+ sched_get_priority_max = FUNCTION;
+ sched_get_priority_min = FUNCTION;
+ sched_getscheduler = FUNCTION;
+ sched_rr_get_interval = FUNCTION;
+ sched_setparam = FUNCTION;
+ sched_setscheduler = FUNCTION;
+ sched_yield = FUNCTION;
+ sem_close = FUNCTION;
+ sem_destroy = FUNCTION;
+ sem_getvalue = FUNCTION;
+ sem_init = FUNCTION;
+ sem_open = FUNCTION;
+ sem_post = FUNCTION;
+ sem_trywait = FUNCTION;
+ sem_unlink = FUNCTION;
+ sem_wait = FUNCTION;
+ shm_open = FUNCTION;
+ shm_unlink = FUNCTION;
+ sigqueue = FUNCTION;
+ sigtimedwait = FUNCTION;
+ sigwaitinfo = FUNCTION;
+ timer_create = FUNCTION;
+ timer_delete = FUNCTION;
+ timer_getoverrun = FUNCTION;
+ timer_gettime = FUNCTION;
+ timer_settime = FUNCTION;
+};
+
+SUNWprivate_1.1 {
+ global:
+ _clock_getres = FUNCTION;
+ _clock_gettime = FUNCTION;
+ _clock_nanosleep = FUNCTION;
+ _clock_settime = FUNCTION;
+ _nanosleep = FUNCTION;
+ _sem_close = FUNCTION;
+ _sem_destroy = FUNCTION;
+ _sem_getvalue = FUNCTION;
+ _sem_init = FUNCTION;
+ _sem_open = FUNCTION;
+ _sem_post = FUNCTION;
+ _sem_reltimedwait_np = FUNCTION;
+ _sem_timedwait = FUNCTION;
+ _sem_trywait = FUNCTION;
+ _sem_unlink = FUNCTION;
+ _sem_wait = FUNCTION;
+ _sigqueue = FUNCTION;
+ _sigtimedwait = FUNCTION;
+ _sigwaitinfo = FUNCTION;
+ _timer_create = FUNCTION;
+ _timer_delete = FUNCTION;
+ _timer_getoverrun = FUNCTION;
+ _timer_gettime = FUNCTION;
+ _timer_settime = FUNCTION;
+};
diff --git a/usr/src/lib/librt/common/Makefile b/usr/src/lib/librt/common/Makefile
deleted file mode 100644
index 052e5a63ad..0000000000
--- a/usr/src/lib/librt/common/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# 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 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# lib/librt/common/Makefile
-
-LINTSRC32= lintsrc32
-LINTOUT32= lint32.out
-LINTLIB32= $(LIBNAME)32
-$(LINTSRC32):= LINTFLAGS +=
-
-LINTSRC64= lintsrc64
-LINTOUT64= lint64.out
-LINTLIB64= $(LIBNAME)64
-$(LINTSRC64):= LINTFLAGS64 += -errchk=longptr64 -fd -Xtransition=yes
-
-lints : $(LINTSRC32) $(LINTSRC64)
-
-$(LINTSRC32): $$(SRCS)
- $(LINT.c) -o $(LINTLIB32) $(SRCS) > $(LINTOUT32) 2>&1
-
-$(LINTSRC64): $$(SRCS)
- $(LINT64.c) -o $(LINTLIB64) $(SRCS) > $(LINTOUT64) 2>&1
-
-include ../Makefile.com
-
diff --git a/usr/src/lib/librt/common/aio.c b/usr/src/lib/librt/common/aio.c
deleted file mode 100644
index aed292ce56..0000000000
--- a/usr/src/lib/librt/common/aio.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * 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.
- * 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 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*
- * The POSIX async. I/O functionality is
- * implemented in libaio/common/posix_aio.c
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#pragma weak close = __posix_aio_close
-
-#include "c_synonyms.h"
-#include <aio.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <stdlib.h>
-#include "pos4.h"
-#include "sigev_thread.h"
-
-extern int _libaio_close(int fd);
-
-/*
- * There is but one spawner for all aio operations.
- */
-thread_communication_data_t *sigev_aio_tcd = NULL;
-
-mutex_t sigev_aio_lock = DEFAULTMUTEX;
-cond_t sigev_aio_cv = DEFAULTCV;
-int sigev_aio_busy = 0;
-
-static int
-__sigev_thread_init(struct sigevent *sigevp)
-{
- thread_communication_data_t *tcdp;
- int port;
- int rc = 0;
-
- (void) mutex_lock(&sigev_aio_lock);
- while (sigev_aio_busy)
- (void) cond_wait(&sigev_aio_cv, &sigev_aio_lock);
- if ((tcdp = sigev_aio_tcd) != NULL)
- port = tcdp->tcd_port;
- else {
- sigev_aio_busy = 1;
- (void) mutex_unlock(&sigev_aio_lock);
-
- tcdp = setup_sigev_handler(sigevp, AIO);
- if (tcdp == NULL) {
- port = -1;
- rc = -1;
- } else if (launch_spawner(tcdp) != 0) {
- free_sigev_handler(tcdp);
- tcdp = NULL;
- port = -1;
- rc = -1;
- } else {
- port = tcdp->tcd_port;
- }
-
- (void) mutex_lock(&sigev_aio_lock);
- sigev_aio_tcd = tcdp;
- sigev_aio_busy = 0;
- (void) cond_broadcast(&sigev_aio_cv);
- }
- (void) mutex_unlock(&sigev_aio_lock);
- sigevp->sigev_signo = port;
- return (rc);
-}
-
-static int
-__posix_sigev_thread(aiocb_t *aiocbp)
-{
- struct sigevent *sigevp;
-
- if (aiocbp != NULL) {
- sigevp = &aiocbp->aio_sigevent;
- if (sigevp->sigev_notify == SIGEV_THREAD &&
- sigevp->sigev_notify_function != NULL)
- return (__sigev_thread_init(sigevp));
- }
- return (0);
-}
-
-#if !defined(_LP64)
-static int
-__posix_sigev_thread64(aiocb64_t *aiocbp)
-{
- struct sigevent *sigevp;
-
- if (aiocbp != NULL) {
- sigevp = &aiocbp->aio_sigevent;
- if (sigevp->sigev_notify == SIGEV_THREAD &&
- sigevp->sigev_notify_function != NULL)
- return (__sigev_thread_init(sigevp));
- }
- return (0);
-}
-#endif
-
-int
-__posix_aio_close(int fd)
-{
- return (_libaio_close(fd));
-}
-
-int
-aio_cancel(int fildes, aiocb_t *aiocbp)
-{
- return (__aio_cancel(fildes, aiocbp));
-}
-
-#if !defined(_LP64)
-
-int
-aio_cancel64(int fildes, aiocb64_t *aiocbp)
-{
- return (__aio_cancel64(fildes, aiocbp));
-}
-
-#endif
-
-int
-aio_error(const aiocb_t *aiocbp)
-{
- return (__aio_error(aiocbp));
-}
-
-#if !defined(_LP64)
-
-int
-aio_error64(const aiocb64_t *aiocbp)
-{
- return (__aio_error64(aiocbp));
-}
-
-#endif
-
-int
-aio_fsync(int op, aiocb_t *aiocbp)
-{
- int rc;
-
- if ((rc = __posix_sigev_thread(aiocbp)) == 0)
- rc = __aio_fsync(op, aiocbp);
- return (rc);
-
-}
-
-#if !defined(_LP64)
-
-int
-aio_fsync64(int op, aiocb64_t *aiocbp)
-{
- int rc;
-
- if ((rc = __posix_sigev_thread64(aiocbp)) == 0)
- rc = __aio_fsync64(op, aiocbp);
- return (rc);
-}
-
-#endif
-
-int
-aio_read(aiocb_t *aiocbp)
-{
- int rc;
-
- if ((rc = __posix_sigev_thread(aiocbp)) == 0)
- rc = __aio_read(aiocbp);
- return (rc);
-}
-
-#if !defined(_LP64)
-
-int
-aio_read64(aiocb64_t *aiocbp)
-{
- int rc;
-
- if ((rc = __posix_sigev_thread64(aiocbp)) == 0)
- rc = __aio_read64(aiocbp);
- return (rc);
-}
-
-#endif
-
-ssize_t
-aio_return(aiocb_t *aiocbp)
-{
- return (__aio_return(aiocbp));
-}
-
-#if !defined(_LP64)
-
-ssize_t
-aio_return64(aiocb64_t *aiocbp)
-{
- return (__aio_return64(aiocbp));
-}
-
-#endif
-
-int
-aio_suspend(const aiocb_t * const list[], int nent,
- const timespec_t *timeout)
-{
- return (__aio_suspend((void **)list, nent, timeout, 0));
-}
-
-#if !defined(_LP64)
-
-int
-aio_suspend64(const aiocb64_t * const list[], int nent,
- const timespec_t *timeout)
-{
- return (__aio_suspend((void **)list, nent, timeout, 1));
-}
-
-#endif
-
-int
-aio_write(aiocb_t *aiocbp)
-{
- int rc;
-
- if ((rc = __posix_sigev_thread(aiocbp)) == 0)
- rc = __aio_write(aiocbp);
- return (rc);
-}
-
-#if !defined(_LP64)
-
-int
-aio_write64(aiocb64_t *aiocbp)
-{
- int rc;
-
- if ((rc = __posix_sigev_thread64(aiocbp)) == 0)
- rc = __aio_write64(aiocbp);
- return (rc);
-}
-
-#endif
-
-int
-lio_listio(int mode,
- aiocb_t *_RESTRICT_KYWD const *_RESTRICT_KYWD list,
- int nent, struct sigevent *_RESTRICT_KYWD sigevp)
-{
- int i;
- aiocb_t *aiocbp;
-
- for (i = 0; i < nent; i++) {
- if ((aiocbp = list[i]) != NULL &&
- aiocbp->aio_sigevent.sigev_notify == SIGEV_THREAD &&
- __posix_sigev_thread(aiocbp) != 0)
- return (-1);
- }
- if (sigevp != NULL &&
- sigevp->sigev_notify == SIGEV_THREAD &&
- sigevp->sigev_notify_function != NULL &&
- __sigev_thread_init(sigevp) != 0)
- return (-1);
-
- return (__lio_listio(mode, list, nent, sigevp));
-}
-
-#if !defined(_LP64)
-
-int
-lio_listio64(int mode,
- aiocb64_t *_RESTRICT_KYWD const *_RESTRICT_KYWD list,
- int nent, struct sigevent *_RESTRICT_KYWD sigevp)
-{
- int i;
- aiocb64_t *aiocbp;
-
- for (i = 0; i < nent; i++) {
- if ((aiocbp = list[i]) != NULL &&
- aiocbp->aio_sigevent.sigev_notify == SIGEV_THREAD &&
- __posix_sigev_thread64(aiocbp) != 0)
- return (-1);
- }
- if (sigevp != NULL &&
- sigevp->sigev_notify == SIGEV_THREAD &&
- sigevp->sigev_notify_function != NULL &&
- __sigev_thread_init(sigevp) != 0)
- return (-1);
-
- return (__lio_listio64(mode, list, nent, sigevp));
-}
-
-#endif
-
-
-int
-aio_waitn(aiocb_t *list[], uint_t nent, uint_t *nwait,
- const timespec_t *timeout)
-{
- return (__aio_waitn((void **)list, nent, nwait, timeout));
-}
-
-#if !defined(_LP64)
-
-int
-aio_waitn64(aiocb64_t *list[], uint_t nent, uint_t *nwait,
- const timespec_t *timeout)
-{
- return (__aio_waitn((void **)list, nent, nwait, timeout));
-}
-
-#endif
diff --git a/usr/src/lib/librt/common/llib-lrt b/usr/src/lib/librt/common/llib-lrt
index 1d0c3a9fcf..0850024175 100644
--- a/usr/src/lib/librt/common/llib-lrt
+++ b/usr/src/lib/librt/common/llib-lrt
@@ -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.
*/
@@ -29,7 +29,6 @@
#pragma ident "%Z%%M% %I% %E% SMI"
-#include <sys/types.h>
#include <aio.h>
#include <mqueue.h>
#include <sched.h>
diff --git a/usr/src/lib/librt/common/mqlib.h b/usr/src/lib/librt/common/mqlib.h
deleted file mode 100644
index 8b51767d0f..0000000000
--- a/usr/src/lib/librt/common/mqlib.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * 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.
- * 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 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#ifndef _MQLIB_H
-#define _MQLIB_H
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * mqlib.h - Header file for POSIX.4 message queue
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <sys/types.h>
-#include "sigev_thread.h"
-
-/*
- * Default values per message queue
- */
-#define MQ_MAXMSG 128
-#define MQ_MAXSIZE 1024
-
-#define MQ_MAGIC 0x4d534751 /* "MSGQ" */
-
-/*
- * Message header which is part of messages in link list
- */
-typedef struct {
- uint64_t msg_next; /* offset of next message in the link */
- uint64_t msg_len; /* length of the message */
-} msghdr_t;
-
-/*
- * message queue description
- */
-struct mq_dn {
- size_t mqdn_flags; /* open description flags */
-};
-
-/*
- * message queue descriptor structure
- */
-typedef struct mq_des {
- struct mq_des *mqd_next; /* list of all open mq descriptors, */
- struct mq_des *mqd_prev; /* needed for fork-safety */
- int mqd_magic; /* magic # to identify mq_des */
- int mqd_flags; /* operation flag per open */
- struct mq_header *mqd_mq; /* address pointer of message Q */
- struct mq_dn *mqd_mqdn; /* open description */
- thread_communication_data_t *mqd_tcd; /* SIGEV_THREAD notification */
-} mqdes_t;
-
-
-/*
- * message queue common header, part of the mmap()ed file.
- * Since message queues may be shared between 32- and 64-bit processes,
- * care must be taken to make sure that the elements of this structure
- * are identical for both _LP64 and _ILP32 cases.
- */
-typedef struct mq_header {
- /* first field must be mq_totsize, DO NOT insert before this */
- int64_t mq_totsize; /* total size of the Queue */
- int64_t mq_maxsz; /* max size of each message */
- uint32_t mq_maxmsg; /* max messages in the queue */
- uint32_t mq_maxprio; /* maximum mqueue priority */
- uint32_t mq_curmaxprio; /* current maximum MQ priority */
- uint32_t mq_mask; /* priority bitmask */
- uint64_t mq_freep; /* free message's head pointer */
- uint64_t mq_headpp; /* pointer to head pointers */
- uint64_t mq_tailpp; /* pointer to tail pointers */
- signotify_id_t mq_sigid; /* notification id (3 int's) */
- uint32_t mq_ntype; /* notification type (SIGEV_*) */
- uint64_t mq_des; /* pointer to msg Q descriptor */
- mutex_t mq_exclusive; /* acquire for exclusive access */
- sem_t mq_rblocked; /* number of processes rblocked */
- sem_t mq_notfull; /* mq_send()'s block on this */
- sem_t mq_notempty; /* mq_receive()'s block on this */
- sem_t mq_spawner; /* spawner thread blocks on this */
-} mqhdr_t;
-
-extern mutex_t mq_list_lock;
-extern mqdes_t *mq_list;
-
-/* prototype for signotify system call. unexposed to user */
-int __signotify(int cmd, siginfo_t *sigonfo, signotify_id_t *sn_id);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _MQLIB_H */
diff --git a/usr/src/lib/librt/common/pos4.c b/usr/src/lib/librt/common/pos4.c
deleted file mode 100644
index 3bc253960d..0000000000
--- a/usr/src/lib/librt/common/pos4.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * 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.
- * 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 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "c_synonyms.h"
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include "mqlib.h"
-#include "thread_pool.h"
-
-extern mutex_t semlock;
-extern mutex_t md5_lock;
-
-extern void prefork1_tpool(void);
-extern void postfork1_parent_tpool(void);
-extern void postfork1_child_tpool(void);
-
-/*
- * A spawner and its workers are gone.
- * We are here to clean up the data structures and close the port.
- */
-static void
-tcd_teardown(thread_communication_data_t *tcdp)
-{
- if (tcdp->tcd_poolp != NULL)
- tpool_abandon(tcdp->tcd_poolp);
- tcdp->tcd_poolp = NULL;
- tcdp->tcd_server_id = 0;
- free_sigev_handler(tcdp);
-}
-
-static void
-_rt_prepare_fork(void)
-{
- thread_communication_data_t *tcdp;
- mqdes_t *mqdp;
- int timer;
-
- (void) mutex_lock(&sigev_aio_lock);
- while (sigev_aio_busy)
- (void) cond_wait(&sigev_aio_cv, &sigev_aio_lock);
- (void) mutex_lock(&semlock);
- (void) mutex_lock(&md5_lock);
- if ((tcdp = sigev_aio_tcd) != NULL)
- (void) mutex_lock(&tcdp->tcd_lock);
-
- (void) mutex_lock(&mq_list_lock);
- for (mqdp = mq_list; mqdp; mqdp = mqdp->mqd_next) {
- if ((tcdp = mqdp->mqd_tcd) != NULL)
- (void) mutex_lock(&tcdp->tcd_lock);
- }
-
- for (timer = 0; timer < timer_max; timer++) {
- if ((tcdp = timer_tcd[timer]) != NULL)
- (void) mutex_lock(&tcdp->tcd_lock);
- }
- (void) mutex_lock(&free_tcd_lock);
-
- prefork1_tpool();
-}
-
-static void
-_rt_release_locks(void)
-{
- thread_communication_data_t *tcdp;
- mqdes_t *mqdp;
- int timer;
-
- (void) mutex_unlock(&free_tcd_lock);
- for (timer = 0; timer < timer_max; timer++) {
- if ((tcdp = timer_tcd[timer]) != NULL)
- (void) mutex_unlock(&tcdp->tcd_lock);
- }
-
- for (mqdp = mq_list; mqdp; mqdp = mqdp->mqd_next) {
- if ((tcdp = mqdp->mqd_tcd) != NULL)
- (void) mutex_unlock(&tcdp->tcd_lock);
- }
- (void) mutex_unlock(&mq_list_lock);
-
- if ((tcdp = sigev_aio_tcd) != NULL)
- (void) mutex_unlock(&tcdp->tcd_lock);
- (void) mutex_unlock(&md5_lock);
- (void) mutex_unlock(&semlock);
- (void) mutex_unlock(&sigev_aio_lock);
-}
-
-static void
-_rt_parent_fork(void)
-{
- postfork1_parent_tpool();
- _rt_release_locks();
-}
-
-static void
-_rt_child_fork(void)
-{
- mqdes_t *mqdp;
- int timer;
-
- postfork1_child_tpool();
- _rt_release_locks();
-
- /*
- * All of the spawners and workers are gone; free their structures.
- */
-
- if (sigev_aio_tcd != NULL) { /* AIO */
- tcd_teardown(sigev_aio_tcd);
- sigev_aio_tcd = NULL;
- }
-
- for (mqdp = mq_list; mqdp; mqdp = mqdp->mqd_next) { /* MQ */
- if (mqdp->mqd_tcd != NULL) {
- tcd_teardown(mqdp->mqd_tcd);
- mqdp->mqd_tcd = NULL;
- }
- }
-
- for (timer = 0; timer < timer_max; timer++) { /* TIMER */
- if (timer_tcd[timer] != NULL) {
- tcd_teardown(timer_tcd[timer]);
- timer_tcd[timer] = NULL;
- }
- }
-}
-
-#pragma init(_rt_init)
-static void
-_rt_init(void)
-{
- (void) pthread_atfork(_rt_prepare_fork,
- _rt_parent_fork, _rt_child_fork);
-}
diff --git a/usr/src/lib/librt/common/pos4.h b/usr/src/lib/librt/common/pos4.h
deleted file mode 100644
index 8645fd27d9..0000000000
--- a/usr/src/lib/librt/common/pos4.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * 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.
- * 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 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*
- * These are largely extern definitions for functions that librt
- * finds elsewhere (in libaio or libc).
- */
-
-#ifndef _POS4_H
-#define _POS4_H
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <aio.h>
-#include <time.h>
-#include <signal.h>
-#include <siginfo.h>
-#include <unistd.h>
-#include <semaphore.h>
-
-extern int __aio_cancel(int, aiocb_t *);
-extern int __aio_cancel64(int, aiocb64_t *);
-extern int __aio_error(const aiocb_t *);
-extern int __aio_error64(const aiocb64_t *);
-extern int __aio_fsync(int, aiocb_t *);
-extern int __aio_fsync64(int, aiocb64_t *);
-extern int __aio_read(aiocb_t *);
-extern int __aio_read64(aiocb64_t *);
-extern ssize_t __aio_return(aiocb_t *);
-extern ssize_t __aio_return64(aiocb64_t *);
-extern int __aio_suspend(void **, int, const timespec_t *, int);
-extern int __aio_write(aiocb_t *);
-extern int __aio_write64(aiocb64_t *);
-extern int __lio_listio(int,
- aiocb_t *_RESTRICT_KYWD const *_RESTRICT_KYWD list,
- int, struct sigevent *_RESTRICT_KYWD);
-extern int __lio_listio64(int,
- aiocb64_t *_RESTRICT_KYWD const *_RESTRICT_KYWD list,
- int, struct sigevent *_RESTRICT_KYWD);
-extern int __aio_waitn(void **list, uint_t, uint_t *, const timespec_t *);
-
-extern int __clock_getres(clockid_t, timespec_t *);
-extern int __clock_gettime(clockid_t, timespec_t *);
-extern int __clock_settime(clockid_t, const timespec_t *);
-extern int __timer_create(clockid_t, struct sigevent *, timer_t *);
-extern int __timer_delete(timer_t);
-extern int __timer_getoverrun(timer_t);
-extern int __timer_gettime(timer_t, itimerspec_t *);
-extern int __timer_settime(timer_t, int, const itimerspec_t *, itimerspec_t *);
-
-extern int __clock_nanosleep(clockid_t, int, const timespec_t *, timespec_t *);
-extern int __nanosleep(const timespec_t *, timespec_t *);
-
-extern int __sigtimedwait(const sigset_t *, siginfo_t *,
- const timespec_t *);
-extern int __sigqueue(pid_t pid, int signo,
- /* const union sigval */ void *value, int si_code);
-extern void _thr_yield(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _POS4_H */
diff --git a/usr/src/lib/librt/i386/Makefile b/usr/src/lib/librt/i386/Makefile
index af76f5ab90..b3157e385b 100644
--- a/usr/src/lib/librt/i386/Makefile
+++ b/usr/src/lib/librt/i386/Makefile
@@ -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.
@@ -20,7 +19,7 @@
# 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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -28,4 +27,4 @@
include ../Makefile.com
-install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
+install: all $(ROOTLIBDIR) .WAIT $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/usr/src/lib/librt/i386/mapfile-vers b/usr/src/lib/librt/i386/mapfile-vers
new file mode 100644
index 0000000000..4c88b3471c
--- /dev/null
+++ b/usr/src/lib/librt/i386/mapfile-vers
@@ -0,0 +1,150 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# 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.
+# 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 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+#
+# DO NOT TOUCH THIS FILE.
+# This file declares interfaces that are cast in stone.
+# They offer interfaces that will never change.
+# DO NOT TOUCH THIS FILE.
+#
+
+SUNW_1.4 {
+ global:
+ clock_nanosleep = FUNCTION;
+ mq_reltimedreceive_np = FUNCTION;
+ mq_reltimedsend_np = FUNCTION;
+ mq_timedreceive = FUNCTION;
+ mq_timedsend = FUNCTION;
+ sem_reltimedwait_np = FUNCTION;
+ sem_timedwait = FUNCTION;
+ local:
+ *;
+} SUNW_1.3;
+
+SUNW_1.3 {
+ global:
+ aio_waitn = FUNCTION;
+ aio_waitn64 = FUNCTION;
+} SUNW_1.2;
+
+SUNW_1.2 {
+ global:
+ close = FUNCTION;
+} SUNW_1.1;
+
+SUNW_1.1 {
+ global:
+ aio_cancel64 = FUNCTION;
+ aio_error64 = FUNCTION;
+ aio_fsync64 = FUNCTION;
+ aio_read64 = FUNCTION;
+ aio_return64 = FUNCTION;
+ aio_suspend64 = FUNCTION;
+ aio_write64 = FUNCTION;
+ fork = FUNCTION;
+ lio_listio64 = FUNCTION;
+} SUNW_0.7;
+
+SUNW_0.7 {
+ global:
+ aio_cancel = FUNCTION;
+ aio_error = FUNCTION;
+ aio_fsync = FUNCTION;
+ aio_read = FUNCTION;
+ aio_return = FUNCTION;
+ aio_suspend = FUNCTION;
+ aio_write = FUNCTION;
+ clock_getres = FUNCTION;
+ clock_gettime = FUNCTION;
+ clock_settime = FUNCTION;
+ fdatasync = FUNCTION;
+ lio_listio = FUNCTION;
+ mq_close = FUNCTION;
+ mq_getattr = FUNCTION;
+ mq_notify = FUNCTION;
+ mq_open = FUNCTION;
+ mq_receive = FUNCTION;
+ mq_send = FUNCTION;
+ mq_setattr = FUNCTION;
+ mq_unlink = FUNCTION;
+ nanosleep = FUNCTION;
+ sched_getparam = FUNCTION;
+ sched_get_priority_max = FUNCTION;
+ sched_get_priority_min = FUNCTION;
+ sched_getscheduler = FUNCTION;
+ sched_rr_get_interval = FUNCTION;
+ sched_setparam = FUNCTION;
+ sched_setscheduler = FUNCTION;
+ sched_yield = FUNCTION;
+ sem_close = FUNCTION;
+ sem_destroy = FUNCTION;
+ sem_getvalue = FUNCTION;
+ sem_init = FUNCTION;
+ sem_open = FUNCTION;
+ sem_post = FUNCTION;
+ sem_trywait = FUNCTION;
+ sem_unlink = FUNCTION;
+ sem_wait = FUNCTION;
+ shm_open = FUNCTION;
+ shm_unlink = FUNCTION;
+ sigqueue = FUNCTION;
+ sigtimedwait = FUNCTION;
+ sigwaitinfo = FUNCTION;
+ timer_create = FUNCTION;
+ timer_delete = FUNCTION;
+ timer_getoverrun = FUNCTION;
+ timer_gettime = FUNCTION;
+ timer_settime = FUNCTION;
+};
+
+SUNWprivate_1.1 {
+ global:
+ _clock_getres = FUNCTION;
+ _clock_gettime = FUNCTION;
+ _clock_nanosleep = FUNCTION;
+ _clock_settime = FUNCTION;
+ _nanosleep = FUNCTION;
+ _sem_close = FUNCTION;
+ _sem_destroy = FUNCTION;
+ _sem_getvalue = FUNCTION;
+ _sem_init = FUNCTION;
+ _sem_open = FUNCTION;
+ _sem_post = FUNCTION;
+ _sem_reltimedwait_np = FUNCTION;
+ _sem_timedwait = FUNCTION;
+ _sem_trywait = FUNCTION;
+ _sem_unlink = FUNCTION;
+ _sem_wait = FUNCTION;
+ _sigqueue = FUNCTION;
+ _sigtimedwait = FUNCTION;
+ _sigwaitinfo = FUNCTION;
+ _timer_create = FUNCTION;
+ _timer_delete = FUNCTION;
+ _timer_getoverrun = FUNCTION;
+ _timer_gettime = FUNCTION;
+ _timer_settime = FUNCTION;
+};
diff --git a/usr/src/lib/librt/req.flg b/usr/src/lib/librt/req.flg
deleted file mode 100644
index ee4b2316e3..0000000000
--- a/usr/src/lib/librt/req.flg
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-#
-# 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
-#
-#
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-
-echo_file usr/src/lib/libc/inc/synonyms.h
diff --git a/usr/src/lib/librt/sparc/Makefile b/usr/src/lib/librt/sparc/Makefile
index af76f5ab90..b3157e385b 100644
--- a/usr/src/lib/librt/sparc/Makefile
+++ b/usr/src/lib/librt/sparc/Makefile
@@ -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.
@@ -20,7 +19,7 @@
# 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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -28,4 +27,4 @@
include ../Makefile.com
-install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
+install: all $(ROOTLIBDIR) .WAIT $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/usr/src/lib/librt/sparc/mapfile-vers b/usr/src/lib/librt/sparc/mapfile-vers
new file mode 100644
index 0000000000..4c88b3471c
--- /dev/null
+++ b/usr/src/lib/librt/sparc/mapfile-vers
@@ -0,0 +1,150 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# 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.
+# 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 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+#
+# DO NOT TOUCH THIS FILE.
+# This file declares interfaces that are cast in stone.
+# They offer interfaces that will never change.
+# DO NOT TOUCH THIS FILE.
+#
+
+SUNW_1.4 {
+ global:
+ clock_nanosleep = FUNCTION;
+ mq_reltimedreceive_np = FUNCTION;
+ mq_reltimedsend_np = FUNCTION;
+ mq_timedreceive = FUNCTION;
+ mq_timedsend = FUNCTION;
+ sem_reltimedwait_np = FUNCTION;
+ sem_timedwait = FUNCTION;
+ local:
+ *;
+} SUNW_1.3;
+
+SUNW_1.3 {
+ global:
+ aio_waitn = FUNCTION;
+ aio_waitn64 = FUNCTION;
+} SUNW_1.2;
+
+SUNW_1.2 {
+ global:
+ close = FUNCTION;
+} SUNW_1.1;
+
+SUNW_1.1 {
+ global:
+ aio_cancel64 = FUNCTION;
+ aio_error64 = FUNCTION;
+ aio_fsync64 = FUNCTION;
+ aio_read64 = FUNCTION;
+ aio_return64 = FUNCTION;
+ aio_suspend64 = FUNCTION;
+ aio_write64 = FUNCTION;
+ fork = FUNCTION;
+ lio_listio64 = FUNCTION;
+} SUNW_0.7;
+
+SUNW_0.7 {
+ global:
+ aio_cancel = FUNCTION;
+ aio_error = FUNCTION;
+ aio_fsync = FUNCTION;
+ aio_read = FUNCTION;
+ aio_return = FUNCTION;
+ aio_suspend = FUNCTION;
+ aio_write = FUNCTION;
+ clock_getres = FUNCTION;
+ clock_gettime = FUNCTION;
+ clock_settime = FUNCTION;
+ fdatasync = FUNCTION;
+ lio_listio = FUNCTION;
+ mq_close = FUNCTION;
+ mq_getattr = FUNCTION;
+ mq_notify = FUNCTION;
+ mq_open = FUNCTION;
+ mq_receive = FUNCTION;
+ mq_send = FUNCTION;
+ mq_setattr = FUNCTION;
+ mq_unlink = FUNCTION;
+ nanosleep = FUNCTION;
+ sched_getparam = FUNCTION;
+ sched_get_priority_max = FUNCTION;
+ sched_get_priority_min = FUNCTION;
+ sched_getscheduler = FUNCTION;
+ sched_rr_get_interval = FUNCTION;
+ sched_setparam = FUNCTION;
+ sched_setscheduler = FUNCTION;
+ sched_yield = FUNCTION;
+ sem_close = FUNCTION;
+ sem_destroy = FUNCTION;
+ sem_getvalue = FUNCTION;
+ sem_init = FUNCTION;
+ sem_open = FUNCTION;
+ sem_post = FUNCTION;
+ sem_trywait = FUNCTION;
+ sem_unlink = FUNCTION;
+ sem_wait = FUNCTION;
+ shm_open = FUNCTION;
+ shm_unlink = FUNCTION;
+ sigqueue = FUNCTION;
+ sigtimedwait = FUNCTION;
+ sigwaitinfo = FUNCTION;
+ timer_create = FUNCTION;
+ timer_delete = FUNCTION;
+ timer_getoverrun = FUNCTION;
+ timer_gettime = FUNCTION;
+ timer_settime = FUNCTION;
+};
+
+SUNWprivate_1.1 {
+ global:
+ _clock_getres = FUNCTION;
+ _clock_gettime = FUNCTION;
+ _clock_nanosleep = FUNCTION;
+ _clock_settime = FUNCTION;
+ _nanosleep = FUNCTION;
+ _sem_close = FUNCTION;
+ _sem_destroy = FUNCTION;
+ _sem_getvalue = FUNCTION;
+ _sem_init = FUNCTION;
+ _sem_open = FUNCTION;
+ _sem_post = FUNCTION;
+ _sem_reltimedwait_np = FUNCTION;
+ _sem_timedwait = FUNCTION;
+ _sem_trywait = FUNCTION;
+ _sem_unlink = FUNCTION;
+ _sem_wait = FUNCTION;
+ _sigqueue = FUNCTION;
+ _sigtimedwait = FUNCTION;
+ _sigwaitinfo = FUNCTION;
+ _timer_create = FUNCTION;
+ _timer_delete = FUNCTION;
+ _timer_getoverrun = FUNCTION;
+ _timer_gettime = FUNCTION;
+ _timer_settime = FUNCTION;
+};
diff --git a/usr/src/lib/librt/sparcv9/Makefile b/usr/src/lib/librt/sparcv9/Makefile
index 0c6326a6de..249f249362 100644
--- a/usr/src/lib/librt/sparcv9/Makefile
+++ b/usr/src/lib/librt/sparcv9/Makefile
@@ -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.
@@ -20,7 +19,7 @@
# 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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -29,4 +28,6 @@
include ../Makefile.com
include ../../Makefile.lib.64
-install: all $(ROOTLIBS64) $(ROOTLINKS64)
+BUILD.SO= $(LD) -o $@ -G -64 $(DYNFLAGS)
+
+install: all $(ROOTLIBDIR64) .WAIT $(ROOTLIBS64) $(ROOTLINKS64)
diff --git a/usr/src/lib/librt/sparcv9/mapfile-vers b/usr/src/lib/librt/sparcv9/mapfile-vers
new file mode 100644
index 0000000000..c7120c1d89
--- /dev/null
+++ b/usr/src/lib/librt/sparcv9/mapfile-vers
@@ -0,0 +1,141 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# 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.
+# 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 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+#
+# DO NOT TOUCH THIS FILE.
+# This file declares interfaces that are cast in stone.
+# They offer interfaces that will never change.
+# DO NOT TOUCH THIS FILE.
+#
+
+SUNW_1.4 {
+ global:
+ clock_nanosleep = FUNCTION;
+ mq_reltimedreceive_np = FUNCTION;
+ mq_reltimedsend_np = FUNCTION;
+ mq_timedreceive = FUNCTION;
+ mq_timedsend = FUNCTION;
+ sem_reltimedwait_np = FUNCTION;
+ sem_timedwait = FUNCTION;
+ local:
+ *;
+} SUNW_1.3;
+
+SUNW_1.3 {
+ global:
+ aio_waitn = FUNCTION;
+} SUNW_1.2;
+
+SUNW_1.2 {
+ global:
+ close = FUNCTION;
+} SUNW_1.1;
+
+SUNW_1.1 {
+ global:
+ fork = FUNCTION;
+} SUNW_0.7;
+
+SUNW_0.7 {
+ global:
+ aio_cancel = FUNCTION;
+ aio_error = FUNCTION;
+ aio_fsync = FUNCTION;
+ aio_read = FUNCTION;
+ aio_return = FUNCTION;
+ aio_suspend = FUNCTION;
+ aio_write = FUNCTION;
+ clock_getres = FUNCTION;
+ clock_gettime = FUNCTION;
+ clock_settime = FUNCTION;
+ fdatasync = FUNCTION;
+ lio_listio = FUNCTION;
+ mq_close = FUNCTION;
+ mq_getattr = FUNCTION;
+ mq_notify = FUNCTION;
+ mq_open = FUNCTION;
+ mq_receive = FUNCTION;
+ mq_send = FUNCTION;
+ mq_setattr = FUNCTION;
+ mq_unlink = FUNCTION;
+ nanosleep = FUNCTION;
+ sched_getparam = FUNCTION;
+ sched_get_priority_max = FUNCTION;
+ sched_get_priority_min = FUNCTION;
+ sched_getscheduler = FUNCTION;
+ sched_rr_get_interval = FUNCTION;
+ sched_setparam = FUNCTION;
+ sched_setscheduler = FUNCTION;
+ sched_yield = FUNCTION;
+ sem_close = FUNCTION;
+ sem_destroy = FUNCTION;
+ sem_getvalue = FUNCTION;
+ sem_init = FUNCTION;
+ sem_open = FUNCTION;
+ sem_post = FUNCTION;
+ sem_trywait = FUNCTION;
+ sem_unlink = FUNCTION;
+ sem_wait = FUNCTION;
+ shm_open = FUNCTION;
+ shm_unlink = FUNCTION;
+ sigqueue = FUNCTION;
+ sigtimedwait = FUNCTION;
+ sigwaitinfo = FUNCTION;
+ timer_create = FUNCTION;
+ timer_delete = FUNCTION;
+ timer_getoverrun = FUNCTION;
+ timer_gettime = FUNCTION;
+ timer_settime = FUNCTION;
+};
+
+SUNWprivate_1.1 {
+ global:
+ _clock_getres = FUNCTION;
+ _clock_gettime = FUNCTION;
+ _clock_nanosleep = FUNCTION;
+ _clock_settime = FUNCTION;
+ _nanosleep = FUNCTION;
+ _sem_close = FUNCTION;
+ _sem_destroy = FUNCTION;
+ _sem_getvalue = FUNCTION;
+ _sem_init = FUNCTION;
+ _sem_open = FUNCTION;
+ _sem_post = FUNCTION;
+ _sem_reltimedwait_np = FUNCTION;
+ _sem_timedwait = FUNCTION;
+ _sem_trywait = FUNCTION;
+ _sem_unlink = FUNCTION;
+ _sem_wait = FUNCTION;
+ _sigqueue = FUNCTION;
+ _sigtimedwait = FUNCTION;
+ _sigwaitinfo = FUNCTION;
+ _timer_create = FUNCTION;
+ _timer_delete = FUNCTION;
+ _timer_getoverrun = FUNCTION;
+ _timer_gettime = FUNCTION;
+ _timer_settime = FUNCTION;
+};
diff --git a/usr/src/lib/librt/spec/Makefile b/usr/src/lib/librt/spec/Makefile
deleted file mode 100644
index 753f8d7321..0000000000
--- a/usr/src/lib/librt/spec/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# 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
-#
-#ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright (c) 1998-1999 by Sun Microsystems, Inc.
-# All rights reserved.
-#
-# lib/librt/spec/Makefile
-
-include $(SRC)/lib/Makefile.spec.arch
diff --git a/usr/src/lib/librt/spec/Makefile.targ b/usr/src/lib/librt/spec/Makefile.targ
deleted file mode 100644
index 4dc69043fc..0000000000
--- a/usr/src/lib/librt/spec/Makefile.targ
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# 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
-#
-#ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# lib/librt/spec/Makefile.targ
-
-LIBRARY = librt.a
-VERS = .1
-
-OBJECTS = rt.o
diff --git a/usr/src/lib/librt/spec/amd64/Makefile b/usr/src/lib/librt/spec/amd64/Makefile
deleted file mode 100644
index 6461352322..0000000000
--- a/usr/src/lib/librt/spec/amd64/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# 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 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-.KEEP_STATE:
-
-include ../Makefile.targ
-
-# Add arch specific objects here
-OBJECTS +=
-
-include $(SRC)/lib/Makefile.lib
-include $(SRC)/lib/Makefile.lib.64
-
-# Uncomment the following if the linker complains
-#amd64_C_PICFLAGS = -K PIC
-
-include $(SRC)/lib/Makefile.spec
-
-install: $(ROOTABILIB64) $(ROOTABIDIR64)/$(ABIPOSIXLIB)
diff --git a/usr/src/lib/librt/spec/i386/Makefile b/usr/src/lib/librt/spec/i386/Makefile
deleted file mode 100644
index 8abba2fc02..0000000000
--- a/usr/src/lib/librt/spec/i386/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# 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
-#
-#
-#ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# lib/librt/spec/i386/Makefile
-
-.KEEP_STATE:
-
-include ../Makefile.targ
-
-# Add arch specific objects here
-OBJECTS +=
-
-include $(SRC)/lib/Makefile.lib
-
-# Uncomment the following if the linker complains
-#i386_C_PICFLAGS = -K PIC
-
-include $(SRC)/lib/Makefile.spec
-
-install: $(ROOTABILIB)
diff --git a/usr/src/lib/librt/spec/sparc/Makefile b/usr/src/lib/librt/spec/sparc/Makefile
deleted file mode 100644
index 59b962c6f2..0000000000
--- a/usr/src/lib/librt/spec/sparc/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# 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
-#
-#
-#ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# lib/librt/spec/sparc/Makefile
-
-.KEEP_STATE:
-
-include ../Makefile.targ
-
-# Add arch specific objects here
-OBJECTS +=
-
-include $(SRC)/lib/Makefile.lib
-
-# Uncomment the following if the linker complains
-#sparc_C_PICFLAGS = -K PIC
-
-include $(SRC)/lib/Makefile.spec
-
-install: $(ROOTABILIB)
diff --git a/usr/src/lib/librt/spec/sparcv9/Makefile b/usr/src/lib/librt/spec/sparcv9/Makefile
deleted file mode 100644
index 6af86e7a4f..0000000000
--- a/usr/src/lib/librt/spec/sparcv9/Makefile
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# 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
-#
-#
-#ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# lib/librt/spec/sparcv9/Makefile
-
-.KEEP_STATE:
-
-include ../Makefile.targ
-
-# Add arch specific objects here
-OBJECTS +=
-
-include $(SRC)/lib/Makefile.lib
-include $(SRC)/lib/Makefile.lib.64
-
-# Uncomment the following if the linker complains
-#sparcv9_C_PICFLAGS = -K PIC
-
-include $(SRC)/lib/Makefile.spec
-
-install: $(ROOTABILIB64)
diff --git a/usr/src/lib/librt/spec/versions b/usr/src/lib/librt/spec/versions
deleted file mode 100644
index 29a7c57d07..0000000000
--- a/usr/src/lib/librt/spec/versions
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# 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
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-sparc {
- SUNW_1.5: {SUNW_1.4};
- SUNW_1.4: {SUNW_1.3};
- SUNW_1.3: {SUNW_1.2};
- SUNW_1.2: {SUNW_1.1};
- SUNW_1.1: {SUNW_0.7};
- SUNW_0.7;
- SUNWprivate_1.1;
-}
-i386 {
- SUNW_1.5: {SUNW_1.4};
- SUNW_1.4: {SUNW_1.3};
- SUNW_1.3: {SUNW_1.2};
- SUNW_1.2: {SUNW_1.1};
- SUNW_1.1: {SUNW_0.7};
- SUNW_0.7;
- SUNWprivate_1.1;
-}
-sparcv9 {
- SUNW_1.5: {SUNW_1.4};
- SUNW_1.4: {SUNW_1.3};
- SUNW_1.3: {SUNW_1.2};
- SUNW_1.2: {SUNW_1.1};
- SUNW_1.1: {SUNW_0.7};
- SUNW_0.7;
- SUNWprivate_1.1;
-}
-amd64 {
- SUNW_1.5: {SUNW_1.4};
- SUNW_1.4: {SUNW_1.3};
- SUNW_1.3: {SUNW_1.2};
- SUNW_1.2: {SUNW_1.1};
- SUNW_1.1: {SUNW_0.7};
- SUNW_0.7;
- SUNWprivate_1.1;
-}
diff --git a/usr/src/lib/libtsol/common/call_labeld.c b/usr/src/lib/libtsol/common/call_labeld.c
index 35d94450f5..8ae29742be 100644
--- a/usr/src/lib/libtsol/common/call_labeld.c
+++ b/usr/src/lib/libtsol/common/call_labeld.c
@@ -18,6 +18,7 @@
*
* CDDL HEADER END
*/
+
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
@@ -45,12 +46,6 @@
#endif /* !DEBUG */
/*
- * Library prototypes to get away from lots of static build problems.
- */
-
-extern int __nanosleep(const struct timespec *, struct timespec *);
-
-/*
* This is cloned from _nsc_trydoorcall used by the nscd client.
*
* Routine that actually performs the door call.
@@ -273,7 +268,7 @@ try_again:
ts.tv_sec++;
ts.tv_nsec = 100;
}
- (void) __nanosleep(&ts, NULL);
+ (void) nanosleep(&ts, NULL);
#ifdef DEBUG
(void) printf("door_call failed EAGAIN # %d\n", busy);
#endif /* DEBUG */
diff --git a/usr/src/ucbcmd/sbcp/Makefile b/usr/src/ucbcmd/sbcp/Makefile
index 23d6a5a3e7..e582d39fb5 100644
--- a/usr/src/ucbcmd/sbcp/Makefile
+++ b/usr/src/ucbcmd/sbcp/Makefile
@@ -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.
@@ -20,7 +19,7 @@
# 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.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -53,7 +52,7 @@ ASFLAGS= -P -D_ASM -DPIC -K pic
LDFLAGS= -R /usr/4lib:/usr/ucblib -e _start -G -t \
-zdefs -z text -zcombreloc -I /usr/lib/ld.so.1
OBJS= sbcp.o
-LIBS= $(LDLIBS.lib) -lmapmalloc $(LIBBC) $(LIBUCB) -lnsl -laio -lc
+LIBS= $(LDLIBS.lib) -lmapmalloc $(LIBBC) $(LIBUCB) -lnsl -lc
$(PROG): $(OBJS)
$(LDOPTS) $(LD) $(LDFLAGS) -o sbcp $(OBJS) $(LIBS)
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/lib/libaio/asynch.h b/usr/src/uts/common/sys/asynch.h
index 48dc3dc622..48dc3dc622 100644
--- a/usr/src/lib/libaio/asynch.h
+++ b/usr/src/uts/common/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