Skip to content

Commit

Permalink
Merge branch 'freebsd/current/master' into hardened/current/master
Browse files Browse the repository at this point in the history
* freebsd/current/master:
  libbe(3): Move build goop back out of cddl/
  libbe(3): Remove -v from LDFLAGS
  bectl(8): Allow running a custom command in the 'jail' subcommand
  POSIX compliance improvements in the pthread(3) functions.
  • Loading branch information
opntr-auto committed Aug 18, 2018
2 parents 8b45101 + 68ec745 commit d7f0d9d
Show file tree
Hide file tree
Showing 34 changed files with 169 additions and 131 deletions.
2 changes: 1 addition & 1 deletion Makefile.inc1
Original file line number Diff line number Diff line change
Expand Up @@ -2606,7 +2606,7 @@ cddl/lib/libzfs__L: cddl/lib/libzfs_core__L lib/msun__L lib/libutil__L
cddl/lib/libzfs__L: lib/libthr__L lib/libmd__L lib/libz__L cddl/lib/libumem__L
cddl/lib/libzfs__L: cddl/lib/libuutil__L cddl/lib/libavl__L lib/libgeom__L

cddl/lib/libbe__L: cddl/lib/libzfs__L
lib/libbe__L: cddl/lib/libzfs__L
.endif
_cddl_lib_libctf= cddl/lib/libctf
_cddl_lib= cddl/lib
Expand Down
3 changes: 0 additions & 3 deletions cddl/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

SUBDIR= ${_drti} \
libavl \
${_libbe} \
libctf \
${_libdtrace} \
libnvpair \
Expand All @@ -17,7 +16,6 @@ SUBDIR= ${_drti} \
SUBDIR.${MK_TESTS}+= tests

.if ${MK_ZFS} != "no"
_libbe= libbe
_libzfs_core= libzfs_core
_libzfs= libzfs
.if ${MK_LIBTHR} != "no"
Expand All @@ -30,7 +28,6 @@ _drti= drti
_libdtrace= libdtrace
.endif

SUBDIR_DEPEND_libbe= libnvpair libzfs
SUBDIR_DEPEND_libdtrace= libctf
SUBDIR_DEPEND_libzfs_core= libnvpair
SUBDIR_DEPEND_libzfs= libavl libnvpair libumem libuutil libzfs_core
Expand Down
91 changes: 54 additions & 37 deletions include/pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ int pthread_attr_destroy(pthread_attr_t *);
int pthread_attr_getstack(
const pthread_attr_t * __restrict, void ** __restrict,
size_t * __restrict);
int pthread_attr_getstacksize(const pthread_attr_t *,
size_t *);
int pthread_attr_getguardsize(const pthread_attr_t *,
size_t *);
int pthread_attr_getstacksize(const pthread_attr_t * __restrict,
size_t * __restrict);
int pthread_attr_getguardsize(const pthread_attr_t * __restrict,
size_t * __restrict);
int pthread_attr_getstackaddr(const pthread_attr_t *, void **);
int pthread_attr_getdetachstate(const pthread_attr_t *,
int *);
Expand All @@ -168,12 +168,12 @@ int pthread_attr_setstack(pthread_attr_t *, void *,
int pthread_attr_setstackaddr(pthread_attr_t *, void *);
int pthread_attr_setdetachstate(pthread_attr_t *, int);
int pthread_barrier_destroy(pthread_barrier_t *);
int pthread_barrier_init(pthread_barrier_t *,
const pthread_barrierattr_t *, unsigned);
int pthread_barrier_init(pthread_barrier_t * __restrict,
const pthread_barrierattr_t * __restrict, unsigned);
int pthread_barrier_wait(pthread_barrier_t *);
int pthread_barrierattr_destroy(pthread_barrierattr_t *);
int pthread_barrierattr_getpshared(
const pthread_barrierattr_t *, int *);
const pthread_barrierattr_t * __restrict, int * __restrict);
int pthread_barrierattr_init(pthread_barrierattr_t *);
int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);

Expand All @@ -191,24 +191,27 @@ int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
}

