148 #undef DTRACE_PROBE4
149 #endif /* DTRACE_PROBE4 */
150 #define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) \
151 ZFS_PROBE4(#a, (unsigned long)c, (unsigned long)e, (unsigned long)g, \
152 (unsigned long)i)
153
154 /*
155 * We use the comma operator so that this macro can be used without much
156 * additional code. For example, "return (EINVAL);" becomes
157 * "return (SET_ERROR(EINVAL));". Note that the argument will be evaluated
158 * twice, so it should not have side effects (e.g. something like:
159 * "return (SET_ERROR(log_error(EINVAL, info)));" would log the error twice).
160 */
161 #define SET_ERROR(err) (ZFS_SET_ERROR(err), err)
162
163 /*
164 * Threads
165 */
166 #define curthread ((void *)(uintptr_t)thr_self())
167
168 typedef struct kthread kthread_t;
169
170 #define thread_create(stk, stksize, func, arg, len, pp, state, pri) \
171 zk_thread_create(func, arg)
172 #define thread_exit() thr_exit(NULL)
173 #define thread_join(t) panic("libzpool cannot join threads")
174
175 #define newproc(f, a, cid, pri, ctp, pid) (ENOSYS)
176
177 /* in libzpool, p0 exists only to have its address taken */
178 struct proc {
179 uintptr_t this_is_never_used_dont_dereference_it;
180 };
181
182 extern struct proc p0;
183 #define curproc (&p0)
184
185 #define PS_NONE -1
186
187 extern kthread_t *zk_thread_create(void (*func)(), void *arg);
|
148 #undef DTRACE_PROBE4
149 #endif /* DTRACE_PROBE4 */
150 #define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) \
151 ZFS_PROBE4(#a, (unsigned long)c, (unsigned long)e, (unsigned long)g, \
152 (unsigned long)i)
153
154 /*
155 * We use the comma operator so that this macro can be used without much
156 * additional code. For example, "return (EINVAL);" becomes
157 * "return (SET_ERROR(EINVAL));". Note that the argument will be evaluated
158 * twice, so it should not have side effects (e.g. something like:
159 * "return (SET_ERROR(log_error(EINVAL, info)));" would log the error twice).
160 */
161 #define SET_ERROR(err) (ZFS_SET_ERROR(err), err)
162
163 /*
164 * Threads
165 */
166 #define curthread ((void *)(uintptr_t)thr_self())
167
168 #define kpreempt(x) yield()
169
170 typedef struct kthread kthread_t;
171
172 #define thread_create(stk, stksize, func, arg, len, pp, state, pri) \
173 zk_thread_create(func, arg)
174 #define thread_exit() thr_exit(NULL)
175 #define thread_join(t) panic("libzpool cannot join threads")
176
177 #define newproc(f, a, cid, pri, ctp, pid) (ENOSYS)
178
179 /* in libzpool, p0 exists only to have its address taken */
180 struct proc {
181 uintptr_t this_is_never_used_dont_dereference_it;
182 };
183
184 extern struct proc p0;
185 #define curproc (&p0)
186
187 #define PS_NONE -1
188
189 extern kthread_t *zk_thread_create(void (*func)(), void *arg);
|