Index: head/Makefile.inc1 =================================================================== --- head/Makefile.inc1 (revision 169523) +++ head/Makefile.inc1 (revision 169524) @@ -1,1241 +1,1241 @@ # # $FreeBSD$ # # Make command line options: # -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir # -DNO_CLEAN do not clean at all # -DNO_SHARE do not go into share subdir # -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel # -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel # -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel # -DNO_PORTSUPDATE do not update ports in ${MAKE} update # -DNO_DOCUPDATE do not update doc in ${MAKE} update # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list # TARGET="machine" to crossbuild world for a different machine type # # The intended user-driven targets are: # buildworld - rebuild *everything*, including glue to help do upgrades # installworld- install everything built by "buildworld" # doxygen - build API documentation of the kernel # update - convenient way to update your source tree (eg: cvsup/cvs) # # Standard targets (not defined here) are documented in the makefiles in # /usr/share/mk. These include: # obj depend all install clean cleandepend cleanobj .include # We must do share/info early so that installation of info `dir' # entries works correctly. Do it first since it is less likely to # grow dependencies on include and lib than vice versa. # # We must do lib/ and libexec/ before bin/, because if installworld # installs a new /bin/sh, the 'make' command will *immediately* # use that new version. And the new (dynamically-linked) /bin/sh # will expect to find appropriate libraries in /lib and /libexec. # SUBDIR= share/info lib libexec SUBDIR+=bin .if ${MK_GAMES} != "no" SUBDIR+=games .endif .if ${MK_CDDL} != "no" SUBDIR+=cddl .endif SUBDIR+=gnu include .if ${MK_KERBEROS} != "no" SUBDIR+=kerberos5 .endif .if ${MK_RESCUE} != "no" SUBDIR+=rescue .endif SUBDIR+=sbin .if ${MK_CRYPT} != "no" SUBDIR+=secure .endif .if !defined(NO_SHARE) SUBDIR+=share .endif SUBDIR+=sys usr.bin usr.sbin # # We must do etc/ last for install/distribute to work. # SUBDIR+=etc # These are last, since it is nice to at least get the base system # rebuilt before you do them. .for _DIR in ${LOCAL_DIRS} .if exists(${.CURDIR}/${_DIR}/Makefile) SUBDIR+= ${_DIR} .endif .endfor .if defined(SUBDIR_OVERRIDE) SUBDIR= ${SUBDIR_OVERRIDE} .endif .if defined(NOCLEAN) NO_CLEAN= ${NOCLEAN} .endif .if defined(NO_CLEANDIR) CLEANDIR= clean cleandepend .else CLEANDIR= cleandir .endif CVS?= cvs CVSFLAGS?= -A -P -d -I! SUP?= /usr/bin/csup SUPFLAGS?= -g -L 2 .if defined(SUPHOST) SUPFLAGS+= -h ${SUPHOST} .endif MAKEOBJDIRPREFIX?= /usr/obj .if !defined(OSRELDATE) .if exists(/usr/include/osreldate.h) OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ /usr/include/osreldate.h .else OSRELDATE= 0 .endif .endif # Guess machine architecture from machine type, and vice versa. .if !defined(TARGET_ARCH) && defined(TARGET) TARGET_ARCH= ${TARGET:S/pc98/i386/:S/sun4v/sparc64/} .elif !defined(TARGET) && defined(TARGET_ARCH) && \ ${TARGET_ARCH} != ${MACHINE_ARCH} TARGET= ${TARGET_ARCH} .endif # Otherwise, default to current machine type and architecture. TARGET?= ${MACHINE} TARGET_ARCH?= ${MACHINE_ARCH} KNOWN_ARCHES?= amd64 arm i386 i386/pc98 ia64 powerpc sparc64 sparc64/sun4v .if ${TARGET} == ${TARGET_ARCH} _t= ${TARGET} .else _t= ${TARGET_ARCH}/${TARGET} .endif .for _t in ${_t} .if empty(KNOWN_ARCHES:M${_t}) .error Unknown target ${TARGET_ARCH}:${TARGET}. .endif .endfor .if ${TARGET} == ${MACHINE} TARGET_CPUTYPE?=${CPUTYPE} .else TARGET_CPUTYPE?= .endif .if !empty(TARGET_CPUTYPE) _TARGET_CPUTYPE=${TARGET_CPUTYPE} .else _TARGET_CPUTYPE=dummy .endif _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \ -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE .if ${_CPUTYPE} != ${_TARGET_CPUTYPE} .error CPUTYPE global should be set with ?=. .endif .if make(buildworld) BUILD_ARCH!= uname -p .if ${MACHINE_ARCH} != ${BUILD_ARCH} .error To cross-build, set TARGET_ARCH. .endif .endif .if ${MACHINE} == ${TARGET} && !defined(CROSS_BUILD_TESTING) OBJTREE= ${MAKEOBJDIRPREFIX} .else OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET} .endif WORLDTMP= ${OBJTREE}${.CURDIR}/tmp # /usr/games added for fortune which depend on strfile BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games STRICTTMPPATH= ${BPATH}:${XPATH} TMPPATH= ${STRICTTMPPATH}:${PATH} INSTALLTMP!= /usr/bin/mktemp -d -u -t install # # Building a world goes through the following stages # # 1. legacy stage [BMAKE] # This stage is responsible for creating compatibility # shims that are needed by the bootstrap-tools, # build-tools and cross-tools stages. # 1. bootstrap-tools stage [BMAKE] # This stage is responsible for creating programs that # are needed for backward compatibility reasons. They # are not built as cross-tools. # 2. build-tools stage [TMAKE] # This stage is responsible for creating the object # tree and building any tools that are needed during # the build process. # 3. cross-tools stage [XMAKE] # This stage is responsible for creating any tools that # are needed for cross-builds. A cross-compiler is one # of them. # 4. world stage [WMAKE] # This stage actually builds the world. # 5. install stage (optional) [IMAKE] # This stage installs a previously built world. # BOOTSTRAPPING?= 0 # Common environment for world related stages CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \ MACHINE_ARCH=${TARGET_ARCH} \ MACHINE=${TARGET} \ CPUTYPE=${TARGET_CPUTYPE} \ GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \ GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac # bootstrap-tools stage BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ PATH=${BPATH}:${PATH} \ WORLDTMP=${WORLDTMP} \ MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ DESTDIR= \ BOOTSTRAPPING=${OSRELDATE} \ -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ -DWITHOUT_NLS -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \ -DNO_CPU_CFLAGS -DNO_WARNS # build-tools stage TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ DESTDIR= \ BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS # cross-tools stage XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ -DWITHOUT_FORTRAN -DWITHOUT_GDB # world stage WMAKEENV= ${CROSSENV} \ _SHLIBDIRPREFIX=${WORLDTMP} \ INSTALL="sh ${.CURDIR}/tools/install.sh" \ PATH=${TMPPATH} WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP} .if ${TARGET_ARCH} == "amd64" # 32 bit world LIB32TMP= ${OBJTREE}${.CURDIR}/lib32 .if empty(TARGET_CPUTYPE) LIB32CPUTYPE= k8 .else LIB32CPUTYPE= ${TARGET_CPUTYPE} .endif LIB32FLAGS= -m32 -march=${LIB32CPUTYPE} -mfancy-math-387 -DCOMPAT_32BIT \ -iprefix ${LIB32TMP}/usr/ \ -L${LIB32TMP}/usr/lib32 \ -B${LIB32TMP}/usr/lib32 # Yes, the flags are redundant. LIB32WMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \ _SHLIBDIRPREFIX=${LIB32TMP} \ MACHINE=i386 \ MACHINE_ARCH=i386 \ INSTALL="sh ${.CURDIR}/tools/install.sh" \ PATH=${TMPPATH} \ CC="${CC} ${LIB32FLAGS}" \ CXX="${CXX} ${LIB32FLAGS}" \ OBJC="${OBJC} ${LIB32FLAGS}" \ LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \ AS="${AS} --32" \ LIBDIR=/usr/lib32 \ SHLIBDIR=/usr/lib32 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \ -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_INFO \ -DWITHOUT_HTML DESTDIR=${LIB32TMP} LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS .endif # install stage .if empty(.MAKEFLAGS:M-n) IMAKEENV= ${CROSSENV} \ PATH=${STRICTTMPPATH}:${INSTALLTMP} .else IMAKEENV= ${CROSSENV} \ PATH=${TMPPATH}:${INSTALLTMP} .endif IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 # kernel stage KMAKEENV= ${WMAKEENV} KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} # # buildworld # # Attempt to rebuild the entire system, with reasonable chance of # success, regardless of how old your existing system is. # _worldtmp: .if ${.CURDIR:C/[^,]//g} != "" # The m4 build of sendmail files doesn't like it if ',' is used # anywhere in the path of it's files. @echo @echo "*** Error: path to source tree contains a comma ','" @echo false .endif @echo @echo "--------------------------------------------------------------" @echo ">>> Rebuilding the temporary build tree" @echo "--------------------------------------------------------------" .if !defined(NO_CLEAN) rm -rf ${WORLDTMP} .if ${TARGET_ARCH} == "amd64" rm -rf ${LIB32TMP} .endif .else rm -rf ${WORLDTMP}/legacy/usr/include # XXX - These two can depend on any header file. rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c .endif .for _dir in \ usr/bin usr/games usr/include/c++/3.4 usr/include/sys usr/lib \ usr/libexec usr/sbin usr/share/dict \ usr/share/groff_font/devX100 \ usr/share/groff_font/devX100-12 \ usr/share/groff_font/devX75 \ usr/share/groff_font/devX75-12 \ usr/share/groff_font/devascii \ usr/share/groff_font/devcp1047 \ usr/share/groff_font/devdvi \ usr/share/groff_font/devhtml \ usr/share/groff_font/devkoi8-r \ usr/share/groff_font/devlatin1 \ usr/share/groff_font/devlbp \ usr/share/groff_font/devlj4 \ usr/share/groff_font/devps \ usr/share/groff_font/devutf8 \ usr/share/tmac/mdoc usr/share/tmac/mm mkdir -p ${WORLDTMP}/legacy/${_dir} .endfor .for _dir in \ lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \ usr/libexec usr/sbin usr/share/misc \ usr/share/snmp/defs usr/share/snmp/mibs mkdir -p ${WORLDTMP}/${_dir} .endfor mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ -p ${WORLDTMP}/usr/include >/dev/null ln -sf ${.CURDIR}/sys ${WORLDTMP} .if ${MK_BIND_LIBS} != "no" mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \ -p ${WORLDTMP}/usr/include >/dev/null .endif _legacy: @echo @echo "--------------------------------------------------------------" @echo ">>> stage 1.1: legacy release compatibility shims" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${BMAKE} legacy _bootstrap-tools: @echo @echo "--------------------------------------------------------------" @echo ">>> stage 1.2: bootstrap tools" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools _cleanobj: .if !defined(NO_CLEAN) @echo @echo "--------------------------------------------------------------" @echo ">>> stage 2.1: cleaning up the object tree" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/} .if ${TARGET_ARCH} == "amd64" ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/} .endif .endif _obj: @echo @echo "--------------------------------------------------------------" @echo ">>> stage 2.2: rebuilding the object tree" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj _build-tools: @echo @echo "--------------------------------------------------------------" @echo ">>> stage 2.3: build tools" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools _cross-tools: @echo @echo "--------------------------------------------------------------" @echo ">>> stage 3: cross tools" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools _includes: @echo @echo "--------------------------------------------------------------" @echo ">>> stage 4.1: building includes" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes _libraries: @echo @echo "--------------------------------------------------------------" @echo ">>> stage 4.2: building libraries" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; \ ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE libraries _depend: @echo @echo "--------------------------------------------------------------" @echo ">>> stage 4.3: make dependencies" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend everything: @echo @echo "--------------------------------------------------------------" @echo ">>> stage 4.4: building everything" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${WMAKE} par-all .if ${TARGET_ARCH} == "amd64" build32: @echo @echo "--------------------------------------------------------------" @echo ">>> stage 5.1: building 32 bit shim libraries" @echo "--------------------------------------------------------------" .for _dir in \ lib lib32 usr/bin usr/include usr/lib32 usr/libdata/ldscripts \ usr/libexec usr/sbin usr/share/misc \ usr/share/snmp/defs usr/share/snmp/mibs mkdir -p ${LIB32TMP}/${_dir} .endfor mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ -p ${LIB32TMP}/usr/include >/dev/null mkdir -p ${WORLDTMP} ln -sf ${.CURDIR}/sys ${WORLDTMP} .if ${MK_KERBEROS} != "no" .for _t in obj depend all cd ${.CURDIR}/kerberos5/tools; \ MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= ${_t} .endfor .endif .for _t in obj includes cd ${.CURDIR}/include; ${LIB32WMAKE} ${_t} cd ${.CURDIR}/lib; ${LIB32WMAKE} ${_t} .if ${MK_CDDL} != "no" cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} ${_t} .endif cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} ${_t} .if ${MK_CRYPT} != "no" cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} ${_t} .endif .if ${MK_KERBEROS} != "no" cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} ${_t} .endif .endfor .for _dir in usr.bin/lex/lib cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} obj .endfor .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic cd ${.CURDIR}/${_dir}; \ MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= build-tools .endfor cd ${.CURDIR}; \ ${LIB32WMAKE} -f Makefile.inc1 libraries .for _t in obj depend all cd ${.CURDIR}/libexec/rtld-elf; \ PROG=ld-elf32.so.1 ${LIB32WMAKE} ${_t} .endfor distribute32 install32: .if make(distribute32) mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32 # XXX add to mtree .else mkdir -p ${DESTDIR}/usr/lib32 # XXX add to mtree .endif cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} .if ${MK_CRYPT} != "no" cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} .endif cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//} .endif WMAKE_TGTS= .if !defined(SUBDIR_OVERRIDE) WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools .endif WMAKE_TGTS+= _cleanobj _obj _build-tools .if !defined(SUBDIR_OVERRIDE) WMAKE_TGTS+= _cross-tools .endif WMAKE_TGTS+= _includes _libraries _depend everything .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no" WMAKE_TGTS+= build32 .endif buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue buildworld_prologue: @echo "--------------------------------------------------------------" @echo ">>> World build started on `LC_ALL=C date`" @echo "--------------------------------------------------------------" buildworld_epilogue: @echo @echo "--------------------------------------------------------------" @echo ">>> World build completed on `LC_ALL=C date`" @echo "--------------------------------------------------------------" # # We need to have this as a target because the indirection between Makefile # and Makefile.inc1 causes the correct PATH to be used, rather than a # modification of the current environment's PATH. In addition, we need # to quote multiword values. # buildenvvars: @echo ${WMAKEENV:Q} buildenv: @echo Entering world for ${TARGET_ARCH}:${TARGET} @cd ${.CURDIR} && env ${WMAKEENV} sh || true TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32} toolchain: ${TOOLCHAIN_TGTS} kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries} # # installcheck # # Checks to be sure system is ready for installworld/installkernel. # installcheck: # # Require DESTDIR to be set if installing for a different architecture. # .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} .if !make(distributeworld) installcheck: installcheck_DESTDIR installcheck_DESTDIR: .if !defined(DESTDIR) || empty(DESTDIR) @echo "ERROR: Please set DESTDIR!"; \ false .endif .endif .endif # # Check for missing UIDs/GIDs. # CHECK_UIDS= CHECK_GIDS= audit .if ${MK_SENDMAIL} != "no" CHECK_UIDS+= smmsp CHECK_GIDS+= smmsp .endif .if ${MK_PF} != "no" CHECK_UIDS+= proxy CHECK_GIDS+= proxy authpf .endif installcheck: installcheck_UGID installcheck_UGID: .for uid in ${CHECK_UIDS} @if ! `id -u ${uid} >/dev/null 2>&1`; then \ echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \ false; \ fi .endfor .for gid in ${CHECK_GIDS} @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \ echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \ false; \ fi .endfor # # distributeworld # # Distributes everything compiled by a `buildworld'. # # installworld # # Installs everything compiled by a 'buildworld'. # distributeworld installworld: installcheck mkdir -p ${INSTALLTMP} for prog in [ awk cap_mkdb cat chflags chmod chown \ date echo egrep find grep install-info \ ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \ test true uname wc zic; do \ cp `which $$prog` ${INSTALLTMP}; \ done ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//} rm -rf ${INSTALLTMP} # # reinstall # # If you have a build server, you can NFS mount the source and obj directories # and do a 'make reinstall' on the *client* to install new binaries from the # most recent server build. # reinstall: @echo "--------------------------------------------------------------" @echo ">>> Making hierarchy" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy @echo @echo "--------------------------------------------------------------" @echo ">>> Installing everything" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no" ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32 .endif redistribute: @echo "--------------------------------------------------------------" @echo ">>> Distributing everything" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no" ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 DISTRIBUTION=lib32 .endif distrib-dirs distribution: cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET} # # buildkernel and installkernel # # Which kernels to build and/or install is specified by setting # KERNCONF. If not defined a GENERIC kernel is built/installed. # Only the existing (depending TARGET) config files are used # for building kernels and only the first of these is designated # as the one being installed. # # Note that we have to use TARGET instead of TARGET_ARCH when # we're in kernel-land. Since only TARGET_ARCH is (expected) to # be set to cross-build, we have to make sure TARGET is set # properly. .if !defined(KERNCONF) && defined(KERNEL) KERNCONF= ${KERNEL} KERNWARN= .else KERNCONF?= GENERIC .endif INSTKERNNAME?= kernel KERNSRCDIR?= ${.CURDIR}/sys KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR} KERNCONFDIR?= ${KRNLCONFDIR} BUILDKERNELS= INSTALLKERNEL= .for _kernel in ${KERNCONF} .if exists(${KERNCONFDIR}/${_kernel}) BUILDKERNELS+= ${_kernel} .if empty(INSTALLKERNEL) INSTALLKERNEL= ${_kernel} .endif .endif .endfor # # buildkernel # # Builds all kernels defined by BUILDKERNELS. # buildkernel: .if empty(BUILDKERNELS) @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ false .endif .if defined(KERNWARN) @echo "--------------------------------------------------------------" @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" @echo "--------------------------------------------------------------" @sleep 3 .endif @echo .for _kernel in ${BUILDKERNELS} @echo "--------------------------------------------------------------" @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" @echo "--------------------------------------------------------------" @echo "===> ${_kernel}" mkdir -p ${KRNLOBJDIR} .if !defined(NO_KERNELCONFIG) @echo @echo "--------------------------------------------------------------" @echo ">>> stage 1: configuring the kernel" @echo "--------------------------------------------------------------" cd ${KRNLCONFDIR}; \ PATH=${TMPPATH} \ config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ ${KERNCONFDIR}/${_kernel} .endif .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) @echo @echo "--------------------------------------------------------------" @echo ">>> stage 2.1: cleaning up the object tree" @echo "--------------------------------------------------------------" cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} .endif @echo @echo "--------------------------------------------------------------" @echo ">>> stage 2.2: rebuilding the object tree" @echo "--------------------------------------------------------------" cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj @echo @echo "--------------------------------------------------------------" @echo ">>> stage 2.3: build tools" @echo "--------------------------------------------------------------" cd ${KRNLOBJDIR}/${_kernel}; \ MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) .for target in obj depend all cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \ MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ ${MAKE} -DNO_CPU_CFLAGS ${target} .endfor .endif .if !defined(NO_KERNELDEPEND) @echo @echo "--------------------------------------------------------------" @echo ">>> stage 3.1: making dependencies" @echo "--------------------------------------------------------------" cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ .endif @echo @echo "--------------------------------------------------------------" @echo ">>> stage 3.2: building everything" @echo "--------------------------------------------------------------" cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ @echo "--------------------------------------------------------------" @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" @echo "--------------------------------------------------------------" .endfor # # installkernel, etc. # # Install the kernel defined by INSTALLKERNEL # installkernel installkernel.debug \ reinstallkernel reinstallkernel.debug: installcheck .if empty(INSTALLKERNEL) @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ false .endif @echo "--------------------------------------------------------------" @echo ">>> Installing kernel" @echo "--------------------------------------------------------------" cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ ${CROSSENV} PATH=${TMPPATH} \ ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} # # doxygen # # Build the API documentation with doxygen # doxygen: @if [ ! -x `/usr/bin/which doxygen` ]; then \ echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ exit 1; \ fi cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all # # update # # Update the source tree, by running cvsup and/or running cvs to update to the # latest copy. # update: .if defined(SUP_UPDATE) @echo "--------------------------------------------------------------" @echo ">>> Running ${SUP}" @echo "--------------------------------------------------------------" .if defined(SUPFILE) @${SUP} ${SUPFLAGS} ${SUPFILE} .endif .if defined(SUPFILE1) @${SUP} ${SUPFLAGS} ${SUPFILE1} .endif .if defined(SUPFILE2) @${SUP} ${SUPFLAGS} ${SUPFILE2} .endif .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE) @${SUP} ${SUPFLAGS} ${PORTSSUPFILE} .endif .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE) @${SUP} ${SUPFLAGS} ${DOCSUPFILE} .endif .endif .if defined(CVS_UPDATE) @echo "--------------------------------------------------------------" @echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} @echo "--------------------------------------------------------------" cd ${.CURDIR}; ${CVS} -R -q update ${CVSFLAGS} .endif # # ------------------------------------------------------------------------ # # From here onwards are utility targets used by the 'make world' and # related targets. If your 'world' breaks, you may like to try to fix # the problem and manually run the following targets to attempt to # complete the build. Beware, this is *not* guaranteed to work, you # need to have a pretty good grip on the current state of the system # to attempt to manually finish it. If in doubt, 'make world' again. # # # legacy: Build compatibility shims for the next three targets # legacy: .if ${BOOTSTRAPPING} < 503000 @echo "ERROR: Source upgrades from versions prior to 5.3 not supported."; \ false .endif .for _tool in tools/build ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \ cd ${.CURDIR}/${_tool}; \ ${MAKE} DIRPRFX=${_tool}/ obj; \ ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ ${MAKE} DIRPRFX=${_tool}/ depend; \ ${MAKE} DIRPRFX=${_tool}/ all; \ ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install .endfor # # bootstrap-tools: Build tools needed for compatibility # .if ${MK_GAMES} != "no" _strfile= games/fortune/strfile .endif .if ${MK_CXX} != "no" _gperf= gnu/usr.bin/gperf .if ${BOOTSTRAPPING} < 700004 _groff= gnu/usr.bin/groff .else _groff= gnu/usr.bin/groff/tmac .endif .endif .if ${BOOTSTRAPPING} < 600029 _texinfo= gnu/usr.bin/texinfo .endif .if ${BOOTSTRAPPING} < 600015 _cap_mkdb= usr.bin/cap_mkdb .endif .if ${BOOTSTRAPPING} < 600018 _colldef= usr.bin/colldef .endif .if ${BOOTSTRAPPING} < 600017 _gencat= usr.bin/gencat .endif .if ${BOOTSTRAPPING} < 600016 _mklocale= usr.bin/mklocale .endif .if ${BOOTSTRAPPING} < 700018 _gensnmptree= usr.sbin/bsnmpd/gensnmptree .endif .if ${MK_RESCUE} != "no" && \ ${BOOTSTRAPPING} < 700026 _crunchgen= usr.sbin/crunch/crunchgen .endif .if ${BOOTSTRAPPING} < 600020 _pwd_mkdb= usr.sbin/pwd_mkdb .endif bootstrap-tools: .for _tool in \ ${_strfile} \ ${_gperf} \ ${_groff} \ ${_texinfo} \ ${_cap_mkdb} \ ${_colldef} \ ${_gencat} \ usr.bin/lorder \ usr.bin/makewhatis \ ${_mklocale} \ usr.bin/rpcgen \ usr.bin/xinstall \ ${_gensnmptree} \ usr.sbin/config \ ${_crunchgen} \ ${_pwd_mkdb} ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ cd ${.CURDIR}/${_tool}; \ ${MAKE} DIRPRFX=${_tool}/ obj; \ ${MAKE} DIRPRFX=${_tool}/ depend; \ ${MAKE} DIRPRFX=${_tool}/ all; \ ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install .endfor # # build-tools: Build special purpose build tools # .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules) _aicasm= sys/modules/aic7xxx/aicasm .endif .if !defined(NO_SHARE) _share= share/syscons/scrnmaps .endif .if ${MK_KERBEROS} != "no" _kerberos5_tools= kerberos5/tools .endif .if ${MK_RESCUE} != "no" _rescue= rescue/rescue .endif build-tools: .for _tool in \ bin/csh \ bin/sh \ ${_rescue} \ lib/ncurses/ncurses \ lib/ncurses/ncursesw \ ${_share} \ ${_aicasm} \ usr.bin/awk \ lib/libmagic \ usr.sbin/sysinstall ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ cd ${.CURDIR}/${_tool}; \ ${MAKE} DIRPRFX=${_tool}/ obj; \ ${MAKE} DIRPRFX=${_tool}/ build-tools .endfor .for _tool in \ gnu/usr.bin/cc/cc_tools \ ${_kerberos5_tools} ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \ cd ${.CURDIR}/${_tool}; \ ${MAKE} DIRPRFX=${_tool}/ obj; \ ${MAKE} DIRPRFX=${_tool}/ depend; \ ${MAKE} DIRPRFX=${_tool}/ all .endfor # # cross-tools: Build cross-building tools # .if ${TARGET_ARCH} != ${MACHINE_ARCH} .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" _btxld= usr.sbin/btxld .endif .if ${MK_RESCUE} != "no" || defined(RELEASEDIR) _crunchide= usr.sbin/crunch/crunchide .endif .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR) _kgzip= usr.sbin/kgzip .endif .endif cross-tools: .for _tool in \ gnu/usr.bin/binutils \ gnu/usr.bin/cc \ usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ ${_btxld} \ ${_crunchide} \ ${_kgzip} ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ cd ${.CURDIR}/${_tool}; \ ${MAKE} DIRPRFX=${_tool}/ obj; \ ${MAKE} DIRPRFX=${_tool}/ depend; \ ${MAKE} DIRPRFX=${_tool}/ all; \ ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install .endfor # # hierarchy - ensure that all the needed directories are present # hierarchy: cd ${.CURDIR}/etc; ${MAKE} distrib-dirs # # libraries - build all libraries, and install them under ${DESTDIR}. # # The list of libraries with dependents (${_prebuild_libs}) and their # interdependencies (__L) are built automatically by the # ${.CURDIR}/tools/make_libdeps.sh script. # libraries: cd ${.CURDIR}; \ ${MAKE} -f Makefile.inc1 _startup_libs; \ ${MAKE} -f Makefile.inc1 _prebuild_libs; \ ${MAKE} -f Makefile.inc1 _generic_libs; # These dependencies are not automatically generated: # # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all # shared libraries for ELF. # _startup_libs= gnu/lib/csu gnu/lib/libgcc .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) _startup_libs+= lib/csu/${MACHINE_ARCH}-elf .else _startup_libs+= lib/csu/${MACHINE_ARCH} .endif _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libkrb5} \ ${_kerberos5_lib_libroken} \ lib/libbz2 lib/libcom_err lib/libcrypt lib/libexpat \ ${_lib_libgssapi} ${_lib_libipx} \ lib/libkiconv lib/libkvm lib/libmd \ lib/ncurses/ncurses lib/ncurses/ncursesw \ - lib/libopie lib/libpam lib/libpthread \ + lib/libopie lib/libpam lib/${DEFAULT_THREAD_LIB} \ lib/libradius lib/libsbuf lib/libtacplus lib/libutil \ ${_lib_libypclnt} lib/libz lib/msun \ ${_secure_lib_libcrypto} ${_secure_lib_libssh} \ ${_secure_lib_libssl} _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib lib/libopie__L lib/libtacplus__L: lib/libmd__L .if ${MK_CDDL} != "no" _cddl_lib= cddl/lib .endif .if ${MK_CRYPT} != "no" .if ${MK_OPENSSL} != "no" _secure_lib_libcrypto= secure/lib/libcrypto _secure_lib_libssl= secure/lib/libssl lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L .if ${MK_OPENSSH} != "no" _secure_lib_libssh= secure/lib/libssh secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L .if ${MK_KERBEROS} != "no" secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ kerberos5/lib/libasn1__L lib/libcom_err__L lib/libmd__L \ kerberos5/lib/libroken__L .endif .endif .endif _secure_lib= secure/lib .endif .if ${MK_IPX} != "no" _lib_libipx= lib/libipx .endif .if ${MK_KERBEROS} != "no" _kerberos5_lib= kerberos5/lib _kerberos5_lib_libasn1= kerberos5/lib/libasn1 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 _kerberos5_lib_libroken= kerberos5/lib/libroken _lib_libgssapi= lib/libgssapi .endif .if ${MK_NIS} != "no" _lib_libypclnt= lib/libypclnt .endif .if ${MK_OPENSSL} == "no" lib/libradius__L: lib/libmd__L .endif .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs} ${_lib}__L: .PHONY .if exists(${.CURDIR}/${_lib}) ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ cd ${.CURDIR}/${_lib}; \ ${MAKE} DIRPRFX=${_lib}/ obj; \ ${MAKE} DIRPRFX=${_lib}/ depend; \ ${MAKE} DIRPRFX=${_lib}/ all; \ ${MAKE} DIRPRFX=${_lib}/ install .endif .endfor # libpam is special: we need to build static PAM modules before # static PAM library, and dynamic PAM library before dynamic PAM # modules. lib/libpam__L: .PHONY ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \ cd ${.CURDIR}/lib/libpam; \ ${MAKE} DIRPRFX=lib/libpam/ obj; \ ${MAKE} DIRPRFX=lib/libpam/ depend; \ ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \ ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install _startup_libs: ${_startup_libs:S/$/__L/} _prebuild_libs: ${_prebuild_libs:S/$/__L/} _generic_libs: ${_generic_libs:S/$/__L/} .for __target in all clean cleandepend cleandir depend includes obj .for entry in ${SUBDIR} ${entry}.${__target}__D: .PHONY ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \ edir=${entry}.${MACHINE_ARCH}; \ cd ${.CURDIR}/$${edir}; \ else \ ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \ edir=${entry}; \ cd ${.CURDIR}/$${edir}; \ fi; \ ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ .endfor par-${__target}: ${SUBDIR:S/$/.${__target}__D/} .endfor .include .if make(delete-old) || make(delete-old-libs) || make(check-old) # # check for / delete old files section # .include "ObsoleteFiles.inc" OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ else you can not start such an application. Consult UPDATING for more \ information regarding how to cope with the removal/revision bump of a \ specific library." .if !defined(BATCH_DELETE_OLD_FILES) RM_I=-i .else RM_I=-v .endif delete-old-files: @echo ">>> Removing old files (only deletes safe to delete libs)" .for file in ${OLD_FILES} # Ask for every old file if the user really wants to remove it. # It's annoying, but better safe than sorry. @if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then \ rm ${RM_I} "${DESTDIR}/${file}" || true; \ if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then\ echo "Removing schg flag on ${DESTDIR}/${file}"; \ chflags noschg "${DESTDIR}/${file}"; \ rm ${RM_I} "${DESTDIR}/${file}"; \ fi; \ fi .endfor # Remove catpages without corresponding manpages. @3<&0; \ find ${DESTDIR}/usr/share/man/cat* ! -type d | \ sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ while read catpage; do \ read manpage; \ if [ ! -e "$${manpage}" ]; then \ rm ${RM_I} $${catpage} <&3 ; \ fi; \ done @echo ">>> Old files removed" check-old-files: @echo ">>> Checking for old files" .for file in ${OLD_FILES} @if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then \ echo "${DESTDIR}/${file}"; \ fi .endfor # Check for catpages without corresponding manpages. @find ${DESTDIR}/usr/share/man/cat* ! -type d | \ sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ while read catpage; do \ read manpage; \ if [ ! -e "$${manpage}" ]; then \ echo $${catpage} ; \ fi; \ done delete-old-libs: @echo ">>> Removing old libraries" @echo "${OLD_LIBS_MESSAGE}" | fmt .for file in ${OLD_LIBS} @if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then \ rm ${RM_I} "${DESTDIR}/${file}" || true; \ if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then\ echo "Removing schg flag on ${DESTDIR}/${file}"; \ chflags noschg "${DESTDIR}/${file}"; \ rm ${RM_I} "${DESTDIR}/${file}"; \ fi; \ fi .endfor @echo ">>> Old libraries removed" check-old-libs: @echo ">>> Checking for old libraries" .for file in ${OLD_LIBS} @if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then \ echo "${DESTDIR}/${file}"; \ fi .endfor delete-old-dirs: @echo ">>> Removing old directories" .for dir in ${OLD_DIRS} # Don't fail if an old directory isn't empty. @if [ -d "${DESTDIR}/${dir}" ]; then \ rmdir -v "${DESTDIR}/${dir}" || true; \ else \ if [ -L "${DESTDIR}/${dir}" ]; then \ echo "${DESTDIR}/${dir} is a link, please remove everything manually."; \ fi; \ fi .endfor @echo ">>> Old directories removed" check-old-dirs: @echo ">>> Checking for old directories" .for dir in ${OLD_DIRS} @if [ -d "${DESTDIR}/${dir}" ]; then \ echo "${DESTDIR}/${dir}"; \ else \ if [ -L "${DESTDIR}/${dir}" ]; then \ echo "${DESTDIR}/${dir} is a link, please remove everything manually."; \ fi; \ fi .endfor delete-old: delete-old-files delete-old-dirs @echo "To remove old libraries run '${MAKE} delete-old-libs'." check-old: check-old-files check-old-libs check-old-dirs @echo "To remove old files and directories run '${MAKE} delete-old'." @echo "To remove old libraries run '${MAKE} delete-old-libs'." .endif # # showconfig - show build configuration. # showconfig: @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort Index: head/lib/libc/Makefile =================================================================== --- head/lib/libc/Makefile (revision 169523) +++ head/lib/libc/Makefile (revision 169524) @@ -1,119 +1,117 @@ # @(#)Makefile 8.2 (Berkeley) 2/3/94 # $FreeBSD$ SHLIBDIR?= /lib .include # All library objects contain FreeBSD revision strings by default; they may be # excluded as a space-saving measure. To produce a library that does # not contain these strings, add -DSTRIP_FBSDID (see ) to CFLAGS # below. Note: there are no IDs for syscall stubs whose sources are generated. # To include legacy CSRG sccsid strings, add -DLIBC_SCCS and -DSYSLIBC_SCCS # to CFLAGS below. -DSYSLIBC_SCCS affects just the system call stubs. LIB=c SHLIB_MAJOR= 7 WARNS?= 2 CFLAGS+=-I${.CURDIR}/include -I${.CURDIR}/../../include CFLAGS+=-I${.CURDIR}/${MACHINE_ARCH} CLEANFILES+=tags INSTALL_PIC_ARCHIVE= PRECIOUSLIB= # Define (empty) variables so that make doesn't give substitution # errors if the included makefiles don't change these: MDSRCS= MISRCS= MDASM= MIASM= NOASM= .include "${.CURDIR}/${MACHINE_ARCH}/Makefile.inc" .include "${.CURDIR}/db/Makefile.inc" .include "${.CURDIR}/compat-43/Makefile.inc" .include "${.CURDIR}/gdtoa/Makefile.inc" .include "${.CURDIR}/gen/Makefile.inc" .include "${.CURDIR}/gmon/Makefile.inc" .include "${.CURDIR}/inet/Makefile.inc" .include "${.CURDIR}/isc/Makefile.inc" .include "${.CURDIR}/locale/Makefile.inc" .include "${.CURDIR}/nameser/Makefile.inc" .include "${.CURDIR}/net/Makefile.inc" .include "${.CURDIR}/nls/Makefile.inc" .include "${.CURDIR}/posix1e/Makefile.inc" .if ${MACHINE_ARCH} != "amd64" && \ ${MACHINE_ARCH} != "ia64" && \ ${MACHINE_ARCH} != "sparc64" .include "${.CURDIR}/quad/Makefile.inc" .endif .include "${.CURDIR}/regex/Makefile.inc" .include "${.CURDIR}/resolv/Makefile.inc" .include "${.CURDIR}/stdio/Makefile.inc" .include "${.CURDIR}/stdlib/Makefile.inc" .include "${.CURDIR}/stdtime/Makefile.inc" .include "${.CURDIR}/string/Makefile.inc" .include "${.CURDIR}/sys/Makefile.inc" .include "${.CURDIR}/rpc/Makefile.inc" .include "${.CURDIR}/uuid/Makefile.inc" .include "${.CURDIR}/xdr/Makefile.inc" .if ${MACHINE_ARCH} == "arm" .include "${.CURDIR}/softfloat/Makefile.inc" .endif .if ${MK_NIS} != "no" CFLAGS+= -DYP .include "${.CURDIR}/yp/Makefile.inc" .endif .if ${MK_HESIOD} != "no" CFLAGS+= -DHESIOD .endif .if ${MK_FP_LIBC} == "no" CFLAGS+= -DNO_FLOATING_POINT .endif .if ${MK_NS_CACHING} != "no" CFLAGS+= -DNS_CACHING .endif .if defined(_FREEFALL_CONFIG) CFLAGS+=-D_FREEFALL_CONFIG .endif -.if defined(SYMVER_ENABLED) VERSION_DEF=${.CURDIR}/Versions.def SYMBOL_MAPS=${SYM_MAPS} CFLAGS+= -DSYMBOL_VERSIONING -.endif # If there are no machine dependent sources, append all the # machine-independent sources: .if empty(MDSRCS) SRCS+= ${MISRCS} .else # Append machine-dependent sources, then append machine-independent sources # for which there is no machine-dependent variant. SRCS+= ${MDSRCS} .for _src in ${MISRCS} .if ${MDSRCS:R:M${_src:R}} == "" SRCS+= ${_src} .endif .endfor .endif KQSRCS= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \ lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \ subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c KSRCS= bcmp.c ffs.c ffsl.c fls.c flsl.c index.c mcount.c rindex.c \ strcat.c strcmp.c strcpy.c strlen.c strncpy.c libkern: libkern.gen libkern.${MACHINE_ARCH} libkern.gen: ${KQSRCS} ${KSRCS} cp -p ${.CURDIR}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern libkern.${MACHINE_ARCH}:: ${KMSRCS} .if defined(KMSRCS) && !empty(KMSRCS) cp -p ${.ALLSRC} ${DESTDIR}/sys/libkern/${MACHINE_ARCH} .endif .include # Disable warnings in contributed sources. CWARNFLAGS:= ${.IMPSRC:Ngdtoa_*.c:C/^.+$/${CWARNFLAGS}/} Index: head/lib/libc_r/Makefile =================================================================== --- head/lib/libc_r/Makefile (revision 169523) +++ head/lib/libc_r/Makefile (revision 169524) @@ -1,38 +1,45 @@ # $FreeBSD$ # # All library objects contain FreeBSD revision strings by default; they may be # excluded as a space-saving measure. To produce a library that does # not contain these strings, add -DSTRIP_FBSDID (see ) to CFLAGS # below. Note, there are no IDs for syscall stubs whose sources are generated. # To included legacy CSRG sccsid strings, add -DLIBC_SCCS and -DSYSLIBC_SCCS # (for system call stubs) to CFLAGS below. -DSYSLIBC_SCCS affects just the # system call stubs. + +.if defined(DEFAULT_THREAD_LIB) && (${DEFAULT_THREAD_LIB} == "libc_r") +SHLIBDIR?= /lib +.endif + +.include + LIB=c_r SHLIB_MAJOR= 6 CFLAGS+=-DPTHREAD_KERNEL CFLAGS+=-I${.CURDIR}/../libc/include -I${.CURDIR}/uthread \ -I${.CURDIR}/../../include # Uncomment this if you want libc_r to contain debug information for # thread locking. CFLAGS+=-D_LOCK_DEBUG # enable extra internal consistancy checks CFLAGS+=-D_PTHREADS_INVARIANTS PRECIOUSLIB= .include "${.CURDIR}/uthread/Makefile.inc" .include "${.CURDIR}/sys/Makefile.inc" -.if ${MACHINE_ARCH} == "sparc64" +.if ${DEFAULT_THREAD_LIB} == "libc_r" SYMLINKS+=lib${LIB}.a ${LIBDIR}/libpthread.a .if !defined(NO_PIC) SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthread.so .endif .if ${MK_PROFILE} != "no" SYMLINKS+=lib${LIB}_p.a ${LIBDIR}/libpthread_p.a .endif .endif .include Index: head/lib/libkse/Makefile =================================================================== --- head/lib/libkse/Makefile (revision 169523) +++ head/lib/libkse/Makefile (revision 169524) @@ -1,54 +1,59 @@ # $FreeBSD$ # # All library objects contain FreeBSD revision strings by default; they may be # excluded as a space-saving measure. To produce a library that does # not contain these strings, add -DSTRIP_FBSDID (see ) to CFLAGS # below. Note, there are no IDs for syscall stubs whose sources are generated. # To included legacy CSRG sccsid strings, add -DLIBC_SCCS and -DSYSLIBC_SCCS # (for system call stubs) to CFLAGS below. -DSYSLIBC_SCCS affects just the # system call stubs. -.if ${MACHINE_ARCH} == "sparc64" -LIB=kse -.else -LIB=pthread + +.if defined(DEFAULT_THREAD_LIB) && (${DEFAULT_THREAD_LIB} == "libpthread") SHLIBDIR?= /lib .endif + +.include + +LIB=kse SHLIB_MAJOR= 2 CFLAGS+=-DPTHREAD_KERNEL CFLAGS+=-I${.CURDIR}/../libc/include -I${.CURDIR}/thread \ -I${.CURDIR}/../../include CFLAGS+=-I${.CURDIR}/arch/${MACHINE_ARCH}/include CFLAGS+=-I${.CURDIR}/sys CFLAGS+=-I${.CURDIR}/../../libexec/rtld-elf CFLAGS+=-I${.CURDIR}/../../libexec/rtld-elf/${MACHINE_ARCH} CFLAGS+=-fno-builtin # Uncomment this if you want libpthread to contain debug information for # thread locking. CFLAGS+=-D_LOCK_DEBUG WARNS?=2 # Uncomment this if you want to build a 1:1 threading mode library # however it is no longer strictly conformed to POSIX # CFLAGS+=-DSYSTEM_SCOPE_ONLY # Enable extra internal consistancy checks. CFLAGS+=-D_PTHREADS_INVARIANTS -Wall VERSION_MAP=${.CURDIR}/pthread.map -.if defined(SYMVER_ENABLED) -# Remove this if library version is bumped and LIBPTHREAD_1_0 -# compatability hacks are removed (see thread/thr_private.h). -LDFLAGS+=-Wl,-zmuldefs -CFLAGS+=-DSYMBOL_VERSIONING -.endif - PRECIOUSLIB= .include "${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.inc" .include "${.CURDIR}/support/Makefile.inc" .include "${.CURDIR}/sys/Makefile.inc" .include "${.CURDIR}/thread/Makefile.inc" + +.if ${DEFAULT_THREAD_LIB} == "libpthread" +SYMLINKS+=lib${LIB}.a ${LIBDIR}/libpthread.a +.if !defined(NO_PIC) +SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthread.so +.endif +.if ${MK_PROFILE} != "no" +SYMLINKS+=lib${LIB}_p.a ${LIBDIR}/libpthread_p.a +.endif +.endif .include Index: head/lib/libkse/thread/thr_private.h =================================================================== --- head/lib/libkse/thread/thr_private.h (revision 169523) +++ head/lib/libkse/thread/thr_private.h (revision 169524) @@ -1,1324 +1,1324 @@ /* * Copyright (c) 1995-1998 John Birrell . * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the author nor the names of any co-contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Private thread definitions for the uthread kernel. * * $FreeBSD$ */ #ifndef _THR_PRIVATE_H #define _THR_PRIVATE_H /* * Include files. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef LIBTHREAD_DB #include "lock.h" #include "pthread_md.h" #endif /* * Unfortunately, libpthread had symbol versioning before libc. * But now libc has symbol versioning, we need to occupy the * same version namespace in order to override some libc functions. * So in order to avoid breaking binaries requiring symbols from * LIBTHREAD_1_0, we need to provide a compatible interface for * those symbols. */ -#if defined(SYMBOL_VERSIONING) && defined(PIC) +#if 0 #define SYM_LT10(sym) __CONCAT(sym, _lt10) #define SYM_FB10(sym) __CONCAT(sym, _fb10) #define SYM_FBP10(sym) __CONCAT(sym, _fbp10) #define WEAK_REF(sym, alias) __weak_reference(sym, alias) #define SYM_COMPAT(sym, impl, ver) __sym_compat(sym, impl, ver) #define SYM_DEFAULT(sym, impl, ver) __sym_default(sym, impl, ver) #define LT10_COMPAT(sym) \ WEAK_REF(sym, SYM_LT10(sym)); \ SYM_COMPAT(sym, SYM_LT10(sym), LIBTHREAD_1_0) #define LT10_COMPAT_DEFAULT(sym) \ LT10_COMPAT(sym); \ WEAK_REF(sym, SYM_FB10(sym)); \ SYM_DEFAULT(sym, SYM_FB10(sym), FBSD_1.0) #define LT10_COMPAT_PRIVATE(sym) \ LT10_COMPAT(sym); \ WEAK_REF(sym, SYM_FBP10(sym)); \ SYM_DEFAULT(sym, SYM_FBP10(sym), FBSDprivate_1.0) #else #define LT10_COMPAT_DEFAULT(sym) #define LT10_COMPAT_PRIVATE(sym) #endif /* * Evaluate the storage class specifier. */ #ifdef GLOBAL_PTHREAD_PRIVATE #define SCLASS #define SCLASS_PRESET(x...) = x #else #define SCLASS extern #define SCLASS_PRESET(x...) #endif /* * Kernel fatal error handler macro. */ #define PANIC(string) _thr_exit(__FILE__, __LINE__, string) /* Output debug messages like this: */ #ifdef STDOUT_FILENO #define stdout_debug(...) _thread_printf(STDOUT_FILENO, __VA_ARGS__) #endif #ifdef STDERR_FILENO #define stderr_debug(...) _thread_printf(STDERR_FILENO, __VA_ARGS__) #endif #define DBG_MUTEX 0x0001 #define DBG_SIG 0x0002 #define DBG_INFO_DUMP 0x0004 #ifdef _PTHREADS_INVARIANTS #define THR_ASSERT(cond, msg) do { \ if (!(cond)) \ PANIC(msg); \ } while (0) #else #define THR_ASSERT(cond, msg) #endif /* * State change macro without scheduling queue change: */ #define THR_SET_STATE(thrd, newstate) do { \ (thrd)->state = newstate; \ (thrd)->fname = __FILE__; \ (thrd)->lineno = __LINE__; \ } while (0) #define TIMESPEC_ADD(dst, src, val) \ do { \ (dst)->tv_sec = (src)->tv_sec + (val)->tv_sec; \ (dst)->tv_nsec = (src)->tv_nsec + (val)->tv_nsec; \ if ((dst)->tv_nsec >= 1000000000) { \ (dst)->tv_sec++; \ (dst)->tv_nsec -= 1000000000; \ } \ } while (0) #define TIMESPEC_SUB(dst, src, val) \ do { \ (dst)->tv_sec = (src)->tv_sec - (val)->tv_sec; \ (dst)->tv_nsec = (src)->tv_nsec - (val)->tv_nsec; \ if ((dst)->tv_nsec < 0) { \ (dst)->tv_sec--; \ (dst)->tv_nsec += 1000000000; \ } \ } while (0) /* * Priority queues. * * XXX It'd be nice if these were contained in uthread_priority_queue.[ch]. */ typedef struct pq_list { TAILQ_HEAD(, pthread) pl_head; /* list of threads at this priority */ TAILQ_ENTRY(pq_list) pl_link; /* link for queue of priority lists */ int pl_prio; /* the priority of this list */ int pl_queued; /* is this in the priority queue */ } pq_list_t; typedef struct pq_queue { TAILQ_HEAD(, pq_list) pq_queue; /* queue of priority lists */ pq_list_t *pq_lists; /* array of all priority lists */ int pq_size; /* number of priority lists */ #define PQF_ACTIVE 0x0001 int pq_flags; int pq_threads; } pq_queue_t; /* * Each KSEG has a scheduling queue. For now, threads that exist in their * own KSEG (system scope) will get a full priority queue. In the future * this can be optimized for the single thread per KSEG case. */ struct sched_queue { pq_queue_t sq_runq; TAILQ_HEAD(, pthread) sq_waitq; /* waiting in userland */ }; typedef struct kse_thr_mailbox *kse_critical_t; struct kse_group; #define MAX_KSE_LOCKLEVEL 5 struct kse { /* -- location and order specific items for gdb -- */ struct kcb *k_kcb; struct pthread *k_curthread; /* current thread */ struct kse_group *k_kseg; /* parent KSEG */ struct sched_queue *k_schedq; /* scheduling queue */ /* -- end of location and order specific items -- */ TAILQ_ENTRY(kse) k_qe; /* KSE list link entry */ TAILQ_ENTRY(kse) k_kgqe; /* KSEG's KSE list entry */ /* * Items that are only modified by the kse, or that otherwise * don't need to be locked when accessed */ struct lock k_lock; struct lockuser k_lockusers[MAX_KSE_LOCKLEVEL]; int k_locklevel; stack_t k_stack; int k_flags; #define KF_STARTED 0x0001 /* kernel kse created */ #define KF_INITIALIZED 0x0002 /* initialized on 1st upcall */ #define KF_TERMINATED 0x0004 /* kse is terminated */ #define KF_IDLE 0x0008 /* kse is idle */ #define KF_SWITCH 0x0010 /* thread switch in UTS */ int k_error; /* syscall errno in critical */ int k_cpu; /* CPU ID when bound */ int k_sigseqno; /* signal buffered count */ }; #define KSE_SET_IDLE(kse) ((kse)->k_flags |= KF_IDLE) #define KSE_CLEAR_IDLE(kse) ((kse)->k_flags &= ~KF_IDLE) #define KSE_IS_IDLE(kse) (((kse)->k_flags & KF_IDLE) != 0) #define KSE_SET_SWITCH(kse) ((kse)->k_flags |= KF_SWITCH) #define KSE_CLEAR_SWITCH(kse) ((kse)->k_flags &= ~KF_SWITCH) #define KSE_IS_SWITCH(kse) (((kse)->k_flags & KF_SWITCH) != 0) /* * Each KSE group contains one or more KSEs in which threads can run. * At least for now, there is one scheduling queue per KSE group; KSEs * within the same KSE group compete for threads from the same scheduling * queue. A scope system thread has one KSE in one KSE group; the group * does not use its scheduling queue. */ struct kse_group { TAILQ_HEAD(, kse) kg_kseq; /* list of KSEs in group */ TAILQ_HEAD(, pthread) kg_threadq; /* list of threads in group */ TAILQ_ENTRY(kse_group) kg_qe; /* link entry */ struct sched_queue kg_schedq; /* scheduling queue */ struct lock kg_lock; int kg_threadcount; /* # of assigned threads */ int kg_ksecount; /* # of assigned KSEs */ int kg_idle_kses; int kg_flags; #define KGF_SINGLE_THREAD 0x0001 /* scope system kse group */ #define KGF_SCHEDQ_INITED 0x0002 /* has an initialized schedq */ }; /* * Add/remove threads from a KSE's scheduling queue. * For now the scheduling queue is hung off the KSEG. */ #define KSEG_THRQ_ADD(kseg, thr) \ do { \ TAILQ_INSERT_TAIL(&(kseg)->kg_threadq, thr, kle);\ (kseg)->kg_threadcount++; \ } while (0) #define KSEG_THRQ_REMOVE(kseg, thr) \ do { \ TAILQ_REMOVE(&(kseg)->kg_threadq, thr, kle); \ (kseg)->kg_threadcount--; \ } while (0) /* * Lock acquire and release for KSEs. */ #define KSE_LOCK_ACQUIRE(kse, lck) \ do { \ if ((kse)->k_locklevel < MAX_KSE_LOCKLEVEL) { \ (kse)->k_locklevel++; \ _lock_acquire((lck), \ &(kse)->k_lockusers[(kse)->k_locklevel - 1], 0); \ } \ else \ PANIC("Exceeded maximum lock level"); \ } while (0) #define KSE_LOCK_RELEASE(kse, lck) \ do { \ if ((kse)->k_locklevel > 0) { \ _lock_release((lck), \ &(kse)->k_lockusers[(kse)->k_locklevel - 1]); \ (kse)->k_locklevel--; \ } \ } while (0) /* * Lock our own KSEG. */ #define KSE_LOCK(curkse) \ KSE_LOCK_ACQUIRE(curkse, &(curkse)->k_kseg->kg_lock) #define KSE_UNLOCK(curkse) \ KSE_LOCK_RELEASE(curkse, &(curkse)->k_kseg->kg_lock) /* * Lock a potentially different KSEG. */ #define KSE_SCHED_LOCK(curkse, kseg) \ KSE_LOCK_ACQUIRE(curkse, &(kseg)->kg_lock) #define KSE_SCHED_UNLOCK(curkse, kseg) \ KSE_LOCK_RELEASE(curkse, &(kseg)->kg_lock) /* * Waiting queue manipulation macros (using pqe link): */ #define KSE_WAITQ_REMOVE(kse, thrd) \ do { \ if (((thrd)->flags & THR_FLAGS_IN_WAITQ) != 0) { \ TAILQ_REMOVE(&(kse)->k_schedq->sq_waitq, thrd, pqe); \ (thrd)->flags &= ~THR_FLAGS_IN_WAITQ; \ } \ } while (0) #define KSE_WAITQ_INSERT(kse, thrd) kse_waitq_insert(thrd) #define KSE_WAITQ_FIRST(kse) TAILQ_FIRST(&(kse)->k_schedq->sq_waitq) #define KSE_WAKEUP(kse) kse_wakeup(&(kse)->k_kcb->kcb_kmbx) /* * TailQ initialization values. */ #define TAILQ_INITIALIZER { NULL, NULL } /* * lock initialization values. */ #define LCK_INITIALIZER { NULL, NULL, LCK_DEFAULT } struct pthread_mutex { /* * Lock for accesses to this structure. */ struct lock m_lock; enum pthread_mutextype m_type; int m_protocol; TAILQ_HEAD(mutex_head, pthread) m_queue; struct pthread *m_owner; long m_flags; int m_count; int m_refcount; /* * Used for priority inheritence and protection. * * m_prio - For priority inheritence, the highest active * priority (threads locking the mutex inherit * this priority). For priority protection, the * ceiling priority of this mutex. * m_saved_prio - mutex owners inherited priority before * taking the mutex, restored when the owner * unlocks the mutex. */ int m_prio; int m_saved_prio; /* * Link for list of all mutexes a thread currently owns. */ TAILQ_ENTRY(pthread_mutex) m_qe; }; /* * Flags for mutexes. */ #define MUTEX_FLAGS_PRIVATE 0x01 #define MUTEX_FLAGS_INITED 0x02 #define MUTEX_FLAGS_BUSY 0x04 /* * Static mutex initialization values. */ #define PTHREAD_MUTEX_STATIC_INITIALIZER \ { LCK_INITIALIZER, PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, \ TAILQ_INITIALIZER, NULL, MUTEX_FLAGS_PRIVATE, 0, 0, 0, 0, \ TAILQ_INITIALIZER } struct pthread_mutex_attr { enum pthread_mutextype m_type; int m_protocol; int m_ceiling; long m_flags; }; #define PTHREAD_MUTEXATTR_STATIC_INITIALIZER \ { PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, 0, MUTEX_FLAGS_PRIVATE } /* * Condition variable definitions. */ enum pthread_cond_type { COND_TYPE_FAST, COND_TYPE_MAX }; struct pthread_cond { /* * Lock for accesses to this structure. */ struct lock c_lock; enum pthread_cond_type c_type; TAILQ_HEAD(cond_head, pthread) c_queue; struct pthread_mutex *c_mutex; long c_flags; long c_seqno; }; struct pthread_cond_attr { enum pthread_cond_type c_type; long c_flags; }; struct pthread_barrier { pthread_mutex_t b_lock; pthread_cond_t b_cond; int b_count; int b_waiters; int b_generation; }; struct pthread_barrierattr { int pshared; }; struct pthread_spinlock { volatile int s_lock; pthread_t s_owner; }; /* * Flags for condition variables. */ #define COND_FLAGS_PRIVATE 0x01 #define COND_FLAGS_INITED 0x02 #define COND_FLAGS_BUSY 0x04 /* * Static cond initialization values. */ #define PTHREAD_COND_STATIC_INITIALIZER \ { LCK_INITIALIZER, COND_TYPE_FAST, TAILQ_INITIALIZER, \ NULL, NULL, 0, 0 } /* * Cleanup definitions. */ struct pthread_cleanup { struct pthread_cleanup *next; void (*routine) (void *); void *routine_arg; int onstack; }; #define THR_CLEANUP_PUSH(td, func, arg) { \ struct pthread_cleanup __cup; \ \ __cup.routine = func; \ __cup.routine_arg = arg; \ __cup.onstack = 1; \ __cup.next = (td)->cleanup; \ (td)->cleanup = &__cup; #define THR_CLEANUP_POP(td, exec) \ (td)->cleanup = __cup.next; \ if ((exec) != 0) \ __cup.routine(__cup.routine_arg); \ } struct pthread_atfork { TAILQ_ENTRY(pthread_atfork) qe; void (*prepare)(void); void (*parent)(void); void (*child)(void); }; struct pthread_attr { int sched_policy; int sched_inherit; int sched_interval; int prio; int suspend; #define THR_STACK_USER 0x100 /* 0xFF reserved for */ #define THR_SIGNAL_THREAD 0x200 /* This is a signal thread */ int flags; void *arg_attr; void (*cleanup_attr) (void *); void *stackaddr_attr; size_t stacksize_attr; size_t guardsize_attr; }; /* * Thread creation state attributes. */ #define THR_CREATE_RUNNING 0 #define THR_CREATE_SUSPENDED 1 /* * Miscellaneous definitions. */ #define THR_STACK32_DEFAULT (1 * 1024 * 1024) #define THR_STACK64_DEFAULT (2 * 1024 * 1024) /* * Maximum size of initial thread's stack. This perhaps deserves to be larger * than the stacks of other threads, since many applications are likely to run * almost entirely on this stack. */ #define THR_STACK32_INITIAL (2 * 1024 * 1024) #define THR_STACK64_INITIAL (4 * 1024 * 1024) /* * Define the different priority ranges. All applications have thread * priorities constrained within 0-31. The threads library raises the * priority when delivering signals in order to ensure that signal * delivery happens (from the POSIX spec) "as soon as possible". * In the future, the threads library will also be able to map specific * threads into real-time (cooperating) processes or kernel threads. * The RT and SIGNAL priorities will be used internally and added to * thread base priorities so that the scheduling queue can handle both * normal and RT priority threads with and without signal handling. * * The approach taken is that, within each class, signal delivery * always has priority over thread execution. */ #define THR_DEFAULT_PRIORITY 15 #define THR_MIN_PRIORITY 0 #define THR_MAX_PRIORITY 31 /* 0x1F */ #define THR_SIGNAL_PRIORITY 32 /* 0x20 */ #define THR_RT_PRIORITY 64 /* 0x40 */ #define THR_FIRST_PRIORITY THR_MIN_PRIORITY #define THR_LAST_PRIORITY \ (THR_MAX_PRIORITY + THR_SIGNAL_PRIORITY + THR_RT_PRIORITY) #define THR_BASE_PRIORITY(prio) ((prio) & THR_MAX_PRIORITY) /* * Clock resolution in microseconds. */ #define CLOCK_RES_USEC 10000 /* * Time slice period in microseconds. */ #define TIMESLICE_USEC 20000 /* * XXX - Define a thread-safe macro to get the current time of day * which is updated at regular intervals by something. * * For now, we just make the system call to get the time. */ #define KSE_GET_TOD(curkse, tsp) \ do { \ *tsp = (curkse)->k_kcb->kcb_kmbx.km_timeofday; \ if ((tsp)->tv_sec == 0) \ clock_gettime(CLOCK_REALTIME, tsp); \ } while (0) struct pthread_rwlockattr { int pshared; }; struct pthread_rwlock { pthread_mutex_t lock; /* monitor lock */ pthread_cond_t read_signal; pthread_cond_t write_signal; int state; /* 0 = idle >0 = # of readers -1 = writer */ int blocked_writers; }; /* * Thread states. */ enum pthread_state { PS_RUNNING, PS_LOCKWAIT, PS_MUTEX_WAIT, PS_COND_WAIT, PS_SLEEP_WAIT, PS_SIGSUSPEND, PS_SIGWAIT, PS_JOIN, PS_SUSPENDED, PS_DEAD, PS_DEADLOCK, PS_STATE_MAX }; struct sigwait_data { sigset_t *waitset; siginfo_t *siginfo; /* used to save siginfo for sigwaitinfo() */ }; union pthread_wait_data { pthread_mutex_t mutex; pthread_cond_t cond; struct lock *lock; struct sigwait_data *sigwait; }; /* * Define a continuation routine that can be used to perform a * transfer of control: */ typedef void (*thread_continuation_t) (void *); /* * This stores a thread's state prior to running a signal handler. * It is used when a signal is delivered to a thread blocked in * userland. If the signal handler returns normally, the thread's * state is restored from here. */ struct pthread_sigframe { int psf_valid; int psf_flags; int psf_cancelflags; int psf_interrupted; int psf_timeout; int psf_signo; enum pthread_state psf_state; union pthread_wait_data psf_wait_data; struct timespec psf_wakeup_time; sigset_t psf_sigset; sigset_t psf_sigmask; int psf_seqno; thread_continuation_t psf_continuation; }; struct join_status { struct pthread *thread; void *ret; int error; }; struct pthread_specific_elem { const void *data; int seqno; }; struct pthread_key { volatile int allocated; volatile int count; int seqno; void (*destructor) (void *); }; #define MAX_THR_LOCKLEVEL 5 /* * Thread structure. */ struct pthread { /* Thread control block */ struct tcb *tcb; /* * Magic value to help recognize a valid thread structure * from an invalid one: */ #define THR_MAGIC ((u_int32_t) 0xd09ba115) u_int32_t magic; char *name; u_int64_t uniqueid; /* for gdb */ /* Queue entry for list of all threads: */ TAILQ_ENTRY(pthread) tle; /* link for all threads in process */ TAILQ_ENTRY(pthread) kle; /* link for all threads in KSE/KSEG */ /* Queue entry for GC lists: */ TAILQ_ENTRY(pthread) gcle; /* Hash queue entry */ LIST_ENTRY(pthread) hle; /* * Lock for accesses to this thread structure. */ struct lock lock; struct lockuser lockusers[MAX_THR_LOCKLEVEL]; int locklevel; kse_critical_t critical[MAX_KSE_LOCKLEVEL]; struct kse *kse; struct kse_group *kseg; /* * Thread start routine, argument, stack pointer and thread * attributes. */ void *(*start_routine)(void *); void *arg; struct pthread_attr attr; int active; /* thread running */ int blocked; /* thread blocked in kernel */ int need_switchout; /* * Used for tracking delivery of signal handlers. */ siginfo_t *siginfo; thread_continuation_t sigbackout; /* * Cancelability flags - the lower 2 bits are used by cancel * definitions in pthread.h */ #define THR_AT_CANCEL_POINT 0x0004 #define THR_CANCELLING 0x0008 #define THR_CANCEL_NEEDED 0x0010 int cancelflags; thread_continuation_t continuation; /* * The thread's base and pending signal masks. The active * signal mask is stored in the thread's context (in mailbox). */ sigset_t sigmask; sigset_t sigpend; sigset_t *oldsigmask; volatile int check_pending; int refcount; /* Thread state: */ enum pthread_state state; volatile int lock_switch; /* * Number of microseconds accumulated by this thread when * time slicing is active. */ long slice_usec; /* * Time to wake up thread. This is used for sleeping threads and * for any operation which may time out (such as select). */ struct timespec wakeup_time; /* TRUE if operation has timed out. */ int timeout; /* * Error variable used instead of errno. The function __error() * returns a pointer to this. */ int error; /* * The joiner is the thread that is joining to this thread. The * join status keeps track of a join operation to another thread. */ struct pthread *joiner; struct join_status join_status; /* * The current thread can belong to only one scheduling queue at * a time (ready or waiting queue). It can also belong to: * * o A queue of threads waiting for a mutex * o A queue of threads waiting for a condition variable * * It is possible for a thread to belong to more than one of the * above queues if it is handling a signal. A thread may only * enter a mutex or condition variable queue when it is not * being called from a signal handler. If a thread is a member * of one of these queues when a signal handler is invoked, it * must be removed from the queue before invoking the handler * and then added back to the queue after return from the handler. * * Use pqe for the scheduling queue link (both ready and waiting), * sqe for synchronization (mutex, condition variable, and join) * queue links, and qe for all other links. */ TAILQ_ENTRY(pthread) pqe; /* priority, wait queues link */ TAILQ_ENTRY(pthread) sqe; /* synchronization queue link */ /* Wait data. */ union pthread_wait_data data; /* * Set to TRUE if a blocking operation was * interrupted by a signal: */ int interrupted; /* * Set to non-zero when this thread has entered a critical * region. We allow for recursive entries into critical regions. */ int critical_count; /* * Set to TRUE if this thread should yield after leaving a * critical region to check for signals, messages, etc. */ int critical_yield; int sflags; #define THR_FLAGS_IN_SYNCQ 0x0001 /* Miscellaneous flags; only set with scheduling lock held. */ int flags; #define THR_FLAGS_PRIVATE 0x0001 #define THR_FLAGS_IN_WAITQ 0x0002 /* in waiting queue using pqe link */ #define THR_FLAGS_IN_RUNQ 0x0004 /* in run queue using pqe link */ #define THR_FLAGS_EXITING 0x0008 /* thread is exiting */ #define THR_FLAGS_SUSPENDED 0x0010 /* thread is suspended */ /* Thread list flags; only set with thread list lock held. */ #define TLFLAGS_GC_SAFE 0x0001 /* thread safe for cleaning */ #define TLFLAGS_IN_TDLIST 0x0002 /* thread in all thread list */ #define TLFLAGS_IN_GCLIST 0x0004 /* thread in gc list */ int tlflags; /* * Base priority is the user setable and retrievable priority * of the thread. It is only affected by explicit calls to * set thread priority and upon thread creation via a thread * attribute or default priority. */ char base_priority; /* * Inherited priority is the priority a thread inherits by * taking a priority inheritence or protection mutex. It * is not affected by base priority changes. Inherited * priority defaults to and remains 0 until a mutex is taken * that is being waited on by any other thread whose priority * is non-zero. */ char inherited_priority; /* * Active priority is always the maximum of the threads base * priority and inherited priority. When there is a change * in either the base or inherited priority, the active * priority must be recalculated. */ char active_priority; /* Number of priority ceiling or protection mutexes owned. */ int priority_mutex_count; /* Number rwlocks rdlocks held. */ int rdlock_count; /* * Queue of currently owned mutexes. */ TAILQ_HEAD(, pthread_mutex) mutexq; void *ret; struct pthread_specific_elem *specific; int specific_data_count; /* Alternative stack for sigaltstack() */ stack_t sigstk; /* * Current locks bitmap for rtld. */ int rtld_bits; /* Cleanup handlers Link List */ struct pthread_cleanup *cleanup; char *fname; /* Ptr to source file name */ int lineno; /* Source line number. */ }; /* * Critical regions can also be detected by looking at the threads * current lock level. Ensure these macros increment and decrement * the lock levels such that locks can not be held with a lock level * of 0. */ #define THR_IN_CRITICAL(thrd) \ (((thrd)->locklevel > 0) || \ ((thrd)->critical_count > 0)) #define THR_YIELD_CHECK(thrd) \ do { \ if (!THR_IN_CRITICAL(thrd)) { \ if (__predict_false(_libkse_debug)) \ _thr_debug_check_yield(thrd); \ if ((thrd)->critical_yield != 0) \ _thr_sched_switch(thrd); \ if ((thrd)->check_pending != 0) \ _thr_sig_check_pending(thrd); \ } \ } while (0) #define THR_LOCK_ACQUIRE(thrd, lck) \ do { \ if ((thrd)->locklevel < MAX_THR_LOCKLEVEL) { \ THR_DEACTIVATE_LAST_LOCK(thrd); \ (thrd)->locklevel++; \ _lock_acquire((lck), \ &(thrd)->lockusers[(thrd)->locklevel - 1], \ (thrd)->active_priority); \ } else \ PANIC("Exceeded maximum lock level"); \ } while (0) #define THR_LOCK_RELEASE(thrd, lck) \ do { \ if ((thrd)->locklevel > 0) { \ _lock_release((lck), \ &(thrd)->lockusers[(thrd)->locklevel - 1]); \ (thrd)->locklevel--; \ THR_ACTIVATE_LAST_LOCK(thrd); \ if ((thrd)->locklevel == 0) \ THR_YIELD_CHECK(thrd); \ } \ } while (0) #define THR_ACTIVATE_LAST_LOCK(thrd) \ do { \ if ((thrd)->locklevel > 0) \ _lockuser_setactive( \ &(thrd)->lockusers[(thrd)->locklevel - 1], 1); \ } while (0) #define THR_DEACTIVATE_LAST_LOCK(thrd) \ do { \ if ((thrd)->locklevel > 0) \ _lockuser_setactive( \ &(thrd)->lockusers[(thrd)->locklevel - 1], 0); \ } while (0) /* * For now, threads will have their own lock separate from their * KSE scheduling lock. */ #define THR_LOCK(thr) THR_LOCK_ACQUIRE(thr, &(thr)->lock) #define THR_UNLOCK(thr) THR_LOCK_RELEASE(thr, &(thr)->lock) #define THR_THREAD_LOCK(curthrd, thr) THR_LOCK_ACQUIRE(curthrd, &(thr)->lock) #define THR_THREAD_UNLOCK(curthrd, thr) THR_LOCK_RELEASE(curthrd, &(thr)->lock) /* * Priority queue manipulation macros (using pqe link). We use * the thread's kseg link instead of the kse link because a thread * does not (currently) have a statically assigned kse. */ #define THR_RUNQ_INSERT_HEAD(thrd) \ _pq_insert_head(&(thrd)->kseg->kg_schedq.sq_runq, thrd) #define THR_RUNQ_INSERT_TAIL(thrd) \ _pq_insert_tail(&(thrd)->kseg->kg_schedq.sq_runq, thrd) #define THR_RUNQ_REMOVE(thrd) \ _pq_remove(&(thrd)->kseg->kg_schedq.sq_runq, thrd) /* * Macros to insert/remove threads to the all thread list and * the gc list. */ #define THR_LIST_ADD(thrd) do { \ if (((thrd)->tlflags & TLFLAGS_IN_TDLIST) == 0) { \ TAILQ_INSERT_HEAD(&_thread_list, thrd, tle); \ _thr_hash_add(thrd); \ (thrd)->tlflags |= TLFLAGS_IN_TDLIST; \ } \ } while (0) #define THR_LIST_REMOVE(thrd) do { \ if (((thrd)->tlflags & TLFLAGS_IN_TDLIST) != 0) { \ TAILQ_REMOVE(&_thread_list, thrd, tle); \ _thr_hash_remove(thrd); \ (thrd)->tlflags &= ~TLFLAGS_IN_TDLIST; \ } \ } while (0) #define THR_GCLIST_ADD(thrd) do { \ if (((thrd)->tlflags & TLFLAGS_IN_GCLIST) == 0) { \ TAILQ_INSERT_HEAD(&_thread_gc_list, thrd, gcle);\ (thrd)->tlflags |= TLFLAGS_IN_GCLIST; \ _gc_count++; \ } \ } while (0) #define THR_GCLIST_REMOVE(thrd) do { \ if (((thrd)->tlflags & TLFLAGS_IN_GCLIST) != 0) { \ TAILQ_REMOVE(&_thread_gc_list, thrd, gcle); \ (thrd)->tlflags &= ~TLFLAGS_IN_GCLIST; \ _gc_count--; \ } \ } while (0) #define GC_NEEDED() (atomic_load_acq_int(&_gc_count) >= 5) /* * Locking the scheduling queue for another thread uses that thread's * KSEG lock. */ #define THR_SCHED_LOCK(curthr, thr) do { \ (curthr)->critical[(curthr)->locklevel] = _kse_critical_enter(); \ (curthr)->locklevel++; \ KSE_SCHED_LOCK((curthr)->kse, (thr)->kseg); \ } while (0) #define THR_SCHED_UNLOCK(curthr, thr) do { \ KSE_SCHED_UNLOCK((curthr)->kse, (thr)->kseg); \ (curthr)->locklevel--; \ _kse_critical_leave((curthr)->critical[(curthr)->locklevel]); \ } while (0) /* Take the scheduling lock with the intent to call the scheduler. */ #define THR_LOCK_SWITCH(curthr) do { \ (void)_kse_critical_enter(); \ KSE_SCHED_LOCK((curthr)->kse, (curthr)->kseg); \ } while (0) #define THR_UNLOCK_SWITCH(curthr) do { \ KSE_SCHED_UNLOCK((curthr)->kse, (curthr)->kseg);\ } while (0) #define THR_CRITICAL_ENTER(thr) (thr)->critical_count++ #define THR_CRITICAL_LEAVE(thr) do { \ (thr)->critical_count--; \ if (((thr)->critical_yield != 0) && \ ((thr)->critical_count == 0)) { \ (thr)->critical_yield = 0; \ _thr_sched_switch(thr); \ } \ } while (0) #define THR_IS_ACTIVE(thrd) \ ((thrd)->kse != NULL) && ((thrd)->kse->k_curthread == (thrd)) #define THR_IN_SYNCQ(thrd) (((thrd)->sflags & THR_FLAGS_IN_SYNCQ) != 0) #define THR_IS_SUSPENDED(thrd) \ (((thrd)->state == PS_SUSPENDED) || \ (((thrd)->flags & THR_FLAGS_SUSPENDED) != 0)) #define THR_IS_EXITING(thrd) (((thrd)->flags & THR_FLAGS_EXITING) != 0) #define DBG_CAN_RUN(thrd) (((thrd)->tcb->tcb_tmbx.tm_dflags & \ TMDF_SUSPEND) == 0) extern int __isthreaded; static inline int _kse_isthreaded(void) { return (__isthreaded != 0); } /* * Global variables for the pthread kernel. */ SCLASS void *_usrstack SCLASS_PRESET(NULL); SCLASS struct kse *_kse_initial SCLASS_PRESET(NULL); SCLASS struct pthread *_thr_initial SCLASS_PRESET(NULL); /* For debugger */ SCLASS int _libkse_debug SCLASS_PRESET(0); SCLASS int _thread_activated SCLASS_PRESET(0); SCLASS int _thread_scope_system SCLASS_PRESET(0); /* List of all threads: */ SCLASS TAILQ_HEAD(, pthread) _thread_list SCLASS_PRESET(TAILQ_HEAD_INITIALIZER(_thread_list)); /* List of threads needing GC: */ SCLASS TAILQ_HEAD(, pthread) _thread_gc_list SCLASS_PRESET(TAILQ_HEAD_INITIALIZER(_thread_gc_list)); SCLASS int _thread_active_threads SCLASS_PRESET(1); SCLASS TAILQ_HEAD(atfork_head, pthread_atfork) _thr_atfork_list; SCLASS pthread_mutex_t _thr_atfork_mutex; /* Default thread attributes: */ SCLASS struct pthread_attr _pthread_attr_default SCLASS_PRESET({ SCHED_RR, 0, TIMESLICE_USEC, THR_DEFAULT_PRIORITY, THR_CREATE_RUNNING, PTHREAD_CREATE_JOINABLE, NULL, NULL, NULL, /* stacksize */0, /* guardsize */0 }); /* Default mutex attributes: */ SCLASS struct pthread_mutex_attr _pthread_mutexattr_default SCLASS_PRESET({PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, 0, 0 }); /* Default condition variable attributes: */ SCLASS struct pthread_cond_attr _pthread_condattr_default SCLASS_PRESET({COND_TYPE_FAST, 0}); /* Clock resolution in usec. */ SCLASS int _clock_res_usec SCLASS_PRESET(CLOCK_RES_USEC); /* Array of signal actions for this process: */ SCLASS struct sigaction _thread_sigact[_SIG_MAXSIG]; /* * Lock for above count of dummy handlers and for the process signal * mask and pending signal sets. */ SCLASS struct lock _thread_signal_lock; /* Pending signals and mask for this process: */ SCLASS sigset_t _thr_proc_sigpending; SCLASS siginfo_t _thr_proc_siginfo[_SIG_MAXSIG]; SCLASS pid_t _thr_pid SCLASS_PRESET(0); /* Garbage collector lock. */ SCLASS struct lock _gc_lock; SCLASS int _gc_check SCLASS_PRESET(0); SCLASS int _gc_count SCLASS_PRESET(0); SCLASS struct lock _mutex_static_lock; SCLASS struct lock _rwlock_static_lock; SCLASS struct lock _keytable_lock; SCLASS struct lock _thread_list_lock; SCLASS int _thr_guard_default; SCLASS int _thr_stack_default; SCLASS int _thr_stack_initial; SCLASS int _thr_page_size; SCLASS pthread_t _thr_sig_daemon; SCLASS int _thr_debug_flags SCLASS_PRESET(0); /* Undefine the storage class and preset specifiers: */ #undef SCLASS #undef SCLASS_PRESET /* * Function prototype definitions. */ __BEGIN_DECLS int _cond_reinit(pthread_cond_t *); struct kse *_kse_alloc(struct pthread *, int sys_scope); kse_critical_t _kse_critical_enter(void); void _kse_critical_leave(kse_critical_t); int _kse_in_critical(void); void _kse_free(struct pthread *, struct kse *); void _kse_init(void); struct kse_group *_kseg_alloc(struct pthread *); void _kse_lock_wait(struct lock *, struct lockuser *lu); void _kse_lock_wakeup(struct lock *, struct lockuser *lu); void _kse_single_thread(struct pthread *); int _kse_setthreaded(int); void _kseg_free(struct kse_group *); int _mutex_cv_lock(pthread_mutex_t *); int _mutex_cv_unlock(pthread_mutex_t *); void _mutex_notify_priochange(struct pthread *, struct pthread *, int); int _mutex_reinit(struct pthread_mutex *); void _mutex_unlock_private(struct pthread *); void _libpthread_init(struct pthread *); int _pq_alloc(struct pq_queue *, int, int); void _pq_free(struct pq_queue *); int _pq_init(struct pq_queue *); void _pq_remove(struct pq_queue *pq, struct pthread *); void _pq_insert_head(struct pq_queue *pq, struct pthread *); void _pq_insert_tail(struct pq_queue *pq, struct pthread *); struct pthread *_pq_first(struct pq_queue *pq); struct pthread *_pq_first_debug(struct pq_queue *pq); void *_pthread_getspecific(pthread_key_t); int _pthread_key_create(pthread_key_t *, void (*) (void *)); int _pthread_key_delete(pthread_key_t); int _pthread_mutex_destroy(pthread_mutex_t *); int _pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *); int _pthread_mutex_lock(pthread_mutex_t *); int _pthread_mutex_trylock(pthread_mutex_t *); int _pthread_mutex_unlock(pthread_mutex_t *); int _pthread_mutexattr_init(pthread_mutexattr_t *); int _pthread_mutexattr_destroy(pthread_mutexattr_t *); int _pthread_mutexattr_settype(pthread_mutexattr_t *, int); int _pthread_once(pthread_once_t *, void (*) (void)); int _pthread_rwlock_init(pthread_rwlock_t *, const pthread_rwlockattr_t *); int _pthread_rwlock_destroy (pthread_rwlock_t *); struct pthread *_pthread_self(void); int _pthread_setspecific(pthread_key_t, const void *); void _pthread_yield(void); void _pthread_cleanup_push(void (*routine) (void *), void *routine_arg); void _pthread_cleanup_pop(int execute); struct pthread *_thr_alloc(struct pthread *); void _thr_exit(char *, int, char *); void _thr_exit_cleanup(void); void _thr_lock_wait(struct lock *lock, struct lockuser *lu); void _thr_lock_wakeup(struct lock *lock, struct lockuser *lu); void _thr_mutex_reinit(pthread_mutex_t *); int _thr_ref_add(struct pthread *, struct pthread *, int); void _thr_ref_delete(struct pthread *, struct pthread *); void _thr_rtld_init(void); void _thr_rtld_fini(void); int _thr_schedule_add(struct pthread *, struct pthread *); void _thr_schedule_remove(struct pthread *, struct pthread *); void _thr_setrunnable(struct pthread *curthread, struct pthread *thread); struct kse_mailbox *_thr_setrunnable_unlocked(struct pthread *thread); struct kse_mailbox *_thr_sig_add(struct pthread *, int, siginfo_t *); void _thr_sig_dispatch(struct kse *, int, siginfo_t *); int _thr_stack_alloc(struct pthread_attr *); void _thr_stack_free(struct pthread_attr *); void _thr_exit_cleanup(void); void _thr_free(struct pthread *, struct pthread *); void _thr_gc(struct pthread *); void _thr_panic_exit(char *, int, char *); void _thread_cleanupspecific(void); void _thread_dump_info(void); void _thread_printf(int, const char *, ...); void _thr_sched_switch(struct pthread *); void _thr_sched_switch_unlocked(struct pthread *); void _thr_set_timeout(const struct timespec *); void _thr_seterrno(struct pthread *, int); void _thr_sig_handler(int, siginfo_t *, ucontext_t *); void _thr_sig_check_pending(struct pthread *); void _thr_sig_rundown(struct pthread *, ucontext_t *); void _thr_sig_send(struct pthread *pthread, int sig); void _thr_sigframe_restore(struct pthread *thread, struct pthread_sigframe *psf); void _thr_spinlock_init(void); void _thr_cancel_enter(struct pthread *); void _thr_cancel_leave(struct pthread *, int); int _thr_setconcurrency(int new_level); int _thr_setmaxconcurrency(void); void _thr_critical_enter(struct pthread *); void _thr_critical_leave(struct pthread *); int _thr_start_sig_daemon(void); int _thr_getprocsig(int sig, siginfo_t *siginfo); int _thr_getprocsig_unlocked(int sig, siginfo_t *siginfo); void _thr_signal_init(void); void _thr_signal_deinit(void); void _thr_hash_add(struct pthread *); void _thr_hash_remove(struct pthread *); struct pthread *_thr_hash_find(struct pthread *); void _thr_finish_cancellation(void *arg); int _thr_sigonstack(void *sp); void _thr_debug_check_yield(struct pthread *); /* * Aliases for _pthread functions. Should be called instead of * originals if PLT replocation is unwanted at runtme. */ int _thr_cond_broadcast(pthread_cond_t *); int _thr_cond_signal(pthread_cond_t *); int _thr_cond_wait(pthread_cond_t *, pthread_mutex_t *); int _thr_mutex_lock(pthread_mutex_t *); int _thr_mutex_unlock(pthread_mutex_t *); int _thr_rwlock_rdlock (pthread_rwlock_t *); int _thr_rwlock_wrlock (pthread_rwlock_t *); int _thr_rwlock_unlock (pthread_rwlock_t *); /* #include */ #ifdef _SYS_AIO_H_ int __sys_aio_suspend(const struct aiocb * const[], int, const struct timespec *); #endif /* #include */ #ifdef _SYS_FCNTL_H_ int __sys_fcntl(int, int, ...); int __sys_open(const char *, int, ...); #endif /* #include */ #ifdef _SYS_IOCTL_H_ int __sys_ioctl(int, unsigned long, ...); #endif /* #inclde */ #ifdef _SCHED_H_ int __sys_sched_yield(void); #endif /* #include */ #ifdef _SIGNAL_H_ int __sys_kill(pid_t, int); int __sys_sigaction(int, const struct sigaction *, struct sigaction *); int __sys_sigpending(sigset_t *); int __sys_sigprocmask(int, const sigset_t *, sigset_t *); int __sys_sigsuspend(const sigset_t *); int __sys_sigreturn(ucontext_t *); int __sys_sigaltstack(const struct sigaltstack *, struct sigaltstack *); #endif /* #include */ #ifdef _SYS_SOCKET_H_ int __sys_accept(int, struct sockaddr *, socklen_t *); int __sys_connect(int, const struct sockaddr *, socklen_t); int __sys_sendfile(int, int, off_t, size_t, struct sf_hdtr *, off_t *, int); #endif /* #include */ #ifdef _SYS_UIO_H_ ssize_t __sys_readv(int, const struct iovec *, int); ssize_t __sys_writev(int, const struct iovec *, int); #endif /* #include */ #ifdef _TIME_H_ int __sys_nanosleep(const struct timespec *, struct timespec *); #endif /* #include */ #ifdef _UNISTD_H_ int __sys_close(int); int __sys_execve(const char *, char * const *, char * const *); int __sys_fork(void); int __sys_fsync(int); pid_t __sys_getpid(void); int __sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); ssize_t __sys_read(int, void *, size_t); ssize_t __sys_write(int, const void *, size_t); void __sys_exit(int); int __sys_sigwait(const sigset_t *, int *); int __sys_sigtimedwait(sigset_t *, siginfo_t *, struct timespec *); #endif /* #include */ #ifdef _SYS_POLL_H_ int __sys_poll(struct pollfd *, unsigned, int); #endif /* #include */ #ifdef _SYS_MMAN_H_ int __sys_msync(void *, size_t, int); #endif static __inline int _thr_dump_enabled(void) { return ((_thr_debug_flags & DBG_INFO_DUMP) != 0); } #endif /* !_THR_PRIVATE_H */ Index: head/lib/libpthread/Makefile =================================================================== --- head/lib/libpthread/Makefile (revision 169523) +++ head/lib/libpthread/Makefile (revision 169524) @@ -1,54 +1,59 @@ # $FreeBSD$ # # All library objects contain FreeBSD revision strings by default; they may be # excluded as a space-saving measure. To produce a library that does # not contain these strings, add -DSTRIP_FBSDID (see ) to CFLAGS # below. Note, there are no IDs for syscall stubs whose sources are generated. # To included legacy CSRG sccsid strings, add -DLIBC_SCCS and -DSYSLIBC_SCCS # (for system call stubs) to CFLAGS below. -DSYSLIBC_SCCS affects just the # system call stubs. -.if ${MACHINE_ARCH} == "sparc64" -LIB=kse -.else -LIB=pthread + +.if defined(DEFAULT_THREAD_LIB) && (${DEFAULT_THREAD_LIB} == "libpthread") SHLIBDIR?= /lib .endif + +.include + +LIB=kse SHLIB_MAJOR= 2 CFLAGS+=-DPTHREAD_KERNEL CFLAGS+=-I${.CURDIR}/../libc/include -I${.CURDIR}/thread \ -I${.CURDIR}/../../include CFLAGS+=-I${.CURDIR}/arch/${MACHINE_ARCH}/include CFLAGS+=-I${.CURDIR}/sys CFLAGS+=-I${.CURDIR}/../../libexec/rtld-elf CFLAGS+=-I${.CURDIR}/../../libexec/rtld-elf/${MACHINE_ARCH} CFLAGS+=-fno-builtin # Uncomment this if you want libpthread to contain debug information for # thread locking. CFLAGS+=-D_LOCK_DEBUG WARNS?=2 # Uncomment this if you want to build a 1:1 threading mode library # however it is no longer strictly conformed to POSIX # CFLAGS+=-DSYSTEM_SCOPE_ONLY # Enable extra internal consistancy checks. CFLAGS+=-D_PTHREADS_INVARIANTS -Wall VERSION_MAP=${.CURDIR}/pthread.map -.if defined(SYMVER_ENABLED) -# Remove this if library version is bumped and LIBPTHREAD_1_0 -# compatability hacks are removed (see thread/thr_private.h). -LDFLAGS+=-Wl,-zmuldefs -CFLAGS+=-DSYMBOL_VERSIONING -.endif - PRECIOUSLIB= .include "${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.inc" .include "${.CURDIR}/support/Makefile.inc" .include "${.CURDIR}/sys/Makefile.inc" .include "${.CURDIR}/thread/Makefile.inc" + +.if ${DEFAULT_THREAD_LIB} == "libpthread" +SYMLINKS+=lib${LIB}.a ${LIBDIR}/libpthread.a +.if !defined(NO_PIC) +SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthread.so +.endif +.if ${MK_PROFILE} != "no" +SYMLINKS+=lib${LIB}_p.a ${LIBDIR}/libpthread_p.a +.endif +.endif .include Index: head/lib/libpthread/pthread.map =================================================================== --- head/lib/libpthread/pthread.map (revision 169523) +++ head/lib/libpthread/pthread.map (revision 169524) @@ -1,738 +1,370 @@ /* * $FreeBSD$ */ /* - * Hack. libpthread had versioning before libc, but we need to - * reside in the same namespace as libc if we want to override - * libc functions. Use this so we don't break older applications - * that require symbols from "LIBTHREAD_1_0". - * - * From now on, use the same naming scheme as libc. - */ -LIBTHREAD_1_0 { -global: - ___creat; - __accept; - __close; - __connect; - __error; - __fcntl; - __fsync; - __msync; - __nanosleep; - __open; - __poll; - __pthread_cond_timedwait; - __pthread_cond_wait; - __pthread_mutex_init; - __pthread_mutex_lock; - __pthread_mutex_trylock; - __pthread_mutex_timedlock; - __read; - __readv; - __select; - __sigsuspend; - __sigtimedwait; - __sigwait; - __sigwaitinfo; - __wait4; - __write; - __writev; - _aio_suspend; - _execve; - _fork; - _nanosleep; - _pause; - _pselect; - _pthread_atfork; - _pthread_barrier_destroy; - _pthread_barrier_init; - _pthread_barrier_wait; - _pthread_barrierattr_destroy; - _pthread_barrierattr_getpshared; - _pthread_barrierattr_init; - _pthread_barrierattr_setpshared; - _pthread_attr_destroy; - _pthread_attr_get_np; - _pthread_attr_getdetachstate; - _pthread_attr_getguardsize; - _pthread_attr_getinheritsched; - _pthread_attr_getschedparam; - _pthread_attr_getschedpolicy; - _pthread_attr_getscope; - _pthread_attr_getstack; - _pthread_attr_getstackaddr; - _pthread_attr_getstacksize; - _pthread_attr_init; - _pthread_attr_setcreatesuspend_np; - _pthread_attr_setdetachstate; - _pthread_attr_setguardsize; - _pthread_attr_setinheritsched; - _pthread_attr_setschedparam; - _pthread_attr_setschedpolicy; - _pthread_attr_setscope; - _pthread_attr_setstack; - _pthread_attr_setstackaddr; - _pthread_attr_setstacksize; - _pthread_cancel; - _pthread_cleanup_pop; - _pthread_cleanup_push; - _pthread_cond_broadcast; - _pthread_cond_destroy; - _pthread_cond_init; - _pthread_cond_signal; - _pthread_cond_timedwait; - _pthread_cond_wait; - _pthread_condattr_default; - _pthread_condattr_destroy; - _pthread_condattr_getpshared; - _pthread_condattr_init; - _pthread_condattr_setpshared; - _pthread_create; - _pthread_detach; - _pthread_equal; - _pthread_exit; - _pthread_getconcurrency; - _pthread_getprio; - _pthread_getschedparam; - _pthread_getspecific; - _pthread_join; - _pthread_key_create; - _pthread_key_delete; - _pthread_kill; - _pthread_main_np; - _pthread_multi_np; - _pthread_mutex_destroy; - _pthread_mutex_getprioceiling; - _pthread_mutex_init; - _pthread_mutex_lock; - _pthread_mutex_setprioceiling; - _pthread_mutex_timedlock; - _pthread_mutex_trylock; - _pthread_mutex_unlock; - _pthread_mutexattr_default; - _pthread_mutexattr_destroy; - _pthread_mutexattr_getkind_np; - _pthread_mutexattr_getprioceiling; - _pthread_mutexattr_getprotocol; - _pthread_mutexattr_getpshared; - _pthread_mutexattr_gettype; - _pthread_mutexattr_init; - _pthread_mutexattr_setkind_np; - _pthread_mutexattr_setprioceiling; - _pthread_mutexattr_setprotocol; - _pthread_mutexattr_setpshared; - _pthread_mutexattr_settype; - _pthread_once; - _pthread_resume_all_np; - _pthread_resume_np; - _pthread_rwlock_destroy; - _pthread_rwlock_init; - _pthread_rwlock_rdlock; - _pthread_rwlock_timedrdlock; - _pthread_rwlock_timedwrlock; - _pthread_rwlock_tryrdlock; - _pthread_rwlock_trywrlock; - _pthread_rwlock_unlock; - _pthread_rwlock_wrlock; - _pthread_rwlockattr_destroy; - _pthread_rwlockattr_getpshared; - _pthread_rwlockattr_init; - _pthread_rwlockattr_setpshared; - _pthread_self; - _pthread_set_name_np; - _pthread_setcancelstate; - _pthread_setcanceltype; - _pthread_setconcurrency; - _pthread_setprio; - _pthread_setschedparam; - _pthread_setspecific; - _pthread_sigmask; - _pthread_single_np; - _pthread_spin_destroy; - _pthread_spin_init; - _pthread_spin_lock; - _pthread_spin_trylock; - _pthread_spin_unlock; - _pthread_suspend_all_np; - _pthread_suspend_np; - _pthread_switch_add_np; - _pthread_switch_delete_np; - _pthread_testcancel; - _pthread_yield; - _raise; - _sched_yield; - _sem_init; - _sem_post; - _sem_timedwait; - _sem_wait; - _sigaction; - _sigaltstack; - _sigpending; - _sigprocmask; - _sigsuspend; - _sigtimedwait; - _sigwait; - _sigwaitinfo; - _sleep; - _spinlock; - _spinlock_debug; - _spinunlock; - _system; - _tcdrain; - _usleep; - _vfork; - _wait; - _waitpid; - accept; - aio_suspend; - close; - connect; - creat; - execve; - fcntl; - fork; - fsync; - msync; - nanosleep; - open; - pause; - poll; - pselect; - pthread_atfork; - pthread_barrier_destroy; - pthread_barrier_init; - pthread_barrier_wait; - pthread_barrierattr_destroy; - pthread_barrierattr_getpshared; - pthread_barrierattr_init; - pthread_barrierattr_setpshared; - pthread_attr_destroy; - pthread_attr_get_np; - pthread_attr_getdetachstate; - pthread_attr_getguardsize; - pthread_attr_getinheritsched; - pthread_attr_getschedparam; - pthread_attr_getschedpolicy; - pthread_attr_getscope; - pthread_attr_getstack; - pthread_attr_getstackaddr; - pthread_attr_getstacksize; - pthread_attr_init; - pthread_attr_setcreatesuspend_np; - pthread_attr_setdetachstate; - pthread_attr_setguardsize; - pthread_attr_setinheritsched; - pthread_attr_setschedparam; - pthread_attr_setschedpolicy; - pthread_attr_setscope; - pthread_attr_setstack; - pthread_attr_setstackaddr; - pthread_attr_setstacksize; - pthread_cancel; - pthread_cleanup_pop; - pthread_cleanup_push; - pthread_cond_broadcast; - pthread_cond_destroy; - pthread_cond_init; - pthread_cond_signal; - pthread_cond_timedwait; - pthread_cond_wait; - pthread_condattr_destroy; - pthread_condattr_getpshared; - pthread_condattr_init; - pthread_condattr_setpshared; - pthread_create; - pthread_detach; - pthread_equal; - pthread_exit; - pthread_getconcurrency; - pthread_getprio; - pthread_getschedparam; - pthread_getspecific; - pthread_join; - pthread_key_create; - pthread_key_delete; - pthread_kill; - pthread_main_np; - pthread_multi_np; - pthread_mutex_destroy; - pthread_mutex_getprioceiling; - pthread_mutex_init; - pthread_mutex_lock; - pthread_mutex_setprioceiling; - pthread_mutex_timedlock; - pthread_mutex_trylock; - pthread_mutex_unlock; - pthread_mutexattr_destroy; - pthread_mutexattr_getkind_np; - pthread_mutexattr_getprioceiling; - pthread_mutexattr_getprotocol; - pthread_mutexattr_getpshared; - pthread_mutexattr_gettype; - pthread_mutexattr_init; - pthread_mutexattr_setkind_np; - pthread_mutexattr_setprioceiling; - pthread_mutexattr_setprotocol; - pthread_mutexattr_setpshared; - pthread_mutexattr_settype; - pthread_once; - pthread_resume_all_np; - pthread_resume_np; - pthread_rwlock_destroy; - pthread_rwlock_init; - pthread_rwlock_rdlock; - pthread_rwlock_timedrdlock; - pthread_rwlock_timedwrlock; - pthread_rwlock_tryrdlock; - pthread_rwlock_trywrlock; - pthread_rwlock_unlock; - pthread_rwlock_wrlock; - pthread_rwlockattr_destroy; - pthread_rwlockattr_getpshared; - pthread_rwlockattr_init; - pthread_rwlockattr_setpshared; - pthread_self; - pthread_set_name_np; - pthread_setcancelstate; - pthread_setcanceltype; - pthread_setconcurrency; - pthread_setprio; - pthread_setschedparam; - pthread_setspecific; - pthread_sigmask; - pthread_single_np; - pthread_spin_destroy; - pthread_spin_init; - pthread_spin_lock; - pthread_spin_trylock; - pthread_spin_unlock; - pthread_suspend_all_np; - pthread_suspend_np; - pthread_switch_add_np; - pthread_switch_delete_np; - pthread_testcancel; - pthread_yield; - raise; - read; - readv; - sched_yield; - select; - sem_init; - sem_post; - sem_timedwait; - sem_wait; - sigaction; - sigaltstack; - sigpending; - sigprocmask; - sigsuspend; - sigwait; - sigwaitinfo; - sigtimedwait; - sleep; - system; - tcdrain; - usleep; - vfork; - wait4; - wait; - waitpid; - write; - writev; - - /* Debugger needs these. */ - _libkse_debug; - _thread_activated; - _thread_active_threads; - _thread_keytable; - _thread_list; - _thread_max_keys; - _thread_off_attr_flags; - _thread_off_dtv; - _thread_off_linkmap; - _thread_off_next; - _thread_off_tcb; - _thread_off_tmbx; - _thread_off_key_allocated; - _thread_off_key_destructor; - _thread_off_kse; - _thread_off_kse_locklevel; - _thread_off_state; - _thread_off_thr_locklevel; - _thread_off_tlsindex; - _thread_size_key; - _thread_state_running; - _thread_state_zoombie; - -local: - *; -}; - -/* * Use the same naming scheme as libc. */ FBSD_1.0 { global: __error; accept; aio_suspend; close; connect; creat; execve; fcntl; fork; fsync; msync; nanosleep; open; pause; poll; pselect; pthread_atfork; pthread_barrier_destroy; pthread_barrier_init; pthread_barrier_wait; pthread_barrierattr_destroy; pthread_barrierattr_getpshared; pthread_barrierattr_init; pthread_barrierattr_setpshared; pthread_attr_destroy; pthread_attr_get_np; pthread_attr_getdetachstate; pthread_attr_getguardsize; pthread_attr_getinheritsched; pthread_attr_getschedparam; pthread_attr_getschedpolicy; pthread_attr_getscope; pthread_attr_getstack; pthread_attr_getstackaddr; pthread_attr_getstacksize; pthread_attr_init; pthread_attr_setcreatesuspend_np; pthread_attr_setdetachstate; pthread_attr_setguardsize; pthread_attr_setinheritsched; pthread_attr_setschedparam; pthread_attr_setschedpolicy; pthread_attr_setscope; pthread_attr_setstack; pthread_attr_setstackaddr; pthread_attr_setstacksize; pthread_cancel; pthread_cleanup_pop; pthread_cleanup_push; pthread_cond_broadcast; pthread_cond_destroy; pthread_cond_init; pthread_cond_signal; pthread_cond_timedwait; pthread_cond_wait; pthread_condattr_destroy; pthread_condattr_init; pthread_create; pthread_detach; pthread_equal; pthread_exit; pthread_getconcurrency; pthread_getprio; pthread_getschedparam; pthread_getspecific; pthread_join; pthread_key_create; pthread_key_delete; pthread_kill; pthread_main_np; pthread_multi_np; pthread_mutex_destroy; pthread_mutex_getprioceiling; pthread_mutex_init; pthread_mutex_lock; pthread_mutex_setprioceiling; pthread_mutex_timedlock; pthread_mutex_trylock; pthread_mutex_unlock; pthread_mutexattr_destroy; pthread_mutexattr_getkind_np; pthread_mutexattr_getprioceiling; pthread_mutexattr_getprotocol; pthread_mutexattr_gettype; pthread_mutexattr_init; pthread_mutexattr_setkind_np; pthread_mutexattr_setprioceiling; pthread_mutexattr_setprotocol; pthread_mutexattr_settype; pthread_once; pthread_resume_all_np; pthread_resume_np; pthread_rwlock_destroy; pthread_rwlock_init; pthread_rwlock_rdlock; pthread_rwlock_timedrdlock; pthread_rwlock_timedwrlock; pthread_rwlock_tryrdlock; pthread_rwlock_trywrlock; pthread_rwlock_unlock; pthread_rwlock_wrlock; pthread_rwlockattr_destroy; pthread_rwlockattr_getpshared; pthread_rwlockattr_init; pthread_rwlockattr_setpshared; pthread_self; pthread_set_name_np; pthread_setcancelstate; pthread_setcanceltype; pthread_setconcurrency; pthread_setprio; pthread_setschedparam; pthread_setspecific; pthread_sigmask; pthread_single_np; pthread_spin_destroy; pthread_spin_init; pthread_spin_lock; pthread_spin_trylock; pthread_spin_unlock; pthread_suspend_all_np; pthread_suspend_np; pthread_switch_add_np; pthread_switch_delete_np; pthread_testcancel; pthread_yield; raise; read; readv; sched_yield; select; sem_init; sem_post; sem_timedwait; sem_wait; sigaction; sigaltstack; sigpending; sigprocmask; sigsuspend; sigwait; sigwaitinfo; sigtimedwait; sleep; system; tcdrain; usleep; vfork; wait4; wait; waitpid; write; writev; local: *; }; /* * List the private interfaces reserved for use in FreeBSD libraries. * These are not part of our application ABI. */ FBSDprivate_1.0 { global: ___creat; __accept; __close; __connect; __fcntl; __fsync; __msync; __nanosleep; __open; __poll; __pthread_cond_timedwait; __pthread_cond_wait; __pthread_mutex_init; __pthread_mutex_lock; __pthread_mutex_trylock; __pthread_mutex_timedlock; __read; __readv; __select; __sigsuspend; __sigtimedwait; __sigwait; __sigwaitinfo; __wait4; __write; __writev; _aio_suspend; _execve; _fork; _nanosleep; _pause; _pselect; _pthread_atfork; _pthread_barrier_destroy; _pthread_barrier_init; _pthread_barrier_wait; _pthread_barrierattr_destroy; _pthread_barrierattr_getpshared; _pthread_barrierattr_init; _pthread_barrierattr_setpshared; _pthread_attr_destroy; _pthread_attr_get_np; _pthread_attr_getdetachstate; _pthread_attr_getguardsize; _pthread_attr_getinheritsched; _pthread_attr_getschedparam; _pthread_attr_getschedpolicy; _pthread_attr_getscope; _pthread_attr_getstack; _pthread_attr_getstackaddr; _pthread_attr_getstacksize; _pthread_attr_init; _pthread_attr_setcreatesuspend_np; _pthread_attr_setdetachstate; _pthread_attr_setguardsize; _pthread_attr_setinheritsched; _pthread_attr_setschedparam; _pthread_attr_setschedpolicy; _pthread_attr_setscope; _pthread_attr_setstack; _pthread_attr_setstackaddr; _pthread_attr_setstacksize; _pthread_cancel; _pthread_cleanup_pop; _pthread_cleanup_push; _pthread_cond_broadcast; _pthread_cond_destroy; _pthread_cond_init; _pthread_cond_signal; _pthread_cond_timedwait; _pthread_cond_wait; _pthread_condattr_default; _pthread_condattr_destroy; _pthread_condattr_init; _pthread_create; _pthread_detach; _pthread_equal; _pthread_exit; _pthread_getconcurrency; _pthread_getprio; _pthread_getschedparam; _pthread_getspecific; _pthread_join; _pthread_key_create; _pthread_key_delete; _pthread_kill; _pthread_main_np; _pthread_multi_np; _pthread_mutex_destroy; _pthread_mutex_getprioceiling; _pthread_mutex_init; _pthread_mutex_lock; _pthread_mutex_setprioceiling; _pthread_mutex_timedlock; _pthread_mutex_trylock; _pthread_mutex_unlock; _pthread_mutexattr_default; _pthread_mutexattr_destroy; _pthread_mutexattr_getkind_np; _pthread_mutexattr_getprioceiling; _pthread_mutexattr_getprotocol; _pthread_mutexattr_gettype; _pthread_mutexattr_init; _pthread_mutexattr_setkind_np; _pthread_mutexattr_setprioceiling; _pthread_mutexattr_setprotocol; _pthread_mutexattr_settype; _pthread_once; _pthread_resume_all_np; _pthread_resume_np; _pthread_rwlock_destroy; _pthread_rwlock_init; _pthread_rwlock_rdlock; _pthread_rwlock_timedrdlock; _pthread_rwlock_timedwrlock; _pthread_rwlock_tryrdlock; _pthread_rwlock_trywrlock; _pthread_rwlock_unlock; _pthread_rwlock_wrlock; _pthread_rwlockattr_destroy; _pthread_rwlockattr_getpshared; _pthread_rwlockattr_init; _pthread_rwlockattr_setpshared; _pthread_self; _pthread_set_name_np; _pthread_setcancelstate; _pthread_setcanceltype; _pthread_setconcurrency; _pthread_setprio; _pthread_setschedparam; _pthread_setspecific; _pthread_sigmask; _pthread_single_np; _pthread_spin_destroy; _pthread_spin_init; _pthread_spin_lock; _pthread_spin_trylock; _pthread_spin_unlock; _pthread_suspend_all_np; _pthread_suspend_np; _pthread_switch_add_np; _pthread_switch_delete_np; _pthread_testcancel; _pthread_yield; _raise; _sched_yield; _sem_init; _sem_post; _sem_timedwait; _sem_wait; _sigaction; _sigaltstack; _sigpending; _sigprocmask; _sigsuspend; _sigtimedwait; _sigwait; _sigwaitinfo; _sleep; _spinlock; _spinlock_debug; _spinunlock; _system; _tcdrain; _usleep; _vfork; _wait; _waitpid; /* Debugger needs these. */ _libkse_debug; _thread_activated; _thread_active_threads; _thread_keytable; _thread_list; _thread_max_keys; _thread_off_attr_flags; _thread_off_dtv; _thread_off_linkmap; _thread_off_next; _thread_off_tcb; _thread_off_tmbx; _thread_off_key_allocated; _thread_off_key_destructor; _thread_off_kse; _thread_off_kse_locklevel; _thread_off_sigmask; _thread_off_sigpend; _thread_off_state; _thread_off_thr_locklevel; _thread_off_tlsindex; _thread_size_key; _thread_state_running; _thread_state_zoombie; local: *; }; Index: head/lib/libpthread/thread/thr_private.h =================================================================== --- head/lib/libpthread/thread/thr_private.h (revision 169523) +++ head/lib/libpthread/thread/thr_private.h (revision 169524) @@ -1,1324 +1,1324 @@ /* * Copyright (c) 1995-1998 John Birrell . * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the author nor the names of any co-contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Private thread definitions for the uthread kernel. * * $FreeBSD$ */ #ifndef _THR_PRIVATE_H #define _THR_PRIVATE_H /* * Include files. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef LIBTHREAD_DB #include "lock.h" #include "pthread_md.h" #endif /* * Unfortunately, libpthread had symbol versioning before libc. * But now libc has symbol versioning, we need to occupy the * same version namespace in order to override some libc functions. * So in order to avoid breaking binaries requiring symbols from * LIBTHREAD_1_0, we need to provide a compatible interface for * those symbols. */ -#if defined(SYMBOL_VERSIONING) && defined(PIC) +#if 0 #define SYM_LT10(sym) __CONCAT(sym, _lt10) #define SYM_FB10(sym) __CONCAT(sym, _fb10) #define SYM_FBP10(sym) __CONCAT(sym, _fbp10) #define WEAK_REF(sym, alias) __weak_reference(sym, alias) #define SYM_COMPAT(sym, impl, ver) __sym_compat(sym, impl, ver) #define SYM_DEFAULT(sym, impl, ver) __sym_default(sym, impl, ver) #define LT10_COMPAT(sym) \ WEAK_REF(sym, SYM_LT10(sym)); \ SYM_COMPAT(sym, SYM_LT10(sym), LIBTHREAD_1_0) #define LT10_COMPAT_DEFAULT(sym) \ LT10_COMPAT(sym); \ WEAK_REF(sym, SYM_FB10(sym)); \ SYM_DEFAULT(sym, SYM_FB10(sym), FBSD_1.0) #define LT10_COMPAT_PRIVATE(sym) \ LT10_COMPAT(sym); \ WEAK_REF(sym, SYM_FBP10(sym)); \ SYM_DEFAULT(sym, SYM_FBP10(sym), FBSDprivate_1.0) #else #define LT10_COMPAT_DEFAULT(sym) #define LT10_COMPAT_PRIVATE(sym) #endif /* * Evaluate the storage class specifier. */ #ifdef GLOBAL_PTHREAD_PRIVATE #define SCLASS #define SCLASS_PRESET(x...) = x #else #define SCLASS extern #define SCLASS_PRESET(x...) #endif /* * Kernel fatal error handler macro. */ #define PANIC(string) _thr_exit(__FILE__, __LINE__, string) /* Output debug messages like this: */ #ifdef STDOUT_FILENO #define stdout_debug(...) _thread_printf(STDOUT_FILENO, __VA_ARGS__) #endif #ifdef STDERR_FILENO #define stderr_debug(...) _thread_printf(STDERR_FILENO, __VA_ARGS__) #endif #define DBG_MUTEX 0x0001 #define DBG_SIG 0x0002 #define DBG_INFO_DUMP 0x0004 #ifdef _PTHREADS_INVARIANTS #define THR_ASSERT(cond, msg) do { \ if (!(cond)) \ PANIC(msg); \ } while (0) #else #define THR_ASSERT(cond, msg) #endif /* * State change macro without scheduling queue change: */ #define THR_SET_STATE(thrd, newstate) do { \ (thrd)->state = newstate; \ (thrd)->fname = __FILE__; \ (thrd)->lineno = __LINE__; \ } while (0) #define TIMESPEC_ADD(dst, src, val) \ do { \ (dst)->tv_sec = (src)->tv_sec + (val)->tv_sec; \ (dst)->tv_nsec = (src)->tv_nsec + (val)->tv_nsec; \ if ((dst)->tv_nsec >= 1000000000) { \ (dst)->tv_sec++; \ (dst)->tv_nsec -= 1000000000; \ } \ } while (0) #define TIMESPEC_SUB(dst, src, val) \ do { \ (dst)->tv_sec = (src)->tv_sec - (val)->tv_sec; \ (dst)->tv_nsec = (src)->tv_nsec - (val)->tv_nsec; \ if ((dst)->tv_nsec < 0) { \ (dst)->tv_sec--; \ (dst)->tv_nsec += 1000000000; \ } \ } while (0) /* * Priority queues. * * XXX It'd be nice if these were contained in uthread_priority_queue.[ch]. */ typedef struct pq_list { TAILQ_HEAD(, pthread) pl_head; /* list of threads at this priority */ TAILQ_ENTRY(pq_list) pl_link; /* link for queue of priority lists */ int pl_prio; /* the priority of this list */ int pl_queued; /* is this in the priority queue */ } pq_list_t; typedef struct pq_queue { TAILQ_HEAD(, pq_list) pq_queue; /* queue of priority lists */ pq_list_t *pq_lists; /* array of all priority lists */ int pq_size; /* number of priority lists */ #define PQF_ACTIVE 0x0001 int pq_flags; int pq_threads; } pq_queue_t; /* * Each KSEG has a scheduling queue. For now, threads that exist in their * own KSEG (system scope) will get a full priority queue. In the future * this can be optimized for the single thread per KSEG case. */ struct sched_queue { pq_queue_t sq_runq; TAILQ_HEAD(, pthread) sq_waitq; /* waiting in userland */ }; typedef struct kse_thr_mailbox *kse_critical_t; struct kse_group; #define MAX_KSE_LOCKLEVEL 5 struct kse { /* -- location and order specific items for gdb -- */ struct kcb *k_kcb; struct pthread *k_curthread; /* current thread */ struct kse_group *k_kseg; /* parent KSEG */ struct sched_queue *k_schedq; /* scheduling queue */ /* -- end of location and order specific items -- */ TAILQ_ENTRY(kse) k_qe; /* KSE list link entry */ TAILQ_ENTRY(kse) k_kgqe; /* KSEG's KSE list entry */ /* * Items that are only modified by the kse, or that otherwise * don't need to be locked when accessed */ struct lock k_lock; struct lockuser k_lockusers[MAX_KSE_LOCKLEVEL]; int k_locklevel; stack_t k_stack; int k_flags; #define KF_STARTED 0x0001 /* kernel kse created */ #define KF_INITIALIZED 0x0002 /* initialized on 1st upcall */ #define KF_TERMINATED 0x0004 /* kse is terminated */ #define KF_IDLE 0x0008 /* kse is idle */ #define KF_SWITCH 0x0010 /* thread switch in UTS */ int k_error; /* syscall errno in critical */ int k_cpu; /* CPU ID when bound */ int k_sigseqno; /* signal buffered count */ }; #define KSE_SET_IDLE(kse) ((kse)->k_flags |= KF_IDLE) #define KSE_CLEAR_IDLE(kse) ((kse)->k_flags &= ~KF_IDLE) #define KSE_IS_IDLE(kse) (((kse)->k_flags & KF_IDLE) != 0) #define KSE_SET_SWITCH(kse) ((kse)->k_flags |= KF_SWITCH) #define KSE_CLEAR_SWITCH(kse) ((kse)->k_flags &= ~KF_SWITCH) #define KSE_IS_SWITCH(kse) (((kse)->k_flags & KF_SWITCH) != 0) /* * Each KSE group contains one or more KSEs in which threads can run. * At least for now, there is one scheduling queue per KSE group; KSEs * within the same KSE group compete for threads from the same scheduling * queue. A scope system thread has one KSE in one KSE group; the group * does not use its scheduling queue. */ struct kse_group { TAILQ_HEAD(, kse) kg_kseq; /* list of KSEs in group */ TAILQ_HEAD(, pthread) kg_threadq; /* list of threads in group */ TAILQ_ENTRY(kse_group) kg_qe; /* link entry */ struct sched_queue kg_schedq; /* scheduling queue */ struct lock kg_lock; int kg_threadcount; /* # of assigned threads */ int kg_ksecount; /* # of assigned KSEs */ int kg_idle_kses; int kg_flags; #define KGF_SINGLE_THREAD 0x0001 /* scope system kse group */ #define KGF_SCHEDQ_INITED 0x0002 /* has an initialized schedq */ }; /* * Add/remove threads from a KSE's scheduling queue. * For now the scheduling queue is hung off the KSEG. */ #define KSEG_THRQ_ADD(kseg, thr) \ do { \ TAILQ_INSERT_TAIL(&(kseg)->kg_threadq, thr, kle);\ (kseg)->kg_threadcount++; \ } while (0) #define KSEG_THRQ_REMOVE(kseg, thr) \ do { \ TAILQ_REMOVE(&(kseg)->kg_threadq, thr, kle); \ (kseg)->kg_threadcount--; \ } while (0) /* * Lock acquire and release for KSEs. */ #define KSE_LOCK_ACQUIRE(kse, lck) \ do { \ if ((kse)->k_locklevel < MAX_KSE_LOCKLEVEL) { \ (kse)->k_locklevel++; \ _lock_acquire((lck), \ &(kse)->k_lockusers[(kse)->k_locklevel - 1], 0); \ } \ else \ PANIC("Exceeded maximum lock level"); \ } while (0) #define KSE_LOCK_RELEASE(kse, lck) \ do { \ if ((kse)->k_locklevel > 0) { \ _lock_release((lck), \ &(kse)->k_lockusers[(kse)->k_locklevel - 1]); \ (kse)->k_locklevel--; \ } \ } while (0) /* * Lock our own KSEG. */ #define KSE_LOCK(curkse) \ KSE_LOCK_ACQUIRE(curkse, &(curkse)->k_kseg->kg_lock) #define KSE_UNLOCK(curkse) \ KSE_LOCK_RELEASE(curkse, &(curkse)->k_kseg->kg_lock) /* * Lock a potentially different KSEG. */ #define KSE_SCHED_LOCK(curkse, kseg) \ KSE_LOCK_ACQUIRE(curkse, &(kseg)->kg_lock) #define KSE_SCHED_UNLOCK(curkse, kseg) \ KSE_LOCK_RELEASE(curkse, &(kseg)->kg_lock) /* * Waiting queue manipulation macros (using pqe link): */ #define KSE_WAITQ_REMOVE(kse, thrd) \ do { \ if (((thrd)->flags & THR_FLAGS_IN_WAITQ) != 0) { \ TAILQ_REMOVE(&(kse)->k_schedq->sq_waitq, thrd, pqe); \ (thrd)->flags &= ~THR_FLAGS_IN_WAITQ; \ } \ } while (0) #define KSE_WAITQ_INSERT(kse, thrd) kse_waitq_insert(thrd) #define KSE_WAITQ_FIRST(kse) TAILQ_FIRST(&(kse)->k_schedq->sq_waitq) #define KSE_WAKEUP(kse) kse_wakeup(&(kse)->k_kcb->kcb_kmbx) /* * TailQ initialization values. */ #define TAILQ_INITIALIZER { NULL, NULL } /* * lock initialization values. */ #define LCK_INITIALIZER { NULL, NULL, LCK_DEFAULT } struct pthread_mutex { /* * Lock for accesses to this structure. */ struct lock m_lock; enum pthread_mutextype m_type; int m_protocol; TAILQ_HEAD(mutex_head, pthread) m_queue; struct pthread *m_owner; long m_flags; int m_count; int m_refcount; /* * Used for priority inheritence and protection. * * m_prio - For priority inheritence, the highest active * priority (threads locking the mutex inherit * this priority). For priority protection, the * ceiling priority of this mutex. * m_saved_prio - mutex owners inherited priority before * taking the mutex, restored when the owner * unlocks the mutex. */ int m_prio; int m_saved_prio; /* * Link for list of all mutexes a thread currently owns. */ TAILQ_ENTRY(pthread_mutex) m_qe; }; /* * Flags for mutexes. */ #define MUTEX_FLAGS_PRIVATE 0x01 #define MUTEX_FLAGS_INITED 0x02 #define MUTEX_FLAGS_BUSY 0x04 /* * Static mutex initialization values. */ #define PTHREAD_MUTEX_STATIC_INITIALIZER \ { LCK_INITIALIZER, PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, \ TAILQ_INITIALIZER, NULL, MUTEX_FLAGS_PRIVATE, 0, 0, 0, 0, \ TAILQ_INITIALIZER } struct pthread_mutex_attr { enum pthread_mutextype m_type; int m_protocol; int m_ceiling; long m_flags; }; #define PTHREAD_MUTEXATTR_STATIC_INITIALIZER \ { PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, 0, MUTEX_FLAGS_PRIVATE } /* * Condition variable definitions. */ enum pthread_cond_type { COND_TYPE_FAST, COND_TYPE_MAX }; struct pthread_cond { /* * Lock for accesses to this structure. */ struct lock c_lock; enum pthread_cond_type c_type; TAILQ_HEAD(cond_head, pthread) c_queue; struct pthread_mutex *c_mutex; long c_flags; long c_seqno; }; struct pthread_cond_attr { enum pthread_cond_type c_type; long c_flags; }; struct pthread_barrier { pthread_mutex_t b_lock; pthread_cond_t b_cond; int b_count; int b_waiters; int b_generation; }; struct pthread_barrierattr { int pshared; }; struct pthread_spinlock { volatile int s_lock; pthread_t s_owner; }; /* * Flags for condition variables. */ #define COND_FLAGS_PRIVATE 0x01 #define COND_FLAGS_INITED 0x02 #define COND_FLAGS_BUSY 0x04 /* * Static cond initialization values. */ #define PTHREAD_COND_STATIC_INITIALIZER \ { LCK_INITIALIZER, COND_TYPE_FAST, TAILQ_INITIALIZER, \ NULL, NULL, 0, 0 } /* * Cleanup definitions. */ struct pthread_cleanup { struct pthread_cleanup *next; void (*routine) (void *); void *routine_arg; int onstack; }; #define THR_CLEANUP_PUSH(td, func, arg) { \ struct pthread_cleanup __cup; \ \ __cup.routine = func; \ __cup.routine_arg = arg; \ __cup.onstack = 1; \ __cup.next = (td)->cleanup; \ (td)->cleanup = &__cup; #define THR_CLEANUP_POP(td, exec) \ (td)->cleanup = __cup.next; \ if ((exec) != 0) \ __cup.routine(__cup.routine_arg); \ } struct pthread_atfork { TAILQ_ENTRY(pthread_atfork) qe; void (*prepare)(void); void (*parent)(void); void (*child)(void); }; struct pthread_attr { int sched_policy; int sched_inherit; int sched_interval; int prio; int suspend; #define THR_STACK_USER 0x100 /* 0xFF reserved for */ #define THR_SIGNAL_THREAD 0x200 /* This is a signal thread */ int flags; void *arg_attr; void (*cleanup_attr) (void *); void *stackaddr_attr; size_t stacksize_attr; size_t guardsize_attr; }; /* * Thread creation state attributes. */ #define THR_CREATE_RUNNING 0 #define THR_CREATE_SUSPENDED 1 /* * Miscellaneous definitions. */ #define THR_STACK32_DEFAULT (1 * 1024 * 1024) #define THR_STACK64_DEFAULT (2 * 1024 * 1024) /* * Maximum size of initial thread's stack. This perhaps deserves to be larger * than the stacks of other threads, since many applications are likely to run * almost entirely on this stack. */ #define THR_STACK32_INITIAL (2 * 1024 * 1024) #define THR_STACK64_INITIAL (4 * 1024 * 1024) /* * Define the different priority ranges. All applications have thread * priorities constrained within 0-31. The threads library raises the * priority when delivering signals in order to ensure that signal * delivery happens (from the POSIX spec) "as soon as possible". * In the future, the threads library will also be able to map specific * threads into real-time (cooperating) processes or kernel threads. * The RT and SIGNAL priorities will be used internally and added to * thread base priorities so that the scheduling queue can handle both * normal and RT priority threads with and without signal handling. * * The approach taken is that, within each class, signal delivery * always has priority over thread execution. */ #define THR_DEFAULT_PRIORITY 15 #define THR_MIN_PRIORITY 0 #define THR_MAX_PRIORITY 31 /* 0x1F */ #define THR_SIGNAL_PRIORITY 32 /* 0x20 */ #define THR_RT_PRIORITY 64 /* 0x40 */ #define THR_FIRST_PRIORITY THR_MIN_PRIORITY #define THR_LAST_PRIORITY \ (THR_MAX_PRIORITY + THR_SIGNAL_PRIORITY + THR_RT_PRIORITY) #define THR_BASE_PRIORITY(prio) ((prio) & THR_MAX_PRIORITY) /* * Clock resolution in microseconds. */ #define CLOCK_RES_USEC 10000 /* * Time slice period in microseconds. */ #define TIMESLICE_USEC 20000 /* * XXX - Define a thread-safe macro to get the current time of day * which is updated at regular intervals by something. * * For now, we just make the system call to get the time. */ #define KSE_GET_TOD(curkse, tsp) \ do { \ *tsp = (curkse)->k_kcb->kcb_kmbx.km_timeofday; \ if ((tsp)->tv_sec == 0) \ clock_gettime(CLOCK_REALTIME, tsp); \ } while (0) struct pthread_rwlockattr { int pshared; }; struct pthread_rwlock { pthread_mutex_t lock; /* monitor lock */ pthread_cond_t read_signal; pthread_cond_t write_signal; int state; /* 0 = idle >0 = # of readers -1 = writer */ int blocked_writers; }; /* * Thread states. */ enum pthread_state { PS_RUNNING, PS_LOCKWAIT, PS_MUTEX_WAIT, PS_COND_WAIT, PS_SLEEP_WAIT, PS_SIGSUSPEND, PS_SIGWAIT, PS_JOIN, PS_SUSPENDED, PS_DEAD, PS_DEADLOCK, PS_STATE_MAX }; struct sigwait_data { sigset_t *waitset; siginfo_t *siginfo; /* used to save siginfo for sigwaitinfo() */ }; union pthread_wait_data { pthread_mutex_t mutex; pthread_cond_t cond; struct lock *lock; struct sigwait_data *sigwait; }; /* * Define a continuation routine that can be used to perform a * transfer of control: */ typedef void (*thread_continuation_t) (void *); /* * This stores a thread's state prior to running a signal handler. * It is used when a signal is delivered to a thread blocked in * userland. If the signal handler returns normally, the thread's * state is restored from here. */ struct pthread_sigframe { int psf_valid; int psf_flags; int psf_cancelflags; int psf_interrupted; int psf_timeout; int psf_signo; enum pthread_state psf_state; union pthread_wait_data psf_wait_data; struct timespec psf_wakeup_time; sigset_t psf_sigset; sigset_t psf_sigmask; int psf_seqno; thread_continuation_t psf_continuation; }; struct join_status { struct pthread *thread; void *ret; int error; }; struct pthread_specific_elem { const void *data; int seqno; }; struct pthread_key { volatile int allocated; volatile int count; int seqno; void (*destructor) (void *); }; #define MAX_THR_LOCKLEVEL 5 /* * Thread structure. */ struct pthread { /* Thread control block */ struct tcb *tcb; /* * Magic value to help recognize a valid thread structure * from an invalid one: */ #define THR_MAGIC ((u_int32_t) 0xd09ba115) u_int32_t magic; char *name; u_int64_t uniqueid; /* for gdb */ /* Queue entry for list of all threads: */ TAILQ_ENTRY(pthread) tle; /* link for all threads in process */ TAILQ_ENTRY(pthread) kle; /* link for all threads in KSE/KSEG */ /* Queue entry for GC lists: */ TAILQ_ENTRY(pthread) gcle; /* Hash queue entry */ LIST_ENTRY(pthread) hle; /* * Lock for accesses to this thread structure. */ struct lock lock; struct lockuser lockusers[MAX_THR_LOCKLEVEL]; int locklevel; kse_critical_t critical[MAX_KSE_LOCKLEVEL]; struct kse *kse; struct kse_group *kseg; /* * Thread start routine, argument, stack pointer and thread * attributes. */ void *(*start_routine)(void *); void *arg; struct pthread_attr attr; int active; /* thread running */ int blocked; /* thread blocked in kernel */ int need_switchout; /* * Used for tracking delivery of signal handlers. */ siginfo_t *siginfo; thread_continuation_t sigbackout; /* * Cancelability flags - the lower 2 bits are used by cancel * definitions in pthread.h */ #define THR_AT_CANCEL_POINT 0x0004 #define THR_CANCELLING 0x0008 #define THR_CANCEL_NEEDED 0x0010 int cancelflags; thread_continuation_t continuation; /* * The thread's base and pending signal masks. The active * signal mask is stored in the thread's context (in mailbox). */ sigset_t sigmask; sigset_t sigpend; sigset_t *oldsigmask; volatile int check_pending; int refcount; /* Thread state: */ enum pthread_state state; volatile int lock_switch; /* * Number of microseconds accumulated by this thread when * time slicing is active. */ long slice_usec; /* * Time to wake up thread. This is used for sleeping threads and * for any operation which may time out (such as select). */ struct timespec wakeup_time; /* TRUE if operation has timed out. */ int timeout; /* * Error variable used instead of errno. The function __error() * returns a pointer to this. */ int error; /* * The joiner is the thread that is joining to this thread. The * join status keeps track of a join operation to another thread. */ struct pthread *joiner; struct join_status join_status; /* * The current thread can belong to only one scheduling queue at * a time (ready or waiting queue). It can also belong to: * * o A queue of threads waiting for a mutex * o A queue of threads waiting for a condition variable * * It is possible for a thread to belong to more than one of the * above queues if it is handling a signal. A thread may only * enter a mutex or condition variable queue when it is not * being called from a signal handler. If a thread is a member * of one of these queues when a signal handler is invoked, it * must be removed from the queue before invoking the handler * and then added back to the queue after return from the handler. * * Use pqe for the scheduling queue link (both ready and waiting), * sqe for synchronization (mutex, condition variable, and join) * queue links, and qe for all other links. */ TAILQ_ENTRY(pthread) pqe; /* priority, wait queues link */ TAILQ_ENTRY(pthread) sqe; /* synchronization queue link */ /* Wait data. */ union pthread_wait_data data; /* * Set to TRUE if a blocking operation was * interrupted by a signal: */ int interrupted; /* * Set to non-zero when this thread has entered a critical * region. We allow for recursive entries into critical regions. */ int critical_count; /* * Set to TRUE if this thread should yield after leaving a * critical region to check for signals, messages, etc. */ int critical_yield; int sflags; #define THR_FLAGS_IN_SYNCQ 0x0001 /* Miscellaneous flags; only set with scheduling lock held. */ int flags; #define THR_FLAGS_PRIVATE 0x0001 #define THR_FLAGS_IN_WAITQ 0x0002 /* in waiting queue using pqe link */ #define THR_FLAGS_IN_RUNQ 0x0004 /* in run queue using pqe link */ #define THR_FLAGS_EXITING 0x0008 /* thread is exiting */ #define THR_FLAGS_SUSPENDED 0x0010 /* thread is suspended */ /* Thread list flags; only set with thread list lock held. */ #define TLFLAGS_GC_SAFE 0x0001 /* thread safe for cleaning */ #define TLFLAGS_IN_TDLIST 0x0002 /* thread in all thread list */ #define TLFLAGS_IN_GCLIST 0x0004 /* thread in gc list */ int tlflags; /* * Base priority is the user setable and retrievable priority * of the thread. It is only affected by explicit calls to * set thread priority and upon thread creation via a thread * attribute or default priority. */ char base_priority; /* * Inherited priority is the priority a thread inherits by * taking a priority inheritence or protection mutex. It * is not affected by base priority changes. Inherited * priority defaults to and remains 0 until a mutex is taken * that is being waited on by any other thread whose priority * is non-zero. */ char inherited_priority; /* * Active priority is always the maximum of the threads base * priority and inherited priority. When there is a change * in either the base or inherited priority, the active * priority must be recalculated. */ char active_priority; /* Number of priority ceiling or protection mutexes owned. */ int priority_mutex_count; /* Number rwlocks rdlocks held. */ int rdlock_count; /* * Queue of currently owned mutexes. */ TAILQ_HEAD(, pthread_mutex) mutexq; void *ret; struct pthread_specific_elem *specific; int specific_data_count; /* Alternative stack for sigaltstack() */ stack_t sigstk; /* * Current locks bitmap for rtld. */ int rtld_bits; /* Cleanup handlers Link List */ struct pthread_cleanup *cleanup; char *fname; /* Ptr to source file name */ int lineno; /* Source line number. */ }; /* * Critical regions can also be detected by looking at the threads * current lock level. Ensure these macros increment and decrement * the lock levels such that locks can not be held with a lock level * of 0. */ #define THR_IN_CRITICAL(thrd) \ (((thrd)->locklevel > 0) || \ ((thrd)->critical_count > 0)) #define THR_YIELD_CHECK(thrd) \ do { \ if (!THR_IN_CRITICAL(thrd)) { \ if (__predict_false(_libkse_debug)) \ _thr_debug_check_yield(thrd); \ if ((thrd)->critical_yield != 0) \ _thr_sched_switch(thrd); \ if ((thrd)->check_pending != 0) \ _thr_sig_check_pending(thrd); \ } \ } while (0) #define THR_LOCK_ACQUIRE(thrd, lck) \ do { \ if ((thrd)->locklevel < MAX_THR_LOCKLEVEL) { \ THR_DEACTIVATE_LAST_LOCK(thrd); \ (thrd)->locklevel++; \ _lock_acquire((lck), \ &(thrd)->lockusers[(thrd)->locklevel - 1], \ (thrd)->active_priority); \ } else \ PANIC("Exceeded maximum lock level"); \ } while (0) #define THR_LOCK_RELEASE(thrd, lck) \ do { \ if ((thrd)->locklevel > 0) { \ _lock_release((lck), \ &(thrd)->lockusers[(thrd)->locklevel - 1]); \ (thrd)->locklevel--; \ THR_ACTIVATE_LAST_LOCK(thrd); \ if ((thrd)->locklevel == 0) \ THR_YIELD_CHECK(thrd); \ } \ } while (0) #define THR_ACTIVATE_LAST_LOCK(thrd) \ do { \ if ((thrd)->locklevel > 0) \ _lockuser_setactive( \ &(thrd)->lockusers[(thrd)->locklevel - 1], 1); \ } while (0) #define THR_DEACTIVATE_LAST_LOCK(thrd) \ do { \ if ((thrd)->locklevel > 0) \ _lockuser_setactive( \ &(thrd)->lockusers[(thrd)->locklevel - 1], 0); \ } while (0) /* * For now, threads will have their own lock separate from their * KSE scheduling lock. */ #define THR_LOCK(thr) THR_LOCK_ACQUIRE(thr, &(thr)->lock) #define THR_UNLOCK(thr) THR_LOCK_RELEASE(thr, &(thr)->lock) #define THR_THREAD_LOCK(curthrd, thr) THR_LOCK_ACQUIRE(curthrd, &(thr)->lock) #define THR_THREAD_UNLOCK(curthrd, thr) THR_LOCK_RELEASE(curthrd, &(thr)->lock) /* * Priority queue manipulation macros (using pqe link). We use * the thread's kseg link instead of the kse link because a thread * does not (currently) have a statically assigned kse. */ #define THR_RUNQ_INSERT_HEAD(thrd) \ _pq_insert_head(&(thrd)->kseg->kg_schedq.sq_runq, thrd) #define THR_RUNQ_INSERT_TAIL(thrd) \ _pq_insert_tail(&(thrd)->kseg->kg_schedq.sq_runq, thrd) #define THR_RUNQ_REMOVE(thrd) \ _pq_remove(&(thrd)->kseg->kg_schedq.sq_runq, thrd) /* * Macros to insert/remove threads to the all thread list and * the gc list. */ #define THR_LIST_ADD(thrd) do { \ if (((thrd)->tlflags & TLFLAGS_IN_TDLIST) == 0) { \ TAILQ_INSERT_HEAD(&_thread_list, thrd, tle); \ _thr_hash_add(thrd); \ (thrd)->tlflags |= TLFLAGS_IN_TDLIST; \ } \ } while (0) #define THR_LIST_REMOVE(thrd) do { \ if (((thrd)->tlflags & TLFLAGS_IN_TDLIST) != 0) { \ TAILQ_REMOVE(&_thread_list, thrd, tle); \ _thr_hash_remove(thrd); \ (thrd)->tlflags &= ~TLFLAGS_IN_TDLIST; \ } \ } while (0) #define THR_GCLIST_ADD(thrd) do { \ if (((thrd)->tlflags & TLFLAGS_IN_GCLIST) == 0) { \ TAILQ_INSERT_HEAD(&_thread_gc_list, thrd, gcle);\ (thrd)->tlflags |= TLFLAGS_IN_GCLIST; \ _gc_count++; \ } \ } while (0) #define THR_GCLIST_REMOVE(thrd) do { \ if (((thrd)->tlflags & TLFLAGS_IN_GCLIST) != 0) { \ TAILQ_REMOVE(&_thread_gc_list, thrd, gcle); \ (thrd)->tlflags &= ~TLFLAGS_IN_GCLIST; \ _gc_count--; \ } \ } while (0) #define GC_NEEDED() (atomic_load_acq_int(&_gc_count) >= 5) /* * Locking the scheduling queue for another thread uses that thread's * KSEG lock. */ #define THR_SCHED_LOCK(curthr, thr) do { \ (curthr)->critical[(curthr)->locklevel] = _kse_critical_enter(); \ (curthr)->locklevel++; \ KSE_SCHED_LOCK((curthr)->kse, (thr)->kseg); \ } while (0) #define THR_SCHED_UNLOCK(curthr, thr) do { \ KSE_SCHED_UNLOCK((curthr)->kse, (thr)->kseg); \ (curthr)->locklevel--; \ _kse_critical_leave((curthr)->critical[(curthr)->locklevel]); \ } while (0) /* Take the scheduling lock with the intent to call the scheduler. */ #define THR_LOCK_SWITCH(curthr) do { \ (void)_kse_critical_enter(); \ KSE_SCHED_LOCK((curthr)->kse, (curthr)->kseg); \ } while (0) #define THR_UNLOCK_SWITCH(curthr) do { \ KSE_SCHED_UNLOCK((curthr)->kse, (curthr)->kseg);\ } while (0) #define THR_CRITICAL_ENTER(thr) (thr)->critical_count++ #define THR_CRITICAL_LEAVE(thr) do { \ (thr)->critical_count--; \ if (((thr)->critical_yield != 0) && \ ((thr)->critical_count == 0)) { \ (thr)->critical_yield = 0; \ _thr_sched_switch(thr); \ } \ } while (0) #define THR_IS_ACTIVE(thrd) \ ((thrd)->kse != NULL) && ((thrd)->kse->k_curthread == (thrd)) #define THR_IN_SYNCQ(thrd) (((thrd)->sflags & THR_FLAGS_IN_SYNCQ) != 0) #define THR_IS_SUSPENDED(thrd) \ (((thrd)->state == PS_SUSPENDED) || \ (((thrd)->flags & THR_FLAGS_SUSPENDED) != 0)) #define THR_IS_EXITING(thrd) (((thrd)->flags & THR_FLAGS_EXITING) != 0) #define DBG_CAN_RUN(thrd) (((thrd)->tcb->tcb_tmbx.tm_dflags & \ TMDF_SUSPEND) == 0) extern int __isthreaded; static inline int _kse_isthreaded(void) { return (__isthreaded != 0); } /* * Global variables for the pthread kernel. */ SCLASS void *_usrstack SCLASS_PRESET(NULL); SCLASS struct kse *_kse_initial SCLASS_PRESET(NULL); SCLASS struct pthread *_thr_initial SCLASS_PRESET(NULL); /* For debugger */ SCLASS int _libkse_debug SCLASS_PRESET(0); SCLASS int _thread_activated SCLASS_PRESET(0); SCLASS int _thread_scope_system SCLASS_PRESET(0); /* List of all threads: */ SCLASS TAILQ_HEAD(, pthread) _thread_list SCLASS_PRESET(TAILQ_HEAD_INITIALIZER(_thread_list)); /* List of threads needing GC: */ SCLASS TAILQ_HEAD(, pthread) _thread_gc_list SCLASS_PRESET(TAILQ_HEAD_INITIALIZER(_thread_gc_list)); SCLASS int _thread_active_threads SCLASS_PRESET(1); SCLASS TAILQ_HEAD(atfork_head, pthread_atfork) _thr_atfork_list; SCLASS pthread_mutex_t _thr_atfork_mutex; /* Default thread attributes: */ SCLASS struct pthread_attr _pthread_attr_default SCLASS_PRESET({ SCHED_RR, 0, TIMESLICE_USEC, THR_DEFAULT_PRIORITY, THR_CREATE_RUNNING, PTHREAD_CREATE_JOINABLE, NULL, NULL, NULL, /* stacksize */0, /* guardsize */0 }); /* Default mutex attributes: */ SCLASS struct pthread_mutex_attr _pthread_mutexattr_default SCLASS_PRESET({PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, 0, 0 }); /* Default condition variable attributes: */ SCLASS struct pthread_cond_attr _pthread_condattr_default SCLASS_PRESET({COND_TYPE_FAST, 0}); /* Clock resolution in usec. */ SCLASS int _clock_res_usec SCLASS_PRESET(CLOCK_RES_USEC); /* Array of signal actions for this process: */ SCLASS struct sigaction _thread_sigact[_SIG_MAXSIG]; /* * Lock for above count of dummy handlers and for the process signal * mask and pending signal sets. */ SCLASS struct lock _thread_signal_lock; /* Pending signals and mask for this process: */ SCLASS sigset_t _thr_proc_sigpending; SCLASS siginfo_t _thr_proc_siginfo[_SIG_MAXSIG]; SCLASS pid_t _thr_pid SCLASS_PRESET(0); /* Garbage collector lock. */ SCLASS struct lock _gc_lock; SCLASS int _gc_check SCLASS_PRESET(0); SCLASS int _gc_count SCLASS_PRESET(0); SCLASS struct lock _mutex_static_lock; SCLASS struct lock _rwlock_static_lock; SCLASS struct lock _keytable_lock; SCLASS struct lock _thread_list_lock; SCLASS int _thr_guard_default; SCLASS int _thr_stack_default; SCLASS int _thr_stack_initial; SCLASS int _thr_page_size; SCLASS pthread_t _thr_sig_daemon; SCLASS int _thr_debug_flags SCLASS_PRESET(0); /* Undefine the storage class and preset specifiers: */ #undef SCLASS #undef SCLASS_PRESET /* * Function prototype definitions. */ __BEGIN_DECLS int _cond_reinit(pthread_cond_t *); struct kse *_kse_alloc(struct pthread *, int sys_scope); kse_critical_t _kse_critical_enter(void); void _kse_critical_leave(kse_critical_t); int _kse_in_critical(void); void _kse_free(struct pthread *, struct kse *); void _kse_init(void); struct kse_group *_kseg_alloc(struct pthread *); void _kse_lock_wait(struct lock *, struct lockuser *lu); void _kse_lock_wakeup(struct lock *, struct lockuser *lu); void _kse_single_thread(struct pthread *); int _kse_setthreaded(int); void _kseg_free(struct kse_group *); int _mutex_cv_lock(pthread_mutex_t *); int _mutex_cv_unlock(pthread_mutex_t *); void _mutex_notify_priochange(struct pthread *, struct pthread *, int); int _mutex_reinit(struct pthread_mutex *); void _mutex_unlock_private(struct pthread *); void _libpthread_init(struct pthread *); int _pq_alloc(struct pq_queue *, int, int); void _pq_free(struct pq_queue *); int _pq_init(struct pq_queue *); void _pq_remove(struct pq_queue *pq, struct pthread *); void _pq_insert_head(struct pq_queue *pq, struct pthread *); void _pq_insert_tail(struct pq_queue *pq, struct pthread *); struct pthread *_pq_first(struct pq_queue *pq); struct pthread *_pq_first_debug(struct pq_queue *pq); void *_pthread_getspecific(pthread_key_t); int _pthread_key_create(pthread_key_t *, void (*) (void *)); int _pthread_key_delete(pthread_key_t); int _pthread_mutex_destroy(pthread_mutex_t *); int _pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *); int _pthread_mutex_lock(pthread_mutex_t *); int _pthread_mutex_trylock(pthread_mutex_t *); int _pthread_mutex_unlock(pthread_mutex_t *); int _pthread_mutexattr_init(pthread_mutexattr_t *); int _pthread_mutexattr_destroy(pthread_mutexattr_t *); int _pthread_mutexattr_settype(pthread_mutexattr_t *, int); int _pthread_once(pthread_once_t *, void (*) (void)); int _pthread_rwlock_init(pthread_rwlock_t *, const pthread_rwlockattr_t *); int _pthread_rwlock_destroy (pthread_rwlock_t *); struct pthread *_pthread_self(void); int _pthread_setspecific(pthread_key_t, const void *); void _pthread_yield(void); void _pthread_cleanup_push(void (*routine) (void *), void *routine_arg); void _pthread_cleanup_pop(int execute); struct pthread *_thr_alloc(struct pthread *); void _thr_exit(char *, int, char *); void _thr_exit_cleanup(void); void _thr_lock_wait(struct lock *lock, struct lockuser *lu); void _thr_lock_wakeup(struct lock *lock, struct lockuser *lu); void _thr_mutex_reinit(pthread_mutex_t *); int _thr_ref_add(struct pthread *, struct pthread *, int); void _thr_ref_delete(struct pthread *, struct pthread *); void _thr_rtld_init(void); void _thr_rtld_fini(void); int _thr_schedule_add(struct pthread *, struct pthread *); void _thr_schedule_remove(struct pthread *, struct pthread *); void _thr_setrunnable(struct pthread *curthread, struct pthread *thread); struct kse_mailbox *_thr_setrunnable_unlocked(struct pthread *thread); struct kse_mailbox *_thr_sig_add(struct pthread *, int, siginfo_t *); void _thr_sig_dispatch(struct kse *, int, siginfo_t *); int _thr_stack_alloc(struct pthread_attr *); void _thr_stack_free(struct pthread_attr *); void _thr_exit_cleanup(void); void _thr_free(struct pthread *, struct pthread *); void _thr_gc(struct pthread *); void _thr_panic_exit(char *, int, char *); void _thread_cleanupspecific(void); void _thread_dump_info(void); void _thread_printf(int, const char *, ...); void _thr_sched_switch(struct pthread *); void _thr_sched_switch_unlocked(struct pthread *); void _thr_set_timeout(const struct timespec *); void _thr_seterrno(struct pthread *, int); void _thr_sig_handler(int, siginfo_t *, ucontext_t *); void _thr_sig_check_pending(struct pthread *); void _thr_sig_rundown(struct pthread *, ucontext_t *); void _thr_sig_send(struct pthread *pthread, int sig); void _thr_sigframe_restore(struct pthread *thread, struct pthread_sigframe *psf); void _thr_spinlock_init(void); void _thr_cancel_enter(struct pthread *); void _thr_cancel_leave(struct pthread *, int); int _thr_setconcurrency(int new_level); int _thr_setmaxconcurrency(void); void _thr_critical_enter(struct pthread *); void _thr_critical_leave(struct pthread *); int _thr_start_sig_daemon(void); int _thr_getprocsig(int sig, siginfo_t *siginfo); int _thr_getprocsig_unlocked(int sig, siginfo_t *siginfo); void _thr_signal_init(void); void _thr_signal_deinit(void); void _thr_hash_add(struct pthread *); void _thr_hash_remove(struct pthread *); struct pthread *_thr_hash_find(struct pthread *); void _thr_finish_cancellation(void *arg); int _thr_sigonstack(void *sp); void _thr_debug_check_yield(struct pthread *); /* * Aliases for _pthread functions. Should be called instead of * originals if PLT replocation is unwanted at runtme. */ int _thr_cond_broadcast(pthread_cond_t *); int _thr_cond_signal(pthread_cond_t *); int _thr_cond_wait(pthread_cond_t *, pthread_mutex_t *); int _thr_mutex_lock(pthread_mutex_t *); int _thr_mutex_unlock(pthread_mutex_t *); int _thr_rwlock_rdlock (pthread_rwlock_t *); int _thr_rwlock_wrlock (pthread_rwlock_t *); int _thr_rwlock_unlock (pthread_rwlock_t *); /* #include */ #ifdef _SYS_AIO_H_ int __sys_aio_suspend(const struct aiocb * const[], int, const struct timespec *); #endif /* #include */ #ifdef _SYS_FCNTL_H_ int __sys_fcntl(int, int, ...); int __sys_open(const char *, int, ...); #endif /* #include */ #ifdef _SYS_IOCTL_H_ int __sys_ioctl(int, unsigned long, ...); #endif /* #inclde */ #ifdef _SCHED_H_ int __sys_sched_yield(void); #endif /* #include */ #ifdef _SIGNAL_H_ int __sys_kill(pid_t, int); int __sys_sigaction(int, const struct sigaction *, struct sigaction *); int __sys_sigpending(sigset_t *); int __sys_sigprocmask(int, const sigset_t *, sigset_t *); int __sys_sigsuspend(const sigset_t *); int __sys_sigreturn(ucontext_t *); int __sys_sigaltstack(const struct sigaltstack *, struct sigaltstack *); #endif /* #include */ #ifdef _SYS_SOCKET_H_ int __sys_accept(int, struct sockaddr *, socklen_t *); int __sys_connect(int, const struct sockaddr *, socklen_t); int __sys_sendfile(int, int, off_t, size_t, struct sf_hdtr *, off_t *, int); #endif /* #include */ #ifdef _SYS_UIO_H_ ssize_t __sys_readv(int, const struct iovec *, int); ssize_t __sys_writev(int, const struct iovec *, int); #endif /* #include */ #ifdef _TIME_H_ int __sys_nanosleep(const struct timespec *, struct timespec *); #endif /* #include */ #ifdef _UNISTD_H_ int __sys_close(int); int __sys_execve(const char *, char * const *, char * const *); int __sys_fork(void); int __sys_fsync(int); pid_t __sys_getpid(void); int __sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); ssize_t __sys_read(int, void *, size_t); ssize_t __sys_write(int, const void *, size_t); void __sys_exit(int); int __sys_sigwait(const sigset_t *, int *); int __sys_sigtimedwait(sigset_t *, siginfo_t *, struct timespec *); #endif /* #include */ #ifdef _SYS_POLL_H_ int __sys_poll(struct pollfd *, unsigned, int); #endif /* #include */ #ifdef _SYS_MMAN_H_ int __sys_msync(void *, size_t, int); #endif static __inline int _thr_dump_enabled(void) { return ((_thr_debug_flags & DBG_INFO_DUMP) != 0); } #endif /* !_THR_PRIVATE_H */ Index: head/lib/librt/Makefile =================================================================== --- head/lib/librt/Makefile (revision 169523) +++ head/lib/librt/Makefile (revision 169524) @@ -1,18 +1,16 @@ # $FreeBSD$ LIB=rt SHLIB_MAJOR= 1 CFLAGS+=-I${.CURDIR}/../libc/include -I${.CURDIR} CFLAGS+=-Winline -Wall -g #MAN= libthr.3 SRCS+= aio.c mq.c sigev_thread.c timer.c PRECIOUSLIB= -.if defined(SYMVER_ENABLED) VERSION_MAP= ${.CURDIR}/Version.map -.endif .include Index: head/lib/libthr/Makefile =================================================================== --- head/lib/libthr/Makefile (revision 169523) +++ head/lib/libthr/Makefile (revision 169524) @@ -1,55 +1,55 @@ # $FreeBSD$ # # All library objects contain FreeBSD revision strings by default; they may be # excluded as a space-saving measure. To produce a library that does # not contain these strings, add -DSTRIP_FBSDID (see ) to CFLAGS # below. Note, there are no IDs for syscall stubs whose sources are generated. # To included legacy CSRG sccsid strings, add -DLIBC_SCCS and -DSYSLIBC_SCCS # (for system call stubs) to CFLAGS below. -DSYSLIBC_SCCS affects just the # system call stubs. -.include - -.if ${MACHINE_ARCH} == "sparc64" || ${MK_LIBPTHREAD} == "no" -SHLIBDIR= /lib +.if !defined(DEFAULT_THREAD_LIB) || (${DEFAULT_THREAD_LIB} == "libthr") +SHLIBDIR?= /lib .endif +.include + LIB=thr SHLIB_MAJOR= 2 CFLAGS+=-DPTHREAD_KERNEL CFLAGS+=-I${.CURDIR}/../libc/include -I${.CURDIR}/thread \ -I${.CURDIR}/../../include CFLAGS+=-I${.CURDIR}/arch/${MACHINE_ARCH}/include CFLAGS+=-I${.CURDIR}/sys CFLAGS+=-I${.CURDIR}/../../libexec/rtld-elf CFLAGS+=-I${.CURDIR}/../../libexec/rtld-elf/${MACHINE_ARCH} CFLAGS+=-I${.CURDIR}/../libthread_db CFLAGS+=-Winline # CFLAGS+=-DSYSTEM_SCOPE_ONLY -LDFLAGS= -Wl,--version-script=${.CURDIR}/pthread.map +VERSION_MAP=${.CURDIR}/pthread.map MAN= libthr.3 # enable extra internal consistancy checks CFLAGS+=-D_PTHREADS_INVARIANTS -Wall #CFLAGS+=-g PRECIOUSLIB= .include "${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.inc" .include "${.CURDIR}/sys/Makefile.inc" .include "${.CURDIR}/thread/Makefile.inc" -.if ${MACHINE_ARCH} == "sparc64" || ${MK_LIBPTHREAD} == "no" +.if ${DEFAULT_THREAD_LIB} == "libthr" SYMLINKS+=lib${LIB}.a ${LIBDIR}/libpthread.a .if !defined(NO_PIC) SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthread.so .endif .if ${MK_PROFILE} != "no" SYMLINKS+=lib${LIB}_p.a ${LIBDIR}/libpthread_p.a .endif .endif .include Index: head/lib/libthr/pthread.map =================================================================== --- head/lib/libthr/pthread.map (revision 169523) +++ head/lib/libthr/pthread.map (revision 169524) @@ -1,764 +1,390 @@ /* * $FreeBSD$ */ -LIBTHREAD_1_0 { -global: - ___creat; - ___pause; - ___pselect; - ___sleep; - ___system; - ___tcdrain; - ___usleep; - ___wait; - ___waitpid; - __accept; - __aio_suspend; - __close; - __connect; - __error; - __fcntl; - __fsync; - __msync; - __nanosleep; - __open; - __poll; - __pthread_cond_timedwait; - __pthread_cond_wait; - __pthread_mutex_init; - __pthread_mutex_lock; - __pthread_mutex_timedlock; - __pthread_mutex_trylock; - __read; - __readv; - __recvfrom; - __recvmsg; - __select; - __sendmsg; - __sendto; - __sigsuspend; - __sigtimedwait; - __sigwait; - __sigwaitinfo; - __wait3; - __wait4; - __write; - __writev; - _fork; - _pthread_atfork; - _pthread_barrier_destroy; - _pthread_barrier_init; - _pthread_barrier_wait; - _pthread_barrierattr_destroy; - _pthread_barrierattr_getpshared; - _pthread_barrierattr_init; - _pthread_barrierattr_setpshared; - _pthread_attr_destroy; - _pthread_attr_get_np; - _pthread_attr_getdetachstate; - _pthread_attr_getguardsize; - _pthread_attr_getinheritsched; - _pthread_attr_getschedparam; - _pthread_attr_getschedpolicy; - _pthread_attr_getscope; - _pthread_attr_getstack; - _pthread_attr_getstackaddr; - _pthread_attr_getstacksize; - _pthread_attr_init; - _pthread_attr_setcreatesuspend_np; - _pthread_attr_setdetachstate; - _pthread_attr_setguardsize; - _pthread_attr_setinheritsched; - _pthread_attr_setschedparam; - _pthread_attr_setschedpolicy; - _pthread_attr_setscope; - _pthread_attr_setstack; - _pthread_attr_setstackaddr; - _pthread_attr_setstacksize; - _pthread_cancel; - _pthread_cleanup_pop; - _pthread_cleanup_push; - _pthread_cond_broadcast; - _pthread_cond_destroy; - _pthread_cond_init; - _pthread_cond_signal; - _pthread_cond_timedwait; - _pthread_cond_wait; - _pthread_condattr_destroy; - _pthread_condattr_getclock; - _pthread_condattr_getpshared; - _pthread_condattr_init; - _pthread_condattr_setclock; - _pthread_condattr_setpshared; - _pthread_create; - _pthread_detach; - _pthread_equal; - _pthread_exit; - _pthread_getconcurrency; - _pthread_getprio; - _pthread_getschedparam; - _pthread_getspecific; - _pthread_join; - _pthread_key_create; - _pthread_key_delete; - _pthread_kill; - _pthread_main_np; - _pthread_multi_np; - _pthread_mutex_destroy; - _pthread_mutex_getprioceiling; - _pthread_mutex_init; - _pthread_mutex_lock; - _pthread_mutex_setprioceiling; - _pthread_mutex_timedlock; - _pthread_mutex_trylock; - _pthread_mutex_unlock; - _pthread_mutexattr_destroy; - _pthread_mutexattr_getkind_np; - _pthread_mutexattr_getprioceiling; - _pthread_mutexattr_getprotocol; - _pthread_mutexattr_getpshared; - _pthread_mutexattr_gettype; - _pthread_mutexattr_init; - _pthread_mutexattr_setkind_np; - _pthread_mutexattr_setprioceiling; - _pthread_mutexattr_setprotocol; - _pthread_mutexattr_setpshared; - _pthread_mutexattr_settype; - _pthread_once; - _pthread_resume_all_np; - _pthread_resume_np; - _pthread_rwlock_destroy; - _pthread_rwlock_init; - _pthread_rwlock_rdlock; - _pthread_rwlock_timedrdlock; - _pthread_rwlock_timedwrlock; - _pthread_rwlock_tryrdlock; - _pthread_rwlock_trywrlock; - _pthread_rwlock_unlock; - _pthread_rwlock_wrlock; - _pthread_rwlockattr_destroy; - _pthread_rwlockattr_getpshared; - _pthread_rwlockattr_init; - _pthread_rwlockattr_setpshared; - _pthread_self; - _pthread_set_name_np; - _pthread_setcancelstate; - _pthread_setcanceltype; - _pthread_setconcurrency; - _pthread_setprio; - _pthread_setschedparam; - _pthread_setspecific; - _pthread_sigmask; - _pthread_single_np; - _pthread_spin_destroy; - _pthread_spin_init; - _pthread_spin_lock; - _pthread_spin_trylock; - _pthread_spin_unlock; - _pthread_suspend_all_np; - _pthread_suspend_np; - _pthread_switch_add_np; - _pthread_switch_delete_np; - _pthread_testcancel; - _pthread_timedjoin_np; - _pthread_yield; - _raise; - _sem_destroy; - _sem_getvalue; - _sem_init; - _sem_post; - _sem_timedwait; - _sem_trywait; - _sem_wait; - _sigaction; - _sigprocmask; - _sigsuspend; - _sigtimedwait; - _sigwait; - _sigwaitinfo; - _spinlock; - _spinlock_debug; - _spinunlock; - _vfork; - accept; - aio_suspend; - close; - connect; - creat; - execve; - fcntl; - fork; - fsync; - msync; - nanosleep; - open; - pause; - poll; - pselect; - pthread_atfork; - pthread_barrier_destroy; - pthread_barrier_init; - pthread_barrier_wait; - pthread_barrierattr_destroy; - pthread_barrierattr_getpshared; - pthread_barrierattr_init; - pthread_barrierattr_setpshared; - pthread_attr_destroy; - pthread_attr_get_np; - pthread_attr_getdetachstate; - pthread_attr_getguardsize; - pthread_attr_getinheritsched; - pthread_attr_getschedparam; - pthread_attr_getschedpolicy; - pthread_attr_getscope; - pthread_attr_getstack; - pthread_attr_getstackaddr; - pthread_attr_getstacksize; - pthread_attr_init; - pthread_attr_setcreatesuspend_np; - pthread_attr_setdetachstate; - pthread_attr_setguardsize; - pthread_attr_setinheritsched; - pthread_attr_setschedparam; - pthread_attr_setschedpolicy; - pthread_attr_setscope; - pthread_attr_setstack; - pthread_attr_setstackaddr; - pthread_attr_setstacksize; - pthread_cancel; - pthread_cleanup_pop; - pthread_cleanup_push; - pthread_cond_broadcast; - pthread_cond_destroy; - pthread_cond_init; - pthread_cond_signal; - pthread_cond_timedwait; - pthread_cond_wait; - pthread_condattr_destroy; - pthread_condattr_getclock; - pthread_condattr_getpshared; - pthread_condattr_init; - pthread_condattr_setclock; - pthread_condattr_setpshared; - pthread_create; - pthread_detach; - pthread_equal; - pthread_exit; - pthread_getconcurrency; - pthread_getprio; - pthread_getschedparam; - pthread_getspecific; - pthread_join; - pthread_key_create; - pthread_key_delete; - pthread_kill; - pthread_main_np; - pthread_multi_np; - pthread_mutex_destroy; - pthread_mutex_getprioceiling; - pthread_mutex_init; - pthread_mutex_lock; - pthread_mutex_setprioceiling; - pthread_mutex_timedlock; - pthread_mutex_trylock; - pthread_mutex_unlock; - pthread_mutexattr_destroy; - pthread_mutexattr_getkind_np; - pthread_mutexattr_getprioceiling; - pthread_mutexattr_getpshared; - pthread_mutexattr_getprotocol; - pthread_mutexattr_gettype; - pthread_mutexattr_init; - pthread_mutexattr_setkind_np; - pthread_mutexattr_setprioceiling; - pthread_mutexattr_setprotocol; - pthread_mutexattr_setpshared; - pthread_mutexattr_settype; - pthread_once; - pthread_resume_all_np; - pthread_resume_np; - pthread_rwlock_destroy; - pthread_rwlock_init; - pthread_rwlock_rdlock; - pthread_rwlock_timedrdlock; - pthread_rwlock_timedwrlock; - pthread_rwlock_tryrdlock; - pthread_rwlock_trywrlock; - pthread_rwlock_unlock; - pthread_rwlock_wrlock; - pthread_rwlockattr_destroy; - pthread_rwlockattr_getpshared; - pthread_rwlockattr_init; - pthread_rwlockattr_setpshared; - pthread_self; - pthread_set_name_np; - pthread_setcancelstate; - pthread_setcanceltype; - pthread_setconcurrency; - pthread_setprio; - pthread_setschedparam; - pthread_setspecific; - pthread_sigmask; - pthread_single_np; - pthread_spin_destroy; - pthread_spin_init; - pthread_spin_lock; - pthread_spin_trylock; - pthread_spin_unlock; - pthread_suspend_all_np; - pthread_suspend_np; - pthread_switch_add_np; - pthread_switch_delete_np; - pthread_testcancel; - pthread_timedjoin_np; - pthread_yield; - raise; - read; - readv; - recvfrom; - recvmsg; - select; - sem_destroy; - sem_getvalue; - sem_init; - sem_post; - sem_timedwait; - sem_trywait; - sem_wait; - sendmsg; - sendto; - sigaction; - sigprocmask; - sigsuspend; - sigwait; - sigwaitinfo; - sigtimedwait; - sleep; - system; - tcdrain; - usleep; - vfork; - wait; - wait3; - wait4; - waitpid; - write; - writev; - - /* Debugger needs these. */ - _libthr_debug; - _thread_active_threads; - _thread_bp_create; - _thread_bp_death; - _thread_event_mask; - _thread_keytable; - _thread_last_event; - _thread_list; - _thread_max_keys; - _thread_off_attr_flags; - _thread_off_dtv; - _thread_off_event_buf; - _thread_off_event_mask; - _thread_off_key_allocated; - _thread_off_key_destructor; - _thread_off_linkmap; - _thread_off_next; - _thread_off_report_events; - _thread_off_state; - _thread_off_tcb; - _thread_off_tid; - _thread_off_tlsindex; - _thread_size_key; - _thread_state_running; - _thread_state_zoombie; -local: - *; -}; - /* * Use the same naming scheme as libc. */ FBSD_1.0 { global: __error; accept; aio_suspend; close; connect; creat; execve; fcntl; fork; fsync; msync; nanosleep; open; pause; poll; pselect; pthread_atfork; pthread_barrier_destroy; pthread_barrier_init; pthread_barrier_wait; pthread_barrierattr_destroy; pthread_barrierattr_getpshared; pthread_barrierattr_init; pthread_barrierattr_setpshared; pthread_attr_destroy; pthread_attr_get_np; pthread_attr_getdetachstate; pthread_attr_getguardsize; pthread_attr_getinheritsched; pthread_attr_getschedparam; pthread_attr_getschedpolicy; pthread_attr_getscope; pthread_attr_getstack; pthread_attr_getstackaddr; pthread_attr_getstacksize; pthread_attr_init; pthread_attr_setcreatesuspend_np; pthread_attr_setdetachstate; pthread_attr_setguardsize; pthread_attr_setinheritsched; pthread_attr_setschedparam; pthread_attr_setschedpolicy; pthread_attr_setscope; pthread_attr_setstack; pthread_attr_setstackaddr; pthread_attr_setstacksize; pthread_cancel; pthread_cleanup_pop; pthread_cleanup_push; pthread_cond_broadcast; pthread_cond_destroy; pthread_cond_init; pthread_cond_signal; pthread_cond_timedwait; pthread_cond_wait; pthread_condattr_destroy; pthread_condattr_getclock; pthread_condattr_getpshared; pthread_condattr_init; pthread_condattr_setclock; pthread_condattr_setpshared; pthread_create; pthread_detach; pthread_equal; pthread_exit; pthread_getconcurrency; pthread_getprio; pthread_getschedparam; pthread_getspecific; pthread_join; pthread_key_create; pthread_key_delete; pthread_kill; pthread_main_np; pthread_multi_np; pthread_mutex_destroy; pthread_mutex_getprioceiling; pthread_mutex_init; pthread_mutex_lock; pthread_mutex_setprioceiling; pthread_mutex_timedlock; pthread_mutex_trylock; pthread_mutex_unlock; pthread_mutexattr_destroy; pthread_mutexattr_getkind_np; pthread_mutexattr_getprioceiling; pthread_mutexattr_getpshared; pthread_mutexattr_getprotocol; pthread_mutexattr_gettype; pthread_mutexattr_init; pthread_mutexattr_setkind_np; pthread_mutexattr_setprioceiling; pthread_mutexattr_setprotocol; pthread_mutexattr_setpshared; pthread_mutexattr_settype; pthread_once; pthread_resume_all_np; pthread_resume_np; pthread_rwlock_destroy; pthread_rwlock_init; pthread_rwlock_rdlock; pthread_rwlock_timedrdlock; pthread_rwlock_timedwrlock; pthread_rwlock_tryrdlock; pthread_rwlock_trywrlock; pthread_rwlock_unlock; pthread_rwlock_wrlock; pthread_rwlockattr_destroy; pthread_rwlockattr_getpshared; pthread_rwlockattr_init; pthread_rwlockattr_setpshared; pthread_self; pthread_set_name_np; pthread_setcancelstate; pthread_setcanceltype; pthread_setconcurrency; pthread_setprio; pthread_setschedparam; pthread_setspecific; pthread_sigmask; pthread_single_np; pthread_spin_destroy; pthread_spin_init; pthread_spin_lock; pthread_spin_trylock; pthread_spin_unlock; pthread_suspend_all_np; pthread_suspend_np; pthread_switch_add_np; pthread_switch_delete_np; pthread_testcancel; pthread_timedjoin_np; pthread_yield; raise; read; readv; recvfrom; recvmsg; select; sem_destroy; sem_getvalue; sem_init; sem_post; sem_timedwait; sem_trywait; sem_wait; sendmsg; sendto; sigaction; sigprocmask; sigsuspend; sigwait; sigwaitinfo; sigtimedwait; sleep; system; tcdrain; usleep; vfork; wait; wait3; wait4; waitpid; write; writev; local: *; }; /* * List the private interfaces reserved for use in FreeBSD libraries. * These are not part of our application ABI. */ FBSDprivate_1.0 { global: ___creat; ___pause; ___pselect; ___sleep; ___system; ___tcdrain; ___usleep; ___wait; ___waitpid; __accept; __aio_suspend; __close; __connect; __fcntl; __fsync; __msync; __nanosleep; __open; __poll; __pthread_cond_timedwait; __pthread_cond_wait; __pthread_mutex_init; __pthread_mutex_lock; __pthread_mutex_timedlock; __pthread_mutex_trylock; __read; __readv; __recvfrom; __recvmsg; __select; __sendmsg; __sendto; __sigsuspend; __sigtimedwait; __sigwait; __sigwaitinfo; __wait3; __wait4; __write; __writev; _fork; _pthread_atfork; _pthread_barrier_destroy; _pthread_barrier_init; _pthread_barrier_wait; _pthread_barrierattr_destroy; _pthread_barrierattr_getpshared; _pthread_barrierattr_init; _pthread_barrierattr_setpshared; _pthread_attr_destroy; _pthread_attr_get_np; _pthread_attr_getdetachstate; _pthread_attr_getguardsize; _pthread_attr_getinheritsched; _pthread_attr_getschedparam; _pthread_attr_getschedpolicy; _pthread_attr_getscope; _pthread_attr_getstack; _pthread_attr_getstackaddr; _pthread_attr_getstacksize; _pthread_attr_init; _pthread_attr_setcreatesuspend_np; _pthread_attr_setdetachstate; _pthread_attr_setguardsize; _pthread_attr_setinheritsched; _pthread_attr_setschedparam; _pthread_attr_setschedpolicy; _pthread_attr_setscope; _pthread_attr_setstack; _pthread_attr_setstackaddr; _pthread_attr_setstacksize; _pthread_cancel; _pthread_cleanup_pop; _pthread_cleanup_push; _pthread_cond_broadcast; _pthread_cond_destroy; _pthread_cond_init; _pthread_cond_signal; _pthread_cond_timedwait; _pthread_cond_wait; _pthread_condattr_destroy; _pthread_condattr_getclock; _pthread_condattr_getpshared; _pthread_condattr_init; _pthread_condattr_setclock; _pthread_condattr_setpshared; _pthread_create; _pthread_detach; _pthread_equal; _pthread_exit; _pthread_getconcurrency; _pthread_getprio; _pthread_getschedparam; _pthread_getspecific; _pthread_join; _pthread_key_create; _pthread_key_delete; _pthread_kill; _pthread_main_np; _pthread_multi_np; _pthread_mutex_destroy; _pthread_mutex_getprioceiling; _pthread_mutex_init; _pthread_mutex_lock; _pthread_mutex_setprioceiling; _pthread_mutex_timedlock; _pthread_mutex_trylock; _pthread_mutex_unlock; _pthread_mutexattr_destroy; _pthread_mutexattr_getkind_np; _pthread_mutexattr_getprioceiling; _pthread_mutexattr_getprotocol; _pthread_mutexattr_getpshared; _pthread_mutexattr_gettype; _pthread_mutexattr_init; _pthread_mutexattr_setkind_np; _pthread_mutexattr_setprioceiling; _pthread_mutexattr_setprotocol; _pthread_mutexattr_setpshared; _pthread_mutexattr_settype; _pthread_once; _pthread_resume_all_np; _pthread_resume_np; _pthread_rwlock_destroy; _pthread_rwlock_init; _pthread_rwlock_rdlock; _pthread_rwlock_timedrdlock; _pthread_rwlock_timedwrlock; _pthread_rwlock_tryrdlock; _pthread_rwlock_trywrlock; _pthread_rwlock_unlock; _pthread_rwlock_wrlock; _pthread_rwlockattr_destroy; _pthread_rwlockattr_getpshared; _pthread_rwlockattr_init; _pthread_rwlockattr_setpshared; _pthread_self; _pthread_set_name_np; _pthread_setcancelstate; _pthread_setcanceltype; _pthread_setconcurrency; _pthread_setprio; _pthread_setschedparam; _pthread_setspecific; _pthread_sigmask; _pthread_single_np; _pthread_spin_destroy; _pthread_spin_init; _pthread_spin_lock; _pthread_spin_trylock; _pthread_spin_unlock; _pthread_suspend_all_np; _pthread_suspend_np; _pthread_switch_add_np; _pthread_switch_delete_np; _pthread_testcancel; _pthread_timedjoin_np; _pthread_yield; _raise; _sem_destroy; _sem_getvalue; _sem_init; _sem_post; _sem_timedwait; _sem_trywait; _sem_wait; _sigaction; _sigprocmask; _sigsuspend; _sigtimedwait; _sigwait; _sigwaitinfo; _spinlock; _spinlock_debug; _spinunlock; _vfork; /* Debugger needs these. */ _libthr_debug; _thread_active_threads; _thread_bp_create; _thread_bp_death; _thread_event_mask; _thread_keytable; _thread_last_event; _thread_list; _thread_max_keys; _thread_off_attr_flags; _thread_off_dtv; _thread_off_event_buf; _thread_off_event_mask; _thread_off_key_allocated; _thread_off_key_destructor; _thread_off_linkmap; _thread_off_next; _thread_off_report_events; _thread_off_state; _thread_off_tcb; _thread_off_tid; _thread_off_tlsindex; _thread_size_key; _thread_state_running; _thread_state_zoombie; local: *; }; Index: head/lib/libthread_db/Makefile =================================================================== --- head/lib/libthread_db/Makefile (revision 169523) +++ head/lib/libthread_db/Makefile (revision 169524) @@ -1,21 +1,19 @@ # $FreeBSD$ .PATH: ${.CURDIR}/arch/${MACHINE_ARCH} LIB= thread_db SHLIB_MAJOR= 2 SRCS= thread_db.c SRCS+= libpthread_db.c libpthread_md.c SRCS+= libthr_db.c INCS= thread_db.h WARNS?= 1 CFLAGS+=-I. -I${.CURDIR} SYM_MAPS+=${.CURDIR}/Symbol.map -.if defined(SYMVER_ENABLED) SYMBOL_MAPS=${SYM_MAPS} VERSION_DEF=${.CURDIR}/../libc/Versions.def -.endif .include Index: head/lib/msun/Makefile =================================================================== --- head/lib/msun/Makefile (revision 169523) +++ head/lib/msun/Makefile (revision 169524) @@ -1,164 +1,162 @@ # @(#)Makefile 5.1beta 93/09/24 # $FreeBSD$ # # ==================================================== # Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. # # Developed at SunPro, a Sun Microsystems, Inc. business. # Permission to use, copy, modify, and distribute this # software is freely granted, provided that this notice # is preserved. # ==================================================== # # .if ${MACHINE_ARCH} == "i386" ARCH_SUBDIR= i387 .else ARCH_SUBDIR= ${MACHINE_ARCH} .endif .include "${ARCH_SUBDIR}/Makefile.inc" .PATH: ${.CURDIR}/bsdsrc .PATH: ${.CURDIR}/man .PATH: ${.CURDIR}/src LIB= m SHLIBDIR?= /lib SHLIB_MAJOR= 4 COMMON_SRCS= b_exp.c b_log.c b_tgamma.c \ e_acos.c e_acosf.c e_acosh.c e_acoshf.c e_asin.c e_asinf.c \ e_atan2.c e_atan2f.c e_atanh.c e_atanhf.c e_cosh.c e_coshf.c e_exp.c \ e_expf.c e_fmod.c e_fmodf.c e_gamma.c e_gamma_r.c e_gammaf.c \ e_gammaf_r.c e_hypot.c e_hypotf.c e_j0.c e_j0f.c e_j1.c e_j1f.c \ e_jn.c e_jnf.c e_lgamma.c e_lgamma_r.c e_lgammaf.c e_lgammaf_r.c \ e_log.c e_log10.c e_log10f.c e_logf.c e_pow.c e_powf.c e_rem_pio2.c \ e_rem_pio2f.c e_remainder.c e_remainderf.c e_scalb.c e_scalbf.c \ e_sinh.c e_sinhf.c e_sqrt.c e_sqrtf.c fenv.c \ k_cos.c k_cosf.c k_rem_pio2.c k_sin.c k_sinf.c \ k_tan.c k_tanf.c \ s_asinh.c s_asinhf.c s_atan.c s_atanf.c s_cbrt.c s_cbrtf.c \ s_ceil.c s_ceilf.c s_ceill.c \ s_copysign.c s_copysignf.c s_cos.c s_cosf.c s_erf.c s_erff.c \ s_exp2.c s_exp2f.c s_expm1.c s_expm1f.c s_fabsf.c s_fdim.c \ s_finite.c s_finitef.c \ s_floor.c s_floorf.c s_floorl.c s_fma.c s_fmaf.c \ s_fmax.c s_fmaxf.c s_fmaxl.c s_fmin.c \ s_fminf.c s_fminl.c s_frexp.c s_frexpf.c s_ilogb.c s_ilogbf.c \ s_ilogbl.c s_isfinite.c s_isnan.c s_isnormal.c \ s_llrint.c s_llrintf.c s_llround.c s_llroundf.c s_llroundl.c \ s_log1p.c s_log1pf.c s_logb.c s_logbf.c s_lrint.c s_lrintf.c \ s_lround.c s_lroundf.c s_lroundl.c s_modff.c \ s_nearbyint.c s_nextafter.c s_nextafterf.c \ s_nexttowardf.c s_remquo.c s_remquof.c \ s_rint.c s_rintf.c s_round.c s_roundf.c s_roundl.c \ s_scalbln.c s_scalbn.c s_scalbnf.c s_signbit.c \ s_signgam.c s_significand.c s_significandf.c s_sin.c s_sinf.c s_tan.c \ s_tanf.c s_tanh.c s_tanhf.c s_trunc.c s_truncf.c s_truncl.c \ w_cabs.c w_cabsf.c w_drem.c w_dremf.c # Location of fpmath.h and _fpmath.h LIBCDIR= ${.CURDIR}/../libc CFLAGS+= -I${LIBCDIR}/include -I${LIBCDIR}/${MACHINE_ARCH} SYM_MAPS+= ${.CURDIR}/Symbol.map -.if defined(SYMVER_ENABLED) VERSION_DEF= ${LIBCDIR}/Versions.def SYMBOL_MAPS= ${SYM_MAPS} -.endif # C99 long double functions COMMON_SRCS+= s_copysignl.c s_fabsl.c s_modfl.c .if ${LDBL_PREC} != 53 # If long double != double use these; otherwise, we alias the double versions. COMMON_SRCS+= s_fmal.c s_frexpl.c s_nextafterl.c s_nexttoward.c s_scalbnl.c .endif # C99 complex functions COMMON_SRCS+= s_cimag.c s_cimagf.c s_cimagl.c s_conj.c s_conjf.c s_conjl.c \ s_creal.c s_crealf.c s_creall.c # FreeBSD's C library supplies these functions: #COMMON_SRCS+= s_fabs.c s_frexp.c s_isnan.c s_ldexp.c s_modf.c # Exclude the generic versions of what we provide in the MD area. .PATH: ${.CURDIR}/${ARCH_SUBDIR} .if defined(ARCH_SRCS) .for i in ${ARCH_SRCS} COMMON_SRCS:= ${COMMON_SRCS:N${i:R}.c} .endfor .endif SRCS= ${COMMON_SRCS} ${ARCH_SRCS} INCS= fenv.h math.h MAN= acos.3 acosh.3 asin.3 asinh.3 atan.3 atan2.3 atanh.3 ceil.3 \ cimag.3 copysign.3 cos.3 cosh.3 erf.3 exp.3 fabs.3 fdim.3 \ feclearexcept.3 feenableexcept.3 fegetenv.3 \ fegetround.3 fenv.3 floor.3 \ fma.3 fmax.3 fmod.3 hypot.3 ieee.3 ieee_test.3 ilogb.3 j0.3 \ lgamma.3 lrint.3 lround.3 math.3 nextafter.3 remainder.3 rint.3 \ round.3 scalbn.3 signbit.3 sin.3 sinh.3 sqrt.3 tan.3 tanh.3 trunc.3 MLINKS+=acos.3 acosf.3 MLINKS+=acosh.3 acoshf.3 MLINKS+=asin.3 asinf.3 MLINKS+=asinh.3 asinhf.3 MLINKS+=atan.3 atanf.3 MLINKS+=atanh.3 atanhf.3 MLINKS+=atan2.3 atan2f.3 MLINKS+=ceil.3 ceilf.3 ceil.3 ceill.3 MLINKS+=cimag.3 cimagf.3 cimag.3 cimagl.3 \ cimag.3 conj.3 cimag.3 conjf.3 cimag.3 conjl.3 \ cimag.3 creal.3 cimag.3 crealf.3 cimag.3 creall.3 MLINKS+=copysign.3 copysignf.3 copysign.3 copysignl.3 MLINKS+=cos.3 cosf.3 MLINKS+=cosh.3 coshf.3 MLINKS+=erf.3 erfc.3 erf.3 erff.3 erf.3 erfcf.3 MLINKS+=exp.3 expm1.3 exp.3 log.3 exp.3 log10.3 exp.3 log1p.3 exp.3 pow.3 \ exp.3 exp2.3 exp.3 exp2f.3 exp.3 expf.3 \ exp.3 expm1f.3 exp.3 logf.3 exp.3 powf.3 \ exp.3 log10f.3 exp.3 log1pf.3 MLINKS+=fabs.3 fabsf.3 fabs.3 fabsl.3 MLINKS+=fdim.3 fdimf.3 fdim.3 fdiml.3 MLINKS+=feclearexcept.3 fegetexceptflag.3 feclearexcept.3 feraiseexcept.3 \ feclearexcept.3 fesetexceptflag.3 feclearexcept.3 fetestexcept.3 MLINKS+=feenableexcept.3 fedisableexcept.3 feenableexcept.3 fegetexcept.3 MLINKS+=fegetenv.3 feholdexcept.3 fegetenv.3 fesetenv.3 \ fegetenv.3 feupdateenv.3 MLINKS+=fegetround.3 fesetround.3 MLINKS+=floor.3 floorf.3 floor.3 floorl.3 MLINKS+=fma.3 fmaf.3 fma.3 fmal.3 MLINKS+=fmax.3 fmaxf.3 fmax.3 fmaxl.3 \ fmax.3 fmin.3 fmax.3 fminf.3 fmax.3 fminl.3 MLINKS+=fmod.3 fmodf.3 MLINKS+=hypot.3 cabs.3 hypot.3 cabsf.3 hypot.3 hypotf.3 MLINKS+=ieee_test.3 scalb.3 ieee_test.3 scalbf.3 MLINKS+=ieee_test.3 significand.3 ieee_test.3 significandf.3 MLINKS+=ilogb.3 ilogbf.3 ilogb.3 ilogbl.3 \ ilogb.3 logb.3 ilogb.3 logbf.3 MLINKS+=j0.3 j1.3 j0.3 jn.3 j0.3 y0.3 j0.3 y1.3 j0.3 y1f.3 j0.3 yn.3 MLINKS+=j0.3 j0f.3 j0.3 j1f.3 j0.3 jnf.3 j0.3 y0f.3 j0.3 ynf.3 MLINKS+=lgamma.3 gamma.3 lgamma.3 gammaf.3 lgamma.3 lgammaf.3 lgamma.3 tgamma.3 MLINKS+=lrint.3 llrint.3 lrint.3 llrintf.3 lrint.3 lrintf.3 MLINKS+=lround.3 llround.3 lround.3 llroundf.3 lround.3 llroundl.3 \ lround.3 lroundf.3 lround.3 lroundl.3 MLINKS+=nextafter.3 nextafterf.3 nextafter.3 nextafterl.3 MLINKS+=nextafter.3 nexttoward.3 nextafter.3 nexttowardf.3 MLINKS+=nextafter.3 nexttowardl.3 MLINKS+=remainder.3 remainderf.3 MLINKS+=remainder.3 remquo.3 remainder.3 remquof.3 MLINKS+=rint.3 rintf.3 rint.3 nearbyint.3 rint.3 nearbyintf.3 MLINKS+=round.3 roundf.3 round.3 roundl.3 MLINKS+=scalbn.3 scalbln.3 scalbn.3 scalblnf.3 scalbn.3 scalblnl.3 MLINKS+=scalbn.3 scalbnf.3 scalbn.3 scalbnl.3 MLINKS+=sin.3 sinf.3 MLINKS+=sinh.3 sinhf.3 MLINKS+=sqrt.3 cbrt.3 sqrt.3 cbrtf.3 sqrt.3 sqrtf.3 MLINKS+=tan.3 tanf.3 MLINKS+=tanh.3 tanhf.3 MLINKS+=trunc.3 truncf.3 trunc.3 truncl.3 .include Index: head/libexec/rtld-elf/Makefile =================================================================== --- head/libexec/rtld-elf/Makefile (revision 169523) +++ head/libexec/rtld-elf/Makefile (revision 169524) @@ -1,52 +1,54 @@ # $FreeBSD$ +.include + PROG?= ld-elf.so.1 SRCS= rtld_start.S \ reloc.c rtld.c rtld_lock.c map_object.c \ malloc.c xmalloc.c debug.c libmap.c MAN= rtld.1 CSTD?= gnu99 CFLAGS+= -Wall -DFREEBSD_ELF -DIN_RTLD CFLAGS+= -I${.CURDIR}/${MACHINE_ARCH} -I${.CURDIR} LDFLAGS+= -nostdlib -e .rtld_start INSTALLFLAGS= -C -b PRECIOUSPROG= BINDIR= /libexec SYMLINKS= ${BINDIR}/${PROG} /usr/libexec/${PROG} MLINKS= rtld.1 ld-elf.so.1.1 \ rtld.1 ld.so.1 CFLAGS+= -fpic -DPIC LDFLAGS+= -shared -Wl,-Bsymbolic DPADD= ${LIBC_PIC} LDADD= -lc_pic -.if defined(SYMVER_ENABLED) +.if ${MK_SYMVER} == "yes" LIBCDIR= ${.CURDIR}/../../lib/libc VERSION_DEF= ${LIBCDIR}/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map VERSION_MAP= Version.map LDFLAGS+= -Wl,--version-script=${VERSION_MAP} ${PROG}: ${VERSION_MAP} .if exists(${.CURDIR}/${MACHINE_ARCH}/Symbol.map) SYMBOL_MAPS+= ${.CURDIR}/${MACHINE_ARCH}/Symbol.map .endif .endif .if exists(${.CURDIR}/${MACHINE_ARCH}/Makefile.inc) .include "${.CURDIR}/${MACHINE_ARCH}/Makefile.inc" .endif # Since moving rtld-elf to /libexec, we need to create a symlink. # Fixup the existing binary that's there so we can symlink over it. beforeinstall: .if exists(${DESTDIR}/usr/libexec/${PROG}) -chflags noschg ${DESTDIR}/usr/libexec/${PROG} .endif .PATH: ${.CURDIR}/${MACHINE_ARCH} .include .include Index: head/share/mk/bsd.lib.mk =================================================================== --- head/share/mk/bsd.lib.mk (revision 169523) +++ head/share/mk/bsd.lib.mk (revision 169524) @@ -1,353 +1,353 @@ # from: @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91 # $FreeBSD$ # .include # Set up the variables controlling shared libraries. After this section, # SHLIB_NAME will be defined only if we are to create a shared library. # SHLIB_LINK will be defined only if we are to create a link to it. # INSTALL_PIC_ARCHIVE will be defined only if we are to create a PIC archive. .if defined(NO_PIC) .undef SHLIB_NAME .undef INSTALL_PIC_ARCHIVE .else .if !defined(SHLIB) && defined(LIB) SHLIB= ${LIB} .endif .if !defined(SHLIB_NAME) && defined(SHLIB) && defined(SHLIB_MAJOR) SHLIB_NAME= lib${SHLIB}.so.${SHLIB_MAJOR} .endif .if defined(SHLIB_NAME) && !empty(SHLIB_NAME:M*.so.*) SHLIB_LINK?= ${SHLIB_NAME:R} .endif SONAME?= ${SHLIB_NAME} .endif .if defined(CRUNCH_CFLAGS) CFLAGS+= ${CRUNCH_CFLAGS} .endif .if ${MK_ASSERT_DEBUG} == "no" CFLAGS+= -DNDEBUG NO_WERROR= .endif .if defined(DEBUG_FLAGS) CFLAGS+= ${DEBUG_FLAGS} .endif .if !defined(DEBUG_FLAGS) STRIP?= -s .endif .include # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries # .So used for PIC object files .SUFFIXES: .SUFFIXES: .out .o .po .So .S .asm .s .c .cc .cpp .cxx .m .C .f .y .l .ln .if !defined(PICFLAG) .if ${MACHINE_ARCH} == "sparc64" PICFLAG=-fPIC .else PICFLAG=-fpic .endif .endif .if ${CC} == "icc" PO_FLAG=-p .else PO_FLAG=-pg .endif .c.po: ${CC} ${PO_FLAG} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} .c.So: ${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} .cc.po .C.po .cpp.po .cxx.po: ${CXX} ${PO_FLAG} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} .cc.So .C.So .cpp.So .cxx.So: ${CXX} ${PICFLAG} -DPIC ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} .f.po: ${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} .f.So: ${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} .m.po: ${OBJC} ${OBJCFLAGS} -pg -c ${.IMPSRC} -o ${.TARGET} .m.So: ${OBJC} ${PICFLAG} -DPIC ${OBJCFLAGS} -c ${.IMPSRC} -o ${.TARGET} .s.po .s.So: ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} .asm.po: ${CC} -x assembler-with-cpp -DPROF ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} .asm.So: ${CC} -x assembler-with-cpp ${PICFLAG} -DPIC ${CFLAGS} \ -c ${.IMPSRC} -o ${.TARGET} .S.po: ${CC} -DPROF ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} .S.So: ${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} all: objwarn .include # Allow librararies to specify their own version map or have it # automatically generated (see bsd.symver.mk above). -.if !empty(VERSION_MAP) +.if (${MK_SYMVER} == "yes") && !empty(VERSION_MAP) ${SHLIB_NAME}: ${VERSION_MAP} LDFLAGS+= -Wl,--version-script=${VERSION_MAP} .endif .if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME) OBJS+= ${SRCS:N*.h:R:S/$/.o/} .endif .if defined(LIB) && !empty(LIB) _LIBS= lib${LIB}.a lib${LIB}.a: ${OBJS} ${STATICOBJS} @${ECHO} building static ${LIB} library @rm -f ${.TARGET} .if !defined(NM) @${AR} cq ${.TARGET} `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD} .else @${AR} cq ${.TARGET} `NM='${NM}' lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD} .endif ${RANLIB} ${.TARGET} .endif .if !defined(INTERNALLIB) .if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB) _LIBS+= lib${LIB}_p.a POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po} lib${LIB}_p.a: ${POBJS} @${ECHO} building profiled ${LIB} library @rm -f ${.TARGET} .if !defined(NM) @${AR} cq ${.TARGET} `lorder ${POBJS} | tsort -q` ${ARADD} .else @${AR} cq ${.TARGET} `NM='${NM}' lorder ${POBJS} | tsort -q` ${ARADD} .endif ${RANLIB} ${.TARGET} .endif .if defined(SHLIB_NAME) || \ defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) SOBJS+= ${OBJS:.o=.So} .endif .if defined(SHLIB_NAME) _LIBS+= ${SHLIB_NAME} ${SHLIB_NAME}: ${SOBJS} @${ECHO} building shared library ${SHLIB_NAME} @rm -f ${.TARGET} ${SHLIB_LINK} .if defined(SHLIB_LINK) @ln -fs ${.TARGET} ${SHLIB_LINK} .endif .if !defined(NM) @${CC} ${LDFLAGS} -shared -Wl,-x \ -o ${.TARGET} -Wl,-soname,${SONAME} \ `lorder ${SOBJS} | tsort -q` ${LDADD} .else @${CC} ${LDFLAGS} -shared -Wl,-x \ -o ${.TARGET} -Wl,-soname,${SONAME} \ `NM='${NM}' lorder ${SOBJS} | tsort -q` ${LDADD} .endif .endif .if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no" _LIBS+= lib${LIB}_pic.a lib${LIB}_pic.a: ${SOBJS} @${ECHO} building special pic ${LIB} library @rm -f ${.TARGET} @${AR} cq ${.TARGET} ${SOBJS} ${ARADD} ${RANLIB} ${.TARGET} .endif .if defined(WANT_LINT) && !defined(NO_LINT) && defined(LIB) && !empty(LIB) LINTLIB= llib-l${LIB}.ln _LIBS+= ${LINTLIB} LINTOBJS+= ${SRCS:M*.c:.c=.ln} ${LINTLIB}: ${LINTOBJS} @${ECHO} building lint library ${.TARGET} @rm -f ${.TARGET} ${LINT} ${LINTLIBFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC} .endif .endif # !defined(INTERNALLIB) all: ${_LIBS} .if ${MK_MAN} != "no" all: _manpages .endif _EXTRADEPEND: @TMP=_depend$$$$; \ sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.So:/' < ${DEPENDFILE} \ > $$TMP; \ mv $$TMP ${DEPENDFILE} .if !defined(NO_EXTRADEPEND) && defined(SHLIB_NAME) .if defined(DPADD) && !empty(DPADD) echo ${SHLIB_NAME}: ${DPADD} >> ${DEPENDFILE} .endif .endif .if !target(install) .if defined(PRECIOUSLIB) .if !defined(NO_FSCHG) SHLINSTALLFLAGS+= -fschg .endif SHLINSTALLFLAGS+= -S .endif _INSTALLFLAGS:= ${INSTALLFLAGS} .for ie in ${INSTALLFLAGS_EDIT} _INSTALLFLAGS:= ${_INSTALLFLAGS${ie}} .endfor _SHLINSTALLFLAGS:= ${SHLINSTALLFLAGS} .for ie in ${INSTALLFLAGS_EDIT} _SHLINSTALLFLAGS:= ${_SHLINSTALLFLAGS${ie}} .endfor .if !defined(INTERNALLIB) realinstall: _libinstall .ORDER: beforeinstall _libinstall _libinstall: .if defined(LIB) && !empty(LIB) && !defined(NO_INSTALLLIB) ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} lib${LIB}.a ${DESTDIR}${LIBDIR} .endif .if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB) ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} lib${LIB}_p.a ${DESTDIR}${LIBDIR} .endif .if defined(SHLIB_NAME) ${INSTALL} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \ ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR} .if defined(SHLIB_LINK) .if ${SHLIBDIR} == ${LIBDIR} ln -fs ${SHLIB_NAME} ${DESTDIR}${LIBDIR}/${SHLIB_LINK} .else ln -fs ${_SHLIBDIRPREFIX}${SHLIBDIR}/${SHLIB_NAME} \ ${DESTDIR}${LIBDIR}/${SHLIB_LINK} .if exists(${DESTDIR}${LIBDIR}/${SHLIB_NAME}) -chflags noschg ${DESTDIR}${LIBDIR}/${SHLIB_NAME} rm -f ${DESTDIR}${LIBDIR}/${SHLIB_NAME} .endif .endif .endif .endif .if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no" ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${LIBDIR} .endif .if defined(WANT_LINT) && !defined(NO_LINT) && defined(LIB) && !empty(LIB) ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} ${LINTLIB} ${DESTDIR}${LINTLIBDIR} .endif .endif # !defined(INTERNALLIB) .include .include .include .include .if ${MK_MAN} != "no" realinstall: _maninstall .ORDER: beforeinstall _maninstall .endif .endif .if !target(lint) lint: ${SRCS:M*.c} ${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC} .endif .if ${MK_MAN} != "no" .include .endif .include .if !exists(${.OBJDIR}/${DEPENDFILE}) .if defined(LIB) && !empty(LIB) ${OBJS} ${STATICOBJS} ${POBJS}: ${SRCS:M*.h} .for _S in ${SRCS:N*.[hly]} ${_S:R}.po: ${_S} .endfor .endif .if defined(SHLIB_NAME) || \ defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) ${SOBJS}: ${SRCS:M*.h} .for _S in ${SRCS:N*.[hly]} ${_S:R}.So: ${_S} .endfor .endif .endif .if !target(clean) clean: .if defined(CLEANFILES) && !empty(CLEANFILES) rm -f ${CLEANFILES} .endif .if defined(LIB) && !empty(LIB) rm -f a.out ${OBJS} ${OBJS:S/$/.tmp/} ${STATICOBJS} .endif .if !defined(INTERNALLIB) .if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB) rm -f ${POBJS} ${POBJS:S/$/.tmp/} .endif .if defined(SHLIB_NAME) || \ defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) rm -f ${SOBJS} ${SOBJS:.So=.so} ${SOBJS:S/$/.tmp/} .endif .if defined(SHLIB_NAME) .if defined(SHLIB_LINK) rm -f ${SHLIB_LINK} .endif .if defined(LIB) && !empty(LIB) rm -f lib${LIB}.so.* lib${LIB}.so .endif .endif .if defined(WANT_LINT) && defined(LIB) && !empty(LIB) rm -f ${LINTOBJS} .endif .endif # !defined(INTERNALLIB) .if defined(_LIBS) && !empty(_LIBS) rm -f ${_LIBS} .endif .if defined(CLEANDIRS) && !empty(CLEANDIRS) rm -rf ${CLEANDIRS} .endif .if !empty(VERSION_DEF) && !empty(SYMBOL_MAPS) rm -f ${VERSION_MAP} .endif .endif .include .include Index: head/share/mk/bsd.libnames.mk =================================================================== --- head/share/mk/bsd.libnames.mk (revision 169523) +++ head/share/mk/bsd.libnames.mk (revision 169524) @@ -1,152 +1,156 @@ # $FreeBSD$ # The include file define library names. # Other include files (e.g. bsd.prog.mk, bsd.lib.mk) include this # file where necessary. .if !target(____) .error bsd.libnames.mk cannot be included directly. .endif LIBCRT0?= ${DESTDIR}${LIBDIR}/crt0.o LIBALIAS?= ${DESTDIR}${LIBDIR}/libalias.a LIBARCHIVE?= ${DESTDIR}${LIBDIR}/libarchive.a LIBASN1?= ${DESTDIR}${LIBDIR}/libasn1.a LIBATM?= ${DESTDIR}${LIBDIR}/libatm.a LIBAVL?= ${DESTDIR}${LIBDIR}/libavl.a LIBBEGEMOT?= ${DESTDIR}${LIBDIR}/libbegemot.a .if ${MK_BIND_LIBS} != "no" LIBBIND?= ${DESTDIR}${LIBDIR}/libbind.a LIBBIND9?= ${DESTDIR}${LIBDIR}/libbind9.a .endif LIBBLUETOOTH?= ${DESTDIR}${LIBDIR}/libbluetooth.a LIBBSDXML?= ${DESTDIR}${LIBDIR}/libbsdxml.a LIBBSM?= ${DESTDIR}${LIBDIR}/libbsm.a LIBBSNMP?= ${DESTDIR}${LIBDIR}/libbsnmp.a LIBBZ2?= ${DESTDIR}${LIBDIR}/libbz2.a LIBC?= ${DESTDIR}${LIBDIR}/libc.a LIBC_PIC?= ${DESTDIR}${LIBDIR}/libc_pic.a LIBCALENDAR?= ${DESTDIR}${LIBDIR}/libcalendar.a LIBCAM?= ${DESTDIR}${LIBDIR}/libcam.a LIBCOM_ERR?= ${DESTDIR}${LIBDIR}/libcom_err.a LIBCOMPAT?= ${DESTDIR}${LIBDIR}/libcompat.a LIBCRYPT?= ${DESTDIR}${LIBDIR}/libcrypt.a LIBCRYPTO?= ${DESTDIR}${LIBDIR}/libcrypto.a LIBCURSES?= ${DESTDIR}${LIBDIR}/libcurses.a LIBDEVINFO?= ${DESTDIR}${LIBDIR}/libdevinfo.a LIBDEVSTAT?= ${DESTDIR}${LIBDIR}/libdevstat.a LIBDIALOG?= ${DESTDIR}${LIBDIR}/libdialog.a LIBDISK?= ${DESTDIR}${LIBDIR}/libdisk.a LIBDNS?= ${DESTDIR}${LIBDIR}/libdns.a LIBEDIT?= ${DESTDIR}${LIBDIR}/libedit.a LIBFETCH?= ${DESTDIR}${LIBDIR}/libfetch.a LIBFL?= "don't use LIBFL, use LIBL" LIBFORM?= ${DESTDIR}${LIBDIR}/libform.a LIBFTPIO?= ${DESTDIR}${LIBDIR}/libftpio.a LIBG2C?= ${DESTDIR}${LIBDIR}/libg2c.a LIBGCC?= ${DESTDIR}${LIBDIR}/libgcc.a LIBGCC_PIC?= ${DESTDIR}${LIBDIR}/libgcc_pic.a LIBGEOM?= ${DESTDIR}${LIBDIR}/libgeom.a LIBGNUREGEX?= ${DESTDIR}${LIBDIR}/libgnuregex.a LIBGSSAPI?= ${DESTDIR}${LIBDIR}/libgssapi.a LIBHDB?= ${DESTDIR}${LIBDIR}/libhdb.a LIBHISTORY?= ${DESTDIR}${LIBDIR}/libhistory.a LIBIPSEC?= ${DESTDIR}${LIBDIR}/libipsec.a .if ${MK_IPX} != "no" LIBIPX?= ${DESTDIR}${LIBDIR}/libipx.a .endif .if ${MK_BIND_LIBS} != "no" LIBISC?= ${DESTDIR}${LIBDIR}/libisc.a LIBISCCC?= ${DESTDIR}${LIBDIR}/libisccc.a LIBISCCFG?= ${DESTDIR}${LIBDIR}/libisccfg.a .endif LIBKADM5CLNT?= ${DESTDIR}${LIBDIR}/libkadm5clnt.a LIBKADM5SRV?= ${DESTDIR}${LIBDIR}/libkadm5srv.a LIBKAFS5?= ${DESTDIR}${LIBDIR}/libkafs5.a LIBKEYCAP?= ${DESTDIR}${LIBDIR}/libkeycap.a LIBKICONV?= ${DESTDIR}${LIBDIR}/libkiconv.a LIBKRB5?= ${DESTDIR}${LIBDIR}/libkrb5.a LIBKVM?= ${DESTDIR}${LIBDIR}/libkvm.a LIBL?= ${DESTDIR}${LIBDIR}/libl.a LIBLN?= "don't use LIBLN, use LIBL" .if ${MK_BIND} != "no" LIBLWRES?= ${DESTDIR}${LIBDIR}/liblwres.a .endif LIBM?= ${DESTDIR}${LIBDIR}/libm.a LIBMAGIC?= ${DESTDIR}${LIBDIR}/libmagic.a LIBMD?= ${DESTDIR}${LIBDIR}/libmd.a LIBMEMSTAT?= ${DESTDIR}${LIBDIR}/libmemstat.a LIBMENU?= ${DESTDIR}${LIBDIR}/libmenu.a .if ${MK_SENDMAIL} != "no" LIBMILTER?= ${DESTDIR}${LIBDIR}/libmilter.a .endif LIBMP?= ${DESTDIR}${LIBDIR}/libmp.a .if ${MK_NCP} != "no" LIBNCP?= ${DESTDIR}${LIBDIR}/libncp.a .endif LIBNCURSES?= ${DESTDIR}${LIBDIR}/libncurses.a LIBNCURSESW?= ${DESTDIR}${LIBDIR}/libncursesw.a LIBNETGRAPH?= ${DESTDIR}${LIBDIR}/libnetgraph.a LIBNGATM?= ${DESTDIR}${LIBDIR}/libngatm.a LIBNVPAIR?= ${DESTDIR}${LIBDIR}/libnvpair.a LIBOBJC?= ${DESTDIR}${LIBDIR}/libobjc.a LIBOPIE?= ${DESTDIR}${LIBDIR}/libopie.a # The static PAM library doesn't know its secondary dependencies, # so we have to specify them explicitly. LIBPAM?= ${DESTDIR}${LIBDIR}/libpam.a MINUSLPAM= -lpam .if defined(LDFLAGS) && !empty(LDFLAGS:M-static) .if ${MK_KERBEROS} != "no" LIBPAM+= ${LIBKRB5} ${LIBASN1} ${LIBCRYPTO} ${LIBCRYPT} \ ${LIBROKEN} ${LIBCOM_ERR} MINUSLPAM+= -lkrb5 -lasn1 -lcrypto -lcrypt -lroken -lcom_err .endif LIBPAM+= ${LIBRADIUS} ${LIBTACPLUS} ${LIBCRYPT} \ ${LIBUTIL} ${LIBOPIE} ${LIBMD} MINUSLPAM+= -lradius -ltacplus -lcrypt \ -lutil -lopie -lmd .if ${MK_OPENSSH} != "no" LIBPAM+= ${LIBSSH} ${LIBCRYPTO} ${LIBCRYPT} MINUSLPAM+= -lssh -lcrypto -lcrypt .endif .if ${MK_NIS} != "no" LIBPAM+= ${LIBYPCLNT} MINUSLPAM+= -lypclnt .endif .endif LIBPANEL?= ${DESTDIR}${LIBDIR}/libpanel.a LIBPCAP?= ${DESTDIR}${LIBDIR}/libpcap.a LIBPMC?= ${DESTDIR}${LIBDIR}/libpmc.a -LIBPTHREAD?= ${DESTDIR}${LIBDIR}/libpthread.a +.if defined(DEFAULT_THREAD_LIB) +LIBPTHREAD?= ${DESTDIR}${LIBDIR}/${DEFAULT_THREAD_LIB}.a +.else +LIBPTHREAD?= ${DESTDIR}${LIBDIR}/libthr.a +.endif LIBRADIUS?= ${DESTDIR}${LIBDIR}/libradius.a LIBREADLINE?= ${DESTDIR}${LIBDIR}/libreadline.a LIBROKEN?= ${DESTDIR}${LIBDIR}/libroken.a LIBRPCSVC?= ${DESTDIR}${LIBDIR}/librpcsvc.a LIBSBUF?= ${DESTDIR}${LIBDIR}/libsbuf.a LIBSDP?= ${DESTDIR}${LIBDIR}/libsdp.a LIBSMB?= ${DESTDIR}${LIBDIR}/libsmb.a LIBSSH?= ${DESTDIR}${LIBDIR}/libssh.a LIBSSL?= ${DESTDIR}${LIBDIR}/libssl.a LIBSTAND?= ${DESTDIR}${LIBDIR}/libstand.a LIBSTDCPLUSPLUS?= ${DESTDIR}${LIBDIR}/libstdc++.a LIBTACPLUS?= ${DESTDIR}${LIBDIR}/libtacplus.a LIBTERMCAP?= ${DESTDIR}${LIBDIR}/libtermcap.a LIBTERMLIB?= "don't use LIBTERMLIB, use LIBTERMCAP" LIBTINFO?= "don't use LIBTINFO, use LIBNCURSES" LIBUFS?= ${DESTDIR}${LIBDIR}/libufs.a LIBUGIDFW?= ${DESTDIR}${LIBDIR}/libugidfw.a LIBUMEM?= ${DESTDIR}${LIBDIR}/libumem.a LIBUSBHID?= ${DESTDIR}${LIBDIR}/libusbhid.a LIBUTIL?= ${DESTDIR}${LIBDIR}/libutil.a LIBUUTIL?= ${DESTDIR}${LIBDIR}/libuutil.a LIBVGL?= ${DESTDIR}${LIBDIR}/libvgl.a LIBWRAP?= ${DESTDIR}${LIBDIR}/libwrap.a LIBXPG4?= ${DESTDIR}${LIBDIR}/libxpg4.a LIBY?= ${DESTDIR}${LIBDIR}/liby.a LIBYPCLNT?= ${DESTDIR}${LIBDIR}/libypclnt.a LIBZ?= ${DESTDIR}${LIBDIR}/libz.a LIBZFS?= ${DESTDIR}${LIBDIR}/libzfs.a LIBZPOOL?= ${DESTDIR}${LIBDIR}/libzpool.a Index: head/share/mk/bsd.own.mk =================================================================== --- head/share/mk/bsd.own.mk (revision 169523) +++ head/share/mk/bsd.own.mk (revision 169524) @@ -1,463 +1,466 @@ # $FreeBSD$ # # The include file set common variables for owner, # group, mode, and directories. Defaults are in brackets. # # # +++ variables +++ # # DESTDIR Change the tree where the file gets installed. [not set] # # DISTDIR Change the tree where the file for a distribution # gets installed (see /usr/src/release/Makefile). [not set] # # COMPRESS_CMD Program to compress documents. # Output is to stdout. [gzip -cn] # # COMPRESS_EXT File name extension of ${COMPRESS_CMD} command. [.gz] # # BINOWN Binary owner. [root] # # BINGRP Binary group. [wheel] # # BINMODE Binary mode. [555] # # NOBINMODE Mode for non-executable files. [444] # # LIBDIR Base path for libraries. [/usr/lib] # # LIBCOMPATDIR Base path for compat libraries. [/usr/lib/compat] # # LIBDATADIR Base path for misc. utility data files. [/usr/libdata] # # LINTLIBDIR Base path for lint libraries. [/usr/libdata/lint] # # SHLIBDIR Base path for shared libraries. [${LIBDIR}] # # LIBOWN Library owner. [${BINOWN}] # # LIBGRP Library group. [${BINGRP}] # # LIBMODE Library mode. [${NOBINMODE}] # # # KMODDIR Base path for loadable kernel modules # (see kld(4)). [/boot/kernel] # # KMODOWN KLD owner. [${BINOWN}] # # KMODGRP KLD group. [${BINGRP}] # # KMODMODE KLD mode. [${BINMODE}] # # # SHAREDIR Base path for architecture-independent ascii # text files. [/usr/share] # # SHAREOWN ASCII text file owner. [root] # # SHAREGRP ASCII text file group. [wheel] # # SHAREMODE ASCII text file mode. [${NOBINMODE}] # # # DOCDIR Base path for system documentation (e.g. PSD, USD, # handbook, FAQ etc.). [${SHAREDIR}/doc] # # DOCOWN Documentation owner. [${SHAREOWN}] # # DOCGRP Documentation group. [${SHAREGRP}] # # DOCMODE Documentation mode. [${NOBINMODE}] # # # INFODIR Base path for GNU's hypertext system # called Info (see info(1)). [${SHAREDIR}/info] # # INFOOWN Info owner. [${SHAREOWN}] # # INFOGRP Info group. [${SHAREGRP}] # # INFOMODE Info mode. [${NOBINMODE}] # # # MANDIR Base path for manual installation. [${SHAREDIR}/man/man] # # MANOWN Manual owner. [${SHAREOWN}] # # MANGRP Manual group. [${SHAREGRP}] # # MANMODE Manual mode. [${NOBINMODE}] # # # NLSDIR Base path for National Language Support files # installation. [${SHAREDIR}/nls] # # NLSOWN National Language Support files owner. [${SHAREOWN}] # # NLSGRP National Language Support files group. [${SHAREGRP}] # # NLSMODE National Language Support files mode. [${NOBINMODE}] # # INCLUDEDIR Base path for standard C include files [/usr/include] .if !target(____) ____: .if !defined(_WITHOUT_SRCCONF) SRCCONF?= /etc/src.conf .if exists(${SRCCONF}) .include "${SRCCONF}" .endif .endif # Binaries BINOWN?= root BINGRP?= wheel BINMODE?= 555 NOBINMODE?= 444 .if defined(MODULES_WITH_WORLD) KMODDIR?= /boot/modules .else KMODDIR?= /boot/kernel .endif KMODOWN?= ${BINOWN} KMODGRP?= ${BINGRP} KMODMODE?= ${BINMODE} LIBDIR?= /usr/lib LIBCOMPATDIR?= /usr/lib/compat LIBDATADIR?= /usr/libdata LINTLIBDIR?= /usr/libdata/lint SHLIBDIR?= ${LIBDIR} LIBOWN?= ${BINOWN} LIBGRP?= ${BINGRP} LIBMODE?= ${NOBINMODE} # Share files SHAREDIR?= /usr/share SHAREOWN?= root SHAREGRP?= wheel SHAREMODE?= ${NOBINMODE} MANDIR?= ${SHAREDIR}/man/man MANOWN?= ${SHAREOWN} MANGRP?= ${SHAREGRP} MANMODE?= ${NOBINMODE} DOCDIR?= ${SHAREDIR}/doc DOCOWN?= ${SHAREOWN} DOCGRP?= ${SHAREGRP} DOCMODE?= ${NOBINMODE} INFODIR?= ${SHAREDIR}/info INFOOWN?= ${SHAREOWN} INFOGRP?= ${SHAREGRP} INFOMODE?= ${NOBINMODE} NLSDIR?= ${SHAREDIR}/nls NLSOWN?= ${SHAREOWN} NLSGRP?= ${SHAREGRP} NLSMODE?= ${NOBINMODE} +DEFAULT_THREAD_LIB?= libthr + INCLUDEDIR?= /usr/include # Common variables .if !defined(DEBUG_FLAGS) STRIP?= -s .endif COMPRESS_CMD?= gzip -cn COMPRESS_EXT?= .gz .if !defined(_WITHOUT_SRCCONF) # # Define MK_* variables (which are either "yes" or "no") for users # to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the # make(1) environment. # These should be tested with `== "no"' or `!= "no"' in makefiles. # The NO_* variables should only be set by makefiles. # # # Supported NO_* options (if defined, MK_* will be forced to "no", # regardless of user's setting). # .for var in \ MAN \ PROFILE .if defined(NO_${var}) WITHOUT_${var}= .endif .endfor # # Compat NO_* options (same as above, except their use is deprecated). # .if !defined(BURN_BRIDGES) .for var in \ ACPI \ ATM \ AUDIT \ AUTHPF \ BIND \ BIND_DNSSEC \ BIND_ETC \ BIND_LIBS_LWRES \ BIND_MTREE \ BIND_NAMED \ BIND_UTILS \ BLUETOOTH \ BOOT \ CALENDAR \ CPP \ CRYPT \ CVS \ CXX \ DICT \ DYNAMICROOT \ EXAMPLES \ FORTH \ FORTRAN \ FP_LIBC \ GAMES \ GCOV \ GDB \ GNU \ GPIB \ GROFF \ HTML \ I4B \ INET6 \ INFO \ IPFILTER \ IPX \ KERBEROS \ LIB32 \ LIBPTHREAD \ LIBTHR \ LOCALES \ LPR \ MAILWRAPPER \ NETCAT \ NIS \ NLS \ NLS_CATALOGS \ NS_CACHING \ OBJC \ OPENSSH \ OPENSSL \ PAM \ PF \ RCMDS \ RCS \ RESCUE \ SENDMAIL \ SETUID_LOGIN \ SHAREDOCS \ SYSCONS \ TCSH \ TOOLCHAIN \ USB \ WPA_SUPPLICANT_EAPOL .if defined(NO_${var}) #.warning NO_${var} is deprecated in favour of WITHOUT_${var}= WITHOUT_${var}= .endif .endfor .endif # !defined(BURN_BRIDGES) # # Older-style variables that enabled behaviour when set. # .if defined(YES_HESIOD) WITH_HESIOD= .endif .if defined(MAKE_IDEA) WITH_IDEA= .endif # # MK_* options which default to "yes". # .for var in \ ACPI \ ASSERT_DEBUG \ ATM \ AUDIT \ AUTHPF \ BIND \ BIND_DNSSEC \ BIND_ETC \ BIND_LIBS_LWRES \ BIND_MTREE \ BIND_NAMED \ BIND_UTILS \ BLUETOOTH \ BOOT \ BZIP2 \ CALENDAR \ CDDL \ CPP \ CRYPT \ CVS \ CXX \ DICT \ DYNAMICROOT \ EXAMPLES \ FORTH \ FORTRAN \ FP_LIBC \ GAMES \ GCOV \ GDB \ GNU \ GPIB \ GROFF \ HTML \ I4B \ INET6 \ INFO \ IPFILTER \ IPX \ KERBEROS \ LIB32 \ LIBPTHREAD \ LIBTHR \ LOCALES \ LPR \ MAILWRAPPER \ MAN \ NCP \ NETCAT \ NIS \ NLS \ NLS_CATALOGS \ NS_CACHING \ OBJC \ OPENSSH \ OPENSSL \ PAM \ PF \ PROFILE \ RCMDS \ RCS \ RESCUE \ SENDMAIL \ SETUID_LOGIN \ SHAREDOCS \ + SYMVER \ SYSCONS \ TCSH \ TOOLCHAIN \ USB \ WPA_SUPPLICANT_EAPOL \ ZFS .if defined(WITH_${var}) && defined(WITHOUT_${var}) .error WITH_${var} and WITHOUT_${var} can't both be set. .endif .if defined(MK_${var}) .error MK_${var} can't be set by a user. .endif .if defined(WITHOUT_${var}) MK_${var}:= no .else MK_${var}:= yes .endif .endfor # # MK_* options which default to "no". # .for var in \ BIND_LIBS \ HESIOD \ IDEA .if defined(WITH_${var}) && defined(WITHOUT_${var}) .error WITH_${var} and WITHOUT_${var} can't both be set. .endif .if defined(MK_${var}) .error MK_${var} can't be set by a user. .endif .if defined(WITH_${var}) MK_${var}:= yes .else MK_${var}:= no .endif .endfor # # Force some options off if their dependencies are off. # .if ${MK_BIND} == "no" MK_BIND_DNSSEC:= no MK_BIND_ETC:= no MK_BIND_LIBS:= no MK_BIND_LIBS_LWRES:= no MK_BIND_MTREE:= no MK_BIND_NAMED:= no MK_BIND_UTILS:= no .endif .if ${MK_BIND_MTREE} == "no" MK_BIND_ETC:= no .endif .if ${MK_CDDL} == "no" MK_ZFS:= no .endif .if ${MK_CRYPT} == "no" MK_OPENSSL:= no MK_OPENSSH:= no MK_KERBEROS:= no .endif .if ${MK_IPX} == "no" MK_NCP:= no .endif .if ${MK_OPENSSL} == "no" MK_OPENSSH:= no MK_KERBEROS:= no .endif .if ${MK_PF} == "no" MK_AUTHPF:= no .endif .if ${MK_TOOLCHAIN} == "no" MK_GDB:= no .endif # # Set defaults for the MK_*_SUPPORT variables. # # # MK_*_SUPPORT options which default to "yes" unless their corresponding # MK_* variable is set to "no". # .for var in \ BZIP2 \ GNU \ INET6 \ IPX \ KERBEROS \ PAM .if defined(WITH_${var}_SUPPORT) && defined(WITHOUT_${var}_SUPPORT) .error WITH_${var}_SUPPORT and WITHOUT_${var}_SUPPORT can't both be set. .endif .if defined(MK_${var}_SUPPORT) .error MK_${var}_SUPPORT can't be set by a user. .endif .if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no" MK_${var}_SUPPORT:= no .else MK_${var}_SUPPORT:= yes .endif .endfor .endif # !_WITHOUT_SRCCONF .endif # !target(____) Index: head/share/mk/bsd.symver.mk =================================================================== --- head/share/mk/bsd.symver.mk (revision 169523) +++ head/share/mk/bsd.symver.mk (revision 169524) @@ -1,44 +1,44 @@ # $FreeBSD$ .if !target(____) ____: .include # Generate the version map given the version definitions # and symbol maps. -.if !empty(VERSION_DEF) && !empty(SYMBOL_MAPS) +.if (${MK_SYMVER} == "yes") && !empty(VERSION_DEF) && !empty(SYMBOL_MAPS) # Find the awk script that generates the version map. VERSION_GEN?= version_gen.awk VERSION_MAP?= Version.map CLEANFILES+= ${VERSION_MAP} # Compute the make's -m path. _mpath= _oarg= .for _arg in ${.MAKEFLAGS} .if ${_oarg} == "-m" _mpath+= ${_arg} .endif _oarg= ${_arg} .endfor _mpath+= /usr/share/mk # Look up ${VERSION_GEN} in ${_mpath}. _vgen= .for path in ${_mpath} .if empty(_vgen) .if exists(${path}/${VERSION_GEN}) _vgen= ${path}/${VERSION_GEN} .endif .endif .endfor # Run the symbol maps through the C preprocessor before passing # them to the symbol version generator. ${VERSION_MAP}: ${VERSION_DEF} ${_vgen} ${SYMBOL_MAPS} cat ${SYMBOL_MAPS} | ${CPP} - - \ | awk -v vfile=${VERSION_DEF} -f ${_vgen} > ${.TARGET} .endif # !empty(VERSION_DEF) && !empty(SYMBOL_MAPS) .endif # !target(____)