4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
32 #include <sys/signal.h>
35 #include <sys/processor.h>
36 #include <sys/zfs_context.h>
37 #include <sys/utsname.h>
39 #include <sys/systeminfo.h>
42 * Emulation of kernel services in userland.
47 vnode_t *rootdir = (vnode_t *)0xabcd1234;
48 char hw_serial[HW_HOSTID_LEN];
50 struct utsname utsname = {
51 "userland", "libzpool", "1", "1", "na"
54 /* this only exists to have its address taken */
58 * =========================================================================
60 * =========================================================================
63 pthread_cond_t kthread_cond = PTHREAD_COND_INITIALIZER;
64 pthread_mutex_t kthread_lock = PTHREAD_MUTEX_INITIALIZER;
65 pthread_key_t kthread_key;
73 VERIFY3S(pthread_key_create(&kthread_key, NULL), ==, 0);
75 /* Create entry for primary kthread */
76 kt = umem_zalloc(sizeof(kthread_t), UMEM_NOFAIL);
77 kt->t_tid = pthread_self();
80 VERIFY3S(pthread_setspecific(kthread_key, kt), ==, 0);
82 /* Only the main thread should be running at the moment */
83 ASSERT3S(kthread_nr, ==, 0);
90 kthread_t *kt = curthread;
92 ASSERT(pthread_equal(kt->t_tid, pthread_self()));
93 ASSERT3P(kt->t_func, ==, NULL);
95 umem_free(kt, sizeof(kthread_t));
97 /* Wait for all threads to exit via thread_exit() */
98 VERIFY3S(pthread_mutex_lock(&kthread_lock), ==, 0);
100 kthread_nr--; /* Main thread is exiting */
102 while (kthread_nr > 0)
103 VERIFY3S(pthread_cond_wait(&kthread_cond, &kthread_lock), ==,
106 ASSERT3S(kthread_nr, ==, 0);
107 VERIFY3S(pthread_mutex_unlock(&kthread_lock), ==, 0);
109 VERIFY3S(pthread_key_delete(kthread_key), ==, 0);
113 zk_thread_current(void)
115 kthread_t *kt = pthread_getspecific(kthread_key);
117 ASSERT3P(kt, !=, NULL);
123 zk_thread_helper(void *arg)
125 kthread_t *kt = (kthread_t *) arg;
127 VERIFY3S(pthread_setspecific(kthread_key, kt), ==, 0);
129 VERIFY3S(pthread_mutex_lock(&kthread_lock), ==, 0);
131 VERIFY3S(pthread_mutex_unlock(&kthread_lock), ==, 0);
133 kt->t_tid = pthread_self();
134 ((thread_func_arg_t) kt->t_func)(kt->t_arg);
136 /* Unreachable, thread must exit with thread_exit() */
143 zk_thread_create(caddr_t stk, size_t stksize, thread_func_t func, void *arg,
144 size_t len, proc_t *pp, int state, pri_t pri)
150 ASSERT3S(state & ~TS_RUN, ==, 0);
152 kt = umem_zalloc(sizeof(kthread_t), UMEM_NOFAIL);
157 * The Solaris kernel stack size is 24k for x86/x86_64.
158 * The Linux kernel stack size is 8k for x86/x86_64.
160 * We reduce the default stack size in userspace, to ensure
161 * we observe stack overruns in user space as well as in
162 * kernel space. PTHREAD_STACK_MIN is the minimum stack
163 * required for a NULL procedure in user space and is added
164 * in to the stack requirements.
166 * Some buggy NPTL threading implementations include the
167 * guard area within the stack size allocations. In
168 * this case we allocate an extra page to account for the
169 * guard area since we only have two pages of usable stack
173 stack = PTHREAD_STACK_MIN + MAX(stksize, STACK_SIZE) +
176 VERIFY3S(pthread_attr_init(&attr), ==, 0);
177 VERIFY3S(pthread_attr_setstacksize(&attr, stack), ==, 0);
178 VERIFY3S(pthread_attr_setguardsize(&attr, PAGESIZE), ==, 0);
180 VERIFY3S(pthread_create(&kt->t_tid, &attr, &zk_thread_helper, kt),
183 VERIFY3S(pthread_attr_destroy(&attr), ==, 0);
191 kthread_t *kt = curthread;
193 ASSERT(pthread_equal(kt->t_tid, pthread_self()));
195 umem_free(kt, sizeof(kthread_t));
197 pthread_mutex_lock(&kthread_lock);
199 pthread_mutex_unlock(&kthread_lock);
201 pthread_cond_broadcast(&kthread_cond);
202 pthread_exit((void *)TS_MAGIC);
206 zk_thread_join(kt_did_t tid)
210 pthread_join((pthread_t)tid, &ret);
211 VERIFY3P(ret, ==, (void *)TS_MAGIC);
215 * =========================================================================
217 * =========================================================================
221 kstat_create(char *module, int instance, char *name, char *class,
222 uchar_t type, ulong_t ndata, uchar_t ks_flag)
229 kstat_install(kstat_t *ksp)
234 kstat_delete(kstat_t *ksp)
238 * =========================================================================
240 * =========================================================================
244 mutex_init(kmutex_t *mp, char *name, int type, void *cookie)
246 ASSERT3S(type, ==, MUTEX_DEFAULT);
247 ASSERT3P(cookie, ==, NULL);
248 mp->m_owner = MTX_INIT;
249 mp->m_magic = MTX_MAGIC;
250 VERIFY3S(pthread_mutex_init(&mp->m_lock, NULL), ==, 0);
254 mutex_destroy(kmutex_t *mp)
256 ASSERT3U(mp->m_magic, ==, MTX_MAGIC);
257 ASSERT3P(mp->m_owner, ==, MTX_INIT);
258 VERIFY3S(pthread_mutex_destroy(&(mp)->m_lock), ==, 0);
259 mp->m_owner = MTX_DEST;
264 mutex_enter(kmutex_t *mp)
266 ASSERT3U(mp->m_magic, ==, MTX_MAGIC);
267 ASSERT3P(mp->m_owner, !=, MTX_DEST);
268 ASSERT3P(mp->m_owner, !=, curthread);
269 VERIFY3S(pthread_mutex_lock(&mp->m_lock), ==, 0);
270 ASSERT3P(mp->m_owner, ==, MTX_INIT);
271 mp->m_owner = curthread;
275 mutex_tryenter(kmutex_t *mp)
277 ASSERT3U(mp->m_magic, ==, MTX_MAGIC);
278 ASSERT3P(mp->m_owner, !=, MTX_DEST);
279 if (0 == pthread_mutex_trylock(&mp->m_lock)) {
280 ASSERT3P(mp->m_owner, ==, MTX_INIT);
281 mp->m_owner = curthread;
289 mutex_exit(kmutex_t *mp)
291 ASSERT3U(mp->m_magic, ==, MTX_MAGIC);
292 ASSERT3P(mutex_owner(mp), ==, curthread);
293 mp->m_owner = MTX_INIT;
294 VERIFY3S(pthread_mutex_unlock(&mp->m_lock), ==, 0);
298 mutex_owner(kmutex_t *mp)
300 ASSERT3U(mp->m_magic, ==, MTX_MAGIC);
301 return (mp->m_owner);
305 mutex_held(kmutex_t *mp)
307 return (mp->m_owner == curthread);
311 * =========================================================================
313 * =========================================================================
317 rw_init(krwlock_t *rwlp, char *name, int type, void *arg)
319 ASSERT3S(type, ==, RW_DEFAULT);
320 ASSERT3P(arg, ==, NULL);
321 VERIFY3S(pthread_rwlock_init(&rwlp->rw_lock, NULL), ==, 0);
322 rwlp->rw_owner = RW_INIT;
323 rwlp->rw_wr_owner = RW_INIT;
324 rwlp->rw_readers = 0;
325 rwlp->rw_magic = RW_MAGIC;
329 rw_destroy(krwlock_t *rwlp)
331 ASSERT3U(rwlp->rw_magic, ==, RW_MAGIC);
333 VERIFY3S(pthread_rwlock_destroy(&rwlp->rw_lock), ==, 0);
338 rw_enter(krwlock_t *rwlp, krw_t rw)
340 ASSERT3U(rwlp->rw_magic, ==, RW_MAGIC);
341 ASSERT3P(rwlp->rw_owner, !=, curthread);
342 ASSERT3P(rwlp->rw_wr_owner, !=, curthread);
344 if (rw == RW_READER) {
345 VERIFY3S(pthread_rwlock_rdlock(&rwlp->rw_lock), ==, 0);
346 ASSERT3P(rwlp->rw_wr_owner, ==, RW_INIT);
348 atomic_inc_uint(&rwlp->rw_readers);
350 VERIFY3S(pthread_rwlock_wrlock(&rwlp->rw_lock), ==, 0);
351 ASSERT3P(rwlp->rw_wr_owner, ==, RW_INIT);
352 ASSERT3U(rwlp->rw_readers, ==, 0);
354 rwlp->rw_wr_owner = curthread;
357 rwlp->rw_owner = curthread;
361 rw_exit(krwlock_t *rwlp)
363 ASSERT3U(rwlp->rw_magic, ==, RW_MAGIC);
364 ASSERT(RW_LOCK_HELD(rwlp));
366 if (RW_READ_HELD(rwlp))
367 atomic_dec_uint(&rwlp->rw_readers);
369 rwlp->rw_wr_owner = RW_INIT;
371 rwlp->rw_owner = RW_INIT;
372 VERIFY3S(pthread_rwlock_unlock(&rwlp->rw_lock), ==, 0);
376 rw_tryenter(krwlock_t *rwlp, krw_t rw)
380 ASSERT3U(rwlp->rw_magic, ==, RW_MAGIC);
383 rv = pthread_rwlock_tryrdlock(&rwlp->rw_lock);
385 rv = pthread_rwlock_trywrlock(&rwlp->rw_lock);
388 ASSERT3P(rwlp->rw_wr_owner, ==, RW_INIT);
391 atomic_inc_uint(&rwlp->rw_readers);
393 ASSERT3U(rwlp->rw_readers, ==, 0);
394 rwlp->rw_wr_owner = curthread;
397 rwlp->rw_owner = curthread;
401 VERIFY3S(rv, ==, EBUSY);
407 rw_tryupgrade(krwlock_t *rwlp)
409 ASSERT3U(rwlp->rw_magic, ==, RW_MAGIC);
415 * =========================================================================
416 * condition variables
417 * =========================================================================
421 cv_init(kcondvar_t *cv, char *name, int type, void *arg)
423 ASSERT3S(type, ==, CV_DEFAULT);
424 cv->cv_magic = CV_MAGIC;
425 VERIFY3S(pthread_cond_init(&cv->cv, NULL), ==, 0);
429 cv_destroy(kcondvar_t *cv)
431 ASSERT3U(cv->cv_magic, ==, CV_MAGIC);
432 VERIFY3S(pthread_cond_destroy(&cv->cv), ==, 0);
437 cv_wait(kcondvar_t *cv, kmutex_t *mp)
439 ASSERT3U(cv->cv_magic, ==, CV_MAGIC);
440 ASSERT3P(mutex_owner(mp), ==, curthread);
441 mp->m_owner = MTX_INIT;
442 int ret = pthread_cond_wait(&cv->cv, &mp->m_lock);
444 VERIFY3S(ret, ==, EINTR);
445 mp->m_owner = curthread;
449 cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime)
456 ASSERT3U(cv->cv_magic, ==, CV_MAGIC);
459 delta = abstime - ddi_get_lbolt();
463 VERIFY(gettimeofday(&tv, NULL) == 0);
465 ts.tv_sec = tv.tv_sec + delta / hz;
466 ts.tv_nsec = tv.tv_usec * 1000 + (delta % hz) * (NANOSEC / hz);
467 if (ts.tv_nsec >= NANOSEC) {
469 ts.tv_nsec -= NANOSEC;
472 ASSERT3P(mutex_owner(mp), ==, curthread);
473 mp->m_owner = MTX_INIT;
474 error = pthread_cond_timedwait(&cv->cv, &mp->m_lock, &ts);
475 mp->m_owner = curthread;
477 if (error == ETIMEDOUT)
483 VERIFY3S(error, ==, 0);
489 cv_signal(kcondvar_t *cv)
491 ASSERT3U(cv->cv_magic, ==, CV_MAGIC);
492 VERIFY3S(pthread_cond_signal(&cv->cv), ==, 0);
496 cv_broadcast(kcondvar_t *cv)
498 ASSERT3U(cv->cv_magic, ==, CV_MAGIC);
499 VERIFY3S(pthread_cond_broadcast(&cv->cv), ==, 0);
503 * =========================================================================
505 * =========================================================================
508 * Note: for the xxxat() versions of these functions, we assume that the
509 * starting vp is always rootdir (which is true for spa_directory.c, the only
510 * ZFS consumer of these interfaces). We assert this is true, and then emulate
511 * them by adding '/' in front of the path.
516 vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3)
525 realpath = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
528 * If we're accessing a real disk from userland, we need to use
529 * the character interface to avoid caching. This is particularly
530 * important if we're trying to look at a real in-kernel storage
531 * pool from userland, e.g. via zdb, because otherwise we won't
532 * see the changes occurring under the segmap cache.
533 * On the other hand, the stupid character device returns zero
534 * for its size. So -- gag -- we open the block device to get
535 * its size, and remember it for subsequent VOP_GETATTR().
537 #if defined(__sun__) || defined(__sun)
538 if (strncmp(path, "/dev/", 5) == 0) {
543 fd = open64(path, O_RDONLY);
549 if (fstat64(fd, &st) == -1) {
556 (void) sprintf(realpath, "%s", path);
557 dsk = strstr(path, "/dsk/");
559 (void) sprintf(realpath + (dsk - path) + 1, "r%s",
562 (void) sprintf(realpath, "%s", path);
563 if (!(flags & FCREAT) && stat64(realpath, &st) == -1) {
570 if (!(flags & FCREAT) && S_ISBLK(st.st_mode)) {
574 /* We shouldn't be writing to block devices in userspace */
575 VERIFY(!(flags & FWRITE));
579 old_umask = umask(0);
582 * The construct 'flags - FREAD' conveniently maps combinations of
583 * FREAD and FWRITE to the corresponding O_RDONLY, O_WRONLY, and O_RDWR.
585 fd = open64(realpath, flags - FREAD, mode);
589 (void) umask(old_umask);
594 if (fstat64_blk(fd, &st) == -1) {
600 (void) fcntl(fd, F_SETFD, FD_CLOEXEC);
602 *vpp = vp = umem_zalloc(sizeof (vnode_t), UMEM_NOFAIL);
605 vp->v_size = st.st_size;
606 vp->v_path = spa_strdup(path);
613 vn_openat(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2,
614 int x3, vnode_t *startvp, int fd)
616 char *realpath = umem_alloc(strlen(path) + 2, UMEM_NOFAIL);
619 ASSERT(startvp == rootdir);
620 (void) sprintf(realpath, "/%s", path);
622 /* fd ignored for now, need if want to simulate nbmand support */
623 ret = vn_open(realpath, x1, flags, mode, vpp, x2, x3);
625 umem_free(realpath, strlen(path) + 2);
632 vn_rdwr(int uio, vnode_t *vp, void *addr, ssize_t len, offset_t offset,
633 int x1, int x2, rlim64_t x3, void *x4, ssize_t *residp)
635 ssize_t rc, done = 0, split;
637 if (uio == UIO_READ) {
638 rc = pread64(vp->v_fd, addr, len, offset);
641 * To simulate partial disk writes, we split writes into two
642 * system calls so that the process can be killed in between.
644 split = (len > 0 ? rand() % len : 0);
645 rc = pwrite64(vp->v_fd, addr, split, offset);
648 rc = pwrite64(vp->v_fd, (char *)addr + split,
649 len - split, offset + split);
654 if (rc == -1 && errno == EINVAL) {
656 * Under Linux, this most likely means an alignment issue
657 * (memory or disk) due to O_DIRECT, so we abort() in order to
658 * catch the offender.
669 *residp = len - done;
670 else if (done != len)
676 vn_close(vnode_t *vp)
679 spa_strfree(vp->v_path);
680 umem_free(vp, sizeof (vnode_t));
684 * At a minimum we need to update the size since vdev_reopen()
685 * will no longer call vn_openat().
688 fop_getattr(vnode_t *vp, vattr_t *vap)
693 if (fstat64_blk(vp->v_fd, &st) == -1) {
699 vap->va_size = st.st_size;
704 * =========================================================================
705 * Figure out which debugging statements to print
706 * =========================================================================
709 static char *dprintf_string;
710 static int dprintf_print_all;
713 dprintf_find_string(const char *string)
715 char *tmp_str = dprintf_string;
716 int len = strlen(string);
719 * Find out if this is a string we want to print.
720 * String format: file1.c,function_name1,file2.c,file3.c
723 while (tmp_str != NULL) {
724 if (strncmp(tmp_str, string, len) == 0 &&
725 (tmp_str[len] == ',' || tmp_str[len] == '\0'))
727 tmp_str = strchr(tmp_str, ',');
729 tmp_str++; /* Get rid of , */
735 dprintf_setup(int *argc, char **argv)
740 * Debugging can be specified two ways: by setting the
741 * environment variable ZFS_DEBUG, or by including a
742 * "debug=..." argument on the command line. The command
743 * line setting overrides the environment variable.
746 for (i = 1; i < *argc; i++) {
747 int len = strlen("debug=");
748 /* First look for a command line argument */
749 if (strncmp("debug=", argv[i], len) == 0) {
750 dprintf_string = argv[i] + len;
751 /* Remove from args */
752 for (j = i; j < *argc; j++)
759 if (dprintf_string == NULL) {
760 /* Look for ZFS_DEBUG environment variable */
761 dprintf_string = getenv("ZFS_DEBUG");
765 * Are we just turning on all debugging?
767 if (dprintf_find_string("on"))
768 dprintf_print_all = 1;
772 * =========================================================================
774 * =========================================================================
777 __dprintf(const char *file, const char *func, int line, const char *fmt, ...)
783 * Get rid of annoying "../common/" prefix to filename.
785 newfile = strrchr(file, '/');
786 if (newfile != NULL) {
787 newfile = newfile + 1; /* Get rid of leading / */
792 if (dprintf_print_all ||
793 dprintf_find_string(newfile) ||
794 dprintf_find_string(func)) {
795 /* Print out just the function name if requested */
797 if (dprintf_find_string("pid"))
798 (void) printf("%d ", getpid());
799 if (dprintf_find_string("tid"))
800 (void) printf("%u ", (uint_t) pthread_self());
801 if (dprintf_find_string("cpu"))
802 (void) printf("%u ", getcpuid());
803 if (dprintf_find_string("time"))
804 (void) printf("%llu ", gethrtime());
805 if (dprintf_find_string("long"))
806 (void) printf("%s, line %d: ", newfile, line);
807 (void) printf("%s: ", func);
809 (void) vprintf(fmt, adx);
816 * =========================================================================
817 * cmn_err() and panic()
818 * =========================================================================
820 static char ce_prefix[CE_IGNORE][10] = { "", "NOTICE: ", "WARNING: ", "" };
821 static char ce_suffix[CE_IGNORE][2] = { "", "\n", "\n", "" };
824 vpanic(const char *fmt, va_list adx)
826 (void) fprintf(stderr, "error: ");
827 (void) vfprintf(stderr, fmt, adx);
828 (void) fprintf(stderr, "\n");
830 abort(); /* think of it as a "user-level crash dump" */
834 panic(const char *fmt, ...)
844 vcmn_err(int ce, const char *fmt, va_list adx)
848 if (ce != CE_NOTE) { /* suppress noise in userland stress testing */
849 (void) fprintf(stderr, "%s", ce_prefix[ce]);
850 (void) vfprintf(stderr, fmt, adx);
851 (void) fprintf(stderr, "%s", ce_suffix[ce]);
857 cmn_err(int ce, const char *fmt, ...)
862 vcmn_err(ce, fmt, adx);
867 * =========================================================================
869 * =========================================================================
872 kobj_open_file(char *name)
877 /* set vp as the _fd field of the file */
878 if (vn_openat(name, UIO_SYSSPACE, FREAD, 0, &vp, 0, 0, rootdir,
880 return ((void *)-1UL);
882 file = umem_zalloc(sizeof (struct _buf), UMEM_NOFAIL);
883 file->_fd = (intptr_t)vp;
888 kobj_read_file(struct _buf *file, char *buf, unsigned size, unsigned off)
892 vn_rdwr(UIO_READ, (vnode_t *)file->_fd, buf, size, (offset_t)off,
893 UIO_SYSSPACE, 0, 0, 0, &resid);
895 return (size - resid);
899 kobj_close_file(struct _buf *file)
901 vn_close((vnode_t *)file->_fd);
902 umem_free(file, sizeof (struct _buf));
906 kobj_get_filesize(struct _buf *file, uint64_t *size)
909 vnode_t *vp = (vnode_t *)file->_fd;
911 if (fstat64(vp->v_fd, &st) == -1) {
920 * =========================================================================
922 * =========================================================================
928 poll(0, 0, ticks * (1000 / hz));
932 * Find highest one bit set.
933 * Returns bit number + 1 of highest bit that is set, otherwise returns 0.
934 * High order bit is 31 (or 63 in _LP64 kernel).
944 if (i & 0xffffffff00000000ul) {
948 if (i & 0xffff0000) {
966 static int random_fd = -1, urandom_fd = -1;
969 random_get_bytes_common(uint8_t *ptr, size_t len, int fd)
977 bytes = read(fd, ptr, resid);
978 ASSERT3S(bytes, >=, 0);
987 random_get_bytes(uint8_t *ptr, size_t len)
989 return (random_get_bytes_common(ptr, len, random_fd));
993 random_get_pseudo_bytes(uint8_t *ptr, size_t len)
995 return (random_get_bytes_common(ptr, len, urandom_fd));
999 ddi_strtoul(const char *hw_serial, char **nptr, int base, unsigned long *result)
1003 *result = strtoul(hw_serial, &end, base);
1010 ddi_strtoull(const char *str, char **nptr, int base, u_longlong_t *result)
1014 *result = strtoull(str, &end, base);
1021 * =========================================================================
1022 * kernel emulation setup & teardown
1023 * =========================================================================
1026 umem_out_of_memory(void)
1028 char errmsg[] = "out of memory -- generating core dump\n";
1030 (void) fprintf(stderr, "%s", errmsg);
1036 kernel_init(int mode)
1038 umem_nofail_callback(umem_out_of_memory);
1040 physmem = sysconf(_SC_PHYS_PAGES);
1042 dprintf("physmem = %llu pages (%.2f GB)\n", physmem,
1043 (double)physmem * sysconf(_SC_PAGE_SIZE) / (1ULL << 30));
1045 (void) snprintf(hw_serial, sizeof (hw_serial), "%ld",
1046 (mode & FWRITE) ? gethostid() : 0);
1048 VERIFY((random_fd = open("/dev/random", O_RDONLY)) != -1);
1049 VERIFY((urandom_fd = open("/dev/urandom", O_RDONLY)) != -1);
1052 system_taskq_init();
1062 system_taskq_fini();
1073 crgetuid(cred_t *cr)
1079 crgetgid(cred_t *cr)
1085 crgetngroups(cred_t *cr)
1091 crgetgroups(cred_t *cr)
1097 zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr)
1103 zfs_secpolicy_rename_perms(const char *from, const char *to, cred_t *cr)
1109 zfs_secpolicy_destroy_perms(const char *name, cred_t *cr)
1115 ksid_lookupdomain(const char *dom)
1119 kd = umem_zalloc(sizeof (ksiddomain_t), UMEM_NOFAIL);
1120 kd->kd_name = spa_strdup(dom);
1125 ksiddomain_rele(ksiddomain_t *ksid)
1127 spa_strfree(ksid->kd_name);
1128 umem_free(ksid, sizeof (ksiddomain_t));
1132 kmem_vasprintf(const char *fmt, va_list adx)
1137 va_copy(adx_copy, adx);
1138 VERIFY(vasprintf(&buf, fmt, adx_copy) != -1);
1145 kmem_asprintf(const char *fmt, ...)
1151 VERIFY(vasprintf(&buf, fmt, adx) != -1);
1159 zfs_onexit_fd_hold(int fd, minor_t *minorp)
1167 zfs_onexit_fd_rele(int fd)
1173 zfs_onexit_add_cb(minor_t minor, void (*func)(void *), void *data,
1174 uint64_t *action_handle)
1181 zfs_onexit_del_cb(minor_t minor, uint64_t action_handle, boolean_t fire)
1188 zfs_onexit_cb_data(minor_t minor, uint64_t action_handle, void **data)