History log of /freebsd-9.3-release/lib/libthr/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
267655 20-Jun-2014 gjb

Remove svn:mergeinfo carried over from stable/9.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


/freebsd-9.3-release/COPYRIGHT
/freebsd-9.3-release/MAINTAINERS
/freebsd-9.3-release/Makefile
/freebsd-9.3-release/Makefile.inc1
/freebsd-9.3-release/ObsoleteFiles.inc
/freebsd-9.3-release/UPDATING
/freebsd-9.3-release/bin
/freebsd-9.3-release/bin/cat
/freebsd-9.3-release/bin/cp
/freebsd-9.3-release/bin/csh
/freebsd-9.3-release/bin/date
/freebsd-9.3-release/bin/dd
/freebsd-9.3-release/bin/df
/freebsd-9.3-release/bin/ed
/freebsd-9.3-release/bin/expr
/freebsd-9.3-release/bin/getfacl
/freebsd-9.3-release/bin/kenv
/freebsd-9.3-release/bin/ln
/freebsd-9.3-release/bin/mkdir
/freebsd-9.3-release/bin/mv
/freebsd-9.3-release/bin/pkill
/freebsd-9.3-release/bin/ps
/freebsd-9.3-release/bin/pwait
/freebsd-9.3-release/bin/rcp
/freebsd-9.3-release/bin/rm
/freebsd-9.3-release/bin/setfacl
/freebsd-9.3-release/bin/sh
/freebsd-9.3-release/bin/sleep
/freebsd-9.3-release/bin/test
/freebsd-9.3-release/bin/uuidgen
/freebsd-9.3-release/cddl
/freebsd-9.3-release/cddl/contrib
/freebsd-9.3-release/cddl/contrib/dtracetoolkit
/freebsd-9.3-release/cddl/contrib/opensolaris
/freebsd-9.3-release/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize
/freebsd-9.3-release/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-9.3-release/cddl/contrib/opensolaris/cmd/zfs
/freebsd-9.3-release/cddl/contrib/opensolaris/cmd/zpool
/freebsd-9.3-release/cddl/contrib/opensolaris/lib/libdtrace/common
/freebsd-9.3-release/cddl/contrib/opensolaris/lib/libzfs
/freebsd-9.3-release/cddl/lib
/freebsd-9.3-release/cddl/lib/drti
/freebsd-9.3-release/cddl/lib/libdtrace
/freebsd-9.3-release/cddl/usr.bin/zinject
/freebsd-9.3-release/contrib
/freebsd-9.3-release/contrib/bind9
/freebsd-9.3-release/contrib/binutils
/freebsd-9.3-release/contrib/bmake
/freebsd-9.3-release/contrib/bsnmp
/freebsd-9.3-release/contrib/bsnmp/snmp_mibII
/freebsd-9.3-release/contrib/bzip2
/freebsd-9.3-release/contrib/compiler-rt
/freebsd-9.3-release/contrib/dialog
/freebsd-9.3-release/contrib/diff
/freebsd-9.3-release/contrib/ee
/freebsd-9.3-release/contrib/expat
/freebsd-9.3-release/contrib/file
/freebsd-9.3-release/contrib/gcc
/freebsd-9.3-release/contrib/gcclibs
/freebsd-9.3-release/contrib/gdb
/freebsd-9.3-release/contrib/gdtoa
/freebsd-9.3-release/contrib/gnu-sort
/freebsd-9.3-release/contrib/gperf
/freebsd-9.3-release/contrib/groff
/freebsd-9.3-release/contrib/less
/freebsd-9.3-release/contrib/libarchive
/freebsd-9.3-release/contrib/libarchive/cpio
/freebsd-9.3-release/contrib/libarchive/libarchive
/freebsd-9.3-release/contrib/libarchive/libarchive_fe
/freebsd-9.3-release/contrib/libarchive/tar
/freebsd-9.3-release/contrib/libc++
/freebsd-9.3-release/contrib/libc-pwcache
/freebsd-9.3-release/contrib/libc-vis
/freebsd-9.3-release/contrib/libcxxrt
/freebsd-9.3-release/contrib/libpcap
/freebsd-9.3-release/contrib/libstdc++
/freebsd-9.3-release/contrib/libucl
/freebsd-9.3-release/contrib/llvm
/freebsd-9.3-release/contrib/llvm/tools/clang
/freebsd-9.3-release/contrib/mknod
/freebsd-9.3-release/contrib/mtree
/freebsd-9.3-release/contrib/ncurses
/freebsd-9.3-release/contrib/netcat
/freebsd-9.3-release/contrib/ntp
/freebsd-9.3-release/contrib/nvi
/freebsd-9.3-release/contrib/one-true-awk
/freebsd-9.3-release/contrib/openbsm
/freebsd-9.3-release/contrib/openpam
/freebsd-9.3-release/contrib/openresolv
/freebsd-9.3-release/contrib/opie
/freebsd-9.3-release/contrib/pf
/freebsd-9.3-release/contrib/pnpinfo
/freebsd-9.3-release/contrib/sendmail
/freebsd-9.3-release/contrib/tcpdump
/freebsd-9.3-release/contrib/tcsh
/freebsd-9.3-release/contrib/telnet
/freebsd-9.3-release/contrib/tnftp
/freebsd-9.3-release/contrib/top
/freebsd-9.3-release/contrib/top/install-sh
/freebsd-9.3-release/contrib/traceroute
/freebsd-9.3-release/contrib/tzcode
/freebsd-9.3-release/contrib/tzcode/stdtime
/freebsd-9.3-release/contrib/tzcode/zic
/freebsd-9.3-release/contrib/tzdata
/freebsd-9.3-release/contrib/unvis
/freebsd-9.3-release/contrib/vis
/freebsd-9.3-release/contrib/wpa
/freebsd-9.3-release/contrib/xz
/freebsd-9.3-release/crypto/heimdal
/freebsd-9.3-release/crypto/openssh
/freebsd-9.3-release/crypto/openssl
/freebsd-9.3-release/etc
/freebsd-9.3-release/etc/mtree
/freebsd-9.3-release/etc/rc.d
/freebsd-9.3-release/games/bcd
/freebsd-9.3-release/games/caesar
/freebsd-9.3-release/games/factor
/freebsd-9.3-release/games/fortune
/freebsd-9.3-release/games/fortune/fortune
/freebsd-9.3-release/games/grdc
/freebsd-9.3-release/games/morse
/freebsd-9.3-release/games/number
/freebsd-9.3-release/games/pom
/freebsd-9.3-release/games/random
/freebsd-9.3-release/gnu/lib
/freebsd-9.3-release/gnu/lib/csu
/freebsd-9.3-release/gnu/lib/libgcc
/freebsd-9.3-release/gnu/lib/libgomp
/freebsd-9.3-release/gnu/lib/libstdc++
/freebsd-9.3-release/gnu/lib/libsupc++
/freebsd-9.3-release/gnu/usr.bin/binutils
/freebsd-9.3-release/gnu/usr.bin/binutils/libbinutils
/freebsd-9.3-release/gnu/usr.bin/cc/c++
/freebsd-9.3-release/gnu/usr.bin/cc/cc_tools
/freebsd-9.3-release/gnu/usr.bin/cc/include
/freebsd-9.3-release/gnu/usr.bin/gdb
/freebsd-9.3-release/gnu/usr.bin/gdb/kgdb
/freebsd-9.3-release/gnu/usr.bin/gperf
/freebsd-9.3-release/gnu/usr.bin/groff
/freebsd-9.3-release/gnu/usr.bin/send-pr
/freebsd-9.3-release/include
/freebsd-9.3-release/include/arpa
/freebsd-9.3-release/kerberos5
/freebsd-9.3-release/kerberos5/lib/libgssapi_krb5
/freebsd-9.3-release/lib
/freebsd-9.3-release/lib/Makefile
/freebsd-9.3-release/lib/bind
/freebsd-9.3-release/lib/clang
/freebsd-9.3-release/lib/clang/include
/freebsd-9.3-release/lib/csu
/freebsd-9.3-release/lib/libarchive
/freebsd-9.3-release/lib/libbluetooth
/freebsd-9.3-release/lib/libc
/freebsd-9.3-release/lib/libc++
/freebsd-9.3-release/lib/libc/stdtime
/freebsd-9.3-release/lib/libc/sys
/freebsd-9.3-release/lib/libc/uuid
/freebsd-9.3-release/lib/libcam
/freebsd-9.3-release/lib/libcompiler_rt
/freebsd-9.3-release/lib/libcrypt
/freebsd-9.3-release/lib/libcxxrt
/freebsd-9.3-release/lib/libdwarf
/freebsd-9.3-release/lib/libedit
/freebsd-9.3-release/lib/libelf
/freebsd-9.3-release/lib/libexpat
/freebsd-9.3-release/lib/libfetch
/freebsd-9.3-release/lib/libgeom
/freebsd-9.3-release/lib/libgpib
/freebsd-9.3-release/lib/libgssapi
/freebsd-9.3-release/lib/libiconv_modules
/freebsd-9.3-release/lib/libipsec
/freebsd-9.3-release/lib/libjail
/freebsd-9.3-release/lib/libkiconv
/freebsd-9.3-release/lib/libkvm
/freebsd-9.3-release/lib/libmagic
/freebsd-9.3-release/lib/libmemstat
/freebsd-9.3-release/lib/libncp
/freebsd-9.3-release/lib/libnetbsd
/freebsd-9.3-release/lib/libnetgraph
/freebsd-9.3-release/lib/libopie
/freebsd-9.3-release/lib/libpam
/freebsd-9.3-release/lib/libpcap
/freebsd-9.3-release/lib/libpmc
/freebsd-9.3-release/lib/libproc
/freebsd-9.3-release/lib/libprocstat
/freebsd-9.3-release/lib/libradius
/freebsd-9.3-release/lib/librpcsec_gss
/freebsd-9.3-release/lib/librpcsvc
/freebsd-9.3-release/lib/librt
/freebsd-9.3-release/lib/libsbuf
/freebsd-9.3-release/lib/libsm
/freebsd-9.3-release/lib/libstand
/freebsd-9.3-release/lib/libstdbuf
/freebsd-9.3-release/lib/libtacplus
/freebsd-9.3-release/lib/libthr
thread/thr_setprio.c
thread/thr_setschedparam.c
/freebsd-9.3-release/lib/libthread_db
/freebsd-9.3-release/lib/libucl
/freebsd-9.3-release/lib/libulog
/freebsd-9.3-release/lib/libusb
/freebsd-9.3-release/lib/libusbhid
/freebsd-9.3-release/lib/libutil
/freebsd-9.3-release/lib/libvgl
/freebsd-9.3-release/lib/libypclnt
/freebsd-9.3-release/lib/libz
/freebsd-9.3-release/lib/msun
/freebsd-9.3-release/lib/ncurses/form
/freebsd-9.3-release/lib/ncurses/menu
/freebsd-9.3-release/lib/ncurses/ncurses
/freebsd-9.3-release/lib/ncurses/panel
/freebsd-9.3-release/libexec/atrun
/freebsd-9.3-release/libexec/bootpd
/freebsd-9.3-release/libexec/comsat
/freebsd-9.3-release/libexec/ftpd
/freebsd-9.3-release/libexec/getty
/freebsd-9.3-release/libexec/mail.local
/freebsd-9.3-release/libexec/pppoed
/freebsd-9.3-release/libexec/rbootd
/freebsd-9.3-release/libexec/rshd
/freebsd-9.3-release/libexec/rtld-elf
/freebsd-9.3-release/libexec/save-entropy
/freebsd-9.3-release/libexec/smrsh
/freebsd-9.3-release/libexec/tftpd
/freebsd-9.3-release/libexec/ypxfr
/freebsd-9.3-release/release
/freebsd-9.3-release/release/doc
/freebsd-9.3-release/release/doc/en_US.ISO8859-1/hardware
/freebsd-9.3-release/release/ia64
/freebsd-9.3-release/release/picobsd/tinyware/passwd
/freebsd-9.3-release/rescue
/freebsd-9.3-release/rescue/rescue
/freebsd-9.3-release/sbin
/freebsd-9.3-release/sbin/atacontrol
/freebsd-9.3-release/sbin/atm/atmconfig
/freebsd-9.3-release/sbin/bsdlabel
/freebsd-9.3-release/sbin/camcontrol
/freebsd-9.3-release/sbin/ccdconfig
/freebsd-9.3-release/sbin/ddb
/freebsd-9.3-release/sbin/devd
/freebsd-9.3-release/sbin/devfs
/freebsd-9.3-release/sbin/dhclient
/freebsd-9.3-release/sbin/dump
/freebsd-9.3-release/sbin/dumpfs
/freebsd-9.3-release/sbin/fdisk
/freebsd-9.3-release/sbin/fdisk_pc98
/freebsd-9.3-release/sbin/fsck_ffs
/freebsd-9.3-release/sbin/fsck_msdosfs
/freebsd-9.3-release/sbin/fsdb
/freebsd-9.3-release/sbin/fsirand
/freebsd-9.3-release/sbin/gbde
/freebsd-9.3-release/sbin/geom
/freebsd-9.3-release/sbin/geom/class/mirror
/freebsd-9.3-release/sbin/geom/class/multipath
/freebsd-9.3-release/sbin/geom/class/part
/freebsd-9.3-release/sbin/geom/class/raid
/freebsd-9.3-release/sbin/geom/class/raid3
/freebsd-9.3-release/sbin/geom/class/sched
/freebsd-9.3-release/sbin/geom/class/virstor
/freebsd-9.3-release/sbin/ggate
/freebsd-9.3-release/sbin/growfs
/freebsd-9.3-release/sbin/gvinum
/freebsd-9.3-release/sbin/hastctl
/freebsd-9.3-release/sbin/hastd
/freebsd-9.3-release/sbin/ifconfig
/freebsd-9.3-release/sbin/init
/freebsd-9.3-release/sbin/ipf
/freebsd-9.3-release/sbin/ipfw
/freebsd-9.3-release/sbin/iscontrol
/freebsd-9.3-release/sbin/kldload
/freebsd-9.3-release/sbin/mca
/freebsd-9.3-release/sbin/md5
/freebsd-9.3-release/sbin/mdconfig
/freebsd-9.3-release/sbin/mdmfs
/freebsd-9.3-release/sbin/mount
/freebsd-9.3-release/sbin/mount_cd9660
/freebsd-9.3-release/sbin/mount_msdosfs
/freebsd-9.3-release/sbin/mount_nfs
/freebsd-9.3-release/sbin/mount_ntfs
/freebsd-9.3-release/sbin/mount_nullfs
/freebsd-9.3-release/sbin/mount_unionfs
/freebsd-9.3-release/sbin/natd
/freebsd-9.3-release/sbin/newfs
/freebsd-9.3-release/sbin/newfs_msdos
/freebsd-9.3-release/sbin/nvmecontrol
/freebsd-9.3-release/sbin/ping6
/freebsd-9.3-release/sbin/quotacheck
/freebsd-9.3-release/sbin/rcorder
/freebsd-9.3-release/sbin/reboot
/freebsd-9.3-release/sbin/recoverdisk
/freebsd-9.3-release/sbin/restore
/freebsd-9.3-release/sbin/route
/freebsd-9.3-release/sbin/routed/rtquery
/freebsd-9.3-release/sbin/savecore
/freebsd-9.3-release/sbin/setkey
/freebsd-9.3-release/sbin/shutdown
/freebsd-9.3-release/sbin/swapon
/freebsd-9.3-release/sbin/sysctl
/freebsd-9.3-release/sbin/tunefs
/freebsd-9.3-release/sbin/umount
/freebsd-9.3-release/secure/lib/libcrypt
/freebsd-9.3-release/secure/lib/libcrypto
/freebsd-9.3-release/secure/lib/libssh
/freebsd-9.3-release/secure/lib/libssl
/freebsd-9.3-release/secure/libexec/ssh-keysign
/freebsd-9.3-release/secure/usr.bin/openssl
/freebsd-9.3-release/secure/usr.bin/ssh
/freebsd-9.3-release/secure/usr.sbin/sshd
/freebsd-9.3-release/share
/freebsd-9.3-release/share/doc
/freebsd-9.3-release/share/doc/bind9
/freebsd-9.3-release/share/doc/smm
/freebsd-9.3-release/share/dtrace
/freebsd-9.3-release/share/examples
/freebsd-9.3-release/share/examples/csh
/freebsd-9.3-release/share/examples/cvsup
/freebsd-9.3-release/share/examples/diskless
/freebsd-9.3-release/share/examples/etc
/freebsd-9.3-release/share/examples/kld/dyn_sysctl
/freebsd-9.3-release/share/examples/ppp
/freebsd-9.3-release/share/examples/printing
/freebsd-9.3-release/share/examples/scsi_target
/freebsd-9.3-release/share/examples/ses
/freebsd-9.3-release/share/i18n/csmapper
/freebsd-9.3-release/share/info
/freebsd-9.3-release/share/man
/freebsd-9.3-release/share/man/man3
/freebsd-9.3-release/share/man/man4
/freebsd-9.3-release/share/man/man4/run.4
/freebsd-9.3-release/share/man/man4/runfw.4
/freebsd-9.3-release/share/man/man5
/freebsd-9.3-release/share/man/man7
/freebsd-9.3-release/share/man/man8
/freebsd-9.3-release/share/man/man9
/freebsd-9.3-release/share/misc
/freebsd-9.3-release/share/mk
/freebsd-9.3-release/share/mk/bsd.arch.inc.mk
/freebsd-9.3-release/share/mk/bsd.sys.mk
/freebsd-9.3-release/share/skel
/freebsd-9.3-release/share/syscons
/freebsd-9.3-release/share/syscons/keymaps
/freebsd-9.3-release/share/termcap
/freebsd-9.3-release/share/zoneinfo
/freebsd-9.3-release/sys
/freebsd-9.3-release/sys/amd64/include/xen
/freebsd-9.3-release/sys/boot
/freebsd-9.3-release/sys/boot/forth
/freebsd-9.3-release/sys/boot/i386/efi
/freebsd-9.3-release/sys/boot/i386/gptboot
/freebsd-9.3-release/sys/boot/ia64/efi
/freebsd-9.3-release/sys/boot/ia64/ski
/freebsd-9.3-release/sys/boot/powerpc/boot1.chrp
/freebsd-9.3-release/sys/boot/powerpc/ofw
/freebsd-9.3-release/sys/cddl/contrib/opensolaris
/freebsd-9.3-release/sys/conf
/freebsd-9.3-release/sys/contrib/dev/acpica
/freebsd-9.3-release/sys/contrib/dev/run
/freebsd-9.3-release/sys/contrib/octeon-sdk
/freebsd-9.3-release/sys/contrib/pf
/freebsd-9.3-release/sys/contrib/x86emu
/freebsd-9.3-release/sys/dev
/freebsd-9.3-release/sys/dev/e1000
/freebsd-9.3-release/sys/dev/isp
/freebsd-9.3-release/sys/dev/ixgbe
/freebsd-9.3-release/sys/dev/puc
/freebsd-9.3-release/sys/dev/usb/wlan/if_run.c
/freebsd-9.3-release/sys/dev/usb/wlan/if_runreg.h
/freebsd-9.3-release/sys/fs
/freebsd-9.3-release/sys/fs/ntfs
/freebsd-9.3-release/sys/modules
/freebsd-9.3-release/sys/modules/ixgbe
/freebsd-9.3-release/sys/net
/freebsd-9.3-release/sys/netpfil
/freebsd-9.3-release/sys/sys
/freebsd-9.3-release/tools
/freebsd-9.3-release/tools/build
/freebsd-9.3-release/tools/build/options
/freebsd-9.3-release/tools/diag
/freebsd-9.3-release/tools/kerneldoc
/freebsd-9.3-release/tools/regression
/freebsd-9.3-release/tools/regression/aio/aiotest
/freebsd-9.3-release/tools/regression/bin/sh
/freebsd-9.3-release/tools/regression/bin/test
/freebsd-9.3-release/tools/regression/doat
/freebsd-9.3-release/tools/regression/fifo
/freebsd-9.3-release/tools/regression/fsx
/freebsd-9.3-release/tools/regression/lib/libc
/freebsd-9.3-release/tools/regression/netinet
/freebsd-9.3-release/tools/regression/pipe
/freebsd-9.3-release/tools/regression/security/cap_test
/freebsd-9.3-release/tools/regression/sockets
/freebsd-9.3-release/tools/regression/usr.sbin
/freebsd-9.3-release/tools/regression/usr.sbin/etcupdate
/freebsd-9.3-release/tools/test
/freebsd-9.3-release/tools/test/auxinfo
/freebsd-9.3-release/tools/test/pthread_vfork
/freebsd-9.3-release/tools/tools
/freebsd-9.3-release/tools/tools/ath
/freebsd-9.3-release/tools/tools/bootparttest
/freebsd-9.3-release/tools/tools/cxgbetool
/freebsd-9.3-release/tools/tools/ether_reflect
/freebsd-9.3-release/tools/tools/mcgrab
/freebsd-9.3-release/tools/tools/nanobsd
/freebsd-9.3-release/tools/tools/netmap
/freebsd-9.3-release/tools/tools/syscall_timing
/freebsd-9.3-release/tools/tools/sysdoc
/freebsd-9.3-release/tools/tools/umastat
/freebsd-9.3-release/tools/tools/vimage
/freebsd-9.3-release/tools/tools/zfsboottest
/freebsd-9.3-release/usr.bin
/freebsd-9.3-release/usr.bin/apply
/freebsd-9.3-release/usr.bin/ar
/freebsd-9.3-release/usr.bin/at
/freebsd-9.3-release/usr.bin/bc
/freebsd-9.3-release/usr.bin/bmake
/freebsd-9.3-release/usr.bin/brandelf
/freebsd-9.3-release/usr.bin/bsdiff
/freebsd-9.3-release/usr.bin/c89
/freebsd-9.3-release/usr.bin/c99
/freebsd-9.3-release/usr.bin/calendar
/freebsd-9.3-release/usr.bin/calendar/calendars
/freebsd-9.3-release/usr.bin/chpass
/freebsd-9.3-release/usr.bin/clang
/freebsd-9.3-release/usr.bin/comm
/freebsd-9.3-release/usr.bin/compress
/freebsd-9.3-release/usr.bin/cpio
/freebsd-9.3-release/usr.bin/csup
/freebsd-9.3-release/usr.bin/ctlstat
/freebsd-9.3-release/usr.bin/cut
/freebsd-9.3-release/usr.bin/dc
/freebsd-9.3-release/usr.bin/dig
/freebsd-9.3-release/usr.bin/du
/freebsd-9.3-release/usr.bin/ee
/freebsd-9.3-release/usr.bin/fetch
/freebsd-9.3-release/usr.bin/find
/freebsd-9.3-release/usr.bin/finger
/freebsd-9.3-release/usr.bin/fstat
/freebsd-9.3-release/usr.bin/gcore
/freebsd-9.3-release/usr.bin/gprof
/freebsd-9.3-release/usr.bin/grep
/freebsd-9.3-release/usr.bin/gzip
/freebsd-9.3-release/usr.bin/hexdump
/freebsd-9.3-release/usr.bin/host
/freebsd-9.3-release/usr.bin/indent
/freebsd-9.3-release/usr.bin/ipcrm
/freebsd-9.3-release/usr.bin/join
/freebsd-9.3-release/usr.bin/kdump
/freebsd-9.3-release/usr.bin/killall
/freebsd-9.3-release/usr.bin/ktrace
/freebsd-9.3-release/usr.bin/ktrdump
/freebsd-9.3-release/usr.bin/last
/freebsd-9.3-release/usr.bin/lastcomm
/freebsd-9.3-release/usr.bin/ldd
/freebsd-9.3-release/usr.bin/less
/freebsd-9.3-release/usr.bin/lex
/freebsd-9.3-release/usr.bin/limits
/freebsd-9.3-release/usr.bin/locale
/freebsd-9.3-release/usr.bin/lock
/freebsd-9.3-release/usr.bin/lockf
/freebsd-9.3-release/usr.bin/login
/freebsd-9.3-release/usr.bin/lsvfs
/freebsd-9.3-release/usr.bin/m4
/freebsd-9.3-release/usr.bin/mail
/freebsd-9.3-release/usr.bin/make
/freebsd-9.3-release/usr.bin/makewhatis
/freebsd-9.3-release/usr.bin/man
/freebsd-9.3-release/usr.bin/minigzip
/freebsd-9.3-release/usr.bin/ministat
/freebsd-9.3-release/usr.bin/mkcsmapper
/freebsd-9.3-release/usr.bin/mkesdb
/freebsd-9.3-release/usr.bin/mklocale
/freebsd-9.3-release/usr.bin/mktemp
/freebsd-9.3-release/usr.bin/msgs
/freebsd-9.3-release/usr.bin/mt
/freebsd-9.3-release/usr.bin/ncal
/freebsd-9.3-release/usr.bin/ncplist
/freebsd-9.3-release/usr.bin/ncplogin
/freebsd-9.3-release/usr.bin/netstat
/freebsd-9.3-release/usr.bin/newgrp
/freebsd-9.3-release/usr.bin/nfsstat
/freebsd-9.3-release/usr.bin/nslookup
/freebsd-9.3-release/usr.bin/passwd
/freebsd-9.3-release/usr.bin/pr
/freebsd-9.3-release/usr.bin/printf
/freebsd-9.3-release/usr.bin/procstat
/freebsd-9.3-release/usr.bin/protect
/freebsd-9.3-release/usr.bin/rctl
/freebsd-9.3-release/usr.bin/rlogin
/freebsd-9.3-release/usr.bin/rpcgen
/freebsd-9.3-release/usr.bin/rsh
/freebsd-9.3-release/usr.bin/rwho
/freebsd-9.3-release/usr.bin/script
/freebsd-9.3-release/usr.bin/sed
/freebsd-9.3-release/usr.bin/seq
/freebsd-9.3-release/usr.bin/sockstat
/freebsd-9.3-release/usr.bin/split
/freebsd-9.3-release/usr.bin/stat
/freebsd-9.3-release/usr.bin/stdbuf
/freebsd-9.3-release/usr.bin/su
/freebsd-9.3-release/usr.bin/systat
/freebsd-9.3-release/usr.bin/tail
/freebsd-9.3-release/usr.bin/talk
/freebsd-9.3-release/usr.bin/tar
/freebsd-9.3-release/usr.bin/tftp
/freebsd-9.3-release/usr.bin/top
/freebsd-9.3-release/usr.bin/touch
/freebsd-9.3-release/usr.bin/truss
/freebsd-9.3-release/usr.bin/unvis
/freebsd-9.3-release/usr.bin/unzip
/freebsd-9.3-release/usr.bin/usbhidaction
/freebsd-9.3-release/usr.bin/usbhidctl
/freebsd-9.3-release/usr.bin/users
/freebsd-9.3-release/usr.bin/uuencode
/freebsd-9.3-release/usr.bin/vacation
/freebsd-9.3-release/usr.bin/vis
/freebsd-9.3-release/usr.bin/vmstat
/freebsd-9.3-release/usr.bin/w
/freebsd-9.3-release/usr.bin/wall
/freebsd-9.3-release/usr.bin/who
/freebsd-9.3-release/usr.bin/whois
/freebsd-9.3-release/usr.bin/write
/freebsd-9.3-release/usr.bin/xinstall
/freebsd-9.3-release/usr.bin/xlint
/freebsd-9.3-release/usr.bin/yes
/freebsd-9.3-release/usr.sbin
/freebsd-9.3-release/usr.sbin/Makefile
/freebsd-9.3-release/usr.sbin/ac
/freebsd-9.3-release/usr.sbin/acpi/acpidump
/freebsd-9.3-release/usr.sbin/adduser
/freebsd-9.3-release/usr.sbin/amd
/freebsd-9.3-release/usr.sbin/ancontrol
/freebsd-9.3-release/usr.sbin/apmd
/freebsd-9.3-release/usr.sbin/arp
/freebsd-9.3-release/usr.sbin/authpf
/freebsd-9.3-release/usr.sbin/bluetooth/ath3kfw
/freebsd-9.3-release/usr.sbin/bluetooth/bthidd
/freebsd-9.3-release/usr.sbin/bluetooth/hccontrol
/freebsd-9.3-release/usr.sbin/bluetooth/sdpd
/freebsd-9.3-release/usr.sbin/boot0cfg
/freebsd-9.3-release/usr.sbin/bootparamd
/freebsd-9.3-release/usr.sbin/bsdconfig
/freebsd-9.3-release/usr.sbin/bsdinstall
/freebsd-9.3-release/usr.sbin/bsdinstall/scripts
/freebsd-9.3-release/usr.sbin/bsnmpd
/freebsd-9.3-release/usr.sbin/bsnmpd/modules/snmp_hostres
/freebsd-9.3-release/usr.sbin/bsnmpd/modules/snmp_wlan
/freebsd-9.3-release/usr.sbin/bsnmpd/tools/bsnmptools
/freebsd-9.3-release/usr.sbin/btxld
/freebsd-9.3-release/usr.sbin/burncd
/freebsd-9.3-release/usr.sbin/cdcontrol
/freebsd-9.3-release/usr.sbin/chkgrp
/freebsd-9.3-release/usr.sbin/config
/freebsd-9.3-release/usr.sbin/cpucontrol
/freebsd-9.3-release/usr.sbin/crashinfo
/freebsd-9.3-release/usr.sbin/cron
/freebsd-9.3-release/usr.sbin/cron/crontab
/freebsd-9.3-release/usr.sbin/crunch
/freebsd-9.3-release/usr.sbin/ctladm
/freebsd-9.3-release/usr.sbin/ctm/ctm_dequeue
/freebsd-9.3-release/usr.sbin/daemon
/freebsd-9.3-release/usr.sbin/diskinfo
/freebsd-9.3-release/usr.sbin/edquota
/freebsd-9.3-release/usr.sbin/etcupdate
/freebsd-9.3-release/usr.sbin/flowctl
/freebsd-9.3-release/usr.sbin/freebsd-update
/freebsd-9.3-release/usr.sbin/fwcontrol
/freebsd-9.3-release/usr.sbin/gpioctl
/freebsd-9.3-release/usr.sbin/gssd
/freebsd-9.3-release/usr.sbin/i2c
/freebsd-9.3-release/usr.sbin/ifmcstat
/freebsd-9.3-release/usr.sbin/inetd
/freebsd-9.3-release/usr.sbin/iostat
/freebsd-9.3-release/usr.sbin/ip6addrctl
/freebsd-9.3-release/usr.sbin/jail
/freebsd-9.3-release/usr.sbin/jls
/freebsd-9.3-release/usr.sbin/kbdcontrol
/freebsd-9.3-release/usr.sbin/kbdmap
/freebsd-9.3-release/usr.sbin/keyserv
/freebsd-9.3-release/usr.sbin/kgmon
/freebsd-9.3-release/usr.sbin/kldxref
/freebsd-9.3-release/usr.sbin/lpr
/freebsd-9.3-release/usr.sbin/lpr/filters
/freebsd-9.3-release/usr.sbin/lpr/lpd
/freebsd-9.3-release/usr.sbin/makefs
/freebsd-9.3-release/usr.sbin/memcontrol
/freebsd-9.3-release/usr.sbin/mergemaster
/freebsd-9.3-release/usr.sbin/mfiutil
/freebsd-9.3-release/usr.sbin/mixer
/freebsd-9.3-release/usr.sbin/mountd
/freebsd-9.3-release/usr.sbin/moused
/freebsd-9.3-release/usr.sbin/mptutil
/freebsd-9.3-release/usr.sbin/mtest
/freebsd-9.3-release/usr.sbin/mtree
/freebsd-9.3-release/usr.sbin/named
/freebsd-9.3-release/usr.sbin/ndiscvt
/freebsd-9.3-release/usr.sbin/ndp
/freebsd-9.3-release/usr.sbin/newsyslog
/freebsd-9.3-release/usr.sbin/nfscbd
/freebsd-9.3-release/usr.sbin/nfsd
/freebsd-9.3-release/usr.sbin/nmtree
/freebsd-9.3-release/usr.sbin/ntp
/freebsd-9.3-release/usr.sbin/pc-sysinstall
/freebsd-9.3-release/usr.sbin/pciconf
/freebsd-9.3-release/usr.sbin/pkg
/freebsd-9.3-release/usr.sbin/pkg_install
/freebsd-9.3-release/usr.sbin/pkg_install/add
/freebsd-9.3-release/usr.sbin/pkg_install/info
/freebsd-9.3-release/usr.sbin/pkg_install/updating
/freebsd-9.3-release/usr.sbin/pmcannotate
/freebsd-9.3-release/usr.sbin/pmccontrol
/freebsd-9.3-release/usr.sbin/pmcstat
/freebsd-9.3-release/usr.sbin/portsnap
/freebsd-9.3-release/usr.sbin/portsnap/portsnap
/freebsd-9.3-release/usr.sbin/powerd
/freebsd-9.3-release/usr.sbin/ppp
/freebsd-9.3-release/usr.sbin/pw
/freebsd-9.3-release/usr.sbin/pwd_mkdb
/freebsd-9.3-release/usr.sbin/rarpd
/freebsd-9.3-release/usr.sbin/route6d
/freebsd-9.3-release/usr.sbin/rpc.lockd
/freebsd-9.3-release/usr.sbin/rpc.statd
/freebsd-9.3-release/usr.sbin/rpc.yppasswdd
/freebsd-9.3-release/usr.sbin/rpc.ypupdated
/freebsd-9.3-release/usr.sbin/rpc.ypxfrd
/freebsd-9.3-release/usr.sbin/rrenumd
/freebsd-9.3-release/usr.sbin/rtadvctl
/freebsd-9.3-release/usr.sbin/rtadvd
/freebsd-9.3-release/usr.sbin/rtprio
/freebsd-9.3-release/usr.sbin/rtsold
/freebsd-9.3-release/usr.sbin/rwhod
/freebsd-9.3-release/usr.sbin/sa
/freebsd-9.3-release/usr.sbin/sade
/freebsd-9.3-release/usr.sbin/sendmail
/freebsd-9.3-release/usr.sbin/service
/freebsd-9.3-release/usr.sbin/services_mkdb
/freebsd-9.3-release/usr.sbin/setfib
/freebsd-9.3-release/usr.sbin/smbmsg
/freebsd-9.3-release/usr.sbin/syslogd
/freebsd-9.3-release/usr.sbin/sysrc
/freebsd-9.3-release/usr.sbin/tcpdrop
/freebsd-9.3-release/usr.sbin/tcpdump
/freebsd-9.3-release/usr.sbin/timed
/freebsd-9.3-release/usr.sbin/timed/timed
/freebsd-9.3-release/usr.sbin/traceroute6
/freebsd-9.3-release/usr.sbin/tzsetup
/freebsd-9.3-release/usr.sbin/uhsoctl
/freebsd-9.3-release/usr.sbin/usbdump
/freebsd-9.3-release/usr.sbin/utxrm
/freebsd-9.3-release/usr.sbin/vidcontrol
/freebsd-9.3-release/usr.sbin/vipw
/freebsd-9.3-release/usr.sbin/wake
/freebsd-9.3-release/usr.sbin/watch
/freebsd-9.3-release/usr.sbin/watchdogd
/freebsd-9.3-release/usr.sbin/wlandebug
/freebsd-9.3-release/usr.sbin/wpa
/freebsd-9.3-release/usr.sbin/wpa/hostapd
/freebsd-9.3-release/usr.sbin/wpa/wpa_supplicant
/freebsd-9.3-release/usr.sbin/yp_mkdb
/freebsd-9.3-release/usr.sbin/ypbind
/freebsd-9.3-release/usr.sbin/yppush
/freebsd-9.3-release/usr.sbin/ypserv
/freebsd-9.3-release/usr.sbin/zic
267654 20-Jun-2014 gjb

Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


