From 9939af86bc5ca7d2bd51aabc92453feb1a9b1984 Mon Sep 17 00:00:00 2001 From: mav Date: Sun, 20 Mar 2016 20:00:25 +0000 Subject: [PATCH] MFC r277300 (by smh): 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. git-svn-id: svn://svn.freebsd.org/base/stable/10@297077 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- cddl/contrib/opensolaris/cmd/dtrace/dtrace.c | 32 +- .../opensolaris/cmd/lockstat/lockstat.c | 24 +- cddl/contrib/opensolaris/cmd/lockstat/sym.c | 17 +- .../opensolaris/cmd/mdb/tools/common/die.c | 8 +- .../opensolaris/cmd/mdb/tools/common/util.h | 2 +- .../opensolaris/cmd/plockstat/plockstat.c | 14 +- cddl/contrib/opensolaris/cmd/zfs/zfs_main.c | 12 +- .../opensolaris/cmd/zpool/zpool_vdev.c | 18 +- .../opensolaris/common/util/strtolctype.h | 2 +- .../opensolaris/lib/libctf/common/ctf_lib.c | 10 +- .../opensolaris/lib/libdtrace/common/drti.c | 26 +- .../lib/libdtrace/common/dt_aggregate.c | 4 +- .../opensolaris/lib/libdtrace/common/dt_cc.c | 10 +- .../lib/libdtrace/common/dt_consume.c | 6 +- .../opensolaris/lib/libdtrace/common/dt_dof.c | 4 +- .../lib/libdtrace/common/dt_error.c | 2 +- .../lib/libdtrace/common/dt_handle.c | 2 +- .../lib/libdtrace/common/dt_ident.c | 6 +- .../lib/libdtrace/common/dt_impl.h | 14 +- .../opensolaris/lib/libdtrace/common/dt_lex.l | 10 +- .../lib/libdtrace/common/dt_link.c | 28 +- .../opensolaris/lib/libdtrace/common/dt_map.c | 8 +- .../lib/libdtrace/common/dt_module.c | 24 +- .../lib/libdtrace/common/dt_open.c | 54 ++-- .../lib/libdtrace/common/dt_options.c | 6 +- .../lib/libdtrace/common/dt_parser.c | 2 +- .../opensolaris/lib/libdtrace/common/dt_pid.c | 42 +-- .../lib/libdtrace/common/dt_pragma.c | 2 +- .../lib/libdtrace/common/dt_printf.c | 18 +- .../lib/libdtrace/common/dt_proc.c | 58 ++-- .../lib/libdtrace/common/dt_program.c | 2 +- .../lib/libdtrace/common/dt_provider.c | 4 +- .../lib/libdtrace/common/dt_subr.c | 16 +- .../lib/libdtrace/common/dt_work.c | 2 +- .../opensolaris/lib/libdtrace/common/dtrace.h | 6 +- .../lib/libdtrace/i386/dt_isadep.c | 10 +- .../opensolaris/lib/libgen/common/gmatch.c | 4 +- .../opensolaris/lib/libzfs/common/libzfs.h | 4 +- .../lib/libzfs/common/libzfs_dataset.c | 28 +- .../lib/libzfs/common/libzfs_diff.c | 2 +- .../lib/libzfs/common/libzfs_import.c | 18 +- .../lib/libzfs/common/libzfs_mount.c | 24 +- .../lib/libzfs/common/libzfs_pool.c | 18 +- .../lib/libzfs/common/libzfs_sendrecv.c | 2 +- .../lib/libzfs/common/libzfs_util.c | 6 +- .../opensolaris/tools/ctf/cvt/barrier.c | 8 +- .../opensolaris/tools/ctf/cvt/barrier.h | 2 +- .../opensolaris/tools/ctf/cvt/ctfconvert.c | 4 +- .../opensolaris/tools/ctf/cvt/ctfmerge.c | 12 +- .../contrib/opensolaris/tools/ctf/cvt/dwarf.c | 4 +- .../opensolaris/tools/ctf/cvt/output.c | 6 +- .../contrib/opensolaris/tools/ctf/cvt/tdata.c | 2 +- cddl/contrib/opensolaris/tools/ctf/cvt/util.c | 2 +- .../opensolaris/uts/common/dtrace/dtrace.c | 274 +++++++++--------- .../opensolaris/uts/common/dtrace/fasttrap.c | 110 +++---- .../contrib/opensolaris/uts/common/fs/gfs.c | 14 +- .../opensolaris/uts/common/fs/zfs/arc.c | 20 +- .../opensolaris/uts/common/fs/zfs/dmu.c | 8 +- .../opensolaris/uts/common/fs/zfs/dnode.c | 6 +- .../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 +- .../uts/common/fs/zfs/sys/spa_impl.h | 4 +- .../opensolaris/uts/common/fs/zfs/sys/zvol.h | 8 +- .../opensolaris/uts/common/fs/zfs/vdev.c | 4 +- .../opensolaris/uts/common/fs/zfs/zfs_acl.c | 2 +- .../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 +-- .../uts/common/fs/zfs/zfs_replay.c | 6 +- .../uts/common/fs/zfs/zfs_vfsops.c | 14 +- .../opensolaris/uts/common/fs/zfs/zfs_vnops.c | 38 +-- .../opensolaris/uts/common/fs/zfs/zfs_znode.c | 28 +- .../contrib/opensolaris/uts/common/os/callb.c | 4 +- .../contrib/opensolaris/uts/common/os/fm.c | 16 +- .../contrib/opensolaris/uts/common/sys/ctf.h | 2 +- .../opensolaris/uts/common/sys/ctf_api.h | 2 +- .../opensolaris/uts/common/sys/dtrace.h | 22 +- .../opensolaris/uts/common/sys/dtrace_impl.h | 12 +- .../opensolaris/uts/common/sys/fasttrap.h | 2 +- .../uts/common/sys/fasttrap_impl.h | 6 +- .../opensolaris/uts/common/sys/isa_defs.h | 6 +- .../opensolaris/uts/common/sys/procset.h | 2 +- .../opensolaris/uts/common/sys/sysevent.h | 12 +- .../opensolaris/uts/common/sys/sysmacros.h | 4 +- .../opensolaris/uts/common/sys/u8_textprep.h | 4 +- .../uts/intel/dtrace/fasttrap_isa.c | 42 +-- sys/cddl/dev/dtrace/amd64/instr_size.c | 6 +- sys/cddl/dev/dtrace/dtrace_ioctl.c | 10 +- sys/cddl/dev/dtrace/i386/instr_size.c | 6 +- sys/cddl/dev/dtrace/x86/regset.h | 12 +- 91 files changed, 739 insertions(+), 744 deletions(-) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c index 3a954ed40..d8bdaa61f 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c @@ -43,11 +43,11 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #endif #include -#if defined(sun) +#ifdef illumos #include #endif @@ -101,7 +101,7 @@ static int g_grabanon = 0; static const char *g_ofile = NULL; static FILE *g_ofp; static dtrace_hdl_t *g_dtp; -#if defined(sun) +#ifdef illumos static char *g_etcfile = "/etc/system"; static const char *g_etcbegin = "* vvvv Added by DTrace"; static const char *g_etcend = "* ^^^^ Added by DTrace"; @@ -211,7 +211,7 @@ fatal(const char *fmt, ...) static void dfatal(const char *fmt, ...) { -#if !defined(sun) && defined(NEED_ERRLOC) +#if !defined(illumos) && defined(NEED_ERRLOC) char *p_errfile = NULL; int errline = 0; #endif @@ -232,7 +232,7 @@ dfatal(const char *fmt, ...) (void) fprintf(stderr, "%s\n", dtrace_errmsg(g_dtp, dtrace_errno(g_dtp))); } -#if !defined(sun) && defined(NEED_ERRLOC) +#if !defined(illumos) && defined(NEED_ERRLOC) dt_get_errloc(g_dtp, &p_errfile, &errline); if (p_errfile != NULL) printf("File '%s', line %d\n", p_errfile, errline); @@ -397,7 +397,7 @@ dof_prune(const char *fname) free(buf); } -#if defined(sun) +#ifdef illumos static void etcsystem_prune(void) { @@ -508,7 +508,7 @@ etcsystem_add(void) error("added forceload directives to %s\n", g_ofile); } -#endif +#endif /* illumos */ static void print_probe_info(const dtrace_probeinfo_t *p) @@ -643,7 +643,7 @@ anon_prog(const dtrace_cmd_t *dcp, dof_hdr_t *dof, int n) p = (uchar_t *)dof; q = p + dof->dofh_loadsz; -#if defined(sun) +#ifdef illumos oprintf("dof-data-%d=0x%x", n, *p++); while (p < q) @@ -793,7 +793,7 @@ compile_str(dtrace_cmd_t *dcp) static void prochandler(struct ps_prochandle *P, const char *msg, void *arg) { -#if defined(sun) +#ifdef illumos const psinfo_t *prp = Ppsinfo(P); int pid = Pstatus(P)->pr_pid; char name[SIG2STR_MAX]; @@ -807,13 +807,13 @@ prochandler(struct ps_prochandle *P, const char *msg, void *arg) return; } -#if defined(sun) +#ifdef illumos switch (Pstate(P)) { #else switch (proc_state(P)) { #endif case PS_UNDEAD: -#if defined(sun) +#ifdef illumos /* * Ideally we would like to always report pr_wstat here, but it * isn't possible given current /proc semantics. If we grabbed @@ -831,7 +831,7 @@ prochandler(struct ps_prochandle *P, const char *msg, void *arg) notice("pid %d terminated by %d\n", pid, WTERMSIG(wstatus)); #endif -#if defined(sun) +#ifdef illumos } else if (prp != NULL && WEXITSTATUS(prp->pr_wstat) != 0) { notice("pid %d exited with status %d\n", pid, WEXITSTATUS(prp->pr_wstat)); @@ -1238,7 +1238,7 @@ installsighands(void) if (sigaction(SIGTERM, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN) (void) sigaction(SIGTERM, &act, NULL); -#if !defined(sun) +#ifndef illumos if (sigaction(SIGPIPE, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN) (void) sigaction(SIGPIPE, &act, NULL); @@ -1720,7 +1720,7 @@ main(int argc, char *argv[]) case DMODE_ANON: if (g_ofile == NULL) -#if defined(sun) +#ifdef illumos g_ofile = "/kernel/drv/dtrace.conf"; #else /* @@ -1732,7 +1732,7 @@ main(int argc, char *argv[]) #endif dof_prune(g_ofile); /* strip out any old DOF directives */ -#if defined(sun) +#ifdef illumos etcsystem_prune(); /* string out any forceload directives */ #endif @@ -1765,7 +1765,7 @@ main(int argc, char *argv[]) * that itself contains a #pragma D option quiet. */ error("saved anonymous enabling in %s\n", g_ofile); -#if defined(sun) +#ifdef illumos etcsystem_add(); error("run update_drv(1M) or reboot to enable changes\n"); #endif diff --git a/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c b/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c index 07f7cda1f..4f2f2c724 100644 --- a/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c +++ b/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c @@ -46,10 +46,9 @@ #include #include -#if defined(sun) +#ifdef illumos #define GETOPT_EOF EOF #else -/* FreeBSD */ #include #include @@ -57,7 +56,7 @@ #define GETOPT_EOF (-1) typedef uintptr_t pc_t; -#endif /* defined(sun) */ +#endif #define LOCKSTAT_OPTSTR "x:bths:n:d:i:l:f:e:ckwWgCHEATID:RpPo:V" @@ -226,10 +225,9 @@ static ls_event_info_t g_event_info[LS_MAX_EVENTS] = { { 'H', "Lock", "Unknown event (type 53)", "units" }, { 'H', "Lock", "Unknown event (type 54)", "units" }, { 'H', "Lock", "Unknown event (type 55)", "units" }, -#if defined(sun) +#ifdef illumos { 'I', "CPU+PIL", "Profiling interrupt", "nsec", #else - /* FreeBSD */ { 'I', "CPU+Pri_Class", "Profiling interrupt", "nsec", #endif "profile:::profile-97", NULL }, @@ -243,7 +241,7 @@ static ls_event_info_t g_event_info[LS_MAX_EVENTS] = { { 'E', "Lock", "Lockstat record failure", "(N/A)" }, }; -#if !defined(sun) +#ifndef illumos static char *g_pri_class[] = { "", "Intr", @@ -610,7 +608,7 @@ filter_add(char **filt, char *what, uintptr_t base, uintptr_t size) *filt[0] = '\0'; } -#if defined(sun) +#ifdef illumos (void) sprintf(c, "%s(%s >= 0x%p && %s < 0x%p)", *filt[0] != '\0' ? " || " : "", what, (void *)base, what, (void *)(base + size)); #else @@ -688,7 +686,7 @@ dprog_addevent(int event) * the number of nanoseconds) is the number of nanoseconds * late -- and it's stored in arg2. */ -#if defined(sun) +#ifdef illumos arg0 = "(uintptr_t)curthread->t_cpu + \n" "\t curthread->t_cpu->cpu_profile_pil"; #else @@ -836,7 +834,7 @@ dprog_compile() } static void -#if defined(sun) +#ifdef illumos status_fire(void) #else status_fire(int i) @@ -1435,7 +1433,7 @@ main(int argc, char **argv) exit(127); } -#if defined(sun) +#ifdef illumos while (waitpid(child, &status, WEXITED) != child) #else while (waitpid(child, &status, 0) != child) @@ -1480,7 +1478,7 @@ main(int argc, char **argv) dfail("failed to walk aggregate"); } -#if defined(sun) +#ifdef illumos if ((data_buf = memalign(sizeof (uint64_t), (g_nrecs + 1) * g_recsize)) == NULL) #else @@ -1512,7 +1510,7 @@ main(int argc, char **argv) if (g_gflag) { lsrec_t *newlsp, *oldlsp; -#if defined(sun) +#ifdef illumos newlsp = memalign(sizeof (uint64_t), g_nrecs_used * LS_TIME * (g_stkdepth + 1)); #else @@ -1676,7 +1674,7 @@ format_symbol(char *buf, uintptr_t addr, int show_size) else if (symoff == 0) (void) sprintf(buf, "%s", symname); else if (symoff < 16 && bcmp(symname, "cpu[", 4) == 0) /* CPU+PIL */ -#if defined(sun) +#ifdef illumos (void) sprintf(buf, "%s+%ld", symname, (long)symoff); #else (void) sprintf(buf, "%s+%s", symname, g_pri_class[(int)symoff]); diff --git a/cddl/contrib/opensolaris/cmd/lockstat/sym.c b/cddl/contrib/opensolaris/cmd/lockstat/sym.c index 78b27d2bd..5361607b5 100644 --- a/cddl/contrib/opensolaris/cmd/lockstat/sym.c +++ b/cddl/contrib/opensolaris/cmd/lockstat/sym.c @@ -42,12 +42,11 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #include #else -/* FreeBSD */ #include #include #endif @@ -63,7 +62,7 @@ static syment_t *symbol_table; static int nsyms, maxsyms; static char maxsymname[64]; -#if defined(sun) +#ifdef illumos #ifdef _ELF64 #define elf_getshdr elf64_getshdr #else @@ -102,7 +101,7 @@ remove_symbol(uintptr_t addr) sep->addr = 0; } -#if defined(sun) +#ifdef illumos static void fake_up_certain_popular_kernel_symbols(void) { @@ -130,8 +129,7 @@ fake_up_certain_popular_kernel_symbols(void) } (void) kstat_close(kc); } -#else -/* FreeBSD */ +#else /* !illumos */ static void fake_up_certain_popular_kernel_symbols(void) { @@ -148,7 +146,7 @@ fake_up_certain_popular_kernel_symbols(void) add_symbol(name, addr, sizeof (uintptr_t)); } } -#endif /* !defined(sun) */ +#endif /* illumos */ static int symcmp(const void *p1, const void *p2) @@ -174,7 +172,7 @@ symtab_init(void) int fd; int i; int strindex = -1; -#if !defined(sun) +#ifndef illumos void *ksyms; size_t sz; #endif @@ -182,12 +180,11 @@ symtab_init(void) if ((fd = open("/dev/ksyms", O_RDONLY)) == -1) return (-1); -#if defined(sun) +#ifdef illumos (void) elf_version(EV_CURRENT); elf = elf_begin(fd, ELF_C_READ, NULL); #else - /* FreeBSD */ /* * XXX - libelf needs to be fixed so it will work with * non 'ordinary' files like /dev/ksyms. The following diff --git a/cddl/contrib/opensolaris/cmd/mdb/tools/common/die.c b/cddl/contrib/opensolaris/cmd/mdb/tools/common/die.c index 602969e1a..7bfc06bf2 100644 --- a/cddl/contrib/opensolaris/cmd/mdb/tools/common/die.c +++ b/cddl/contrib/opensolaris/cmd/mdb/tools/common/die.c @@ -40,7 +40,7 @@ die(char *format, ...) { va_list ap; int err = errno; -#if !defined(sun) +#ifndef illumos const char *progname = getprogname(); #endif @@ -54,7 +54,7 @@ die(char *format, ...) if (format[strlen(format) - 1] != '\n') (void) fprintf(stderr, ": %s\n", strerror(err)); -#if defined(__FreeBSD__) +#ifndef illumos exit(0); #else exit(1); @@ -65,7 +65,7 @@ void elfdie(char *format, ...) { va_list ap; -#if !defined(sun) +#ifndef illumos const char *progname = getprogname(); #endif @@ -79,7 +79,7 @@ elfdie(char *format, ...) if (format[strlen(format) - 1] != '\n') (void) fprintf(stderr, ": %s\n", elf_errmsg(elf_errno())); -#if defined(__FreeBSD__) +#ifndef illumos exit(0); #else exit(1); diff --git a/cddl/contrib/opensolaris/cmd/mdb/tools/common/util.h b/cddl/contrib/opensolaris/cmd/mdb/tools/common/util.h index a0932ada0..737d2221f 100644 --- a/cddl/contrib/opensolaris/cmd/mdb/tools/common/util.h +++ b/cddl/contrib/opensolaris/cmd/mdb/tools/common/util.h @@ -40,7 +40,7 @@ extern int findelfsecidx(Elf *, char *); extern void die(char *, ...); extern void elfdie(char *, ...); -#if defined(sun) +#ifdef illumos extern const char *progname; #endif diff --git a/cddl/contrib/opensolaris/cmd/plockstat/plockstat.c b/cddl/contrib/opensolaris/cmd/plockstat/plockstat.c index 12884682c..8dfb0ba25 100644 --- a/cddl/contrib/opensolaris/cmd/plockstat/plockstat.c +++ b/cddl/contrib/opensolaris/cmd/plockstat/plockstat.c @@ -24,7 +24,7 @@ * Use is subject to license terms. */ -#if defined(sun) +#ifdef illumos #pragma ident "%Z%%M% %I% %E% SMI" #endif @@ -505,7 +505,7 @@ getsym(struct ps_prochandle *P, uintptr_t addr, char *buf, size_t size, { char name[256]; GElf_Sym sym; -#if defined(sun) +#ifdef illumos prsyminfo_t info; #else prmap_t *map; @@ -518,7 +518,7 @@ getsym(struct ps_prochandle *P, uintptr_t addr, char *buf, size_t size, (void) snprintf(buf, size, "%#lx", addr); return (0); } -#if defined(sun) +#ifdef illumos if (info.prs_object == NULL) info.prs_object = ""; @@ -668,7 +668,7 @@ process_aggregate(const dtrace_aggdata_t **aggsdata, int naggvars, void *arg) static void prochandler(struct ps_prochandle *P, const char *msg, void *arg) { -#if defined(sun) +#ifdef illumos const psinfo_t *prp = Ppsinfo(P); int pid = Pstatus(P)->pr_pid; #else @@ -773,7 +773,7 @@ intr(int signo) int main(int argc, char **argv) { -#if defined(sun) +#ifdef illumos ucred_t *ucp; #endif int err; @@ -785,7 +785,7 @@ main(int argc, char **argv) g_pname = basename(argv[0]); argv[0] = g_pname; /* rewrite argv[0] for getopt errors */ -#if defined(sun) +#ifdef illumos /* * Make sure we have the required dtrace_proc privilege. */ @@ -988,7 +988,7 @@ main(int argc, char **argv) if (opt_v) (void) printf("%s: tracing enabled for pid %d\n", g_pname, -#if defined(sun) +#ifdef illumos (int)Pstatus(g_pr)->pr_pid); #else (int)proc_getpid(g_pr)); diff --git a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c index 54135f1ab..cb6ace4ee 100644 --- a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c +++ b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c @@ -65,7 +65,7 @@ #include #include #include -#ifdef sun +#ifdef illumos #include #include #include @@ -2433,7 +2433,7 @@ userspace_cb(void *arg, const char *domain, uid_t rid, uint64_t space) /* SMB */ char sid[ZFS_MAXNAMELEN + 32]; uid_t id; -#ifdef sun +#ifdef illumos int err; int flag = IDMAP_REQ_FLG_USE_CACHE; #endif @@ -2444,17 +2444,17 @@ userspace_cb(void *arg, const char *domain, uid_t rid, uint64_t space) if (prop == ZFS_PROP_GROUPUSED || prop == ZFS_PROP_GROUPQUOTA) { type = USTYPE_SMB_GRP; -#ifdef sun +#ifdef illumos err = sid_to_id(sid, B_FALSE, &id); #endif } else { type = USTYPE_SMB_USR; -#ifdef sun +#ifdef illumos err = sid_to_id(sid, B_TRUE, &id); #endif } -#ifdef sun +#ifdef illumos if (err == 0) { rid = id; if (!cb->cb_sid2posix) { @@ -6264,7 +6264,7 @@ unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual) /* * Search for the given (major,minor) pair in the mount table. */ -#ifdef sun +#ifdef illumos rewind(mnttab_file); while ((ret = getextmntent(mnttab_file, &entry, 0)) == 0) { if (entry.mnt_major == major(statbuf.st_dev) && diff --git a/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c b/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c index a7747f67e..ee6b01d5f 100644 --- a/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c +++ b/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c @@ -112,7 +112,7 @@ vdev_error(const char *fmt, ...) va_end(ap); } -#ifdef sun +#ifdef illumos static void libdiskmgt_error(int error) { @@ -274,7 +274,7 @@ check_device(const char *path, boolean_t force, boolean_t isspare) return (check_slice(path, force, B_FALSE, isspare)); } -#endif /* sun */ +#endif /* illumos */ /* * Check that a file is valid. All we can do in this case is check that it's @@ -290,7 +290,7 @@ check_file(const char *file, boolean_t force, boolean_t isspare) pool_state_t state; boolean_t inuse; -#ifdef sun +#ifdef illumos if (dm_inuse_swap(file, &err)) { if (err) libdiskmgt_error(err); @@ -377,7 +377,7 @@ check_device(const char *name, boolean_t force, boolean_t isspare) static boolean_t is_whole_disk(const char *arg) { -#ifdef sun +#ifdef illumos struct dk_gpt *label; int fd; char path[MAXPATHLEN]; @@ -911,7 +911,7 @@ check_replication(nvlist_t *config, nvlist_t *newroot) return (ret); } -#ifdef sun +#ifdef illumos /* * Go through and find any whole disks in the vdev specification, labelling them * as appropriate. When constructing the vdev spec, we were unable to open this @@ -1015,7 +1015,7 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv) return (0); } -#endif /* sun */ +#endif /* illumos */ /* * Determine if the given path is a hot spare within the given configuration. @@ -1094,7 +1094,7 @@ is_device_in_use(nvlist_t *config, nvlist_t *nv, boolean_t force, * regardless of what libdiskmgt or zpool_in_use() says. */ if (replacing) { -#ifdef sun +#ifdef illumos if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK, &wholedisk) == 0 && wholedisk) (void) snprintf(buf, sizeof (buf), "%ss0", @@ -1418,7 +1418,7 @@ split_mirror_vdev(zpool_handle_t *zhp, char *newname, nvlist_t *props, return (NULL); } -#ifdef sun +#ifdef illumos if (!flags.dryrun && make_disks(zhp, newroot) != 0) { nvlist_free(newroot); return (NULL); @@ -1503,7 +1503,7 @@ make_root_vdev(zpool_handle_t *zhp, int force, int check_rep, return (NULL); } -#ifdef sun +#ifdef illumos /* * Run through the vdev specification and label any whole disks found. */ diff --git a/cddl/contrib/opensolaris/common/util/strtolctype.h b/cddl/contrib/opensolaris/common/util/strtolctype.h index a1d18367d..91609cede 100644 --- a/cddl/contrib/opensolaris/common/util/strtolctype.h +++ b/cddl/contrib/opensolaris/common/util/strtolctype.h @@ -44,7 +44,7 @@ extern "C" { * safe in probe context. */ -#if defined(sun) && (defined(_KERNEL) || defined(_BOOT)) +#if defined(illumos) && (defined(_KERNEL) || defined(_BOOT)) #define isalnum(ch) (isalpha(ch) || isdigit(ch)) #define isalpha(ch) (isupper(ch) || islower(ch)) diff --git a/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c b/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c index 58222670f..b9f512d37 100644 --- a/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c +++ b/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c @@ -34,14 +34,14 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #else #include #endif #include -#if defined(sun) +#ifdef illumos #ifdef _LP64 static const char *_libctf_zlib = "/usr/lib/64/libz.so"; #else @@ -58,7 +58,7 @@ static struct { static size_t _PAGESIZE; static size_t _PAGEMASK; -#if defined(sun) +#ifdef illumos #pragma init(_libctf_init) #else void _libctf_init(void) __attribute__ ((constructor)); @@ -66,7 +66,7 @@ void _libctf_init(void) __attribute__ ((constructor)); void _libctf_init(void) { -#if defined(sun) +#ifdef illumos const char *p = getenv("LIBCTF_DECOMPRESSOR"); if (p != NULL) @@ -87,7 +87,7 @@ _libctf_init(void) void * ctf_zopen(int *errp) { -#if defined(sun) +#ifdef illumos ctf_dprintf("decompressing CTF data using %s\n", _libctf_zlib); if (zlib.z_dlp != NULL) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c index b2854d2bb..1ee873b2a 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c @@ -56,13 +56,13 @@ */ static const char *devnamep = "/dev/dtrace/helper"; -#if defined(sun) +#ifdef illumos static const char *olddevname = "/devices/pseudo/dtrace@0:helper"; #endif static const char *modname; /* Name of this load object */ static int gen; /* DOF helper generation */ -#if defined(sun) +#ifdef illumos extern dof_hdr_t __SUNW_dof; /* DOF defined in the .SUNW_dof section */ #endif static boolean_t dof_init_debug = B_FALSE; /* From DTRACE_DOF_INIT_DEBUG */ @@ -90,7 +90,7 @@ dprintf(int debug, const char *fmt, ...) va_end(ap); } -#if !defined(sun) +#ifndef illumos static void fixsymbol(Elf *e, Elf_Data *data, size_t idx, int nprobes, char *buf, dof_sec_t *sec, int *fixedprobes, char *dofstrtab) @@ -120,7 +120,7 @@ fixsymbol(Elf *e, Elf_Data *data, size_t idx, int nprobes, char *buf, } #endif -#if defined(sun) +#ifdef illumos #pragma init(dtrace_dof_init) #else static void dtrace_dof_init(void) __attribute__ ((constructor)); @@ -129,7 +129,7 @@ static void dtrace_dof_init(void) __attribute__ ((constructor)); static void dtrace_dof_init(void) { -#if defined(sun) +#ifdef illumos dof_hdr_t *dof = &__SUNW_dof; #else dof_hdr_t *dof = NULL; @@ -141,7 +141,7 @@ dtrace_dof_init(void) #endif dof_helper_t dh; Link_map *lmp; -#if defined(sun) +#ifdef illumos Lmid_t lmid; #else u_long lmid = 0; @@ -151,7 +151,7 @@ dtrace_dof_init(void) #endif int fd; const char *p; -#if !defined(sun) +#ifndef illumos Elf *e; Elf_Scn *scn = NULL; Elf_Data *symtabdata = NULL, *dynsymdata = NULL, *dofdata = NULL; @@ -177,7 +177,7 @@ dtrace_dof_init(void) return; } -#if defined(sun) +#ifdef illumos if (dlinfo(RTLD_SELF, RTLD_DI_LMID, &lmid) == -1) { dprintf(1, "couldn't discover link map ID\n"); return; @@ -189,7 +189,7 @@ dtrace_dof_init(void) modname = lmp->l_name; else modname++; -#if !defined(sun) +#ifndef illumos elf_version(EV_CURRENT); if ((efd = open(lmp->l_name, O_RDONLY, 0)) < 0) { dprintf(1, "couldn't open file for reading\n"); @@ -258,7 +258,7 @@ dtrace_dof_init(void) if ((fd = open64(devnamep, O_RDWR)) < 0) { dprintf(1, "failed to open helper device %s", devnamep); -#if defined(sun) +#ifdef illumos /* * If the device path wasn't explicitly set, try again with * the old device path. @@ -350,14 +350,14 @@ dtrace_dof_init(void) dprintf(1, "DTrace ioctl failed for DOF at %p", dof); else { dprintf(1, "DTrace ioctl succeeded for DOF at %p\n", dof); -#if !defined(sun) +#ifndef illumos gen = dh.gen; #endif } (void) close(fd); -#if !defined(sun) +#ifndef illumos /* End of while loop */ dof = dof_next; } @@ -367,7 +367,7 @@ dtrace_dof_init(void) #endif } -#if defined(sun) +#ifdef illumos #pragma fini(dtrace_dof_fini) #else static void dtrace_dof_fini(void) __attribute__ ((destructor)); diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c index 6b571fafd..5ea55a05f 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c @@ -35,7 +35,7 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #else #include @@ -453,7 +453,7 @@ dt_aggregate_snap_cpu(dtrace_hdl_t *dtp, processorid_t cpu) buf->dtbd_cpu = cpu; -#if defined(sun) +#ifdef illumos if (dt_ioctl(dtp, DTRACEIOC_AGGSNAP, buf) == -1) { #else if (dt_ioctl(dtp, DTRACEIOC_AGGSNAP, &buf) == -1) { diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c index 35b8f0289..84f8661e3 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c @@ -1888,7 +1888,7 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp) char **argv = malloc(sizeof (char *) * (argc + 5)); FILE *ofp = tmpfile(); -#if defined(sun) +#ifdef illumos char ipath[20], opath[20]; /* big enough for /dev/fd/ + INT_MAX + \0 */ #endif char verdef[32]; /* big enough for -D__SUNW_D_VERSION=0x%08x + \0 */ @@ -1898,7 +1898,7 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp) int wstat, estat; pid_t pid; -#if defined(sun) +#ifdef illumos off64_t off; #else off_t off = 0; @@ -1929,7 +1929,7 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp) (void) fseeko64(ifp, off, SEEK_SET); } -#if defined(sun) +#ifdef illumos (void) snprintf(ipath, sizeof (ipath), "/dev/fd/%d", fileno(ifp)); (void) snprintf(opath, sizeof (opath), "/dev/fd/%d", fileno(ofp)); #endif @@ -1940,7 +1940,7 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp) "-D__SUNW_D_VERSION=0x%08x", dtp->dt_vmax); argv[argc++] = verdef; -#if defined(sun) +#ifdef illumos switch (dtp->dt_stdcmode) { case DT_STDC_XA: case DT_STDC_XT: @@ -1982,7 +1982,7 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp) } if (pid == 0) { -#if !defined(sun) +#ifndef illumos if (isatty(fileno(ifp)) == 0) lseek(fileno(ifp), off, SEEK_SET); dup2(fileno(ifp), 0); diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c index 2ed50c691..04c022b7a 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c @@ -35,12 +35,12 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #endif #include #include -#if !defined(sun) +#ifndef illumos #include #endif @@ -2961,7 +2961,7 @@ dt_get_buf(dtrace_hdl_t *dtp, int cpu, dtrace_bufdesc_t **bufp) buf->dtbd_size = size; buf->dtbd_cpu = cpu; -#if defined(sun) +#ifdef illumos if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, buf) == -1) { #else if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, &buf) == -1) { diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c index 54426834d..4fc887676 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c @@ -26,12 +26,12 @@ */ #include -#if defined(sun) +#ifdef illumos #include #endif #include -#if defined(sun) +#ifdef illumos #include #endif #include diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c index 2327ff75e..339e2de5d 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c @@ -145,7 +145,7 @@ dtrace_errno(dtrace_hdl_t *dtp) return (dtp->dt_errno); } -#if defined(sun) +#ifdef illumos int dt_set_errno(dtrace_hdl_t *dtp, int err) { diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_handle.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_handle.c index fe1ec7a80..f26126bba 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_handle.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_handle.c @@ -31,7 +31,7 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #endif diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c index 5a2f0e4c1..b9164ac26 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c @@ -28,18 +28,18 @@ #pragma ident "%Z%%M% %I% %E% SMI" -#if defined(sun) +#ifdef illumos #include #endif #include #include -#if defined(sun) +#ifdef illumos #include #endif #include #include #include -#if defined(sun) +#ifdef illumos #include #endif #include diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h index b7abbc2fd..348231cc3 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h @@ -34,7 +34,7 @@ #include #include -#if !defined(sun) +#ifndef illumos #include #include #include @@ -45,7 +45,7 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #endif @@ -142,7 +142,7 @@ typedef struct dt_module { GElf_Addr dm_bss_va; /* virtual address of BSS */ GElf_Xword dm_bss_size; /* size in bytes of BSS */ dt_idhash_t *dm_extern; /* external symbol definitions */ -#if !defined(sun) +#ifndef illumos caddr_t dm_reloc_offset; /* Symbol relocation offset. */ uintptr_t *dm_sec_offsets; #endif @@ -296,7 +296,7 @@ struct dtrace_hdl { int dt_version; /* library version requested by client */ int dt_ctferr; /* error resulting from last CTF failure */ int dt_errno; /* error resulting from last failed operation */ -#if !defined(sun) +#ifndef illumos const char *dt_errfile; int dt_errline; #endif @@ -305,7 +305,7 @@ struct dtrace_hdl { int dt_fterr; /* saved errno from failed open of dt_ftfd */ int dt_cdefs_fd; /* file descriptor for C CTF debugging cache */ int dt_ddefs_fd; /* file descriptor for D CTF debugging cache */ -#if defined(sun) +#ifdef illumos int dt_stdout_fd; /* file descriptor for saved stdout */ #else FILE *dt_freopen_fp; /* file pointer for freopened stdout */ @@ -596,7 +596,7 @@ extern int dt_version_defined(dt_version_t); extern char *dt_cpp_add_arg(dtrace_hdl_t *, const char *); extern char *dt_cpp_pop_arg(dtrace_hdl_t *); -#if defined(sun) +#ifdef illumos extern int dt_set_errno(dtrace_hdl_t *, int); #else int _dt_set_errno(dtrace_hdl_t *, int, const char *, int); @@ -606,7 +606,7 @@ void dt_get_errloc(dtrace_hdl_t *, const char **, int *); extern void dt_set_errmsg(dtrace_hdl_t *, const char *, const char *, const char *, int, const char *, va_list); -#if defined(sun) +#ifdef illumos extern int dt_ioctl(dtrace_hdl_t *, int, void *); #else extern int dt_ioctl(dtrace_hdl_t *, u_long, void *); diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l index bd41171ad..192e1e20d 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l @@ -44,7 +44,7 @@ * We need to undefine lex's input and unput macros so that references to these * call the functions provided at the end of this source file. */ -#if defined(sun) +#ifdef illumos #undef input #undef unput #else @@ -79,7 +79,7 @@ #endif static int id_or_type(const char *); -#if defined(sun) +#ifdef illumos static int input(void); static void unput(int); #endif @@ -740,7 +740,7 @@ yyinit(dt_pcb_t *pcb) yypcb = pcb; yylineno = 1; yypragma = NULL; -#if defined(sun) +#ifdef illumos yysptr = yysbuf; #endif YY_FLUSH_BUFFER; @@ -839,7 +839,7 @@ id_or_type(const char *s) return (ttok); } -#if defined(sun) +#ifdef illumos static int input(void) { @@ -881,4 +881,4 @@ unput(int c) *yysptr++ = c; yytchar = c; } -#endif +#endif /* illumos */ diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c index dd8a2def6..b73c67ee6 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c @@ -30,7 +30,7 @@ #include #include -#if defined(sun) +#ifdef illumos #include #else #define P2ROUNDUP(x, align) (-(-(x) & -(align))) @@ -38,7 +38,7 @@ #include #include -#if defined(sun) +#ifdef illumos #include #endif #include @@ -47,7 +47,7 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #else #include @@ -1609,7 +1609,7 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp) return (dt_link_error(dtp, elf, fd, bufs, "failed to allocate space for probe")); } -#if !defined(sun) +#ifndef illumos /* * Our linker doesn't understand the SUNW_IGNORE ndx and * will try to use this relocation when we build the @@ -1643,7 +1643,7 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp) * already been processed by an earlier link * invocation. */ -#if !defined(sun) +#ifndef illumos #define SHN_SUNW_IGNORE SHN_ABS #endif if (rsym.st_shndx != SHN_SUNW_IGNORE) { @@ -1659,7 +1659,7 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp) (void) elf_end(elf); (void) close(fd); -#if !defined(sun) +#ifndef illumos if (nsym > 0) #endif while ((pair = bufs) != NULL) { @@ -1680,7 +1680,7 @@ int dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags, const char *file, int objc, char *const objv[]) { -#if !defined(sun) +#ifndef illumos char tfile[PATH_MAX]; Elf *e; Elf_Scn *scn; @@ -1703,7 +1703,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags, size_t len; int eprobes = 0, ret = 0; -#if !defined(sun) +#ifndef illumos if (access(file, R_OK) == 0) { fprintf(stderr, "dtrace: target object (%s) already exists. " "Please remove the target\ndtrace: object and rebuild all " @@ -1781,7 +1781,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags, if ((dof = dtrace_dof_create(dtp, pgp, dflags)) == NULL) return (-1); /* errno is set for us */ -#if defined(sun) +#ifdef illumos /* * Create a temporary file and then unlink it if we're going to * combine it with drti.o later. We can still refer to it in child @@ -1825,12 +1825,12 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags, } -#if defined(sun) +#ifdef illumos if (!dtp->dt_lazyload) (void) unlink(file); #endif -#if defined(sun) +#ifdef illumos if (dtp->dt_oflags & DTRACE_O_LP64) status = dump_elf64(dtp, dof, fd); else @@ -1846,7 +1846,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags, } if (!dtp->dt_lazyload) { -#if defined(sun) +#ifdef illumos const char *fmt = "%s -o %s -r -Blocal -Breduce /dev/fd/%d %s"; if (dtp->dt_oflags & DTRACE_O_LP64) { @@ -1912,7 +1912,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags, file, dtp->dt_ld_path, WEXITSTATUS(status)); goto done; } -#if !defined(sun) +#ifndef illumos /* * FreeBSD's ld(1) is not instructed to interpret and add * correctly the SUNW_dof section present in tfile. @@ -1999,7 +1999,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags, done: dtrace_dof_destroy(dtp, dof); -#if !defined(sun) +#ifndef illumos unlink(tfile); #endif return (ret); diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c index 6ab7cd961..20081edfe 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c @@ -156,7 +156,7 @@ dt_epid_add(dtrace_hdl_t *dtp, dtrace_epid_t id) enabled->dtepd_epid = id; enabled->dtepd_nrecs = 1; -#if defined(sun) +#ifdef illumos if (dt_ioctl(dtp, DTRACEIOC_EPROBE, enabled) == -1) { #else if (dt_ioctl(dtp, DTRACEIOC_EPROBE, &enabled) == -1) { @@ -180,7 +180,7 @@ dt_epid_add(dtrace_hdl_t *dtp, dtrace_epid_t id) if ((enabled = nenabled) == NULL) return (dt_set_errno(dtp, EDT_NOMEM)); -#if defined(sun) +#ifdef illumos rval = dt_ioctl(dtp, DTRACEIOC_EPROBE, enabled); #else rval = dt_ioctl(dtp, DTRACEIOC_EPROBE, &enabled); @@ -356,7 +356,7 @@ dt_aggid_add(dtrace_hdl_t *dtp, dtrace_aggid_t id) agg->dtagd_id = id; agg->dtagd_nrecs = 1; -#if defined(sun) +#ifdef illumos if (dt_ioctl(dtp, DTRACEIOC_AGGDESC, agg) == -1) { #else if (dt_ioctl(dtp, DTRACEIOC_AGGDESC, &agg) == -1) { @@ -379,7 +379,7 @@ dt_aggid_add(dtrace_hdl_t *dtp, dtrace_aggid_t id) if ((agg = nagg) == NULL) return (dt_set_errno(dtp, EDT_NOMEM)); -#if defined(sun) +#ifdef illumos rval = dt_ioctl(dtp, DTRACEIOC_AGGDESC, agg); #else rval = dt_ioctl(dtp, DTRACEIOC_AGGDESC, &agg); diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c index 9dd52b532..b3fe51669 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c @@ -27,7 +27,7 @@ */ #include -#if defined(sun) +#ifdef illumos #include #include #include @@ -41,7 +41,7 @@ #endif #include -#if defined(sun) +#ifdef illumos #include #endif #include @@ -51,7 +51,7 @@ #include #include #include -#if !defined(sun) +#ifndef illumos #include #include #endif @@ -572,7 +572,7 @@ dt_module_load_sect(dtrace_hdl_t *dtp, dt_module_t *dmp, ctf_sect_t *ctsp) if (sp == NULL || (dp = elf_getdata(sp, NULL)) == NULL) return (0); -#if defined(sun) +#ifdef illumos ctsp->cts_data = dp->d_buf; #else if ((ctsp->cts_data = malloc(dp->d_size)) == NULL) @@ -921,7 +921,7 @@ dt_module_unload(dtrace_hdl_t *dtp, dt_module_t *dmp) ctf_close(dmp->dm_ctfp); dmp->dm_ctfp = NULL; -#if !defined(sun) +#ifndef illumos if (dmp->dm_ctdata.cts_data != NULL) { free(dmp->dm_ctdata.cts_data); } @@ -1115,7 +1115,7 @@ dt_module_getctflib(dtrace_hdl_t *dtp, dt_module_t *dmp, const char *name) * including the path. */ static void -#if defined(sun) +#ifdef illumos dt_module_update(dtrace_hdl_t *dtp, const char *name) #else dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat) @@ -1132,7 +1132,7 @@ dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat) Elf_Data *dp; Elf_Scn *sp; -#if defined(sun) +#ifdef illumos (void) snprintf(fname, sizeof (fname), "%s/%s/object", OBJFS_ROOT, name); #else @@ -1242,7 +1242,7 @@ dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat) } dmp->dm_flags |= DT_DM_KERNEL; -#if defined(sun) +#ifdef illumos dmp->dm_modid = (int)OBJFS_MODID(st.st_ino); #else /* @@ -1265,7 +1265,7 @@ dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat) } } #endif -#endif +#endif /* illumos */ if (dmp->dm_info.objfs_info_primary) dmp->dm_flags |= DT_DM_PRIMARY; @@ -1291,7 +1291,7 @@ dtrace_update(dtrace_hdl_t *dtp) dmp != NULL; dmp = dt_list_next(dmp)) dt_module_unload(dtp, dmp); -#if defined(sun) +#ifdef illumos /* * Open /system/object and attempt to create a libdtrace module for * each kernel module that is loaded on the current system. @@ -1331,11 +1331,11 @@ dtrace_update(dtrace_hdl_t *dtp) dt_idhash_lookup(dtp->dt_macros, "pid")->di_id = getpid(); dt_idhash_lookup(dtp->dt_macros, "pgid")->di_id = getpgid(0); dt_idhash_lookup(dtp->dt_macros, "ppid")->di_id = getppid(); -#if defined(sun) +#ifdef illumos dt_idhash_lookup(dtp->dt_macros, "projid")->di_id = getprojid(); #endif dt_idhash_lookup(dtp->dt_macros, "sid")->di_id = getsid(0); -#if defined(sun) +#ifdef illumos dt_idhash_lookup(dtp->dt_macros, "taskid")->di_id = gettaskid(); #endif dt_idhash_lookup(dtp->dt_macros, "uid")->di_id = getuid(); diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c index f6c140bde..f0e1294c7 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c @@ -26,7 +26,7 @@ */ #include -#if defined(sun) +#ifdef illumos #include #include #endif @@ -34,7 +34,7 @@ #include #include -#if defined(sun) +#ifdef illumos #include #endif #include @@ -55,7 +55,7 @@ #include #include #include -#if !defined(sun) +#ifndef illumos #include #include #endif @@ -159,7 +159,7 @@ const dt_version_t _dtrace_versions[] = { /* * Global variables that are formatted on FreeBSD based on the kernel file name. */ -#if !defined(sun) +#ifndef illumos static char curthread_str[MAXPATHLEN]; static char intmtx_str[MAXPATHLEN]; static char threadmtx_str[MAXPATHLEN]; @@ -241,7 +241,7 @@ static const dt_ident_t _dtrace_globals[] = { { "curthread", DT_IDENT_SCALAR, 0, DIF_VAR_CURTHREAD, { DTRACE_STABILITY_STABLE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_COMMON }, DT_VERS_1_0, -#if defined(sun) +#ifdef illumos &dt_idops_type, "genunix`kthread_t *" }, #else &dt_idops_type, curthread_str }, @@ -292,13 +292,13 @@ static const dt_ident_t _dtrace_globals[] = { { "index", DT_IDENT_FUNC, 0, DIF_SUBR_INDEX, DT_ATTR_STABCMN, DT_VERS_1_1, &dt_idops_func, "int(const char *, const char *, [int])" }, { "inet_ntoa", DT_IDENT_FUNC, 0, DIF_SUBR_INET_NTOA, DT_ATTR_STABCMN, -#if defined(sun) +#ifdef illumos DT_VERS_1_5, &dt_idops_func, "string(ipaddr_t *)" }, #else DT_VERS_1_5, &dt_idops_func, "string(in_addr_t *)" }, #endif { "inet_ntoa6", DT_IDENT_FUNC, 0, DIF_SUBR_INET_NTOA6, DT_ATTR_STABCMN, -#if defined(sun) +#ifdef illumos DT_VERS_1_5, &dt_idops_func, "string(in6_addr_t *)" }, #else DT_VERS_1_5, &dt_idops_func, "string(struct in6_addr *)" }, @@ -323,7 +323,7 @@ static const dt_ident_t _dtrace_globals[] = { &dt_idops_func, "void(@)" }, { "memref", DT_IDENT_FUNC, 0, DIF_SUBR_MEMREF, DT_ATTR_STABCMN, DT_VERS_1_1, &dt_idops_func, "uintptr_t *(void *, size_t)" }, -#if !defined(sun) +#ifndef illumos { "memstr", DT_IDENT_FUNC, 0, DIF_SUBR_MEMSTR, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_func, "string(void *, char, size_t)" }, #endif @@ -337,7 +337,7 @@ static const dt_ident_t _dtrace_globals[] = { { "msgsize", DT_IDENT_FUNC, 0, DIF_SUBR_MSGSIZE, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_func, "size_t(mblk_t *)" }, -#if defined(sun) +#ifdef illumos { "mutex_owned", DT_IDENT_FUNC, 0, DIF_SUBR_MUTEX_OWNED, DT_ATTR_EVOLCMN, DT_VERS_1_0, &dt_idops_func, "int(genunix`kmutex_t *)" }, @@ -408,7 +408,7 @@ static const dt_ident_t _dtrace_globals[] = { &dt_idops_func, "int()" }, { "rindex", DT_IDENT_FUNC, 0, DIF_SUBR_RINDEX, DT_ATTR_STABCMN, DT_VERS_1_1, &dt_idops_func, "int(const char *, const char *, [int])" }, -#if defined(sun) +#ifdef illumos { "rw_iswriter", DT_IDENT_FUNC, 0, DIF_SUBR_RW_ISWRITER, DT_ATTR_EVOLCMN, DT_VERS_1_0, &dt_idops_func, "int(genunix`krwlock_t *)" }, @@ -466,7 +466,7 @@ static const dt_ident_t _dtrace_globals[] = { &dt_idops_func, "string(const char *, int, [int])" }, { "sum", DT_IDENT_AGGFUNC, 0, DTRACEAGG_SUM, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_func, "void(@)" }, -#if !defined(sun) +#ifndef illumos { "sx_isexclusive", DT_IDENT_FUNC, 0, DIF_SUBR_SX_ISEXCLUSIVE, DT_ATTR_EVOLCMN, DT_VERS_1_0, &dt_idops_func, sxlock_str }, @@ -526,12 +526,12 @@ static const dt_ident_t _dtrace_globals[] = { { "walltimestamp", DT_IDENT_SCALAR, 0, DIF_VAR_WALLTIMESTAMP, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "int64_t" }, -#if defined(sun) +#ifdef illumos { "zonename", DT_IDENT_SCALAR, 0, DIF_VAR_ZONENAME, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" }, #endif -#if !defined(sun) +#ifndef illumos { "cpu", DT_IDENT_SCALAR, 0, DIF_VAR_CPU, DT_ATTR_STABCMN, DT_VERS_1_6_3, &dt_idops_type, "int" }, #endif @@ -775,7 +775,7 @@ const dtrace_pattr_t _dtrace_prvdesc = { { DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_COMMON }, }; -#if defined(sun) +#ifdef illumos const char *_dtrace_defcpp = "/usr/ccs/lib/cpp"; /* default cpp(1) to invoke */ const char *_dtrace_defld = "/usr/ccs/bin/ld"; /* default ld(1) to invoke */ #else @@ -784,7 +784,7 @@ const char *_dtrace_defld = "ld"; /* default ld(1) to invoke */ #endif const char *_dtrace_libdir = "/usr/lib/dtrace"; /* default library directory */ -#if defined(sun) +#ifdef illumos const char *_dtrace_provdir = "/dev/dtrace/provider"; /* provider directory */ #else const char *_dtrace_provdir = "/dev/dtrace"; /* provider directory */ @@ -809,7 +809,7 @@ typedef struct dt_fdlist { uint_t df_size; /* size of df_fds[] */ } dt_fdlist_t; -#if defined(sun) +#ifdef illumos #pragma init(_dtrace_init) #else void _dtrace_init(void) __attribute__ ((constructor)); @@ -845,7 +845,7 @@ dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *dfp) dt_provmod_t *prov; char path[PATH_MAX]; int fd; -#if defined(sun) +#ifdef illumos struct dirent *dp, *ep; DIR *dirp; @@ -892,7 +892,7 @@ dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *dfp) } (void) closedir(dirp); -#else +#else /* !illumos */ char *p; char *p1; char *p_providers = NULL; @@ -977,7 +977,7 @@ dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *dfp) } if (p_providers != NULL) free(p_providers); -#endif +#endif /* illumos */ } static void @@ -994,7 +994,7 @@ dt_provmod_destroy(dt_provmod_t **provmod) *provmod = NULL; } -#if defined(sun) +#ifdef illumos static const char * dt_get_sysinfo(int cmd, char *buf, size_t len) { @@ -1107,7 +1107,7 @@ dt_vopen(int version, int flags, int *errp, err = errno; } #endif -#if defined(sun) +#ifdef illumos ftfd = open("/dev/dtrace/provider/fasttrap", O_RDWR); #else ftfd = open("/dev/dtrace/fasttrap", O_RDWR); @@ -1149,7 +1149,7 @@ dt_vopen(int version, int flags, int *errp, bzero(dtp, sizeof (dtrace_hdl_t)); dtp->dt_oflags = flags; -#if defined(sun) +#ifdef illumos dtp->dt_prcmode = DT_PROC_STOP_PREINIT; #else dtp->dt_prcmode = DT_PROC_STOP_POSTINIT; @@ -1165,7 +1165,7 @@ dt_vopen(int version, int flags, int *errp, dtp->dt_fterr = fterr; dtp->dt_cdefs_fd = -1; dtp->dt_ddefs_fd = -1; -#if defined(sun) +#ifdef illumos dtp->dt_stdout_fd = -1; #else dtp->dt_freopen_fp = NULL; @@ -1197,7 +1197,7 @@ dt_vopen(int version, int flags, int *errp, dtp->dt_cpp_argv[0] = (char *)strbasename(dtp->dt_cpp_path); -#if defined(sun) +#ifdef illumos (void) snprintf(isadef, sizeof (isadef), "-D__SUNW_D_%u", (uint_t)(sizeof (void *) * NBBY)); @@ -1237,7 +1237,7 @@ dt_vopen(int version, int flags, int *errp, return (set_open_errno(dtp, errp, EDT_NOMEM)); #endif -#if defined(sun) +#ifdef illumos #ifdef __x86 /* * On x86 systems, __i386 is defined for for 32-bit @@ -1277,7 +1277,7 @@ dt_vopen(int version, int flags, int *errp, * 'kern.bootfile' sysctl value tells us exactly which file is being * used as the kernel. */ -#if !defined(sun) +#ifndef illumos { char bootfile[MAXPATHLEN]; char *p; @@ -1639,7 +1639,7 @@ dtrace_close(dtrace_hdl_t *dtp) (void) close(dtp->dt_cdefs_fd); if (dtp->dt_ddefs_fd != -1) (void) close(dtp->dt_ddefs_fd); -#if defined(sun) +#ifdef illumos if (dtp->dt_stdout_fd != -1) (void) close(dtp->dt_stdout_fd); #else diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c index 832af8884..e9164d09a 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c @@ -38,7 +38,7 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #endif #include @@ -871,7 +871,7 @@ dt_options_load(dtrace_hdl_t *dtp) bzero(&hdr, sizeof (dof_hdr_t)); hdr.dofh_loadsz = sizeof (dof_hdr_t); -#if defined(sun) +#ifdef illumos if (dt_ioctl(dtp, DTRACEIOC_DOFGET, &hdr) == -1) #else dof = &hdr; @@ -889,7 +889,7 @@ dt_options_load(dtrace_hdl_t *dtp) for (i = 0; i < DTRACEOPT_MAX; i++) dtp->dt_options[i] = DTRACEOPT_UNSET; -#if defined(sun) +#ifdef illumos if (dt_ioctl(dtp, DTRACEIOC_DOFGET, dof) == -1) #else if (dt_ioctl(dtp, DTRACEIOC_DOFGET, &dof) == -1) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c index 6ce3dadd4..ee31cef5f 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c @@ -102,7 +102,7 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #endif #include diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c index c865a2df7..2472d8ef3 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c @@ -33,7 +33,7 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #endif #include @@ -44,7 +44,7 @@ #include #include #include -#if !defined(sun) +#ifndef illumos #include #endif #include @@ -74,7 +74,7 @@ typedef struct dt_pid_probe { static void dt_pid_objname(char *buf, size_t len, Lmid_t lmid, const char *obj) { -#if defined(sun) +#ifdef illumos if (lmid == LM_ID_BASE) (void) strncpy(buf, obj, len); else @@ -126,7 +126,7 @@ dt_pid_per_sym(dt_pid_probe_t *pp, const GElf_Sym *symp, const char *func) int isdash = strcmp("-", func) == 0; pid_t pid; -#if defined(sun) +#ifdef illumos pid = Pstatus(pp->dpp_pr)->pr_pid; #else pid = proc_getpid(pp->dpp_pr); @@ -270,7 +270,7 @@ dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj) if (obj == NULL) return (0); -#if defined(sun) +#ifdef illumos (void) Plmid(pp->dpp_pr, pmp->pr_vaddr, &pp->dpp_lmid); #endif @@ -279,7 +279,7 @@ dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj) pp->dpp_obj = obj; else pp->dpp_obj++; -#if defined(sun) +#ifdef illumos if (Pxlookup_by_name(pp->dpp_pr, pp->dpp_lmid, obj, ".stret1", &sym, NULL) == 0) pp->dpp_stret[0] = sym.st_value; @@ -337,7 +337,7 @@ dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj) GELF_ST_INFO(STB_LOCAL, STT_FUNC); sym.st_other = 0; sym.st_value = 0; -#if defined(sun) +#ifdef illumos sym.st_size = Pstatus(pp->dpp_pr)->pr_dmodel == PR_MODEL_ILP32 ? -1U : -1ULL; #else @@ -404,7 +404,7 @@ dt_pid_mod_filt(void *arg, const prmap_t *pmp, const char *obj) if (gmatch(obj, pp->dpp_mod)) return (dt_pid_per_mod(pp, pmp, obj)); -#if defined(sun) +#ifdef illumos (void) Plmid(pp->dpp_pr, pmp->pr_vaddr, &pp->dpp_lmid); #else pp->dpp_lmid = 0; @@ -418,7 +418,7 @@ dt_pid_mod_filt(void *arg, const prmap_t *pmp, const char *obj) if (gmatch(pp->dpp_obj, pp->dpp_mod)) return (dt_pid_per_mod(pp, pmp, obj)); -#if defined(sun) +#ifdef illumos (void) Plmid(pp->dpp_pr, pmp->pr_vaddr, &pp->dpp_lmid); #endif @@ -434,7 +434,7 @@ static const prmap_t * dt_pid_fix_mod(dtrace_probedesc_t *pdp, struct ps_prochandle *P) { char m[MAXPATHLEN]; -#if defined(sun) +#ifdef illumos Lmid_t lmid = PR_LMID_EVERY; #else Lmid_t lmid = 0; @@ -442,7 +442,7 @@ dt_pid_fix_mod(dtrace_probedesc_t *pdp, struct ps_prochandle *P) const char *obj; const prmap_t *pmp; -#if defined(sun) +#ifdef illumos /* * Pick apart the link map from the library name. */ @@ -470,7 +470,7 @@ dt_pid_fix_mod(dtrace_probedesc_t *pdp, struct ps_prochandle *P) if ((pmp = Plmid_to_map(P, lmid, obj)) == NULL) return (NULL); -#if defined(sun) +#ifdef illumos (void) Pobjname(P, pmp->pr_vaddr, m, sizeof (m)); if ((obj = strrchr(m, '/')) == NULL) obj = &m[0]; @@ -571,7 +571,7 @@ dt_pid_usdt_mapping(void *data, const prmap_t *pmp, const char *oname) { struct ps_prochandle *P = data; GElf_Sym sym; -#if defined(sun) +#ifdef illumos prsyminfo_t sip; #endif dof_helper_t dh; @@ -609,13 +609,13 @@ dt_pid_usdt_mapping(void *data, const prmap_t *pmp, const char *oname) dh.dofhp_addr = (e_type == ET_EXEC) ? 0 : pmp->pr_vaddr; dt_pid_objname(dh.dofhp_mod, sizeof (dh.dofhp_mod), -#if defined(sun) +#ifdef illumos sip.prs_lmid, mname); #else 0, mname); #endif -#if defined(sun) +#ifdef illumos if (fd == -1 && (fd = pr_open(P, "/dev/dtrace/helper", O_RDWR, 0)) < 0) { dt_dprintf("pr_open of helper device failed: %s\n", @@ -628,7 +628,7 @@ dt_pid_usdt_mapping(void *data, const prmap_t *pmp, const char *oname) #endif } -#if defined(sun) +#ifdef illumos if (fd != -1) (void) pr_close(P, fd); #endif @@ -644,13 +644,13 @@ dt_pid_create_usdt_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp, int ret = 0; assert(DT_MUTEX_HELD(&dpr->dpr_lock)); -#if defined(sun) +#ifdef illumos (void) Pupdate_maps(P); if (Pobject_iter(P, dt_pid_usdt_mapping, P) != 0) { ret = -1; (void) dt_pid_error(dtp, pcb, dpr, NULL, D_PROC_USDT, "failed to instantiate probes for pid %d: %s", -#if defined(sun) +#ifdef illumos (int)Pstatus(P)->pr_pid, strerror(errno)); #else (int)proc_getpid(P), strerror(errno)); @@ -852,7 +852,7 @@ dt_pid_get_types(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp, ctf_funcinfo_t f; ctf_id_t argv[32]; GElf_Sym sym; -#if defined(sun) +#ifdef illumos prsyminfo_t si; #else void *si; @@ -941,7 +941,7 @@ dt_pid_get_types(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp, pdp->dtpd_func, pdp->dtpd_provider, pdp->dtpd_mod); goto out; } -#if defined(sun) +#ifdef illumos if (ctf_func_info(fp, si.prs_id, &f) == CTF_ERR) { dt_dprintf("failed to get ctf information for %s in %s`%s\n", pdp->dtpd_func, pdp->dtpd_provider, pdp->dtpd_mod); @@ -977,7 +977,7 @@ dt_pid_get_types(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp, (void) ctf_type_qname(fp, f.ctc_return, adp->dtargd_native + ret, DTRACE_ARGTYPELEN - ret, buf); *nargs = 2; -#if defined(sun) +#ifdef illumos } else { if (ctf_func_args(fp, si.prs_id, argc, argv) == CTF_ERR) goto out; diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c index 760c2f675..50d0680e1 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c @@ -28,7 +28,7 @@ #include #include -#if defined(sun) +#ifdef illumos #include #endif #include diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c index 720eba69a..d408aed45 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c @@ -25,7 +25,7 @@ * Copyright (c) 2013 by Delphix. All rights reserved. */ -#if defined(sun) +#ifdef illumos #include #else #define ABS(a) ((a) < 0 ? -(a) : (a)) @@ -33,7 +33,7 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #endif #include @@ -467,7 +467,7 @@ pfprint_time(dtrace_hdl_t *dtp, FILE *fp, const char *format, * Below, we turn this into the canonical adb/mdb /[yY] format, * "1973 Dec 3 17:20:00". */ -#if defined(sun) +#ifdef illumos (void) ctime_r(&sec, src, sizeof (src)); #else (void) ctime_r(&sec, src); @@ -518,7 +518,7 @@ pfprint_port(dtrace_hdl_t *dtp, FILE *fp, const char *format, char buf[256]; struct servent *sv, res; -#if defined(sun) +#ifdef illumos if ((sv = getservbyport_r(port, NULL, &res, buf, sizeof (buf))) != NULL) #else if (getservbyport_r(port, NULL, &res, buf, sizeof (buf), &sv) > 0) @@ -544,7 +544,7 @@ pfprint_inetaddr(dtrace_hdl_t *dtp, FILE *fp, const char *format, s[size] = '\0'; if (strchr(s, ':') == NULL && inet_pton(AF_INET, s, inetaddr) != -1) { -#if defined(sun) +#ifdef illumos if ((host = gethostbyaddr_r(inetaddr, NS_INADDRSZ, AF_INET, &res, buf, sizeof (buf), &e)) != NULL) #else @@ -694,7 +694,7 @@ static const dt_pfconv_t _dtrace_conversions[] = { { "S", "s", pfproto_cstr, pfcheck_str, pfprint_estr }, { "T", "s", "int64_t", pfcheck_time, pfprint_time822 }, { "u", "u", pfproto_xint, pfcheck_xint, pfprint_uint }, -#if defined(sun) +#ifdef illumos { "wc", "wc", "int", pfcheck_type, pfprint_sint }, /* a.k.a. wchar_t */ { "ws", "ws", pfproto_wstr, pfcheck_wstr, pfprint_wstr }, #else @@ -1669,7 +1669,7 @@ dtrace_freopen(dtrace_hdl_t *dtp, FILE *fp, void *fmtdata, if (rval == -1 || fp == NULL) return (rval); -#if defined(sun) +#ifdef illumos if (pfd->pfd_preflen != 0 && strcmp(pfd->pfd_prefix, DT_FREOPEN_RESTORE) == 0) { /* @@ -1751,7 +1751,7 @@ dtrace_freopen(dtrace_hdl_t *dtp, FILE *fp, void *fmtdata, } (void) fclose(nfp); -#else +#else /* !illumos */ /* * The 'standard output' (which is not necessarily stdout) * treatment on FreeBSD is implemented differently than on @@ -1826,7 +1826,7 @@ dtrace_freopen(dtrace_hdl_t *dtp, FILE *fp, void *fmtdata, /* Remember that the output has been redirected to the new file. */ dtp->dt_freopen_fp = nfp; -#endif +#endif /* illumos */ return (rval); } diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c index d40a0ae1e..79c187140 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c @@ -77,7 +77,7 @@ */ #include -#if defined(sun) +#ifdef illumos #include #endif #include @@ -89,7 +89,7 @@ #include #include -#if !defined(sun) +#ifndef illumos #include #include #define SYS_forksys SYS_fork @@ -143,7 +143,7 @@ dt_proc_bpdestroy(dt_proc_t *dpr, int delbkpts) static void dt_proc_bpmatch(dtrace_hdl_t *dtp, dt_proc_t *dpr) { -#if defined(sun) +#ifdef illumos const lwpstatus_t *psp = &Pstatus(dpr->dpr_proc)->pr_lwp; #else unsigned long pc; @@ -152,14 +152,14 @@ dt_proc_bpmatch(dtrace_hdl_t *dtp, dt_proc_t *dpr) assert(DT_MUTEX_HELD(&dpr->dpr_lock)); -#if !defined(sun) +#ifndef illumos proc_regget(dpr->dpr_proc, REG_PC, &pc); proc_bkptregadj(&pc); #endif for (dbp = dt_list_next(&dpr->dpr_bps); dbp != NULL; dbp = dt_list_next(dbp)) { -#if defined(sun) +#ifdef illumos if (psp->pr_reg[R_PC] == dbp->dbp_addr) break; #else @@ -170,7 +170,7 @@ dt_proc_bpmatch(dtrace_hdl_t *dtp, dt_proc_t *dpr) if (dbp == NULL) { dt_dprintf("pid %d: spurious breakpoint wakeup for %lx\n", -#if defined(sun) +#ifdef illumos (int)dpr->dpr_pid, (ulong_t)psp->pr_reg[R_PC]); #else (int)dpr->dpr_pid, pc); @@ -342,7 +342,7 @@ dt_proc_rdwatch(dt_proc_t *dpr, rd_event_e event, const char *evname) } (void) dt_proc_bpcreate(dpr, rdn.u.bptaddr, -#if defined(sun) +#ifdef illumos (dt_bkpt_f *)dt_proc_rdevent, (void *)evname); #else /* XXX ugly */ @@ -357,7 +357,7 @@ dt_proc_rdwatch(dt_proc_t *dpr, rd_event_e event, const char *evname) static void dt_proc_attach(dt_proc_t *dpr, int exec) { -#if defined(sun) +#ifdef illumos const pstatus_t *psp = Pstatus(dpr->dpr_proc); #endif rd_err_e err; @@ -366,23 +366,23 @@ dt_proc_attach(dt_proc_t *dpr, int exec) assert(DT_MUTEX_HELD(&dpr->dpr_lock)); if (exec) { -#if defined(sun) +#ifdef illumos if (psp->pr_lwp.pr_errno != 0) return; /* exec failed: nothing needs to be done */ #endif dt_proc_bpdestroy(dpr, B_FALSE); -#if defined(sun) +#ifdef illumos Preset_maps(dpr->dpr_proc); #endif } if ((dpr->dpr_rtld = Prd_agent(dpr->dpr_proc)) != NULL && (err = rd_event_enable(dpr->dpr_rtld, B_TRUE)) == RD_OK) { -#if defined(sun) +#ifdef illumos dt_proc_rdwatch(dpr, RD_PREINIT, "RD_PREINIT"); #endif dt_proc_rdwatch(dpr, RD_POSTINIT, "RD_POSTINIT"); -#if defined(sun) +#ifdef illumos dt_proc_rdwatch(dpr, RD_DLACTIVITY, "RD_DLACTIVITY"); #endif } else { @@ -507,7 +507,7 @@ dt_proc_control(void *arg) struct ps_prochandle *P = dpr->dpr_proc; int pid = dpr->dpr_pid; -#if defined(sun) +#ifdef illumos int pfd = Pctlfd(P); const long wstop = PCWSTOP; @@ -529,7 +529,7 @@ dt_proc_control(void *arg) */ (void) pthread_mutex_lock(&dpr->dpr_lock); -#if defined(sun) +#ifdef illumos (void) Punsetflags(P, PR_ASYNC); /* require synchronous mode */ (void) Psetflags(P, PR_BPTADJ); /* always adjust eip on x86 */ (void) Punsetflags(P, PR_FORK); /* do not inherit on fork */ @@ -562,7 +562,7 @@ dt_proc_control(void *arg) * If PR_KLC is set, we created the process; otherwise we grabbed it. * Check for an appropriate stop request and wait for dt_proc_continue. */ -#if defined(sun) +#ifdef illumos if (Pstatus(P)->pr_flags & PR_KLC) #else if (proc_getflags(P) & PR_KLC) @@ -590,7 +590,7 @@ dt_proc_control(void *arg) while (!dpr->dpr_quit) { const lwpstatus_t *psp; -#if defined(sun) +#ifdef illumos if (write(pfd, &wstop, sizeof (wstop)) == -1 && errno == EINTR) continue; /* check dpr_quit and continue waiting */ #else @@ -602,7 +602,7 @@ dt_proc_control(void *arg) (void) pthread_mutex_lock(&dpr->dpr_lock); -#if defined(sun) +#ifdef illumos pwait_locked: if (Pstopstatus(P, PCNULL, 0) == -1 && errno == EINTR) { (void) pthread_mutex_unlock(&dpr->dpr_lock); @@ -612,7 +612,7 @@ dt_proc_control(void *arg) switch (Pstate(P)) { case PS_STOP: -#if defined(sun) +#ifdef illumos psp = &Pstatus(P)->pr_lwp; #else psp = proc_getlwpstatus(P); @@ -661,7 +661,7 @@ dt_proc_control(void *arg) break; case PS_LOST: -#if defined(sun) +#ifdef illumos if (Preopen(P) == 0) goto pwait_locked; #endif @@ -734,7 +734,7 @@ dt_proc_t * dt_proc_lookup(dtrace_hdl_t *dtp, struct ps_prochandle *P, int remove) { dt_proc_hash_t *dph = dtp->dt_procs; -#if defined(sun) +#ifdef illumos pid_t pid = Pstatus(P)->pr_pid; #else pid_t pid = proc_getpid(P); @@ -772,14 +772,14 @@ dt_proc_destroy(dtrace_hdl_t *dtp, struct ps_prochandle *P) * an external debugger and we were waiting in dt_proc_waitrun(). * Leave the process in this condition using PRELEASE_HANG. */ -#if defined(sun) +#ifdef illumos if (!(Pstatus(dpr->dpr_proc)->pr_flags & (PR_KLC | PR_RLC))) { #else if (!(proc_getflags(dpr->dpr_proc) & (PR_KLC | PR_RLC))) { #endif dt_dprintf("abandoning pid %d\n", (int)dpr->dpr_pid); rflag = PRELEASE_HANG; -#if defined(sun) +#ifdef illumos } else if (Pstatus(dpr->dpr_proc)->pr_flags & PR_KLC) { #else } else if (proc_getflags(dpr->dpr_proc) & PR_KLC) { @@ -808,7 +808,7 @@ dt_proc_destroy(dtrace_hdl_t *dtp, struct ps_prochandle *P) */ (void) pthread_mutex_lock(&dpr->dpr_lock); dpr->dpr_quit = B_TRUE; -#if defined(sun) +#ifdef illumos (void) _lwp_kill(dpr->dpr_tid, SIGCANCEL); #else pthread_kill(dpr->dpr_tid, SIGTHR); @@ -880,7 +880,7 @@ dt_proc_create_thread(dtrace_hdl_t *dtp, dt_proc_t *dpr, uint_t stop) (void) sigfillset(&nset); (void) sigdelset(&nset, SIGABRT); /* unblocked for assert() */ -#if defined(sun) +#ifdef illumos (void) sigdelset(&nset, SIGCANCEL); /* see dt_proc_destroy() */ #else (void) sigdelset(&nset, SIGUSR1); /* see dt_proc_destroy() */ @@ -912,7 +912,7 @@ dt_proc_create_thread(dtrace_hdl_t *dtp, dt_proc_t *dpr, uint_t stop) * small amount of useful information to help figure it out. */ if (dpr->dpr_done) { -#if defined(sun) +#ifdef illumos const psinfo_t *prp = Ppsinfo(dpr->dpr_proc); int stat = prp ? prp->pr_wstat : 0; int pid = dpr->dpr_pid; @@ -963,7 +963,7 @@ dt_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv, (void) pthread_mutex_init(&dpr->dpr_lock, NULL); (void) pthread_cond_init(&dpr->dpr_cv, NULL); -#if defined(sun) +#ifdef illumos if ((dpr->dpr_proc = Pcreate(file, argv, &err, NULL, 0)) == NULL) { #else if ((err = proc_create(file, argv, pcf, child_arg, @@ -974,7 +974,7 @@ dt_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv, } dpr->dpr_hdl = dtp; -#if defined(sun) +#ifdef illumos dpr->dpr_pid = Pstatus(dpr->dpr_proc)->pr_pid; #else dpr->dpr_pid = proc_getpid(dpr->dpr_proc); @@ -1039,7 +1039,7 @@ dt_proc_grab(dtrace_hdl_t *dtp, pid_t pid, int flags, int nomonitor) (void) pthread_mutex_init(&dpr->dpr_lock, NULL); (void) pthread_cond_init(&dpr->dpr_cv, NULL); -#if defined(sun) +#ifdef illumos if ((dpr->dpr_proc = Pgrab(pid, flags, &err)) == NULL) { #else if ((err = proc_attach(pid, flags, &dpr->dpr_proc)) != 0) { @@ -1174,7 +1174,7 @@ dtrace_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv, struct ps_prochandle *P = dt_proc_create(dtp, file, argv, pcf, child_arg); if (P != NULL && idp != NULL && idp->di_id == 0) { -#if defined(sun) +#ifdef illumos idp->di_id = Pstatus(P)->pr_pid; /* $target = created pid */ #else idp->di_id = proc_getpid(P); /* $target = created pid */ diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c index a325c42cb..232a3723b 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c @@ -30,7 +30,7 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #endif diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c index 0f1bfe07b..9d6c12bf7 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c @@ -28,7 +28,7 @@ */ #include -#if defined(sun) +#ifdef illumos #include #endif @@ -36,7 +36,7 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #endif #include diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c index 4429019d5..72fd08aee 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c @@ -25,7 +25,7 @@ * Use is subject to license terms. */ -#if defined(sun) +#ifdef illumos #include #endif #include @@ -38,7 +38,7 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #else #include @@ -477,7 +477,7 @@ dt_dprintf(const char *format, ...) } int -#if defined(sun) +#ifdef illumos dt_ioctl(dtrace_hdl_t *dtp, int val, void *arg) #else dt_ioctl(dtrace_hdl_t *dtp, u_long val, void *arg) @@ -485,7 +485,7 @@ dt_ioctl(dtrace_hdl_t *dtp, u_long val, void *arg) { const dtrace_vector_t *v = dtp->dt_vector; -#if !defined(sun) +#ifndef illumos /* Avoid sign extension. */ val &= 0xffffffff; #endif @@ -506,7 +506,7 @@ dt_status(dtrace_hdl_t *dtp, processorid_t cpu) const dtrace_vector_t *v = dtp->dt_vector; if (v == NULL) { -#if defined(sun) +#ifdef illumos return (p_online(cpu, P_STATUS)); #else int maxid = 0; @@ -583,7 +583,7 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, const char *format, ...) va_list ap; int n; -#if !defined(sun) +#ifndef illumos /* * On FreeBSD, check if output is currently being re-directed * to another file. If so, output to that file instead of the @@ -845,7 +845,7 @@ dt_popcb(const ulong_t *bp, ulong_t n) return (popc + dt_popc(bp[maxw] & ((1UL << maxb) - 1))); } -#if defined(sun) +#ifdef illumos struct _rwlock; struct _lwp_mutex; @@ -867,7 +867,7 @@ dt_rw_write_held(pthread_rwlock_t *lock) int dt_mutex_held(pthread_mutex_t *lock) { -#if defined(sun) +#ifdef illumos extern int _mutex_held(struct _lwp_mutex *); return (_mutex_held((struct _lwp_mutex *)lock)); #else diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_work.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_work.c index d19fb8824..07565e0f7 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_work.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_work.c @@ -82,7 +82,7 @@ dtrace_sleep(dtrace_hdl_t *dtp) return; /* sleep duration has already past */ } -#if defined(sun) +#ifdef illumos tv.tv_sec = (earliest - now) / NANOSEC; tv.tv_nsec = (earliest - now) % NANOSEC; diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h index 6f88e6d46..f0088a939 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h @@ -37,7 +37,7 @@ #include #include #include -#if !defined(sun) +#ifndef illumos #include #endif @@ -554,7 +554,7 @@ extern int dtrace_probe_info(dtrace_hdl_t *, * entry point to obtain a library handle. */ struct dtrace_vector { -#if defined(sun) +#ifdef illumos int (*dtv_ioctl)(void *, int, void *); #else int (*dtv_ioctl)(void *, u_long, void *); @@ -605,7 +605,7 @@ extern int _dtrace_debug; } #endif -#if !defined(sun) +#ifndef illumos #define _SC_CPUID_MAX _SC_NPROCESSORS_CONF #define _SC_NPROCESSORS_MAX _SC_NPROCESSORS_CONF #endif diff --git a/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c b/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c index 9479e83dd..34d558767 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c @@ -39,7 +39,7 @@ #include -#if !defined(sun) +#ifndef illumos #define PR_MODEL_ILP32 1 #define PR_MODEL_LP64 2 #include @@ -88,7 +88,7 @@ dt_pid_has_jump_table(struct ps_prochandle *P, dtrace_hdl_t *dtp, { ulong_t i; int size; -#if defined(sun) +#ifdef illumos pid_t pid = Pstatus(P)->pr_pid; char dmodel = Pstatus(P)->pr_dmodel; #else @@ -144,7 +144,7 @@ dt_pid_create_return_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp, uint8_t *text; ulong_t i, end; int size; -#if defined(sun) +#ifdef illumos pid_t pid = Pstatus(P)->pr_pid; char dmodel = Pstatus(P)->pr_dmodel; #else @@ -305,7 +305,7 @@ dt_pid_create_offset_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp, uint8_t *text; ulong_t i; int size; -#if defined(sun) +#ifdef illumos pid_t pid = Pstatus(P)->pr_pid; char dmodel = Pstatus(P)->pr_dmodel; #else @@ -388,7 +388,7 @@ dt_pid_create_glob_offset_probes(struct ps_prochandle *P, dtrace_hdl_t *dtp, uint8_t *text; int size; ulong_t i, end = symp->st_size; -#if defined(sun) +#ifdef illumos pid_t pid = Pstatus(P)->pr_pid; char dmodel = Pstatus(P)->pr_dmodel; #else diff --git a/cddl/contrib/opensolaris/lib/libgen/common/gmatch.c b/cddl/contrib/opensolaris/lib/libgen/common/gmatch.c index fe4a3825a..6da5cf282 100644 --- a/cddl/contrib/opensolaris/lib/libgen/common/gmatch.c +++ b/cddl/contrib/opensolaris/lib/libgen/common/gmatch.c @@ -29,7 +29,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" -#if defined(sun) +#ifdef illumos #pragma weak gmatch = _gmatch #include "gen_synonyms.h" @@ -38,7 +38,7 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #include "_range.h" #else diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h index 246449c75..8ab15461c 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h @@ -800,10 +800,10 @@ extern boolean_t libzfs_fru_compare(libzfs_handle_t *, const char *, extern boolean_t libzfs_fru_notself(libzfs_handle_t *, const char *); extern int zpool_fru_set(zpool_handle_t *, uint64_t, const char *); -#ifndef sun +#ifndef illumos extern int zmount(const char *, const char *, int, char *, char *, int, char *, int); -#endif /* !sun */ +#endif #ifdef __cplusplus } diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c index 44a9f006d..3e7a551e5 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c @@ -1113,7 +1113,7 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl, } case ZFS_PROP_MLSLABEL: { -#ifdef sun +#ifdef illumos /* * Verify the mlslabel string and convert to * internal hex label string. @@ -1162,11 +1162,11 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl, "invalid mlslabel '%s'"), strval); (void) zfs_error(hdl, EZFS_BADPROP, errbuf); m_label_free(new_sl); /* OK if null */ -#else /* !sun */ +#else /* !illumos */ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "mlslabel is not supported on FreeBSD")); (void) zfs_error(hdl, EZFS_BADPROP, errbuf); -#endif /* !sun */ +#endif /* illumos */ goto error; } @@ -2504,7 +2504,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen, case ZFS_PROP_MLSLABEL: { -#ifdef sun +#ifdef illumos m_label_t *new_sl = NULL; char *ascii = NULL; /* human readable label */ @@ -2538,9 +2538,9 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen, (void) strlcpy(propbuf, ascii, proplen); free(ascii); -#else /* !sun */ +#else /* !illumos */ propbuf[0] = '\0'; -#endif /* !sun */ +#endif /* illumos */ } break; @@ -2652,7 +2652,7 @@ static int idmap_id_to_numeric_domain_rid(uid_t id, boolean_t isuser, char **domainp, idmap_rid_t *ridp) { -#ifdef sun +#ifdef illumos idmap_get_handle_t *get_hdl = NULL; idmap_stat status; int err = EINVAL; @@ -2677,10 +2677,10 @@ idmap_id_to_numeric_domain_rid(uid_t id, boolean_t isuser, if (get_hdl) idmap_get_destroy(get_hdl); return (err); -#else /* !sun */ +#else /* !illumos */ assert(!"invalid code path"); return (EINVAL); // silence compiler warning -#endif /* !sun */ +#endif /* illumos */ } /* @@ -2715,7 +2715,7 @@ userquota_propname_decode(const char *propname, boolean_t zoned, cp = strchr(propname, '@') + 1; if (strchr(cp, '@')) { -#ifdef sun +#ifdef illumos /* * It's a SID name (eg "user@domain") that needs to be * turned into S-1-domainID-RID. @@ -2761,9 +2761,9 @@ userquota_propname_decode(const char *propname, boolean_t zoned, cp = numericsid; *ridp = rid; /* will be further decoded below */ -#else /* !sun */ +#else /* !illumos */ return (ENOENT); -#endif /* !sun */ +#endif /* illumos */ } if (strncmp(cp, "S-1-", 4) == 0) { @@ -4286,7 +4286,7 @@ zfs_prune_proplist(zfs_handle_t *zhp, uint8_t *props) } } -#ifdef sun +#ifdef illumos static int zfs_smb_acl_mgmt(libzfs_handle_t *hdl, char *dataset, char *path, zfs_smb_acl_op_t cmd, char *resource1, char *resource2) @@ -4368,7 +4368,7 @@ zfs_smb_acl_rename(libzfs_handle_t *hdl, char *dataset, char *path, return (zfs_smb_acl_mgmt(hdl, dataset, path, ZFS_SMB_ACL_RENAME, oldname, newname)); } -#endif /* sun */ +#endif /* illumos */ int zfs_userspace(zfs_handle_t *zhp, zfs_userquota_prop_t type, diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c index 3b175790e..bb49eba0f 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c @@ -495,7 +495,7 @@ find_shares_object(differ_info_t *di) (void) strlcat(fullpath, ZDIFF_SHARESDIR, MAXPATHLEN); if (stat64(fullpath, &sb) != 0) { -#ifdef sun +#ifdef illumos (void) snprintf(di->errbuf, sizeof (di->errbuf), dgettext(TEXT_DOMAIN, "Cannot stat %s"), fullpath); return (zfs_error(di->zhp->zfs_hdl, EZFS_DIFF, di->errbuf)); diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c index 87b41cff7..098702422 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c @@ -958,7 +958,7 @@ slice_cache_compare(const void *arg1, const void *arg2) return (rv > 0 ? 1 : -1); } -#ifdef sun +#ifdef illumos static void check_one_slice(avl_tree_t *r, char *diskname, uint_t partno, diskaddr_t size, uint_t blksz) @@ -981,12 +981,12 @@ check_one_slice(avl_tree_t *r, char *diskname, uint_t partno, (node = avl_find(r, &tmpnode, NULL))) node->rn_nozpool = B_TRUE; } -#endif /* sun */ +#endif /* illumos */ static void nozpool_all_slices(avl_tree_t *r, const char *sname) { -#ifdef sun +#ifdef illumos char diskname[MAXNAMELEN]; char *ptr; int i; @@ -1002,10 +1002,10 @@ nozpool_all_slices(avl_tree_t *r, const char *sname) ptr[0] = 'p'; for (i = 0; i <= FD_NUMPART; i++) check_one_slice(r, diskname, i, 0, 1); -#endif /* sun */ +#endif /* illumos */ } -#ifdef sun +#ifdef illumos static void check_slices(avl_tree_t *r, int fd, const char *sname) { @@ -1039,7 +1039,7 @@ check_slices(avl_tree_t *r, int fd, const char *sname) efi_free(gpt); } } -#endif /* sun */ +#endif /* illumos */ static void zpool_open_func(void *arg) @@ -1069,7 +1069,7 @@ zpool_open_func(void *arg) return; } /* this file is too small to hold a zpool */ -#ifdef sun +#ifdef illumos if (S_ISREG(statbuf.st_mode) && statbuf.st_size < SPA_MINDEVSIZE) { (void) close(fd); @@ -1081,12 +1081,12 @@ zpool_open_func(void *arg) */ check_slices(rn->rn_avl, fd, rn->rn_name); } -#else /* !sun */ +#else /* !illumos */ if (statbuf.st_size < SPA_MINDEVSIZE) { (void) close(fd); return; } -#endif /* sun */ +#endif /* illumos */ if ((zpool_read_label(fd, &config)) != 0) { (void) close(fd); diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c index b94af5bf2..f03da991e 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c @@ -139,7 +139,7 @@ is_shared(libzfs_handle_t *hdl, const char *mountpoint, zfs_share_proto_t proto) *tab = '\0'; if (strcmp(buf, mountpoint) == 0) { -#ifdef sun +#ifdef illumos /* * the protocol field is the third field * skip over second field @@ -172,7 +172,7 @@ is_shared(libzfs_handle_t *hdl, const char *mountpoint, zfs_share_proto_t proto) return (SHARED_NOT_SHARED); } -#ifdef sun +#ifdef illumos /* * Returns true if the specified directory is empty. If we can't open the * directory at all, return true so that the mount can fail with a more @@ -297,7 +297,7 @@ zfs_mount(zfs_handle_t *zhp, const char *options, int flags) } } -#ifdef sun /* FreeBSD: overlay mounts are not checked. */ +#ifdef illumos /* FreeBSD: overlay mounts are not checked. */ /* * Determine if the mountpoint is empty. If so, refuse to perform the * mount. We don't perform this check if MS_OVERLAY is specified, which @@ -507,7 +507,7 @@ zfs_is_shared_smb(zfs_handle_t *zhp, char **where) * initialized in _zfs_init_libshare() are actually present. */ -#ifdef sun +#ifdef illumos static sa_handle_t (*_sa_init)(int); static void (*_sa_fini)(sa_handle_t); static sa_share_t (*_sa_find_share)(sa_handle_t, char *); @@ -534,7 +534,7 @@ static void (*_sa_update_sharetab_ts)(sa_handle_t); static void _zfs_init_libshare(void) { -#ifdef sun +#ifdef illumos void *libshare; char path[MAXPATHLEN]; char isa[MAXISALEN]; @@ -605,7 +605,7 @@ zfs_init_libshare(libzfs_handle_t *zhandle, int service) { int ret = SA_OK; -#ifdef sun +#ifdef illumos if (_sa_init == NULL) ret = SA_CONFIG_ERR; @@ -646,7 +646,7 @@ void zfs_uninit_libshare(libzfs_handle_t *zhandle) { if (zhandle != NULL && zhandle->libzfs_sharehdl != NULL) { -#ifdef sun +#ifdef illumos if (_sa_fini != NULL) _sa_fini(zhandle->libzfs_sharehdl); #endif @@ -663,7 +663,7 @@ zfs_uninit_libshare(libzfs_handle_t *zhandle) int zfs_parse_options(char *options, zfs_share_proto_t proto) { -#ifdef sun +#ifdef illumos if (_sa_parse_legacy_options != NULL) { return (_sa_parse_legacy_options(NULL, options, proto_table[proto].p_name)); @@ -674,7 +674,7 @@ zfs_parse_options(char *options, zfs_share_proto_t proto) #endif } -#ifdef sun +#ifdef illumos /* * zfs_sa_find_share(handle, path) * @@ -716,7 +716,7 @@ zfs_sa_disable_share(sa_share_t share, char *proto) return (_sa_disable_share(share, proto)); return (SA_CONFIG_ERR); } -#endif /* sun */ +#endif /* illumos */ /* * Share the given filesystem according to the options in the specified @@ -767,7 +767,7 @@ zfs_share_proto(zfs_handle_t *zhp, zfs_share_proto_t *proto) if (zfs_prop_get_int(zhp, ZFS_PROP_ZONED)) continue; -#ifdef sun +#ifdef illumos share = zfs_sa_find_share(hdl->libzfs_sharehdl, mountpoint); if (share == NULL) { /* @@ -856,7 +856,7 @@ static int unshare_one(libzfs_handle_t *hdl, const char *name, const char *mountpoint, zfs_share_proto_t proto) { -#ifdef sun +#ifdef illumos sa_share_t share; int err; char *mntpt; diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c index 5fd96123f..7cdcfc90f 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c @@ -2339,7 +2339,7 @@ zpool_get_physpath(zpool_handle_t *zhp, char *physpath, size_t phypath_size) static int zpool_relabel_disk(libzfs_handle_t *hdl, const char *name) { -#ifdef sun +#ifdef illumos char path[MAXPATHLEN]; char errbuf[1024]; int fd, error; @@ -2369,7 +2369,7 @@ zpool_relabel_disk(libzfs_handle_t *hdl, const char *name) "relabel '%s': unable to read disk capacity"), name); return (zfs_error(hdl, EZFS_NOCAP, errbuf)); } -#endif /* sun */ +#endif /* illumos */ return (0); } @@ -3417,7 +3417,7 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv, devid_str_free(newdevid); } -#ifdef sun +#ifdef illumos if (strncmp(path, "/dev/dsk/", 9) == 0) path += 9; @@ -3442,10 +3442,10 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv, } return (tmp); } -#else /* !sun */ +#else /* !illumos */ if (strncmp(path, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) path += sizeof(_PATH_DEV) - 1; -#endif /* !sun */ +#endif /* illumos */ } else { verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, &path) == 0); @@ -3835,7 +3835,7 @@ zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj, free(mntpnt); } -#ifdef sun +#ifdef illumos /* * Read the EFI label from the config, if a label does not exist then * pass back the error to the caller. If the caller has passed a non-NULL @@ -3900,7 +3900,7 @@ find_start_block(nvlist_t *config) } return (MAXOFFSET_T); } -#endif /* sun */ +#endif /* illumos */ /* * Label an individual disk. The name provided is the short name, @@ -3909,7 +3909,7 @@ find_start_block(nvlist_t *config) int zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name) { -#ifdef sun +#ifdef illumos char path[MAXPATHLEN]; struct dk_gpt *vtoc; int fd; @@ -4007,7 +4007,7 @@ zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name) (void) close(fd); efi_free(vtoc); -#endif /* sun */ +#endif /* illumos */ return (0); } diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c index e99231dda..3ba069e01 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c @@ -955,7 +955,7 @@ dump_ioctl(zfs_handle_t *zhp, const char *fromsnap, uint64_t fromsnap_obj, case EIO: case ENOLINK: case ENOSPC: -#ifdef sun +#ifdef illumos case ENOSTR: #endif case ENXIO: diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c index 6f7060447..1316aec7c 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c @@ -686,7 +686,7 @@ libzfs_fini(libzfs_handle_t *hdl) (void) fclose(hdl->libzfs_sharetab); zfs_uninit_libshare(hdl); zpool_free_handles(hdl); -#ifdef sun +#ifdef illumos libzfs_fru_clear(hdl, B_TRUE); #endif namespace_clear(hdl); @@ -738,7 +738,7 @@ zfs_path_to_zhandle(libzfs_handle_t *hdl, char *path, zfs_type_t argtype) return (NULL); } -#ifdef sun +#ifdef illumos rewind(hdl->libzfs_mnttab); while ((ret = getextmntent(hdl->libzfs_mnttab, &entry, 0)) == 0) { if (makedevice(entry.mnt_major, entry.mnt_minor) == @@ -758,7 +758,7 @@ zfs_path_to_zhandle(libzfs_handle_t *hdl, char *path, zfs_type_t argtype) strerror(errno)); } } -#endif /* sun */ +#endif /* illumos */ if (ret != 0) { return (NULL); } diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.c b/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.c index bc278b063..c0719620d 100644 --- a/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.c +++ b/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.c @@ -38,7 +38,7 @@ */ #include -#if defined(sun) +#ifdef illumos #include #endif #include @@ -49,7 +49,7 @@ void barrier_init(barrier_t *bar, int nthreads) { pthread_mutex_init(&bar->bar_lock, NULL); -#if defined(sun) +#ifdef illumos sema_init(&bar->bar_sem, 0, USYNC_THREAD, NULL); #else sem_init(&bar->bar_sem, 0, 0); @@ -66,7 +66,7 @@ barrier_wait(barrier_t *bar) if (++bar->bar_numin < bar->bar_nthr) { pthread_mutex_unlock(&bar->bar_lock); -#if defined(sun) +#ifdef illumos sema_wait(&bar->bar_sem); #else sem_wait(&bar->bar_sem); @@ -80,7 +80,7 @@ barrier_wait(barrier_t *bar) /* reset for next use */ bar->bar_numin = 0; for (i = 1; i < bar->bar_nthr; i++) -#if defined(sun) +#ifdef illumos sema_post(&bar->bar_sem); #else sem_post(&bar->bar_sem); diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.h b/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.h index c7e6212a6..babf2e64e 100644 --- a/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.h +++ b/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.h @@ -33,7 +33,7 @@ * APIs for the barrier synchronization primitive. */ -#if defined(sun) +#ifdef illumos #include #else #include diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/ctfconvert.c b/cddl/contrib/opensolaris/tools/ctf/cvt/ctfconvert.c index efe6c279a..d40be25da 100644 --- a/cddl/contrib/opensolaris/tools/ctf/cvt/ctfconvert.c +++ b/cddl/contrib/opensolaris/tools/ctf/cvt/ctfconvert.c @@ -155,7 +155,7 @@ main(int argc, char **argv) int keep_stabs = 0; int c; -#if defined(sun) +#ifdef illumos sighold(SIGINT); sighold(SIGQUIT); sighold(SIGTERM); @@ -221,7 +221,7 @@ main(int argc, char **argv) */ set_terminate_cleanup(terminate_cleanup); -#if defined(sun) +#ifdef illumos sigset(SIGINT, handle_sig); sigset(SIGQUIT, handle_sig); sigset(SIGTERM, handle_sig); diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c b/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c index 3e030c7e2..a3d05ad20 100644 --- a/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c +++ b/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c @@ -176,20 +176,20 @@ #include #include #include -#if defined(sun) +#ifdef illumos #include #endif #include #include #include #include -#if defined(sun) +#ifdef illumos #include #endif #include #include #include -#if defined(sun) +#ifdef illumos #include #endif @@ -232,7 +232,7 @@ usage(void) progname, progname); } -#if defined(sun) +#ifdef illumos static void bigheap(void) { @@ -280,7 +280,7 @@ bigheap(void) (void) memcntl(NULL, 0, MC_HAT_ADVISE, (caddr_t)&mha, 0, 0); } -#endif +#endif /* illumos */ static void finalize_phase_one(workqueue_t *wq) @@ -707,7 +707,7 @@ start_threads(workqueue_t *wq) (void *(*)(void *))worker_thread, wq); } -#if defined(sun) +#ifdef illumos sigset(SIGINT, handle_sig); sigset(SIGQUIT, handle_sig); sigset(SIGTERM, handle_sig); diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c b/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c index 63d4d1edb..572540121 100644 --- a/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c +++ b/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c @@ -1380,7 +1380,7 @@ die_base_type2enc(dwarf_t *dw, Dwarf_Off off, Dwarf_Signed enc, size_t sz) mult = 2; col = 1; } else if (enc == DW_ATE_imaginary_float -#if defined(sun) +#ifdef illumos || enc == DW_ATE_SUN_imaginary_float #endif ) @@ -1431,7 +1431,7 @@ die_base_from_dwarf(dwarf_t *dw, Dwarf_Die base, Dwarf_Off off, size_t sz) case DW_ATE_float: case DW_ATE_complex_float: case DW_ATE_imaginary_float: -#if defined(sun) +#ifdef illumos case DW_ATE_SUN_imaginary_float: case DW_ATE_SUN_interval_float: #endif diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/output.c b/cddl/contrib/opensolaris/tools/ctf/cvt/output.c index af797690a..3131e7fb8 100644 --- a/cddl/contrib/opensolaris/tools/ctf/cvt/output.c +++ b/cddl/contrib/opensolaris/tools/ctf/cvt/output.c @@ -576,7 +576,7 @@ write_file(Elf *src, const char *srcname, Elf *dst, const char *dstname, shdr.sh_name); } -#if !defined(sun) +#ifndef illumos if (gelf_update_shdr(dscn, &shdr) == 0) elfterminate(dstname, "Cannot update sect %s", sname); #endif @@ -585,7 +585,7 @@ write_file(Elf *src, const char *srcname, Elf *dst, const char *dstname, elfterminate(srcname, "Cannot get sect %s data", sname); if ((ddata = elf_newdata(dscn)) == NULL) elfterminate(dstname, "Can't make sect %s data", sname); -#if defined(sun) +#ifdef illumos bcopy(sdata, ddata, sizeof (Elf_Data)); #else /* @@ -645,7 +645,7 @@ write_file(Elf *src, const char *srcname, Elf *dst, const char *dstname, } } -#if !defined(sun) +#ifndef illumos if (ddata->d_buf == NULL && sdata->d_buf != NULL) { ddata->d_buf = xmalloc(shdr.sh_size); bcopy(sdata->d_buf, ddata->d_buf, shdr.sh_size); diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/tdata.c b/cddl/contrib/opensolaris/tools/ctf/cvt/tdata.c index 1ccd6cde5..d1a1ad0e7 100644 --- a/cddl/contrib/opensolaris/tools/ctf/cvt/tdata.c +++ b/cddl/contrib/opensolaris/tools/ctf/cvt/tdata.c @@ -173,7 +173,7 @@ tdesc_namecmp(void *arg1, void *arg2) return (!streq(tdp1->t_name, tdp2->t_name)); } -#if defined(sun) +#ifdef illumos /*ARGSUSED1*/ static int tdesc_print(void *data, void *private __unused) diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/util.c b/cddl/contrib/opensolaris/tools/ctf/cvt/util.c index 82dfe63ad..fb76cbaeb 100644 --- a/cddl/contrib/opensolaris/tools/ctf/cvt/util.c +++ b/cddl/contrib/opensolaris/tools/ctf/cvt/util.c @@ -171,7 +171,7 @@ aborterr(const char *format, ...) whine("ERROR", format, ap); va_end(ap); -#if defined(sun) +#ifdef illumos abort(); #else exit(0); diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index 19559849e..9266ffc81 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 @@ -424,7 +424,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); \ @@ -857,7 +857,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); @@ -891,7 +891,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, @@ -903,7 +903,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); @@ -1340,7 +1340,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; /* @@ -1465,7 +1465,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); @@ -1524,13 +1524,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 @@ -3190,7 +3190,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; @@ -3246,7 +3246,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); @@ -3383,7 +3383,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 @@ -3409,7 +3409,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. */ @@ -3431,7 +3431,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. */ @@ -3452,7 +3452,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); @@ -3477,7 +3477,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); @@ -3504,7 +3504,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. */ @@ -3529,7 +3529,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. */ @@ -3551,7 +3551,7 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_state_t *state, uint64_t v, #endif case DIF_VAR_ERRNO: { -#if defined(sun) +#ifdef illumos klwp_t *lwp; if (!dtrace_priv_proc(state)) return (0); @@ -3576,7 +3576,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; } @@ -4060,7 +4060,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; @@ -4083,7 +4083,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)) { @@ -4171,7 +4171,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)) { @@ -4250,7 +4250,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: { /* @@ -4360,7 +4360,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; @@ -4428,7 +4428,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) { @@ -4946,7 +4946,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; @@ -5462,7 +5462,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 @@ -5564,7 +5564,7 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, 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) { @@ -5687,7 +5687,7 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, 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 && @@ -5698,7 +5698,7 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, } if (tryzero != -1 && -#if defined(sun) +#ifdef illumos (ip6._S6_un._S6_u8[i] != 0 || #else (ip6.__u6_addr.__u6_addr8[i] != 0 || @@ -5714,7 +5714,7 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, 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 && @@ -5735,7 +5735,7 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, 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]; @@ -5780,7 +5780,7 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, 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 @@ -5826,7 +5826,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; @@ -6726,7 +6726,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"); @@ -6773,7 +6773,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. @@ -6797,7 +6797,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; @@ -6816,7 +6816,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]; @@ -7054,7 +7054,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 @@ -7079,7 +7079,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) { @@ -7186,7 +7186,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 @@ -7611,7 +7611,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 @@ -7619,7 +7619,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); @@ -8044,7 +8044,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. @@ -8638,7 +8638,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)); @@ -8653,7 +8653,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); @@ -8669,7 +8669,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); @@ -8705,7 +8705,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); @@ -8761,7 +8761,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); @@ -8770,7 +8770,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 @@ -8789,7 +8789,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); @@ -8882,7 +8882,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); @@ -8922,7 +8922,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 @@ -9093,7 +9093,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; @@ -9111,7 +9111,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 @@ -9134,7 +9134,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. @@ -10092,7 +10092,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) @@ -10730,7 +10730,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 @@ -10769,7 +10769,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 @@ -11128,7 +11128,7 @@ dtrace_ecb_aggregation_create(dtrace_ecb_t *ecb, dtrace_actdesc_t *desc) /* * 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 @@ -11182,7 +11182,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); @@ -11251,7 +11251,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, @@ -11803,13 +11803,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)); @@ -12680,7 +12680,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) || @@ -12985,7 +12985,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) { @@ -13028,7 +13028,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 @@ -13984,7 +13984,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++) { @@ -14064,7 +14064,7 @@ dtrace_vstate_fini(dtrace_vstate_t *vstate) } } -#if defined(sun) +#ifdef illumos static void dtrace_state_clean(dtrace_state_t *state) { @@ -14101,7 +14101,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) { @@ -14150,16 +14150,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 @@ -14174,7 +14174,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); @@ -14197,7 +14197,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); @@ -14225,7 +14225,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 @@ -14315,7 +14315,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 |= @@ -14357,7 +14357,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 @@ -14516,7 +14516,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 @@ -14700,7 +14700,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; @@ -14727,7 +14727,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)) { /* @@ -14861,7 +14861,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)) { /* @@ -14944,7 +14944,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); @@ -15022,7 +15022,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); @@ -15062,14 +15062,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 @@ -15121,7 +15121,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 @@ -15140,7 +15140,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); @@ -16031,7 +16031,7 @@ dtrace_helpers_create(proc_t *p) return (help); } -#if defined(sun) +#ifdef illumos static #endif void @@ -16039,7 +16039,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; @@ -16128,7 +16128,7 @@ dtrace_helpers_destroy(proc_t *p) mutex_exit(&dtrace_lock); } -#if defined(sun) +#ifdef illumos static #endif void @@ -16222,11 +16222,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 @@ -16237,7 +16237,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); @@ -16276,7 +16276,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) @@ -16284,12 +16284,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". */ @@ -16301,12 +16301,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); @@ -16324,7 +16324,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); @@ -16335,7 +16335,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); @@ -16351,7 +16351,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 @@ -16400,7 +16400,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); @@ -16409,13 +16409,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) { @@ -16434,7 +16434,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) { @@ -16507,7 +16507,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) { @@ -16555,7 +16555,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 @@ -16574,7 +16574,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) @@ -16730,15 +16730,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) @@ -16749,7 +16749,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); @@ -16786,7 +16786,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. @@ -16819,7 +16819,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 @@ -16835,7 +16835,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 @@ -16843,7 +16843,7 @@ static void dtrace_dtr(void *data) #endif { -#if defined(sun) +#ifdef illumos minor_t minor = getminor(dev); dtrace_state_t *state; #endif @@ -16896,7 +16896,7 @@ dtrace_dtr(void *data) #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. @@ -16915,12 +16915,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) @@ -17859,7 +17859,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) @@ -17882,7 +17882,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 19fb43c93..84b72d25a 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 @@ -215,7 +215,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 @@ -224,7 +224,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 @@ -288,7 +288,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; @@ -314,7 +314,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. */ @@ -586,20 +586,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) { @@ -638,7 +638,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); @@ -675,14 +675,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. @@ -699,7 +699,7 @@ fasttrap_fork(proc_t *p, proc_t *cp) #endif } -#if defined(sun) +#ifdef illumos mutex_enter(&cp->p_lock); sprunlock(cp); #else @@ -717,11 +717,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); @@ -741,7 +741,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); @@ -776,7 +776,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 @@ -884,7 +884,7 @@ fasttrap_tracepoint_enable(proc_t *p, fasttrap_probe_t *probe, uint_t index) * 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++; @@ -1076,7 +1076,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--; @@ -1129,7 +1129,7 @@ fasttrap_enable_callbacks(void) static void fasttrap_disable_callbacks(void) { -#if defined(sun) +#ifdef illumos ASSERT(MUTEX_HELD(&cpu_lock)); #endif @@ -1138,7 +1138,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; @@ -1148,7 +1148,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); @@ -1169,7 +1169,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 @@ -1196,7 +1196,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; @@ -1264,7 +1264,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 @@ -1279,7 +1279,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 @@ -1363,7 +1363,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(); @@ -1504,7 +1504,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 @@ -1544,7 +1544,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; @@ -1561,7 +1561,7 @@ fasttrap_proc_release(fasttrap_proc_t *proc) return; } -#if !defined(sun) +#ifndef illumos /* * Free all structures used to manage per-thread scratch space. */ @@ -1683,7 +1683,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 @@ -1764,7 +1764,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 @@ -1782,7 +1782,7 @@ fasttrap_provider_free(fasttrap_provider_t *provider) } p->p_dtrace_probes--; -#if !defined(sun) +#ifndef illumos PROC_UNLOCK(p); #endif } @@ -2323,7 +2323,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 /* @@ -2334,12 +2334,12 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag, if (p) fill_kinfo_proc(p, &kp); 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 @@ -2349,7 +2349,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); @@ -2357,7 +2357,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); @@ -2375,11 +2375,11 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag, 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 @@ -2389,7 +2389,7 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag, proc_t *p; pid_t pid = instr.ftiq_pid; -#if defined(sun) +#ifdef illumos mutex_enter(&pidlock); #endif /* @@ -2400,12 +2400,12 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag, if (p) fill_kinfo_proc(p, &kp); 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 @@ -2415,7 +2415,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)) != 0) { -#if defined(sun) +#ifdef illumos mutex_exit(&p->p_lock); #else PROC_UNLOCK(p); @@ -2424,7 +2424,7 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag, } #endif /* notyet */ -#if defined(sun) +#ifdef illumos mutex_exit(&p->p_lock); #else PROC_UNLOCK(p); @@ -2477,7 +2477,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); #endif @@ -2486,7 +2486,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 @@ -2506,7 +2506,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); @@ -2524,7 +2524,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); @@ -2534,7 +2534,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++) @@ -2560,7 +2560,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); @@ -2676,7 +2676,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++) @@ -2698,7 +2698,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 4bcdfc646..2ff8df6ae 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 29ef5651c..7b0e4dee6 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c @@ -1610,7 +1610,7 @@ arc_cksum_compute(arc_buf_t *buf, boolean_t force) mutex_exit(&buf->b_hdr->b_l1hdr.b_freeze_lock); #ifdef illumos arc_buf_watch(buf); -#endif /* illumos */ +#endif } #ifdef illumos @@ -1713,7 +1713,7 @@ arc_buf_thaw(arc_buf_t *buf) #ifdef illumos arc_buf_unwatch(buf); -#endif /* illumos */ +#endif } void @@ -2287,7 +2287,7 @@ arc_buf_destroy(arc_buf_t *buf, boolean_t remove) arc_cksum_verify(buf); #ifdef illumos arc_buf_unwatch(buf); -#endif /* illumos */ +#endif if (type == ARC_BUFC_METADATA) { arc_buf_data_free(buf, zio_buf_free); @@ -3412,7 +3412,7 @@ arc_available_memory(void) r = FMR_LOTSFREE; } -#ifdef sun +#ifdef illumos /* * check that we're out of range of the pageout scanner. It starts to * schedule paging if freemem is less than lotsfree and needfree. @@ -3455,7 +3455,7 @@ arc_available_memory(void) r = FMR_PAGES_PP_MAXIMUM; } -#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 @@ -3578,7 +3578,7 @@ arc_kmem_reap_now(void) kmem_cache_reap_now(hdr_l2only_cache); kmem_cache_reap_now(range_seg_cache); -#ifdef sun +#ifdef illumos if (zio_arena != NULL) { /* * Ask the vmem arena to reclaim unused memory from its @@ -4140,7 +4140,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_l1hdr.b_state == arc_anon) { @@ -4849,7 +4849,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); @@ -5291,7 +5291,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 @@ -5300,7 +5300,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, 16 << 20); /* 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 93a04260f..e3be098b7 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c @@ -1253,7 +1253,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) @@ -1309,7 +1309,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, @@ -1366,8 +1366,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 a295f90a2..01f2d146c 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c @@ -58,7 +58,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 @@ -840,7 +840,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 @@ -983,7 +983,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 95bccaac5..6b45e9429 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c @@ -3811,7 +3811,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. @@ -4012,7 +4012,7 @@ spa_import_rootpool(char *devpath, char *devid) return (error); } -#else +#else /* !illumos */ extern int vdev_geom_read_pool_label(const char *name, nvlist_t ***configs, uint64_t *count); @@ -4208,8 +4208,8 @@ spa_import_rootpool(const char *name) return (0); } -#endif /* sun */ -#endif +#endif /* illumos */ +#endif /* _KERNEL */ /* * Import a non-root pool into the system. @@ -5385,13 +5385,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) @@ -6648,12 +6648,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, @@ -6798,11 +6798,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 6ba19c90c..ee233c7b3 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 @@ -724,7 +724,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 be00621d9..6dc2b118b 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 @@ -625,7 +625,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 0f9a18bed..a93ba832c 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 @@ -256,7 +256,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 @@ -286,7 +286,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 75c6b3757..7556eda0f 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 a8464877f..429d31e10 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c @@ -3401,7 +3401,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; @@ -3418,7 +3418,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 6545dc2ff..fd6f9662c 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 22bbfb25b..693ba4127 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 @@ -113,7 +113,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; @@ -124,20 +124,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 }, @@ -146,7 +146,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 @@ -171,7 +171,7 @@ static gfs_dirent_t zfsctl_root_entries[] = { void zfsctl_init(void) { -#ifdef sun +#ifdef illumos VERIFY(gfs_make_opsvec(zfsctl_opsvec) == 0); #endif } @@ -179,7 +179,7 @@ zfsctl_init(void) void zfsctl_fini(void) { -#ifdef sun +#ifdef illumos /* * Remove vfsctl vnode ops */ @@ -199,7 +199,7 @@ zfsctl_fini(void) zfsctl_ops_snapshot = NULL; zfsctl_ops_shares = NULL; zfsctl_ops_shares_dir = NULL; -#endif /* sun */ +#endif /* illumos */ } boolean_t @@ -550,7 +550,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) @@ -566,9 +566,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 } }, @@ -583,7 +583,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 "..". @@ -677,7 +677,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) { @@ -697,13 +697,13 @@ zfsctl_unmount_snap(zfs_snapentry_t *sep, int fflags, cred_t *cr) kmem_free(sep, sizeof (zfs_snapentry_t)); return (0); -#else /* !sun */ +#else vfs_ref(vn_mountedvfs(svp)); 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) { @@ -756,9 +756,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, @@ -823,9 +823,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, @@ -881,7 +881,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'. @@ -1069,7 +1069,7 @@ zfsctl_snapdir_lookup(ap) } ZFS_EXIT(zfsvfs); return (err); -#endif /* !illumos */ +#endif /* illumos */ } sep = kmem_alloc(sizeof (zfs_snapentry_t), KM_SLEEP); @@ -1377,7 +1377,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 } }, @@ -1408,7 +1408,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, @@ -1437,7 +1437,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 197e122d9..e74799a70 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 6d9877bfc..52ed2b856 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 @@ -4860,7 +4860,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 @@ -4878,10 +4878,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() { @@ -4901,12 +4901,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; @@ -4997,9 +4997,9 @@ zfs_ioc_share(zfs_cmd_t *zc) return (error); -#else /* !sun */ +#else /* !illumos */ return (ENOSYS); -#endif /* !sun */ +#endif /* illumos */ } ace_t full_access[] = { @@ -5107,7 +5107,7 @@ zfs_ioc_diff(zfs_cmd_t *zc) return (error); } -#ifdef sun +#ifdef illumos /* * Remove all ACL files in shares dir */ @@ -5129,12 +5129,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; @@ -5258,9 +5258,9 @@ zfs_ioc_smb_acl(zfs_cmd_t *zc) ZFS_EXIT(zfsvfs); return (error); -#else /* !sun */ +#else /* !illumos */ return (EOPNOTSUPP); -#endif /* !sun */ +#endif /* illumos */ } /* @@ -6013,7 +6013,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 @@ -6358,7 +6358,7 @@ zfsdev_ioctl(struct cdev *dev, u_long zcmd, caddr_t arg, int flag, return (error); } -#ifdef sun +#ifdef illumos static int zfs_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) { @@ -6409,7 +6409,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. @@ -6420,7 +6420,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 */ @@ -6469,7 +6469,7 @@ static struct modlinkage modlinkage = { (void *)&zfs_modldrv, NULL }; -#endif /* sun */ +#endif /* illumos */ static struct cdevsw zfs_cdevsw = { .d_version = D_VERSION, @@ -6502,7 +6502,7 @@ zfsdev_fini(void) static struct root_hold_token *zfs_root_token; struct proc *zfsproc; -#ifdef sun +#ifdef illumos int _init(void) { @@ -6565,7 +6565,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 ae24ef000..6a76513fa 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 @@ zfs_replay_write2(zfsvfs_t *zfsvfs, lr_write_t *lr, boolean_t byteswap) 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 8e6604473..aac460b18 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 @@ -1566,13 +1566,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 @@ -1675,14 +1675,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); @@ -1937,7 +1937,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. @@ -2264,7 +2264,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 @@ -2273,7 +2273,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 5c26efe68..4f6b4bfc3 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 @@ -334,7 +334,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 @@ -763,7 +763,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; @@ -792,7 +792,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 - @@ -924,7 +924,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. @@ -935,7 +935,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. @@ -1187,10 +1187,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); @@ -2863,7 +2863,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]; @@ -2875,7 +2875,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) @@ -4497,7 +4497,7 @@ zfs_link(vnode_t *tdvp, vnode_t *svp, char *name, cred_t *cr, return (error); } -#ifdef sun +#ifdef illumos /* * zfs_null_putapage() is used when the file system has been force * unmounted. It just drops the pages. @@ -4725,7 +4725,7 @@ zfs_putpage(vnode_t *vp, offset_t off, size_t len, int flags, cred_t *cr, ZFS_EXIT(zfsvfs); return (error); } -#endif /* sun */ +#endif /* illumos */ /*ARGSUSED*/ void @@ -4778,7 +4778,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. * @@ -5194,7 +5194,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)); @@ -5282,7 +5282,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; @@ -5320,16 +5320,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); @@ -5388,7 +5388,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. @@ -5719,7 +5719,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 749ad53cc..9aae8e5df 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); @@ -1500,7 +1500,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 @@ -1514,7 +1514,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 da397a5cc..da479087f 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 66a860d66..57b23356b 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 2d1987be4..528814118 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 8e3f4cad1..6b7ab01b6 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 ca73689b9..d449294d7 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 f9e96895c..a65d1ae16 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 431307f46..ec3582f5d 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 6f591fa83..cae919377 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 f5156148b..29d616b0f 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 @@ -504,7 +504,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 8c5739b3b..a7d58e525 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 3558c2a7f..777d7480c 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 0d5a35a48..aa84f361d 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h @@ -115,7 +115,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 */ @@ -175,7 +175,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 77c9c0bf8..1496fa356 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 8df1090da..5d60a07cd 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 @@ fasttrap_pid_probe(struct reg *rp) 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); diff --git a/sys/cddl/dev/dtrace/amd64/instr_size.c b/sys/cddl/dev/dtrace/amd64/instr_size.c index 1acf2c581..b3afcb744 100644 --- a/sys/cddl/dev/dtrace/amd64/instr_size.c +++ b/sys/cddl/dev/dtrace/amd64/instr_size.c @@ -30,14 +30,14 @@ /* All Rights Reserved */ -#if defined(sun) +#ifdef illumos #pragma ident "@(#)instr_size.c 1.14 05/07/08 SMI" #endif #include #include #include -#if defined(sun) +#ifdef illumos #include #include #include @@ -104,7 +104,7 @@ dtrace_dis_isize(uchar_t *instr, dis_isize_t which, model_t model, int *rmindex) dis86_t x; uint_t mode = SIZE64; -#if defined(sun) +#ifdef illumos mode = (model == DATAMODEL_LP64) ? SIZE64 : SIZE32; #endif diff --git a/sys/cddl/dev/dtrace/dtrace_ioctl.c b/sys/cddl/dev/dtrace/dtrace_ioctl.c index e26109116..ef9bed561 100644 --- a/sys/cddl/dev/dtrace/dtrace_ioctl.c +++ b/sys/cddl/dev/dtrace/dtrace_ioctl.c @@ -578,14 +578,14 @@ dtrace_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, return (EINVAL); mutex_enter(&dtrace_provider_lock); -#if defined(sun) +#ifdef illumos mutex_enter(&mod_lock); #endif mutex_enter(&dtrace_lock); if (desc->dtargd_id > dtrace_nprobes) { mutex_exit(&dtrace_lock); -#if defined(sun) +#ifdef illumos mutex_exit(&mod_lock); #endif mutex_exit(&dtrace_provider_lock); @@ -594,7 +594,7 @@ dtrace_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, if ((probe = dtrace_probes[desc->dtargd_id - 1]) == NULL) { mutex_exit(&dtrace_lock); -#if defined(sun) +#ifdef illumos mutex_exit(&mod_lock); #endif mutex_exit(&dtrace_provider_lock); @@ -620,7 +620,7 @@ dtrace_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, probe->dtpr_id, probe->dtpr_arg, desc); } -#if defined(sun) +#ifdef illumos mutex_exit(&mod_lock); #endif mutex_exit(&dtrace_provider_lock); @@ -779,7 +779,7 @@ dtrace_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, dstate = &state->dts_vstate.dtvs_dynvars; for (i = 0; i < NCPU; i++) { -#if !defined(sun) +#ifndef illumos if (pcpu_find(i) == NULL) continue; #endif diff --git a/sys/cddl/dev/dtrace/i386/instr_size.c b/sys/cddl/dev/dtrace/i386/instr_size.c index 7f667f7e5..11fbf9b34 100644 --- a/sys/cddl/dev/dtrace/i386/instr_size.c +++ b/sys/cddl/dev/dtrace/i386/instr_size.c @@ -30,14 +30,14 @@ /* All Rights Reserved */ -#if defined(sun) +#ifdef illumos #pragma ident "@(#)instr_size.c 1.14 05/07/08 SMI" #endif #include #include #include -#if defined(sun) +#ifdef illumos #include #include #include @@ -104,7 +104,7 @@ dtrace_dis_isize(uchar_t *instr, dis_isize_t which, model_t model, int *rmindex) dis86_t x; uint_t mode = SIZE32; -#if defined(sun) +#ifdef illumos mode = (model == DATAMODEL_LP64) ? SIZE64 : SIZE32; #endif diff --git a/sys/cddl/dev/dtrace/x86/regset.h b/sys/cddl/dev/dtrace/x86/regset.h index b1c5116f3..ad12e26a5 100644 --- a/sys/cddl/dev/dtrace/x86/regset.h +++ b/sys/cddl/dev/dtrace/x86/regset.h @@ -61,7 +61,7 @@ extern "C" { #define REG_GSBASE 27 #define REG_FSBASE 26 -#if defined(sun) +#ifdef illumos #define REG_DS 25 #define REG_ES 24 @@ -89,7 +89,7 @@ extern "C" { #define REG_R13 2 #define REG_R14 1 #define REG_R15 0 -#else +#else /* !illumos */ #define REG_SS 25 #define REG_RSP 24 #define REG_RFL 23 @@ -116,13 +116,13 @@ extern "C" { #define REG_R13 2 #define REG_R14 1 #define REG_R15 0 -#endif +#endif /* illumos */ /* * The names and offsets defined here are specified by i386 ABI suppl. */ -#if defined(sun) +#ifdef illumos #define SS 18 /* only stored on a privilege transition */ #define UESP 17 /* only stored on a privilege transition */ #define EFL 16 @@ -142,7 +142,7 @@ extern "C" { #define ES 2 #define FS 1 #define GS 0 -#else +#else /* !illumos */ #define GS 18 #define SS 17 /* only stored on a privilege transition */ #define UESP 16 /* only stored on a privilege transition */ @@ -162,7 +162,7 @@ extern "C" { #define DS 2 #define ES 1 #define FS 0 -#endif +#endif /* illumos */ #define REG_PC EIP #define REG_FP EBP -- 2.45.0