mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-04 15:40:44 +00:00
libthr: move _umtx_op_err() to libsys
Declare in sys/umtx.h and implement in libsys. Explicitly link libthr with libsys. When building libthr static include _umtx_op_err so we don't break static linkage with -lpthread. Reviewed by: kib, emaste, imp Pull Request: https://github.com/freebsd/freebsd-src/pull/908
This commit is contained in:
parent
e9d961055a
commit
ef9871c620
|
@ -59,6 +59,13 @@ NOASM=
|
|||
|
||||
.include "${LIBSYS_SRCTOP}/Makefile.sys"
|
||||
|
||||
SYM_MAPS+= ${LIBSYS_SRCTOP}/Symbol.thr.map
|
||||
.PATH: ${LIBSYS_SRCTOP}/${MACHINE_CPUARCH}
|
||||
.sinclude "${LIBSYS_SRCTOP}/${MACHINE_CPUARCH}/Makefile.thr"
|
||||
.if !${SRCS:M_umtx_op_err.S}
|
||||
SRCS+=_umtx_op_err.c
|
||||
.endif
|
||||
|
||||
VERSION_DEF=${LIBC_SRCTOP}/Versions.def
|
||||
SYMBOL_MAPS=${SYM_MAPS}
|
||||
|
||||
|
|
3
lib/libsys/Symbol.thr.map
Normal file
3
lib/libsys/Symbol.thr.map
Normal file
|
@ -0,0 +1,3 @@
|
|||
FBSDprivate_1.0 {
|
||||
_umtx_op_err;
|
||||
};
|
39
lib/libsys/_umtx_op_err.c
Normal file
39
lib/libsys/_umtx_op_err.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* Copyright (c) 2005 David Xu <davidxu@freebsd.org>
|
||||
* 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 unmodified, 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/umtx.h>
|
||||
|
||||
int
|
||||
_umtx_op_err(void *obj, int op, u_long val, void *uaddr, void *uaddr2)
|
||||
{
|
||||
if (_umtx_op(obj, op, val, uaddr, uaddr2) == -1)
|
||||
return (errno);
|
||||
return (0);
|
||||
}
|
1
lib/libsys/amd64/Makefile.thr
Normal file
1
lib/libsys/amd64/Makefile.thr
Normal file
|
@ -0,0 +1 @@
|
|||
SRCS+= _umtx_op_err.S
|
1
lib/libsys/i386/Makefile.thr
Normal file
1
lib/libsys/i386/Makefile.thr
Normal file
|
@ -0,0 +1 @@
|
|||
SRCS+= _umtx_op_err.S
|
1
lib/libsys/powerpc/Makefile.thr
Normal file
1
lib/libsys/powerpc/Makefile.thr
Normal file
|
@ -0,0 +1 @@
|
|||
SRCS+= _umtx_op_err.S
|
|
@ -12,6 +12,9 @@ MK_SSP= no
|
|||
|
||||
LIB=thr
|
||||
SHLIB_MAJOR= 3
|
||||
|
||||
LIBADD= sys
|
||||
|
||||
NO_WTHREAD_SAFETY=1
|
||||
NO_WCAST_ALIGN.gcc=1 # for gcc 4.2
|
||||
CFLAGS+=-DPTHREAD_KERNEL
|
||||
|
@ -67,6 +70,14 @@ PRECIOUSLIB=
|
|||
.include "${.CURDIR}/thread/Makefile.inc"
|
||||
SRCS+= rtld_malloc.c
|
||||
|
||||
LIBSYS_SRCTOP= ${.CURDIR:H}/libsys
|
||||
.if exists(${LIBSYS_SRCTOP}/${MACHINE_CPUARCH}/_umtx_op_err.S)
|
||||
.PATH: ${LIBSYS_SRCTOP}/${MACHINE_CPUARCH}
|
||||
.else
|
||||
.PATH: ${LIBSYS_SRCTOP}
|
||||
.endif
|
||||
STATICOBJS+= _umtx_op_err.o
|
||||
|
||||
.if ${MK_INSTALLLIB} != "no"
|
||||
SYMLINKS+=lib${LIB}.a ${LIBDIR}/libpthread.a
|
||||
.endif
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
|
||||
SRCS+= _umtx_op_err.S
|
||||
|
||||
# With the current compiler and libthr code, using SSE in libthr
|
||||
# does not provide enough performance improvement to outweigh
|
||||
# the extra context switch cost. This can measurably impact
|
||||
|
|
|
@ -52,6 +52,4 @@ _get_curthread(void)
|
|||
return (thr);
|
||||
}
|
||||
|
||||
#define HAS__UMTX_OP_ERR 1
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
|
||||
SRCS+= _umtx_op_err.S
|
||||
|
||||
# With the current compiler and libthr code, using SSE in libthr
|
||||
# does not provide enough performance improvement to outweigh
|
||||
# the extra context switch cost. This can measurably impact
|
||||
|
|
|
@ -52,6 +52,4 @@ _get_curthread(void)
|
|||
return (thr);
|
||||
}
|
||||
|
||||
#define HAS__UMTX_OP_ERR 1
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
SRCS+= _umtx_op_err.S
|
|
@ -49,6 +49,4 @@ _get_curthread(void)
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
#define HAS__UMTX_OP_ERR 1
|
||||
|
||||
#endif /* _PTHREAD_MD_H_ */
|
||||
|
|
|
@ -30,16 +30,6 @@
|
|||
#include "thr_private.h"
|
||||
#include "thr_umtx.h"
|
||||
|
||||
#ifndef HAS__UMTX_OP_ERR
|
||||
int _umtx_op_err(void *obj, int op, u_long val, void *uaddr, void *uaddr2)
|
||||
{
|
||||
|
||||
if (_umtx_op(obj, op, val, uaddr, uaddr2) == -1)
|
||||
return (errno);
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
_thr_umutex_init(struct umutex *mtx)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#endif
|
||||
#define DEFAULT_URWLOCK {0,0,0,0,{0,0,0,0}}
|
||||
|
||||
int _umtx_op_err(void *, int op, u_long, void *, void *) __hidden;
|
||||
int __thr_umutex_lock(struct umutex *mtx, uint32_t id) __hidden;
|
||||
int __thr_umutex_lock_spin(struct umutex *mtx, uint32_t id) __hidden;
|
||||
int __thr_umutex_timedlock(struct umutex *mtx, uint32_t id,
|
||||
|
|
|
@ -142,7 +142,7 @@ CRUNCH_PROGS_usr.sbin+= zdb
|
|||
|
||||
CRUNCH_LIBS+= -l80211 -lalias -lcam -lncursesw -ldevstat -lipsec -llzma
|
||||
.if ${MK_ZFS} != "no"
|
||||
CRUNCH_LIBS+= -lavl -lpthread -luutil -lumem -ltpool -lspl -lrt
|
||||
CRUNCH_LIBS+= -lavl -lpthread -lsys -luutil -lumem -ltpool -lspl -lrt
|
||||
CRUNCH_LIBS_zfs+= ${LIBBE} \
|
||||
${LIBZPOOL} \
|
||||
${LIBZFS} \
|
||||
|
@ -156,7 +156,7 @@ CRUNCH_LIBS_zpool+= ${CRUNCH_LIBS_zfs}
|
|||
CRUNCH_LIBS_zdb+= ${CRUNCH_LIBS_zfs}
|
||||
.else
|
||||
# liblzma needs pthread
|
||||
CRUNCH_LIBS+= -lpthread
|
||||
CRUNCH_LIBS+= -lpthread -lsys
|
||||
.endif
|
||||
CRUNCH_LIBS+= -lgeom -lbsdxml -lkiconv
|
||||
.if ${MK_OPENSSL} == "no"
|
||||
|
|
|
@ -135,6 +135,7 @@ struct umtx_robust_lists_params {
|
|||
__BEGIN_DECLS
|
||||
|
||||
int _umtx_op(void *obj, int op, u_long val, void *uaddr, void *uaddr2);
|
||||
int _umtx_op_err(void *obj, int op, u_long val, void *uaddr, void *uaddr2);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
Loading…
Reference in a new issue