262221 19-Feb-2014 jhb

MFC 250691:
Return one-based key so that user can check if the key is ever allocated
in the first place.


261637 08-Feb-2014 kib

MFC r261354:
In _pthread_kill(), if passed pthread is current thread, do not send
the signal second time, by adding the missed else before if statement.

PR: threads/186309


258767 30-Nov-2013 kib

MFC r258499:
Fix for the spurious signal handler call with zero signo in the threaded
process.


254398 16-Aug-2013 davidxu

MFC r239347, 240295, 240296 and 253325:

r239347 | davidxu | 2012-08-17 10:26:31 +0800 (Fri, 17 Aug 2012) | 7 lines

Implement syscall clock_getcpuclockid2, so we can get a clock id
for process, thread or others we want to support.
Use the syscall to implement POSIX API clock_getcpuclock and
pthread_getcpuclockid.

PR: 168417

------------------------------------------------------------------------
r240295 | davidxu | 2012-09-10 13:00:29 +0800 (Mon, 10 Sep 2012) | 2 lines

Add missing prototype for clock_getcpuclockid.

------------------------------------------------------------------------
r240296 | davidxu | 2012-09-10 13:09:39 +0800 (Mon, 10 Sep 2012) | 2 lines

Process CPU-Time Clocks option is supported, define _POSIX_CPUTIME.

