From owner-p4-projects@FreeBSD.ORG Mon Sep 15 16:29:24 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 228EF16A4C0; Mon, 15 Sep 2003 16:29:24 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D12F516A4B3 for ; Mon, 15 Sep 2003 16:29:23 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 72E5443FB1 for ; Mon, 15 Sep 2003 16:29:22 -0700 (PDT) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h8FNTM0U096677 for ; Mon, 15 Sep 2003 16:29:22 -0700 (PDT) (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h8FNTLlx096665 for perforce@freebsd.org; Mon, 15 Sep 2003 16:29:21 -0700 (PDT) Date: Mon, 15 Sep 2003 16:29:21 -0700 (PDT) Message-Id: <200309152329.h8FNTLlx096665@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Subject: PERFORCE change 38100 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Sep 2003 23:29:24 -0000 http://perforce.freebsd.org/chv.cgi?CH=38100 Change 38100 by marcel@marcel_nfs on 2003/09/15 16:29:10 IFC @38099 Affected files ... .. //depot/projects/ia64/Makefile.inc1#83 integrate .. //depot/projects/ia64/UPDATING#51 integrate .. //depot/projects/ia64/bin/df/df.c#16 integrate .. //depot/projects/ia64/contrib/isc-dhcp/client/scripts/freebsd#7 integrate .. //depot/projects/ia64/etc/defaults/rc.conf#41 integrate .. //depot/projects/ia64/etc/pccard_ether#11 integrate .. //depot/projects/ia64/lib/libc/net/getaddrinfo.3#6 integrate .. //depot/projects/ia64/lib/libc/net/getnameinfo.3#5 integrate .. //depot/projects/ia64/lib/libc/rpc/rpc_clnt_create.3#7 integrate .. //depot/projects/ia64/lib/libc/stdlib/exit.3#5 integrate .. //depot/projects/ia64/lib/libc/stdlib/grantpt.3#3 integrate .. //depot/projects/ia64/lib/libc_r/man/pthread_condattr.3#3 integrate .. //depot/projects/ia64/lib/libpthread/man/pthread_condattr.3#3 integrate .. //depot/projects/ia64/lib/libpthread/thread/thr_attr_setguardsize.c#3 integrate .. //depot/projects/ia64/lib/libpthread/thread/thr_attr_setinheritsched.c#2 integrate .. //depot/projects/ia64/lib/libpthread/thread/thr_attr_setscope.c#3 integrate .. //depot/projects/ia64/lib/libpthread/thread/thr_cond.c#17 integrate .. //depot/projects/ia64/lib/libpthread/thread/thr_create.c#14 integrate .. //depot/projects/ia64/lib/libpthread/thread/thr_exit.c#7 integrate .. //depot/projects/ia64/lib/libpthread/thread/thr_kern.c#34 integrate .. //depot/projects/ia64/lib/libpthread/thread/thr_private.h#24 integrate .. //depot/projects/ia64/lib/libpthread/thread/thr_sig.c#24 integrate .. //depot/projects/ia64/lib/libpthread/thread/thr_sigmask.c#8 integrate .. //depot/projects/ia64/lib/libpthread/thread/thr_stack.c#4 integrate .. //depot/projects/ia64/libexec/ftpd/ftpd.8#15 integrate .. //depot/projects/ia64/libexec/ftpd/ftpd.c#22 integrate .. //depot/projects/ia64/libexec/rtld-elf/Makefile#8 integrate .. //depot/projects/ia64/libexec/rtld-elf/libmap.c#9 integrate .. //depot/projects/ia64/libexec/rtld-elf/libmap.h#2 integrate .. //depot/projects/ia64/libexec/rtld-elf/rtld.c#19 integrate .. //depot/projects/ia64/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml#123 integrate .. //depot/projects/ia64/sbin/devfs/devfs.8#7 integrate .. //depot/projects/ia64/sbin/newfs/newfs.8#17 integrate .. //depot/projects/ia64/sbin/raidctl/raidctl.8#6 integrate .. //depot/projects/ia64/share/examples/etc/README.examples#3 integrate .. //depot/projects/ia64/share/examples/ses/getencstat/getencstat.0#2 integrate .. //depot/projects/ia64/share/examples/ses/sesd/sesd.0#2 integrate .. //depot/projects/ia64/share/man/man4/bge.4#7 integrate .. //depot/projects/ia64/share/man/man4/ng_bt3c.4#5 integrate .. //depot/projects/ia64/share/man/man4/rl.4#8 integrate .. //depot/projects/ia64/share/man/man4/usb.4#11 integrate .. //depot/projects/ia64/share/man/man5/libmap.conf.5#3 integrate .. //depot/projects/ia64/share/man/man5/make.conf.5#40 integrate .. //depot/projects/ia64/share/man/man7/tuning.7#21 integrate .. //depot/projects/ia64/share/man/man9/mtx_pool.9#4 integrate .. //depot/projects/ia64/share/man/man9/signal.9#5 integrate .. //depot/projects/ia64/share/man/man9/sx.9#8 integrate .. //depot/projects/ia64/sys/amd64/amd64/pmap.c#24 integrate .. //depot/projects/ia64/sys/amd64/conf/GENERIC#10 integrate .. //depot/projects/ia64/sys/conf/files#102 integrate .. //depot/projects/ia64/sys/dev/acpica/acpi.c#40 integrate .. //depot/projects/ia64/sys/dev/acpica/acpi_acad.c#8 integrate .. //depot/projects/ia64/sys/dev/acpica/acpi_ec.c#18 integrate .. //depot/projects/ia64/sys/dev/ath/if_ath.c#10 integrate .. //depot/projects/ia64/sys/dev/ath/if_athvar.h#6 integrate .. //depot/projects/ia64/sys/dev/isp/isp_freebsd.c#17 integrate .. //depot/projects/ia64/sys/dev/pci/pci.c#33 integrate .. //depot/projects/ia64/sys/dev/pci/pcireg.h#8 integrate .. //depot/projects/ia64/sys/dev/pci/pcivar.h#9 integrate .. //depot/projects/ia64/sys/dev/re/if_re.c#4 integrate .. //depot/projects/ia64/sys/dev/sio/sio.c#51 integrate .. //depot/projects/ia64/sys/dev/sound/pci/ich.c#20 integrate .. //depot/projects/ia64/sys/dev/uart/uart_bus_pccard.c#1 branch .. //depot/projects/ia64/sys/i386/i386/pmap.c#63 integrate .. //depot/projects/ia64/sys/kern/kern_prot.c#30 integrate .. //depot/projects/ia64/sys/kern/vfs_bio.c#60 integrate .. //depot/projects/ia64/sys/modules/uart/Makefile#4 integrate .. //depot/projects/ia64/sys/net/if_iso88025subr.c#12 integrate .. //depot/projects/ia64/sys/net80211/ieee80211.c#6 integrate .. //depot/projects/ia64/sys/net80211/ieee80211.h#3 integrate .. //depot/projects/ia64/sys/net80211/ieee80211_input.c#6 integrate .. //depot/projects/ia64/sys/net80211/ieee80211_ioctl.c#5 integrate .. //depot/projects/ia64/sys/net80211/ieee80211_node.c#7 integrate .. //depot/projects/ia64/sys/net80211/ieee80211_output.c#6 integrate .. //depot/projects/ia64/sys/net80211/ieee80211_var.h#5 integrate .. //depot/projects/ia64/sys/netinet6/in6_ifattach.c#6 integrate .. //depot/projects/ia64/sys/netinet6/nd6.c#12 integrate .. //depot/projects/ia64/sys/netinet6/nd6_nbr.c#8 integrate .. //depot/projects/ia64/sys/pci/if_rlreg.h#18 integrate .. //depot/projects/ia64/sys/pci/if_xl.c#40 integrate .. //depot/projects/ia64/sys/pci/if_xlreg.h#12 integrate .. //depot/projects/ia64/sys/vm/vm_kern.c#29 integrate .. //depot/projects/ia64/sys/vm/vm_object.c#66 integrate .. //depot/projects/ia64/usr.bin/colldef/colldef.1#7 integrate .. //depot/projects/ia64/usr.bin/doscmd/doscmd.1#5 integrate .. //depot/projects/ia64/usr.bin/make/dir.c#10 integrate .. //depot/projects/ia64/usr.bin/make/dir.h#4 integrate .. //depot/projects/ia64/usr.bin/make/main.c#19 integrate .. //depot/projects/ia64/usr.bin/make/make.1#12 integrate .. //depot/projects/ia64/usr.bin/tftp/tftp.1#6 integrate .. //depot/projects/ia64/usr.sbin/acpi/acpidump/acpi.c#22 integrate .. //depot/projects/ia64/usr.sbin/boot0cfg/boot0cfg.8#7 integrate .. //depot/projects/ia64/usr.sbin/i4b/isdnd/isdnd.rc.5#6 integrate .. //depot/projects/ia64/usr.sbin/i4b/isdndebug/isdndebug.8#3 integrate .. //depot/projects/ia64/usr.sbin/mrouted/mrouted.8#5 integrate .. //depot/projects/ia64/usr.sbin/mtree/mtree.8#6 integrate .. //depot/projects/ia64/usr.sbin/newsyslog/ptimes.c#2 integrate .. //depot/projects/ia64/usr.sbin/rtadvd/rtadvd.conf.5#5 integrate Differences ... ==== //depot/projects/ia64/Makefile.inc1#83 (text+ko) ==== @@ -1,5 +1,5 @@ # -# $FreeBSD: src/Makefile.inc1,v 1.390 2003/09/07 14:15:40 ru Exp $ +# $FreeBSD: src/Makefile.inc1,v 1.391 2003/09/15 21:18:30 ru Exp $ # # Make command line options: # -DNO_KERBEROS Do not build Heimdal (Kerberos 5) @@ -814,8 +814,6 @@ # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all # shared libraries for ELF. # -# lib/libc (libc_pic.a) must be built before lib/libpthread. -# _startup_libs= gnu/lib/csu gnu/lib/libgcc .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) _startup_libs+= lib/csu/${MACHINE_ARCH}-elf @@ -824,6 +822,7 @@ .endif _prebuild_libs= + _generic_libs= gnu/lib .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \ @@ -835,9 +834,6 @@ _generic_libs+= kerberos5/lib .endif -.if !defined(NOLIBPTHREAD) -_prebuild_libs+= lib/libc -.endif _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \ lib/libkvm lib/libmd \ lib/libncurses lib/libopie lib/libpam lib/libradius \ ==== //depot/projects/ia64/UPDATING#51 (text+ko) ==== @@ -17,6 +17,12 @@ developers choose to disable these features on build machines to maximize performance. +20030915: + A change to /etc/defaults/rc.conf now causes inetd to be started + with `-C 60' if it is not overridden in /etc/rc.conf. This + causes inetd to stop accepting connections from an IP address + that exceeds the rate of 60 connections per minute. + 20030829: The following rc.d scripts have been removed and should be deleted from your installation: atm2.sh atm3.sh devdb @@ -1356,4 +1362,4 @@ Contact Warner Losh if you have any questions about your use of this document. -$FreeBSD: src/UPDATING,v 1.265 2003/08/29 13:25:08 mtm Exp $ +$FreeBSD: src/UPDATING,v 1.266 2003/09/15 17:20:05 nectar Exp $ ==== //depot/projects/ia64/bin/df/df.c#16 (text+ko) ==== @@ -48,7 +48,7 @@ #endif /* not lint */ #endif #include -__FBSDID("$FreeBSD: src/bin/df/df.c,v 1.50 2003/06/03 11:54:42 bde Exp $"); +__FBSDID("$FreeBSD: src/bin/df/df.c,v 1.51 2003/09/13 20:46:58 obrien Exp $"); #include #include @@ -122,10 +122,10 @@ static char *getmntpt(const char *); static size_t longwidth(long); static char *makenetvfslist(void); -static void prthuman(const struct statfs *, long); +static void prthuman(const struct statfs *, size_t); static void prthumanval(double); static void prtstat(struct statfs *, struct maxwidths *); -static long regetmntinfo(struct statfs **, long, const char **); +static size_t regetmntinfo(struct statfs **, long, const char **); static unit_t unit_adjust(double *); static void update_maxwidths(struct maxwidths *, const struct statfs *); static void usage(void); @@ -148,8 +148,8 @@ const char *fstype; char *mntpath, *mntpt; const char **vfslist; - long mntsize; - int ch, i, rv; + size_t i, mntsize; + int ch, rv; fstype = "ufs"; @@ -305,7 +305,7 @@ static char * getmntpt(const char *name) { - long mntsize, i; + size_t mntsize, i; struct statfs *mntbuf; mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); @@ -321,7 +321,7 @@ * file system types not in vfslist and possibly re-stating to get * current (not cached) info. Returns the new count of valid statfs bufs. */ -static long +static size_t regetmntinfo(struct statfs **mntbufp, long mntsize, const char **vfslist) { int i, j; @@ -371,7 +371,7 @@ } static void -prthuman(const struct statfs *sfsp, long used) +prthuman(const struct statfs *sfsp, size_t used) { prthumanval((double)sfsp->f_blocks * (double)sfsp->f_bsize); @@ -411,7 +411,7 @@ static long blocksize; static int headerlen, timesthrough = 0; static const char *header; - long used, availblks, inodes; + size_t used, availblks, inodes; if (++timesthrough == 1) { mwp->mntfrom = max(mwp->mntfrom, strlen("Filesystem")); @@ -456,8 +456,8 @@ if (iflag) { inodes = sfsp->f_files; used = inodes - sfsp->f_ffree; - (void)printf(" %*ld %*ld %4.0f%% ", - (u_int)mwp->iused, used, + (void)printf(" %*lu %*lu %4.0f%% ", + (u_int)mwp->iused, (u_long)used, (u_int)mwp->ifree, sfsp->f_ffree, inodes == 0 ? 100.0 : (double)used / (double)inodes * 100.0); } else ==== //depot/projects/ia64/contrib/isc-dhcp/client/scripts/freebsd#7 (text+ko) ==== @@ -2,7 +2,7 @@ # # $Id: freebsd,v 1.13.2.5 2003/04/27 19:44:01 dhankins Exp $ # -# $FreeBSD: src/contrib/isc-dhcp/client/scripts/freebsd,v 1.24 2003/09/09 16:19:46 mbr Exp $ +# $FreeBSD: src/contrib/isc-dhcp/client/scripts/freebsd,v 1.26 2003/09/15 15:48:12 mbr Exp $ if [ -x /usr/bin/logger ]; then LOGGER="/usr/bin/logger -s -p user.notice -t dhclient" @@ -66,6 +66,15 @@ alias_subnet_arg="netmask $alias_subnet_mask" fi +# Get the interface to which our default route is bound to. +if [ -x /usr/bin/netstat ]; then + if_defaultroute=`/usr/bin/netstat -rn \ + | /usr/bin/grep "^default" \ + | /usr/bin/awk '{print $6}'` +else + if_defaultroute="x" +fi + if [ x$reason = xMEDIUM ]; then eval "ifconfig $interface $medium" eval "ifconfig $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1 @@ -161,7 +170,9 @@ eval "ifconfig $interface inet -alias $old_ip_address $medium" route delete $old_ip_address 127.1 >/dev/null 2>&1 for router in $old_routers; do - route delete default $router >/dev/null 2>&1 + if [ $if_defaultroute = x ] || [ $if_defaultroute = $interface ]; then + route delete default $router >/dev/null 2>&1 + fi done if [ -n "$old_static_routes" ]; then set -- $old_static_routes ==== //depot/projects/ia64/etc/defaults/rc.conf#41 (text+ko) ==== @@ -13,7 +13,7 @@ # # All arguments must be in double or single quotes. # -# $FreeBSD: src/etc/defaults/rc.conf,v 1.187 2003/08/24 06:29:32 mtm Exp $ +# $FreeBSD: src/etc/defaults/rc.conf,v 1.188 2003/09/15 16:44:24 nectar Exp $ ############################################################## ### Important initial Boot-time options #################### @@ -130,7 +130,7 @@ #syslogd_flags="-ss" # Syslogd flags to not bind an inet socket inetd_enable="NO" # Run the network daemon dispatcher (YES/NO). inetd_program="/usr/sbin/inetd" # path to inetd, if you want a different one. -inetd_flags="-wW" # Optional flags to inetd +inetd_flags="-wW -C 60" # Optional flags to inetd # # named. It may be possible to run named in a sandbox, man security for # details. ==== //depot/projects/ia64/etc/pccard_ether#11 (text+ko) ==== @@ -1,6 +1,6 @@ #!/bin/sh - # -# $FreeBSD: src/etc/pccard_ether,v 1.37 2003/08/12 22:44:48 mbr Exp $ +# $FreeBSD: src/etc/pccard_ether,v 1.38 2003/09/15 18:27:38 mbr Exp $ # # pccard_ether interfacename [start|stop] [ifconfig option] # @@ -65,7 +65,7 @@ else return fi - kill `cat ${pidfile}` + /sbin/dhclient -r ${interface} rm -f ${pidfile} case ${startstop} in [Ss][Tt][Oo][Pp]) ==== //depot/projects/ia64/lib/libc/net/getaddrinfo.3#6 (text+ko) ==== @@ -32,7 +32,7 @@ .\" SUCH DAMAGE. .\" .\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95 -.\" $FreeBSD: src/lib/libc/net/getaddrinfo.3,v 1.21 2003/09/08 19:57:14 ru Exp $ +.\" $FreeBSD: src/lib/libc/net/getaddrinfo.3,v 1.22 2003/09/15 04:52:15 ume Exp $ .\" .Dd May 25, 1995 .Dt GETADDRINFO 3 @@ -625,6 +625,10 @@ (RFC2553). .\" .Sh BUGS -The current implementation is not thread-safe. +Though the current implementation should be thread-safe, using +.Fn getaddrinfo +in conjunction with +.Fn gethostby* +breaks thread-safeness. .Pp The text was shamelessly copied from RFC2553. ==== //depot/projects/ia64/lib/libc/net/getnameinfo.3#5 (text+ko) ==== @@ -1,4 +1,4 @@ -.\" $FreeBSD: src/lib/libc/net/getnameinfo.3,v 1.14 2003/09/08 19:57:14 ru Exp $ +.\" $FreeBSD: src/lib/libc/net/getnameinfo.3,v 1.15 2003/09/15 04:52:15 ume Exp $ .\" $KAME: getnameinfo.3,v 1.17 2000/08/09 21:16:17 itojun Exp $ .\" .\" Copyright (c) 1983, 1987, 1991, 1993 @@ -301,7 +301,11 @@ (RFC2553). .\" .Sh BUGS -The current implementation is not thread-safe. +Though the current implementation should be thread-safe, using +.Fn getnameinfo +in conjunction with +.Fn gethostby* +breaks thread-safeness. .Pp The text was shamelessly copied from RFC2553. .Pp ==== //depot/projects/ia64/lib/libc/rpc/rpc_clnt_create.3#7 (text+ko) ==== @@ -3,7 +3,7 @@ .\" @(#)rpc_clnt_create 1.5 89/07/24 SMI; .\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved. .\" $NetBSD: rpc_clnt_create.3,v 1.2 2000/06/20 00:53:08 fvdl Exp $ -.\" $FreeBSD: src/lib/libc/rpc/rpc_clnt_create.3,v 1.11 2002/12/19 09:40:23 ru Exp $ +.\" $FreeBSD: src/lib/libc/rpc/rpc_clnt_create.3,v 1.12 2003/09/14 13:41:56 ru Exp $ .Dd May 7, 1993 .Dt RPC_CLNT_CREATE 3 .Os @@ -459,7 +459,7 @@ has the extra argument .Fa timeout which specifies the maximum time allowed for -for the creation attempt to succeed. +the creation attempt to succeed. In all other respects, the .Fn clnt_tp_create_timed call behaves exactly like the ==== //depot/projects/ia64/lib/libc/stdlib/exit.3#5 (text+ko) ==== @@ -34,7 +34,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)exit.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD: src/lib/libc/stdlib/exit.3,v 1.13 2002/12/13 16:53:50 ru Exp $ +.\" $FreeBSD: src/lib/libc/stdlib/exit.3,v 1.14 2003/09/14 13:41:57 ru Exp $ .\" .Dd September 9, 2002 .Dt EXIT 3 @@ -97,7 +97,7 @@ .Fa status . Cooperating processes may use other values; in a program which might be called by a mail transfer agent, the -the values described in +values described in .Xr sysexits 3 may be used to provide more information to the parent process. .Pp ==== //depot/projects/ia64/lib/libc/stdlib/grantpt.3#3 (text+ko) ==== @@ -29,7 +29,7 @@ .\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS .\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc/stdlib/grantpt.3,v 1.2 2003/06/01 19:19:59 ru Exp $ +.\" $FreeBSD: src/lib/libc/stdlib/grantpt.3,v 1.3 2003/09/14 13:41:57 ru Exp $ .\" .Dd December 23, 2002 .Os @@ -166,7 +166,7 @@ .Bl -tag -width Er .It Bq Er EINVAL .Fa mode -consists an an invalid mode bit. +consists of an invalid mode bit. .It Bq Er EAGAIN The system has no available pseudo-terminal devices. .El ==== //depot/projects/ia64/lib/libc_r/man/pthread_condattr.3#3 (text+ko) ==== @@ -25,7 +25,7 @@ .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_condattr.3,v 1.10 2003/03/24 16:05:24 charnier Exp $ +.\" $FreeBSD: src/lib/libc_r/man/pthread_condattr.3,v 1.11 2003/09/14 13:41:57 ru Exp $ .Dd April 28, 2000 .Dt PTHREAD_CONDATTR 3 .Os @@ -46,7 +46,7 @@ .Fn pthread_cond_init . .Fx Ns 's implementation of conditions does not support any non-default -attributes, so these functions are not very useful, though they are required to +attributes, so these functions are not very useful, though they are required to be present by .Tn POSIX . .Pp ==== //depot/projects/ia64/lib/libpthread/man/pthread_condattr.3#3 (text+ko) ==== @@ -25,7 +25,7 @@ .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libpthread/man/pthread_condattr.3,v 1.11 2003/06/08 10:40:44 charnier Exp $ +.\" $FreeBSD: src/lib/libpthread/man/pthread_condattr.3,v 1.12 2003/09/14 13:41:57 ru Exp $ .Dd April 28, 2000 .Dt PTHREAD_CONDATTR 3 .Os @@ -46,7 +46,7 @@ .Fn pthread_cond_init . .Fx Ns 's implementation of conditions does not support any non-default -attributes, so these functions are not very useful, though they are required to +attributes, so these functions are not very useful, though they are required to be present by .Tn POSIX . .Pp ==== //depot/projects/ia64/lib/libpthread/thread/thr_attr_setguardsize.c#3 (text+ko) ==== @@ -26,7 +26,7 @@ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/lib/libpthread/thread/thr_attr_setguardsize.c,v 1.5 2003/04/18 05:04:15 deischen Exp $ + * $FreeBSD: src/lib/libpthread/thread/thr_attr_setguardsize.c,v 1.6 2003/09/14 22:39:44 davidxu Exp $ */ #include @@ -45,14 +45,6 @@ if (attr == NULL || *attr == NULL) ret = EINVAL; else { - /* - * Round guardsize up to the nearest multiple of - * _thr_page_size. - */ - if (guardsize % _thr_page_size != 0) - guardsize = ((guardsize / _thr_page_size) + 1) * - _thr_page_size; - /* Save the stack size. */ (*attr)->guardsize_attr = guardsize; ret = 0; ==== //depot/projects/ia64/lib/libpthread/thread/thr_attr_setinheritsched.c#2 (text+ko) ==== @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/lib/libpthread/thread/thr_attr_setinheritsched.c,v 1.6 2002/09/16 08:45:34 mini Exp $ + * $FreeBSD: src/lib/libpthread/thread/thr_attr_setinheritsched.c,v 1.7 2003/09/14 22:28:13 davidxu Exp $ */ #include #include @@ -44,6 +44,9 @@ if ((attr == NULL) || (*attr == NULL)) ret = EINVAL; + else if (sched_inherit != PTHREAD_INHERIT_SCHED && + sched_inherit != PTHREAD_EXPLICIT_SCHED) + ret = ENOTSUP; else (*attr)->sched_inherit = sched_inherit; ==== //depot/projects/ia64/lib/libpthread/thread/thr_attr_setscope.c#3 (text+ko) ==== @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/lib/libpthread/thread/thr_attr_setscope.c,v 1.9 2003/04/18 05:04:15 deischen Exp $ + * $FreeBSD: src/lib/libpthread/thread/thr_attr_setscope.c,v 1.10 2003/09/14 22:32:28 davidxu Exp $ */ #include #include @@ -48,8 +48,10 @@ } else if ((contentionscope != PTHREAD_SCOPE_PROCESS) && (contentionscope != PTHREAD_SCOPE_SYSTEM)) { ret = EINVAL; - } else + } else if (contentionscope == PTHREAD_SCOPE_SYSTEM) { (*attr)->flags |= contentionscope; - + } else { + (*attr)->flags &= ~PTHREAD_SCOPE_SYSTEM; + } return (ret); } ==== //depot/projects/ia64/lib/libpthread/thread/thr_cond.c#17 (text+ko) ==== @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/lib/libpthread/thread/thr_cond.c,v 1.49 2003/09/04 07:46:26 davidxu Exp $ + * $FreeBSD: src/lib/libpthread/thread/thr_cond.c,v 1.50 2003/09/14 22:33:32 davidxu Exp $ */ #include #include @@ -116,7 +116,7 @@ * structure: */ TAILQ_INIT(&pcond->c_queue); - pcond->c_flags |= COND_FLAGS_INITED; + pcond->c_flags = COND_FLAGS_INITED; pcond->c_type = type; pcond->c_mutex = NULL; pcond->c_seqno = 0; ==== //depot/projects/ia64/lib/libpthread/thread/thr_create.c#14 (text+ko) ==== @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/lib/libpthread/thread/thr_create.c,v 1.50 2003/08/06 00:23:40 marcel Exp $ + * $FreeBSD: src/lib/libpthread/thread/thr_create.c,v 1.51 2003/09/14 22:52:16 davidxu Exp $ */ #include #include @@ -99,7 +99,6 @@ struct kse *kse = NULL; struct kse_group *kseg = NULL; kse_critical_t crit; - int i; int ret = 0; if (_thr_initial == NULL) @@ -127,8 +126,20 @@ if (attr == NULL || *attr == NULL) /* Use the default thread attributes: */ new_thread->attr = _pthread_attr_default; - else + else { new_thread->attr = *(*attr); + if ((*attr)->sched_inherit == PTHREAD_INHERIT_SCHED) { + /* inherit scheduling contention scop */ + if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM) + new_thread->attr.flags |= PTHREAD_SCOPE_SYSTEM; + else + new_thread->attr.flags &= ~PTHREAD_SCOPE_SYSTEM; + /* + * scheduling policy and scheduling parameters will be + * inherited in following code. + */ + } + } #ifdef SYSTEM_SCOPE_ONLY new_thread->attr.flags |= PTHREAD_SCOPE_SYSTEM; #endif @@ -199,7 +210,7 @@ * Check if this thread is to inherit the scheduling * attributes from its parent: */ - if ((new_thread->attr.flags & PTHREAD_INHERIT_SCHED) != 0) { + if (new_thread->attr.sched_inherit == PTHREAD_INHERIT_SCHED) { /* * Copy the scheduling attributes. * Lock the scheduling lock to get consistent @@ -230,26 +241,17 @@ /* Initialize the mutex queue: */ TAILQ_INIT(&new_thread->mutexq); - /* - * Initialize thread locking. - * Lock initializing needs malloc, so don't - * enter critical region before doing this! - */ - if (_lock_init(&new_thread->lock, LCK_ADAPTIVE, - _thr_lock_wait, _thr_lock_wakeup) != 0) - PANIC("Cannot initialize thread lock"); - for (i = 0; i < MAX_THR_LOCKLEVEL; i++) { - _lockuser_init(&new_thread->lockusers[i], - (void *)new_thread); - _LCK_SET_PRIVATE2(&new_thread->lockusers[i], - (void *)new_thread); - } - /* Initialise hooks in the thread structure: */ new_thread->specific = NULL; + new_thread->specific_data_count = 0; new_thread->cleanup = NULL; new_thread->flags = 0; new_thread->continuation = NULL; + new_thread->wakeup_time.tv_sec = -1; + new_thread->lock_switch = 0; + sigemptyset(&new_thread->sigpend); + new_thread->check_pending = 0; + new_thread->locklevel = 0; if (new_thread->attr.suspend == THR_CREATE_SUSPENDED) { new_thread->state = PS_SUSPENDED; ==== //depot/projects/ia64/lib/libpthread/thread/thr_exit.c#7 (text+ko) ==== @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/lib/libpthread/thread/thr_exit.c,v 1.34 2003/08/18 04:03:08 davidxu Exp $ + * $FreeBSD: src/lib/libpthread/thread/thr_exit.c,v 1.35 2003/09/14 22:52:16 davidxu Exp $ */ #include #include @@ -86,9 +86,9 @@ _pthread_exit(void *status) { struct pthread *curthread = _get_curthread(); + kse_critical_t crit; + struct kse *curkse; - if (!_kse_isthreaded()) - exit(0); /* Check if this thread is already in the process of exiting: */ if ((curthread->flags & THR_FLAGS_EXITING) != 0) { char msg[128]; @@ -119,9 +119,27 @@ /* Run the thread-specific data destructors: */ _thread_cleanupspecific(); } + if (!_kse_isthreaded()) + exit(0); + crit = _kse_critical_enter(); + curkse = _get_curkse(); + KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock); + /* Use thread_list_lock */ + _thr_active_threads--; +#ifdef SYSTEM_SCOPE_ONLY + if (_thr_active_threads == 0) { +#else + if (_thr_active_threads == 1) { +#endif + KSE_LOCK_RELEASE(curkse, &_thread_list_lock); + _kse_critical_leave(crit); + exit(0); + /* Never reach! */ + } + KSE_LOCK_RELEASE(curkse, &_thread_list_lock); /* This thread will never be re-scheduled. */ - THR_LOCK_SWITCH(curthread); + KSE_LOCK(curkse); THR_SET_STATE(curthread, PS_DEAD); _thr_sched_switch_unlocked(curthread); /* Never reach! */ ==== //depot/projects/ia64/lib/libpthread/thread/thr_kern.c#34 (text+ko) ==== @@ -33,7 +33,7 @@ * */ #include -__FBSDID("$FreeBSD: src/lib/libpthread/thread/thr_kern.c,v 1.93 2003/09/04 14:06:42 davidxu Exp $"); +__FBSDID("$FreeBSD: src/lib/libpthread/thread/thr_kern.c,v 1.94 2003/09/14 22:52:16 davidxu Exp $"); #include #include @@ -121,7 +121,6 @@ static struct lock thread_lock; static int free_thread_count = 0; static int inited = 0; -static int active_threads = 1; static int active_kse_count = 0; static int active_kseg_count = 0; static u_int64_t next_uniqueid = 1; @@ -158,6 +157,7 @@ struct pthread_sigframe *psf); static int thr_timedout(struct pthread *thread, struct timespec *curtime); static void thr_unlink(struct pthread *thread); +static void thr_destroy(struct pthread *thread); static void thread_gc(struct pthread *thread); static void kse_gc(struct pthread *thread); static void kseg_gc(struct pthread *thread); @@ -213,7 +213,7 @@ * dump core. */ sigprocmask(SIG_SETMASK, &curthread->sigmask, NULL); - active_threads = 1; + _thr_active_threads = 1; /* * Enter a loop to remove and free all threads other than @@ -232,11 +232,7 @@ _thr_stack_free(&thread->attr); if (thread->specific != NULL) free(thread->specific); - for (i = 0; i < MAX_THR_LOCKLEVEL; i++) { - _lockuser_destroy(&thread->lockusers[i]); - } - _lock_destroy(&thread->lock); - free(thread); + thr_destroy(thread); } } @@ -253,69 +249,42 @@ /* Free the free KSEs: */ while ((kse = TAILQ_FIRST(&free_kseq)) != NULL) { TAILQ_REMOVE(&free_kseq, kse, k_qe); - for (i = 0; i < MAX_KSE_LOCKLEVEL; i++) { - _lockuser_destroy(&kse->k_lockusers[i]); - } - _lock_destroy(&kse->k_lock); - _kcb_dtor(kse->k_kcb); - if (kse->k_stack.ss_sp != NULL) - free(kse->k_stack.ss_sp); - free(kse); + kse_destroy(kse); } free_kse_count = 0; /* Free the active KSEs: */ while ((kse = TAILQ_FIRST(&active_kseq)) != NULL) { TAILQ_REMOVE(&active_kseq, kse, k_qe); - for (i = 0; i < MAX_KSE_LOCKLEVEL; i++) { - _lockuser_destroy(&kse->k_lockusers[i]); - } - _lock_destroy(&kse->k_lock); - if (kse->k_stack.ss_sp != NULL) - free(kse->k_stack.ss_sp); - free(kse); + kse_destroy(kse); } active_kse_count = 0; /* Free the free KSEGs: */ while ((kseg = TAILQ_FIRST(&free_kse_groupq)) != NULL) { TAILQ_REMOVE(&free_kse_groupq, kseg, kg_qe); - _lock_destroy(&kseg->kg_lock); - _pq_free(&kseg->kg_schedq.sq_runq); - free(kseg); + kseg_destroy(kseg); } free_kseg_count = 0; /* Free the active KSEGs: */ while ((kseg = TAILQ_FIRST(&active_kse_groupq)) != NULL) { TAILQ_REMOVE(&active_kse_groupq, kseg, kg_qe); - _lock_destroy(&kseg->kg_lock); - _pq_free(&kseg->kg_schedq.sq_runq); - free(kseg); + kseg_destroy(kseg); } active_kseg_count = 0; /* Free the free threads. */ while ((thread = TAILQ_FIRST(&free_threadq)) != NULL) { TAILQ_REMOVE(&free_threadq, thread, tle); - if (thread->specific != NULL) - free(thread->specific); - for (i = 0; i < MAX_THR_LOCKLEVEL; i++) { - _lockuser_destroy(&thread->lockusers[i]); - } - _lock_destroy(&thread->lock); - free(thread); + thr_destroy(thread); } free_thread_count = 0; /* Free the to-be-gc'd threads. */ while ((thread = TAILQ_FIRST(&_thread_gc_list)) != NULL) { TAILQ_REMOVE(&_thread_gc_list, thread, gcle); - for (i = 0; i < MAX_THR_LOCKLEVEL; i++) { - _lockuser_destroy(&thread->lockusers[i]); - } - _lock_destroy(&thread->lock); - free(thread); + thr_destroy(thread); } TAILQ_INIT(&gc_ksegq); _gc_count = 0; @@ -361,7 +330,7 @@ */ sigprocmask(SIG_SETMASK, &curthread->sigmask, NULL); curthread->kse->k_kcb->kcb_kmbx.km_curthread = NULL; - active_threads = 1; + _thr_active_threads = 1; #endif } @@ -1247,19 +1216,6 @@ KSE_SCHED_UNLOCK(curkse, curkse->k_kseg); DBG_MSG("Adding thread %p to GC list\n", thread); KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock); - /* Use thread_list_lock */ - active_threads--; -#ifdef SYSTEM_SCOPE_ONLY - if (active_threads == 0) { -#else - if (active_threads == 1) { -#endif - KSE_LOCK_RELEASE(curkse, &_thread_list_lock); - /* Possible use a signalcontext wrapper to call exit ? */ - curkse->k_curthread = thread; - _tcb_set(curkse->k_kcb, thread->tcb); - exit(0); - } THR_GCLIST_ADD(thread); KSE_LOCK_RELEASE(curkse, &_thread_list_lock); if (sys_scope) { @@ -2347,8 +2303,9 @@ struct pthread * _thr_alloc(struct pthread *curthread) { - kse_critical_t crit; - struct pthread *thread = NULL; + kse_critical_t crit; + struct pthread *thread = NULL; + int i; if (curthread != NULL) { if (GC_NEEDED()) @@ -2370,6 +2327,21 @@ if ((thread->tcb = _tcb_ctor(thread)) == NULL) { free(thread); thread = NULL; + } else { + /* + * Initialize thread locking. + * Lock initializing needs malloc, so don't + * enter critical region before doing this! + */ + if (_lock_init(&thread->lock, LCK_ADAPTIVE, + _thr_lock_wait, _thr_lock_wakeup) != 0) + PANIC("Cannot initialize thread lock"); + for (i = 0; i < MAX_THR_LOCKLEVEL; i++) { + _lockuser_init(&thread->lockusers[i], + (void *)thread); + _LCK_SET_PRIVATE2(&thread->lockusers[i], + (void *)thread); + } } } return (thread); @@ -2379,23 +2351,11 @@ _thr_free(struct pthread *curthread, struct pthread *thread) { kse_critical_t crit; - int i; DBG_MSG("Freeing thread %p\n", thread); if ((curthread == NULL) || (free_thread_count >= MAX_CACHED_THREADS)) { - for (i = 0; i < MAX_THR_LOCKLEVEL; i++) { - _lockuser_destroy(&thread->lockusers[i]); - } - _lock_destroy(&thread->lock); - _tcb_dtor(thread->tcb); - free(thread); - } - else { - /* Reinitialize any important fields here. */ - thread->lock_switch = 0; - sigemptyset(&thread->sigpend); - thread->check_pending = 0; - + thr_destroy(thread); + } else { /* Add the thread to the free thread list. */ crit = _kse_critical_enter(); KSE_LOCK_ACQUIRE(curthread->kse, &thread_lock); @@ -2406,6 +2366,18 @@ } } +static void +thr_destroy(struct pthread *thread) +{ + int i; + + for (i = 0; i < MAX_THR_LOCKLEVEL; i++) + _lockuser_destroy(&thread->lockusers[i]); + _lock_destroy(&thread->lock); + _tcb_dtor(thread->tcb); + free(thread); +} + /* * Add an active thread: * @@ -2424,7 +2396,6 @@ crit = _kse_critical_enter(); curkse = _get_curkse(); curthread = _get_curthread(); - thread->sigmask = curthread->sigmask; KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock); /* * Initialize the unique id (which GDB uses to track @@ -2433,7 +2404,7 @@ */ thread->uniqueid = next_uniqueid++; THR_LIST_ADD(thread); - active_threads++; + _thr_active_threads++; KSE_LOCK_RELEASE(curkse, &_thread_list_lock); _kse_critical_leave(crit); } @@ -2451,7 +2422,7 @@ curkse = _get_curkse(); KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock); THR_LIST_REMOVE(thread); - active_threads--; + _thr_active_threads--; KSE_LOCK_RELEASE(curkse, &_thread_list_lock); _kse_critical_leave(crit); } ==== //depot/projects/ia64/lib/libpthread/thread/thr_private.h#24 (text+ko) ==== @@ -31,7 +31,7 @@ * * Private thread definitions for the uthread kernel. * - * $FreeBSD: src/lib/libpthread/thread/thr_private.h,v 1.101 2003/09/09 22:38:12 davidxu Exp $ + * $FreeBSD: src/lib/libpthread/thread/thr_private.h,v 1.102 2003/09/14 22:52:16 davidxu Exp $ */ #ifndef _THR_PRIVATE_H @@ -994,6 +994,8 @@ SCLASS TAILQ_HEAD(, pthread) _thread_gc_list SCLASS_PRESET(TAILQ_HEAD_INITIALIZER(_thread_gc_list)); +SCLASS int _thr_active_threads SCLASS_PRESET(1); + /* Default thread attributes: */ SCLASS struct pthread_attr _pthread_attr_default SCLASS_PRESET({ ==== //depot/projects/ia64/lib/libpthread/thread/thr_sig.c#24 (text+ko) ==== @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/lib/libpthread/thread/thr_sig.c,v 1.70 2003/08/21 22:02:18 davidxu Exp $ >>> TRUNCATED FOR MAIL (1000 lines) <<<