int pthread_condattr_destroy(pthread_condattr_t *);
int pthread_condattr_getclock(const pthread_condattr_t *,
clockid_t *);
int pthread_condattr_getclock(const pthread_condattr_t * __restrict,
clockid_t * __restrict);
int pthread_condattr_getpshared(const pthread_condattr_t *, int *);
int pthread_condattr_init(pthread_condattr_t *);
int pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
int pthread_condattr_setpshared(pthread_condattr_t *, int);
int pthread_cond_broadcast(pthread_cond_t *);
int pthread_cond_destroy(pthread_cond_t *);
int pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *);
int pthread_cond_init(pthread_cond_t * __restrict,
const pthread_condattr_t * __restrict);
int pthread_cond_signal(pthread_cond_t *);
int pthread_cond_timedwait(pthread_cond_t *,
pthread_mutex_t * __mutex,
const struct timespec *)
__requires_exclusive(*__mutex);
int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t * __mutex)
int pthread_cond_wait(pthread_cond_t * __restrict,
pthread_mutex_t * __restrict __mutex)
__requires_exclusive(*__mutex);
int pthread_create(pthread_t *, const pthread_attr_t *,
void *(*) (void *), void *);
int pthread_create(pthread_t * __restrict,
const pthread_attr_t * __restrict, void *(*) (void *),
void * __restrict);
int pthread_detach(pthread_t);
int pthread_equal(pthread_t, pthread_t);
void pthread_exit(void *) __dead2;
Expand All @@ -219,40 +222,44 @@ int pthread_key_create(pthread_key_t *, void (*) (void *));
int pthread_key_delete(pthread_key_t);
int pthread_mutexattr_init(pthread_mutexattr_t *);
int pthread_mutexattr_destroy(pthread_mutexattr_t *);
int pthread_mutexattr_getpshared(const pthread_mutexattr_t *,
int *);
int pthread_mutexattr_gettype(pthread_mutexattr_t *, int *);
int pthread_mutexattr_getpshared(
const pthread_mutexattr_t * __restrict,
int * __restrict);
int pthread_mutexattr_gettype(
const pthread_mutexattr_t * __restrict, int * __restrict);
int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
int pthread_mutex_consistent(pthread_mutex_t * __mutex)
__requires_exclusive(*__mutex);
int pthread_mutex_destroy(pthread_mutex_t * __mutex)
__requires_unlocked(*__mutex);
int pthread_mutex_init(pthread_mutex_t * __mutex,
const pthread_mutexattr_t *)
int pthread_mutex_init(pthread_mutex_t * __restrict __mutex,
const pthread_mutexattr_t * __restrict)
__requires_unlocked(*__mutex);
int pthread_mutex_lock(pthread_mutex_t * __mutex)
__locks_exclusive(*__mutex);
int pthread_mutex_trylock(pthread_mutex_t * __mutex)
__trylocks_exclusive(0, *__mutex);
int pthread_mutex_timedlock(pthread_mutex_t * __mutex,
const struct timespec *)
int pthread_mutex_timedlock(pthread_mutex_t * __restrict __mutex,
const struct timespec * __restrict)
__trylocks_exclusive(0, *__mutex);
int pthread_mutex_unlock(pthread_mutex_t * __mutex)
__unlocks(*__mutex);
int pthread_once(pthread_once_t *, void (*) (void));
int pthread_rwlock_destroy(pthread_rwlock_t * __rwlock)
__requires_unlocked(*__rwlock);
int pthread_rwlock_init(pthread_rwlock_t * __rwlock,
const pthread_rwlockattr_t *)
int pthread_rwlock_init(pthread_rwlock_t * __restrict __rwlock,
const pthread_rwlockattr_t * __restrict)
__requires_unlocked(*__rwlock);
int pthread_rwlock_rdlock(pthread_rwlock_t * __rwlock)
__locks_shared(*__rwlock);
int pthread_rwlock_timedrdlock(pthread_rwlock_t * __rwlock,
const struct timespec *)
int pthread_rwlock_timedrdlock(
pthread_rwlock_t * __restrict __rwlock,
const struct timespec * __restrict)
__trylocks_shared(0, *__rwlock);
int pthread_rwlock_timedwrlock(pthread_rwlock_t * __rwlock,
const struct timespec *)
int pthread_rwlock_timedwrlock(
pthread_rwlock_t * __restrict __rwlock,
const struct timespec * __restrict)
__trylocks_exclusive(0, *__rwlock);
int pthread_rwlock_tryrdlock(pthread_rwlock_t * __rwlock)
__trylocks_shared(0, *__rwlock);
Expand All @@ -265,8 +272,9 @@ int pthread_rwlock_wrlock(pthread_rwlock_t * __rwlock)
int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
int pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t *,
int *);
int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *,
int *);
int pthread_rwlockattr_getpshared(
const pthread_rwlockattr_t * __restrict,
int * __restrict);
int pthread_rwlockattr_init(pthread_rwlockattr_t *);
int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t *,
int);
Expand Down Expand Up @@ -295,30 +303,39 @@ int pthread_setprio(pthread_t, int);
void pthread_yield(void);
#endif