------------------------------------------------------------------------
r253325 | kib | 2013-07-14 03:32:50 +0800 (Sun, 14 Jul 2013) | 6 lines

Allow to call clock_gettime() on the clock id for zombie process.

Reported by: Petr Salinger <Petr.Salinger@seznam.cz>
PR: threads/180496
Sponsored by: The FreeBSD Foundation


252245 26-Jun-2013 kib

MFC r251985:
When enabling the cancellation, only process the pending cancellation
for asynchronous mode.


251834 17-Jun-2013 kib

MFC r251284:
Unify the code of check_deferred_signal() for all architectures.


251833 17-Jun-2013 kib

MFC r250013 (by davidxu):
Remove extra code for SA_RESETHAND, it is not needed because kernel has
already done this.

Approved by: davidxu


251365 04-Jun-2013 kib

MFC r251047:
Avoid a nested frame for getcontext() call in check_deferred_signal().


251291 03-Jun-2013 kib

MFC r251040:
Partially apply the capitalization of the heading word of the sequence
and fix typo.


238714 23-Jul-2012 davidxu

Merge r238637,r238640,r238641,r238642:

------------------------------------------------------------------------
r238637 | davidxu | 2012-07-20 09:56:14 +0800 (Fri, 20 Jul 2012) | 6 lines

Don't forget to release a thread reference count,
replace _thr_ref_add() with _thr_find_thread(),
so reference count is no longer needed.

------------------------------------------------------------------------
r238640 | davidxu | 2012-07-20 11:00:41 +0800 (Fri, 20 Jul 2012) | 2 lines

Eliminate duplicated code.

------------------------------------------------------------------------
r238641 | davidxu | 2012-07-20 11:16:52 +0800 (Fri, 20 Jul 2012) | 2 lines

Eliminate duplicated code.

------------------------------------------------------------------------
r238642 | davidxu | 2012-07-20 11:22:17 +0800 (Fri, 20 Jul 2012) | 2 lines

Don't assign same value.

Approved by: re (kib)


237455 22-Jun-2012 gnn

MFC: 234424

Set SIGCANCEL to SIGTHR as part of some cleanup of DTrace code.

Reviewed by: davidxu@


237397 21-Jun-2012 marius

MFC: r231619

Add thread-local storage support for arm:

- Switch to Variant I TCB layout
- Use function from rtld for TCB allocation/deallocation


236275 30-May-2012 davidxu

MFC r236135:

Return EBUSY for PTHREAD_MUTEX_ADAPTIVE_NP too when the mutex could not
be acquired.

PR: 168317


234372 17-Apr-2012 davidxu

Merge 233103, 233912 from head:

233103:
Some software think a mutex can be destroyed after it owned it, for
example, it uses a serialization point like following:
pthread_mutex_lock(&mutex);
pthread_mutex_unlock(&mutex);
pthread_mutex_destroy(&muetx);
They think a previous lock holder should have already left the mutex and
is no longer referencing it, so they destroy it. To be maximum compatible
with such code, we use IA64 version to unlock the mutex in kernel, remove
the two steps unlocking code.

233912:
umtx operation UMTX_OP_MUTEX_WAKE has a side-effect that it accesses
a mutex after a thread has unlocked it, it event writes data to the mutex
memory to clear contention bit, there is a race that other threads
can lock it and unlock it, then destroy it, so it should not write
data to the mutex memory if there isn't any waiter.
The new operation UMTX_OP_MUTEX_WAKE2 try to fix the problem. It
requires thread library to clear the lock word entirely, then
call the WAKE2 operation to check if there is any waiter in kernel,
and try to wake up a thread, if necessary, the contention bit is set again
by the operation. This also mitgates the chance that other threads find
the contention bit and try to enter kernel to compete with each other
to wake up sleeping thread, this is unnecessary. With this change, the
mutex owner is no longer holding the mutex until it reaches a point
where kernel umtx queue is locked, it releases the mutex as soon as
possible.
Performance is improved when the mutex is contensted heavily. On Intel
i3-2310M, the runtime of a benchmark program is reduced from 26.87 seconds
to 2.39 seconds, it even is better than UMTX_OP_MUTEX_WAKE which is
deprecated now. http://people.freebsd.org/~davidxu/bench/mutex_perf.c

Special code for stable/9:
And add code to detect if the UMTX_OP_MUTEX_WAKE2 is available.


234073 09-Apr-2012 jilles

MFC r233516: libthr: In the atfork handlers for signals, do not skip the
last signal.

_SIG_MAXSIG works a bit unexpectedly: signals 1 till _SIG_MAXSIG are valid,
both bounds inclusive.


231996 22-Feb-2012 davidxu

MFC 231906:

Check both seconds and nanoseconds are zero, only checking nanoseconds
is zero may trigger timeout too early. It seems a copy&paste bug.


231983 21-Feb-2012 kib

MFC r230430:
Use getcontextx(3) internal API instead of getcontext(2) to provide
the signal handlers with the context information in the deferrred
case.


231635 14-Feb-2012 davidxu

MFC 231106:
Plug a memory leak. When a cached thread is reused, don't clear sleep
queue pointers, just reuse it.

MFC 231503:
Make code more stable by checking NULL pointers.


229047 30-Dec-2011 dim

MFC r228536:

The TCB_GET32() and TCB_GET64() macros in the i386 and amd64-specific
versions of pthread_md.h have a special case of dereferencing a null
pointer. Clang warns about this with:

In file included from lib/libthr/arch/i386/i386/pthread_md.c:36:
lib/libthr/arch/i386/include/pthread_md.h:96:10: error: indirection of non-volatile null pointer will be deleted, not trap [-Werror,-Wnull-dereference]
return (TCB_GET32(tcb_self));
^~~~~~~~~~~~~~~~~~~
lib/libthr/arch/i386/include/pthread_md.h:73:13: note: expanded from:
: "m" (*(u_int *)(__tcb_offset(name)))); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/libthr/arch/i386/include/pthread_md.h:96:10: note: consider using __builtin_trap() or qualifying pointer with 'volatile'

Since this indirection is done relative to the fs or gs segment, to
retrieve thread-specific data, it is an exception to the rule.

Therefore, add a volatile qualifier to tell the compiler we really want
to dereference a zero address.


227853 23-Nov-2011 davidxu

MFC r227604:
Pass CVWAIT flags to kernel, this should handle
Timeout correctly for pthread_cond_timedwait when
it uses kernel-based condition variable.

Approved by: re (kib)


225736 23-Sep-2011 kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by: re (implicit)


223294 19-Jun-2011 kan

Do not set thread name to less than informative 'initial thread'.


223228 18-Jun-2011 marius

Merge from r161730:
o Set TP using inline assembly to avoid dead code elimination.
o Eliminate _tcb.

Merge from r161840:
Stylize: avoid using a global register variable.

Merge from r157461:
Simplify _get_curthread() and _tcb_ctor because libc and rtld now
already allocate thread pointer space in tls block for initial thread.

Merge from r177853:
Replace function _umtx_op with _umtx_op_err, the later function directly
returns errno, because errno can be mucked by user's signal handler and
most of pthread api heavily depends on errno to be correct, this change
should improve stability of the thread library.

MFC after: 1 week


220888 20-Apr-2011 rstone

r179417 introduced a bug into pthread_once(). Previously pthread_once()
used a global pthread_mutex_t for synchronization. r179417 replaced that
with an implementation that directly used atomic instructions and thr_*
syscalls to synchronize callers to pthread_once. However, calling
pthread_mutex_lock on the global mutex implicitly ensured that
_thr_check_init() had been called but with r179417 this was no longer
guaranteed. This meant that if you were unlucky enough to have your first
call into libthr be a call to pthread_once(), you would segfault when
trying to access the pointer returned by _get_curthread().

The fix is to explicitly call _thr_check_init() from pthread_once().

Reviewed by: davidxu
Approved by: emaste (mentor)
MFC after: 1 week


218414 07-Feb-2011 jkim

Introduce a non-portable function pthread_getthreadid_np(3) to retrieve
calling thread's unique integral ID, which is similar to AIX function of
the same name. Bump __FreeBSD_version to note its introduction.

Reviewed by: kib


217253 11-Jan-2011 davidxu

Fix a typo.

Submitted by: avg


217224 10-Jan-2011 kib

For the process that already loaded libthr but still not initialized
threading, fall back to libc method of performing
__pthread_map_stacks_exec() job.

Reported and tested by: Mykola Dzham <i levsha me>


217191 09-Jan-2011 kib

Implement the __pthread_map_stacks_exec() for libthr.

Stack creation code is changed to call _rtld_get_stack_prot() to get
the stack protection right. There is a race where thread is created
during dlopen() of dso that requires executable stacks. Then,
_rtld_get_stack_prot() may return PROT_READ | PROT_WRITE, but thread
is still not linked into the thread list. In this case, the callback
misses the thread stack, and rechecks the required protection
afterward.

Reviewed by: davidxu


217107 07-Jan-2011 kib

Add section .note.GNU-stack for assembly files used by 386 and amd64.


217047 06-Jan-2011 davidxu

Return 0 instead of garbage value.

Found by: clang static analyzer


216949 04-Jan-2011 davidxu

Because sleepqueue may still being used, we should always check wchan with
queue locked.


216687 24-Dec-2010 davidxu

Always clear flag PMUTEX_FLAG_DEFERED when unlocking, as it is only
significant for lock owner.


216642 22-Dec-2010 davidxu

Add sleep queue code.


216641 22-Dec-2010 davidxu

MFp4:

- Add flags CVWAIT_ABSTIME and CVWAIT_CLOCKID for umtx kernel based
condition variable, this should eliminate an extra system call to get
current time.

- Add sub-function UMTX_OP_NWAKE_PRIVATE to wake up N channels in single
system call. Create userland sleep queue for condition variable, in most
cases, thread will wait in the queue, the pthread_cond_signal will defer
thread wakeup until the mutex is unlocked, it tries to avoid an extra
system call and a extra context switch in time window of pthread_cond_signal
and pthread_mutex_unlock.

The changes are part of process-shared mutex project.


214653 02-Nov-2010 davidxu

Use sysctl kern.sched.cpusetsize to retrieve size of kernel cpuset.


214506 29-Oct-2010 davidxu

Return previous sigaction correctly.

Submitted by: avg


214500 29-Oct-2010 davidxu

Remove local variable 'first', instead check signal number in memory,
because the variable can be in register, second checking the variable
may still return true, however this is unexpected.


214413 27-Oct-2010 davidxu

Check small set and reject it, this is how kernel did. Always use the
size kernel is using.


214412 27-Oct-2010 davidxu

- Revert r214409.
- Use long word to figure out sizeof kernel cpuset, hope it works.


214410 27-Oct-2010 davidxu

Remove locking and unlock in pthread_mutex_destroy, because
it can not fix race condition in application code, as a result,
the problem described in PR threads/151767 is avoided.


214335 25-Oct-2010 davidxu

Fix typo.


214334 25-Oct-2010 davidxu

Get cpuset in pthread_attr_get_np() and free it in pthread_attr_destroy().

MFC after: 7 days


214093 20-Oct-2010 davidxu

Revert revision 214007, I realized that MySQL wants to resolve
a silly rwlock deadlock problem, the deadlock is caused by writer
waiters, if a thread has already locked a reader lock, and wants to
acquire another reader lock, it will be blocked by writer waiters,
but we had already fixed it years ago.


214046 18-Oct-2010 davidxu

Set default type to PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, this
is the type we are using.


214009 18-Oct-2010 davidxu

sort function name.


214008 18-Oct-2010 davidxu

s/||/&&


214007 18-Oct-2010 davidxu

Add pthread_rwlockattr_setkind_np and pthread_rwlockattr_getkind_np, the
functions set or get pthread_rwlock type, current supported types are:
PTHREAD_RWLOCK_PREFER_READER_NP,
PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,
PTHREAD_RWLOCK_PREFER_WRITER_NP,
default is PTHREAD_RWLOCK_PREFER_WRITER_NONCECURSIVE_NP, this maintains
binary compatible with old code.


213541 08-Oct-2010 davidxu

Oops, don't remove -fexceptions flag.


213539 08-Oct-2010 davidxu

unwind.h was imported, gcc directory is no longer needed.


213297 30-Sep-2010 davidxu

change code to use unwind.h.


213257 29-Sep-2010 davidxu

Check invalid mutex in _mutex_cv_unlock.


213241 28-Sep-2010 davidxu

In current code, statically initialized and destroyed object have
same null value, the code can not distinguish between them, to
fix the problem, now a destroyed object is assigned to a non-null
value, and it will be rejected by some pthread functions.
PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP is changed to number 1, so that
adaptive mutex can be statically initialized correctly.


213182 26-Sep-2010 davidxu

Report death event to debugger before moving to gc list, otherwise
debugger may can not find it on thread list.


213163 25-Sep-2010 davidxu

Only access unwind_disabled when _PTHREAD_FORCED_UNWIND is defined.


213161 25-Sep-2010 davidxu

Add missing field.


213159 25-Sep-2010 davidxu

Because old _pthread_cleanup_push/pop do not have frame address,
it is incompatible with stack unwinding code, if they are invoked,
disable stack unwinding for current thread, and when thread is
exiting, print a warning message.


213154 25-Sep-2010 davidxu

Simplify code, and in while loop, fix operator to match the unwinding
direction.


213153 25-Sep-2010 davidxu

To support stack unwinding for cancellation points, add -fexceptions flag
for them, two functions _pthread_cancel_enter and _pthread_cancel_leave
are added to let thread enter and leave a cancellation point, it also
makes it possible that other functions can be cancellation points in
libraries without having to be rewritten in libthr.


213100 24-Sep-2010 davidxu

inline testcancel() into thr_cancel_leave(), because cancel_pending is
almost false, this makes a slight better branch predicting.


213096 24-Sep-2010 davidxu

In most cases, cancel_point and cancel_async needn't be checked again,
because cancellation is almostly checked at cancellation points.


212952 21-Sep-2010 davidxu

If we are at cancellation point, always work as deferred mode despite
whether asynchronous mode is turned on or not, this always gives us a
chance to decide whether thread should be canceled or not in
cancellation points.


212841 19-Sep-2010 davidxu

Because atfork lock is held while forking, a thread cancellation triggered
by atfork handler is unsafe, use intenal flag no_cancel to disable it.


212840 19-Sep-2010 davidxu

Fix typo.


212838 19-Sep-2010 davidxu

- _Unwind_Resume function is not used, remove it.
- Use a store barrier to make sure uwl_forcedunwind is lastest thing
other threads can see.
- Add some comments.


212837 19-Sep-2010 davidxu

Fix a race condition when finding stack unwinding functions.


212630 15-Sep-2010 davidxu

add code to support stack unwinding when thread exits. note that only
defer-mode cancellation works, asynchrnous mode does not work because
it lacks of libuwind's support. stack unwinding is not enabled unless
LIBTHR_UNWIND_STACK is defined in Makefile.


212629 15-Sep-2010 davidxu

Move back IN_GCLIST flag into field tlflags, since thread list and gc list
still share same lock.


212552 13-Sep-2010 davidxu

Don't compare thread pointers again.


212551 13-Sep-2010 davidxu

Fix copy&paste problem.


212548 13-Sep-2010 davidxu

Update symbol.


212539 13-Sep-2010 davidxu

PS_DEAD state needs not be checked because _thr_find_thread() has already
checked it.


212536 13-Sep-2010 davidxu

Convert thread list lock from mutex to rwlock.


212516 13-Sep-2010 imp

Merge from tbemd, with a small amount of rework:
For all libthr contexts, use ${MACHINE_CPUARCH}
for all libc contexts, use ${MACHINE_ARCH} if it exists, otherwise use
${MACHINE_CPUARCH}
Move some common code up a layer (the .PATH statement was the same in
all the arch submakefiles).

# Hope she hasn't busted powerpc64 with this...


212405 10-Sep-2010 davidxu

Because POSIX does not allow EINTR to be returned from sigwait(),
add a wrapper for it in libc and rework the code in libthr, the
system call still can return EINTR, we keep this feature.

Discussed on: thread
Reviewed by: jilles


212312 08-Sep-2010 davidxu

To avoid possible race condition, SIGCANCEL is always sent except the
thread is dead.


212245 06-Sep-2010 davidxu

Fix off-by-one error in function _thr_sigact_unload, also disable the
function, it seems some gnome application tends to crash if we
unregister sigaction automatically.


212095 01-Sep-2010 davidxu

Remove incorrect comments, also make sure signal is
disabled when unregistering sigaction.


212083 01-Sep-2010 davidxu

In function __pthread_cxa_finalize(), also make code for removing
atfork handler be async-signal safe.


212078 01-Sep-2010 davidxu

pthread_atfork should acquire writer lock and protect the code
with critical region.


212077 01-Sep-2010 davidxu

Change atfork lock from mutex to rwlock, also make mutexes used by malloc()
module private type, when private type mutex is locked/unlocked, thread
critical region is entered or leaved. These changes makes fork()
async-signal safe which required by POSIX. Note that user's atfork handler
still needs to be async-signal safe, but it is not problem of libthr, it
is user's responsiblity.


