From bc96366c864c07ef352edb92017357917c75b36c Mon Sep 17 00:00:00 2001 From: Steven Hartland Date: Sat, 17 Jan 2015 14:44:59 +0000 Subject: Mechanically convert cddl sun #ifdef's to illumos Since the upstream for cddl code is now illumos not sun, mechanically convert all sun #ifdef's to illumos #ifdef's which have been used in all newer code for some time. Also do a manual pass to correct the use if #ifdef comments as per style(9) as well as few uses of #if defined(__FreeBSD__) vs #ifndef illumos. MFC after: 1 month Sponsored by: Multiplay --- .../contrib/opensolaris/uts/common/dtrace/dtrace.c | 276 ++++++++++----------- .../opensolaris/uts/common/dtrace/fasttrap.c | 110 ++++---- sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c | 14 +- .../contrib/opensolaris/uts/common/fs/zfs/arc.c | 24 +- .../contrib/opensolaris/uts/common/fs/zfs/dmu.c | 8 +- .../contrib/opensolaris/uts/common/fs/zfs/dnode.c | 6 +- .../contrib/opensolaris/uts/common/fs/zfs/spa.c | 20 +- .../opensolaris/uts/common/fs/zfs/sys/dmu.h | 2 +- .../opensolaris/uts/common/fs/zfs/sys/spa.h | 2 +- .../opensolaris/uts/common/fs/zfs/sys/spa_impl.h | 4 +- .../opensolaris/uts/common/fs/zfs/sys/zvol.h | 8 +- .../contrib/opensolaris/uts/common/fs/zfs/vdev.c | 4 +- .../opensolaris/uts/common/fs/zfs/zfs_acl.c | 2 +- .../opensolaris/uts/common/fs/zfs/zfs_ctldir.c | 50 ++-- .../opensolaris/uts/common/fs/zfs/zfs_fuid.c | 14 +- .../opensolaris/uts/common/fs/zfs/zfs_ioctl.c | 38 +-- .../opensolaris/uts/common/fs/zfs/zfs_replay.c | 6 +- .../opensolaris/uts/common/fs/zfs/zfs_vfsops.c | 14 +- .../opensolaris/uts/common/fs/zfs/zfs_vnops.c | 40 +-- .../opensolaris/uts/common/fs/zfs/zfs_znode.c | 28 +-- sys/cddl/contrib/opensolaris/uts/common/os/callb.c | 4 +- sys/cddl/contrib/opensolaris/uts/common/os/fm.c | 16 +- sys/cddl/contrib/opensolaris/uts/common/sys/ctf.h | 2 +- .../contrib/opensolaris/uts/common/sys/ctf_api.h | 2 +- .../contrib/opensolaris/uts/common/sys/dtrace.h | 22 +- .../opensolaris/uts/common/sys/dtrace_impl.h | 12 +- .../contrib/opensolaris/uts/common/sys/fasttrap.h | 2 +- .../opensolaris/uts/common/sys/fasttrap_impl.h | 6 +- .../contrib/opensolaris/uts/common/sys/isa_defs.h | 6 +- .../contrib/opensolaris/uts/common/sys/procset.h | 2 +- .../contrib/opensolaris/uts/common/sys/sysevent.h | 12 +- .../contrib/opensolaris/uts/common/sys/sysmacros.h | 4 +- .../opensolaris/uts/common/sys/u8_textprep.h | 4 +- .../opensolaris/uts/intel/dtrace/fasttrap_isa.c | 42 ++-- 34 files changed, 403 insertions(+), 403 deletions(-) (limited to 'sys/cddl/contrib/opensolaris/uts') diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index 884defaa7c56..f5a5b6391e5b 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -67,42 +67,42 @@ * on capital-f functions. */ #include -#if !defined(sun) +#ifndef illumos #include #endif #include #include #include #include -#if defined(sun) +#ifdef illumos #include #include #endif #include #include -#if defined(sun) +#ifdef illumos #include #endif #include #include #include #include -#if defined(sun) +#ifdef illumos #include #include #endif #include -#if defined(sun) +#ifdef illumos #include #include #endif #include -#if defined(sun) +#ifdef illumos #include #include #endif #include -#if defined(sun) +#ifdef illumos #include #include #endif @@ -112,7 +112,7 @@ #include "strtolctype.h" /* FreeBSD includes: */ -#if !defined(sun) +#ifndef illumos #include #include #include @@ -184,7 +184,7 @@ hrtime_t dtrace_deadman_interval = NANOSEC; hrtime_t dtrace_deadman_timeout = (hrtime_t)10 * NANOSEC; hrtime_t dtrace_deadman_user = (hrtime_t)30 * NANOSEC; hrtime_t dtrace_unregister_defunct_reap = (hrtime_t)60 * NANOSEC; -#if !defined(sun) +#ifndef illumos int dtrace_memstr_max = 4096; #endif @@ -202,10 +202,10 @@ const char dtrace_zero[256] = { 0 }; /* zero-filled memory */ /* * DTrace Internal Variables */ -#if defined(sun) +#ifdef illumos static dev_info_t *dtrace_devi; /* device info */ #endif -#if defined(sun) +#ifdef illumos static vmem_t *dtrace_arena; /* probe ID arena */ static vmem_t *dtrace_minor; /* minor number arena */ #else @@ -219,7 +219,7 @@ static dtrace_meta_t *dtrace_meta_pid; /* user-land meta provider */ static int dtrace_opens; /* number of opens */ static int dtrace_helpers; /* number of helpers */ static int dtrace_getf; /* number of unpriv getf()s */ -#if defined(sun) +#ifdef illumos static void *dtrace_softstate; /* softstate pointer */ #endif static dtrace_hash_t *dtrace_bymod; /* probes hashed by module */ @@ -239,7 +239,7 @@ static dtrace_enabling_t *dtrace_retained; /* list of retained enablings */ static dtrace_genid_t dtrace_retained_gen; /* current retained enab gen */ static dtrace_dynvar_t dtrace_dynhash_sink; /* end of dynamic hash chains */ static int dtrace_dynvar_failclean; /* dynvars failed to clean */ -#if !defined(sun) +#ifndef illumos static struct mtx dtrace_unr_mtx; MTX_SYSINIT(dtrace_unr_mtx, &dtrace_unr_mtx, "Unique resource identifier", MTX_DEF); int dtrace_in_probe; /* non-zero if executing a probe */ @@ -284,7 +284,7 @@ static kmutex_t dtrace_lock; /* probe state lock */ static kmutex_t dtrace_provider_lock; /* provider state lock */ static kmutex_t dtrace_meta_lock; /* meta-provider state lock */ -#if !defined(sun) +#ifndef illumos /* XXX FreeBSD hacks. */ #define cr_suid cr_svuid #define cr_sgid cr_svgid @@ -309,7 +309,7 @@ SYSCTL_DECL(_debug_dtrace); SYSCTL_DECL(_kern_dtrace); #endif -#if defined(sun) +#ifdef illumos #define curcpu CPU->cpu_id #endif @@ -419,7 +419,7 @@ static kmutex_t dtrace_errlock; * no way for a global variable key signature to match a thread-local key * signature. */ -#if defined(sun) +#ifdef illumos #define DTRACE_TLS_THRKEY(where) { \ uint_t intr = 0; \ uint_t actv = CPU->cpu_intr_actv >> (LOCK_LEVEL + 1); \ @@ -848,7 +848,7 @@ dtrace_canload(uint64_t addr, size_t sz, dtrace_mstate_t *mstate, return (1); } -#if defined(sun) +#ifdef illumos if (p != NULL && p->p_pidp != NULL && DTRACE_INRANGE(addr, sz, &(p->p_pidp->pid_id), sizeof (pid_t))) { return (1); @@ -882,7 +882,7 @@ dtrace_canload(uint64_t addr, size_t sz, dtrace_mstate_t *mstate, return (1); if ((vp = fp->f_vnode) != NULL) { -#if defined(sun) +#ifdef illumos if (DTRACE_INRANGE(addr, sz, &vp->v_path, psz)) return (1); if (vp->v_path != NULL && DTRACE_INRANGE(addr, sz, @@ -894,7 +894,7 @@ dtrace_canload(uint64_t addr, size_t sz, dtrace_mstate_t *mstate, if (DTRACE_INRANGE(addr, sz, &vp->v_op, psz)) return (1); -#if defined(sun) +#ifdef illumos if ((op = vp->v_op) != NULL && DTRACE_INRANGE(addr, sz, &op->vnop_name, psz)) { return (1); @@ -1331,7 +1331,7 @@ dtrace_priv_proc_common_user(dtrace_state_t *state) static int dtrace_priv_proc_common_zone(dtrace_state_t *state) { -#if defined(sun) +#ifdef illumos cred_t *cr, *s_cr = state->dts_cred.dcr_cred; /* @@ -1456,7 +1456,7 @@ dtrace_priv_probe(dtrace_state_t *state, dtrace_mstate_t *mstate, ASSERT(ecb->dte_cond); -#if defined(sun) +#ifdef illumos if (pops->dtps_mode != NULL) { mode = pops->dtps_mode(prov->dtpv_arg, probe->dtpr_id, probe->dtpr_arg); @@ -1515,13 +1515,13 @@ dtrace_priv_probe(dtrace_state_t *state, dtrace_mstate_t *mstate, if (mode & DTRACE_MODE_NOPRIV_DROP) return (0); -#if defined(sun) +#ifdef illumos mstate->dtms_access &= ~DTRACE_ACCESS_PROC; #endif } } -#if defined(sun) +#ifdef illumos /* * If our dte_cond is set to DTRACE_COND_ZONEOWNER and we are not * in our zone, check to see if our mode policy is to restrict rather @@ -3181,7 +3181,7 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_state_t *state, uint64_t v, return (mstate->dtms_arg[ndx]); -#if defined(sun) +#ifdef illumos case DIF_VAR_UREGS: { klwp_t *lwp; @@ -3237,7 +3237,7 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_state_t *state, uint64_t v, } return (mstate->dtms_walltimestamp); -#if defined(sun) +#ifdef illumos case DIF_VAR_IPL: if (!dtrace_priv_kernel(state)) return (0); @@ -3374,7 +3374,7 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_state_t *state, uint64_t v, if (!dtrace_priv_proc(state)) return (0); -#if defined(sun) +#ifdef illumos /* * Note that we are assuming that an unanchored probe is * always due to a high-level interrupt. (And we're assuming @@ -3400,7 +3400,7 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_state_t *state, uint64_t v, if (!dtrace_priv_proc(state)) return (0); -#if defined(sun) +#ifdef illumos /* * See comment in DIF_VAR_PID. */ @@ -3422,7 +3422,7 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_state_t *state, uint64_t v, #endif case DIF_VAR_TID: -#if defined(sun) +#ifdef illumos /* * See comment in DIF_VAR_PID. */ @@ -3443,7 +3443,7 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_state_t *state, uint64_t v, } case DIF_VAR_EXECNAME: -#if defined(sun) +#ifdef illumos if (!dtrace_priv_proc(state)) return (0); @@ -3468,7 +3468,7 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_state_t *state, uint64_t v, #endif case DIF_VAR_ZONENAME: -#if defined(sun) +#ifdef illumos if (!dtrace_priv_proc(state)) return (0); @@ -3495,7 +3495,7 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_state_t *state, uint64_t v, if (!dtrace_priv_proc(state)) return (0); -#if defined(sun) +#ifdef illumos /* * See comment in DIF_VAR_PID. */ @@ -3518,7 +3518,7 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_state_t *state, uint64_t v, if (!dtrace_priv_proc(state)) return (0); -#if defined(sun) +#ifdef illumos /* * See comment in DIF_VAR_PID. */ @@ -3538,7 +3538,7 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_state_t *state, uint64_t v, return ((uint64_t)curthread->t_procp->p_cred->cr_gid); case DIF_VAR_ERRNO: { -#if defined(sun) +#ifdef illumos klwp_t *lwp; if (!dtrace_priv_proc(state)) return (0); @@ -3563,7 +3563,7 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_state_t *state, uint64_t v, return (curthread->td_errno); #endif } -#if !defined(sun) +#ifndef illumos case DIF_VAR_CPU: { return curcpu; } @@ -4047,7 +4047,7 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, volatile uintptr_t *illval = &cpu_core[curcpu].cpuc_dtrace_illval; dtrace_vstate_t *vstate = &state->dts_vstate; -#if defined(sun) +#ifdef illumos union { mutex_impl_t mi; uint64_t mx; @@ -4070,7 +4070,7 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, regs[rd] = (dtrace_gethrtime() * 2416 + 374441) % 1771875; break; -#if defined(sun) +#ifdef illumos case DIF_SUBR_MUTEX_OWNED: if (!dtrace_canload(tupregs[0].dttk_value, sizeof (kmutex_t), mstate, vstate)) { @@ -4158,7 +4158,7 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, regs[rd] = _RW_ISWRITER(&r.ri); break; -#else +#else /* !illumos */ case DIF_SUBR_MUTEX_OWNED: if (!dtrace_canload(tupregs[0].dttk_value, sizeof (struct lock_object), mstate, vstate)) { @@ -4237,7 +4237,7 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, regs[rd] = LOCK_CLASS(l.li)->lc_owner(l.li, &lowner) && lowner != NULL; break; -#endif /* ! defined(sun) */ +#endif /* illumos */ case DIF_SUBR_BCOPY: { /* @@ -4347,7 +4347,7 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, break; } -#if defined(sun) +#ifdef illumos case DIF_SUBR_MSGSIZE: case DIF_SUBR_MSGDSIZE: { uintptr_t baddr = tupregs[0].dttk_value, daddr; @@ -4415,7 +4415,7 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); for (p = curthread->t_procp; p != NULL; p = p->p_parent) { -#if defined(sun) +#ifdef illumos if (p->p_pidp->pid_id == pid) { #else if (p->p_pid == pid) { @@ -4933,7 +4933,7 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, break; } -#if defined(sun) +#ifdef illumos case DIF_SUBR_GETMAJOR: #ifdef _LP64 regs[rd] = (tupregs[0].dttk_value >> NBITSMINOR64) & MAXMAJ64; @@ -5449,7 +5449,7 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, uint64_t size = state->dts_options[DTRACEOPT_STRSIZE]; uintptr_t src = tupregs[0].dttk_value; int i = 0, j = 0; -#if defined(sun) +#ifdef illumos zone_t *z; #endif @@ -5551,7 +5551,7 @@ next: dest[j] = '\0'; -#if defined(sun) +#ifdef illumos if (mstate->dtms_getf != NULL && !(mstate->dtms_access & DTRACE_ACCESS_KERNEL) && (z = state->dts_cred.dcr_cred->cr_zone) != kcred->cr_zone) { @@ -5674,7 +5674,7 @@ next: tryzero = -1; numzero = 1; for (i = 0; i < sizeof (struct in6_addr); i++) { -#if defined(sun) +#ifdef illumos if (ip6._S6_un._S6_u8[i] == 0 && #else if (ip6.__u6_addr.__u6_addr8[i] == 0 && @@ -5685,7 +5685,7 @@ next: } if (tryzero != -1 && -#if defined(sun) +#ifdef illumos (ip6._S6_un._S6_u8[i] != 0 || #else (ip6.__u6_addr.__u6_addr8[i] != 0 || @@ -5701,7 +5701,7 @@ next: numzero = i - i % 2 - tryzero; tryzero = -1; -#if defined(sun) +#ifdef illumos if (ip6._S6_un._S6_u8[i] == 0 && #else if (ip6.__u6_addr.__u6_addr8[i] == 0 && @@ -5722,7 +5722,7 @@ next: i >= DTRACE_V4MAPPED_OFFSET; i--) { ASSERT(end >= base); -#if defined(sun) +#ifdef illumos val = ip6._S6_un._S6_u8[i]; #else val = ip6.__u6_addr.__u6_addr8[i]; @@ -5767,7 +5767,7 @@ next: if (i < 14 && i != firstzero - 2) *end-- = ':'; -#if defined(sun) +#ifdef illumos val = (ip6._S6_un._S6_u8[i] << 8) + ip6._S6_un._S6_u8[i + 1]; #else @@ -5813,7 +5813,7 @@ inetout: regs[rd] = (uintptr_t)end + 1; break; } -#if !defined(sun) +#ifndef illumos case DIF_SUBR_MEMSTR: { char *str = (char *)mstate->dtms_scratch_ptr; uintptr_t mem = tupregs[0].dttk_value; @@ -6713,7 +6713,7 @@ dtrace_action_breakpoint(dtrace_ecb_t *ecb) c[i++] = ')'; c[i] = '\0'; -#if defined(sun) +#ifdef illumos debug_enter(c); #else kdb_enter(KDB_WHY_DTRACE, "breakpoint action"); @@ -6760,7 +6760,7 @@ dtrace_action_raise(uint64_t sig) return; } -#if defined(sun) +#ifdef illumos /* * raise() has a queue depth of 1 -- we ignore all subsequent * invocations of the raise() action. @@ -6784,7 +6784,7 @@ dtrace_action_stop(void) if (dtrace_destructive_disallow) return; -#if defined(sun) +#ifdef illumos if (!curthread->t_dtrace_stop) { curthread->t_dtrace_stop = 1; curthread->t_sig_check = 1; @@ -6803,7 +6803,7 @@ dtrace_action_chill(dtrace_mstate_t *mstate, hrtime_t val) { hrtime_t now; volatile uint16_t *flags; -#if defined(sun) +#ifdef illumos cpu_t *cpu = CPU; #else cpu_t *cpu = &solaris_cpu[curcpu]; @@ -7041,7 +7041,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1, if (panicstr != NULL) return; -#if defined(sun) +#ifdef illumos /* * Kick out immediately if this CPU is still being born (in which case * curthread will be set to -1) or the current thread can't allow @@ -7066,7 +7066,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1, return; } -#if defined(sun) +#ifdef illumos if (panic_quiesce) { #else if (panicstr != NULL) { @@ -7172,7 +7172,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1, probe->dtpr_id, probe->dtpr_arg) == 0) continue; -#if defined(sun) +#ifdef illumos /* * This is more subtle than it looks. We have to be * absolutely certain that CRED() isn't going to @@ -7597,7 +7597,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1, case DTRACEACT_USYM: case DTRACEACT_UMOD: case DTRACEACT_UADDR: { -#if defined(sun) +#ifdef illumos struct pid *pid = curthread->t_procp->p_pidp; #endif @@ -7605,7 +7605,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1, continue; DTRACE_STORE(uint64_t, tomax, -#if defined(sun) +#ifdef illumos valoffs, (uint64_t)pid->pid_id); #else valoffs, (uint64_t) curproc->p_pid); @@ -8030,7 +8030,7 @@ dtrace_cred2priv(cred_t *cr, uint32_t *privp, uid_t *uidp, zoneid_t *zoneidp) { uint32_t priv; -#if defined(sun) +#ifdef illumos if (cr == NULL || PRIV_POLICY_ONLY(cr, PRIV_ALL, B_FALSE)) { /* * For DTRACE_PRIV_ALL, the uid and zoneid don't matter. @@ -8624,7 +8624,7 @@ dtrace_unregister(dtrace_provider_id_t id) * already held. */ ASSERT(old == dtrace_provider); -#if defined(sun) +#ifdef illumos ASSERT(dtrace_devi != NULL); #endif ASSERT(MUTEX_HELD(&dtrace_provider_lock)); @@ -8639,7 +8639,7 @@ dtrace_unregister(dtrace_provider_id_t id) } } else { mutex_enter(&dtrace_provider_lock); -#if defined(sun) +#ifdef illumos mutex_enter(&mod_lock); #endif mutex_enter(&dtrace_lock); @@ -8655,7 +8655,7 @@ dtrace_unregister(dtrace_provider_id_t id) dtrace_anon.dta_state->dts_necbs > 0))) { if (!self) { mutex_exit(&dtrace_lock); -#if defined(sun) +#ifdef illumos mutex_exit(&mod_lock); #endif mutex_exit(&dtrace_provider_lock); @@ -8691,7 +8691,7 @@ dtrace_unregister(dtrace_provider_id_t id) if (!self) { mutex_exit(&dtrace_lock); -#if defined(sun) +#ifdef illumos mutex_exit(&mod_lock); #endif mutex_exit(&dtrace_provider_lock); @@ -8747,7 +8747,7 @@ dtrace_unregister(dtrace_provider_id_t id) kmem_free(probe->dtpr_mod, strlen(probe->dtpr_mod) + 1); kmem_free(probe->dtpr_func, strlen(probe->dtpr_func) + 1); kmem_free(probe->dtpr_name, strlen(probe->dtpr_name) + 1); -#if defined(sun) +#ifdef illumos vmem_free(dtrace_arena, (void *)(uintptr_t)(probe->dtpr_id), 1); #else free_unr(dtrace_arena, probe->dtpr_id); @@ -8756,7 +8756,7 @@ dtrace_unregister(dtrace_provider_id_t id) } if ((prev = dtrace_provider) == old) { -#if defined(sun) +#ifdef illumos ASSERT(self || dtrace_devi == NULL); ASSERT(old->dtpv_next == NULL || dtrace_devi == NULL); #endif @@ -8775,7 +8775,7 @@ dtrace_unregister(dtrace_provider_id_t id) if (!self) { mutex_exit(&dtrace_lock); -#if defined(sun) +#ifdef illumos mutex_exit(&mod_lock); #endif mutex_exit(&dtrace_provider_lock); @@ -8868,7 +8868,7 @@ dtrace_condense(dtrace_provider_id_t id) kmem_free(probe->dtpr_func, strlen(probe->dtpr_func) + 1); kmem_free(probe->dtpr_name, strlen(probe->dtpr_name) + 1); kmem_free(probe, sizeof (dtrace_probe_t)); -#if defined(sun) +#ifdef illumos vmem_free(dtrace_arena, (void *)((uintptr_t)i + 1), 1); #else free_unr(dtrace_arena, i + 1); @@ -8908,7 +8908,7 @@ dtrace_probe_create(dtrace_provider_id_t prov, const char *mod, mutex_enter(&dtrace_lock); } -#if defined(sun) +#ifdef illumos id = (dtrace_id_t)(uintptr_t)vmem_alloc(dtrace_arena, 1, VM_BESTFIT | VM_SLEEP); #else @@ -9079,7 +9079,7 @@ dtrace_probe_description(const dtrace_probe_t *prp, dtrace_probedesc_t *pdp) static void dtrace_probe_provide(dtrace_probedesc_t *desc, dtrace_provider_t *prv) { -#if defined(sun) +#ifdef illumos modctl_t *ctl; #endif int all = 0; @@ -9097,7 +9097,7 @@ dtrace_probe_provide(dtrace_probedesc_t *desc, dtrace_provider_t *prv) */ prv->dtpv_pops.dtps_provide(prv->dtpv_arg, desc); -#if defined(sun) +#ifdef illumos /* * Now call the per-module provide operation. We will grab * mod_lock to prevent the list from being modified. Note @@ -9120,7 +9120,7 @@ dtrace_probe_provide(dtrace_probedesc_t *desc, dtrace_provider_t *prv) } while (all && (prv = prv->dtpv_next) != NULL); } -#if defined(sun) +#ifdef illumos /* * Iterate over each probe, and call the Framework-to-Provider API function * denoted by offs. @@ -10078,7 +10078,7 @@ dtrace_difo_validate_helper(dtrace_difo_t *dp) subr == DIF_SUBR_NTOHL || subr == DIF_SUBR_NTOHLL || subr == DIF_SUBR_MEMREF || -#if !defined(sun) +#ifndef illumos subr == DIF_SUBR_MEMSTR || #endif subr == DIF_SUBR_TYPEREF) @@ -10716,7 +10716,7 @@ dtrace_actdesc_create(dtrace_actkind_t kind, uint32_t ntuple, { dtrace_actdesc_t *act; -#if defined(sun) +#ifdef illumos ASSERT(!DTRACEACT_ISPRINTFLIKE(kind) || (arg != NULL && arg >= KERNELBASE) || (arg == NULL && kind == DTRACEACT_PRINTA)); #endif @@ -10755,7 +10755,7 @@ dtrace_actdesc_release(dtrace_actdesc_t *act, dtrace_vstate_t *vstate) if (DTRACEACT_ISPRINTFLIKE(kind)) { char *str = (char *)(uintptr_t)act->dtad_arg; -#if defined(sun) +#ifdef illumos ASSERT((str != NULL && (uintptr_t)str >= KERNELBASE) || (str == NULL && act->dtad_kind == DTRACEACT_PRINTA)); #endif @@ -11114,7 +11114,7 @@ success: /* * We need to allocate an id for this aggregation. */ -#if defined(sun) +#ifdef illumos aggid = (dtrace_aggid_t)(uintptr_t)vmem_alloc(state->dts_aggid_arena, 1, VM_BESTFIT | VM_SLEEP); #else @@ -11168,7 +11168,7 @@ dtrace_ecb_aggregation_destroy(dtrace_ecb_t *ecb, dtrace_action_t *act) dtrace_aggid_t aggid = agg->dtag_id; ASSERT(DTRACEACT_ISAGG(act->dta_kind)); -#if defined(sun) +#ifdef illumos vmem_free(state->dts_aggid_arena, (void *)(uintptr_t)aggid, 1); #else free_unr(state->dts_aggid_arena, aggid); @@ -11237,7 +11237,7 @@ dtrace_ecb_action_add(dtrace_ecb_t *ecb, dtrace_actdesc_t *desc) format = 0; } else { ASSERT(arg != 0); -#if defined(sun) +#ifdef illumos ASSERT(arg > KERNELBASE); #endif format = dtrace_format_add(state, @@ -11789,13 +11789,13 @@ static int dtrace_buffer_alloc(dtrace_buffer_t *bufs, size_t size, int flags, processorid_t cpu, int *factor) { -#if defined(sun) +#ifdef illumos cpu_t *cp; #endif dtrace_buffer_t *buf; int allocated = 0, desired = 0; -#if defined(sun) +#ifdef illumos ASSERT(MUTEX_HELD(&cpu_lock)); ASSERT(MUTEX_HELD(&dtrace_lock)); @@ -12666,7 +12666,7 @@ dtrace_enabling_matchall(void) * block pending our completion. */ for (enab = dtrace_retained; enab != NULL; enab = enab->dten_next) { -#if defined(sun) +#ifdef illumos cred_t *cr = enab->dten_vstate->dtvs_state->dts_cred.dcr_cred; if (INGLOBALZONE(curproc) || @@ -12971,7 +12971,7 @@ dtrace_dof_copyin(uintptr_t uarg, int *errp) return (dof); } -#if !defined(sun) +#ifndef illumos static __inline uchar_t dtrace_dof_char(char c) { switch (c) { @@ -13014,7 +13014,7 @@ dtrace_dof_property(const char *name) unsigned int len, i; dof_hdr_t *dof; -#if defined(sun) +#ifdef illumos /* * Unfortunately, array of values in .conf files are always (and * only) interpreted to be integer arrays. We must read our DOF @@ -13970,7 +13970,7 @@ dtrace_dstate_init(dtrace_dstate_t *dstate, size_t size) maxper = (limit - (uintptr_t)start) / NCPU; maxper = (maxper / dstate->dtds_chunksize) * dstate->dtds_chunksize; -#if !defined(sun) +#ifndef illumos CPU_FOREACH(i) { #else for (i = 0; i < NCPU; i++) { @@ -14050,7 +14050,7 @@ dtrace_vstate_fini(dtrace_vstate_t *vstate) } } -#if defined(sun) +#ifdef illumos static void dtrace_state_clean(dtrace_state_t *state) { @@ -14087,7 +14087,7 @@ dtrace_state_deadman(dtrace_state_t *state) dtrace_membar_producer(); state->dts_alive = now; } -#else +#else /* !illumos */ static void dtrace_state_clean(void *arg) { @@ -14136,16 +14136,16 @@ dtrace_state_deadman(void *arg) callout_reset(&state->dts_deadman, hz * dtrace_deadman_interval / NANOSEC, dtrace_state_deadman, state); } -#endif +#endif /* illumos */ static dtrace_state_t * -#if defined(sun) +#ifdef illumos dtrace_state_create(dev_t *devp, cred_t *cr) #else dtrace_state_create(struct cdev *dev) #endif { -#if defined(sun) +#ifdef illumos minor_t minor; major_t major; #else @@ -14160,7 +14160,7 @@ dtrace_state_create(struct cdev *dev) ASSERT(MUTEX_HELD(&dtrace_lock)); ASSERT(MUTEX_HELD(&cpu_lock)); -#if defined(sun) +#ifdef illumos minor = (minor_t)(uintptr_t)vmem_alloc(dtrace_minor, 1, VM_BESTFIT | VM_SLEEP); @@ -14183,7 +14183,7 @@ dtrace_state_create(struct cdev *dev) state->dts_epid = DTRACE_EPIDNONE + 1; (void) snprintf(c, sizeof (c), "dtrace_aggid_%d", m); -#if defined(sun) +#ifdef illumos state->dts_aggid_arena = vmem_create(c, (void *)1, UINT32_MAX, 1, NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER); @@ -14211,7 +14211,7 @@ dtrace_state_create(struct cdev *dev) state->dts_buffer = kmem_zalloc(bufsize, KM_SLEEP); state->dts_aggbuffer = kmem_zalloc(bufsize, KM_SLEEP); -#if defined(sun) +#ifdef illumos state->dts_cleaner = CYCLIC_NONE; state->dts_deadman = CYCLIC_NONE; #else @@ -14301,7 +14301,7 @@ dtrace_state_create(struct cdev *dev) * we can do destructive things to processes which * have altered credentials. */ -#if defined(sun) +#ifdef illumos if (priv_isequalset(priv_getset(cr, PRIV_EFFECTIVE), cr->cr_zone->zone_privset)) { state->dts_cred.dcr_action |= @@ -14343,7 +14343,7 @@ dtrace_state_create(struct cdev *dev) state->dts_cred.dcr_action |= DTRACE_CRA_PROC_DESTRUCTIVE_ALLZONE; -#if defined(sun) +#ifdef illumos /* * If we have all privs in whatever zone this is, * we can do destructive things to processes which @@ -14502,7 +14502,7 @@ dtrace_state_go(dtrace_state_t *state, processorid_t *cpu) dtrace_optval_t *opt = state->dts_options, sz, nspec; dtrace_speculation_t *spec; dtrace_buffer_t *buf; -#if defined(sun) +#ifdef illumos cyc_handler_t hdlr; cyc_time_t when; #endif @@ -14686,7 +14686,7 @@ dtrace_state_go(dtrace_state_t *state, processorid_t *cpu) opt[DTRACEOPT_CLEANRATE] = dtrace_cleanrate_max; state->dts_alive = state->dts_laststatus = dtrace_gethrtime(); -#if defined(sun) +#ifdef illumos hdlr.cyh_func = (cyc_func_t)dtrace_state_clean; hdlr.cyh_arg = state; hdlr.cyh_level = CY_LOW_LEVEL; @@ -14713,7 +14713,7 @@ dtrace_state_go(dtrace_state_t *state, processorid_t *cpu) state->dts_activity = DTRACE_ACTIVITY_WARMUP; -#if defined(sun) +#ifdef illumos if (state->dts_getf != 0 && !(state->dts_cred.dcr_visible & DTRACE_CRV_KERNEL)) { /* @@ -14847,7 +14847,7 @@ dtrace_state_stop(dtrace_state_t *state, processorid_t *cpu) state->dts_activity = DTRACE_ACTIVITY_STOPPED; dtrace_sync(); -#if defined(sun) +#ifdef illumos if (state->dts_getf != 0 && !(state->dts_cred.dcr_visible & DTRACE_CRV_KERNEL)) { /* @@ -14930,7 +14930,7 @@ dtrace_state_destroy(dtrace_state_t *state) { dtrace_ecb_t *ecb; dtrace_vstate_t *vstate = &state->dts_vstate; -#if defined(sun) +#ifdef illumos minor_t minor = getminor(state->dts_dev); #endif int i, bufsize = NCPU * sizeof (dtrace_buffer_t); @@ -15008,7 +15008,7 @@ dtrace_state_destroy(dtrace_state_t *state) for (i = 0; i < nspec; i++) dtrace_buffer_free(spec[i].dtsp_buffer); -#if defined(sun) +#ifdef illumos if (state->dts_cleaner != CYCLIC_NONE) cyclic_remove(state->dts_cleaner); @@ -15048,14 +15048,14 @@ dtrace_state_destroy(dtrace_state_t *state) dtrace_format_destroy(state); if (state->dts_aggid_arena != NULL) { -#if defined(sun) +#ifdef illumos vmem_destroy(state->dts_aggid_arena); #else delete_unrhdr(state->dts_aggid_arena); #endif state->dts_aggid_arena = NULL; } -#if defined(sun) +#ifdef illumos ddi_soft_state_free(dtrace_softstate, minor); vmem_free(dtrace_minor, (void *)(uintptr_t)minor, 1); #endif @@ -15107,7 +15107,7 @@ dtrace_anon_property(void) break; } -#if defined(sun) +#ifdef illumos /* * We want to create anonymous state, so we need to transition * the kernel debugger to indicate that DTrace is active. If @@ -15126,7 +15126,7 @@ dtrace_anon_property(void) * If we haven't allocated an anonymous state, we'll do so now. */ if ((state = dtrace_anon.dta_state) == NULL) { -#if defined(sun) +#ifdef illumos state = dtrace_state_create(NULL, NULL); #else state = dtrace_state_create(NULL); @@ -16015,7 +16015,7 @@ dtrace_helpers_create(proc_t *p) return (help); } -#if defined(sun) +#ifdef illumos static #endif void @@ -16023,7 +16023,7 @@ dtrace_helpers_destroy(proc_t *p) { dtrace_helpers_t *help; dtrace_vstate_t *vstate; -#if defined(sun) +#ifdef illumos proc_t *p = curproc; #endif int i; @@ -16112,7 +16112,7 @@ dtrace_helpers_destroy(proc_t *p) mutex_exit(&dtrace_lock); } -#if defined(sun) +#ifdef illumos static #endif void @@ -16206,11 +16206,11 @@ dtrace_module_loaded(modctl_t *ctl) dtrace_provider_t *prv; mutex_enter(&dtrace_provider_lock); -#if defined(sun) +#ifdef illumos mutex_enter(&mod_lock); #endif -#if defined(sun) +#ifdef illumos ASSERT(ctl->mod_busy); #endif @@ -16221,7 +16221,7 @@ dtrace_module_loaded(modctl_t *ctl) for (prv = dtrace_provider; prv != NULL; prv = prv->dtpv_next) prv->dtpv_pops.dtps_provide_module(prv->dtpv_arg, ctl); -#if defined(sun) +#ifdef illumos mutex_exit(&mod_lock); #endif mutex_exit(&dtrace_provider_lock); @@ -16260,7 +16260,7 @@ dtrace_module_loaded(modctl_t *ctl) } static void -#if defined(sun) +#ifdef illumos dtrace_module_unloaded(modctl_t *ctl) #else dtrace_module_unloaded(modctl_t *ctl, int *error) @@ -16268,12 +16268,12 @@ dtrace_module_unloaded(modctl_t *ctl, int *error) { dtrace_probe_t template, *probe, *first, *next; dtrace_provider_t *prov; -#if !defined(sun) +#ifndef illumos char modname[DTRACE_MODNAMELEN]; size_t len; #endif -#if defined(sun) +#ifdef illumos template.dtpr_mod = ctl->mod_modname; #else /* Handle the fact that ctl->filename may end in ".ko". */ @@ -16285,12 +16285,12 @@ dtrace_module_unloaded(modctl_t *ctl, int *error) #endif mutex_enter(&dtrace_provider_lock); -#if defined(sun) +#ifdef illumos mutex_enter(&mod_lock); #endif mutex_enter(&dtrace_lock); -#if !defined(sun) +#ifndef illumos if (ctl->nenabled > 0) { /* Don't allow unloads if a probe is enabled. */ mutex_exit(&dtrace_provider_lock); @@ -16308,7 +16308,7 @@ dtrace_module_unloaded(modctl_t *ctl, int *error) * we don't have any work to do. */ mutex_exit(&dtrace_provider_lock); -#if defined(sun) +#ifdef illumos mutex_exit(&mod_lock); #endif mutex_exit(&dtrace_lock); @@ -16319,7 +16319,7 @@ dtrace_module_unloaded(modctl_t *ctl, int *error) probe != NULL; probe = probe->dtpr_nextmod) { if (probe->dtpr_ecb != NULL) { mutex_exit(&dtrace_provider_lock); -#if defined(sun) +#ifdef illumos mutex_exit(&mod_lock); #endif mutex_exit(&dtrace_lock); @@ -16335,7 +16335,7 @@ dtrace_module_unloaded(modctl_t *ctl, int *error) * probe, either. */ if (dtrace_err_verbose) { -#if defined(sun) +#ifdef illumos cmn_err(CE_WARN, "unloaded module '%s' had " "enabled probes", ctl->mod_modname); #else @@ -16384,7 +16384,7 @@ dtrace_module_unloaded(modctl_t *ctl, int *error) kmem_free(probe->dtpr_mod, strlen(probe->dtpr_mod) + 1); kmem_free(probe->dtpr_func, strlen(probe->dtpr_func) + 1); kmem_free(probe->dtpr_name, strlen(probe->dtpr_name) + 1); -#if defined(sun) +#ifdef illumos vmem_free(dtrace_arena, (void *)(uintptr_t)probe->dtpr_id, 1); #else free_unr(dtrace_arena, probe->dtpr_id); @@ -16393,13 +16393,13 @@ dtrace_module_unloaded(modctl_t *ctl, int *error) } mutex_exit(&dtrace_lock); -#if defined(sun) +#ifdef illumos mutex_exit(&mod_lock); #endif mutex_exit(&dtrace_provider_lock); } -#if !defined(sun) +#ifndef illumos static void dtrace_kld_load(void *arg __unused, linker_file_t lf) { @@ -16418,7 +16418,7 @@ dtrace_kld_unload_try(void *arg __unused, linker_file_t lf, int *error) } #endif -#if defined(sun) +#ifdef illumos static void dtrace_suspend(void) { @@ -16491,7 +16491,7 @@ dtrace_cpu_setup(cpu_setup_t what, processorid_t cpu) return (0); } -#if defined(sun) +#ifdef illumos static void dtrace_cpu_setup_initial(processorid_t cpu) { @@ -16539,7 +16539,7 @@ dtrace_toxrange_add(uintptr_t base, uintptr_t limit) static void dtrace_getf_barrier() { -#if defined(sun) +#ifdef illumos /* * When we have unprivileged (that is, non-DTRACE_CRV_KERNEL) enablings * that contain calls to getf(), this routine will be called on every @@ -16558,7 +16558,7 @@ dtrace_getf_barrier() /* * DTrace Driver Cookbook Functions */ -#if defined(sun) +#ifdef illumos /*ARGSUSED*/ static int dtrace_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) @@ -16725,15 +16725,15 @@ dtrace_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) return (DDI_SUCCESS); } -#endif +#endif /* illumos */ -#if !defined(sun) +#ifndef illumos static void dtrace_dtr(void *); #endif /*ARGSUSED*/ static int -#if defined(sun) +#ifdef illumos dtrace_open(dev_t *devp, int flag, int otyp, cred_t *cred_p) #else dtrace_open(struct cdev *dev, int oflags, int devtype, struct thread *td) @@ -16744,7 +16744,7 @@ dtrace_open(struct cdev *dev, int oflags, int devtype, struct thread *td) uid_t uid; zoneid_t zoneid; -#if defined(sun) +#ifdef illumos if (getminor(*devp) == DTRACEMNRN_HELPER) return (0); @@ -16781,7 +16781,7 @@ dtrace_open(struct cdev *dev, int oflags, int devtype, struct thread *td) dtrace_opens++; dtrace_membar_producer(); -#if defined(sun) +#ifdef illumos /* * If the kernel debugger is active (that is, if the kernel debugger * modified text in some way), we won't allow the open. @@ -16802,7 +16802,7 @@ dtrace_open(struct cdev *dev, int oflags, int devtype, struct thread *td) mutex_exit(&cpu_lock); if (state == NULL) { -#if defined(sun) +#ifdef illumos if (--dtrace_opens == 0 && dtrace_anon.dta_enabling == NULL) (void) kdi_dtrace_set(KDI_DTSET_DTRACE_DEACTIVATE); #else @@ -16818,7 +16818,7 @@ dtrace_open(struct cdev *dev, int oflags, int devtype, struct thread *td) } /*ARGSUSED*/ -#if defined(sun) +#ifdef illumos static int dtrace_close(dev_t dev, int flag, int otyp, cred_t *cred_p) #else @@ -16826,7 +16826,7 @@ static void dtrace_dtr(void *data) #endif { -#if defined(sun) +#ifdef illumos minor_t minor = getminor(dev); dtrace_state_t *state; @@ -16852,13 +16852,13 @@ dtrace_dtr(void *data) dtrace_state_destroy(state); -#if !defined(sun) +#ifndef illumos kmem_free(state, 0); #endif } ASSERT(dtrace_opens > 0); -#if defined(sun) +#ifdef illumos /* * Only relinquish control of the kernel debugger interface when there * are no consumers and no anonymous enablings. @@ -16872,12 +16872,12 @@ dtrace_dtr(void *data) mutex_exit(&dtrace_lock); mutex_exit(&cpu_lock); -#if defined(sun) +#ifdef illumos return (0); #endif } -#if defined(sun) +#ifdef illumos /*ARGSUSED*/ static int dtrace_ioctl_helper(int cmd, intptr_t arg, int *rv) @@ -17821,7 +17821,7 @@ dtrace_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) } #endif -#if defined(sun) +#ifdef illumos /*ARGSUSED*/ static int dtrace_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result) @@ -17844,7 +17844,7 @@ dtrace_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result) } #endif -#if defined(sun) +#ifdef illumos static struct cb_ops dtrace_cb_ops = { dtrace_open, /* open */ dtrace_close, /* close */ diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c index f39b6ad118af..be2b27db4623 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c @@ -38,13 +38,13 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #endif #include #include #include -#if defined(sun) +#ifdef illumos #include #endif #include @@ -55,12 +55,12 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #endif #include #include -#if !defined(sun) +#ifndef illumos #include #include #include @@ -212,7 +212,7 @@ static void fasttrap_provider_free(fasttrap_provider_t *); static fasttrap_proc_t *fasttrap_proc_lookup(pid_t); static void fasttrap_proc_release(fasttrap_proc_t *); -#if !defined(sun) +#ifndef illumos static void fasttrap_thread_dtor(void *, struct thread *); #endif @@ -221,7 +221,7 @@ static void fasttrap_thread_dtor(void *, struct thread *); #define FASTTRAP_PROCS_INDEX(pid) ((pid) & fasttrap_procs.fth_mask) -#if !defined(sun) +#ifndef illumos static kmutex_t fasttrap_cpuc_pid_lock[MAXCPU]; static eventhandler_tag fasttrap_thread_dtor_tag; #endif @@ -274,7 +274,7 @@ fasttrap_hash_str(const char *p) void fasttrap_sigtrap(proc_t *p, kthread_t *t, uintptr_t pc) { -#if defined(sun) +#ifdef illumos sigqueue_t *sqp = kmem_zalloc(sizeof (sigqueue_t), KM_SLEEP); sqp->sq_info.si_signo = SIGTRAP; @@ -300,7 +300,7 @@ fasttrap_sigtrap(proc_t *p, kthread_t *t, uintptr_t pc) #endif } -#if !defined(sun) +#ifndef illumos /* * Obtain a chunk of scratch space in the address space of the target process. */ @@ -572,20 +572,20 @@ fasttrap_pid_cleanup(void) static void fasttrap_fork(proc_t *p, proc_t *cp) { -#if !defined(sun) +#ifndef illumos fasttrap_scrblock_t *scrblk; fasttrap_proc_t *fprc = NULL; #endif pid_t ppid = p->p_pid; int i; -#if defined(sun) +#ifdef illumos ASSERT(curproc == p); ASSERT(p->p_proc_flag & P_PR_LOCK); #else PROC_LOCK_ASSERT(p, MA_OWNED); #endif -#if defined(sun) +#ifdef illumos ASSERT(p->p_dtrace_count > 0); #else if (p->p_dtrace_helpers) { @@ -624,7 +624,7 @@ fasttrap_fork(proc_t *p, proc_t *cp) * We don't have to worry about the child process disappearing * because we're in fork(). */ -#if defined(sun) +#ifdef illumos mtx_lock_spin(&cp->p_slock); sprlock_proc(cp); mtx_unlock_spin(&cp->p_slock); @@ -661,14 +661,14 @@ fasttrap_fork(proc_t *p, proc_t *cp) * mid-fork. */ ASSERT(tp->ftt_proc->ftpc_acount != 0); -#if !defined(sun) +#ifndef illumos fprc = tp->ftt_proc; #endif } } mutex_exit(&bucket->ftb_mtx); -#if !defined(sun) +#ifndef illumos /* * Unmap any scratch space inherited from the parent's address * space. @@ -685,7 +685,7 @@ fasttrap_fork(proc_t *p, proc_t *cp) #endif } -#if defined(sun) +#ifdef illumos mutex_enter(&cp->p_lock); sprunlock(cp); #else @@ -703,11 +703,11 @@ fasttrap_fork(proc_t *p, proc_t *cp) static void fasttrap_exec_exit(proc_t *p) { -#if !defined(sun) +#ifndef illumos struct thread *td; #endif -#if defined(sun) +#ifdef illumos ASSERT(p == curproc); #else PROC_LOCK_ASSERT(p, MA_OWNED); @@ -727,7 +727,7 @@ fasttrap_exec_exit(proc_t *p) * static probes are handled by the meta-provider remove entry point. */ fasttrap_provider_retire(p->p_pid, FASTTRAP_PID_NAME, 0); -#if !defined(sun) +#ifndef illumos if (p->p_dtrace_helpers) dtrace_helpers_destroy(p); PROC_LOCK(p); @@ -762,7 +762,7 @@ fasttrap_tracepoint_enable(proc_t *p, fasttrap_probe_t *probe, uint_t index) ASSERT(probe->ftp_tps[index].fit_tp->ftt_pid == pid); -#if defined(sun) +#ifdef illumos ASSERT(!(p->p_flag & SVFORK)); #endif @@ -870,7 +870,7 @@ again: * Increment the count of the number of tracepoints active in * the victim process. */ -#if defined(sun) +#ifdef illumos ASSERT(p->p_proc_flag & P_PR_LOCK); #endif p->p_dtrace_count++; @@ -1062,7 +1062,7 @@ fasttrap_tracepoint_disable(proc_t *p, fasttrap_probe_t *probe, uint_t index) * Decrement the count of the number of tracepoints active * in the victim process. */ -#if defined(sun) +#ifdef illumos ASSERT(p->p_proc_flag & P_PR_LOCK); #endif p->p_dtrace_count--; @@ -1115,7 +1115,7 @@ fasttrap_enable_callbacks(void) static void fasttrap_disable_callbacks(void) { -#if defined(sun) +#ifdef illumos ASSERT(MUTEX_HELD(&cpu_lock)); #endif @@ -1124,7 +1124,7 @@ fasttrap_disable_callbacks(void) ASSERT(fasttrap_pid_count > 0); fasttrap_pid_count--; if (fasttrap_pid_count == 0) { -#if defined(sun) +#ifdef illumos cpu_t *cur, *cpu = CPU; for (cur = cpu->cpu_next_onln; cur != cpu; @@ -1134,7 +1134,7 @@ fasttrap_disable_callbacks(void) #endif dtrace_pid_probe_ptr = NULL; dtrace_return_probe_ptr = NULL; -#if defined(sun) +#ifdef illumos for (cur = cpu->cpu_next_onln; cur != cpu; cur = cur->cpu_next_onln) { rw_exit(&cur->cpu_ft_lock); @@ -1155,7 +1155,7 @@ fasttrap_pid_enable(void *arg, dtrace_id_t id, void *parg) ASSERT(probe != NULL); ASSERT(!probe->ftp_enabled); ASSERT(id == probe->ftp_id); -#if defined(sun) +#ifdef illumos ASSERT(MUTEX_HELD(&cpu_lock)); #endif @@ -1182,7 +1182,7 @@ fasttrap_pid_enable(void *arg, dtrace_id_t id, void *parg) * a fork in which the traced process is being born and we're copying * USDT probes. Otherwise, the process is gone so bail. */ -#if defined(sun) +#ifdef illumos if ((p = sprlock(probe->ftp_pid)) == NULL) { if ((curproc->p_flag & SFORKING) == 0) return; @@ -1250,7 +1250,7 @@ fasttrap_pid_enable(void *arg, dtrace_id_t id, void *parg) i--; } -#if defined(sun) +#ifdef illumos mutex_enter(&p->p_lock); sprunlock(p); #else @@ -1265,7 +1265,7 @@ fasttrap_pid_enable(void *arg, dtrace_id_t id, void *parg) return; } } -#if defined(sun) +#ifdef illumos mutex_enter(&p->p_lock); sprunlock(p); #else @@ -1344,7 +1344,7 @@ fasttrap_pid_disable(void *arg, dtrace_id_t id, void *parg) probe->ftp_enabled = 0; -#if defined(sun) +#ifdef illumos ASSERT(MUTEX_HELD(&cpu_lock)); #endif fasttrap_disable_callbacks(); @@ -1485,7 +1485,7 @@ fasttrap_proc_lookup(pid_t pid) new_fprc->ftpc_pid = pid; new_fprc->ftpc_rcount = 1; new_fprc->ftpc_acount = 1; -#if !defined(sun) +#ifndef illumos mutex_init(&new_fprc->ftpc_mtx, "fasttrap proc mtx", MUTEX_DEFAULT, NULL); #endif @@ -1525,7 +1525,7 @@ fasttrap_proc_release(fasttrap_proc_t *proc) fasttrap_bucket_t *bucket; fasttrap_proc_t *fprc, **fprcp; pid_t pid = proc->ftpc_pid; -#if !defined(sun) +#ifndef illumos fasttrap_scrblock_t *scrblk, *scrblktmp; fasttrap_scrspace_t *scrspc, *scrspctmp; struct proc *p; @@ -1542,7 +1542,7 @@ fasttrap_proc_release(fasttrap_proc_t *proc) return; } -#if !defined(sun) +#ifndef illumos /* * Free all structures used to manage per-thread scratch space. */ @@ -1664,7 +1664,7 @@ fasttrap_provider_lookup(pid_t pid, const char *name, new_fp = kmem_zalloc(sizeof (fasttrap_provider_t), KM_SLEEP); new_fp->ftp_pid = pid; new_fp->ftp_proc = fasttrap_proc_lookup(pid); -#if !defined(sun) +#ifndef illumos mutex_init(&new_fp->ftp_mtx, "provider mtx", MUTEX_DEFAULT, NULL); mutex_init(&new_fp->ftp_cmtx, "lock on creating", MUTEX_DEFAULT, NULL); #endif @@ -1745,7 +1745,7 @@ fasttrap_provider_free(fasttrap_provider_t *provider) fasttrap_proc_release(provider->ftp_proc); -#if !defined(sun) +#ifndef illumos mutex_destroy(&provider->ftp_mtx); mutex_destroy(&provider->ftp_cmtx); #endif @@ -1763,7 +1763,7 @@ fasttrap_provider_free(fasttrap_provider_t *provider) } p->p_dtrace_probes--; -#if !defined(sun) +#ifndef illumos PROC_UNLOCK(p); #endif } @@ -2304,7 +2304,7 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag, proc_t *p; pid_t pid = probe->ftps_pid; -#if defined(sun) +#ifdef illumos mutex_enter(&pidlock); #endif /* @@ -2317,12 +2317,12 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag, fill_kinfo_proc(p, &kp); sx_sunlock(&proctree_lock); if (p == NULL || kp.ki_stat == SIDL) { -#if defined(sun) +#ifdef illumos mutex_exit(&pidlock); #endif return (ESRCH); } -#if defined(sun) +#ifdef illumos mutex_enter(&p->p_lock); mutex_exit(&pidlock); #else @@ -2332,7 +2332,7 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag, #ifdef notyet if ((ret = priv_proc_cred_perm(cr, p, NULL, VREAD | VWRITE)) != 0) { -#if defined(sun) +#ifdef illumos mutex_exit(&p->p_lock); #else PROC_UNLOCK(p); @@ -2340,7 +2340,7 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag, return (ret); } #endif /* notyet */ -#if defined(sun) +#ifdef illumos mutex_exit(&p->p_lock); #else PROC_UNLOCK(p); @@ -2358,11 +2358,11 @@ err: fasttrap_instr_query_t instr; fasttrap_tracepoint_t *tp; uint_t index; -#if defined(sun) +#ifdef illumos int ret; #endif -#if defined(sun) +#ifdef illumos if (copyin((void *)arg, &instr, sizeof (instr)) != 0) return (EFAULT); #endif @@ -2372,7 +2372,7 @@ err: proc_t *p; pid_t pid = instr.ftiq_pid; -#if defined(sun) +#ifdef illumos mutex_enter(&pidlock); #endif /* @@ -2385,12 +2385,12 @@ err: fill_kinfo_proc(p, &kp); sx_sunlock(&proctree_lock); if (p == NULL || kp.ki_stat == SIDL) { -#if defined(sun) +#ifdef illumos mutex_exit(&pidlock); #endif return (ESRCH); } -#if defined(sun) +#ifdef illumos mutex_enter(&p->p_lock); mutex_exit(&pidlock); #else @@ -2400,7 +2400,7 @@ err: #ifdef notyet if ((ret = priv_proc_cred_perm(cr, p, NULL, VREAD)) != 0) { -#if defined(sun) +#ifdef illumos mutex_exit(&p->p_lock); #else PROC_UNLOCK(p); @@ -2409,7 +2409,7 @@ err: } #endif /* notyet */ -#if defined(sun) +#ifdef illumos mutex_exit(&p->p_lock); #else PROC_UNLOCK(p); @@ -2462,7 +2462,7 @@ fasttrap_load(void) mutex_init(&fasttrap_count_mtx, "fasttrap count mtx", MUTEX_DEFAULT, NULL); -#if defined(sun) +#ifdef illumos fasttrap_max = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS, "fasttrap-max-probes", FASTTRAP_MAX_DEFAULT); #else @@ -2473,7 +2473,7 @@ fasttrap_load(void) /* * Conjure up the tracepoints hashtable... */ -#if defined(sun) +#ifdef illumos nent = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS, "fasttrap-hash-size", FASTTRAP_TPOINTS_DEFAULT_SIZE); #else @@ -2491,7 +2491,7 @@ fasttrap_load(void) fasttrap_tpoints.fth_mask = fasttrap_tpoints.fth_nent - 1; fasttrap_tpoints.fth_table = kmem_zalloc(fasttrap_tpoints.fth_nent * sizeof (fasttrap_bucket_t), KM_SLEEP); -#if !defined(sun) +#ifndef illumos for (i = 0; i < fasttrap_tpoints.fth_nent; i++) mutex_init(&fasttrap_tpoints.fth_table[i].ftb_mtx, "tracepoints bucket mtx", MUTEX_DEFAULT, NULL); @@ -2509,7 +2509,7 @@ fasttrap_load(void) fasttrap_provs.fth_mask = fasttrap_provs.fth_nent - 1; fasttrap_provs.fth_table = kmem_zalloc(fasttrap_provs.fth_nent * sizeof (fasttrap_bucket_t), KM_SLEEP); -#if !defined(sun) +#ifndef illumos for (i = 0; i < fasttrap_provs.fth_nent; i++) mutex_init(&fasttrap_provs.fth_table[i].ftb_mtx, "providers bucket mtx", MUTEX_DEFAULT, NULL); @@ -2519,7 +2519,7 @@ fasttrap_load(void) &fasttrap_cleanup_proc, 0, 0, "ftcleanup"); if (ret != 0) { destroy_dev(fasttrap_cdev); -#if !defined(sun) +#ifndef illumos for (i = 0; i < fasttrap_provs.fth_nent; i++) mutex_destroy(&fasttrap_provs.fth_table[i].ftb_mtx); for (i = 0; i < fasttrap_tpoints.fth_nent; i++) @@ -2545,7 +2545,7 @@ fasttrap_load(void) fasttrap_procs.fth_mask = fasttrap_procs.fth_nent - 1; fasttrap_procs.fth_table = kmem_zalloc(fasttrap_procs.fth_nent * sizeof (fasttrap_bucket_t), KM_SLEEP); -#if !defined(sun) +#ifndef illumos for (i = 0; i < fasttrap_procs.fth_nent; i++) mutex_init(&fasttrap_procs.fth_table[i].ftb_mtx, "processes bucket mtx", MUTEX_DEFAULT, NULL); @@ -2661,7 +2661,7 @@ fasttrap_unload(void) mutex_exit(&fasttrap_count_mtx); #endif -#if !defined(sun) +#ifndef illumos EVENTHANDLER_DEREGISTER(thread_dtor, fasttrap_thread_dtor_tag); for (i = 0; i < fasttrap_tpoints.fth_nent; i++) @@ -2683,7 +2683,7 @@ fasttrap_unload(void) fasttrap_procs.fth_nent * sizeof (fasttrap_bucket_t)); fasttrap_procs.fth_nent = 0; -#if !defined(sun) +#ifndef illumos destroy_dev(fasttrap_cdev); mutex_destroy(&fasttrap_count_mtx); CPU_FOREACH(i) { diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c b/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c index 4bcdfc646fdf..2ff8df6ae894 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c @@ -107,7 +107,7 @@ * gfs_root_create_file() */ -#ifdef sun +#ifdef illumos /* * gfs_make_opsvec: take an array of vnode type definitions and create * their vnodeops_t structures @@ -141,7 +141,7 @@ gfs_make_opsvec(gfs_opsvec_t *vec) } return (error); } -#endif /* sun */ +#endif /* illumos */ /* * Low level directory routines @@ -347,7 +347,7 @@ gfs_readdir_emit(gfs_readdir_state_t *st, uio_t *uiop, offset_t voff, cookies)); } -#ifdef sun +#ifdef illumos /* * gfs_readdir_emitn: like gfs_readdir_emit(), but takes an integer * instead of a string for the entry's name. @@ -599,7 +599,7 @@ gfs_root_create(size_t size, vfs_t *vfsp, vnodeops_t *ops, ino64_t ino, return (vp); } -#ifdef sun +#ifdef illumos /* * gfs_root_create_file(): create a root vnode for a GFS file as a filesystem * @@ -619,7 +619,7 @@ gfs_root_create_file(size_t size, vfs_t *vfsp, vnodeops_t *ops, ino64_t ino) return (vp); } -#endif /* sun */ +#endif /* illumos */ /* * gfs_file_inactive() @@ -1146,7 +1146,7 @@ gfs_vop_readdir(ap) } -#ifdef sun +#ifdef illumos /* * gfs_vop_map: VOP_MAP() entry point * @@ -1218,7 +1218,7 @@ gfs_vop_map(vnode_t *vp, offset_t off, struct as *as, caddr_t *addrp, return (rv); } -#endif /* sun */ +#endif /* illumos */ /* * gfs_vop_reclaim: VOP_RECLAIM() entry point (solaris' VOP_INACTIVE()) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c index 975ab7a7b381..29e9eca56706 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c @@ -1207,7 +1207,7 @@ arc_cksum_compute(arc_buf_t *buf, boolean_t force) mutex_exit(&buf->b_hdr->b_freeze_lock); #ifdef illumos arc_buf_watch(buf); -#endif /* illumos */ +#endif } #ifdef illumos @@ -1282,7 +1282,7 @@ arc_buf_thaw(arc_buf_t *buf) #ifdef illumos arc_buf_unwatch(buf); -#endif /* illumos */ +#endif } void @@ -1742,7 +1742,7 @@ arc_buf_destroy(arc_buf_t *buf, boolean_t recycle, boolean_t remove) arc_cksum_verify(buf); #ifdef illumos arc_buf_unwatch(buf); -#endif /* illumos */ +#endif if (!recycle) { if (type == ARC_BUFC_METADATA) { @@ -2595,7 +2595,7 @@ arc_reclaim_needed(void) return (1); } -#ifdef sun +#ifdef illumos /* * take 'desfree' extra pages, so we reclaim sooner, rather than later */ @@ -2631,7 +2631,7 @@ arc_reclaim_needed(void) if (availrmem <= pages_pp_maximum) return (1); -#endif /* sun */ +#endif /* illumos */ #if defined(__i386) || !defined(UMA_MD_SMALL_ALLOC) /* * If we're on an i386 platform, it's possible that we'll exhaust the @@ -2652,7 +2652,7 @@ arc_reclaim_needed(void) return (1); } #endif -#ifdef sun +#ifdef illumos /* * If zio data pages are being allocated out of a separate heap segment, * then enforce that the size of available vmem for this arena remains @@ -2666,7 +2666,7 @@ arc_reclaim_needed(void) vmem_size(zio_arena, VMEM_FREE) < (vmem_size(zio_arena, VMEM_ALLOC) >> 4)) return (1); -#endif /* sun */ +#endif /* illumos */ #else /* _KERNEL */ if (spa_get_random(100) == 0) return (1); @@ -2725,7 +2725,7 @@ arc_kmem_reap_now(arc_reclaim_strategy_t strat) kmem_cache_reap_now(hdr_cache); kmem_cache_reap_now(range_seg_cache); -#ifdef sun +#ifdef illumos /* * Ask the vmem arena to reclaim unused memory from its * quantum caches. @@ -3213,7 +3213,7 @@ arc_read_done(zio_t *zio) arc_cksum_compute(buf, B_FALSE); #ifdef illumos arc_buf_watch(buf); -#endif /* illumos */ +#endif if (hash_lock && zio->io_error == 0 && hdr->b_state == arc_anon) { /* @@ -3816,7 +3816,7 @@ arc_release(arc_buf_t *buf, void *tag) arc_cksum_verify(buf); #ifdef illumos arc_buf_unwatch(buf); -#endif /* illumos */ +#endif mutex_exit(hash_lock); @@ -4186,7 +4186,7 @@ arc_init(void) /* Start out with 1/8 of all memory */ arc_c = kmem_size() / 8; -#ifdef sun +#ifdef illumos #ifdef _KERNEL /* * On architectures where the physical memory can be larger @@ -4195,7 +4195,7 @@ arc_init(void) */ arc_c = MIN(arc_c, vmem_size(heap_arena, VMEM_ALLOC | VMEM_FREE) / 8); #endif -#endif /* sun */ +#endif /* illumos */ /* set min cache to 1/32 of all memory, or 16MB, whichever is more */ arc_c_min = MAX(arc_c / 4, 64<<18); /* set max to 1/2 of all memory, or all but 1GB, whichever is more */ diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c index c86d3a7371e3..181a65b62851 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c @@ -1238,7 +1238,7 @@ dmu_write_uio(objset_t *os, uint64_t object, uio_t *uio, uint64_t size, return (err); } -#ifdef sun +#ifdef illumos int dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, page_t *pp, dmu_tx_t *tx) @@ -1294,7 +1294,7 @@ dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, return (err); } -#else +#else /* !illumos */ int dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, @@ -1351,8 +1351,8 @@ dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, dmu_buf_rele_array(dbp, numbufs, FTAG); return (err); } -#endif /* sun */ -#endif +#endif /* illumos */ +#endif /* _KERNEL */ /* * Allocate a loaned anonymous arc buffer. diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c index 665165a4f6c3..938b5d61793b 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c @@ -57,7 +57,7 @@ static dnode_phys_t dnode_phys_zero; int zfs_default_bs = SPA_MINBLOCKSHIFT; int zfs_default_ibs = DN_MAX_INDBLKSHIFT; -#ifdef sun +#ifdef illumos static kmem_cbrc_t dnode_move(void *, void *, size_t, void *); #endif @@ -813,7 +813,7 @@ dnode_move_impl(dnode_t *odn, dnode_t *ndn) odn->dn_moved = (uint8_t)-1; } -#ifdef sun +#ifdef illumos #ifdef _KERNEL /*ARGSUSED*/ static kmem_cbrc_t @@ -956,7 +956,7 @@ dnode_move(void *buf, void *newbuf, size_t size, void *arg) return (KMEM_CBRC_YES); } #endif /* _KERNEL */ -#endif /* sun */ +#endif /* illumos */ void dnode_special_close(dnode_handle_t *dnh) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c index 7886fd9302d5..8700f4c35eba 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c @@ -3770,7 +3770,7 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props, } #ifdef _KERNEL -#if defined(sun) +#ifdef illumos /* * Get the root pool information from the root disk, then import the root pool * during the system boot up time. @@ -3971,7 +3971,7 @@ out: return (error); } -#else +#else /* !illumos */ extern int vdev_geom_read_pool_label(const char *name, nvlist_t ***configs, uint64_t *count); @@ -4162,8 +4162,8 @@ spa_import_rootpool(const char *name) return (0); } -#endif /* sun */ -#endif +#endif /* illumos */ +#endif /* _KERNEL */ /* * Import a non-root pool into the system. @@ -5331,13 +5331,13 @@ spa_vdev_split_mirror(spa_t *spa, char *newname, nvlist_t *config, spa_activate(newspa, spa_mode_global); spa_async_suspend(newspa); -#ifndef sun +#ifndef illumos /* mark that we are creating new spa by splitting */ newspa->spa_splitting_newspa = B_TRUE; #endif /* create the new pool from the disks of the original pool */ error = spa_load(newspa, SPA_LOAD_IMPORT, SPA_IMPORT_ASSEMBLE, B_TRUE); -#ifndef sun +#ifndef illumos newspa->spa_splitting_newspa = B_FALSE; #endif if (error) @@ -6578,12 +6578,12 @@ spa_sync(spa_t *spa, uint64_t txg) #ifdef illumos VERIFY(cyclic_reprogram(spa->spa_deadman_cycid, spa->spa_sync_starttime + spa->spa_deadman_synctime)); -#else /* FreeBSD */ +#else /* !illumos */ #ifdef _KERNEL callout_reset(&spa->spa_deadman_cycid, hz * spa->spa_deadman_synctime / NANOSEC, spa_deadman, spa); #endif -#endif +#endif /* illumos */ /* * If we are upgrading to SPA_VERSION_RAIDZ_DEFLATE this txg, @@ -6728,11 +6728,11 @@ spa_sync(spa_t *spa, uint64_t txg) #ifdef illumos VERIFY(cyclic_reprogram(spa->spa_deadman_cycid, CY_INFINITY)); -#else /* FreeBSD */ +#else /* !illumos */ #ifdef _KERNEL callout_drain(&spa->spa_deadman_cycid); #endif -#endif +#endif /* illumos */ /* * Clear the dirty config list. diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h index 3881d247b6d9..39ccf65236f2 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h @@ -616,7 +616,7 @@ int dmu_write_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size, int dmu_write_uio_dbuf(dmu_buf_t *zdb, struct uio *uio, uint64_t size, dmu_tx_t *tx); #ifdef _KERNEL -#ifdef sun +#ifdef illumos int dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, struct page *pp, dmu_tx_t *tx); #else diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h index cb5e01158d56..b3937e00ae41 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h @@ -601,7 +601,7 @@ extern int spa_get_stats(const char *pool, nvlist_t **config, char *altroot, size_t buflen); extern int spa_create(const char *pool, nvlist_t *config, nvlist_t *props, nvlist_t *zplprops); -#if defined(sun) +#ifdef illumos extern int spa_import_rootpool(char *devpath, char *devid); #else extern int spa_import_rootpool(const char *name); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h index 40f5b06f1e3d..d1737e13cfda 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h @@ -245,7 +245,7 @@ struct spa { uint64_t spa_feat_refcount_cache[SPA_FEATURES]; #ifdef illumos cyclic_id_t spa_deadman_cycid; /* cyclic id */ -#else /* FreeBSD */ +#else /* !illumos */ #ifdef _KERNEL struct callout spa_deadman_cycid; /* callout id */ #endif @@ -275,7 +275,7 @@ struct spa { */ spa_config_lock_t spa_config_lock[SCL_LOCKS]; /* config changes */ refcount_t spa_refcount; /* number of opens */ -#ifndef sun +#ifndef illumos boolean_t spa_splitting_newspa; /* creating new spa in split */ #endif }; diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h index 75c6b3757c1d..7556eda0fbe9 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h @@ -45,7 +45,7 @@ extern int zvol_remove_minor(const char *); extern void zvol_remove_minors(const char *); extern int zvol_set_volsize(const char *, uint64_t); -#ifdef sun +#ifdef illumos extern int zvol_open(dev_t *devp, int flag, int otyp, cred_t *cr); extern int zvol_dump(dev_t dev, caddr_t addr, daddr_t offset, int nblocks); extern int zvol_close(dev_t dev, int flag, int otyp, cred_t *cr); @@ -54,14 +54,14 @@ extern int zvol_read(dev_t dev, uio_t *uiop, cred_t *cr); extern int zvol_write(dev_t dev, uio_t *uiop, cred_t *cr); extern int zvol_aread(dev_t dev, struct aio_req *aio, cred_t *cr); extern int zvol_awrite(dev_t dev, struct aio_req *aio, cred_t *cr); -#endif /* sun */ +#endif /* illumos */ extern int zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp); extern int zvol_busy(void); extern void zvol_init(void); extern void zvol_fini(void); -#ifdef sun +#ifdef illumos extern int zvol_get_volume_params(minor_t minor, uint64_t *blksize, uint64_t *max_xfer_len, void **minor_hdl, void **objset_hdl, void **zil_hdl, void **rl_hdl, void **bonus_hdl); @@ -69,7 +69,7 @@ extern uint64_t zvol_get_volume_size(void *minor_hdl); extern int zvol_get_volume_wce(void *minor_hdl); extern void zvol_log_write_minor(void *minor_hdl, dmu_tx_t *tx, offset_t off, ssize_t resid, boolean_t sync); -#endif /* sun */ +#endif /* illumos */ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) extern int zvol_create_minors(const char *name); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c index dfbb92eb81dd..a3ec38e16f78 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c @@ -3360,7 +3360,7 @@ vdev_set_state(vdev_t *vd, boolean_t isopen, vdev_state_t state, vdev_aux_t aux) boolean_t vdev_is_bootable(vdev_t *vd) { -#ifdef sun +#ifdef illumos if (!vd->vdev_ops->vdev_op_leaf) { char *vdev_type = vd->vdev_ops->vdev_op_type; @@ -3379,7 +3379,7 @@ vdev_is_bootable(vdev_t *vd) if (!vdev_is_bootable(vd->vdev_child[c])) return (B_FALSE); } -#endif /* sun */ +#endif /* illumos */ return (B_TRUE); } diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c index 6545dc2ff845..fd6f9662cf93 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c @@ -2053,7 +2053,7 @@ zfs_zaccess_dataset_check(znode_t *zp, uint32_t v4_mode) return (SET_ERROR(EPERM)); } -#ifdef sun +#ifdef illumos if ((v4_mode & (ACE_DELETE | ACE_DELETE_CHILD)) && (zp->z_pflags & ZFS_NOUNLINK)) { return (SET_ERROR(EPERM)); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c index 01fae24d699e..9e0b8a0998c3 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c @@ -112,7 +112,7 @@ snapentry_compare(const void *a, const void *b) return (0); } -#ifdef sun +#ifdef illumos vnodeops_t *zfsctl_ops_root; vnodeops_t *zfsctl_ops_snapdir; vnodeops_t *zfsctl_ops_snapshot; @@ -123,20 +123,20 @@ static const fs_operation_def_t zfsctl_tops_root[]; static const fs_operation_def_t zfsctl_tops_snapdir[]; static const fs_operation_def_t zfsctl_tops_snapshot[]; static const fs_operation_def_t zfsctl_tops_shares[]; -#else /* !sun */ +#else static struct vop_vector zfsctl_ops_root; static struct vop_vector zfsctl_ops_snapdir; static struct vop_vector zfsctl_ops_snapshot; static struct vop_vector zfsctl_ops_shares; static struct vop_vector zfsctl_ops_shares_dir; -#endif /* !sun */ +#endif static vnode_t *zfsctl_mknode_snapdir(vnode_t *); static vnode_t *zfsctl_mknode_shares(vnode_t *); static vnode_t *zfsctl_snapshot_mknode(vnode_t *, uint64_t objset); static int zfsctl_unmount_snap(zfs_snapentry_t *, int, cred_t *); -#ifdef sun +#ifdef illumos static gfs_opsvec_t zfsctl_opsvec[] = { { ".zfs", zfsctl_tops_root, &zfsctl_ops_root }, { ".zfs/snapshot", zfsctl_tops_snapdir, &zfsctl_ops_snapdir }, @@ -145,7 +145,7 @@ static gfs_opsvec_t zfsctl_opsvec[] = { { ".zfs/shares/vnode", zfsctl_tops_shares, &zfsctl_ops_shares }, { NULL } }; -#endif /* sun */ +#endif /* * Root directory elements. We only have two entries @@ -170,7 +170,7 @@ static gfs_dirent_t zfsctl_root_entries[] = { void zfsctl_init(void) { -#ifdef sun +#ifdef illumos VERIFY(gfs_make_opsvec(zfsctl_opsvec) == 0); #endif } @@ -178,7 +178,7 @@ zfsctl_init(void) void zfsctl_fini(void) { -#ifdef sun +#ifdef illumos /* * Remove vfsctl vnode ops */ @@ -198,7 +198,7 @@ zfsctl_fini(void) zfsctl_ops_snapshot = NULL; zfsctl_ops_shares = NULL; zfsctl_ops_shares_dir = NULL; -#endif /* sun */ +#endif /* illumos */ } boolean_t @@ -549,7 +549,7 @@ zfsctl_root_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, pathname_t *pnp, return (err); } -#ifdef sun +#ifdef illumos static int zfsctl_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr, caller_context_t *ct) @@ -565,9 +565,9 @@ zfsctl_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr, return (fs_pathconf(vp, cmd, valp, cr, ct)); } -#endif /* sun */ +#endif /* illumos */ -#ifdef sun +#ifdef illumos static const fs_operation_def_t zfsctl_tops_root[] = { { VOPNAME_OPEN, { .vop_open = zfsctl_common_open } }, { VOPNAME_CLOSE, { .vop_close = zfsctl_common_close } }, @@ -582,7 +582,7 @@ static const fs_operation_def_t zfsctl_tops_root[] = { { VOPNAME_FID, { .vop_fid = zfsctl_common_fid } }, { NULL } }; -#endif /* sun */ +#endif /* illumos */ /* * Special case the handling of "..". @@ -676,7 +676,7 @@ zfsctl_unmount_snap(zfs_snapentry_t *sep, int fflags, cred_t *cr) if ((error = vn_vfswlock(svp)) != 0) return (error); -#ifdef sun +#ifdef illumos VN_HOLD(svp); error = dounmount(vn_mountedvfs(svp), fflags, cr); if (error) { @@ -696,12 +696,12 @@ zfsctl_unmount_snap(zfs_snapentry_t *sep, int fflags, cred_t *cr) kmem_free(sep, sizeof (zfs_snapentry_t)); return (0); -#else /* !sun */ +#else return (dounmount(vn_mountedvfs(svp), fflags, curthread)); -#endif /* !sun */ +#endif } -#ifdef sun +#ifdef illumos static void zfsctl_rename_snap(zfsctl_snapdir_t *sdp, zfs_snapentry_t *sep, const char *nm) { @@ -754,9 +754,9 @@ zfsctl_rename_snap(zfsctl_snapdir_t *sdp, zfs_snapentry_t *sep, const char *nm) vfs_unlock(vfsp); } -#endif /* sun */ +#endif /* illumos */ -#ifdef sun +#ifdef illumos /*ARGSUSED*/ static int zfsctl_snapdir_rename(vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm, @@ -821,9 +821,9 @@ zfsctl_snapdir_rename(vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm, return (err); } -#endif /* sun */ +#endif /* illumos */ -#ifdef sun +#ifdef illumos /* ARGSUSED */ static int zfsctl_snapdir_remove(vnode_t *dvp, char *name, vnode_t *cwd, cred_t *cr, @@ -879,7 +879,7 @@ zfsctl_snapdir_remove(vnode_t *dvp, char *name, vnode_t *cwd, cred_t *cr, return (err); } -#endif /* sun */ +#endif /* illumos */ /* * This creates a snapshot under '.zfs/snapshot'. @@ -1067,7 +1067,7 @@ zfsctl_snapdir_lookup(ap) } ZFS_EXIT(zfsvfs); return (err); -#endif /* !illumos */ +#endif /* illumos */ } sep = kmem_alloc(sizeof (zfs_snapentry_t), KM_SLEEP); @@ -1374,7 +1374,7 @@ zfsctl_snapdir_inactive(ap) return (0); } -#ifdef sun +#ifdef illumos static const fs_operation_def_t zfsctl_tops_snapdir[] = { { VOPNAME_OPEN, { .vop_open = zfsctl_common_open } }, { VOPNAME_CLOSE, { .vop_close = zfsctl_common_close } }, @@ -1405,7 +1405,7 @@ static const fs_operation_def_t zfsctl_tops_shares[] = { { VOPNAME_FID, { .vop_fid = zfsctl_shares_fid } }, { NULL } }; -#else /* !sun */ +#else /* !illumos */ static struct vop_vector zfsctl_ops_snapdir = { .vop_default = &default_vnodeops, .vop_open = zfsctl_common_open, @@ -1434,7 +1434,7 @@ static struct vop_vector zfsctl_ops_shares = { .vop_reclaim = gfs_vop_reclaim, .vop_fid = zfsctl_shares_fid, }; -#endif /* !sun */ +#endif /* illumos */ /* * pvp is the GFS vnode '.zfs/snapshot'. diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c index 197e122d961e..e74799a70fe0 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c @@ -406,7 +406,7 @@ zfs_fuid_map_id(zfsvfs_t *zfsvfs, uint64_t fuid, domain = zfs_fuid_find_by_idx(zfsvfs, index); ASSERT(domain != NULL); -#ifdef sun +#ifdef illumos if (type == ZFS_OWNER || type == ZFS_ACE_USER) { (void) kidmap_getuidbysid(crgetzone(cr), domain, FUID_RID(fuid), &id); @@ -414,9 +414,9 @@ zfs_fuid_map_id(zfsvfs_t *zfsvfs, uint64_t fuid, (void) kidmap_getgidbysid(crgetzone(cr), domain, FUID_RID(fuid), &id); } -#else /* !sun */ +#else id = UID_NOBODY; -#endif /* !sun */ +#endif return (id); } @@ -703,13 +703,13 @@ zfs_fuid_info_free(zfs_fuid_info_t *fuidp) boolean_t zfs_groupmember(zfsvfs_t *zfsvfs, uint64_t id, cred_t *cr) { -#ifdef sun +#ifdef illumos ksid_t *ksid = crgetsid(cr, KSID_GROUP); ksidlist_t *ksidlist = crgetsidlist(cr); -#endif /* !sun */ +#endif uid_t gid; -#ifdef sun +#ifdef illumos if (ksid && ksidlist) { int i; ksid_t *ksid_groups; @@ -741,7 +741,7 @@ zfs_groupmember(zfsvfs_t *zfsvfs, uint64_t id, cred_t *cr) } } } -#endif /* !sun */ +#endif /* illumos */ /* * Not found in ksidlist, check posix groups diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c index 383b789e611d..8801aa5abee3 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c @@ -4823,7 +4823,7 @@ zfs_ioc_userspace_upgrade(zfs_cmd_t *zc) return (error); } -#ifdef sun +#ifdef illumos /* * We don't want to have a hard dependency * against some special symbols in sharefs @@ -4841,10 +4841,10 @@ int zfs_smbshare_inited; ddi_modhandle_t nfs_mod; ddi_modhandle_t sharefs_mod; ddi_modhandle_t smbsrv_mod; -#endif /* sun */ +#endif /* illumos */ kmutex_t zfs_share_lock; -#ifdef sun +#ifdef illumos static int zfs_init_sharefs() { @@ -4864,12 +4864,12 @@ zfs_init_sharefs() } return (0); } -#endif /* sun */ +#endif /* illumos */ static int zfs_ioc_share(zfs_cmd_t *zc) { -#ifdef sun +#ifdef illumos int error; int opcode; @@ -4960,9 +4960,9 @@ zfs_ioc_share(zfs_cmd_t *zc) return (error); -#else /* !sun */ +#else /* !illumos */ return (ENOSYS); -#endif /* !sun */ +#endif /* illumos */ } ace_t full_access[] = { @@ -5065,7 +5065,7 @@ zfs_ioc_diff(zfs_cmd_t *zc) return (error); } -#ifdef sun +#ifdef illumos /* * Remove all ACL files in shares dir */ @@ -5087,12 +5087,12 @@ zfs_smb_acl_purge(znode_t *dzp) zap_cursor_fini(&zc); return (error); } -#endif /* sun */ +#endif /* illumos */ static int zfs_ioc_smb_acl(zfs_cmd_t *zc) { -#ifdef sun +#ifdef illumos vnode_t *vp; znode_t *dzp; vnode_t *resourcevp = NULL; @@ -5215,9 +5215,9 @@ zfs_ioc_smb_acl(zfs_cmd_t *zc) ZFS_EXIT(zfsvfs); return (error); -#else /* !sun */ +#else /* !illumos */ return (EOPNOTSUPP); -#endif /* !sun */ +#endif /* illumos */ } /* @@ -5908,7 +5908,7 @@ zfsdev_open(struct cdev *devp, int flag, int mode, struct thread *td) { int error = 0; -#ifdef sun +#ifdef illumos if (getminor(*devp) != 0) return (zvol_open(devp, flag, otyp, cr)); #endif @@ -6245,7 +6245,7 @@ out: return (error); } -#ifdef sun +#ifdef illumos static int zfs_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) { @@ -6296,7 +6296,7 @@ zfs_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result) return (DDI_FAILURE); } -#endif /* sun */ +#endif /* illumos */ /* * OK, so this is a little weird. @@ -6307,7 +6307,7 @@ zfs_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result) * /dev/zfs has basically nothing to do except serve up ioctls, * so most of the standard driver entry points are in zvol.c. */ -#ifdef sun +#ifdef illumos static struct cb_ops zfs_cb_ops = { zfsdev_open, /* open */ zfsdev_close, /* close */ @@ -6356,7 +6356,7 @@ static struct modlinkage modlinkage = { (void *)&zfs_modldrv, NULL }; -#endif /* sun */ +#endif /* illumos */ static struct cdevsw zfs_cdevsw = { .d_version = D_VERSION, @@ -6389,7 +6389,7 @@ zfsdev_fini(void) static struct root_hold_token *zfs_root_token; struct proc *zfsproc; -#ifdef sun +#ifdef illumos int _init(void) { @@ -6452,7 +6452,7 @@ _info(struct modinfo *modinfop) { return (mod_info(&modlinkage, modinfop)); } -#endif /* sun */ +#endif /* illumos */ static int zfs__init(void); static int zfs__fini(void); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c index 6e0c24337bf5..96f777a95f3a 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c @@ -820,7 +820,7 @@ top: static int zfs_replay_truncate(zfsvfs_t *zfsvfs, lr_truncate_t *lr, boolean_t byteswap) { -#ifdef sun +#ifdef illumos znode_t *zp; flock64_t fl; int error; @@ -843,10 +843,10 @@ zfs_replay_truncate(zfsvfs_t *zfsvfs, lr_truncate_t *lr, boolean_t byteswap) VN_RELE(ZTOV(zp)); return (error); -#else /* !sun */ +#else ZFS_LOG(0, "Unexpected code path, report to pjd@FreeBSD.org"); return (EOPNOTSUPP); -#endif /* !sun */ +#endif } static int diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c index 15d34df9a0bd..7b74145393b0 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c @@ -1635,13 +1635,13 @@ zfs_mount(vfs_t *vfsp) * can be interrogated. */ if ((uap->flags & MS_DATA) && uap->datalen > 0) -#else +#else /* !illumos */ if (!prison_allow(td->td_ucred, PR_ALLOW_MOUNT_ZFS)) return (SET_ERROR(EPERM)); if (vfs_getopt(vfsp->mnt_optnew, "from", (void **)&osname, NULL)) return (SET_ERROR(EINVAL)); -#endif /* ! illumos */ +#endif /* illumos */ /* * If full-owner-access is enabled and delegated administration is @@ -1734,14 +1734,14 @@ zfs_mount(vfs_t *vfsp) error = zfs_domount(vfsp, osname); PICKUP_GIANT(); -#ifdef sun +#ifdef illumos /* * Add an extra VFS_HOLD on our parent vfs so that it can't * disappear due to a forced unmount. */ if (error == 0 && ((zfsvfs_t *)vfsp->vfs_data)->z_issnap) VFS_HOLD(mvp->v_vfsp); -#endif /* sun */ +#endif out: return (error); @@ -1996,7 +1996,7 @@ zfs_umount(vfs_t *vfsp, int fflag) return (ret); } -#ifdef sun +#ifdef illumos if (!(fflag & MS_FORCE)) { /* * Check the number of active vnodes in the file system. @@ -2321,7 +2321,7 @@ zfs_freevfs(vfs_t *vfsp) { zfsvfs_t *zfsvfs = vfsp->vfs_data; -#ifdef sun +#ifdef illumos /* * If this is a snapshot, we have an extra VFS_HOLD on our parent * from zfs_mount(). Release it here. If we came through @@ -2330,7 +2330,7 @@ zfs_freevfs(vfs_t *vfsp) */ if (zfsvfs->z_issnap && (vfsp != rootvfs)) VFS_RELE(zfsvfs->z_parent->z_vfs); -#endif /* sun */ +#endif zfsvfs_free(zfsvfs); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index 9b11652bb228..5bd67257b419 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -311,7 +311,7 @@ zfs_ioctl(vnode_t *vp, u_long com, intptr_t data, int flag, cred_t *cred, case _FIO_SEEK_DATA: case _FIO_SEEK_HOLE: -#ifdef sun +#ifdef illumos if (ddi_copyin((void *)data, &off, sizeof (off), flag)) return (SET_ERROR(EFAULT)); #else @@ -327,7 +327,7 @@ zfs_ioctl(vnode_t *vp, u_long com, intptr_t data, int flag, cred_t *cred, ZFS_EXIT(zfsvfs); if (error) return (error); -#ifdef sun +#ifdef illumos if (ddi_copyout(&off, (void *)data, sizeof (off), flag)) return (SET_ERROR(EFAULT)); #else @@ -714,7 +714,7 @@ zfs_read(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct) ASSERT(uio->uio_loffset < zp->z_size); n = MIN(uio->uio_resid, zp->z_size - uio->uio_loffset); -#ifdef sun +#ifdef illumos if ((uio->uio_extflg == UIO_XUIO) && (((xuio_t *)uio)->xu_type == UIOTYPE_ZEROCOPY)) { int nblk; @@ -743,7 +743,7 @@ zfs_read(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct) } } } -#endif /* sun */ +#endif /* illumos */ while (n > 0) { nbytes = MIN(n, zfs_read_chunk_size - @@ -885,7 +885,7 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct) return (error); } -#ifdef sun +#ifdef illumos /* * Pre-fault the pages to ensure slow (eg NFS) pages * don't hold up txg. @@ -896,7 +896,7 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct) xuio = (xuio_t *)uio; else uio_prefaultpages(MIN(n, max_blksz), uio); -#endif /* sun */ +#endif /* * If in append mode, set the io offset pointer to eof. @@ -1148,10 +1148,10 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct) ASSERT(tx_bytes == nbytes); n -= nbytes; -#ifdef sun +#ifdef illumos if (!xuio && n > 0) uio_prefaultpages(MIN(n, max_blksz), uio); -#endif /* sun */ +#endif } zfs_range_unlock(rl); @@ -2823,7 +2823,7 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, mutex_enter(&zp->z_lock); vap->va_type = IFTOVT(zp->z_mode); vap->va_mode = zp->z_mode & ~S_IFMT; -#ifdef sun +#ifdef illumos vap->va_fsid = zp->z_zfsvfs->z_vfs->vfs_dev; #else vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0]; @@ -2835,7 +2835,7 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, links = zp->z_links; vap->va_nlink = MIN(links, LINK_MAX); /* nlink_t limit! */ vap->va_size = zp->z_size; -#ifdef sun +#ifdef illumos vap->va_rdev = vp->v_rdev; #else if (vp->v_type == VBLK || vp->v_type == VCHR) @@ -4462,7 +4462,7 @@ top: return (error); } -#ifdef sun +#ifdef illumos /* * zfs_null_putapage() is used when the file system has been force * unmounted. It just drops the pages. @@ -4690,7 +4690,7 @@ out: ZFS_EXIT(zfsvfs); return (error); } -#endif /* sun */ +#endif /* illumos */ /*ARGSUSED*/ void @@ -4743,7 +4743,7 @@ zfs_inactive(vnode_t *vp, cred_t *cr, caller_context_t *ct) rw_exit(&zfsvfs->z_teardown_inactive_lock); } -#ifdef sun +#ifdef illumos /* * Bounds-check the seek operation. * @@ -5169,7 +5169,7 @@ zfs_space(vnode_t *vp, int cmd, flock64_t *bfp, int flag, ZFS_EXIT(zfsvfs); return (error); } -#endif /* sun */ +#endif /* illumos */ CTASSERT(sizeof(struct zfid_short) <= sizeof(struct fid)); CTASSERT(sizeof(struct zfid_long) <= sizeof(struct fid)); @@ -5257,7 +5257,7 @@ zfs_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr, case _PC_FILESIZEBITS: *valp = 64; return (0); -#ifdef sun +#ifdef illumos case _PC_XATTR_EXISTS: zp = VTOZ(vp); zfsvfs = zp->z_zfsvfs; @@ -5295,16 +5295,16 @@ zfs_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr, case _PC_ACL_ENABLED: *valp = _ACL_ACE_ENABLED; return (0); -#endif /* sun */ +#endif /* illumos */ case _PC_MIN_HOLE_SIZE: *valp = (int)SPA_MINBLOCKSIZE; return (0); -#ifdef sun +#ifdef illumos case _PC_TIMESTAMP_RESOLUTION: /* nanosecond timestamp resolution */ *valp = 1L; return (0); -#endif /* sun */ +#endif case _PC_ACL_EXTENDED: *valp = 0; return (0); @@ -5363,7 +5363,7 @@ zfs_setsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr, return (error); } -#ifdef sun +#ifdef illumos /* * The smallest read we may consider to loan out an arcbuf. * This must be a power of 2. @@ -5694,7 +5694,7 @@ const fs_operation_def_t zfs_evnodeops_template[] = { VOPNAME_PATHCONF, { .vop_pathconf = zfs_pathconf }, NULL, NULL }; -#endif /* sun */ +#endif /* illumos */ static int ioflags(int ioflags) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c index f92ddd446b89..44b782096b20 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c @@ -172,7 +172,7 @@ static struct { } znode_move_stats; #endif /* ZNODE_STATS */ -#ifdef sun +#ifdef illumos static void zfs_znode_move_impl(znode_t *ozp, znode_t *nzp) { @@ -343,7 +343,7 @@ zfs_znode_move(void *buf, void *newbuf, size_t size, void *arg) return (KMEM_CBRC_YES); } -#endif /* sun */ +#endif /* illumos */ void zfs_znode_init(void) @@ -362,12 +362,12 @@ zfs_znode_init(void) void zfs_znode_fini(void) { -#ifdef sun +#ifdef illumos /* * Cleanup vfs & vnode ops */ zfs_remove_op_tables(); -#endif /* sun */ +#endif /* * Cleanup zcache @@ -378,7 +378,7 @@ zfs_znode_fini(void) rw_destroy(&zfsvfs_lock); } -#ifdef sun +#ifdef illumos struct vnodeops *zfs_dvnodeops; struct vnodeops *zfs_fvnodeops; struct vnodeops *zfs_symvnodeops; @@ -470,7 +470,7 @@ zfs_create_op_tables() return (error); } -#endif /* sun */ +#endif /* illumos */ int zfs_create_share_dir(zfsvfs_t *zfsvfs, dmu_tx_t *tx) @@ -689,7 +689,7 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz, case VDIR: zp->z_zn_prefetch = B_TRUE; /* z_prefetch default is enabled */ break; -#ifdef sun +#ifdef illumos case VBLK: case VCHR: { @@ -700,12 +700,12 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz, vp->v_rdev = zfs_cmpldev(rdev); } break; -#endif /* sun */ +#endif case VFIFO: -#ifdef sun +#ifdef illumos case VSOCK: case VDOOR: -#endif /* sun */ +#endif vp->v_op = &zfs_fifoops; break; case VREG: @@ -714,14 +714,14 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz, vp->v_op = &zfs_shareops; } break; -#ifdef sun +#ifdef illumos case VLNK: vn_setops(vp, zfs_symvnodeops); break; default: vn_setops(vp, zfs_evnodeops); break; -#endif /* sun */ +#endif } mutex_enter(&zfsvfs->z_znodes_lock); @@ -1490,7 +1490,7 @@ zfs_grow_blocksize(znode_t *zp, uint64_t size, dmu_tx_t *tx) dmu_object_size_from_db(sa_get_db(zp->z_sa_hdl), &zp->z_blksz, &dummy); } -#ifdef sun +#ifdef illumos /* * This is a dummy interface used when pvn_vplist_dirty() should *not* * be calling back into the fs for a putpage(). E.g.: when truncating @@ -1504,7 +1504,7 @@ zfs_no_putpage(vnode_t *vp, page_t *pp, u_offset_t *offp, size_t *lenp, ASSERT(0); return (0); } -#endif /* sun */ +#endif /* * Increase the file length diff --git a/sys/cddl/contrib/opensolaris/uts/common/os/callb.c b/sys/cddl/contrib/opensolaris/uts/common/os/callb.c index da397a5cca95..da479087f869 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/os/callb.c +++ b/sys/cddl/contrib/opensolaris/uts/common/os/callb.c @@ -368,7 +368,7 @@ callb_unlock_table(void) mutex_exit(&ct->ct_lock); } -#ifdef sun +#ifdef illumos /* * Return a boolean value indicating whether a particular kernel thread is * stopped in accordance with the cpr callback protocol. If returning @@ -432,7 +432,7 @@ callb_is_stopped(kthread_id_t tp, caddr_t *thread_name) mutex_exit(&ct->ct_lock); return (ret_val); } -#endif /* sun */ +#endif /* illumos */ SYSINIT(sol_callb, SI_SUB_DRIVERS, SI_ORDER_FIRST, callb_init, NULL); SYSUNINIT(sol_callb, SI_SUB_DRIVERS, SI_ORDER_FIRST, callb_fini, NULL); diff --git a/sys/cddl/contrib/opensolaris/uts/common/os/fm.c b/sys/cddl/contrib/opensolaris/uts/common/os/fm.c index 66a860d66526..57b23356b12d 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/os/fm.c +++ b/sys/cddl/contrib/opensolaris/uts/common/os/fm.c @@ -79,7 +79,7 @@ static const char *fm_url = "http://www.sun.com/msg"; static const char *fm_msgid = "SUNOS-8000-0G"; static char *volatile fm_panicstr = NULL; -#ifdef sun +#ifdef illumos errorq_t *ereport_errorq; #endif void *ereport_dumpbuf; @@ -112,7 +112,7 @@ static struct erpt_kstat erpt_kstat_data = { { "payload-set-failed", KSTAT_DATA_UINT64 } }; -#ifdef sun +#ifdef illumos /*ARGSUSED*/ static void fm_drain(void *private, void *data, errorq_elem_t *eep) @@ -131,7 +131,7 @@ fm_init(void) { kstat_t *ksp; -#ifdef sun +#ifdef illumos (void) sysevent_evc_bind(FM_ERROR_CHAN, &ereport_chan, EVCH_CREAT | EVCH_HOLD_PEND); @@ -145,7 +145,7 @@ fm_init(void) if (ereport_size == 0) ereport_size = ERPT_DATA_SZ; -#ifdef sun +#ifdef illumos ereport_errorq = errorq_nvcreate("fm_ereport_queue", (errorq_func_t)fm_drain, NULL, ereport_qlen, ereport_size, FM_ERR_PIL, ERRORQ_VITAL); @@ -170,7 +170,7 @@ fm_init(void) } } -#ifdef sun +#ifdef illumos /* * Formatting utility function for fm_nvprintr. We attempt to wrap chunks of * output so they aren't split across console lines, and return the end column. @@ -528,7 +528,7 @@ fm_ereport_post(nvlist_t *ereport, int evc_flag) return; } -#ifdef sun +#ifdef illumos if (sysevent_evc_bind(FM_ERROR_CHAN, &error_chan, EVCH_CREAT|EVCH_HOLD_PEND) != 0) { atomic_inc_64(&erpt_kstat_data.erpt_dropped.value.ui64); @@ -1262,7 +1262,7 @@ fm_ena_time_get(uint64_t ena) return (time); } -#ifdef sun +#ifdef illumos /* * Convert a getpcstack() trace to symbolic name+offset, and add the resulting * string array to a Fault Management ereport as FM_EREPORT_PAYLOAD_NAME_STACK. @@ -1290,7 +1290,7 @@ fm_payload_stack_add(nvlist_t *payload, const pc_t *stack, int depth) } #endif -#ifdef sun +#ifdef illumos void print_msg_hwerr(ctid_t ct_id, proc_t *p) { diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/ctf.h b/sys/cddl/contrib/opensolaris/uts/common/sys/ctf.h index 2d1987be459f..528814118e1c 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/ctf.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/ctf.h @@ -27,7 +27,7 @@ #ifndef _CTF_H #define _CTF_H -#if defined(sun) +#ifdef illumos #pragma ident "%Z%%M% %I% %E% SMI" #endif diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h b/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h index 8e3f4cad1f0e..6b7ab01b6929 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h @@ -69,7 +69,7 @@ typedef struct ctf_sect { const char *cts_name; /* section name (if any) */ ulong_t cts_type; /* section type (ELF SHT_... value) */ ulong_t cts_flags; /* section flags (ELF SHF_... value) */ -#if defined(sun) +#ifdef illumos const void *cts_data; /* pointer to section data */ #else void *cts_data; /* pointer to section data */ diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h index ca73689b9d5b..d449294d7507 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h @@ -54,7 +54,7 @@ extern "C" { #include #include #include -#if defined(sun) +#ifdef illumos #include #else #include @@ -65,7 +65,7 @@ extern "C" { typedef int model_t; #endif #include -#if defined(sun) +#ifdef illumos #include #include #else @@ -257,7 +257,7 @@ typedef enum dtrace_probespec { #define DIF_VAR_ERRNO 0x0120 /* thread errno */ #define DIF_VAR_EXECARGS 0x0121 /* process arguments */ -#if !defined(sun) +#ifndef illumos #define DIF_VAR_CPU 0x0200 #endif @@ -1277,7 +1277,7 @@ typedef struct dtrace_providerdesc { * pseudodevice driver. These ioctls comprise the user-kernel interface to * DTrace. */ -#if defined(sun) +#ifdef illumos #define DTRACEIOC (('d' << 24) | ('t' << 16) | ('r' << 8)) #define DTRACEIOC_PROVIDER (DTRACEIOC | 1) /* provider query */ #define DTRACEIOC_PROBES (DTRACEIOC | 2) /* probe query */ @@ -1408,7 +1408,7 @@ typedef struct { * helpers and should no longer be used. No other ioctls are valid on the * helper minor node. */ -#if defined(sun) +#ifdef illumos #define DTRACEHIOC (('d' << 24) | ('t' << 16) | ('h' << 8)) #define DTRACEHIOC_ADD (DTRACEHIOC | 1) /* add helper */ #define DTRACEHIOC_REMOVE (DTRACEHIOC | 2) /* remove helper */ @@ -1423,7 +1423,7 @@ typedef struct dof_helper { char dofhp_mod[DTRACE_MODNAMELEN]; /* executable or library name */ uint64_t dofhp_addr; /* base address of object */ uint64_t dofhp_dof; /* address of helper DOF */ -#if !defined(sun) +#ifndef illumos int gen; #endif } dof_helper_t; @@ -2325,7 +2325,7 @@ typedef enum dtrace_vtime_state { DTRACE_VTIME_ACTIVE_TNF /* DTrace virtual time _and_ TNF */ } dtrace_vtime_state_t; -#if defined(sun) +#ifdef illumos extern dtrace_vtime_state_t dtrace_vtime_active; #endif extern void dtrace_vtime_switch(kthread_t *next); @@ -2337,7 +2337,7 @@ extern void dtrace_vtime_disable(void); struct regs; struct reg; -#if defined(sun) +#ifdef illumos extern int (*dtrace_pid_probe_ptr)(struct reg *); extern int (*dtrace_return_probe_ptr)(struct reg *); extern void (*dtrace_fasttrap_fork_ptr)(proc_t *, proc_t *); @@ -2356,7 +2356,7 @@ extern void dtrace_membar_producer(void); extern void dtrace_membar_consumer(void); extern void (*dtrace_cpu_init)(processorid_t); -#if defined(sun) +#ifdef illumos extern void (*dtrace_modload)(modctl_t *); extern void (*dtrace_modunload)(modctl_t *); #endif @@ -2370,7 +2370,7 @@ extern void (*dtrace_debugger_init)(void); extern void (*dtrace_debugger_fini)(void); extern dtrace_cacheid_t dtrace_predcache_id; -#if defined(sun) +#ifdef illumos extern hrtime_t dtrace_gethrtime(void); #else void dtrace_debug_printf(const char *, ...) __printflike(1, 2); @@ -2399,7 +2399,7 @@ extern int dtrace_blksuword32(uintptr_t, uint32_t *, int); extern void dtrace_getfsr(uint64_t *); #endif -#if !defined(sun) +#ifndef illumos extern void dtrace_helpers_duplicate(proc_t *, proc_t *); extern void dtrace_helpers_destroy(proc_t *); #endif diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h index f9e96895c46c..a65d1ae16c18 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h @@ -50,7 +50,7 @@ extern "C" { */ #include -#if !defined(sun) +#ifndef illumos #ifdef __sparcv9 typedef uint32_t pc_t; #else @@ -1122,7 +1122,7 @@ typedef struct dtrace_cred { * dtrace_state structure. */ struct dtrace_state { -#if defined(sun) +#ifdef illumos dev_t dts_dev; /* device */ #else struct cdev *dts_dev; /* device */ @@ -1140,7 +1140,7 @@ struct dtrace_state { int dts_nspeculations; /* number of speculations */ int dts_naggregations; /* number of aggregations */ dtrace_aggregation_t **dts_aggregations; /* aggregation array */ -#if defined(sun) +#ifdef illumos vmem_t *dts_aggid_arena; /* arena for aggregation IDs */ #else struct unrhdr *dts_aggid_arena; /* arena for aggregation IDs */ @@ -1152,7 +1152,7 @@ struct dtrace_state { uint32_t dts_dblerrors; /* errors in ERROR probes */ uint32_t dts_reserve; /* space reserved for END */ hrtime_t dts_laststatus; /* time of last status */ -#if defined(sun) +#ifdef illumos cyclic_id_t dts_cleaner; /* cleaning cyclic */ cyclic_id_t dts_deadman; /* deadman cyclic */ #else @@ -1270,7 +1270,7 @@ typedef struct dtrace_toxrange { uintptr_t dtt_limit; /* limit of toxic range */ } dtrace_toxrange_t; -#if defined(sun) +#ifdef illumos extern uint64_t dtrace_getarg(int, int); #else extern uint64_t __noinline dtrace_getarg(int, int); @@ -1300,7 +1300,7 @@ extern void dtrace_probe_error(dtrace_state_t *, dtrace_epid_t, int, int, int, uintptr_t); extern int dtrace_assfail(const char *, const char *, int); extern int dtrace_attached(void); -#if defined(sun) +#ifdef illumos extern hrtime_t dtrace_gethrestime(void); #endif diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap.h b/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap.h index 431307f46a2b..ec3582f5daa8 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap.h @@ -37,7 +37,7 @@ extern "C" { #endif -#if defined(sun) +#ifdef illumos #define FASTTRAPIOC (('m' << 24) | ('r' << 16) | ('f' << 8)) #define FASTTRAPIOC_MAKEPROBE (FASTTRAPIOC | 1) #define FASTTRAPIOC_GETINSTR (FASTTRAPIOC | 2) diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h b/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h index 6f591fa83dda..cae919377c20 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h @@ -79,7 +79,7 @@ extern "C" { * until it exits. */ -#if !defined(sun) +#ifndef illumos typedef struct fasttrap_scrblock { vm_offset_t ftsb_addr; /* address of a scratch block */ LIST_ENTRY(fasttrap_scrblock) ftsb_next;/* next block in list */ @@ -99,7 +99,7 @@ typedef struct fasttrap_proc { uint64_t ftpc_rcount; /* count of extant providers */ kmutex_t ftpc_mtx; /* lock on all but acount */ struct fasttrap_proc *ftpc_next; /* next proc in hash chain */ -#if !defined(sun) +#ifndef illumos LIST_HEAD(, fasttrap_scrblock) ftpc_scrblks; /* mapped scratch blocks */ LIST_HEAD(, fasttrap_scrspace) ftpc_fscr; /* free scratch space */ LIST_HEAD(, fasttrap_scrspace) ftpc_ascr; /* used scratch space */ @@ -198,7 +198,7 @@ typedef struct fasttrap_hash { #endif extern void fasttrap_sigtrap(proc_t *, kthread_t *, uintptr_t); -#if !defined(sun) +#ifndef illumos extern fasttrap_scrspace_t *fasttrap_scraddr(struct thread *, fasttrap_proc_t *); #endif diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h b/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h index d70a760683d9..114c9665bac7 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h @@ -235,7 +235,7 @@ extern "C" { /* * Define the appropriate "processor characteristics" */ -#if defined(sun) +#ifdef illumos #define _LITTLE_ENDIAN #endif #define _STACK_GROWS_DOWNWARD @@ -302,7 +302,7 @@ extern "C" { /* * Define the appropriate "processor characteristics" */ -#if defined(sun) +#ifdef illumos #define _LITTLE_ENDIAN #endif #define _STACK_GROWS_DOWNWARD @@ -508,7 +508,7 @@ extern "C" { * Define the appropriate "processor characteristics" shared between * all Solaris on SPARC systems. */ -#if defined(sun) +#ifdef illumos #define _BIG_ENDIAN #endif #define _STACK_GROWS_DOWNWARD diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/procset.h b/sys/cddl/contrib/opensolaris/uts/common/sys/procset.h index 8c5739b3bc28..a7d58e52534c 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/procset.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/procset.h @@ -143,7 +143,7 @@ typedef struct procset { #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ -#if defined(sun) +#ifdef illumos #ifdef _KERNEL struct proc; diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent.h b/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent.h index 3558c2a7f03d..777d7480cf08 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent.h @@ -214,7 +214,7 @@ typedef struct sysevent_value { #define EVCH_SET_CHAN_LEN 3 /* Set event queue length */ #define EVCH_CMD_LAST EVCH_SET_CHAN_LEN /* Last command */ -#ifdef sun +#ifdef illumos /* * Shared user/kernel event channel interface definitions */ @@ -228,11 +228,11 @@ extern int sysevent_evc_publish(evchan_t *, const char *, const char *, extern int sysevent_evc_control(evchan_t *, int, ...); extern int sysevent_evc_setpropnvl(evchan_t *, nvlist_t *); extern int sysevent_evc_getpropnvl(evchan_t *, nvlist_t **); -#endif /* sun */ +#endif /* illumos */ #ifndef _KERNEL -#ifdef sun +#ifdef illumos /* * Userland-only event channel interfaces */ @@ -254,7 +254,7 @@ extern void sysevent_subattr_thrsetup(sysevent_subattr_t *, extern int sysevent_evc_xsubscribe(evchan_t *, const char *, const char *, int (*)(sysevent_t *, void *), void *, uint32_t, sysevent_subattr_t *); -#endif /* sun */ +#endif /* illumos */ #else @@ -270,7 +270,7 @@ extern int sysevent_add_attr(sysevent_attr_list_t **, char *, extern void sysevent_free_attr(sysevent_attr_list_t *); extern int sysevent_attach_attributes(sysevent_t *, sysevent_attr_list_t *); extern void sysevent_detach_attributes(sysevent_t *); -#ifdef sun +#ifdef illumos extern char *sysevent_get_class_name(sysevent_t *); extern char *sysevent_get_subclass_name(sysevent_t *); extern uint64_t sysevent_get_seq(sysevent_t *); @@ -278,7 +278,7 @@ extern void sysevent_get_time(sysevent_t *, hrtime_t *); extern size_t sysevent_get_size(sysevent_t *); extern char *sysevent_get_pub(sysevent_t *); extern int sysevent_get_attr_list(sysevent_t *, nvlist_t **); -#endif /* sun */ +#endif /* illumos */ #endif /* _KERNEL */ diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h b/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h index 0d98b263583b..300351482c10 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h @@ -112,7 +112,7 @@ extern unsigned char bcd_to_byte[256]; #define L_MAXMIN L_MAXMIN32 #endif -#ifdef sun +#ifdef illumos #ifdef _KERNEL /* major part of a device internal to the kernel */ @@ -172,7 +172,7 @@ extern unsigned char bcd_to_byte[256]; #define getemajor(x) (major_t)((((dev_t)(x) >> L_BITSMINOR) > L_MAXMAJ) ? \ NODEV : (((dev_t)(x) >> L_BITSMINOR) & L_MAXMAJ)) #define geteminor(x) (minor_t)((x) & L_MAXMIN) -#endif /* sun */ +#endif /* illumos */ /* * These are versions of the kernel routines for compressing and diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/u8_textprep.h b/sys/cddl/contrib/opensolaris/uts/common/sys/u8_textprep.h index 77c9c0bf84fe..1496fa356835 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/u8_textprep.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/u8_textprep.h @@ -36,7 +36,7 @@ extern "C" { #endif -#ifdef sun +#ifdef illumos /* * Unicode encoding conversion functions and their macros. */ @@ -58,7 +58,7 @@ extern int uconv_u32tou16(const uint32_t *, size_t *, uint16_t *, size_t *, extern int uconv_u32tou8(const uint32_t *, size_t *, uchar_t *, size_t *, int); extern int uconv_u8tou16(const uchar_t *, size_t *, uint16_t *, size_t *, int); extern int uconv_u8tou32(const uchar_t *, size_t *, uint32_t *, size_t *, int); -#endif /* sun */ +#endif /* illumos */ /* * UTF-8 text preparation functions and their macros. diff --git a/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c b/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c index 8df1090da813..5d60a07cdc9a 100644 --- a/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c +++ b/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c @@ -28,7 +28,7 @@ * Use is subject to license terms. */ -#if defined(sun) +#ifdef illumos #pragma ident "%Z%%M% %I% %E% SMI" #endif @@ -37,7 +37,7 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #include #include @@ -53,7 +53,7 @@ #include #endif #include -#if defined(sun) +#ifdef illumos #include #include #else @@ -97,7 +97,7 @@ uwrite(proc_t *p, void *kaddr, size_t len, uintptr_t uaddr) return (proc_ops(UIO_WRITE, p, kaddr, uaddr, len)); } -#endif /* sun */ +#endif /* illumos */ #ifdef __i386__ #define r_rax r_eax #define r_rbx r_ebx @@ -747,11 +747,11 @@ fasttrap_return_common(struct reg *rp, uintptr_t pc, pid_t pid, fasttrap_tracepoint_t *tp; fasttrap_bucket_t *bucket; fasttrap_id_t *id; -#if defined(sun) +#ifdef illumos kmutex_t *pid_mtx; #endif -#if defined(sun) +#ifdef illumos pid_mtx = &cpu_core[CPU->cpu_id].cpuc_pid_lock; mutex_enter(pid_mtx); #endif @@ -769,7 +769,7 @@ fasttrap_return_common(struct reg *rp, uintptr_t pc, pid_t pid, * is not essential to the correct execution of the process. */ if (tp == NULL) { -#if defined(sun) +#ifdef illumos mutex_exit(pid_mtx); #endif return; @@ -792,7 +792,7 @@ fasttrap_return_common(struct reg *rp, uintptr_t pc, pid_t pid, rp->r_rax, rp->r_rbx, 0, 0); } -#if defined(sun) +#ifdef illumos mutex_exit(pid_mtx); #endif } @@ -800,7 +800,7 @@ fasttrap_return_common(struct reg *rp, uintptr_t pc, pid_t pid, static void fasttrap_sigsegv(proc_t *p, kthread_t *t, uintptr_t addr) { -#if defined(sun) +#ifdef illumos sigqueue_t *sqp = kmem_zalloc(sizeof (sigqueue_t), KM_SLEEP); sqp->sq_info.si_signo = SIGSEGV; @@ -1001,13 +1001,13 @@ int fasttrap_pid_probe(struct reg *rp) { proc_t *p = curproc; -#if !defined(sun) +#ifndef illumos proc_t *pp; #endif uintptr_t pc = rp->r_rip - 1; uintptr_t new_pc = 0; fasttrap_bucket_t *bucket; -#if defined(sun) +#ifdef illumos kmutex_t *pid_mtx; #endif fasttrap_tracepoint_t *tp, tp_local; @@ -1044,7 +1044,7 @@ fasttrap_pid_probe(struct reg *rp) * parent. We know that there's only one thread of control in such a * process: this one. */ -#if defined(sun) +#ifdef illumos while (p->p_flag & SVFORK) { p = p->p_parent; } @@ -1082,7 +1082,7 @@ fasttrap_pid_probe(struct reg *rp) * fasttrap_ioctl), or somehow we have mislaid this tracepoint. */ if (tp == NULL) { -#if defined(sun) +#ifdef illumos mutex_exit(pid_mtx); #else _PRELE(p); @@ -1209,7 +1209,7 @@ fasttrap_pid_probe(struct reg *rp) * tracepoint again later if we need to light up any return probes. */ tp_local = *tp; -#if defined(sun) +#ifdef illumos mutex_exit(pid_mtx); #else PROC_UNLOCK(p); @@ -1537,7 +1537,7 @@ fasttrap_pid_probe(struct reg *rp) uint8_t scratch[2 * FASTTRAP_MAX_INSTR_SIZE + 7]; #endif uint_t i = 0; -#if defined(sun) +#ifdef illumos klwp_t *lwp = ttolwp(curthread); /* @@ -1558,7 +1558,7 @@ fasttrap_pid_probe(struct reg *rp) addr = USD_GETBASE(&lwp->lwp_pcb.pcb_gsdesc); addr += sizeof (void *); #endif -#else +#else /* !illumos */ fasttrap_scrspace_t *scrspace; scrspace = fasttrap_scraddr(curthread, tp->ftt_proc); if (scrspace == NULL) { @@ -1574,7 +1574,7 @@ fasttrap_pid_probe(struct reg *rp) break; } addr = scrspace->ftss_addr; -#endif /* sun */ +#endif /* illumos */ /* * Generic Instruction Tracing @@ -1760,7 +1760,7 @@ fasttrap_pid_probe(struct reg *rp) ASSERT(i <= sizeof (scratch)); -#if defined(sun) +#ifdef illumos if (fasttrap_copyout(scratch, (char *)addr, i)) { #else if (uwrite(p, scratch, i, addr)) { @@ -1822,7 +1822,7 @@ done: rp->r_rip = new_pc; -#if !defined(sun) +#ifndef illumos PROC_LOCK(p); proc_write_regs(curthread, rp); _PRELE(p); @@ -1844,7 +1844,7 @@ fasttrap_return_probe(struct reg *rp) curthread->t_dtrace_scrpc = 0; curthread->t_dtrace_astpc = 0; -#if defined(sun) +#ifdef illumos /* * Treat a child created by a call to vfork(2) as if it were its * parent. We know that there's only one thread of control in such a @@ -1917,7 +1917,7 @@ fasttrap_getreg(struct reg *rp, uint_t reg) case REG_ERR: return (rp->r_err); case REG_RIP: return (rp->r_rip); case REG_CS: return (rp->r_cs); -#if defined(sun) +#ifdef illumos case REG_RFL: return (rp->r_rfl); #endif case REG_RSP: return (rp->r_rsp); -- cgit v1.2.3