int pthread_mutexattr_getprioceiling(pthread_mutexattr_t *, int *);
int pthread_mutexattr_getprioceiling(
const pthread_mutexattr_t * __restrict,
int * __restrict);
int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
int pthread_mutex_getprioceiling(pthread_mutex_t *, int *);
int pthread_mutex_setprioceiling(pthread_mutex_t *, int, int *);
int pthread_mutex_getprioceiling(const pthread_mutex_t * __restrict,
int * __restrict);
int pthread_mutex_setprioceiling(pthread_mutex_t * __restrict, int,
int * __restrict);

int pthread_mutexattr_getprotocol(pthread_mutexattr_t *, int *);
int pthread_mutexattr_getprotocol(
const pthread_mutexattr_t * __restrict,
int * __restrict);
int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);

int pthread_mutexattr_getrobust(
pthread_mutexattr_t * __restrict, int * __restrict);
int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int);

int pthread_attr_getinheritsched(const pthread_attr_t *, int *);
int pthread_attr_getinheritsched(const pthread_attr_t * __restrict,
int * __restrict);
int pthread_attr_getschedparam(const pthread_attr_t *,
struct sched_param *);
int pthread_attr_getschedpolicy(const pthread_attr_t *, int *);
int pthread_attr_getscope(const pthread_attr_t *, int *);
int pthread_attr_getschedpolicy(const pthread_attr_t * __restrict,
int * __restrict);
int pthread_attr_getscope(const pthread_attr_t * __restrict,
int * __restrict);
int pthread_attr_setinheritsched(pthread_attr_t *, int);
int pthread_attr_setschedparam(pthread_attr_t *,
const struct sched_param *);
int pthread_attr_setschedpolicy(pthread_attr_t *, int);
int pthread_attr_setscope(pthread_attr_t *, int);
int pthread_getschedparam(pthread_t pthread, int *,
struct sched_param *);
int pthread_getschedparam(pthread_t pthread, int * __restrict,
struct sched_param * __restrict);
int pthread_setschedparam(pthread_t, int,
const struct sched_param *);
#if __XSI_VISIBLE
Expand Down
1 change: 1 addition & 0 deletions lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ SUBDIR.${MK_TESTS}+= tests
SUBDIR.${MK_UNBOUND}+= libunbound
SUBDIR.${MK_USB}+= libusbhid libusb
SUBDIR.${MK_OFED}+= ofed
SUBDIR.${MK_ZFS}+= libbe

.if !make(install)
SUBDIR_PARALLEL=
Expand Down
5 changes: 1 addition & 4 deletions cddl/lib/libbe/Makefile → lib/libbe/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ PACKAGE= lib${LIB}
LIB= be
SHLIB_MAJOR= 1
SHLIB_MINOR= 0
LIBBE_SRC= ${SRCTOP}/lib/libbe

.PATH: ${LIBBE_SRC}
SRCS= be.c be_access.c be_error.c be_info.c
INCS= be.h
MAN= libbe.3

WARNS?= 2
IGNORE_PRAGMA= yes

LIBADD+= zfs
LIBADD+= nvpair

CFLAGS+= -I${LIBBE_SRC}
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs/common
CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris
CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
Expand All @@ -26,7 +24,6 @@ CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
LDFLAGS+= -v

CFLAGS+= -DNEED_SOLARIS_BOOLEAN

Expand Down
21 changes: 14 additions & 7 deletions lib/libthr/thread/thr_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ _pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
__weak_reference(_pthread_attr_getguardsize, pthread_attr_getguardsize);