212076 01-Sep-2010 davidxu

Add signal handler wrapper, the reason to add it becauses there are
some cases we want to improve:
1) if a thread signal got a signal while in cancellation point,
it is possible the TDP_WAKEUP may be eaten by signal handler
if the handler called some interruptibly system calls.
2) In signal handler, we want to disable cancellation.
3) When thread holding some low level locks, it is better to
disable signal, those code need not to worry reentrancy,
sigprocmask system call is avoided because it is a bit expensive.
The signal handler wrapper works in this way:
1) libthr installs its signal handler if user code invokes sigaction
to install its handler, the user handler is recorded in internal
array.
2) when a signal is delivered, libthr's signal handler is invoke,
libthr checks if thread holds some low level lock or is in critical
region, if it is true, the signal is buffered, and all signals are
masked, once the thread leaves critical region, correct signal
mask is restored and buffered signal is processed.
3) before user signal handler is invoked, cancellation is temporarily
disabled, after user signal handler is returned, cancellation state
is restored, and pending cancellation is rescheduled.


211860 27-Aug-2010 davidxu

Unregister thread specific data destructor when a corresponding dso
is unloaded.


211859 27-Aug-2010 davidxu

clear lock to zero state if it is destroyed.


211836 26-Aug-2010 davidxu

eliminate unused code.


211833 26-Aug-2010 davidxu

Decrease rdlock count only when thread unlocked a reader lock.

MFC after: 3 days


211773 24-Aug-2010 nwhitehorn

Unify 32-bit and 64-bit PowerPC libthr support. This reduces code
duplication, and simplifies the TBEMD import.

Requested by: imp


211743 24-Aug-2010 kib

Remove unused source.

MFC after: 2 weeks


211742 24-Aug-2010 kib

The __hidden definition is provided by sys/cdefs.h.

MFC after: 2 weeks


211737 24-Aug-2010 davidxu

Add wrapper for setcontext() and swapcontext(), the wrappers
unblock SIGCANCEL which is needed by thread cancellation.


211706 23-Aug-2010 kib

On shared object unload, in __cxa_finalize, call and clear all installed
atexit and __cxa_atexit handlers that are either installed by unloaded
dso, or points to the functions provided by the dso.

Use _rtld_addr_phdr to locate segment information from the address of
private variable belonging to the dso, supplied by crtstuff.c. Provide
utility function __elf_phdr_match_addr to do the match of address against
dso executable segment.

Call back into libthr from __cxa_finalize using weak
__pthread_cxa_finalize symbol to remove any atfork handler which
function points into unloaded object.

The rtld needs private __pthread_cxa_finalize symbol to not require
resolution of the weak undefined symbol at initialization time. This
cannot work, since rtld is relocated before sym_zero is set up.

Idea by: kan
Reviewed by: kan (previous version)
MFC after: 3 weeks


211526 20-Aug-2010 davidxu

Reduce redundant code.

Submitted by: kib


211524 20-Aug-2010 davidxu

In current implementation, thread cancellation is done in signal handler,
which does not know what is the state of interrupted system call, for
example, open() system call opened a file and the thread is still cancelled,
result is descriptor leak, there are other problems which can cause resource
leak or undeterminable side effect when a thread is cancelled. However, this
is no longer true in new implementation.

In defering mode, a thread is canceled if cancellation request is pending and
later the thread enters a cancellation point, otherwise, a later
pthread_cancel() just causes SIGCANCEL to be sent to the target thread, and
causes target thread to abort system call, userland code in libthr then checks
cancellation state, and cancels the thread if needed. For example, the
cancellation point open(), the thread may be canceled at start,
but later, if it opened a file descriptor, it is not canceled, this avoids
file handle leak. Another example is read(), a thread may be canceled at start
of the function, but later, if it read some bytes from a socket, the thread
is not canceled, the caller then can decide if it should still enable cancelling
or disable it and continue reading data until it thinks it has read all
bytes of a packet, and keeps a protocol stream in health state, if user ignores
partly reading of a packet without disabling cancellation, then second iteration
of read loop cause the thread to be cancelled.
An exception is that the close() cancellation point always closes a file handle
despite whether the thread is cancelled or not.

The old mechanism is still kept, for a functions which is not so easily to
fix a cancellation problem, the rough mechanism is used.

Reviewed by: kib@


211522 20-Aug-2010 davidxu

According to specification, function fcntl() is a cancellation point only
when cmd argument is F_SETLKW.


211409 17-Aug-2010 davidxu

Tweak code a bit to be POSIX compatible, when a cancellation request
is acted upon, or when a thread calls pthread_exit(), the thread first
disables cancellation by setting its cancelability state to
PTHREAD_CANCEL_DISABLE and its cancelability type to
PTHREAD_CANCEL_DEFERRED. The cancelability state remains set to
PTHREAD_CANCEL_DISABLE until the thread has terminated.

It has no effect if a cancellation cleanup handler or thread-specific
data destructor routine changes the cancelability state to
PTHREAD_CANCEL_ENABLE.


209933 12-Jul-2010 kib

Use _SIG_VALID instead of expanded form of the macro.

Submitted by: Garrett Cooper <yanegomi gmail com>
MFC after: 1 week


209893 11-Jul-2010 nwhitehorn

Fix SVN mismerge. We somehow ended up with the 32-bit powerpc version
in arch/powerpc64 instead of the 64-bit one.


209880 10-Jul-2010 nwhitehorn

Powerpc64 thread libraries support.


208503 24-May-2010 deischen

Coalesce one more broken line.


208502 24-May-2010 deischen

Coalesce a couple of broken lines since they can fit within 80
characters. Little nit found while looking at a bug report.


206622 14-Apr-2010 uqs

mdoc: order prologue macros consistently by Dd/Dt/Os

Although groff_mdoc(7) gives another impression, this is the ordering
most widely used and also required by mdocml/mandoc.

Reviewed by: ru
Approved by: philip, ed (mentors)


201864 09-Jan-2010 imp

Merge r195129 from project/mips to head by hand:

r195129 | gonzo | 2009-06-27 17:28:56 -0600 (Sat, 27 Jun 2009) | 2 lines
- Use sysarch(2) in MIPS version of _tcb_set/_tcb_get


201565 05-Jan-2010 davidxu

remove file thr_sem_new.c.


201559 05-Jan-2010 davidxu

Remove extra new semaphore stubs, because libc already has them, and
ld can find the newest version which is default.

Poked by: kan@


201546 05-Jan-2010 davidxu

Use umtx to implement process sharable semaphore, to make this work,
now type sema_t is a structure which can be put in a shared memory area,
and multiple processes can operate it concurrently.
User can either use mmap(MAP_SHARED) + sem_init(pshared=1) or use sem_open()
to initialize a shared semaphore.
Named semaphore uses file system and is located in /tmp directory, and its
file name is prefixed with 'SEMD', so now it is chroot or jail friendly.
In simplist cases, both for named and un-named semaphore, userland code
does not have to enter kernel to reduce/increase semaphore's count.
The semaphore is designed to be crash-safe, it means even if an application
is crashed in the middle of operating semaphore, the semaphore state is
still safely recovered by later use, there is no waiter counter maintained
by userland code.
The main semaphore code is in libc and libthr only has some necessary stubs,
this makes it possible that a non-threaded application can use semaphore
without linking to thread library.
Old semaphore implementation is kept libc to maintain binary compatibility.
The kernel ksem API is no longer used in the new implemenation.

Discussed on: threads@


200498 14-Dec-2009 marcel

Work-around a race condition on ia64 while unlocking a contested lock.
The race condition is believed to be in UMTX_OP_MUTEX_WAKE. On ia64,
we simply go to the kernel to unlock.
The big question is why this is only a race condition on ia64...

MFC after: 3 days


199878 28-Nov-2009 kib

Revert r199830 for now. Too many ports dlopen() libraries linked with
libthr, but forgot to link main binary with it.


199830 26-Nov-2009 kib

Libthr cannot be dynamically loaded into the running process.
Mark it with -z nodlopen for now.

Discussed with: jhb, kan
MFC after: 3 weeks


198508 27-Oct-2009 kib

Current pselect(3) is implemented in usermode and thus vulnerable to
well-known race condition, which elimination was the reason for the
function appearance in first place. If sigmask supplied as argument to
pselect() enables a signal, the signal might be delivered before thread
called select(2), causing lost wakeup. Reimplement pselect() in kernel,
making change of sigmask and sleep atomic.

Since signal shall be delivered to the usermode, but sigmask restored,
set TDP_OLDMASK and save old mask in td_oldsigmask. The TDP_OLDMASK
should be cleared by ast() in case signal was not gelivered during
syscall execution.

Reviewed by: davidxu
Tested by: pho
MFC after: 1 month


198450 24-Oct-2009 marcel

Implement _umtx_op_err() for ia64.


197968 11-Oct-2009 jilles

Make openat(2) a cancellation point.

This is required by POSIX and matches open(2).

Reviewed by: kib, jhb
MFC after: 1 month


197477 25-Sep-2009 davidxu

don't report error if key was deleted.

PR: threads/135462


197445 23-Sep-2009 attilio

rwlock implemented from libthr need to fall through the 'hard path' and
query umtx also if the shared waiters bit is set on a shared lock.
The writer starvation avoidance technique, infact, can lead to shared
waiters on a shared lock which can bring to a missed wakeup and thus
to a deadlock if the right bit is not checked (a notable case is the
writers counterpart to be handled through expired timeouts).

Fix that by checking for the shared waiters bit also when unlocking the
shared locks.

That bug was causing a reported MySQL deadlock.
Many thanks go to Nick Esborn and his employer DesertNet which provided
time and machines to identify and fix this issue.

PR: thread/135673
Reported by: Nick Esborn <nick at desert dot net>
Tested by: Nick Esborn <nick at desert dot net>
Reviewed by: jeff


195403 06-Jul-2009 attilio

In the current code, rdlock_count is not correctly handled for some cases.
The most notable is that it is not bumped in rwlock_rdlock_common() when
the hard path (__thr_rwlock_rdlock()) returns successfully.
This can lead to deadlocks in libthr when rwlocks recursion in read mode
happens.
Fix the interested parts by correctly handling rdlock_count.

PR: threads/136345
Reported by: rink
Tested by: rink
Reviewed by: jeff
Approved by: re (kib)
MFC: 2 weeks


191993 11-May-2009 green

These are some cosmetic changes to improve the clarity of libthr's fork implementation.


191291 19-Apr-2009 rwatson

Now that the kernel defines CACHE_LINE_SIZE in machine/param.h, use
that definition in the custom locking code for the run-time linker
rather than local definitions.

Pointed out by: tinderbox
MFC after: 2 weeks


190585 31-Mar-2009 davidxu

Turn on nodelete linker flag because libthr can not be unloaded safely,
it does hook on to libc.


190025 19-Mar-2009 kib

Forcibly unlock the malloc() locks in the child process after fork(),
by temporary pretending that the process is still multithreaded.
Current malloc lock primitives do nothing for singlethreaded process.

Reviewed by: davidxu, deischen


189553 09-Mar-2009 davidxu

Don't ignore other fcntl functions, directly call __sys_fcntl if
WITHOUT_SYSCALL_COMPAT is not defined.

Reviewed by: deischen


189549 09-Mar-2009 davidxu

Don't reference non-existent __fcntl_compat if WITHOUT_SYSCALL_COMPAT is defined.

Submitted by: Pawel Worach "pawel dot worach at gmail dot com"


188997 24-Feb-2009 ru

With only one threading library, simplify the logic of setting SHLIBDIR.


188895 21-Feb-2009 ru

Fix build when WITH_SSP is set explicitly.

Submitted by: Jeremie Le Hen


188583 13-Feb-2009 jkim

Honor WITHOUT_INSTALLLIB in some places.


185728 07-Dec-2008 peter

When libthr and rtld start up, there are a number of magic spells cast
in order to get the symbol binding state "just so". This is to allow
locking to be activated and not run into recursion problems later.

However, one of the magic bits involves an explicit call to _umtx_op()
to force symbol resolution. It does a wakeup operation on a fake,
uninitialized (ie: random contents) umtx. Since libthr isn't active, this
is harmless. Nothing can match the random wakeup.

However, valgrind finds this and is not amused. Normally I'd just
write a suppression record for it, but the idea of passing random
args to syscalls (on purpose) just doesn't feel right.


185558 02-Dec-2008 kib

Provide custom simple allocator for rtld locks in libthr. The allocator
does not use any external symbols, thus avoiding possible recursion into
rtld to resolve symbols, when called.

Reviewed by: kan, davidxu
Tested by: rink
MFC after: 1 month


185531 01-Dec-2008 kan

Invoke _rtld_atfork_post earlier, before we reinitialize rtld locks
by switching into single-thread mode.

libthr ignores broken use of lock bitmaps used by default rtld locking
implementation, this in turn turns lock handoff in _rtld_thread_init
into NOP. This in turn makes child processes of forked multi-threaded
programs to run with _thr_signal_block still in effect, with most
signals blocked.

Reported by: phk, kib


185456 29-Nov-2008 kib

Unlock the malloc() locks in the child process after fork(). This gives
us working malloc in the fork child of the multithreaded process.

Although POSIX requires that only async-signal safe functions shall be
operable after fork in multithreaded process, not having malloc lower
the quality of our implementation.

Tested by: rink
Discussed with: kan, davidxu
Reviewed by: kan
MFC after: 1 month


185369 27-Nov-2008 kib

Add two rtld exported symbols, _rtld_atfork_pre and _rtld_atfork_post.
Threading library calls _pre before the fork, allowing the rtld to
lock itself to ensure that other threads of the process are out of
dynamic linker. _post releases the locks.

This allows the rtld to have consistent state in the child. Although
child may legitimately call only async-safe functions, the call may
need plt relocation resolution, and this requires working rtld.

Reported and debugging help by: rink
Reviewed by: kan, davidxu
MFC after: 1 month (anyway, not before 7.1 is out)


183021 14-Sep-2008 marcel

Allow psaddr_t to be widened by using thr_pread_{int,long,ptr},
where critical. Some places still use ps_pread/ps_pwrite directly,
but only need changed when byte-order comes into the picture.
Also, change th_p in td_event_msg_t from a pointer type to
psaddr_t, so that events also work when psaddr_t is widened.


182894 09-Sep-2008 jasone

Move call to _malloc_thread_cleanup() so that if this is the last thread,
the call never happens. This is necessary because malloc may be used
during exit handler processing.

Submitted by: davidxu


182225 27-Aug-2008 jasone

Add thread-specific caching for small size classes, based on magazines.
This caching allows for completely lock-free allocation/deallocation in the
steady state, at the expense of likely increased memory use and
fragmentation.

Reduce the default number of arenas to 2*ncpus, since thread-specific
caching typically reduces arena contention.

Modify size class spacing to include ranges of 2^n-spaced, quantum-spaced,
cacheline-spaced, and subpage-spaced size classes. The advantages are:
fewer size classes, reduced false cacheline sharing, and reduced internal
fragmentation for allocations that are slightly over 512, 1024, etc.

Increase RUN_MAX_SMALL, in order to limit fragmentation for the
subpage-spaced size classes.

Add a size-->bin lookup table for small sizes to simplify translating sizes
to size classes. Include a hard-coded constant table that is used unless
custom size class spacing is specified at run time.

Add the ability to disable tiny size classes at compile time via
MALLOC_TINY.


181099 01-Aug-2008 davidxu

In function pthread_condattr_getpshared, store result correctly.

PR: kern/126128


180012 25-Jun-2008 ru

Enable GCC stack protection (aka Propolice) for userland:
- It is opt-out for now so as to give it maximum testing, but it may be
turned opt-in for stable branches depending on the consensus. You
can turn it off with WITHOUT_SSP.
- WITHOUT_SSP was previously used to disable the build of GNU libssp.
It is harmless to steal the knob as SSP symbols have been provided
by libc for a long time, GNU libssp should not have been much used.
- SSP is disabled in a few corners such as system bootstrap programs
(sys/boot), process bootstrap code (rtld, csu) and SSP symbols themselves.
- It should be safe to use -fstack-protector-all to build world, however
libc will be automatically downgraded to -fstack-protector because it
breaks rtld otherwise.
- This option is unavailable on ia64.

Enable GCC stack protection (aka Propolice) for kernel:
- It is opt-out for now so as to give it maximum testing.
- Do not compile your kernel with -fstack-protector-all, it won't work.

Submitted by: Jeremie Le Hen <jeremie@le-hen.org>


179970 24-Jun-2008 davidxu

Add two commands to _umtx_op system call to allow a simple mutex to be
locked and unlocked completely in userland. by locking and unlocking mutex
in userland, it reduces the total time a mutex is locked by a thread,
in some application code, a mutex only protects a small piece of code, the
code's execution time is less than a simple system call, if a lock contention
happens, however in current implemenation, the lock holder has to extend its
locking time and enter kernel to unlock it, the change avoids this disadvantage,
it first sets mutex to free state and then enters kernel and wake one waiter
up. This improves performance dramatically in some sysbench mutex tests.

Tested by: kris
Sounds great: jeff


179662 09-Jun-2008 davidxu

Make pthread_cleanup_push() and pthread_cleanup_pop() as a pair of macros,
use stack space to keep cleanup information, this eliminates overhead of
calling malloc() and free() in thread library.

Discussed on: thread@


179434 30-May-2008 dfr

Call the fcntl compatiblity wrapper from the thread library fcntl wrappers
so that they get the benefit of the (limited) forward ABI compatibility.

MFC after: 1 week


179417 30-May-2008 davidxu

Eliminate global mutex by using pthread_once's state field as
a semaphore.


179411 29-May-2008 davidxu

- Reduce function call overhead for uncontended case.
- Remove unused flags MUTEX_FLAGS_* and their code.
- Check validity of the timeout parameter in mutex_self_lock().


178938 11-May-2008 imp

Commit missing mips libthr support that I thought I'd committed earlier


178806 06-May-2008 davidxu

