From bc96366c864c07ef352edb92017357917c75b36c Mon Sep 17 00:00:00 2001 From: Steven Hartland Date: Sat, 17 Jan 2015 14:44:59 +0000 Subject: Mechanically convert cddl sun #ifdef's to illumos Since the upstream for cddl code is now illumos not sun, mechanically convert all sun #ifdef's to illumos #ifdef's which have been used in all newer code for some time. Also do a manual pass to correct the use if #ifdef comments as per style(9) as well as few uses of #if defined(__FreeBSD__) vs #ifndef illumos. MFC after: 1 month Sponsored by: Multiplay --- .../opensolaris/lib/libctf/common/ctf_lib.c | 10 ++-- .../opensolaris/lib/libdtrace/common/drti.c | 24 ++++----- .../lib/libdtrace/common/dt_aggregate.c | 4 +- .../opensolaris/lib/libdtrace/common/dt_cc.c | 10 ++-- .../opensolaris/lib/libdtrace/common/dt_consume.c | 6 +-- .../opensolaris/lib/libdtrace/common/dt_dof.c | 4 +- .../opensolaris/lib/libdtrace/common/dt_error.c | 2 +- .../opensolaris/lib/libdtrace/common/dt_handle.c | 2 +- .../opensolaris/lib/libdtrace/common/dt_ident.c | 6 +-- .../opensolaris/lib/libdtrace/common/dt_impl.h | 14 +++--- .../opensolaris/lib/libdtrace/common/dt_lex.l | 10 ++-- .../opensolaris/lib/libdtrace/common/dt_link.c | 32 ++++++------ .../opensolaris/lib/libdtrace/common/dt_map.c | 8 +-- .../opensolaris/lib/libdtrace/common/dt_module.c | 24 ++++----- .../opensolaris/lib/libdtrace/common/dt_open.c | 55 ++++++++++---------- .../opensolaris/lib/libdtrace/common/dt_options.c | 6 +-- .../opensolaris/lib/libdtrace/common/dt_parser.c | 2 +- .../opensolaris/lib/libdtrace/common/dt_pid.c | 30 +++++------ .../opensolaris/lib/libdtrace/common/dt_pragma.c | 2 +- .../opensolaris/lib/libdtrace/common/dt_printf.c | 18 +++---- .../opensolaris/lib/libdtrace/common/dt_proc.c | 58 +++++++++++----------- .../opensolaris/lib/libdtrace/common/dt_program.c | 2 +- .../opensolaris/lib/libdtrace/common/dt_provider.c | 4 +- .../opensolaris/lib/libdtrace/common/dt_subr.c | 16 +++--- .../opensolaris/lib/libdtrace/common/dt_work.c | 2 +- .../opensolaris/lib/libdtrace/common/dtrace.h | 6 +-- .../opensolaris/lib/libdtrace/i386/dt_isadep.c | 10 ++-- .../contrib/opensolaris/lib/libgen/common/gmatch.c | 4 +- .../contrib/opensolaris/lib/libzfs/common/libzfs.h | 4 +- .../opensolaris/lib/libzfs/common/libzfs_dataset.c | 28 +++++------ .../opensolaris/lib/libzfs/common/libzfs_diff.c | 2 +- .../opensolaris/lib/libzfs/common/libzfs_import.c | 18 +++---- .../opensolaris/lib/libzfs/common/libzfs_mount.c | 24 ++++----- .../opensolaris/lib/libzfs/common/libzfs_pool.c | 26 +++++----- .../lib/libzfs/common/libzfs_sendrecv.c | 2 +- .../opensolaris/lib/libzfs/common/libzfs_util.c | 6 +-- 36 files changed, 240 insertions(+), 241 deletions(-) (limited to 'cddl/contrib/opensolaris/lib') diff --git a/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c b/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c index 58222670f4ff..b9f512d37739 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 6f3c9c7d3de9..fdfe416804fc 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) +#ifdef illumos #pragma init(dtrace_dof_init) #else static void dtrace_dof_init(void) __attribute__ ((constructor)); @@ -99,7 +99,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; @@ -111,14 +111,14 @@ dtrace_dof_init(void) #endif dof_helper_t dh; Link_map *lmp = NULL; -#if defined(sun) +#ifdef illumos Lmid_t lmid; #else u_long lmid = 0; #endif int fd; const char *p; -#if !defined(sun) +#ifndef illumos Elf *e; Elf_Scn *scn = NULL; Elf_Data *dofdata = NULL; @@ -141,7 +141,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; @@ -152,7 +152,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"); @@ -215,7 +215,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. @@ -237,14 +237,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; } @@ -254,7 +254,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 6b571fafdd04..5ea55a05faf0 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 35b8f0289b9f..84f8661e3fb4 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 072cb0558813..7eae3986e93a 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 @@ -2958,7 +2958,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 0b531c5e6883..a4e325671f9f 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 2327ff75e4d4..339e2de5d150 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 fe1ec7a80f71..f26126bba517 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 5a2f0e4c1f5c..b9164ac26cf9 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 8cf5fe2d140b..c9e8e20d0b71 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 032d3034d67a..925f8a5875e9 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 } @@ -838,7 +838,7 @@ id_or_type(const char *s) return (ttok); } -#if defined(sun) +#ifdef illumos static int input(void) { @@ -880,4 +880,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 771f1ae287b6..3991714086a7 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 @@ -322,7 +322,7 @@ prepare_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, dof_elf64_t *dep) char *strtab; int i, j, nrel; size_t strtabsz = 1; -#if defined(sun) +#ifdef illumos uint32_t count = 0; #else uint64_t count = 0; @@ -434,7 +434,7 @@ prepare_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, dof_elf64_t *dep) #elif defined(__i386) || defined(__amd64) rel->r_offset = s->dofs_offset + dofr[j].dofr_offset; -#if defined(sun) +#ifdef illumos rel->r_info = ELF64_R_INFO(count + dep->de_global, R_AMD64_64); #else @@ -711,7 +711,7 @@ dump_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, int fd) shp = &elf_file.shdr[ESHDR_DOF]; shp->sh_name = 11; /* DTRACE_SHSTRTAB64[11] = ".SUNW_dof" */ -#if defined(sun) +#ifdef illumos shp->sh_flags = SHF_ALLOC; #else shp->sh_flags = SHF_WRITE | SHF_ALLOC; @@ -1613,7 +1613,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 @@ -1647,7 +1647,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) { @@ -1663,7 +1663,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) { @@ -1684,7 +1684,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]; #endif char drti[PATH_MAX]; @@ -1694,7 +1694,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 " @@ -1770,7 +1770,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 @@ -1816,7 +1816,7 @@ 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 @@ -1826,7 +1826,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags, else status = dump_elf32(dtp, dof, fd); -#if defined(sun) +#ifdef illumos if (status != 0 || lseek(fd, 0, SEEK_SET) != 0) { return (dt_link_error(dtp, NULL, -1, NULL, "failed to write %s: %s", file, strerror(errno))); @@ -1839,7 +1839,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags, #endif 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, 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 6ab7cd9619c3..20081edfe75a 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 9dd52b53263d..b3fe51669cc0 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 0eb2a2cdcc2f..b8b146732a89 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c @@ -26,11 +26,10 @@ */ #include -#if defined(sun) +#ifdef illumos #include #include #else -/* FreeBSD */ #include #include #include @@ -39,7 +38,7 @@ #include #include -#if defined(sun) +#ifdef illumos #include #endif #include @@ -60,7 +59,7 @@ #include #include #include -#if !defined(sun) +#ifndef illumos #include #include #endif @@ -164,7 +163,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]; @@ -246,7 +245,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 }, @@ -297,13 +296,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 *)" }, @@ -328,7 +327,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 @@ -342,7 +341,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 *)" }, @@ -413,7 +412,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 *)" }, @@ -471,7 +470,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 }, @@ -531,12 +530,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 @@ -780,7 +779,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 @@ -789,7 +788,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 */ @@ -814,7 +813,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)); @@ -850,7 +849,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; @@ -897,7 +896,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; @@ -982,7 +981,7 @@ dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *dfp) } if (p_providers != NULL) free(p_providers); -#endif +#endif /* illumos */ } static void @@ -999,7 +998,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) { @@ -1112,7 +1111,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); @@ -1154,7 +1153,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; @@ -1170,7 +1169,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; @@ -1202,7 +1201,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)); @@ -1242,7 +1241,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 for 32-bit @@ -1282,7 +1281,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; @@ -1644,7 +1643,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 832af888446a..e9164d09a857 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 6ce3dadd4e84..ee31cef5f28c 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 6c529e5e6033..e628e62e9cc4 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 @@ -468,7 +468,7 @@ dt_pid_fix_mod(dtrace_probedesc_t *pdp, struct ps_prochandle *P) else obj++; -#if defined(sun) +#ifdef illumos (void) Plmid(P, pmp->pr_vaddr, &lmid); #endif @@ -599,13 +599,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", @@ -618,7 +618,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 @@ -634,13 +634,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)); diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c index 7f49f640a944..bd0d708bde5a 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 eeb8735f6f05..ae26d55ba8be 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 @@ -1657,7 +1657,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) { /* @@ -1739,7 +1739,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 @@ -1814,7 +1814,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 d40a0ae1eb18..79c187140de9 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 @@ 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 a325c42cbf23..232a3723b11d 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 cd8ceb655934..29138746cfd9 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 4429019d5bf7..72fd08aee2c1 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 d19fb88245e2..07565e0f7850 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 6f88e6d46c42..f0088a939cb0 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 9479e83dd777..34d558767b9e 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 199fbb356036..ae65019d3e9f 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 8a707d1f795c..fbfaab1d6cc5 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h @@ -789,10 +789,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 8df7471cb87f..6d9b68ffde49 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c @@ -1112,7 +1112,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. @@ -1161,11 +1161,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; } @@ -2423,7 +2423,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 */ @@ -2457,9 +2457,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; @@ -2569,7 +2569,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; @@ -2594,10 +2594,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 */ } /* @@ -2632,7 +2632,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. @@ -2678,9 +2678,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) { @@ -4184,7 +4184,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) @@ -4266,7 +4266,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 ab2007d98a33..dde329a8226f 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c @@ -494,7 +494,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 49a43855d5fe..67eba1b88eb7 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c @@ -952,7 +952,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) @@ -975,12 +975,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; @@ -996,10 +996,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) { @@ -1033,7 +1033,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) @@ -1063,7 +1063,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); @@ -1075,12 +1075,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 f8596ede3ba6..6c115153bf07 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 b8f126cd8f7b..78a34f931d67 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c @@ -409,7 +409,7 @@ bootfs_name_valid(const char *pool, char *bootfs) static boolean_t pool_uses_efi(nvlist_t *config) { -#ifdef sun +#ifdef illumos nvlist_t **child; uint_t c, children; @@ -421,7 +421,7 @@ pool_uses_efi(nvlist_t *config) if (pool_uses_efi(child[c])) return (B_TRUE); } -#endif /* sun */ +#endif /* illumos */ return (B_FALSE); } @@ -575,7 +575,7 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname, verify(nvlist_lookup_nvlist(zpool_get_config(zhp, NULL), ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0); -#ifdef sun +#ifdef illumos /* * bootfs property cannot be set on a disk which has * been EFI labeled. @@ -588,7 +588,7 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname, zpool_close(zhp); goto error; } -#endif /* sun */ +#endif /* illumos */ zpool_close(zhp); break; @@ -2384,7 +2384,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; @@ -2414,7 +2414,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); } @@ -3470,7 +3470,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; @@ -3495,10 +3495,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); @@ -3888,7 +3888,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 @@ -3953,7 +3953,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, @@ -3962,7 +3962,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; @@ -4067,7 +4067,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 91857b65a8d6..954adac6c239 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c @@ -949,7 +949,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 3b5991422155..427b2fd8dee4 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c @@ -687,7 +687,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); @@ -739,7 +739,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) == @@ -759,7 +759,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); } -- cgit v1.2.3