int
_pthread_attr_getguardsize(const pthread_attr_t *attr, size_t *guardsize)
_pthread_attr_getguardsize(const pthread_attr_t *__restrict attr,
size_t *__restrict guardsize)
{
int ret;

Expand All @@ -217,7 +218,8 @@ _pthread_attr_getguardsize(const pthread_attr_t *attr, size_t *guardsize)
__weak_reference(_pthread_attr_getinheritsched, pthread_attr_getinheritsched);

int
_pthread_attr_getinheritsched(const pthread_attr_t *attr, int *sched_inherit)
_pthread_attr_getinheritsched(const pthread_attr_t * __restrict attr,
int * __restrict sched_inherit)
{
int ret = 0;

Expand All @@ -232,7 +234,8 @@ _pthread_attr_getinheritsched(const pthread_attr_t *attr, int *sched_inherit)
__weak_reference(_pthread_attr_getschedparam, pthread_attr_getschedparam);

int
_pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param)
_pthread_attr_getschedparam(const pthread_attr_t * __restrict attr,
struct sched_param * __restrict param)
{
int ret = 0;

Expand All @@ -247,7 +250,8 @@ _pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *para
__weak_reference(_pthread_attr_getschedpolicy, pthread_attr_getschedpolicy);

int
_pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy)
_pthread_attr_getschedpolicy(const pthread_attr_t * __restrict attr,
int * __restrict policy)
{
int ret = 0;

Expand All @@ -262,7 +266,8 @@ _pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy)
__weak_reference(_pthread_attr_getscope, pthread_attr_getscope);

int
_pthread_attr_getscope(const pthread_attr_t *attr, int *contentionscope)
_pthread_attr_getscope(const pthread_attr_t * __restrict attr,
int * __restrict contentionscope)
{
int ret = 0;

Expand Down Expand Up @@ -320,7 +325,8 @@ _pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr)
__weak_reference(_pthread_attr_getstacksize, pthread_attr_getstacksize);

int
_pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize)
_pthread_attr_getstacksize(const pthread_attr_t * __restrict attr,
size_t * __restrict stacksize)
{
int ret;

Expand Down Expand Up @@ -440,7 +446,8 @@ _pthread_attr_setinheritsched(pthread_attr_t *attr, int sched_inherit)
__weak_reference(_pthread_attr_setschedparam, pthread_attr_setschedparam);

int
_pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param)
_pthread_attr_setschedparam(pthread_attr_t * __restrict attr,
const struct sched_param * __restrict param)
{
int policy;

Expand Down
4 changes: 2 additions & 2 deletions lib/libthr/thread/thr_barrier.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ _pthread_barrier_destroy(pthread_barrier_t *barrier)
}

int
_pthread_barrier_init(pthread_barrier_t *barrier,
const pthread_barrierattr_t *attr, unsigned count)
_pthread_barrier_init(pthread_barrier_t * __restrict barrier,
const pthread_barrierattr_t * __restrict attr, unsigned count)
{
pthread_barrier_t bar;
int pshared;
Expand Down
4 changes: 2 additions & 2 deletions lib/libthr/thread/thr_barrierattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ _pthread_barrierattr_destroy(pthread_barrierattr_t *attr)
}

int
_pthread_barrierattr_getpshared(const pthread_barrierattr_t *attr,
int *pshared)
_pthread_barrierattr_getpshared(const pthread_barrierattr_t * __restrict attr,
int * __restrict pshared)
{

if (attr == NULL || *attr == NULL)
Expand Down
11 changes: 7 additions & 4 deletions lib/libthr/thread/thr_cond.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ init_static(struct pthread *thread, pthread_cond_t *cond)
}

int
_pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *cond_attr)
_pthread_cond_init(pthread_cond_t * __restrict cond,
const pthread_condattr_t * __restrict cond_attr)
{

*cond = NULL;
Expand Down Expand Up @@ -374,15 +375,17 @@ _pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
}

int
__pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
__pthread_cond_wait(pthread_cond_t * __restrict cond,
pthread_mutex_t * __restrict mutex)
{

return (cond_wait_common(cond, mutex, NULL, 1));
}

int
_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
const struct timespec * abstime)
_pthread_cond_timedwait(pthread_cond_t * __restrict cond,
pthread_mutex_t * __restrict mutex,
const struct timespec * __restrict abstime)
{

if (abstime == NULL || abstime->tv_sec < 0 || abstime->tv_nsec < 0 ||
Expand Down
6 changes: 4 additions & 2 deletions lib/libthr/thread/thr_condattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ _pthread_condattr_destroy(pthread_condattr_t *attr)
}

int
_pthread_condattr_getclock(const pthread_condattr_t *attr, clockid_t *clock_id)
_pthread_condattr_getclock(const pthread_condattr_t * __restrict attr,
clockid_t * __restrict clock_id)
{
if (attr == NULL || *attr == NULL)
return (EINVAL);
Expand All @@ -106,7 +107,8 @@ _pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id)
}

int
_pthread_condattr_getpshared(const pthread_condattr_t *attr, int *pshared)
_pthread_condattr_getpshared(const pthread_condattr_t * __restrict attr,
int * __restrict pshared)
{

if (attr == NULL || *attr == NULL)
Expand Down
Loading

0 comments on commit d7f0d9d

Please sign in to comment.