Remove libc_r's remnant code.


178647 29-Apr-2008 davidxu

Use UMTX_OP_WAIT_UINT_PRIVATE and UMTX_OP_WAKE_PRIVATE to save
time in kernel(avoid VM lookup).


178587 26-Apr-2008 kris

Increase the default MUTEX_ADAPTIVE_SPINS to 2000, after further
testing it turns out 200 was too short to give good adaptive
performance.

Reviewed by: jeff
MFC after: 1 week


178581 26-Apr-2008 imp

Bring in mips threads support from perforce mips2-jnpr branch.


178446 23-Apr-2008 delphij

Avoid various shadowed variables. libthr is now almost WARNS=4 clean except
for some const dequalifiers that needs more careful investigation.

Ok'ed by: davidxu


178413 22-Apr-2008 davidxu

Use native rwlock.


178236 16-Apr-2008 davidxu

_vfork is not in libthr, remove the reference.


178194 14-Apr-2008 davidxu

don't include pthread_np.h, it is not used.


177871 03-Apr-2008 davidxu

put THR_CRITICAL_LEAVE into do .. while statement.


177869 03-Apr-2008 davidxu

add __hidden suffix to _umtx_op_err, this eliminates PLT.


177861 02-Apr-2008 davidxu

Non-portable functions are in pthread_np.h, fix compiling problem.


177855 02-Apr-2008 davidxu

Add pthread_setaffinity_np and pthread_getaffinity_np to libc namespace.


177854 02-Apr-2008 davidxu

Remove unused functions.


177853 02-Apr-2008 davidxu

Replace function _umtx_op with _umtx_op_err, the later function directly
returns errno, because errno can be mucked by user's signal handler and
most of pthread api heavily depends on errno to be correct, this change
should improve stability of the thread library.


177850 02-Apr-2008 davidxu

Replace userland rwlock with a pure kernel based rwlock, the new
implementation does not switch pointers when it resumes waiters.

Asked by: jeff


177823 01-Apr-2008 davidxu

Restore normal pthread_cond_signal path to avoid some obscure races.


177818 01-Apr-2008 davidxu

return EAGAIN early rather than running bunch of code later, micro optimize
static branch prediction.


177770 31-Mar-2008 davidxu

Rewrite rwlock to user atomic operations to change rwlock state, this
eliminates internal mutex lock contention when most rwlock operations
are read.

Orignal patch provided by: jeff


177714 29-Mar-2008 ru

Remove options MK_LIBKSE and DEFAULT_THREAD_LIB now that we no longer
build libkse. This should fix WITHOUT_LIBTHR builds as a side effect.


177605 25-Mar-2008 ru

Compile libthr with warnings.


177600 25-Mar-2008 ru

Fixed mis-implementation of pthread_mutex_get{spin,yield}loops_np().

Reviewed by: davidxu


177494 22-Mar-2008 davidxu

Add POSIX pthread API pthread_getcpuclockid() to get a thread's cpu
time clock id.


177470 21-Mar-2008 davidxu

Resolve __error()'s PLT early so that it needs not to be resolved again,
otherwise rwlock is recursivly called when signal happens and the __error
was never resolved before.


177451 20-Mar-2008 ru

pthread_mutexattr_destroy() was accidentally broken in last revision,
unbreak it. We should really start compiling this with warnings.


177445 20-Mar-2008 davidxu

Preserve application code's errno in rtld locking code, it attemps to keep
any case safe.


177441 20-Mar-2008 davidxu

Make pthread_mutexattr_settype to return error number directly and
conformant to POSIX specification.

Bug reported by: modelnine at modelnine dt org


177379 19-Mar-2008 davidxu

don't reduce new thread's refcount if current thread can not set cpuset
for it, since the new thread will reduce it by itself.


177378 19-Mar-2008 davidxu

- Trim trailing spaces.
- Use a different sigmask variable name to avoid confusing.


177370 19-Mar-2008 davidxu

if passed thread pointer is equal to current thread, pass -1 to kernel
to speed up searching.


177337 18-Mar-2008 davidxu

- Copy signal mask out before THR_UNLOCK(), because THR_UNLOCK() may call
_thr_suspend_check() which messes sigmask saved in thread structure.
- Don't suspend a thread has force_exit set.
- In pthread_exit(), if there is a suspension flag set, wake up waiting-
thread after setting PS_DEAD, this causes waiting-thread to break loop
in suspend_common().


177231 16-Mar-2008 davidxu

Actually delete SIGCANCEL mask for suspended thread, so the signal will not
be masked when it is resumed.


177046 11-Mar-2008 davidxu

If a thread is cancelled, it may have already consumed a umtx_wake,
check waiter and semphore counter to see if we may wake up next thread.


176864 06-Mar-2008 davidxu

Fix a bug when calculating remnant size.


176861 06-Mar-2008 davidxu

Don't report death event to debugger if it is a forced exit.


176860 06-Mar-2008 davidxu

Restore code setting new thread's scheduler parameters, I was thinking
that there might be starvations, but because we have already locked the
thread, the cpuset settings will always be done before the new thread
does real-world work.


176818 05-Mar-2008 davidxu

Increase and decrease in_sigcancel_handler accordingly to avoid possible
error caused by nested SIGCANCEL stack, it is a bit complex.


176817 05-Mar-2008 davidxu

Use cpuset defined in pthread_attr for newly created thread, for now,
we set scheduling parameters and cpu binding fully in userland, and
because default scheduling policy is SCHED_RR (time-sharing), we set
default sched_inherit to PTHREAD_SCHED_INHERIT, this saves a system
call.


176816 05-Mar-2008 davidxu

Add more cpu affinity function's symbols.


176815 05-Mar-2008 davidxu

Check actual size of cpuset kernel is using and define underscore version
of API.


176784 04-Mar-2008 davidxu

If a new thread is created, it inherits current thread's signal masks,
however if current thread is executing cancellation handler, signal
SIGCANCEL may have already been blocked, this is unexpected, unblock the
signal in new thread if this happens.

MFC after: 1 week


176783 04-Mar-2008 davidxu

Include cpuset.h, unbreak compiling.


176781 04-Mar-2008 davidxu

implement pthread_attr_getaffinity_np and pthread_attr_setaffinity_np.


176763 03-Mar-2008 davidxu

Implement functions pthread_getaffinity_np and pthread_setaffinity_np to
get and set thread's cpu affinity mask.


176275 14-Feb-2008 des

_pthread_mutex_isowned_np(): use a more reliable method; the current code
will work in simple cases, but may fail in more complicated ones.

Reviewed by: davidxu


176226 13-Feb-2008 obrien

style.Makefile(5)


176225 13-Feb-2008 obrien

style(9)


176061 06-Feb-2008 des

Yet another pointy hat: when I zapped FBSDprivate_1.1, I forgot to move
its contents to FBSDprivate_1.0.


176059 06-Feb-2008 des

Remove unnecessary prototype.


176054 06-Feb-2008 des

Convert pthread.map to the format expected by version_gen.awk, and modify
the Makefile accordingly; libthr now explicitly uses libc's Versions.def.

MFC after: 2 weeks


176053 06-Feb-2008 des

Remove incorrectly added FBSDprivate_1.1 namespace, and move symbols which
are new in FreeBSD 8 to the appropriate namespace.


176049 06-Feb-2008 des

Per discussion on -threads, rename _islocked_np() to _isowned_np().


175969 04-Feb-2008 des

After careful consideration (and a brief discussion with attilio@), change
the semantics of pthread_mutex_islocked_np() to return true if and only if
the mutex is held by the current thread.

Obviously, change the regression test to match.

MFC after: 2 weeks


175958 03-Feb-2008 des

Add pthread_mutex_islocked_np(), a cheap way to verify that a mutex is
locked. This is intended primarily to support the userland equivalent
of the various *_ASSERT_LOCKED() macros we have in the kernel.

MFC after: 2 weeks


175421 18-Jan-2008 davidxu

SYSTEM_SCOPE_ONLY flag is no longer needed, it is the only mode libthr
supports.


175122 07-Jan-2008 davidxu

sem_post() requires to return -1 on error.


174806 20-Dec-2007 davidxu

call underscore version of pthread_cleanup_pop instead.


174805 20-Dec-2007 davidxu

Remove vfork() overloading, it is no longer needed.


174696 17-Dec-2007 davidxu

Add function prototypes.


174585 14-Dec-2007 davidxu

1. Add function pthread_mutex_setspinloops_np to turn a mutex's spin
loop count.
2. Add function pthread_mutex_setyieldloops_np to turn a mutex's yield
loop count.
3. Make environment variables PTHREAD_SPINLOOPS and PTHREAD_YIELDLOOPS
to be only used for turnning PTHREAD_MUTEX_ADAPTIVE_NP mutex.


174535 11-Dec-2007 davidxu

Enclose all code for macro ENQUEUE_MUTEX in do while statement, and
add missing brackets.

MFC: after 1 day


174001 28-Nov-2007 jasone

Fix pointer dereferencing problems in _pthread_mutex_init_calloc_cb() that
were obscured by pseudo-opaque pthreads API pointer casting.


173967 27-Nov-2007 jasone

Add _pthread_mutex_init_calloc_cb() to libthr and libkse, so that malloc(3)
(part of libc) can use pthreads mutexes without causing infinite recursion
during initialization.


173856 23-Nov-2007 davidxu

Simplify code, fix a thread cancellation bug in sem_wait and sem_timedwait.


173808 21-Nov-2007 davidxu

Reuse nwaiter member field to record number of waiters, in sem_post(),
this should reduce the chance having to do a syscall when there is no
waiter in the semaphore.


173805 21-Nov-2007 davidxu

Remove warning level and aliasing restrictions.


173803 21-Nov-2007 davidxu

Convert ceiling type to unsigned integer before comparing, fix compiler
warnings.


173802 21-Nov-2007 davidxu

Add some function prototypes.


173801 21-Nov-2007 davidxu

Remove umtx_t definition, use type long directly, add wrapper function
_thr_umtx_wait_uint() for umtx operation UMTX_OP_WAIT_UINT, use the
function in semaphore operations, this fixed compiler warnings.


173766 20-Nov-2007 jb

These are the things that the tinderbox has problems with because it
doesn't use the default CFLAGS which contain -fno-strict-aliasing.

Until the code is cleaned up, just add -fno-strict-aliasing to the
CFLAGS of these for the tinderboxes' sake, allowing the rest of the
tree to have -Werror enabled again.


173394 06-Nov-2007 marius

In _pthread_key_create() ensure that libthr is initialized. This
fixes a NULL-dereference of curthread when libstdc+ initializes
the exception handling globals on archs we can't use GNU TLS due
to lack of support in binutils 2.15 (i.e. arm and sparc64), yet,
thus making threaded C++ programs compiled with GCC 4.2.1 work
again on these archs.

Reviewed by: davidxu
MFC after: 3 days


173208 31-Oct-2007 davidxu

Avoid doing adaptive spinning for priority protected mutex, current
implementation always does lock in kernel.


173207 31-Oct-2007 davidxu

Don't do adaptive spinning if it is running on UP kernel.


173206 31-Oct-2007 davidxu

Restore revision 1.55, the kris's adaptive mutex type.


173174 30-Oct-2007 kris

Adaptive mutexes should have the same deadlock detection properties that
default (errorcheck) mutexes do.

Noticed by: davidxu


173173 30-Oct-2007 davidxu

Add my recent work of adaptive spin mutex code. Use two environments variable
to tune pthread mutex performance:
1. LIBPTHREAD_SPINLOOPS
If a pthread mutex is being locked by another thread, this environment
variable sets total number of spin loops before the current thread
sleeps in kernel, this saves a syscall overhead if the mutex will be
unlocked very soon (well written application code).
2. LIBPTHREAD_YIELDLOOPS
If a pthread mutex is being locked by other threads, this environment
variable sets total number of sched_yield() loops before the currrent
thread sleeps in kernel. if a pthread mutex is locked, the current thread
gives up cpu, but will not sleep in kernel, this means, current thread
does not set contention bit in mutex, but let lock owner to run again
if the owner is on kernel's run queue, and when lock owner unlocks the
mutex, it does not need to enter kernel and do lots of work to resume
mutex waiters, in some cases, this saves lots of syscall overheads for
mutex owner.

In my practice, sometimes LIBPTHREAD_YIELDLOOPS can massively improve performance
than LIBPTHREAD_SPINLOOPS, this depends on application. These two environments
are global to all pthread mutex, there is no interface to set them for each
pthread mutex, the default values are zero, this means spinning is turned off
by default.


173154 29-Oct-2007 kris

Add a new "non-portable" mutex type, PTHREAD_MUTEX_ADAPTIVE_NP. This
is also implemented in glibc and is used by a number of existing
applications (mysql, firefox, etc).

This mutex type is a default mutex with the additional property that
it spins briefly when attempting to acquire a contested lock, doing
trylock operations in userland before entering the kernel to block if
eventually unsuccessful.

The expectation is that applications requesting this mutex type know
that the mutex is likely to be only held for very brief periods, so it
is faster to spin in userland and probably succeed in acquiring the
mutex, than to enter the kernel and sleep, only to be woken up almost
immediately. This can help significantly in certain cases when
pthread mutexes are heavily contended and held for brief durations
(such as mysql).

Spin up to 200 times before entering the kernel, which represents only
a few us on modern CPUs. No performance degradation was observed with
this value and it is sufficient to avoid a large performance drop in
mysql performance in the heavily contended pthread mutex case.

The libkse implementation is a NOP.

Reviewed by: jeff
MFC after: 3 days


172881 22-Oct-2007 ru

- Stop calling libthr alternative as it's now the default
threading library.

- Now that libpthread is a symlink, it's no longer possible
to link applications with libpthread and have libmap.conf(5)
select the desired threading library; applications will be
linked to the default threading library, libkse or libthr.
Remove an obsolete paragraph.

- Mention that improvements can be seen compared to libkse.

Reviewed by: deischen, davidxu


172695 16-Oct-2007 davidxu

Use macro THR_CLEANUP_PUSH/POP, they are cheaper than pthread_cleanup_push/pop.


172694 16-Oct-2007 davidxu

Reverse the logic of UP and SMP.

Submitted by: jasone


172500 09-Oct-2007 obrien

Tweak the handling of "WITHOUT_LIBPTHREAD". Also remove the accidental
treatment of 'LIBKSE' as an "old style" knob.

Submitted by: ru
Approved by: re(kensmith)


172406 01-Oct-2007 ru

Always install libpthread.* symlinks if at least one of
the threading libraries is built. This simplifies the
logic in makefiles that need to check if the pthreads
support is present. It also fixes a bug where we would
build a threading library that we shouldn't have built:
for example, building with WITHOUT_LIBTHR and the default
value of DEFAULT_THREADING_LIB (libthr) would mistakenly
build the libthr library, but not install it.

Approved by: re (kensmith)


171763 07-Aug-2007 davidxu

Output error message to STDERR_FILENO.

Approved by: re (bmah)


170416 08-Jun-2007 davidxu

Set warning level to 2.


169807 21-May-2007 deischen

Bump library versions in preparation for 7.0.

Ok'd by: kan


169669 18-May-2007 ru

Fix a logic bug I re-introduced in my patch I sent to Daniel
that would cause the selected shared threading library to be
overwritten with its 32-bit version on amd64.

PR: amd64/112509


169648 17-May-2007 deischen

Allow DEFAULT_THREAD_LIB to be set from /etc/src.conf.

Submitted by: ru


169524 13-May-2007 deischen

Enable symbol versioning by default. Use WITHOUT_SYMVER to disable it.
Warning, after symbol versioning is enabled, going back is not easy
(use WITHOUT_SYMVER at your own risk).

Change the default thread library to libthr.

There most likely still needs to be a version bump for at least the
thread libraries. If necessary, this will happen later.


169413 09-May-2007 davidxu

backout experimental adaptive spinning mutex for product use.


169092 29-Apr-2007 deischen

Use C comments since we now preprocess these files with CPP.


168382 05-Apr-2007 davidxu

If a thread who's name is being set is not the current thread, use macros
THR_THREAD_LOCK and THR_THREAD_UNLOCK instead, this should fix wrong
lock level problem.

Bug reported by: ed dot maste at gmail dot com


165967 12-Jan-2007 imp

Remove 3rd clause, renumber, ok per email


165791 05-Jan-2007 davidxu

Insert mutex at tail if it has highest ceiling.


165790 05-Jan-2007 davidxu

Oops, don't corrupt the list.


165789 05-Jan-2007 davidxu

Check if the PP mutex is recursive, if we have already locked it, place the
mutex in right order sorted by priority ceiling.


165371 20-Dec-2006 davidxu

get LIBPTHREAD_ADAPTIVE_SPIN early, so it can be used for some global
mutexes.


165370 20-Dec-2006 davidxu

Check environment variable PTHREAD_ADAPTIVE_SPIN, if it is set, use
it as a default spin cycle count.


165241 15-Dec-2006 davidxu

- Remove variable _thr_scope_system, all threads are system scope.
- Rename _thr_smp_cpus to boolean variable _thr_is_smp.
- Define CPU_SPINWAIT macro for each arch, only X86 supports it.


165206 14-Dec-2006 davidxu

Create inline function _thr_umutex_trylock2 to only try one atomic
operation, if it is failed, we call syscall directly, this saves
one atomic operation per lock contention.


165115 12-Dec-2006 davidxu

Correctly check failed syscall.


165110 12-Dec-2006 davidxu

Move checking for c_has_waiters into low level _thr_ucond_signal and
_thr_ucond_broadcast, clear condition variable pointer in cancellation
info after returing from _thr_ucond_wait, since kernel has already
dropped the internal lock, so we don't need to unlock it in cancellation
handler again.


164929 06-Dec-2006 davidxu

test cancel_pending to save a thr_wake call in some specical cases.


164927 05-Dec-2006 davidxu

_thr_ucond_wait drops lock, we should pick it up again.


164905 05-Dec-2006 davidxu

the c_has_waiters is lazily updated, temporarily disable the false
alarm code.


164903 05-Dec-2006 davidxu

Use ucond to implement barrier.


164902 05-Dec-2006 davidxu

