Date: Mon, 13 Sep 2010 15:19:49 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r212557 - in user/imp/tbemd: contrib/top lib/libthr lib/libthr/thread lib/msun sbin/geom/class/cache sbin/geom/class/concat sbin/geom/class/eli sbin/geom/class/journal sbin/geom/class/l... Message-ID: <201009131519.o8DFJnkj010094@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Mon Sep 13 15:19:49 2010 New Revision: 212557 URL: http://svn.freebsd.org/changeset/base/212557 Log: merge from head @r212556 Added: user/imp/tbemd/usr.bin/xlint/arch/powerpc64/ - copied from r212556, head/usr.bin/xlint/arch/powerpc64/ Deleted: user/imp/tbemd/sys/mips/mips/psraccess.S Modified: user/imp/tbemd/lib/libthr/pthread.map user/imp/tbemd/lib/libthr/thread/thr_affinity.c user/imp/tbemd/lib/libthr/thread/thr_attr.c user/imp/tbemd/lib/libthr/thread/thr_cancel.c user/imp/tbemd/lib/libthr/thread/thr_create.c user/imp/tbemd/lib/libthr/thread/thr_detach.c user/imp/tbemd/lib/libthr/thread/thr_exit.c user/imp/tbemd/lib/libthr/thread/thr_fork.c user/imp/tbemd/lib/libthr/thread/thr_init.c user/imp/tbemd/lib/libthr/thread/thr_join.c user/imp/tbemd/lib/libthr/thread/thr_kill.c user/imp/tbemd/lib/libthr/thread/thr_list.c user/imp/tbemd/lib/libthr/thread/thr_private.h user/imp/tbemd/lib/libthr/thread/thr_resume_np.c user/imp/tbemd/lib/libthr/thread/thr_stack.c user/imp/tbemd/lib/libthr/thread/thr_suspend_np.c user/imp/tbemd/lib/msun/Makefile user/imp/tbemd/sbin/geom/class/cache/geom_cache.c user/imp/tbemd/sbin/geom/class/concat/geom_concat.c user/imp/tbemd/sbin/geom/class/eli/geom_eli.c user/imp/tbemd/sbin/geom/class/journal/geom_journal.c user/imp/tbemd/sbin/geom/class/label/geom_label.c user/imp/tbemd/sbin/geom/class/mirror/geom_mirror.c user/imp/tbemd/sbin/geom/class/mountver/geom_mountver.c user/imp/tbemd/sbin/geom/class/multipath/geom_multipath.c user/imp/tbemd/sbin/geom/class/nop/geom_nop.c user/imp/tbemd/sbin/geom/class/part/geom_part.c user/imp/tbemd/sbin/geom/class/raid3/geom_raid3.c user/imp/tbemd/sbin/geom/class/sched/geom_sched.c user/imp/tbemd/sbin/geom/class/shsec/geom_shsec.c user/imp/tbemd/sbin/geom/class/stripe/geom_stripe.c user/imp/tbemd/sbin/geom/class/virstor/geom_virstor.c user/imp/tbemd/sbin/geom/core/geom.c user/imp/tbemd/sbin/geom/core/geom.h user/imp/tbemd/share/mk/bsd.cpu.mk user/imp/tbemd/sys/amd64/amd64/machdep.c user/imp/tbemd/sys/amd64/amd64/mp_machdep.c user/imp/tbemd/sys/amd64/include/apicvar.h user/imp/tbemd/sys/conf/files.mips user/imp/tbemd/sys/conf/kern.mk user/imp/tbemd/sys/conf/kmod.mk user/imp/tbemd/sys/dev/acpica/acpi_cpu.c user/imp/tbemd/sys/dev/acpica/acpi_hpet.c user/imp/tbemd/sys/geom/eli/g_eli_ctl.c user/imp/tbemd/sys/geom/mirror/g_mirror_ctl.c user/imp/tbemd/sys/geom/part/g_part.c user/imp/tbemd/sys/i386/i386/machdep.c user/imp/tbemd/sys/i386/i386/mp_machdep.c user/imp/tbemd/sys/i386/include/apicvar.h user/imp/tbemd/sys/kern/bus_if.m user/imp/tbemd/sys/kern/kern_clock.c user/imp/tbemd/sys/kern/kern_clocksource.c user/imp/tbemd/sys/kern/kern_et.c user/imp/tbemd/sys/kern/kern_tc.c user/imp/tbemd/sys/kern/kern_timeout.c user/imp/tbemd/sys/kern/sched_4bsd.c user/imp/tbemd/sys/kern/sched_ule.c user/imp/tbemd/sys/mips/include/cpufunc.h user/imp/tbemd/sys/mips/include/md_var.h user/imp/tbemd/sys/mips/include/smp.h user/imp/tbemd/sys/mips/mips/mp_machdep.c user/imp/tbemd/sys/mips/rmi/dev/nlge/if_nlge.c user/imp/tbemd/sys/mips/rmi/dev/xlr/rge.c user/imp/tbemd/sys/mips/rmi/iodi.c user/imp/tbemd/sys/mips/rmi/msgring.h user/imp/tbemd/sys/pc98/pc98/machdep.c user/imp/tbemd/sys/powerpc/aim/machdep.c user/imp/tbemd/sys/powerpc/booke/machdep.c user/imp/tbemd/sys/powerpc/include/smp.h user/imp/tbemd/sys/powerpc/powerpc/mp_machdep.c user/imp/tbemd/sys/sparc64/include/intr_machdep.h user/imp/tbemd/sys/sparc64/include/smp.h user/imp/tbemd/sys/sparc64/sparc64/intr_machdep.c user/imp/tbemd/sys/sparc64/sparc64/mp_machdep.c user/imp/tbemd/sys/sun4v/include/intr_machdep.h user/imp/tbemd/sys/sun4v/include/smp.h user/imp/tbemd/sys/sun4v/sun4v/intr_machdep.c user/imp/tbemd/sys/sun4v/sun4v/mp_machdep.c user/imp/tbemd/sys/sys/callout.h user/imp/tbemd/sys/sys/sched.h user/imp/tbemd/sys/sys/systm.h user/imp/tbemd/sys/sys/timeet.h user/imp/tbemd/sys/sys/timetc.h user/imp/tbemd/sys/x86/x86/local_apic.c user/imp/tbemd/usr.bin/xlint/Makefile.inc user/imp/tbemd/usr.bin/xlint/arch/powerpc/targparam.h user/imp/tbemd/usr.sbin/crunch/crunchide/Makefile Directory Properties: user/imp/tbemd/ (props changed) user/imp/tbemd/cddl/contrib/opensolaris/ (props changed) user/imp/tbemd/contrib/bind9/ (props changed) user/imp/tbemd/contrib/ee/ (props changed) user/imp/tbemd/contrib/expat/ (props changed) user/imp/tbemd/contrib/file/ (props changed) user/imp/tbemd/contrib/gdb/ (props changed) user/imp/tbemd/contrib/gdtoa/ (props changed) user/imp/tbemd/contrib/gnu-sort/ (props changed) user/imp/tbemd/contrib/groff/ (props changed) user/imp/tbemd/contrib/less/ (props changed) user/imp/tbemd/contrib/libpcap/ (props changed) user/imp/tbemd/contrib/llvm/ (props changed) user/imp/tbemd/contrib/llvm/tools/clang/ (props changed) user/imp/tbemd/contrib/ncurses/ (props changed) user/imp/tbemd/contrib/netcat/ (props changed) user/imp/tbemd/contrib/ntp/ (props changed) user/imp/tbemd/contrib/one-true-awk/ (props changed) user/imp/tbemd/contrib/openbsm/ (props changed) user/imp/tbemd/contrib/openpam/ (props changed) user/imp/tbemd/contrib/pf/ (props changed) user/imp/tbemd/contrib/sendmail/ (props changed) user/imp/tbemd/contrib/tcpdump/ (props changed) user/imp/tbemd/contrib/tcsh/ (props changed) user/imp/tbemd/contrib/top/ (props changed) user/imp/tbemd/contrib/top/install-sh (props changed) user/imp/tbemd/contrib/tzcode/stdtime/ (props changed) user/imp/tbemd/contrib/tzcode/zic/ (props changed) user/imp/tbemd/contrib/tzdata/ (props changed) user/imp/tbemd/contrib/wpa/ (props changed) user/imp/tbemd/crypto/openssh/ (props changed) user/imp/tbemd/crypto/openssl/ (props changed) user/imp/tbemd/lib/libc/ (props changed) user/imp/tbemd/lib/libc/stdtime/ (props changed) user/imp/tbemd/lib/libutil/ (props changed) user/imp/tbemd/lib/libz/ (props changed) user/imp/tbemd/sbin/ (props changed) user/imp/tbemd/sbin/ipfw/ (props changed) user/imp/tbemd/share/zoneinfo/ (props changed) user/imp/tbemd/sys/ (props changed) user/imp/tbemd/sys/amd64/include/xen/ (props changed) user/imp/tbemd/sys/cddl/contrib/opensolaris/ (props changed) user/imp/tbemd/sys/contrib/dev/acpica/ (props changed) user/imp/tbemd/sys/contrib/pf/ (props changed) user/imp/tbemd/sys/contrib/x86emu/ (props changed) user/imp/tbemd/sys/dev/xen/xenpci/ (props changed) user/imp/tbemd/usr.bin/calendar/ (props changed) user/imp/tbemd/usr.bin/csup/ (props changed) user/imp/tbemd/usr.bin/procstat/ (props changed) user/imp/tbemd/usr.sbin/zic/ (props changed) Modified: user/imp/tbemd/lib/libthr/pthread.map ============================================================================== --- user/imp/tbemd/lib/libthr/pthread.map Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/lib/libthr/pthread.map Mon Sep 13 15:19:49 2010 (r212557) @@ -173,6 +173,7 @@ FBSDprivate_1.0 { ___creat; ___pause; ___pselect; + ___sigwait; ___sleep; ___system; ___tcdrain; @@ -206,7 +207,6 @@ FBSDprivate_1.0 { __sendto; __sigsuspend; __sigtimedwait; - __sigwait; __sigwaitinfo; __wait3; __wait4; Modified: user/imp/tbemd/lib/libthr/thread/thr_affinity.c ============================================================================== --- user/imp/tbemd/lib/libthr/thread/thr_affinity.c Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/lib/libthr/thread/thr_affinity.c Mon Sep 13 15:19:49 2010 (r212557) @@ -50,12 +50,7 @@ _pthread_setaffinity_np(pthread_t td, si -1, cpusetsize, cpusetp); if (error == -1) error = errno; - } else { - THR_THREAD_LOCK(curthread, td); - if (td->state == PS_DEAD) { - THR_THREAD_UNLOCK(curthread, td); - return (EINVAL); - } + } else if ((error = _thr_find_thread(curthread, td, 0)) == 0) { tid = TID(td); error = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, tid, cpusetsize, cpusetp); @@ -73,10 +68,18 @@ _pthread_getaffinity_np(pthread_t td, si lwpid_t tid; int error; - tid = TID(td); - error = cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, - (td == curthread) ? -1 : tid, cpusetsize, cpusetp); - if (error == -1) - error = errno; + if (td == curthread) { + error = cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, + -1, cpusetsize, cpusetp); + if (error == -1) + error = errno; + } else if ((error = _thr_find_thread(curthread, td, 0)) == 0) { + tid = TID(td); + error = cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, tid, + cpusetsize, cpusetp); + if (error == -1) + error = errno; + THR_THREAD_UNLOCK(curthread, td); + } return (error); } Modified: user/imp/tbemd/lib/libthr/thread/thr_attr.c ============================================================================== --- user/imp/tbemd/lib/libthr/thread/thr_attr.c Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/lib/libthr/thread/thr_attr.c Mon Sep 13 15:19:49 2010 (r212557) @@ -132,22 +132,23 @@ _pthread_attr_destroy(pthread_attr_t *at __weak_reference(_pthread_attr_get_np, pthread_attr_get_np); int -_pthread_attr_get_np(pthread_t pid, pthread_attr_t *dst) +_pthread_attr_get_np(pthread_t pthread, pthread_attr_t *dst) { struct pthread *curthread; struct pthread_attr attr; int ret; - if (pid == NULL || dst == NULL || *dst == NULL) + if (pthread == NULL || dst == NULL || *dst == NULL) return (EINVAL); curthread = _get_curthread(); - if ((ret = _thr_ref_add(curthread, pid, /*include dead*/0)) != 0) + if ((ret = _thr_find_thread(curthread, pthread, /*include dead*/0)) != 0) return (ret); - attr = pid->attr; - if (pid->tlflags & TLFLAGS_DETACHED) + attr = pthread->attr; + if (pthread->flags & THR_FLAGS_DETACHED) attr.flags |= PTHREAD_DETACHED; - _thr_ref_delete(curthread, pid); + THR_THREAD_UNLOCK(curthread, pthread); + memcpy(*dst, &attr, sizeof(struct pthread_attr)); /* XXX */ (*dst)->cpuset = NULL; Modified: user/imp/tbemd/lib/libthr/thread/thr_cancel.c ============================================================================== --- user/imp/tbemd/lib/libthr/thread/thr_cancel.c Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/lib/libthr/thread/thr_cancel.c Mon Sep 13 15:19:49 2010 (r212557) @@ -60,18 +60,16 @@ _pthread_cancel(pthread_t pthread) /* * POSIX says _pthread_cancel should be async cancellation safe. - * _thr_ref_add and _thr_ref_delete will enter and leave critical + * _thr_find_thread and THR_THREAD_UNLOCK will enter and leave critical * region automatically. */ - if ((ret = _thr_ref_add(curthread, pthread, 0)) == 0) { - THR_THREAD_LOCK(curthread, pthread); + if ((ret = _thr_find_thread(curthread, pthread, 0)) == 0) { if (!pthread->cancel_pending) { pthread->cancel_pending = 1; if (pthread->state != PS_DEAD) _thr_send_sig(pthread, SIGCANCEL); } THR_THREAD_UNLOCK(curthread, pthread); - _thr_ref_delete(curthread, pthread); } return (ret); } Modified: user/imp/tbemd/lib/libthr/thread/thr_create.c ============================================================================== --- user/imp/tbemd/lib/libthr/thread/thr_create.c Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/lib/libthr/thread/thr_create.c Mon Sep 13 15:19:49 2010 (r212557) @@ -125,7 +125,7 @@ _pthread_create(pthread_t * thread, cons new_thread->state = PS_RUNNING; if (new_thread->attr.flags & PTHREAD_CREATE_DETACHED) - new_thread->tlflags |= TLFLAGS_DETACHED; + new_thread->flags |= THR_FLAGS_DETACHED; /* Add the new thread. */ new_thread->refcount = 1; @@ -185,16 +185,14 @@ _pthread_create(pthread_t * thread, cons THR_THREAD_LOCK(curthread, new_thread); new_thread->state = PS_DEAD; new_thread->tid = TID_TERMINATED; + new_thread->flags |= THR_FLAGS_DETACHED; + new_thread->refcount--; if (new_thread->flags & THR_FLAGS_NEED_SUSPEND) { new_thread->cycle++; _thr_umtx_wake(&new_thread->cycle, INT_MAX, 0); } - THR_THREAD_UNLOCK(curthread, new_thread); - THREAD_LIST_LOCK(curthread); - _thread_active_threads--; - new_thread->tlflags |= TLFLAGS_DETACHED; - _thr_ref_delete_unlocked(curthread, new_thread); - THREAD_LIST_UNLOCK(curthread); + _thr_try_gc(curthread, new_thread); /* thread lock released */ + atomic_add_int(&_thread_active_threads, -1); } else if (locked) { if (cpusetp != NULL) { if (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, @@ -202,22 +200,17 @@ _pthread_create(pthread_t * thread, cons ret = errno; /* kill the new thread */ new_thread->force_exit = 1; - THR_THREAD_UNLOCK(curthread, new_thread); + new_thread->flags |= THR_FLAGS_DETACHED; + _thr_try_gc(curthread, new_thread); + /* thread lock released */ goto out; } } _thr_report_creation(curthread, new_thread); THR_THREAD_UNLOCK(curthread, new_thread); -out: - if (ret) { - THREAD_LIST_LOCK(curthread); - new_thread->tlflags |= TLFLAGS_DETACHED; - THR_GCLIST_ADD(new_thread); - THREAD_LIST_UNLOCK(curthread); - } } - +out: if (ret) (*thread) = 0; return (ret); Modified: user/imp/tbemd/lib/libthr/thread/thr_detach.c ============================================================================== --- user/imp/tbemd/lib/libthr/thread/thr_detach.c Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/lib/libthr/thread/thr_detach.c Mon Sep 13 15:19:49 2010 (r212557) @@ -47,25 +47,21 @@ _pthread_detach(pthread_t pthread) if (pthread == NULL) return (EINVAL); - THREAD_LIST_LOCK(curthread); if ((rval = _thr_find_thread(curthread, pthread, /*include dead*/1)) != 0) { - THREAD_LIST_UNLOCK(curthread); return (rval); } /* Check if the thread is already detached or has a joiner. */ - if ((pthread->tlflags & TLFLAGS_DETACHED) != 0 || + if ((pthread->flags & THR_FLAGS_DETACHED) != 0 || (pthread->joiner != NULL)) { - THREAD_LIST_UNLOCK(curthread); + THR_THREAD_UNLOCK(curthread, pthread); return (EINVAL); } /* Flag the thread as detached. */ - pthread->tlflags |= TLFLAGS_DETACHED; - if (pthread->state == PS_DEAD) - THR_GCLIST_ADD(pthread); - THREAD_LIST_UNLOCK(curthread); + pthread->flags |= THR_FLAGS_DETACHED; + _thr_try_gc(curthread, pthread); /* thread lock released */ return (0); } Modified: user/imp/tbemd/lib/libthr/thread/thr_exit.c ============================================================================== --- user/imp/tbemd/lib/libthr/thread/thr_exit.c Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/lib/libthr/thread/thr_exit.c Mon Sep 13 15:19:49 2010 (r212557) @@ -108,37 +108,34 @@ _pthread_exit_mask(void *status, sigset_ if (!_thr_isthreaded()) exit(0); - THREAD_LIST_LOCK(curthread); - _thread_active_threads--; - if (_thread_active_threads == 0) { - THREAD_LIST_UNLOCK(curthread); + if (atomic_fetchadd_int(&_thread_active_threads, -1) == 1) { exit(0); /* Never reach! */ } - THREAD_LIST_UNLOCK(curthread); /* Tell malloc that the thread is exiting. */ _malloc_thread_cleanup(); - THREAD_LIST_LOCK(curthread); THR_LOCK(curthread); curthread->state = PS_DEAD; if (curthread->flags & THR_FLAGS_NEED_SUSPEND) { curthread->cycle++; _thr_umtx_wake(&curthread->cycle, INT_MAX, 0); } - THR_UNLOCK(curthread); /* * Thread was created with initial refcount 1, we drop the * reference count to allow it to be garbage collected. */ curthread->refcount--; - if (curthread->tlflags & TLFLAGS_DETACHED) - THR_GCLIST_ADD(curthread); - THREAD_LIST_UNLOCK(curthread); + _thr_try_gc(curthread, curthread); /* thread lock released */ + if (!curthread->force_exit && SHOULD_REPORT_EVENT(curthread, TD_DEATH)) _thr_report_death(curthread); +#if defined(_PTHREADS_INVARIANTS) + if (THR_IN_CRITICAL(curthread)) + PANIC("thread exits with resources held!"); +#endif /* * Kernel will do wakeup at the address, so joiner thread * will be resumed if it is sleeping at the address. Modified: user/imp/tbemd/lib/libthr/thread/thr_fork.c ============================================================================== --- user/imp/tbemd/lib/libthr/thread/thr_fork.c Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/lib/libthr/thread/thr_fork.c Mon Sep 13 15:19:49 2010 (r212557) @@ -178,13 +178,13 @@ _fork(void) /* Child process */ errsave = errno; curthread->cancel_pending = 0; - curthread->flags &= ~THR_FLAGS_NEED_SUSPEND; + curthread->flags &= ~(THR_FLAGS_NEED_SUSPEND|THR_FLAGS_DETACHED); /* * Thread list will be reinitialized, and later we call * _libpthread_init(), it will add us back to list. */ - curthread->tlflags &= ~(TLFLAGS_IN_TDLIST | TLFLAGS_DETACHED); + curthread->tlflags &= ~TLFLAGS_IN_TDLIST; /* child is a new kernel thread. */ thr_self(&curthread->tid); Modified: user/imp/tbemd/lib/libthr/thread/thr_init.c ============================================================================== --- user/imp/tbemd/lib/libthr/thread/thr_init.c Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/lib/libthr/thread/thr_init.c Mon Sep 13 15:19:49 2010 (r212557) @@ -111,7 +111,7 @@ struct umutex _mutex_static_lock = DEFAU struct umutex _cond_static_lock = DEFAULT_UMUTEX; struct umutex _rwlock_static_lock = DEFAULT_UMUTEX; struct umutex _keytable_lock = DEFAULT_UMUTEX; -struct umutex _thr_list_lock = DEFAULT_UMUTEX; +struct urwlock _thr_list_lock = DEFAULT_URWLOCK; struct umutex _thr_event_lock = DEFAULT_UMUTEX; int __pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *); Modified: user/imp/tbemd/lib/libthr/thread/thr_join.c ============================================================================== --- user/imp/tbemd/lib/libthr/thread/thr_join.c Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/lib/libthr/thread/thr_join.c Mon Sep 13 15:19:49 2010 (r212557) @@ -43,12 +43,12 @@ __weak_reference(_pthread_timedjoin_np, static void backout_join(void *arg) { - struct pthread *curthread = _get_curthread(); struct pthread *pthread = (struct pthread *)arg; + struct pthread *curthread = _get_curthread(); - THREAD_LIST_LOCK(curthread); + THR_THREAD_LOCK(curthread, pthread); pthread->joiner = NULL; - THREAD_LIST_UNLOCK(curthread); + THR_THREAD_LOCK(curthread, pthread); } int @@ -88,23 +88,23 @@ join_common(pthread_t pthread, void **th if (pthread == curthread) return (EDEADLK); - THREAD_LIST_LOCK(curthread); - if ((ret = _thr_find_thread(curthread, pthread, 1)) != 0) { - ret = ESRCH; - } else if ((pthread->tlflags & TLFLAGS_DETACHED) != 0) { + if ((ret = _thr_find_thread(curthread, pthread, 1)) != 0) + return (ESRCH); + + if ((pthread->flags & THR_FLAGS_DETACHED) != 0) { ret = EINVAL; } else if (pthread->joiner != NULL) { /* Multiple joiners are not supported. */ ret = ENOTSUP; } if (ret) { - THREAD_LIST_UNLOCK(curthread); + THR_THREAD_UNLOCK(curthread, pthread); return (ret); } /* Set the running thread to be the joiner: */ pthread->joiner = curthread; - THREAD_LIST_UNLOCK(curthread); + THR_THREAD_UNLOCK(curthread, pthread); THR_CLEANUP_PUSH(curthread, backout_join, pthread); _thr_cancel_enter(curthread); @@ -131,17 +131,16 @@ join_common(pthread_t pthread, void **th THR_CLEANUP_POP(curthread, 0); if (ret == ETIMEDOUT) { - THREAD_LIST_LOCK(curthread); + THR_THREAD_LOCK(curthread, pthread); pthread->joiner = NULL; - THREAD_LIST_UNLOCK(curthread); + THR_THREAD_UNLOCK(curthread, pthread); } else { ret = 0; tmp = pthread->ret; - THREAD_LIST_LOCK(curthread); - pthread->tlflags |= TLFLAGS_DETACHED; + THR_THREAD_LOCK(curthread, pthread); + pthread->flags |= THR_FLAGS_DETACHED; pthread->joiner = NULL; - THR_GCLIST_ADD(pthread); - THREAD_LIST_UNLOCK(curthread); + _thr_try_gc(curthread, pthread); /* thread lock released */ if (thread_return != NULL) *thread_return = tmp; Modified: user/imp/tbemd/lib/libthr/thread/thr_kill.c ============================================================================== --- user/imp/tbemd/lib/libthr/thread/thr_kill.c Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/lib/libthr/thread/thr_kill.c Mon Sep 13 15:19:49 2010 (r212557) @@ -54,11 +54,15 @@ _pthread_kill(pthread_t pthread, int sig * signal is valid (signal 0 specifies error checking only) and * not being ignored: */ - else if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0)) + else if (curthread == pthread) { + if (sig > 0) + _thr_send_sig(pthread, sig); + ret = 0; + } if ((ret = _thr_find_thread(curthread, pthread, /*include dead*/0)) == 0) { if (sig > 0) _thr_send_sig(pthread, sig); - _thr_ref_delete(curthread, pthread); + THR_THREAD_UNLOCK(curthread, pthread); } /* Return the completion status: */ Modified: user/imp/tbemd/lib/libthr/thread/thr_list.c ============================================================================== --- user/imp/tbemd/lib/libthr/thread/thr_list.c Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/lib/libthr/thread/thr_list.c Mon Sep 13 15:19:49 2010 (r212557) @@ -79,7 +79,7 @@ _thr_list_init(void) _gc_count = 0; total_threads = 1; - _thr_umutex_init(&_thr_list_lock); + _thr_urwlock_init(&_thr_list_lock); TAILQ_INIT(&_thread_list); TAILQ_INIT(&free_threadq); _thr_umutex_init(&free_thread_lock); @@ -98,7 +98,7 @@ _thr_gc(struct pthread *curthread) TAILQ_HEAD(, pthread) worklist; TAILQ_INIT(&worklist); - THREAD_LIST_LOCK(curthread); + THREAD_LIST_WRLOCK(curthread); /* Check the threads waiting for GC. */ TAILQ_FOREACH_SAFE(td, &_thread_gc_list, gcle, td_next) { @@ -107,17 +107,8 @@ _thr_gc(struct pthread *curthread) continue; } _thr_stack_free(&td->attr); - if (((td->tlflags & TLFLAGS_DETACHED) != 0) && - (td->refcount == 0)) { - THR_GCLIST_REMOVE(td); - /* - * The thread has detached and is no longer - * referenced. It is safe to remove all - * remnants of the thread. - */ - THR_LIST_REMOVE(td); - TAILQ_INSERT_HEAD(&worklist, td, gcle); - } + THR_GCLIST_REMOVE(td); + TAILQ_INSERT_HEAD(&worklist, td, gcle); } THREAD_LIST_UNLOCK(curthread); @@ -228,10 +219,10 @@ thr_destroy(struct pthread *curthread __ void _thr_link(struct pthread *curthread, struct pthread *thread) { - THREAD_LIST_LOCK(curthread); + THREAD_LIST_WRLOCK(curthread); THR_LIST_ADD(thread); - _thread_active_threads++; THREAD_LIST_UNLOCK(curthread); + atomic_add_int(&_thread_active_threads, 1); } /* @@ -240,10 +231,10 @@ _thr_link(struct pthread *curthread, str void _thr_unlink(struct pthread *curthread, struct pthread *thread) { - THREAD_LIST_LOCK(curthread); + THREAD_LIST_WRLOCK(curthread); THR_LIST_REMOVE(thread); - _thread_active_threads--; THREAD_LIST_UNLOCK(curthread); + atomic_add_int(&_thread_active_threads, -1); } void @@ -290,12 +281,11 @@ _thr_ref_add(struct pthread *curthread, /* Invalid thread: */ return (EINVAL); - THREAD_LIST_LOCK(curthread); if ((ret = _thr_find_thread(curthread, thread, include_dead)) == 0) { thread->refcount++; THR_CRITICAL_ENTER(curthread); + THR_THREAD_UNLOCK(curthread, thread); } - THREAD_LIST_UNLOCK(curthread); /* Return zero if the thread exists: */ return (ret); @@ -304,41 +294,56 @@ _thr_ref_add(struct pthread *curthread, void _thr_ref_delete(struct pthread *curthread, struct pthread *thread) { - THREAD_LIST_LOCK(curthread); - _thr_ref_delete_unlocked(curthread, thread); - THREAD_LIST_UNLOCK(curthread); + THR_THREAD_LOCK(curthread, thread); + thread->refcount--; + _thr_try_gc(curthread, thread); + THR_CRITICAL_LEAVE(curthread); } +/* entered with thread lock held, exit with thread lock released */ void -_thr_ref_delete_unlocked(struct pthread *curthread, - struct pthread *thread) +_thr_try_gc(struct pthread *curthread, struct pthread *thread) { - if (thread != NULL) { - thread->refcount--; - if ((thread->refcount == 0) && thread->state == PS_DEAD && - (thread->tlflags & TLFLAGS_DETACHED) != 0) + if (THR_SHOULD_GC(thread)) { + THR_REF_ADD(curthread, thread); + THR_THREAD_UNLOCK(curthread, thread); + THREAD_LIST_WRLOCK(curthread); + THR_THREAD_LOCK(curthread, thread); + THR_REF_DEL(curthread, thread); + if (THR_SHOULD_GC(thread)) { + THR_LIST_REMOVE(thread); THR_GCLIST_ADD(thread); - THR_CRITICAL_LEAVE(curthread); + } + THR_THREAD_UNLOCK(curthread, thread); + THREAD_LIST_UNLOCK(curthread); + } else { + THR_THREAD_UNLOCK(curthread, thread); } } +/* return with thread lock held if thread is found */ int -_thr_find_thread(struct pthread *curthread __unused, struct pthread *thread, +_thr_find_thread(struct pthread *curthread, struct pthread *thread, int include_dead) { struct pthread *pthread; + int ret; if (thread == NULL) - /* Invalid thread: */ return (EINVAL); + ret = 0; + THREAD_LIST_RDLOCK(curthread); pthread = _thr_hash_find(thread); if (pthread) { + THR_THREAD_LOCK(curthread, pthread); if (include_dead == 0 && pthread->state == PS_DEAD) { - pthread = NULL; - } + THR_THREAD_UNLOCK(curthread, pthread); + ret = ESRCH; + } + } else { + ret = ESRCH; } - - /* Return zero if the thread exists: */ - return ((pthread != NULL) ? 0 : ESRCH); + THREAD_LIST_UNLOCK(curthread); + return (ret); } Modified: user/imp/tbemd/lib/libthr/thread/thr_private.h ============================================================================== --- user/imp/tbemd/lib/libthr/thread/thr_private.h Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/lib/libthr/thread/thr_private.h Mon Sep 13 15:19:49 2010 (r212557) @@ -415,13 +415,13 @@ struct pthread { #define THR_FLAGS_PRIVATE 0x0001 #define THR_FLAGS_NEED_SUSPEND 0x0002 /* thread should be suspended */ #define THR_FLAGS_SUSPENDED 0x0004 /* thread is suspended */ +#define THR_FLAGS_IN_GCLIST 0x0008 /* thread in gc list */ +#define THR_FLAGS_DETACHED 0x0010 /* thread is detached */ /* Thread list flags; only set with thread list lock held. */ int tlflags; #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 */ -#define TLFLAGS_DETACHED 0x0008 /* thread is detached */ /* Queue of currently owned NORMAL or PRIO_INHERIT type mutexes. */ struct mutex_queue mutexq; @@ -463,6 +463,10 @@ struct pthread { td_event_msg_t event_buf; }; +#define THR_SHOULD_GC(thrd) \ + ((thrd)->refcount == 0 && (thrd)->state == PS_DEAD && \ + ((thrd)->flags & THR_FLAGS_DETACHED) != 0) + #define THR_IN_CRITICAL(thrd) \ (((thrd)->locklevel > 0) || \ ((thrd)->critical_count > 0)) @@ -517,14 +521,23 @@ do { \ #define THR_THREAD_LOCK(curthrd, thr) THR_LOCK_ACQUIRE(curthrd, &(thr)->lock) #define THR_THREAD_UNLOCK(curthrd, thr) THR_LOCK_RELEASE(curthrd, &(thr)->lock) -#define THREAD_LIST_LOCK(curthrd) \ +#define THREAD_LIST_RDLOCK(curthrd) \ +do { \ + (curthrd)->locklevel++; \ + _thr_rwl_rdlock(&_thr_list_lock); \ +} while (0) + +#define THREAD_LIST_WRLOCK(curthrd) \ do { \ - THR_LOCK_ACQUIRE((curthrd), &_thr_list_lock); \ + (curthrd)->locklevel++; \ + _thr_rwl_wrlock(&_thr_list_lock); \ } while (0) #define THREAD_LIST_UNLOCK(curthrd) \ do { \ - THR_LOCK_RELEASE((curthrd), &_thr_list_lock); \ + _thr_rwl_unlock(&_thr_list_lock); \ + (curthrd)->locklevel--; \ + _thr_ast(curthrd); \ } while (0) /* @@ -546,20 +559,30 @@ do { \ } \ } while (0) #define THR_GCLIST_ADD(thrd) do { \ - if (((thrd)->tlflags & TLFLAGS_IN_GCLIST) == 0) { \ + if (((thrd)->flags & THR_FLAGS_IN_GCLIST) == 0) { \ TAILQ_INSERT_HEAD(&_thread_gc_list, thrd, gcle);\ - (thrd)->tlflags |= TLFLAGS_IN_GCLIST; \ + (thrd)->flags |= THR_FLAGS_IN_GCLIST; \ _gc_count++; \ } \ } while (0) #define THR_GCLIST_REMOVE(thrd) do { \ - if (((thrd)->tlflags & TLFLAGS_IN_GCLIST) != 0) { \ + if (((thrd)->flags & THR_FLAGS_IN_GCLIST) != 0) { \ TAILQ_REMOVE(&_thread_gc_list, thrd, gcle); \ - (thrd)->tlflags &= ~TLFLAGS_IN_GCLIST; \ + (thrd)->flags &= ~THR_FLAGS_IN_GCLIST; \ _gc_count--; \ } \ } while (0) +#define THR_REF_ADD(curthread, pthread) { \ + THR_CRITICAL_ENTER(curthread); \ + pthread->refcount++; \ +} while (0) + +#define THR_REF_DEL(curthread, pthread) { \ + pthread->refcount--; \ + THR_CRITICAL_LEAVE(curthread); \ +} while (0) + #define GC_NEEDED() (_gc_count >= 5) #define SHOULD_REPORT_EVENT(curthr, e) \ @@ -618,7 +641,7 @@ extern struct umutex _mutex_static_lock extern struct umutex _cond_static_lock __hidden; extern struct umutex _rwlock_static_lock __hidden; extern struct umutex _keytable_lock __hidden; -extern struct umutex _thr_list_lock __hidden; +extern struct urwlock _thr_list_lock __hidden; extern struct umutex _thr_event_lock __hidden; /* @@ -673,6 +696,7 @@ int _thr_setscheduler(lwpid_t, int, cons void _thr_signal_prefork(void) __hidden; void _thr_signal_postfork(void) __hidden; void _thr_signal_postfork_child(void) __hidden; +void _thr_try_gc(struct pthread *, struct pthread *) __hidden; int _rtp_to_schedparam(const struct rtprio *rtp, int *policy, struct sched_param *param) __hidden; int _schedparam_to_rtp(int policy, const struct sched_param *param, Modified: user/imp/tbemd/lib/libthr/thread/thr_resume_np.c ============================================================================== --- user/imp/tbemd/lib/libthr/thread/thr_resume_np.c Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/lib/libthr/thread/thr_resume_np.c Mon Sep 13 15:19:49 2010 (r212557) @@ -50,12 +50,10 @@ _pthread_resume_np(pthread_t thread) int ret; /* Add a reference to the thread: */ - if ((ret = _thr_ref_add(curthread, thread, /*include dead*/0)) == 0) { + if ((ret = _thr_find_thread(curthread, thread, /*include dead*/0)) == 0) { /* Lock the threads scheduling queue: */ - THR_THREAD_LOCK(curthread, thread); resume_common(thread); THR_THREAD_UNLOCK(curthread, thread); - _thr_ref_delete(curthread, thread); } return (ret); } @@ -67,7 +65,7 @@ _pthread_resume_all_np(void) struct pthread *thread; /* Take the thread list lock: */ - THREAD_LIST_LOCK(curthread); + THREAD_LIST_RDLOCK(curthread); TAILQ_FOREACH(thread, &_thread_list, tle) { if (thread != curthread) { Modified: user/imp/tbemd/lib/libthr/thread/thr_stack.c ============================================================================== --- user/imp/tbemd/lib/libthr/thread/thr_stack.c Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/lib/libthr/thread/thr_stack.c Mon Sep 13 15:19:49 2010 (r212557) @@ -154,7 +154,7 @@ _thr_stack_alloc(struct pthread_attr *at * Use the garbage collector lock for synchronization of the * spare stack lists and allocations from usrstack. */ - THREAD_LIST_LOCK(curthread); + THREAD_LIST_WRLOCK(curthread); /* * If the stack and guard sizes are default, try to allocate a stack * from the default-size stack cache: Modified: user/imp/tbemd/lib/libthr/thread/thr_suspend_np.c ============================================================================== --- user/imp/tbemd/lib/libthr/thread/thr_suspend_np.c Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/lib/libthr/thread/thr_suspend_np.c Mon Sep 13 15:19:49 2010 (r212557) @@ -76,7 +76,7 @@ _pthread_suspend_all_np(void) struct pthread *thread; int ret; - THREAD_LIST_LOCK(curthread); + THREAD_LIST_RDLOCK(curthread); TAILQ_FOREACH(thread, &_thread_list, tle) { if (thread != curthread) { @@ -96,13 +96,15 @@ restart: THR_THREAD_LOCK(curthread, thread); ret = suspend_common(curthread, thread, 0); if (ret == 0) { - /* Can not suspend, try to wait */ - thread->refcount++; THREAD_LIST_UNLOCK(curthread); + /* Can not suspend, try to wait */ + THR_REF_ADD(curthread, thread); suspend_common(curthread, thread, 1); - THR_THREAD_UNLOCK(curthread, thread); - THREAD_LIST_LOCK(curthread); - _thr_ref_delete_unlocked(curthread, thread); + THR_REF_DEL(curthread, thread); + _thr_try_gc(curthread, thread); + /* thread lock released */ + + THREAD_LIST_RDLOCK(curthread); /* * Because we were blocked, things may have * been changed, we have to restart the @@ -127,8 +129,8 @@ suspend_common(struct pthread *curthread !(thread->flags & THR_FLAGS_SUSPENDED)) { thread->flags |= THR_FLAGS_NEED_SUSPEND; tmp = thread->cycle; - THR_THREAD_UNLOCK(curthread, thread); _thr_send_sig(thread, SIGCANCEL); + THR_THREAD_UNLOCK(curthread, thread); if (waitok) { _thr_umtx_wait_uint(&thread->cycle, tmp, NULL, 0); THR_THREAD_LOCK(curthread, thread); Modified: user/imp/tbemd/lib/msun/Makefile ============================================================================== --- user/imp/tbemd/lib/msun/Makefile Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/lib/msun/Makefile Mon Sep 13 15:19:49 2010 (r212557) @@ -14,8 +14,6 @@ .if ${MACHINE_CPUARCH} == "i386" ARCH_SUBDIR= i387 -.elif ${MACHINE_ARCH} == "powerpc64" -ARCH_SUBDIR= powerpc .else ARCH_SUBDIR= ${MACHINE_CPUARCH} .endif Modified: user/imp/tbemd/sbin/geom/class/cache/geom_cache.c ============================================================================== --- user/imp/tbemd/sbin/geom/class/cache/geom_cache.c Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/sbin/geom/class/cache/geom_cache.c Mon Sep 13 15:19:49 2010 (r212557) @@ -42,10 +42,8 @@ __FBSDID("$FreeBSD$"); uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_CACHE_VERSION; -static intmax_t blocksize_label = 65536; -static intmax_t size_label = 100; -static intmax_t blocksize_configure = 0; -static intmax_t size_configure = 0; +#define GCACHE_BLOCKSIZE "65536" +#define GCACHE_SIZE "100" static void cache_main(struct gctl_req *req, unsigned flags); static void cache_clear(struct gctl_req *req); @@ -53,44 +51,44 @@ static void cache_dump(struct gctl_req * static void cache_label(struct gctl_req *req); struct g_command class_commands[] = { - { "clear", G_FLAG_VERBOSE, cache_main, G_NULL_OPTS, NULL, + { "clear", G_FLAG_VERBOSE, cache_main, G_NULL_OPTS, "[-v] prov ..." }, { "configure", G_FLAG_VERBOSE, NULL, { - { 'b', "blocksize", &blocksize_configure, G_TYPE_NUMBER }, - { 's', "size", &size_configure, G_TYPE_NUMBER }, + { 'b', "blocksize", "0", G_TYPE_NUMBER }, + { 's', "size", "0", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-v] [-b blocksize] [-s size] name" + "[-v] [-b blocksize] [-s size] name" }, { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, { - { 'b', "blocksize", &blocksize_label, G_TYPE_NUMBER }, - { 's', "size", &size_label, G_TYPE_NUMBER }, + { 'b', "blocksize", GCACHE_BLOCKSIZE, G_TYPE_NUMBER }, + { 's', "size", GCACHE_SIZE, G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-v] [-b blocksize] [-s size] name prov" + "[-v] [-b blocksize] [-s size] name prov" }, { "destroy", G_FLAG_VERBOSE, NULL, { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fv] name ..." + "[-fv] name ..." }, - { "dump", 0, cache_main, G_NULL_OPTS, NULL, + { "dump", 0, cache_main, G_NULL_OPTS, "prov ..." }, { "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, cache_main, { - { 'b', "blocksize", &blocksize_label, G_TYPE_NUMBER }, - { 's', "size", &size_label, G_TYPE_NUMBER }, + { 'b', "blocksize", GCACHE_BLOCKSIZE, G_TYPE_NUMBER }, + { 's', "size", GCACHE_SIZE, G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-v] [-b blocksize] [-s size] name prov" + "[-v] [-b blocksize] [-s size] name prov" }, - { "reset", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL, + { "reset", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, "[-v] name ..." }, { "stop", G_FLAG_VERBOSE, NULL, @@ -98,7 +96,7 @@ struct g_command class_commands[] = { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fv] name ..." + "[-fv] name ..." }, G_CMD_SENTINEL }; Modified: user/imp/tbemd/sbin/geom/class/concat/geom_concat.c ============================================================================== --- user/imp/tbemd/sbin/geom/class/concat/geom_concat.c Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/sbin/geom/class/concat/geom_concat.c Mon Sep 13 15:19:49 2010 (r212557) @@ -51,20 +51,20 @@ static void concat_dump(struct gctl_req static void concat_label(struct gctl_req *req); struct g_command class_commands[] = { - { "clear", G_FLAG_VERBOSE, concat_main, G_NULL_OPTS, NULL, + { "clear", G_FLAG_VERBOSE, concat_main, G_NULL_OPTS, "[-v] prov ..." }, { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, G_NULL_OPTS, - NULL, "[-v] name prov ..." + "[-v] name prov ..." }, { "destroy", G_FLAG_VERBOSE, NULL, { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fv] name ..." + "[-fv] name ..." }, - { "dump", 0, concat_main, G_NULL_OPTS, NULL, + { "dump", 0, concat_main, G_NULL_OPTS, "prov ..." }, { "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, concat_main, @@ -72,14 +72,14 @@ struct g_command class_commands[] = { { 'h', "hardcode", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-hv] name prov ..." + "[-hv] name prov ..." }, { "stop", G_FLAG_VERBOSE, NULL, { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fv] name ..." + "[-fv] name ..." }, G_CMD_SENTINEL }; Modified: user/imp/tbemd/sbin/geom/class/eli/geom_eli.c ============================================================================== --- user/imp/tbemd/sbin/geom/class/eli/geom_eli.c Mon Sep 13 14:25:07 2010 (r212556) +++ user/imp/tbemd/sbin/geom/class/eli/geom_eli.c Mon Sep 13 15:19:49 2010 (r212557) @@ -55,15 +55,7 @@ uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_ELI_VERSION; #define GELI_BACKUP_DIR "/var/backups/" - -static char aalgo[] = "none"; -static char ealgo[] = "aes"; -static intmax_t keylen = 0; -static intmax_t keyno = -1; -static intmax_t iterations = -1; -static intmax_t sectorsize = 0; -static char keyfile[] = "", newkeyfile[] = ""; -static char backupfile[] = ""; +#define GELI_ENC_ALGO "aes" static void eli_main(struct gctl_req *req, unsigned flags); static void eli_init(struct gctl_req *req); @@ -101,43 +93,43 @@ static int eli_backup_create(struct gctl struct g_command class_commands[] = { { "init", G_FLAG_VERBOSE, eli_main, { - { 'a', "aalgo", aalgo, G_TYPE_STRING }, + { 'a', "aalgo", "", G_TYPE_STRING }, { 'b', "boot", NULL, G_TYPE_BOOL }, - { 'B', "backupfile", backupfile, G_TYPE_STRING }, - { 'e', "ealgo", ealgo, G_TYPE_STRING }, - { 'i', "iterations", &iterations, G_TYPE_NUMBER }, - { 'K', "newkeyfile", newkeyfile, G_TYPE_STRING }, - { 'l', "keylen", &keylen, G_TYPE_NUMBER }, + { 'B', "backupfile", "", G_TYPE_STRING }, + { 'e', "ealgo", GELI_ENC_ALGO, G_TYPE_STRING }, + { 'i', "iterations", "-1", G_TYPE_NUMBER }, + { 'K', "newkeyfile", "", G_TYPE_STRING }, + { 'l', "keylen", "0", G_TYPE_NUMBER }, { 'P', "nonewpassphrase", NULL, G_TYPE_BOOL }, - { 's', "sectorsize", §orsize, G_TYPE_NUMBER }, + { 's', "sectorsize", "0", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-bPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-K newkeyfile] [-s sectorsize] prov" + "[-bPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-K newkeyfile] [-s sectorsize] prov" }, { "label", G_FLAG_VERBOSE, eli_main, { - { 'a', "aalgo", aalgo, G_TYPE_STRING }, + { 'a', "aalgo", "", G_TYPE_STRING }, { 'b', "boot", NULL, G_TYPE_BOOL }, - { 'B', "backupfile", backupfile, G_TYPE_STRING }, - { 'e', "ealgo", ealgo, G_TYPE_STRING }, - { 'i', "iterations", &iterations, G_TYPE_NUMBER }, - { 'K', "newkeyfile", newkeyfile, G_TYPE_STRING }, - { 'l', "keylen", &keylen, G_TYPE_NUMBER }, + { 'B', "backupfile", "", G_TYPE_STRING }, + { 'e', "ealgo", GELI_ENC_ALGO, G_TYPE_STRING }, + { 'i', "iterations", "-1", G_TYPE_NUMBER }, + { 'K', "newkeyfile", "", G_TYPE_STRING }, + { 'l', "keylen", "0", G_TYPE_NUMBER }, { 'P', "nonewpassphrase", NULL, G_TYPE_BOOL }, - { 's', "sectorsize", §orsize, G_TYPE_NUMBER }, + { 's', "sectorsize", "0", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "- an alias for 'init'" + "- an alias for 'init'" }, { "attach", G_FLAG_VERBOSE | G_FLAG_LOADKLD, eli_main, { { 'd', "detach", NULL, G_TYPE_BOOL }, - { 'k', "keyfile", keyfile, G_TYPE_STRING }, + { 'k', "keyfile", "", G_TYPE_STRING }, { 'p', "nopassphrase", NULL, G_TYPE_BOOL }, { 'r', "readonly", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-dprv] [-k keyfile] prov" + "[-dprv] [-k keyfile] prov" }, { "detach", 0, NULL, { @@ -145,7 +137,7 @@ struct g_command class_commands[] = { { 'l', "last", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fl] prov ..." + "[-fl] prov ..." }, { "stop", 0, NULL, { @@ -153,18 +145,18 @@ struct g_command class_commands[] = { { 'l', "last", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "- an alias for 'detach'" + "- an alias for 'detach'" }, { "onetime", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, { - { 'a', "aalgo", aalgo, G_TYPE_STRING }, + { 'a', "aalgo", "", G_TYPE_STRING }, { 'd', "detach", NULL, G_TYPE_BOOL }, - { 'e', "ealgo", ealgo, G_TYPE_STRING }, - { 'l', "keylen", &keylen, G_TYPE_NUMBER }, - { 's', "sectorsize", §orsize, G_TYPE_NUMBER }, + { 'e', "ealgo", GELI_ENC_ALGO, G_TYPE_STRING }, + { 'l', "keylen", "0", G_TYPE_NUMBER }, + { 's', "sectorsize", "0", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-d] [-a aalgo] [-e ealgo] [-l keylen] [-s sectorsize] prov" + "[-d] [-a aalgo] [-e ealgo] [-l keylen] [-s sectorsize] prov" }, { "configure", G_FLAG_VERBOSE, eli_main, { @@ -172,46 +164,46 @@ struct g_command class_commands[] = { { 'B', "noboot", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-bB] prov ..." + "[-bB] prov ..." }, { "setkey", G_FLAG_VERBOSE, eli_main, { - { 'i', "iterations", &iterations, G_TYPE_NUMBER }, - { 'k', "keyfile", keyfile, G_TYPE_STRING }, - { 'K', "newkeyfile", newkeyfile, G_TYPE_STRING }, - { 'n', "keyno", &keyno, G_TYPE_NUMBER }, + { 'i', "iterations", "-1", G_TYPE_NUMBER }, + { 'k', "keyfile", "", G_TYPE_STRING }, + { 'K', "newkeyfile", "", G_TYPE_STRING }, + { 'n', "keyno", "-1", G_TYPE_NUMBER }, { 'p', "nopassphrase", NULL, G_TYPE_BOOL }, { 'P', "nonewpassphrase", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-pPv] [-n keyno] [-i iterations] [-k keyfile] [-K newkeyfile] prov" + "[-pPv] [-n keyno] [-i iterations] [-k keyfile] [-K newkeyfile] prov" }, { "delkey", G_FLAG_VERBOSE, eli_main, { { 'a', "all", NULL, G_TYPE_BOOL }, { 'f', "force", NULL, G_TYPE_BOOL }, - { 'n', "keyno", &keyno, G_TYPE_NUMBER }, + { 'n', "keyno", "-1", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-afv] [-n keyno] prov" + "[-afv] [-n keyno] prov" }, { "kill", G_FLAG_VERBOSE, eli_main, { *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009131519.o8DFJnkj010094>