diff options
author | mav <mav@FreeBSD.org> | 2016-03-20 20:00:25 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2016-03-20 20:00:25 +0000 |
commit | e727ce4355229a44282d4a47836d884f81341982 (patch) | |
tree | 9491d1229ccce6400ac77eb074ff0adec7962f04 /cddl/contrib/opensolaris | |
parent | 4a8be1848456afda0ef2335f0ed1a0b7f4e44cbf (diff) | |
download | FreeBSD-src-e727ce4355229a44282d4a47836d884f81341982.zip FreeBSD-src-e727ce4355229a44282d4a47836d884f81341982.tar.gz |
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.
Diffstat (limited to 'cddl/contrib/opensolaris')
53 files changed, 323 insertions, 328 deletions
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c index 3a954ed..d8bdaa6 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c @@ -43,11 +43,11 @@ #include <fcntl.h> #include <errno.h> #include <signal.h> -#if defined(sun) +#ifdef illumos #include <alloca.h> #endif #include <libgen.h> -#if defined(sun) +#ifdef illumos #include <libproc.h> #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 07f7cda..4f2f2c7 100644 --- a/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c +++ b/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c @@ -46,10 +46,9 @@ #include <signal.h> #include <assert.h> -#if defined(sun) +#ifdef illumos #define GETOPT_EOF EOF #else -/* FreeBSD */ #include <sys/time.h> #include <sys/resource.h> @@ -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 78b27d2..5361607 100644 --- a/cddl/contrib/opensolaris/cmd/lockstat/sym.c +++ b/cddl/contrib/opensolaris/cmd/lockstat/sym.c @@ -42,12 +42,11 @@ #include <libelf.h> #include <link.h> #include <elf.h> -#if defined(sun) +#ifdef illumos #include <sys/machelf.h> #include <kstat.h> #else -/* FreeBSD */ #include <sys/elf.h> #include <sys/ksyms.h> #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 602969e..7bfc06b 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 a0932ad..737d222 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 1288468..8dfb0ba 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 = "<unknown>"; @@ -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 54135f1..cb6ace4 100644 --- a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c +++ b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c @@ -65,7 +65,7 @@ #include <zfs_prop.h> #include <zfs_deleg.h> #include <libuutil.h> -#ifdef sun +#ifdef illumos #include <aclutils.h> #include <directory.h> #include <idmap.h> @@ -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 a7747f6..ee6b01d 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 a1d1836..91609ce 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 5822267..b9f512d 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 <unistd.h> #include <fcntl.h> #include <errno.h> -#if defined(sun) +#ifdef illumos #include <dlfcn.h> #else #include <zlib.h> #endif #include <gelf.h> -#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 b2854d2..1ee873b 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 6b571fa..5ea55a0 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 <unistd.h> #include <dt_impl.h> #include <assert.h> -#if defined(sun) +#ifdef illumos #include <alloca.h> #else #include <sys/sysctl.h> @@ -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 35b8f02..84f8661 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 2ed50c6..04c022b 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 <limits.h> #include <assert.h> #include <ctype.h> -#if defined(sun) +#ifdef illumos #include <alloca.h> #endif #include <dt_impl.h> #include <dt_pq.h> -#if !defined(sun) +#ifndef illumos #include <libproc_compat.h> #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 5442683..4fc8876 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 <sys/types.h> -#if defined(sun) +#ifdef illumos #include <sys/sysmacros.h> #endif #include <strings.h> -#if defined(sun) +#ifdef illumos #include <alloca.h> #endif #include <assert.h> diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c index 2327ff7..339e2de 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 fe1ec7a..f26126b 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 <errno.h> #include <unistd.h> #include <assert.h> -#if defined(sun) +#ifdef illumos #include <alloca.h> #endif diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c index 5a2f0e4..b9164ac 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 <sys/sysmacros.h> #endif #include <strings.h> #include <stdlib.h> -#if defined(sun) +#ifdef illumos #include <alloca.h> #endif #include <assert.h> #include <errno.h> #include <ctype.h> -#if defined(sun) +#ifdef illumos #include <sys/procfs_isa.h> #endif #include <limits.h> diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h index b7abbc2..348231c 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 <sys/param.h> #include <sys/objfs.h> -#if !defined(sun) +#ifndef illumos #include <sys/bitmap.h> #include <sys/utsname.h> #include <sys/ioccom.h> @@ -45,7 +45,7 @@ #include <libctf.h> #include <dtrace.h> #include <gelf.h> -#if defined(sun) +#ifdef illumos #include <synch.h> #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 bd41171..192e1e2 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 dd8a2de..b73c67e 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 <elf.h> #include <sys/types.h> -#if defined(sun) +#ifdef illumos #include <sys/sysmacros.h> #else #define P2ROUNDUP(x, align) (-(-(x) & -(align))) @@ -38,7 +38,7 @@ #include <unistd.h> #include <strings.h> -#if defined(sun) +#ifdef illumos #include <alloca.h> #endif #include <limits.h> @@ -47,7 +47,7 @@ #include <stdio.h> #include <fcntl.h> #include <errno.h> -#if defined(sun) +#ifdef illumos #include <wait.h> #else #include <sys/wait.h> @@ -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 6ab7cd9..20081ed 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 9dd52b5..b3fe516 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 <sys/types.h> -#if defined(sun) +#ifdef illumos #include <sys/modctl.h> #include <sys/kobj.h> #include <sys/kobj_impl.h> @@ -41,7 +41,7 @@ #endif #include <unistd.h> -#if defined(sun) +#ifdef illumos #include <project.h> #endif #include <strings.h> @@ -51,7 +51,7 @@ #include <assert.h> #include <errno.h> #include <dirent.h> -#if !defined(sun) +#ifndef illumos #include <fcntl.h> #include <libproc_compat.h> #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 f6c140b..f0e1294 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 <sys/types.h> -#if defined(sun) +#ifdef illumos #include <sys/modctl.h> #include <sys/systeminfo.h> #endif @@ -34,7 +34,7 @@ #include <libelf.h> #include <strings.h> -#if defined(sun) +#ifdef illumos #include <alloca.h> #endif #include <limits.h> @@ -55,7 +55,7 @@ #include <dt_printf.h> #include <dt_string.h> #include <dt_provider.h> -#if !defined(sun) +#ifndef illumos #include <sys/sysctl.h> #include <string.h> #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 @@ alloc: 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 @@ alloc: 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 @@ alloc: 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 @@ alloc: return (set_open_errno(dtp, errp, EDT_NOMEM)); #endif -#if defined(sun) +#ifdef illumos #ifdef __x86 /* * On x86 systems, __i386 is defined for <sys/isa_defs.h> for 32-bit @@ -1277,7 +1277,7 @@ alloc: * '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 832af88..e9164d0 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 <stdlib.h> #include <unistd.h> #include <limits.h> -#if defined(sun) +#ifdef illumos #include <alloca.h> #endif #include <errno.h> @@ -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 6ce3dad..ee31cef 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 <setjmp.h> #include <strings.h> #include <assert.h> -#if defined(sun) +#ifdef illumos #include <alloca.h> #endif #include <stdlib.h> diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c index c865a2d..2472d8e 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 <stdio.h> #include <errno.h> #include <ctype.h> -#if defined(sun) +#ifdef illumos #include <alloca.h> #endif #include <libgen.h> @@ -44,7 +44,7 @@ #include <dt_program.h> #include <dt_pid.h> #include <dt_string.h> -#if !defined(sun) +#ifndef illumos #include <libproc_compat.h> #endif #include <dt_module.h> @@ -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 760c2f6..50d0680 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 <assert.h> #include <strings.h> -#if defined(sun) +#ifdef illumos #include <alloca.h> #endif #include <fcntl.h> diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c index 720eba6..d408aed 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 <sys/sysmacros.h> #else #define ABS(a) ((a) < 0 ? -(a) : (a)) @@ -33,7 +33,7 @@ #include <string.h> #include <strings.h> #include <stdlib.h> -#if defined(sun) +#ifdef illumos #include <alloca.h> #endif #include <assert.h> @@ -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 d40a0ae..79c1871 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 <sys/wait.h> -#if defined(sun) +#ifdef illumos #include <sys/lwp.h> #endif #include <strings.h> @@ -89,7 +89,7 @@ #include <dt_pid.h> #include <dt_impl.h> -#if !defined(sun) +#ifndef illumos #include <sys/syscall.h> #include <libproc_compat.h> #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 @@ pwait_locked: 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 @@ pwait_locked: 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 a325c42..232a372 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 <errno.h> #include <assert.h> #include <ctype.h> -#if defined(sun) +#ifdef illumos #include <alloca.h> #endif diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c index 0f1bfe0..9d6c12b 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 <sys/types.h> -#if defined(sun) +#ifdef illumos #include <sys/sysmacros.h> #endif @@ -36,7 +36,7 @@ #include <limits.h> #include <strings.h> #include <stdlib.h> -#if defined(sun) +#ifdef illumos #include <alloca.h> #endif #include <unistd.h> diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c index 4429019..72fd08a 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 <sys/sysmacros.h> #endif #include <sys/isa_defs.h> @@ -38,7 +38,7 @@ #include <stdio.h> #include <errno.h> #include <ctype.h> -#if defined(sun) +#ifdef illumos #include <alloca.h> #else #include <sys/sysctl.h> @@ -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 d19fb88..07565e0 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 6f88e6d..f0088a9 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h @@ -37,7 +37,7 @@ #include <stdio.h> #include <gelf.h> #include <libproc.h> -#if !defined(sun) +#ifndef illumos #include <rtld_db.h> #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 9479e83..34d5587 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 <dis_tables.h> -#if !defined(sun) +#ifndef illumos #define PR_MODEL_ILP32 1 #define PR_MODEL_LP64 2 #include <libproc_compat.h> @@ -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 fe4a382..6da5cf2 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 <libgen.h> #include <stdlib.h> #include <limits.h> -#if defined(sun) +#ifdef illumos #include <widec.h> #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 246449c..8ab1546 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 44a9f00..3e7a551 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 @@ badlabel: "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 @@ out: 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 3b17579..bb49eba 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 87b41cf..0987024 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 b94af5b..f03da99 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 5fd9612..7cdcfc9 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 e99231d..3ba069e 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 6f70604..1316aec 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 bc278b0..c071962 100644 --- a/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.c +++ b/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.c @@ -38,7 +38,7 @@ */ #include <pthread.h> -#if defined(sun) +#ifdef illumos #include <synch.h> #endif #include <stdio.h> @@ -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 c7e6212..babf2e6 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 <synch.h> #else #include <semaphore.h> diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/ctfconvert.c b/cddl/contrib/opensolaris/tools/ctf/cvt/ctfconvert.c index efe6c27..d40be25 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 3e030c7..a3d05ad 100644 --- a/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c +++ b/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c @@ -176,20 +176,20 @@ #include <unistd.h> #include <pthread.h> #include <assert.h> -#if defined(sun) +#ifdef illumos #include <synch.h> #endif #include <signal.h> #include <libgen.h> #include <string.h> #include <errno.h> -#if defined(sun) +#ifdef illumos #include <alloca.h> #endif #include <sys/param.h> #include <sys/types.h> #include <sys/mman.h> -#if defined(sun) +#ifdef illumos #include <sys/sysconf.h> #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 63d4d1e..5725401 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 af79769..3131e7f 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 1ccd6cd..d1a1ad0 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 82dfe63..fb76cba 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); |