Add _thr_ucond_init().


164896 05-Dec-2006 davidxu

Tweak _thr_cancel_leave_defer a bit to fix a possible race.


164878 04-Dec-2006 davidxu

Fix typo, I was using a wrong header file, and the typo is not detected
by compiler.


164877 04-Dec-2006 davidxu

Use kernel provided userspace condition variable to implement pthread
condition variable.


164715 28-Nov-2006 davidxu

If a thread was detached, return EINVAL instead, the error code
is also returned by pthread_detach() if a thread was already
detached, the error code was already documented:

> [EINVAL] The implementation has detected that the value speci-
> fied by thread does not refer to a joinable thread.


164616 26-Nov-2006 ru

- When building world WITHOUT_LIBPTHREAD, link libthr to libpthread.
- Don't build ngctl(8) and cached(8) if threading libs aren't built.
- Fix various issues in a cached(8) makefile.


164583 24-Nov-2006 davidxu

Eliminate atomic operations in thread cancellation functions, it should
reduce overheads of cancellation points.


164178 11-Nov-2006 davidxu

Move code calculating new inherited priority into single function.


163346 14-Oct-2006 davidxu

Don't inherit THR_FLAGS_NEED_SUSPEND for child process, child process
only has one thread, setting the flag can cause the thread to be
suspended and no another thread will resume it.


163334 13-Oct-2006 davidxu

o Make _thr_umutex_init a function.
o Eliminate unused parameter for some functions.
o Convert type of first parameter to void * for _thr_umtx_wait
and _thr_umtx_wake.


163307 13-Oct-2006 davidxu

Use type pthread_state for thread state.


162499 21-Sep-2006 davidxu

use rtprio_thread system call to get or set thread priority.


162143 08-Sep-2006 davidxu

Use return value of _thr_umutex_lock instead of using zero.


162061 06-Sep-2006 davidxu

Replace internal usage of struct umtx with umutex which can supports
real-time if we want, no functionality is changed.


162037 05-Sep-2006 davidxu

Same as pthread_setschedparam, use sizeof(struct sched_param) instead.


162036 05-Sep-2006 davidxu

Pass correct parameter size.


161840 01-Sep-2006 marcel

Stylize: avoid using a global register variable.


161804 01-Sep-2006 marcel

Rename TLS_TP_OFFSET back to TP_OFFSET. The former clashes with rtld.


161801 01-Sep-2006 marcel

Stylize.


161787 31-Aug-2006 marcel

Stylize.


161780 31-Aug-2006 marcel

TLS fixes:
o The TLS pointer (r2) points 0x7000 after the *end* of the TCB.
o _rtld_allocate_tls() gets a pointer to the current TCB, not the
current TLS pointer.
o _rtld_free_tls() gets the size of the TCB structure.


161779 31-Aug-2006 marcel

Fix harmless bug: sizeof(tcb) equals sizeof(void*) not sizeof(struct tcb).
The argument is (currently) not used by _rtld_free_tls().


161730 30-Aug-2006 marcel

o Set TP using inline assembly to avoid dead code elimination.
o Eliminate _tcb.


161711 29-Aug-2006 davidxu

Remove unused file.


161695 28-Aug-2006 davidxu

pthread_sigmask is in thr_sig.c, remove this file.


161682 28-Aug-2006 davidxu

Kill unused files.


161681 28-Aug-2006 davidxu

Use umutex APIs to implement pthread_mutex, member pp_mutexq is added
into pthread structure to keep track of locked PTHREAD_PRIO_PROTECT mutex,
no real mutex code is changed, the mutex locking and unlocking code should
has same performance as before.


161680 28-Aug-2006 davidxu

Add umutex APIs.


161526 22-Aug-2006 ru

Remove alpha left-overs.


161069 08-Aug-2006 davidxu

Axe unused member field.


161068 08-Aug-2006 davidxu

Get number of CPUs and ignore spin count on single processor machine.


160662 25-Jul-2006 davidxu

1. Don't override underscore version of aio_suspend(), system(),
wait(), waitpid() and usleep(), they are internal versions and
should not be cancellation points.
2. Make wait3() as a cancellation point.
3. Move raise() and pause() into file thr_sig.c.
4. Add functions _sigsuspend, _sigwait, _sigtimedwait and _sigwaitinfo,
remove SIGCANCEL bit in wait-set for those functions, the signal is
used internally to implement thread cancellation.


160426 17-Jul-2006 delphij

Unexpand two TAILQ_FOREACH_SAFE cases.

Ok'ed by: davidxu


160331 13-Jul-2006 davidxu

Caching scheduling policy and priority in userland, a critical but baddly
written application is frequently changing thread priority for SCHED_OTHER
policy.


160321 13-Jul-2006 davidxu

Use thr_setscheduler, thr_getscheduler and thr_setschedparam to implement
pthread functions.


160287 12-Jul-2006 davidxu

Use kernel facilities to support real-time scheduling.


160284 12-Jul-2006 davidxu

__error could be called too early before libthr is initialized, test
this case and return global varible errno instead.


159184 03-Jun-2006 davidxu

Remove unused member.


159165 02-Jun-2006 davidxu

Remove unused member field m_queue.


159090 31-May-2006 delphij

Explicitly request pre-zeroed memory instead of memset'ing our
own.

Ok'ed by: davidxu


158425 11-May-2006 davidxu

Add symbol versions: FBSD_1.0 and FBSDprivate.


158074 27-Apr-2006 davidxu

s/long/int.


158073 27-Apr-2006 davidxu

- Use same priority range returned by kernel's sched_get_priority_min()
and sched_get_priority_max() syscalls.
- Remove unused fields from structure pthread_attr.


157976 23-Apr-2006 davidxu

Remove multiple _get_curthread() calls.


157694 12-Apr-2006 ru

Install shared libpthread library into /lib; needed by some
/sbin programs.


157591 08-Apr-2006 davidxu

Do not check validity of timeout if a mutex can be acquired immediately.
Completly drop recursive mutex in pthread_cond_wait and restore recursive
after resumption. Reorganize code to make gcc to generate better code.


157462 04-Apr-2006 davidxu

Remove declaration of _thr_initial from MD header file, it is no longer
needed.


157461 04-Apr-2006 davidxu

Simplify _get_curthread() and _tcb_ctor because libc and rtld now
already allocate thread pointer space in tls block for initial thread.
Only i386 and amd64 have been done, others still have to be tested.


157457 04-Apr-2006 davidxu

WARNS level 4 cleanup.


157234 28-Mar-2006 des

Fix prototype mismatch.


157194 27-Mar-2006 davidxu

Remove priority mutex code because it does not work correctly,
to make it work, turnstile like mechanism to support priority
propagating and other realtime scheduling options in kernel
should be available to userland mutex, for the moment, I just
want to make libthr be simple and efficient thread library.

Discussed with: deischen, julian


157174 27-Mar-2006 davidxu

Comment out -g compiler option, found by 'FreeBSD Build Options Survey'.


157138 26-Mar-2006 davidxu

Check cancellation state carefully to see we really need to call
_pthread_testcancel(). Preserve errno in _thr_suspend_check().


157116 25-Mar-2006 davidxu

Don't cancel thread if it is in critical region.


157113 25-Mar-2006 davidxu

Only wake up writer if the lock is free.


157112 25-Mar-2006 davidxu

Compile thr_rtld.c


157111 25-Mar-2006 davidxu

Add locking support for rtld.


157079 24-Mar-2006 davidxu

set an upper limit for thread structures which can be allocated.


156901 20-Mar-2006 davidxu

Set default contention scope to system.


156854 18-Mar-2006 ru

Convert NO_PROFILE and NO_LIB32 to new style.


156452 08-Mar-2006 davidxu

Remove mqueue and timer, now they are in librt.


156319 05-Mar-2006 deischen

Add some more pthread stubs so that librt can use them.
The thread jump table has been resorted, so you need to
keep libc, libpthread, and libthr in sync.

Submitted by: xu


156102 28-Feb-2006 davidxu

Reimplement mutex_init to get rid of compile warning.


155890 22-Feb-2006 davidxu

Disable POSIX SIGEV_THREAD notification support, soon we will have a common
library which can be reused both for libthr and libpthread.


155857 20-Feb-2006 davidxu

Read cycle count before sending signal, this fixes a userland thread
suspension bug.

MFC after: 3 days


155739 15-Feb-2006 davidxu

Rework last change of pthread_once, create a function _thr_once_init to
reinitialize its internal locks.


155714 15-Feb-2006 davidxu

After fork(), reinitialize internal locks for pthread_once().


155330 05-Feb-2006 davidxu

Now, thread name is stored in kernel, userland no longer has to keep it.


155329 05-Feb-2006 davidxu

use syscall thr_set_name to implement pthread_set_name_np.


154703 23-Jan-2006 davidxu

Add missing symbol pthread_set_name_np.


154422 16-Jan-2006 davidxu

Eliminate unused code.


154350 14-Jan-2006 davidxu

Enable mutex inheritance code in mutex_fork, I forgot to turn on it.
while here, add some comments about process shared mutex.


154288 13-Jan-2006 jasone

Increase the number of spinlocks, since libc's malloc implementation is
about to significantly increase the number of spinlocks used.

Approved by: markm (mentor)


154248 12-Jan-2006 jasone

In preparation for a new malloc implementation:

* Add posix_memalign().

* Move calloc() from calloc.c to malloc.c. Add a calloc() implementation in
rtld-elf in order to make the loader happy (even though calloc() isn't
used in rtld-elf).

* Add _malloc_prefork() and _malloc_postfork(), and use them instead of
directly manipulating __malloc_lock.

Approved by: phk, markm (mentor)


154212 11-Jan-2006 davidxu

The thr_new sysscall was already in libc, don't generate it.


154160 10-Jan-2006 davidxu

Use macro STATIC_LIB_REQUIRE to declare a symbol should be linked into
static binary.


154130 09-Jan-2006 davidxu

Rescue pthread_set_name_np for compatible reason, remove unused code.


154129 09-Jan-2006 davidxu

Tweak macro THR_LOCK_RELEASE a bit for non-PTHREAD_INVARIANTS case.


154126 09-Jan-2006 davidxu

Return real detached state.


154113 08-Jan-2006 davidxu

Fix a bug recently introduced, the _thread_active_count should be
decreased if thread can not be created.


154106 08-Jan-2006 davidxu

Allow background threads to be suspended.


154105 08-Jan-2006 davidxu

Try to reduce total time needed for suspending all threads,
first broadcast signals to all threads, then enter a wait loop.


154095 07-Jan-2006 davidxu

Remove functions i386_get_gsbase and i386_set_gsbase, they were already
in libc.


154055 05-Jan-2006 davidxu

Refine thread suspension code, now thread suspension is a blockable
operation, the caller is blocked util target threads are really
suspended, also avoid suspending a thread when it is holding a
critical lock.
Fix a bug in _thr_ref_delete which tests a never set flag.


154021 04-Jan-2006 davidxu

1. Add SIGEV_THREAD notification for mq_notify.
2. Reuse current timer code and abstract some common code to
to support both timer and mqueue.


153987 03-Jan-2006 davidxu

Remove in-progress wait code to sync with libpthread's behavior.


153595 21-Dec-2005 davidxu

Let _mutex_cv_lock call internal functiona mutex_lock_common.


153594 21-Dec-2005 davidxu

Hide umtx API symbols as well.


153593 21-Dec-2005 davidxu

1. Retire macro SCLASS, instead simply use language keyword and
put variables in thr_init.c.
2. Hide all global symbols which won't be exported.


153591 21-Dec-2005 davidxu

Follow the mistake in libpthread, the first version name in libpthread
is LIBTHREAD_1_0, but really it should be LIBPTHREAD_1_0.
Fix it so libmap.conf works again (it was broken by recent versioning
code in rtld_elf).


153526 19-Dec-2005 davidxu

Clear return code to zero if joiner successfully waited joinee.

Bug reported by: jasone at connonware when using ports lang/onyx
MFC after: 3 days


153496 17-Dec-2005 davidxu

Update copyright.


153334 12-Dec-2005 davidxu

Remove unused _get_curthread() call.


152029 04-Nov-2005 davidxu

Fix name compatible problem with POSIX standard. the sigval_ptr and
sigval_int really should be sival_ptr and sival_int.
Also sigev_notify_function accepts a union sigval value but not a
pointer.


151972 02-Nov-2005 davidxu

Remove a redundant _get_curthread() call.


151968 02-Nov-2005 davidxu

In raise(), use a shortcut to directly send signal to current thread.


151928 01-Nov-2005 davidxu

Fix some comments, eliminate a memory leak.


151923 01-Nov-2005 davidxu

Use TIMERS_UNLOCK.


151922 01-Nov-2005 davidxu

Add code to handle timer_delete(). The timer wrapper code is completely
rewritten, now timers created with same sigev_notify_attributes will
run in same thread, this allows user to organize which timers can
run in same thread to save some thread resource.


151892 30-Oct-2005 davidxu

Add thread exit handler in timer_loop to handle broken buggy code which
could lead to memory leak.


151871 30-Oct-2005 davidxu

Add timer_create wrapper.


151859 29-Oct-2005 davidxu

Remove unused variable.

Reviewed by: cognet


151836 29-Oct-2005 davidxu

Kill unused variable declaration.


151729 27-Oct-2005 davidxu

Link libthr to libpthread on Alpha and Sparc.


151696 26-Oct-2005 davidxu

Add experiment code to implement POSIX timer's SIGEV_THREAD notification.


151694 26-Oct-2005 davidxu

Follow the change in kernel, joiner thread just waits at thread id
address, let kernel wake it up.


151637 25-Oct-2005 davidxu

Put pthread_condattr_init sorted order.


151609 24-Oct-2005 davidxu

Export following functions:
_pthread_mutexattr_getpshared
_pthread_mutexattr_setpshared
pthread_condattr_getpshared
pthread_condattr_setpshared
pthread_mutexattr_getpshared
pthread_mutexattr_setpshared


151608 24-Oct-2005 davidxu

Add functions pthread_mutexattr_setpshared and pthread_mutexattr_getpshared.


151199 10-Oct-2005 davidxu

The pthread_attr_set_createsuspend_np was broken, fix it by
replacing THR_FLAGS_SUSPENDED with THR_FLAGS_NEED_SUSPEND.


150904 04-Oct-2005 davidxu

Sort function names.


150901 04-Oct-2005 davidxu

Add function pthread_timedjoin_np, the function is similar with pthread_join
except the function will return ETIMEDOUT if target thread does not exit
before specified absolute time passes.


149691 01-Sep-2005 stefanf

Include needed headers that were obtained through <pthread.h>. Sort headers
while here.


149298 19-Aug-2005 stefanf

- Prefix MUTEX_TYPE_MAX with PTHREAD_ to avoid namespace pollution.
- Remove the macros MUTEX_TYPE_FAST and MUTEX_TYPE_COUNTING_FAST.

OK'ed by: deischen


148662 03-Aug-2005 deischen

Add usleep to the map files.

Noticed by: davidxu


148658 03-Aug-2005 deischen

Add a cancellation point for usleep().

While here, fix sleep() so that it is also a cancellation point (a
missing weak reference prevented that).


148470 28-Jul-2005 davidxu

Cast to uintptr_t to avoid compiler warning, it was broken by
the recent atomic_ptr() change.


148297 22-Jul-2005 kensmith

Bump the shared library version number of all libraries that have not
been bumped since RELENG_5.

Reviewed by: ru
Approved by: re (not needed for commit check but in principle...)


147534 22-Jun-2005 davidxu

Fix off-by-one nanosecond bug in macro TIMESPEC_ADD.

Reviewed by: deischen
Approved by: re (dwhite)
MFC after : 4 days


147434 16-Jun-2005 ru

Markup fixes.

Approved by: re


147399 15-Jun-2005 rwatson

Remove incorrect BUGS entry: libthr does support process-scope thread
scheduling.

MFC after: 1 week
Submitted by: davidxu
Approved by: re (scottl)


147303 11-Jun-2005 rwatson

Add a stub libthr(3) man page to document what it is and why, as well as
to point at libmap.conf(5). This will help answer questions about what
and why it is, although not in great detail.

Approved by: re (scottl)
MFC after: 1 week
MFC note: When MFC'd, don't MFC mention of work not yet MFC'd.


145578 27-Apr-2005 davidxu

Remove COMPAT_32BIT, it is no longer needed.


145438 23-Apr-2005 davidxu

Remove unused variable.


145437 23-Apr-2005 davidxu

Now libthr only uses GDT based tls on i386. using LDT can only increase
clock cycles and has 8191 threads limitation.


145436 23-Apr-2005 davidxu

Use thr_new syscall to create a new thread, obscure context operations
is no longer needed.


145431 23-Apr-2005 davidxu

Add i386_get_gsbase, i386_set_gsbase since old libc doesn't have the
functions, otherwise user ports have to be rebuilt.


145040 14-Apr-2005 peter

Adapt the libpthread patch for using i386_set_gsbase() to libthr.


144925 12-Apr-2005 davidxu

Conditionally report initial thread event.


144924 12-Apr-2005 davidxu

Add missing event reporting code.


144921 12-Apr-2005 davidxu

Add debugger event reporting support, current only TD_CREATE and TD_DEATH
events are reported.


144765 07-Apr-2005 cognet

Use the new atomic_cmpset_32().


144736 07-Apr-2005 davidxu

Adjust hash function for smaller pthread structure size.


144711 06-Apr-2005 davidxu

Remove unique id field which is no longer used by debugger.


144710 06-Apr-2005 davidxu

Remove debug symbol from installed library, one can always
use compiled version in libthr directory.


144639 04-Apr-2005 davidxu

Pass exact number of threads.


144614 03-Apr-2005 davidxu

Export pthread_condattr_getclock, pthread_condattr_setclock.


144518 02-Apr-2005 davidxu

Import my recent 1:1 threading working. some features improved includes:
1. fast simple type mutex.
2. __thread tls works.
3. asynchronous cancellation works ( using signal ).
4. thread synchronization is fully based on umtx, mainly, condition
variable and other synchronization objects were rewritten by using
umtx directly. those objects can be shared between processes via
shared memory, it has to change ABI which does not happen yet.
5. default stack size is increased to 1M on 32 bits platform, 2M for
64 bits platform.
As the result, some mysql super-smack benchmarks show performance is
improved massivly.

Okayed by: jeff, mtm, rwatson, scottl


143170 06-Mar-2005 marcus

Increase the default stacksizes:

32-bit 64-bit
main thread 2 MB 4 MB
other threads 1 MB 2 MB

Approved by: mtm
Adapted from: libpthread


138494 06-Dec-2004 peter

Fix inverted #ifdef that I added. Who had the pointy hat last?

Submitted by: kan


138129 27-Nov-2004 das

Don't include sys/user.h merely for its side-effect of recursively
including other headers.


137292 06-Nov-2004 peter

Use the recently exposed fs/gs set functions when compiling libthr to
run as a 32 bit support library for an amd64 kernel. 32 bit consumers of
libthr have zero chance of running on an amd64 kernel since we don't
implement the i386_set_ldt() family of functions. Note that this commit
doesn't make it actually work, it just removes one more obstacle.


136910 24-Oct-2004 ru

For variables that are only checked with defined(), don't provide
any fake value.


136483 13-Oct-2004 mtm

1. Now that it's a thread's state is changed from within the kernel, where
no userland locks are heald, the dead thread lock can no longer protect
access to it. Therefore, instead of using an if (!dead)...else clause
after walking the active threads list test the thread pointer before
deciding not to walk the dead threads list. If the thread pointer is null
it means it was not found in the active threads list and the dead threads
list should be checked.

2. Do not free the stack of a thread that is not marked dead. This is the
2nd and final part of eliminating the race to free a thread's stack.

MFC after: 3 days


136262 08-Oct-2004 mtm

Remove a reference to a non-existent syscall: _thr_exit(). The
actual name is thr_exit(). How this ever worked is beyond me.


136192 06-Oct-2004 mtm

Close a race between a thread exiting and the freeing of it's stack.
After some discussion the best option seems to be to signal the thread's
death from within the kernel. This requires that thr_exit() take an
argument.

Discussed with: davidxu, deischen, marcel
MFC after: 3 days


135579 22-Sep-2004 mtm

Remove vestiges of libthr's signal mangling past. This fixes that last
known problem with mysql on libthr: not being able to kill mysqld.


135575 22-Sep-2004 mtm

The SUSv3 function say that the affected functions MAY FAIL, if the
specified mutex is invalid. In spec parlance 'MAY FAIL' means it's
up to the implementor. So, remove the check for NULL pointers for two
reasons:
1. A mutex may be invalid without necessarily being NULL.
2. If the pointer to the mutex is NULL core-dumping in the
vicinity of the problem is much much much better than failing
in some other part of the code (especially when the application
doesn't check the return value of the function that you oh so
helpfully set to EINVAL).


135301 16-Sep-2004 mtm

Implement cancellation points in libc interfaces, as specified by POSIX.


134051 19-Aug-2004 davidxu

Adjust code to support AMD64, on AMD64, thread needs to set fsbase by
itself before it can execute any other code, so new thread should be
created with all signals are masked until after fsbase is set.


134050 19-Aug-2004 davidxu

Add AMD64 support code.


133775 15-Aug-2004 dfr

Add rtld-elf to the include path for the rtld to pthread TLS interface.


133755 15-Aug-2004 dfr

Add TLS support for libthr on i386.


132890 30-Jul-2004 mtm

o Assertions to catch that stuff that shouldn't happen is not happening.
o In the rwlock code: move a duplicated check inside an if..else to after
the if...else clause.
o When initializing a static rwlock move the initialization check
inside the lock.
o In thr_setschedparam.c: When breaking out of the trylock...retry if busy
loop make sure to reset the mtx pointer to null if the mutex is nolonger
in a queue.


132334 18-Jul-2004 marcel

Define _libthr_debug for use by libthread_db.


131588 04-Jul-2004 marcel

Record the offset of thr_id in the thread structure. Required for
debugging.


131431 02-Jul-2004 marcel

Change the thread ID (thr_id_t) used for 1:1 threading from being a
pointer to the corresponding struct thread to the thread ID (lwpid_t)
assigned to that thread. The primary reason for this change is that
libthr now internally uses the same ID as the debugger and the kernel
when referencing to a kernel thread. This allows us to implement the
support for debugging without additional translations and/or mappings.

To preserve the ABI, the 1:1 threading syscalls, including the umtx
locking API have not been changed to work on a lwpid_t. Instead the
1:1 threading syscalls operate on long and the umtx locking API has
not been changed except for the contested bit. Previously this was
the least significant bit. Now it's the most significant bit. Since
the contested bit should not be tested by userland, this change is
not expected to be visible. Just to be sure, UMTX_CONTESTED has been
removed from <sys/umtx.h>.

Reviewed by: mtm@
ABI preservation tested on: i386, ia64


131337 30-Jun-2004 mtm

When a thread is created suspended have libthr suspend it explicitly
instead of asking the kernel to do it when we create the thread.


131181 27-Jun-2004 mtm

Implement pthread_atfork in libthr. This is mostly from deichen's
work in libpthread.

Submitted by: Dan Nelson <dnelson@allantgroup.com>


131179 27-Jun-2004 mtm

In the case that the global thread list is being re-initialized after
a fork, make sure that the current thread isn't detached and freed. As
a consequence the thread should be inserted into the head of the
active list only once (in the beginning).


129484 20-May-2004 mtm

Make libthr async-signal-safe without costly signal masking. The guidlines I
followed are: Only 3 functions (pthread_cancel, pthread_setcancelstate,
pthread_setcanceltype) are required to be async-signal-safe by POSIX. None of
the rest of the pthread api is required to be async-signal-safe. This means
that only the three mentioned functions are safe to use from inside
signal handlers.
However, there are certain system/libc calls that are
cancellation points that a caller may call from within a signal handler,
and since they are cancellation points calls have to be made into libthr
to test for cancellation and exit the thread if necessary. So, the
cancellation test and thread exit code paths must be async-signal-safe
as well. A summary of the changes follows:

o Almost all of the code paths that masked signals, as well as locking the
pthread structure now lock only the pthread structure.
o Signals are masked (and left that way) as soon as a thread enters
pthread_exit().
o The active and dead threads locks now explicitly require that signals
are masked.
o Access to the isdead field of the pthread structure is protected by both
the active and dead list locks for writing. Either one is sufficient for
reading.
o The thread state and type fields have been combined into one three-state
switch to make it easier to read without requiring a lock. It doesn't need
a lock for writing (and therefore for reading either) because only the
current thread can write to it and it is an integer value.
o The thread state field of the pthread structure has been eliminated. It
was an unnecessary field that mostly duplicated the flags field, but
required additional locking that would make a lot more code paths require
signal masking. Any truly unique values (such as PS_DEAD) have been
reborn as separate members of the pthread structure.
o Since the mutex and condvar pthread functions are not async-signal-safe
there is no need to muck about with the wait queues when handling
a signal ...
o ... which also removes the need for wrapping signal handlers and sigaction(2).
o The condvar and mutex async-cancellation code had to be revised as a result
of some of these changes, which resulted in semi-unrelated changes which
would have been difficult to work on as a separate commit, so they are
included as well.

The only part of the changes I am worried about is related to locking for
the pthread joining fields. But, I will take a closer look at them once this
mega-patch is committed.


129482 20-May-2004 mtm

q§?\022


128600 24-Apr-2004 mtm

Unconditionaly initialize any spin lock passed to pthread_spin_init(). While
makeing sure the spinlock isn't already in use might be a nice feature to
have in theory, it's hard to implement in practice since the passed in
pointer may not be NULL, but still be an invalid value (i.e. 1..2..3.. etc).


127571 29-Mar-2004 mtm

o Also check that the mutex type is not less than the minimum allowable value.
o Don't check attribute for NULL. It's the callers responsibility.


127570 29-Mar-2004 mtm

Make the minimum implementation of pthread_kill conform to the
functionality spelled out in SUSv3.
o Signal of 0 means do everything except send the signal
o Check that the signal is not invalid
o Check that the target thread is not dead/invalid


127569 29-Mar-2004 mtm

o Don't explicitly check the thread for NULL. That is the caller's
responsibility.
o If a thread is not joinable, the correct return value is EINVAL.


127568 29-Mar-2004 mtm

o If a thread is marked as detached AND on the dead threads list
the correct return value is ESRCH.
o Don't check the attribute for NULL. It's the caller's responsibility.
o Make the bitwise comparison explicit.


127566 29-Mar-2004 mtm

If a condition variable is statically initialized don't return
an error. Return successfully without doing anything.


127561 29-Mar-2004 mtm

The thread suspend function now returns ETIMEDOUT, not EAGAIN.


127556 29-Mar-2004 mtm

o Remove more references to SIGTHR
o Remove clock resolution information left over from libc_r


127523 28-Mar-2004 mtm

Remove the garbage collector thread. All resources are freed
in-line. If the exiting thread cannot release a resource, then
the next thread to exit will release it.


127486 27-Mar-2004 mtm

o Since we're not using signals for thread synchronization anymore,
sigprocmask no longer needs to be wrapped.
o raise(3) is applied to the calling thread in a threaded program.
o In the sigaction wrapper reference the correct structure.
o Don't treat SIGTHR especially anymore (infact it won't exist in
a little while).


127485 27-Mar-2004 mtm

Stop using signals for synchronizing threads. The performance penalty
was too much.


127454 26-Mar-2004 mtm

o The mutex locking functions aren't normally cancellation points. But,
we still have to DTRT when an asynchronously cancellable thread is
cancelled while waiting for a mutex.
o While dequeueing a waiting mutex don't skip a thread if it has
a cancel pending. Only skip it if it is also async cancellable.


127453 26-Mar-2004 mtm

o Initialize a local variable before referencing it. This was not
the cause of any bugs because it is *always* indirectly set
in the for...loop, but better to be explicit about it.
o Check the magic number of the passed in thread only after it has
been found in the active thread list. Otherwise, if the check is done
at the very beginning we may end up pointing to garbage if the
thread was once a valid thread, but has now been destroyed.


126643 05-Mar-2004 markm

Make NULL a (void*)0 whereever possible, and fix the warnings(-Werror)
that this provokes. "Wherever possible" means "In the kernel OR NOT
C++" (implying C).

There are places where (void *) pointers are not valid, such as for
function pointers, but in the special case of (void *)0, agreement
settles on it being OK.

Most of the fixes were NULL where an integer zero was needed; many
of the fixes were NULL where ascii <nul> ('\0') was needed, and a
few were just "other".

Tested on: i386 sparc64


126476 02-Mar-2004 grehan

libthr powerpc support.

Submitted by: Suleiman Souhlal <refugee@segfaulted.com>
Tested with: most libpthread tests, Apache 'worker' MDM


126000 19-Feb-2004 mtm

Implement PThreads barriers and barrier attributes.


125999 19-Feb-2004 mtm

Don't wake up the thread after the signal handler
has been executed. On return from the signal handler
the call will either be restarted or EINTR will be returned,
but it will not go back to its previous state. So, it is
sufficient to simply change the state to 'running' without
actually trying to wake up the thread.


125971 18-Feb-2004 mtm

Remove thr_getschedparam.c since it's contents have been moved into
thr_setschedparam.c


125969 18-Feb-2004 mtm

There are consumers of rwlocks, inluding our own libc, that depend on
a PTHREAD_RWLOCK_INITIALIZER to do for rwlocks what
a similarly named symbol does for statically initialized mutexes.
This symbol was dropped in The Open Group Base Specifications Issue 6
and does not exist in IEEE Std 1003.1, 2003, but it should still be
supported for backwards compatibility.

Pointy hat: mtm


125968 18-Feb-2004 mtm

o Catch up with the mutex priority protocol fixes.
o Move pthread_getschedparam() into the same file with it's
pthread_set* counterpart. Copyright on both files is identical.


125967 18-Feb-2004 mtm

o Style
o Instead of checking both the passed in pointer and its value
for NULL, only check the latter. Any caller that passes in
a NULL pointer is obviously wrong.


125966 18-Feb-2004 mtm

o Refactor and, among other things, get rid of insane nesting levels.
o Fix mutex priority protocols. Keep separate counts of priority
inheritance and protection mutexes to make things easier.
This will not have much affect since this is only the
userland side, and the rest involves kernel scheduling.


125964 18-Feb-2004 mtm

Move the initialization of thread priority to a common function.


125963 18-Feb-2004 mtm

Move the weak references to the top of the file to conform
to the format of other similar files in libthr.


125668 10-Feb-2004 cperciva

style cleanup: Remove duplicate $FreeBSD$ tags.

These files had tags after the copyright notice,
inside the comment block (incorrect, removed),
and outside the comment block (correct).

Approved by: rwatson (mentor)


125408 03-Feb-2004 deischen

Remove the band-aid (#include <time.h>).


125394 03-Feb-2004 deischen

Add <time.h> -- bandaid to unbreak world in <semaphore.h>.


125307 01-Feb-2004 mtm

Bump up the maximum number concurrent threads on x86.


125192 29-Jan-2004 mtm

I update the rwlock code in libthr to be more standards compliant and
what do I get for my troubles? libc breaks offcourse!

Reimplement a hack (in libthr) that allows libc to use
rwlocks without initializing them first. The hack was reimplemented
so that only a private libc version of the rwlock locking functions
initializes an uninitialized rwlock. The application version will
correctly fail.


125191 29-Jan-2004 mtm

When suspending a thread if the timeout was very short or
the system call got interrupted and the absolute timeout is
converted to a relative timeout, it may happen that we get a
negative number. In such a case, simply set the timeout to
zero so that if the event that the thread wants to wait for has
happened it can still return successfully, but if it hasn't
happened then the thread doesn't suspend indefinitely. This should
fix certain applications (including mozilla) that seem to hang
indefinitely sometimes.

Noticed and debugged by: Morten Johansen <root@morten-johansen.net>


124837 22-Jan-2004 mtm

o Implement the pthread_spin_* functions in libthr.
o Man pages


124719 19-Jan-2004 mtm

Refactor _pthread_mutex_init
o Simplify the logic by removing a lot of unnecesary nesting
o Reduce the amount of local variables
o Zero-out the allocated structure and get rid of
all the unnecessary setting to 0 and NULL;

Refactor _pthread_mutex_destroy
o Simplify the logic by removing a lot of unnecesary nesting
o No need to check pointer that the mutex attributes points
to. Checking passed in pointer is enough.


124718 19-Jan-2004 mtm

Implement reference counting of read-write locks. This uses
a list in the thread structure to keep track of the locks and
how many times they have been locked. This list is checked
on every lock and unlock. The traversal through the list is
O(n). Most applications don't hold so many locks at once that
this will become a problem. However, if it does become a problem
it might be a good idea to review this once libthr is
off probation and in the optimization cycle.
This fixes:
o deadlock when a thread tries to recursively acquire a
read lock when a writer is waiting on the lock.
o a thread could previously successfully unlock a lock it did not own
o deadlock when a thread tries to acquire a write lock on
a lock it already owns for reading or writing [ this is admittedly
not required by POSIX, but is nice to have ]


124586 16-Jan-2004 mtm

Add an implementation of pthread_rwlock_timed{rd,wr}lock() to libthr with
attendant documentation.


124583 16-Jan-2004 mtm

o We are not required to initialize an invalid rwlock. So axe all that
code and simply return EINVAL (which is allowed by the standard) in
all those pthread functions that previously initialized it.

o Refactor the pthread_rwlock_[try]rdlock() and pthread_rwlock_[try]wrlock()
functions. They are now completeley condensed into rwlock_rdlock_common()
and rwlock_wrlock_common(), respectively.

o If the application tries to destroy an rwlock that is currently
held by a thread return EBUSY where it previously went ahead and
freed all resources associated with the lock.

o Refactor _pthread_rwlock_init() to make it look (relatively) sane.

o When obtaining a read lock on an rwlock the check for whether it
would exceed the maximum allowed read locks should happen *before*
we obtain the lock.

o The pthread_rwlock_* functions shall *never* return EINTR, so make
sure to requeue/resuspend the thread if it encounters such an error.

o Make a note that pthread_rwlock_unlock() needs to ensure it holds a
lock on an rwlock it tries to unlock. It will be implemented in a
separate commit because it requires some additional rwlock infrastructure.


124564 15-Jan-2004 ru

Return ENOTSUP instead of -1.


123987 30-Dec-2003 mtm

o Implement pthread_mutex_timedlock(), which does not block indefinitely on
a mutex locked by another thread.
o document it: pthread_mutex_timedlock(3)


123986 30-Dec-2003 mtm

Make it possible for the library to specify a timeout value when
waiting on a locked mutex. This involves passing a struct timespec
from the pthread mutex locking interfaces all the way down to the
function that suspends the thread until the mutex is released.
The timeout is assumed to be an absolute time (i.e. not relative to
the current time).

Also, in _thread_suspend() make the passed in timespec const.


123862 26-Dec-2003 dfr

Don't block SIGTRAP - it makes it hard to debug programs with gdb.

Reviewed by: mtm


123859 26-Dec-2003 mtm

Preparations to make libthr work in multi-threaded fork()ing applications.

o Remove some code duplication between _thread_init(), which is run once
to initialize libthr and the intitial thread, and pthread_create(), which
initializes newly created threads, into a new function called from both
places: init_td_common()
o Move initialization of certain parts of libthr into a separate
function. These include:
- Active threads list and it's lock
- Dead threads list and it's lock & condition variable
- Naming and insertion of the initial thread into the
active threads list.


123552 15-Dec-2003 mtm

Remove _giant_mutex and its associated macros.


123551 15-Dec-2003 mtm

Comment out most of pthread_setschedparam. Pthread priorities didn't
work before anyways, and I didn't want to fix broken code I had no
way of testing. It was necessary however, in order to get rid of GIANT_LOCK.
Pthread priorities will have to wait a little longer to get fixed.


123542 15-Dec-2003 mtm

When creating a pthread in the suspended state their were two
problems: (1) The wrong flag was being checked for in the attribute
(2) The pthread's state was not being set to indicate it was
suspended.

Noticed by: Igor Sysoev <is@rambler-co.ru>


123489 12-Dec-2003 mtm

Doh! Lock the thread passed in by the caller, not the current thread.


123439 11-Dec-2003 mtm

Remove uses of GIANT_LOCK and replace with appropriate thread
and thread list locks.


123351 09-Dec-2003 mtm

Take a stab at fixing some of the macro-nightmare.
PTHREAD_NEW_STATE should work as expected now: a thread
marked PS_RUNNING will get sent a SIGTHR.
Still more cleanups necessary.


123350 09-Dec-2003 mtm

Fix the wrapper function around signals so that a signal handling
thread on one of the mutex or condition variable queues is removed
from those queues before the real signal handler is called.


123349 09-Dec-2003 mtm

Ugghh, cvs add the functions necessary to lock the global signal action
table.


123348 09-Dec-2003 mtm

o Add a wrapper around sigaction(2), so we can insert our own wrapper
around signals.
o Lock the process global signal action table.


123347 09-Dec-2003 mtm

Enable cancellation points around some syscalls.


123107 02-Dec-2003 mtm

Use dynamic instead of static LDT allocation.

Approved by: re (scottl)


120533 27-Sep-2003 marcel

Relink libc_r.a, libc_r.so and libc_r_p.so from libthr to libkse.
On ia64, where there's no libc_r at all, libkse is now the default
thread library by virtue of these links.

The reasons for this change are:
1. libkse is slated to become the default thread library anyway,
2. active development and maintenance is only present for libkse,
3. GNOME and KDE, both in the process of being supported on ia64,
work better with KSE; even on ia64.


117959 24-Jul-2003 marcel

Implement _get_curthread and _set_curthread. We use GCCs builtin
function this, which expands to PAL calls (rduniq and wruniq).
This needs adjustment when TLS is implemented.


117784 19-Jul-2003 mtm

This commit was generated by cvs2svn to compensate for changes in r117783,
which included commits to RCS files with non-trunk default branches.


117330 08-Jul-2003 mtm

When _PTHREADSINVARIANTS is defined SIGABRT is not included
in the set of signals to block.
Also, make the PANIC macro call abort() instead of simply
exiting.


117277 06-Jul-2003 mtm

Change all instances of THR_LOCK/UNLOCK, etc to UMTX_*.
It is a more acurate description of the locks they
operate on.


117276 06-Jul-2003 mtm

There's no need for _umtxtrylock to be a separate function.
Roll it into the pre-existing macro that's used to call it.


117196 03-Jul-2003 mtm

_pthread_mutex_trylock() is another internal libc function that must block
signals.


117145 02-Jul-2003 mtm

Begin making libthr async signal safe.

Create a private, single underscore, version of pthread_mutex_unlock for libc.
pthread_mutex_lock already has one. These versions are different from the
ones that applications will link against because they block all signals
from the time a call to lock the mutex is made until it is successfully
unlocked.


117127 01-Jul-2003 mtm

Do not attempt to reque a thread on a mutex queue. It may be that
a thread receives a spurious wakeup from sigtimedwait(), so make sure
that the call to the queueing code is called only once before entering
the loop (not in the loop). This should fix some fatal errors people
are seeing with messages stating the thread is already on the mutex queue.
These errors may still be triggered from signal handlers; however, since
that part of the code is not locked down yet.


117120 01-Jul-2003 ru

Axe AINC.

Submitted by: bde


117073 30-Jun-2003 mtm

Catchup with _thread_suspend() changes.


117049 29-Jun-2003 mtm

Sweep through pthread locking and use the new locking primitives for
libthr.


117048 29-Jun-2003 mtm

Locking primitives and operations in libthr should use struct umtx,
not spinlock_t. Spinlock_t and the associated functions and macros may
require blocking signals in order for async-safe libc functions to behave
appropriately in libthr. This is undesriable for libthr internal locking.
So, this is the first step in completely separating libthr from libc's
locking primitives.

Three new macros should be used for internal libthr locking from now on:
THR_LOCK, THR_TRYLOCK, THR_UNLOCK.


117046 29-Jun-2003 mtm

In a critical section, separate the aquisition of the thread lock
and the disabling of signals. What we are really interested in is
keeping track of recursive disabling of signals. We should not
be recursively acquiring thread locks. Any such situations should
be reorganized to not require a recursive lock.

Separating the two out also allows us to block signals independent of
acquiring thread locks. This will be needed in libthr in the near future when
we put the pieces together to protect libc functions that use pthread mutexes
and low level locks.


117026 29-Jun-2003 jdp

Make _thread_suspend work with both the old broken sigtimedwait
implementation and the new improved one. We now precompute the
signal set passed to sigtimedwait, using an inverted set when
necessary for compatibility with older kernels.


117012 29-Jun-2003 mtm

The move to _retire() a thread in the GC instead of in the thread's
exit function has invalidated the need for _spin[un]lock_pthread().
The _spin[un]lock() functions can now dereference curthread without
the danger that the ldtentry containing the pointer to the thread
has been cleared out from under them.


116920 27-Jun-2003 marcel

Create compatibility links for libc_r on ia64 to prevent build-time
breakages. Note that runtime compatibility is not guaranteed. Future
changes to setjmp/longjmp in libc will break threaded applications
linked against libc_r.so.5 on ia64. We pull our "tier 2" card once
more...

Reviewed by: ru


116103 09-Jun-2003 mtm

_thread_printf() is only used for debugging or in cases where something's
screwed beyond all help, so it can just skip the pthreads wrapper
for write(2) and call directly into it.


115820 04-Jun-2003 mtm

Make C applications statically compiled with libthr work. Previously,
an application compiled -static with libthr would dump core in
malloc(3) because the stub thread initialization routine in libc would
be used instead of the libthr supplied one.


115768 03-Jun-2003 mtm

Teach recent changes in the umtx structure in the kernel to the libthr
initialiazer.

Found by: tinderbox


115693 02-Jun-2003 mtm

Unwind the _giant_mutex from pthread_detach(). When detaching a joiner thread
it's important the correct lock order is observed: lock first the joined and
then the joiner.


115692 02-Jun-2003 mtm

Consolidate static_init() and static_init_private into one function.
The behaviour of this function is controlled by the argument: private.


115666 02-Jun-2003 obrien

.S comments must be C comments, not ASM ones.


115442 31-May-2003 mtm

I botched one of my committs in the last round. Fix it.


115390 29-May-2003 mtm

Make the mutex static initializers look more like the one for
condition variables. Cosmetic.

Explicitly compare against PTHREAD_MUTEX_INITIALIZER. We shouldn't
encourage calls to the mutex functions with null pointers to mutexes.

Approved by: re/jhb


115389 29-May-2003 mtm

Use a static lock to ake sure pthread_cond_* functions called
from multiple threads don't initialze the same condition variable
more than once.

Explicitly compare cond pointers with PTHREAD_COND_INITIALIZER instead
of NULL. Just because it happens to be defined as NULL is no reason
to encourage the idea that people can call those functions with
NULL pointers to a condition variable.

Approved by: re/jhb


115388 29-May-2003 mtm

Missing unlock.

Approved by: re/jhb


115387 29-May-2003 mtm

Don't hold the active thread list lock when signaling the gc thread.
The dead list thread is sufficient for synchronization.

Retire the arch_id (ldt array slot) in the gc thread instead of the
doing it in the thread itself.

Approved by: re/jhb


115386 29-May-2003 mtm

It's unnecessary to lock the thread during creation. Simply extend
the scope of the active thread list lock.

Approved by: re/jhb


115357 27-May-2003 mtm

Minimize the potential for deadlocks between an exiting thread and it's
joiner by making sure all locks and unlocks occur in the same order. For
the record the lock order is: DEAD_LIST, THREAD_LIST, exiting thread, joiner
thread.

Approved by: re/rwatson


115356 27-May-2003 mtm

Revert part of the last commit. I don't know what I was smoking.

Approved by: re/rwatson


115315 26-May-2003 mtm

Decouple the thread stack [de]allocating functions from the 'dead threads list'
lock. It's not really necessary and we don't need the added complexity
or potential for deadlocks.

Approved by: re/blanket libthr


115314 26-May-2003 mtm

Revise the unlock order in _pthread_join(). Also, if the joined
thread is not dead, the join loop is guaranteed to execute at least
once, so there is no need to pick up the thread list lock after
we return from suspenstion only to release it after the loop.

Approved by: re/blanket libthr


115313 25-May-2003 mtm

Return gracefully, rather than aborting, when the maximum concurrent
threads per process has been reached. Return EAGAIN, as per spec.

Approved by: re/blanket libthr


115307 25-May-2003 mtm

_pthread_cancel() breaks the normal lock order of first locking the
joined and then the joiner thread. There isn't an easy (sane?) way
to make it use the correct order without introducing races involving
the target thread and finding which (active or dead) list it is on. So,
after locking the canceled thread it will try to lock the joined thread
and if it fails release the first lock and try again from the top.

Introduce a new function, _spintrylock, which is simply a wrapper arround
umtx_trylock(), to help accomplish this.

Approved by: re/blanket libthr


115306 25-May-2003 mtm

Part of the last patch.
Modify the thread creation and thread searching routine
to lock the thread lists with the new locks instead of GIANT_LOCK.

Approved by: re/blanket libthr


115305 25-May-2003 mtm

Start locking up the active and dead threads lists. The active threads
list is protected by a spinlock_t, but the dead list uses a pthread_mutex
because it is necessary to synchronize other threads with the garbage
collector thread. Lock/Unlock macros are used so it's easier to make
changes to the locks in the future.

The 'dead thread list' lock is intended to replace the gc mutex.
This doesn't have any practical ramifications. It simply makes it
clearer what the purpose of the lock is. The gc will use this lock,
instead of the gc mutex, to synchronize access to the dead list with
other threads.

Modify _pthread_exit() to use these two new locks instead of GIANT_LOCK,
and also to properly lock and protect thread state changes,
especially with respect to a joining thread.

The gc thread was also re-arranged to be more organized and less nested.

_pthread_join() was also modified to use the thread list locks. However,
locking and unlocking here needs special care because a thread could find
itself in a position where it's joining an exiting thread that is
waiting on the dead list lock, which this thread (joiner) holds. If the
joiner doesn't take care to lock *and* unlock in the same order they
(the joiner and the joinee) could deadlock against each other.

Approved by: re/blanket libthr


115304 25-May-2003 mtm

The libthr code makes use of higher-level primitives (pthread_mutex_t and
pthread_cond_t) internaly in addition to the low-level spinlock_t. The
garbage collector mutex and condition variable are two such examples. This
might lead to critical sections nested within critical sections. Implement
a reference counting mechanism so that signals are masked only on the first
entry and unmasked on the last exit.

I'm not sure I like the idea of nested critical sections, but if
the library is going to use the pthread primitives it might be necessary.

Approved by: re/blanket libthr


115302 25-May-2003 marcel

The struct mcontext has changed. It's using the register sets. Bring
this in line.


115277 24-May-2003 mtm

Lock the cond queue (condition variables):
Access to the thread's flags and state is protected by
_thread_critical_enter/exit(). When a thread is signaled with a condition
its state must be protected by locking it and disabling
signals before it is taken of the waiters' queue.

Move the implementation of pthread_cond_signal() and pthread_cond_broadcast()
into one function, cond_signal(). Its behaviour is determined by the
last argument, int broadcast. If this is set to 1 it will remove all
waiters, otherwise it will wake up only the first waiter thread.

Remove an extraneous call to pthread_testcancel().

Approved by: re/blanket libthr


115271 23-May-2003 mtm

Add two functions: _spinlock_pthread() and _spinunlock_pthread()
that take the address of a struct pthread as their first argument.
_spin[un]lock() just become wrappers arround these two functions.
These new functions are for use in situations where curthread can't be
used. One example is _thread_retire(), where we invalidate the array index
curthread uses to get its pointer..

Approved by: re/blanket libthr


115261 23-May-2003 mtm

EDOOFUS
Prevent one thread from messing up another thread's saved signal
mask by saving it in struct pthread instead of leaving it as a
global variable. D'oh!

Approved by: re/blanket libthr


115260 23-May-2003 mtm

Make WARNS2 clean. The fixes mostly included:
o removed unused variables
o explicit inclusion of header files
o prototypes for externally defined functions

Approved by: re/blanket libthr


115259 23-May-2003 mtm

note to self: do not confuse void* with int.

Approved by: re/blanket libthr


115203 21-May-2003 mtm

o Make the defenition of _set_curthread() match its declaration
in thr_private.h

o Lock down the ldt_entries array and ldt_free, which points to
the next free slot. As noted in the comments, it's necessary
to special case the initial_thread because %gs is not setup
for it yet. This is ok because that early in the program there
won't be any reentrancy issues anyways.

Approved by: re/blanket libthr


115198 21-May-2003 mtm

Insert a debugging aid:
When in either the mutex or cond queue we notice that the thread
is already on one of the queues, don't just simply abort(). Print
out the thread's identifiers and what queue it was on.

Approved by: markm/mentor, re/blanket libthr


115197 21-May-2003 mtm

Re-enable the garbage collector thread in anticipation of further
locking work. I can't see anything obviously wrong with it (other than
the need to update the locking).

Approved by: markm/mentor, re/blanket libthr


115196 21-May-2003 mtm

When a thread exits it does not return from the kernel unless it
is the *only* remaining thread in the application, in which case we
should not core dump, and instead exit gracefully.

Approved by: markm/mentor, re/blanket libthr


115195 21-May-2003 mtm

The thread id was being set *before* zeroing out the thread. Reverse
the order.

Approved by: markm/mentor, re/blanket libthr


115183 20-May-2003 mtm

Move a misplaced comment.

Approved by: markm/mentor (implicit), re/blanket libthr


115035 15-May-2003 mtm

Do some cleanup with respect to condition variables. The implementation
of pthread_cond_timedwait() is moved into cond_wait_common().
Pthread_cond_wait() and pthread_cond_timedwait() are now wrappers around
this function. Previously, the former called the latter with the abstime
pointing to 0 time. This violated Posix semantics should an application
have reason to call it with that argument because instead or returning
immediately it would have waited indefinitely for the cv to be signaled.

Approved by: markm/mentor, re/blanket libthr
Reviewed by: jeff


115033 15-May-2003 mtm

o Make the setting/checking of cancel state atomic with
respect to other threads and signal handlers by moving to
the _thread_critical_enter/exit functions.

o Introduce an static function, testcancel(), that is used by
the other functions in this module. This allows it to make
locking assumptions that the top-level functions can't.

o Rework the code flow a bit to reduce indentation levels.

Approved by: markm/mentor, re/blanket libthr
Reviewed by: jeff


114939 12-May-2003 mtm

msg2


114938 12-May-2003 mtm

msg1


114773 06-May-2003 mtm

Fix a null dereference leading to a core dump when
the number of threads exceeds the number of open slots
in ldt_entries[].

Approved by: markm (mentor)(implicit)
Reviewed by: jeff


114772 06-May-2003 mtm

o Correct a debug message that refered to the wrong function
o Remove an unncecesary if clause

Approved by: markm (mentor)(implicit)
Reviewd by: jeff


113735 20-Apr-2003 marcel

Add support for ia64.

Note that the tp register (r13) is reserved as the TLS pointer in
the same way that that gp register (r1) is reserved as the global
pointer. This implementation uses the tp register to point to the
thread structure used by the threads implementation. This is not
in violation with the runtime specification provided the TLS is
a fixed distance from the thread structure. This is only an issue
when code used the __thread keyword to create TLS. This is not
supported at the moment.


113733 20-Apr-2003 marcel

Use STDERR_FILENO as the file descriptor passed to _thread_printf()
instead of 0 (ie stdin). Writing to stdin may not be possible.


113731 20-Apr-2003 marcel

Fix build breakage (on ia64) caused by a missing file descriptor to
_thread_printf(). Use STDERR_FILENO as the file descriptor.


113729 20-Apr-2003 jdp

Add stub implementations of pthread_[gs]etconcurrency to libc_r and
libthr. No changes were made to libpthread by request of deischen,
who will soon commit a real implementation for that library.

PR: standards/50848
Submitted by: Sergey A. Osokin <osa@freebsd.org.ru>
MFC after: 1 week


112995 03-Apr-2003 jake

- Pass a ucontext_t to _set_curthread. If non-NULL the new thread is set
as curthread in the new context, so that it will be set automatically when
the thread is switched to. This fixes a race where we'd run for a little
while with curthread unset in _thread_start.

Reviewed by: jeff


112992 02-Apr-2003 jeff

- Don't overrun the ldt buffer.

Submitted by: gordan@freebsd.org


112969 02-Apr-2003 jake

Implement _get_curthread and _set_curthread. This is especially easy.


112965 02-Apr-2003 jeff

- Define curthread as _get_curthread() and remove all direct calls to
_get_curthread(). This is similar to the kernel's curthread. Doing
this saves stack overhead and is more convenient to the programmer.
- Pass the pointer to the newly created thread to _thread_init().
- Remove _get_curthread_slow().


112964 01-Apr-2003 jake

Add MD makefile.


112960 01-Apr-2003 jeff

- Don't drop and reacquire giant in thread_suspend(). Change callers to do
this manually. This will facilitate the unrolling of giant.
- Don't allow giant to recurse anymore. This should never happen.


112959 01-Apr-2003 jeff

- Reenable setschedparam and the prioceiling code now that the mutex code
has been restored.


112958 01-Apr-2003 jeff

- Restore old mutex code from libc_r. It is more standards compliant.
This was changed because originally we were blocking on the umtx and
allowing the kernel to do the queueing. It was decided that the
lib should queue and start the threads in the order it decides and the
umtx code would just be used like spinlocks.


112925 01-Apr-2003 jeff

- Adjust the makefiles so we have a per architecture makefile.


112919 01-Apr-2003 jeff

- Commit the forgotten libthr/sys bits.


112918 01-Apr-2003 jeff

- Add libthr but don't hook it up to the regular build yet. This is an
adaptation of libc_r for the thr system call interface. This is beta
quality code.