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
This commit is contained in:
Steven Hartland 2015-01-17 14:44:59 +00:00
parent b0b74fb366
commit bc96366c86
94 changed files with 746 additions and 752 deletions

View File

@ -43,11 +43,11 @@
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
#if defined(sun) #ifdef illumos
#include <alloca.h> #include <alloca.h>
#endif #endif
#include <libgen.h> #include <libgen.h>
#if defined(sun) #ifdef illumos
#include <libproc.h> #include <libproc.h>
#endif #endif
@ -101,7 +101,7 @@ static int g_grabanon = 0;
static const char *g_ofile = NULL; static const char *g_ofile = NULL;
static FILE *g_ofp; static FILE *g_ofp;
static dtrace_hdl_t *g_dtp; static dtrace_hdl_t *g_dtp;
#if defined(sun) #ifdef illumos
static char *g_etcfile = "/etc/system"; static char *g_etcfile = "/etc/system";
static const char *g_etcbegin = "* vvvv Added by DTrace"; static const char *g_etcbegin = "* vvvv Added by DTrace";
static const char *g_etcend = "* ^^^^ Added by DTrace"; static const char *g_etcend = "* ^^^^ Added by DTrace";
@ -211,7 +211,7 @@ fatal(const char *fmt, ...)
static void static void
dfatal(const char *fmt, ...) dfatal(const char *fmt, ...)
{ {
#if !defined(sun) && defined(NEED_ERRLOC) #if !defined(illumos) && defined(NEED_ERRLOC)
char *p_errfile = NULL; char *p_errfile = NULL;
int errline = 0; int errline = 0;
#endif #endif
@ -232,7 +232,7 @@ dfatal(const char *fmt, ...)
(void) fprintf(stderr, "%s\n", (void) fprintf(stderr, "%s\n",
dtrace_errmsg(g_dtp, dtrace_errno(g_dtp))); 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); dt_get_errloc(g_dtp, &p_errfile, &errline);
if (p_errfile != NULL) if (p_errfile != NULL)
printf("File '%s', line %d\n", p_errfile, errline); printf("File '%s', line %d\n", p_errfile, errline);
@ -397,7 +397,7 @@ dof_prune(const char *fname)
free(buf); free(buf);
} }
#if defined(sun) #ifdef illumos
static void static void
etcsystem_prune(void) etcsystem_prune(void)
{ {
@ -508,7 +508,7 @@ etcsystem_add(void)
error("added forceload directives to %s\n", g_ofile); error("added forceload directives to %s\n", g_ofile);
} }
#endif #endif /* illumos */
static void static void
print_probe_info(const dtrace_probeinfo_t *p) 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; p = (uchar_t *)dof;
q = p + dof->dofh_loadsz; q = p + dof->dofh_loadsz;
#if defined(sun) #ifdef illumos
oprintf("dof-data-%d=0x%x", n, *p++); oprintf("dof-data-%d=0x%x", n, *p++);
while (p < q) while (p < q)
@ -793,7 +793,7 @@ compile_str(dtrace_cmd_t *dcp)
static void static void
prochandler(struct ps_prochandle *P, const char *msg, void *arg) prochandler(struct ps_prochandle *P, const char *msg, void *arg)
{ {
#if defined(sun) #ifdef illumos
const psinfo_t *prp = Ppsinfo(P); const psinfo_t *prp = Ppsinfo(P);
int pid = Pstatus(P)->pr_pid; int pid = Pstatus(P)->pr_pid;
char name[SIG2STR_MAX]; char name[SIG2STR_MAX];
@ -807,13 +807,13 @@ prochandler(struct ps_prochandle *P, const char *msg, void *arg)
return; return;
} }
#if defined(sun) #ifdef illumos
switch (Pstate(P)) { switch (Pstate(P)) {
#else #else
switch (proc_state(P)) { switch (proc_state(P)) {
#endif #endif
case PS_UNDEAD: case PS_UNDEAD:
#if defined(sun) #ifdef illumos
/* /*
* Ideally we would like to always report pr_wstat here, but it * Ideally we would like to always report pr_wstat here, but it
* isn't possible given current /proc semantics. If we grabbed * 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, notice("pid %d terminated by %d\n", pid,
WTERMSIG(wstatus)); WTERMSIG(wstatus));
#endif #endif
#if defined(sun) #ifdef illumos
} else if (prp != NULL && WEXITSTATUS(prp->pr_wstat) != 0) { } else if (prp != NULL && WEXITSTATUS(prp->pr_wstat) != 0) {
notice("pid %d exited with status %d\n", notice("pid %d exited with status %d\n",
pid, WEXITSTATUS(prp->pr_wstat)); pid, WEXITSTATUS(prp->pr_wstat));
@ -1238,7 +1238,7 @@ installsighands(void)
if (sigaction(SIGTERM, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN) if (sigaction(SIGTERM, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
(void) sigaction(SIGTERM, &act, NULL); (void) sigaction(SIGTERM, &act, NULL);
#if !defined(sun) #ifndef illumos
if (sigaction(SIGPIPE, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN) if (sigaction(SIGPIPE, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
(void) sigaction(SIGPIPE, &act, NULL); (void) sigaction(SIGPIPE, &act, NULL);
@ -1720,7 +1720,7 @@ main(int argc, char *argv[])
case DMODE_ANON: case DMODE_ANON:
if (g_ofile == NULL) if (g_ofile == NULL)
#if defined(sun) #ifdef illumos
g_ofile = "/kernel/drv/dtrace.conf"; g_ofile = "/kernel/drv/dtrace.conf";
#else #else
/* /*
@ -1732,7 +1732,7 @@ main(int argc, char *argv[])
#endif #endif
dof_prune(g_ofile); /* strip out any old DOF directives */ dof_prune(g_ofile); /* strip out any old DOF directives */
#if defined(sun) #ifdef illumos
etcsystem_prune(); /* string out any forceload directives */ etcsystem_prune(); /* string out any forceload directives */
#endif #endif
@ -1765,7 +1765,7 @@ main(int argc, char *argv[])
* that itself contains a #pragma D option quiet. * that itself contains a #pragma D option quiet.
*/ */
error("saved anonymous enabling in %s\n", g_ofile); error("saved anonymous enabling in %s\n", g_ofile);
#if defined(sun) #ifdef illumos
etcsystem_add(); etcsystem_add();
error("run update_drv(1M) or reboot to enable changes\n"); error("run update_drv(1M) or reboot to enable changes\n");
#endif #endif

View File

@ -46,10 +46,9 @@
#include <signal.h> #include <signal.h>
#include <assert.h> #include <assert.h>
#if defined(sun) #ifdef illumos
#define GETOPT_EOF EOF #define GETOPT_EOF EOF
#else #else
/* FreeBSD */
#include <sys/time.h> #include <sys/time.h>
#include <sys/resource.h> #include <sys/resource.h>
@ -57,7 +56,7 @@
#define GETOPT_EOF (-1) #define GETOPT_EOF (-1)
typedef uintptr_t pc_t; typedef uintptr_t pc_t;
#endif /* defined(sun) */ #endif
#define LOCKSTAT_OPTSTR "x:bths:n:d:i:l:f:e:ckwWgCHEATID:RpPo:V" #define LOCKSTAT_OPTSTR "x:bths:n:d:i:l:f:e:ckwWgCHEATID:RpPo:V"
@ -214,10 +213,9 @@ static ls_event_info_t g_event_info[LS_MAX_EVENTS] = {
{ 'H', "Lock", "Unknown event (type 53)", "units" }, { 'H', "Lock", "Unknown event (type 53)", "units" },
{ 'H', "Lock", "Unknown event (type 54)", "units" }, { 'H', "Lock", "Unknown event (type 54)", "units" },
{ 'H', "Lock", "Unknown event (type 55)", "units" }, { 'H', "Lock", "Unknown event (type 55)", "units" },
#if defined(sun) #ifdef illumos
{ 'I', "CPU+PIL", "Profiling interrupt", "nsec", { 'I', "CPU+PIL", "Profiling interrupt", "nsec",
#else #else
/* FreeBSD */
{ 'I', "CPU+Pri_Class", "Profiling interrupt", "nsec", { 'I', "CPU+Pri_Class", "Profiling interrupt", "nsec",
#endif #endif
"profile:::profile-97", NULL }, "profile:::profile-97", NULL },
@ -231,7 +229,7 @@ static ls_event_info_t g_event_info[LS_MAX_EVENTS] = {
{ 'E', "Lock", "Lockstat record failure", "(N/A)" }, { 'E', "Lock", "Lockstat record failure", "(N/A)" },
}; };
#if !defined(sun) #ifndef illumos
static char *g_pri_class[] = { static char *g_pri_class[] = {
"", "",
"Intr", "Intr",
@ -598,7 +596,7 @@ filter_add(char **filt, char *what, uintptr_t base, uintptr_t size)
*filt[0] = '\0'; *filt[0] = '\0';
} }
#if defined(sun) #ifdef illumos
(void) sprintf(c, "%s(%s >= 0x%p && %s < 0x%p)", *filt[0] != '\0' ? (void) sprintf(c, "%s(%s >= 0x%p && %s < 0x%p)", *filt[0] != '\0' ?
" || " : "", what, (void *)base, what, (void *)(base + size)); " || " : "", what, (void *)base, what, (void *)(base + size));
#else #else
@ -676,7 +674,7 @@ dprog_addevent(int event)
* the number of nanoseconds) is the number of nanoseconds * the number of nanoseconds) is the number of nanoseconds
* late -- and it's stored in arg2. * late -- and it's stored in arg2.
*/ */
#if defined(sun) #ifdef illumos
arg0 = "(uintptr_t)curthread->t_cpu + \n" arg0 = "(uintptr_t)curthread->t_cpu + \n"
"\t curthread->t_cpu->cpu_profile_pil"; "\t curthread->t_cpu->cpu_profile_pil";
#else #else
@ -824,7 +822,7 @@ dprog_compile()
} }
static void static void
#if defined(sun) #ifdef illumos
status_fire(void) status_fire(void)
#else #else
status_fire(int i) status_fire(int i)
@ -1423,7 +1421,7 @@ main(int argc, char **argv)
exit(127); exit(127);
} }
#if defined(sun) #ifdef illumos
while (waitpid(child, &status, WEXITED) != child) while (waitpid(child, &status, WEXITED) != child)
#else #else
while (waitpid(child, &status, 0) != child) while (waitpid(child, &status, 0) != child)
@ -1468,7 +1466,7 @@ main(int argc, char **argv)
dfail("failed to walk aggregate"); dfail("failed to walk aggregate");
} }
#if defined(sun) #ifdef illumos
if ((data_buf = memalign(sizeof (uint64_t), if ((data_buf = memalign(sizeof (uint64_t),
(g_nrecs + 1) * g_recsize)) == NULL) (g_nrecs + 1) * g_recsize)) == NULL)
#else #else
@ -1500,7 +1498,7 @@ main(int argc, char **argv)
if (g_gflag) { if (g_gflag) {
lsrec_t *newlsp, *oldlsp; lsrec_t *newlsp, *oldlsp;
#if defined(sun) #ifdef illumos
newlsp = memalign(sizeof (uint64_t), newlsp = memalign(sizeof (uint64_t),
g_nrecs_used * LS_TIME * (g_stkdepth + 1)); g_nrecs_used * LS_TIME * (g_stkdepth + 1));
#else #else
@ -1664,7 +1662,7 @@ format_symbol(char *buf, uintptr_t addr, int show_size)
else if (symoff == 0) else if (symoff == 0)
(void) sprintf(buf, "%s", symname); (void) sprintf(buf, "%s", symname);
else if (symoff < 16 && bcmp(symname, "cpu[", 4) == 0) /* CPU+PIL */ else if (symoff < 16 && bcmp(symname, "cpu[", 4) == 0) /* CPU+PIL */
#if defined(sun) #ifdef illumos
(void) sprintf(buf, "%s+%ld", symname, (long)symoff); (void) sprintf(buf, "%s+%ld", symname, (long)symoff);
#else #else
(void) sprintf(buf, "%s+%s", symname, g_pri_class[(int)symoff]); (void) sprintf(buf, "%s+%s", symname, g_pri_class[(int)symoff]);

View File

@ -42,12 +42,11 @@
#include <libelf.h> #include <libelf.h>
#include <link.h> #include <link.h>
#include <elf.h> #include <elf.h>
#if defined(sun) #ifdef illumos
#include <sys/machelf.h> #include <sys/machelf.h>
#include <kstat.h> #include <kstat.h>
#else #else
/* FreeBSD */
#include <sys/elf.h> #include <sys/elf.h>
#include <sys/ksyms.h> #include <sys/ksyms.h>
#include <sys/param.h> #include <sys/param.h>
@ -66,7 +65,7 @@ static syment_t *symbol_table;
static int nsyms, maxsyms; static int nsyms, maxsyms;
static char maxsymname[64]; static char maxsymname[64];
#if defined(sun) #ifdef illumos
#ifdef _ELF64 #ifdef _ELF64
#define elf_getshdr elf64_getshdr #define elf_getshdr elf64_getshdr
#else #else
@ -105,7 +104,7 @@ remove_symbol(uintptr_t addr)
sep->addr = 0; sep->addr = 0;
} }
#if defined(sun) #ifdef illumos
static void static void
fake_up_certain_popular_kernel_symbols(void) fake_up_certain_popular_kernel_symbols(void)
{ {
@ -133,8 +132,7 @@ fake_up_certain_popular_kernel_symbols(void)
} }
(void) kstat_close(kc); (void) kstat_close(kc);
} }
#else #else /* !illumos */
/* FreeBSD */
static void static void
fake_up_certain_popular_kernel_symbols(void) fake_up_certain_popular_kernel_symbols(void)
{ {
@ -151,7 +149,7 @@ fake_up_certain_popular_kernel_symbols(void)
add_symbol(name, addr, sizeof (uintptr_t)); add_symbol(name, addr, sizeof (uintptr_t));
} }
} }
#endif /* !defined(sun) */ #endif /* illumos */
static int static int
symcmp(const void *p1, const void *p2) symcmp(const void *p1, const void *p2)
@ -177,12 +175,12 @@ symtab_init(void)
int fd; int fd;
int i; int i;
int strindex = -1; int strindex = -1;
#if !defined(sun) #ifndef illumos
void *ksyms; void *ksyms;
size_t sz; size_t sz;
#endif #endif
#if defined(__FreeBSD__) #ifndef illumos
if ((fd = open("/dev/ksyms", O_RDONLY)) == -1) { if ((fd = open("/dev/ksyms", O_RDONLY)) == -1) {
if (errno == ENOENT && modfind("ksyms") == -1) { if (errno == ENOENT && modfind("ksyms") == -1) {
kldload("ksyms"); kldload("ksyms");
@ -196,12 +194,11 @@ symtab_init(void)
return (-1); return (-1);
#endif #endif
#if defined(sun) #ifdef illumos
(void) elf_version(EV_CURRENT); (void) elf_version(EV_CURRENT);
elf = elf_begin(fd, ELF_C_READ, NULL); elf = elf_begin(fd, ELF_C_READ, NULL);
#else #else
/* FreeBSD */
/* /*
* XXX - libelf needs to be fixed so it will work with * XXX - libelf needs to be fixed so it will work with
* non 'ordinary' files like /dev/ksyms. The following * non 'ordinary' files like /dev/ksyms. The following

View File

@ -40,7 +40,7 @@ die(char *format, ...)
{ {
va_list ap; va_list ap;
int err = errno; int err = errno;
#if !defined(sun) #ifndef illumos
const char *progname = getprogname(); const char *progname = getprogname();
#endif #endif
@ -54,7 +54,7 @@ die(char *format, ...)
if (format[strlen(format) - 1] != '\n') if (format[strlen(format) - 1] != '\n')
(void) fprintf(stderr, ": %s\n", strerror(err)); (void) fprintf(stderr, ": %s\n", strerror(err));
#if defined(__FreeBSD__) #ifndef illumos
exit(0); exit(0);
#else #else
exit(1); exit(1);
@ -65,7 +65,7 @@ void
elfdie(char *format, ...) elfdie(char *format, ...)
{ {
va_list ap; va_list ap;
#if !defined(sun) #ifndef illumos
const char *progname = getprogname(); const char *progname = getprogname();
#endif #endif
@ -79,7 +79,7 @@ elfdie(char *format, ...)
if (format[strlen(format) - 1] != '\n') if (format[strlen(format) - 1] != '\n')
(void) fprintf(stderr, ": %s\n", elf_errmsg(elf_errno())); (void) fprintf(stderr, ": %s\n", elf_errmsg(elf_errno()));
#if defined(__FreeBSD__) #ifndef illumos
exit(0); exit(0);
#else #else
exit(1); exit(1);

View File

@ -40,7 +40,7 @@ extern int findelfsecidx(Elf *, char *);
extern void die(char *, ...); extern void die(char *, ...);
extern void elfdie(char *, ...); extern void elfdie(char *, ...);
#if defined(sun) #ifdef illumos
extern const char *progname; extern const char *progname;
#endif #endif

View File

@ -24,7 +24,7 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#if defined(sun) #ifdef illumos
#pragma ident "%Z%%M% %I% %E% SMI" #pragma ident "%Z%%M% %I% %E% SMI"
#endif #endif
@ -505,7 +505,7 @@ getsym(struct ps_prochandle *P, uintptr_t addr, char *buf, size_t size,
{ {
char name[256]; char name[256];
GElf_Sym sym; GElf_Sym sym;
#if defined(sun) #ifdef illumos
prsyminfo_t info; prsyminfo_t info;
#else #else
prmap_t *map; 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); (void) snprintf(buf, size, "%#lx", addr);
return (0); return (0);
} }
#if defined(sun) #ifdef illumos
if (info.prs_object == NULL) if (info.prs_object == NULL)
info.prs_object = "<unknown>"; info.prs_object = "<unknown>";
@ -668,7 +668,7 @@ process_aggregate(const dtrace_aggdata_t **aggsdata, int naggvars, void *arg)
static void static void
prochandler(struct ps_prochandle *P, const char *msg, void *arg) prochandler(struct ps_prochandle *P, const char *msg, void *arg)
{ {
#if defined(sun) #ifdef illumos
const psinfo_t *prp = Ppsinfo(P); const psinfo_t *prp = Ppsinfo(P);
int pid = Pstatus(P)->pr_pid; int pid = Pstatus(P)->pr_pid;
#else #else
@ -773,7 +773,7 @@ intr(int signo)
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
#if defined(sun) #ifdef illumos
ucred_t *ucp; ucred_t *ucp;
#endif #endif
int err; int err;
@ -785,7 +785,7 @@ main(int argc, char **argv)
g_pname = basename(argv[0]); g_pname = basename(argv[0]);
argv[0] = g_pname; /* rewrite argv[0] for getopt errors */ argv[0] = g_pname; /* rewrite argv[0] for getopt errors */
#if defined(sun) #ifdef illumos
/* /*
* Make sure we have the required dtrace_proc privilege. * Make sure we have the required dtrace_proc privilege.
*/ */
@ -988,7 +988,7 @@ main(int argc, char **argv)
if (opt_v) if (opt_v)
(void) printf("%s: tracing enabled for pid %d\n", g_pname, (void) printf("%s: tracing enabled for pid %d\n", g_pname,
#if defined(sun) #ifdef illumos
(int)Pstatus(g_pr)->pr_pid); (int)Pstatus(g_pr)->pr_pid);
#else #else
(int)proc_getpid(g_pr)); (int)proc_getpid(g_pr));

View File

@ -39,7 +39,7 @@ extern "C" {
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#if defined(sun) #ifdef illumos
#include <sys/machelf.h> #include <sys/machelf.h>
#else #else
#include <sys/elf.h> #include <sys/elf.h>

View File

@ -48,7 +48,7 @@ extern "C" {
#ifndef _ASM #ifndef _ASM
#include <sys/types.h> #include <sys/types.h>
#if defined(sun) #ifdef illumos
#include <sys/machelf.h> #include <sys/machelf.h>
#else #else
#include <elf.h> #include <elf.h>

View File

@ -65,7 +65,7 @@
#include <zfs_prop.h> #include <zfs_prop.h>
#include <zfs_deleg.h> #include <zfs_deleg.h>
#include <libuutil.h> #include <libuutil.h>
#ifdef sun #ifdef illumos
#include <aclutils.h> #include <aclutils.h>
#include <directory.h> #include <directory.h>
#include <idmap.h> #include <idmap.h>
@ -2391,7 +2391,7 @@ userspace_cb(void *arg, const char *domain, uid_t rid, uint64_t space)
/* SMB */ /* SMB */
char sid[ZFS_MAXNAMELEN + 32]; char sid[ZFS_MAXNAMELEN + 32];
uid_t id; uid_t id;
#ifdef sun #ifdef illumos
int err; int err;
int flag = IDMAP_REQ_FLG_USE_CACHE; int flag = IDMAP_REQ_FLG_USE_CACHE;
#endif #endif
@ -2402,17 +2402,17 @@ userspace_cb(void *arg, const char *domain, uid_t rid, uint64_t space)
if (prop == ZFS_PROP_GROUPUSED || prop == ZFS_PROP_GROUPQUOTA) { if (prop == ZFS_PROP_GROUPUSED || prop == ZFS_PROP_GROUPQUOTA) {
type = USTYPE_SMB_GRP; type = USTYPE_SMB_GRP;
#ifdef sun #ifdef illumos
err = sid_to_id(sid, B_FALSE, &id); err = sid_to_id(sid, B_FALSE, &id);
#endif #endif
} else { } else {
type = USTYPE_SMB_USR; type = USTYPE_SMB_USR;
#ifdef sun #ifdef illumos
err = sid_to_id(sid, B_TRUE, &id); err = sid_to_id(sid, B_TRUE, &id);
#endif #endif
} }
#ifdef sun #ifdef illumos
if (err == 0) { if (err == 0) {
rid = id; rid = id;
if (!cb->cb_sid2posix) { if (!cb->cb_sid2posix) {
@ -6110,7 +6110,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. * Search for the given (major,minor) pair in the mount table.
*/ */
#ifdef sun #ifdef illumos
rewind(mnttab_file); rewind(mnttab_file);
while ((ret = getextmntent(mnttab_file, &entry, 0)) == 0) { while ((ret = getextmntent(mnttab_file, &entry, 0)) == 0) {
if (entry.mnt_major == major(statbuf.st_dev) && if (entry.mnt_major == major(statbuf.st_dev) &&

View File

@ -112,7 +112,7 @@ vdev_error(const char *fmt, ...)
va_end(ap); va_end(ap);
} }
#ifdef sun #ifdef illumos
static void static void
libdiskmgt_error(int error) 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)); 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 * 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; pool_state_t state;
boolean_t inuse; boolean_t inuse;
#ifdef sun #ifdef illumos
if (dm_inuse_swap(file, &err)) { if (dm_inuse_swap(file, &err)) {
if (err) if (err)
libdiskmgt_error(err); libdiskmgt_error(err);
@ -377,7 +377,7 @@ check_device(const char *name, boolean_t force, boolean_t isspare)
static boolean_t static boolean_t
is_whole_disk(const char *arg) is_whole_disk(const char *arg)
{ {
#ifdef sun #ifdef illumos
struct dk_gpt *label; struct dk_gpt *label;
int fd; int fd;
char path[MAXPATHLEN]; char path[MAXPATHLEN];
@ -915,7 +915,7 @@ check_replication(nvlist_t *config, nvlist_t *newroot)
return (ret); return (ret);
} }
#ifdef sun #ifdef illumos
/* /*
* Go through and find any whole disks in the vdev specification, labelling them * 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 * as appropriate. When constructing the vdev spec, we were unable to open this
@ -1019,7 +1019,7 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv)
return (0); return (0);
} }
#endif /* sun */ #endif /* illumos */
/* /*
* Determine if the given path is a hot spare within the given configuration. * Determine if the given path is a hot spare within the given configuration.
@ -1098,7 +1098,7 @@ is_device_in_use(nvlist_t *config, nvlist_t *nv, boolean_t force,
* regardless of what libdiskmgt or zpool_in_use() says. * regardless of what libdiskmgt or zpool_in_use() says.
*/ */
if (replacing) { if (replacing) {
#ifdef sun #ifdef illumos
if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK, if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK,
&wholedisk) == 0 && wholedisk) &wholedisk) == 0 && wholedisk)
(void) snprintf(buf, sizeof (buf), "%ss0", (void) snprintf(buf, sizeof (buf), "%ss0",
@ -1422,7 +1422,7 @@ split_mirror_vdev(zpool_handle_t *zhp, char *newname, nvlist_t *props,
return (NULL); return (NULL);
} }
#ifdef sun #ifdef illumos
if (!flags.dryrun && make_disks(zhp, newroot) != 0) { if (!flags.dryrun && make_disks(zhp, newroot) != 0) {
nvlist_free(newroot); nvlist_free(newroot);
return (NULL); return (NULL);
@ -1507,7 +1507,7 @@ make_root_vdev(zpool_handle_t *zhp, int force, int check_rep,
return (NULL); return (NULL);
} }
#ifdef sun #ifdef illumos
/* /*
* Run through the vdev specification and label any whole disks found. * Run through the vdev specification and label any whole disks found.
*/ */

View File

@ -44,7 +44,7 @@ extern "C" {
* safe in probe context. * 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 isalnum(ch) (isalpha(ch) || isdigit(ch))
#define isalpha(ch) (isupper(ch) || islower(ch)) #define isalpha(ch) (isupper(ch) || islower(ch))

View File

@ -34,14 +34,14 @@
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#if defined(sun) #ifdef illumos
#include <dlfcn.h> #include <dlfcn.h>
#else #else
#include <zlib.h> #include <zlib.h>
#endif #endif
#include <gelf.h> #include <gelf.h>
#if defined(sun) #ifdef illumos
#ifdef _LP64 #ifdef _LP64
static const char *_libctf_zlib = "/usr/lib/64/libz.so"; static const char *_libctf_zlib = "/usr/lib/64/libz.so";
#else #else
@ -58,7 +58,7 @@ static struct {
static size_t _PAGESIZE; static size_t _PAGESIZE;
static size_t _PAGEMASK; static size_t _PAGEMASK;
#if defined(sun) #ifdef illumos
#pragma init(_libctf_init) #pragma init(_libctf_init)
#else #else
void _libctf_init(void) __attribute__ ((constructor)); void _libctf_init(void) __attribute__ ((constructor));
@ -66,7 +66,7 @@ void _libctf_init(void) __attribute__ ((constructor));
void void
_libctf_init(void) _libctf_init(void)
{ {
#if defined(sun) #ifdef illumos
const char *p = getenv("LIBCTF_DECOMPRESSOR"); const char *p = getenv("LIBCTF_DECOMPRESSOR");
if (p != NULL) if (p != NULL)
@ -87,7 +87,7 @@ _libctf_init(void)
void * void *
ctf_zopen(int *errp) ctf_zopen(int *errp)
{ {
#if defined(sun) #ifdef illumos
ctf_dprintf("decompressing CTF data using %s\n", _libctf_zlib); ctf_dprintf("decompressing CTF data using %s\n", _libctf_zlib);
if (zlib.z_dlp != NULL) if (zlib.z_dlp != NULL)

View File

@ -56,13 +56,13 @@
*/ */
static const char *devnamep = "/dev/dtrace/helper"; static const char *devnamep = "/dev/dtrace/helper";
#if defined(sun) #ifdef illumos
static const char *olddevname = "/devices/pseudo/dtrace@0:helper"; static const char *olddevname = "/devices/pseudo/dtrace@0:helper";
#endif #endif
static const char *modname; /* Name of this load object */ static const char *modname; /* Name of this load object */
static int gen; /* DOF helper generation */ static int gen; /* DOF helper generation */
#if defined(sun) #ifdef illumos
extern dof_hdr_t __SUNW_dof; /* DOF defined in the .SUNW_dof section */ extern dof_hdr_t __SUNW_dof; /* DOF defined in the .SUNW_dof section */
#endif #endif
static boolean_t dof_init_debug = B_FALSE; /* From DTRACE_DOF_INIT_DEBUG */ 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); va_end(ap);
} }
#if defined(sun) #ifdef illumos
#pragma init(dtrace_dof_init) #pragma init(dtrace_dof_init)
#else #else
static void dtrace_dof_init(void) __attribute__ ((constructor)); static void dtrace_dof_init(void) __attribute__ ((constructor));
@ -99,7 +99,7 @@ static void dtrace_dof_init(void) __attribute__ ((constructor));
static void static void
dtrace_dof_init(void) dtrace_dof_init(void)
{ {
#if defined(sun) #ifdef illumos
dof_hdr_t *dof = &__SUNW_dof; dof_hdr_t *dof = &__SUNW_dof;
#else #else
dof_hdr_t *dof = NULL; dof_hdr_t *dof = NULL;
@ -111,14 +111,14 @@ dtrace_dof_init(void)
#endif #endif
dof_helper_t dh; dof_helper_t dh;
Link_map *lmp = NULL; Link_map *lmp = NULL;
#if defined(sun) #ifdef illumos
Lmid_t lmid; Lmid_t lmid;
#else #else
u_long lmid = 0; u_long lmid = 0;
#endif #endif
int fd; int fd;
const char *p; const char *p;
#if !defined(sun) #ifndef illumos
Elf *e; Elf *e;
Elf_Scn *scn = NULL; Elf_Scn *scn = NULL;
Elf_Data *dofdata = NULL; Elf_Data *dofdata = NULL;
@ -141,7 +141,7 @@ dtrace_dof_init(void)
return; return;
} }
#if defined(sun) #ifdef illumos
if (dlinfo(RTLD_SELF, RTLD_DI_LMID, &lmid) == -1) { if (dlinfo(RTLD_SELF, RTLD_DI_LMID, &lmid) == -1) {
dprintf(1, "couldn't discover link map ID\n"); dprintf(1, "couldn't discover link map ID\n");
return; return;
@ -152,7 +152,7 @@ dtrace_dof_init(void)
modname = lmp->l_name; modname = lmp->l_name;
else else
modname++; modname++;
#if !defined(sun) #ifndef illumos
elf_version(EV_CURRENT); elf_version(EV_CURRENT);
if ((efd = open(lmp->l_name, O_RDONLY, 0)) < 0) { if ((efd = open(lmp->l_name, O_RDONLY, 0)) < 0) {
dprintf(1, "couldn't open file for reading\n"); dprintf(1, "couldn't open file for reading\n");
@ -215,7 +215,7 @@ dtrace_dof_init(void)
if ((fd = open64(devnamep, O_RDWR)) < 0) { if ((fd = open64(devnamep, O_RDWR)) < 0) {
dprintf(1, "failed to open helper device %s", devnamep); 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 * If the device path wasn't explicitly set, try again with
* the old device path. * the old device path.
@ -237,14 +237,14 @@ dtrace_dof_init(void)
dprintf(1, "DTrace ioctl failed for DOF at %p", dof); dprintf(1, "DTrace ioctl failed for DOF at %p", dof);
else { else {
dprintf(1, "DTrace ioctl succeeded for DOF at %p\n", dof); dprintf(1, "DTrace ioctl succeeded for DOF at %p\n", dof);
#if !defined(sun) #ifndef illumos
gen = dh.gen; gen = dh.gen;
#endif #endif
} }
(void) close(fd); (void) close(fd);
#if !defined(sun) #ifndef illumos
/* End of while loop */ /* End of while loop */
dof = dof_next; dof = dof_next;
} }
@ -254,7 +254,7 @@ dtrace_dof_init(void)
#endif #endif
} }
#if defined(sun) #ifdef illumos
#pragma fini(dtrace_dof_fini) #pragma fini(dtrace_dof_fini)
#else #else
static void dtrace_dof_fini(void) __attribute__ ((destructor)); static void dtrace_dof_fini(void) __attribute__ ((destructor));

View File

@ -35,7 +35,7 @@
#include <unistd.h> #include <unistd.h>
#include <dt_impl.h> #include <dt_impl.h>
#include <assert.h> #include <assert.h>
#if defined(sun) #ifdef illumos
#include <alloca.h> #include <alloca.h>
#else #else
#include <sys/sysctl.h> #include <sys/sysctl.h>
@ -453,7 +453,7 @@ dt_aggregate_snap_cpu(dtrace_hdl_t *dtp, processorid_t cpu)
buf->dtbd_cpu = cpu; buf->dtbd_cpu = cpu;
#if defined(sun) #ifdef illumos
if (dt_ioctl(dtp, DTRACEIOC_AGGSNAP, buf) == -1) { if (dt_ioctl(dtp, DTRACEIOC_AGGSNAP, buf) == -1) {
#else #else
if (dt_ioctl(dtp, DTRACEIOC_AGGSNAP, &buf) == -1) { if (dt_ioctl(dtp, DTRACEIOC_AGGSNAP, &buf) == -1) {

View File

@ -1888,7 +1888,7 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp)
char **argv = malloc(sizeof (char *) * (argc + 5)); char **argv = malloc(sizeof (char *) * (argc + 5));
FILE *ofp = tmpfile(); FILE *ofp = tmpfile();
#if defined(sun) #ifdef illumos
char ipath[20], opath[20]; /* big enough for /dev/fd/ + INT_MAX + \0 */ char ipath[20], opath[20]; /* big enough for /dev/fd/ + INT_MAX + \0 */
#endif #endif
char verdef[32]; /* big enough for -D__SUNW_D_VERSION=0x%08x + \0 */ 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; int wstat, estat;
pid_t pid; pid_t pid;
#if defined(sun) #ifdef illumos
off64_t off; off64_t off;
#else #else
off_t off = 0; off_t off = 0;
@ -1929,7 +1929,7 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp)
(void) fseeko64(ifp, off, SEEK_SET); (void) fseeko64(ifp, off, SEEK_SET);
} }
#if defined(sun) #ifdef illumos
(void) snprintf(ipath, sizeof (ipath), "/dev/fd/%d", fileno(ifp)); (void) snprintf(ipath, sizeof (ipath), "/dev/fd/%d", fileno(ifp));
(void) snprintf(opath, sizeof (opath), "/dev/fd/%d", fileno(ofp)); (void) snprintf(opath, sizeof (opath), "/dev/fd/%d", fileno(ofp));
#endif #endif
@ -1940,7 +1940,7 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp)
"-D__SUNW_D_VERSION=0x%08x", dtp->dt_vmax); "-D__SUNW_D_VERSION=0x%08x", dtp->dt_vmax);
argv[argc++] = verdef; argv[argc++] = verdef;
#if defined(sun) #ifdef illumos
switch (dtp->dt_stdcmode) { switch (dtp->dt_stdcmode) {
case DT_STDC_XA: case DT_STDC_XA:
case DT_STDC_XT: case DT_STDC_XT:
@ -1982,7 +1982,7 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp)
} }
if (pid == 0) { if (pid == 0) {
#if !defined(sun) #ifndef illumos
if (isatty(fileno(ifp)) == 0) if (isatty(fileno(ifp)) == 0)
lseek(fileno(ifp), off, SEEK_SET); lseek(fileno(ifp), off, SEEK_SET);
dup2(fileno(ifp), 0); dup2(fileno(ifp), 0);

View File

@ -35,12 +35,12 @@
#include <limits.h> #include <limits.h>
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
#if defined(sun) #ifdef illumos
#include <alloca.h> #include <alloca.h>
#endif #endif
#include <dt_impl.h> #include <dt_impl.h>
#include <dt_pq.h> #include <dt_pq.h>
#if !defined(sun) #ifndef illumos
#include <libproc_compat.h> #include <libproc_compat.h>
#endif #endif
@ -2958,7 +2958,7 @@ dt_get_buf(dtrace_hdl_t *dtp, int cpu, dtrace_bufdesc_t **bufp)
buf->dtbd_size = size; buf->dtbd_size = size;
buf->dtbd_cpu = cpu; buf->dtbd_cpu = cpu;
#if defined(sun) #ifdef illumos
if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, buf) == -1) { if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, buf) == -1) {
#else #else
if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, &buf) == -1) { if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, &buf) == -1) {

View File

@ -26,12 +26,12 @@
*/ */
#include <sys/types.h> #include <sys/types.h>
#if defined(sun) #ifdef illumos
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#endif #endif
#include <strings.h> #include <strings.h>
#if defined(sun) #ifdef illumos
#include <alloca.h> #include <alloca.h>
#endif #endif
#include <assert.h> #include <assert.h>

View File

@ -145,7 +145,7 @@ dtrace_errno(dtrace_hdl_t *dtp)
return (dtp->dt_errno); return (dtp->dt_errno);
} }
#if defined(sun) #ifdef illumos
int int
dt_set_errno(dtrace_hdl_t *dtp, int err) dt_set_errno(dtrace_hdl_t *dtp, int err)
{ {

View File

@ -31,7 +31,7 @@
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <assert.h> #include <assert.h>
#if defined(sun) #ifdef illumos
#include <alloca.h> #include <alloca.h>
#endif #endif

View File

@ -28,18 +28,18 @@
#pragma ident "%Z%%M% %I% %E% SMI" #pragma ident "%Z%%M% %I% %E% SMI"
#if defined(sun) #ifdef illumos
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#endif #endif
#include <strings.h> #include <strings.h>
#include <stdlib.h> #include <stdlib.h>
#if defined(sun) #ifdef illumos
#include <alloca.h> #include <alloca.h>
#endif #endif
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <ctype.h> #include <ctype.h>
#if defined(sun) #ifdef illumos
#include <sys/procfs_isa.h> #include <sys/procfs_isa.h>
#endif #endif
#include <limits.h> #include <limits.h>

View File

@ -34,7 +34,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/objfs.h> #include <sys/objfs.h>
#if !defined(sun) #ifndef illumos
#include <sys/bitmap.h> #include <sys/bitmap.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include <sys/ioccom.h> #include <sys/ioccom.h>
@ -45,7 +45,7 @@
#include <libctf.h> #include <libctf.h>
#include <dtrace.h> #include <dtrace.h>
#include <gelf.h> #include <gelf.h>
#if defined(sun) #ifdef illumos
#include <synch.h> #include <synch.h>
#endif #endif
@ -142,7 +142,7 @@ typedef struct dt_module {
GElf_Addr dm_bss_va; /* virtual address of BSS */ GElf_Addr dm_bss_va; /* virtual address of BSS */
GElf_Xword dm_bss_size; /* size in bytes of BSS */ GElf_Xword dm_bss_size; /* size in bytes of BSS */
dt_idhash_t *dm_extern; /* external symbol definitions */ dt_idhash_t *dm_extern; /* external symbol definitions */
#if !defined(sun) #ifndef illumos
caddr_t dm_reloc_offset; /* Symbol relocation offset. */ caddr_t dm_reloc_offset; /* Symbol relocation offset. */
uintptr_t *dm_sec_offsets; uintptr_t *dm_sec_offsets;
#endif #endif
@ -296,7 +296,7 @@ struct dtrace_hdl {
int dt_version; /* library version requested by client */ int dt_version; /* library version requested by client */
int dt_ctferr; /* error resulting from last CTF failure */ int dt_ctferr; /* error resulting from last CTF failure */
int dt_errno; /* error resulting from last failed operation */ int dt_errno; /* error resulting from last failed operation */
#if !defined(sun) #ifndef illumos
const char *dt_errfile; const char *dt_errfile;
int dt_errline; int dt_errline;
#endif #endif
@ -305,7 +305,7 @@ struct dtrace_hdl {
int dt_fterr; /* saved errno from failed open of dt_ftfd */ int dt_fterr; /* saved errno from failed open of dt_ftfd */
int dt_cdefs_fd; /* file descriptor for C CTF debugging cache */ int dt_cdefs_fd; /* file descriptor for C CTF debugging cache */
int dt_ddefs_fd; /* file descriptor for D 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 */ int dt_stdout_fd; /* file descriptor for saved stdout */
#else #else
FILE *dt_freopen_fp; /* file pointer for freopened stdout */ 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_add_arg(dtrace_hdl_t *, const char *);
extern char *dt_cpp_pop_arg(dtrace_hdl_t *); extern char *dt_cpp_pop_arg(dtrace_hdl_t *);
#if defined(sun) #ifdef illumos
extern int dt_set_errno(dtrace_hdl_t *, int); extern int dt_set_errno(dtrace_hdl_t *, int);
#else #else
int _dt_set_errno(dtrace_hdl_t *, int, const char *, int); 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 *, extern void dt_set_errmsg(dtrace_hdl_t *, const char *, const char *,
const char *, int, const char *, va_list); const char *, int, const char *, va_list);
#if defined(sun) #ifdef illumos
extern int dt_ioctl(dtrace_hdl_t *, int, void *); extern int dt_ioctl(dtrace_hdl_t *, int, void *);
#else #else
extern int dt_ioctl(dtrace_hdl_t *, u_long, void *); extern int dt_ioctl(dtrace_hdl_t *, u_long, void *);

View File

@ -44,7 +44,7 @@
* We need to undefine lex's input and unput macros so that references to these * 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. * call the functions provided at the end of this source file.
*/ */
#if defined(sun) #ifdef illumos
#undef input #undef input
#undef unput #undef unput
#else #else
@ -79,7 +79,7 @@
#endif #endif
static int id_or_type(const char *); static int id_or_type(const char *);
#if defined(sun) #ifdef illumos
static int input(void); static int input(void);
static void unput(int); static void unput(int);
#endif #endif
@ -740,7 +740,7 @@ yyinit(dt_pcb_t *pcb)
yypcb = pcb; yypcb = pcb;
yylineno = 1; yylineno = 1;
yypragma = NULL; yypragma = NULL;
#if defined(sun) #ifdef illumos
yysptr = yysbuf; yysptr = yysbuf;
#endif #endif
} }
@ -838,7 +838,7 @@ id_or_type(const char *s)
return (ttok); return (ttok);
} }
#if defined(sun) #ifdef illumos
static int static int
input(void) input(void)
{ {
@ -880,4 +880,4 @@ unput(int c)
*yysptr++ = c; *yysptr++ = c;
yytchar = c; yytchar = c;
} }
#endif #endif /* illumos */

View File

@ -30,7 +30,7 @@
#include <elf.h> #include <elf.h>
#include <sys/types.h> #include <sys/types.h>
#if defined(sun) #ifdef illumos
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#else #else
#define P2ROUNDUP(x, align) (-(-(x) & -(align))) #define P2ROUNDUP(x, align) (-(-(x) & -(align)))
@ -38,7 +38,7 @@
#include <unistd.h> #include <unistd.h>
#include <strings.h> #include <strings.h>
#if defined(sun) #ifdef illumos
#include <alloca.h> #include <alloca.h>
#endif #endif
#include <limits.h> #include <limits.h>
@ -47,7 +47,7 @@
#include <stdio.h> #include <stdio.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#if defined(sun) #ifdef illumos
#include <wait.h> #include <wait.h>
#else #else
#include <sys/wait.h> #include <sys/wait.h>
@ -322,7 +322,7 @@ prepare_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, dof_elf64_t *dep)
char *strtab; char *strtab;
int i, j, nrel; int i, j, nrel;
size_t strtabsz = 1; size_t strtabsz = 1;
#if defined(sun) #ifdef illumos
uint32_t count = 0; uint32_t count = 0;
#else #else
uint64_t count = 0; 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) #elif defined(__i386) || defined(__amd64)
rel->r_offset = s->dofs_offset + rel->r_offset = s->dofs_offset +
dofr[j].dofr_offset; dofr[j].dofr_offset;
#if defined(sun) #ifdef illumos
rel->r_info = ELF64_R_INFO(count + dep->de_global, rel->r_info = ELF64_R_INFO(count + dep->de_global,
R_AMD64_64); R_AMD64_64);
#else #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 = &elf_file.shdr[ESHDR_DOF];
shp->sh_name = 11; /* DTRACE_SHSTRTAB64[11] = ".SUNW_dof" */ shp->sh_name = 11; /* DTRACE_SHSTRTAB64[11] = ".SUNW_dof" */
#if defined(sun) #ifdef illumos
shp->sh_flags = SHF_ALLOC; shp->sh_flags = SHF_ALLOC;
#else #else
shp->sh_flags = SHF_WRITE | SHF_ALLOC; 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, return (dt_link_error(dtp, elf, fd, bufs,
"failed to allocate space for probe")); "failed to allocate space for probe"));
} }
#if !defined(sun) #ifndef illumos
/* /*
* Our linker doesn't understand the SUNW_IGNORE ndx and * Our linker doesn't understand the SUNW_IGNORE ndx and
* will try to use this relocation when we build the * 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 * already been processed by an earlier link
* invocation. * invocation.
*/ */
#if !defined(sun) #ifndef illumos
#define SHN_SUNW_IGNORE SHN_ABS #define SHN_SUNW_IGNORE SHN_ABS
#endif #endif
if (rsym.st_shndx != SHN_SUNW_IGNORE) { 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) elf_end(elf);
(void) close(fd); (void) close(fd);
#if !defined(sun) #ifndef illumos
if (nsym > 0) if (nsym > 0)
#endif #endif
while ((pair = bufs) != NULL) { while ((pair = bufs) != NULL) {
@ -1684,7 +1684,7 @@ int
dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags, dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
const char *file, int objc, char *const objv[]) const char *file, int objc, char *const objv[])
{ {
#if !defined(sun) #ifndef illumos
char tfile[PATH_MAX]; char tfile[PATH_MAX];
#endif #endif
char drti[PATH_MAX]; 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; size_t len;
int eprobes = 0, ret = 0; int eprobes = 0, ret = 0;
#if !defined(sun) #ifndef illumos
if (access(file, R_OK) == 0) { if (access(file, R_OK) == 0) {
fprintf(stderr, "dtrace: target object (%s) already exists. " fprintf(stderr, "dtrace: target object (%s) already exists. "
"Please remove the target\ndtrace: object and rebuild all " "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) if ((dof = dtrace_dof_create(dtp, pgp, dflags)) == NULL)
return (-1); /* errno is set for us */ 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 * 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 * 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) if (!dtp->dt_lazyload)
(void) unlink(file); (void) unlink(file);
#endif #endif
@ -1826,7 +1826,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
else else
status = dump_elf32(dtp, dof, fd); status = dump_elf32(dtp, dof, fd);
#if defined(sun) #ifdef illumos
if (status != 0 || lseek(fd, 0, SEEK_SET) != 0) { if (status != 0 || lseek(fd, 0, SEEK_SET) != 0) {
return (dt_link_error(dtp, NULL, -1, NULL, return (dt_link_error(dtp, NULL, -1, NULL,
"failed to write %s: %s", file, strerror(errno))); "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 #endif
if (!dtp->dt_lazyload) { if (!dtp->dt_lazyload) {
#if defined(sun) #ifdef illumos
const char *fmt = "%s -o %s -r -Blocal -Breduce /dev/fd/%d %s"; const char *fmt = "%s -o %s -r -Blocal -Breduce /dev/fd/%d %s";
if (dtp->dt_oflags & DTRACE_O_LP64) { 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: done:
dtrace_dof_destroy(dtp, dof); dtrace_dof_destroy(dtp, dof);
#if !defined(sun) #ifndef illumos
unlink(tfile); unlink(tfile);
#endif #endif
return (ret); return (ret);

View File

@ -156,7 +156,7 @@ dt_epid_add(dtrace_hdl_t *dtp, dtrace_epid_t id)
enabled->dtepd_epid = id; enabled->dtepd_epid = id;
enabled->dtepd_nrecs = 1; enabled->dtepd_nrecs = 1;
#if defined(sun) #ifdef illumos
if (dt_ioctl(dtp, DTRACEIOC_EPROBE, enabled) == -1) { if (dt_ioctl(dtp, DTRACEIOC_EPROBE, enabled) == -1) {
#else #else
if (dt_ioctl(dtp, DTRACEIOC_EPROBE, &enabled) == -1) { 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) if ((enabled = nenabled) == NULL)
return (dt_set_errno(dtp, EDT_NOMEM)); return (dt_set_errno(dtp, EDT_NOMEM));
#if defined(sun) #ifdef illumos
rval = dt_ioctl(dtp, DTRACEIOC_EPROBE, enabled); rval = dt_ioctl(dtp, DTRACEIOC_EPROBE, enabled);
#else #else
rval = dt_ioctl(dtp, DTRACEIOC_EPROBE, &enabled); 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_id = id;
agg->dtagd_nrecs = 1; agg->dtagd_nrecs = 1;
#if defined(sun) #ifdef illumos
if (dt_ioctl(dtp, DTRACEIOC_AGGDESC, agg) == -1) { if (dt_ioctl(dtp, DTRACEIOC_AGGDESC, agg) == -1) {
#else #else
if (dt_ioctl(dtp, DTRACEIOC_AGGDESC, &agg) == -1) { 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) if ((agg = nagg) == NULL)
return (dt_set_errno(dtp, EDT_NOMEM)); return (dt_set_errno(dtp, EDT_NOMEM));
#if defined(sun) #ifdef illumos
rval = dt_ioctl(dtp, DTRACEIOC_AGGDESC, agg); rval = dt_ioctl(dtp, DTRACEIOC_AGGDESC, agg);
#else #else
rval = dt_ioctl(dtp, DTRACEIOC_AGGDESC, &agg); rval = dt_ioctl(dtp, DTRACEIOC_AGGDESC, &agg);

View File

@ -27,7 +27,7 @@
*/ */
#include <sys/types.h> #include <sys/types.h>
#if defined(sun) #ifdef illumos
#include <sys/modctl.h> #include <sys/modctl.h>
#include <sys/kobj.h> #include <sys/kobj.h>
#include <sys/kobj_impl.h> #include <sys/kobj_impl.h>
@ -41,7 +41,7 @@
#endif #endif
#include <unistd.h> #include <unistd.h>
#if defined(sun) #ifdef illumos
#include <project.h> #include <project.h>
#endif #endif
#include <strings.h> #include <strings.h>
@ -51,7 +51,7 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <dirent.h> #include <dirent.h>
#if !defined(sun) #ifndef illumos
#include <fcntl.h> #include <fcntl.h>
#include <libproc_compat.h> #include <libproc_compat.h>
#endif #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) if (sp == NULL || (dp = elf_getdata(sp, NULL)) == NULL)
return (0); return (0);
#if defined(sun) #ifdef illumos
ctsp->cts_data = dp->d_buf; ctsp->cts_data = dp->d_buf;
#else #else
if ((ctsp->cts_data = malloc(dp->d_size)) == NULL) 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); ctf_close(dmp->dm_ctfp);
dmp->dm_ctfp = NULL; dmp->dm_ctfp = NULL;
#if !defined(sun) #ifndef illumos
if (dmp->dm_ctdata.cts_data != NULL) { if (dmp->dm_ctdata.cts_data != NULL) {
free(dmp->dm_ctdata.cts_data); 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. * including the path.
*/ */
static void static void
#if defined(sun) #ifdef illumos
dt_module_update(dtrace_hdl_t *dtp, const char *name) dt_module_update(dtrace_hdl_t *dtp, const char *name)
#else #else
dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat) 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_Data *dp;
Elf_Scn *sp; Elf_Scn *sp;
#if defined(sun) #ifdef illumos
(void) snprintf(fname, sizeof (fname), (void) snprintf(fname, sizeof (fname),
"%s/%s/object", OBJFS_ROOT, name); "%s/%s/object", OBJFS_ROOT, name);
#else #else
@ -1242,7 +1242,7 @@ dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat)
} }
dmp->dm_flags |= DT_DM_KERNEL; dmp->dm_flags |= DT_DM_KERNEL;
#if defined(sun) #ifdef illumos
dmp->dm_modid = (int)OBJFS_MODID(st.st_ino); dmp->dm_modid = (int)OBJFS_MODID(st.st_ino);
#else #else
/* /*
@ -1265,7 +1265,7 @@ dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat)
} }
} }
#endif #endif
#endif #endif /* illumos */
if (dmp->dm_info.objfs_info_primary) if (dmp->dm_info.objfs_info_primary)
dmp->dm_flags |= DT_DM_PRIMARY; dmp->dm_flags |= DT_DM_PRIMARY;
@ -1291,7 +1291,7 @@ dtrace_update(dtrace_hdl_t *dtp)
dmp != NULL; dmp = dt_list_next(dmp)) dmp != NULL; dmp = dt_list_next(dmp))
dt_module_unload(dtp, dmp); dt_module_unload(dtp, dmp);
#if defined(sun) #ifdef illumos
/* /*
* Open /system/object and attempt to create a libdtrace module for * Open /system/object and attempt to create a libdtrace module for
* each kernel module that is loaded on the current system. * 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, "pid")->di_id = getpid();
dt_idhash_lookup(dtp->dt_macros, "pgid")->di_id = getpgid(0); dt_idhash_lookup(dtp->dt_macros, "pgid")->di_id = getpgid(0);
dt_idhash_lookup(dtp->dt_macros, "ppid")->di_id = getppid(); 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(); dt_idhash_lookup(dtp->dt_macros, "projid")->di_id = getprojid();
#endif #endif
dt_idhash_lookup(dtp->dt_macros, "sid")->di_id = getsid(0); 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(); dt_idhash_lookup(dtp->dt_macros, "taskid")->di_id = gettaskid();
#endif #endif
dt_idhash_lookup(dtp->dt_macros, "uid")->di_id = getuid(); dt_idhash_lookup(dtp->dt_macros, "uid")->di_id = getuid();

View File

@ -26,11 +26,10 @@
*/ */
#include <sys/types.h> #include <sys/types.h>
#if defined(sun) #ifdef illumos
#include <sys/modctl.h> #include <sys/modctl.h>
#include <sys/systeminfo.h> #include <sys/systeminfo.h>
#else #else
/* FreeBSD */
#include <sys/param.h> #include <sys/param.h>
#include <sys/module.h> #include <sys/module.h>
#include <sys/linker.h> #include <sys/linker.h>
@ -39,7 +38,7 @@
#include <libelf.h> #include <libelf.h>
#include <strings.h> #include <strings.h>
#if defined(sun) #ifdef illumos
#include <alloca.h> #include <alloca.h>
#endif #endif
#include <limits.h> #include <limits.h>
@ -60,7 +59,7 @@
#include <dt_printf.h> #include <dt_printf.h>
#include <dt_string.h> #include <dt_string.h>
#include <dt_provider.h> #include <dt_provider.h>
#if !defined(sun) #ifndef illumos
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <string.h> #include <string.h>
#endif #endif
@ -164,7 +163,7 @@ const dt_version_t _dtrace_versions[] = {
/* /*
* Global variables that are formatted on FreeBSD based on the kernel file name. * 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 curthread_str[MAXPATHLEN];
static char intmtx_str[MAXPATHLEN]; static char intmtx_str[MAXPATHLEN];
static char threadmtx_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, { "curthread", DT_IDENT_SCALAR, 0, DIF_VAR_CURTHREAD,
{ DTRACE_STABILITY_STABLE, DTRACE_STABILITY_PRIVATE, { DTRACE_STABILITY_STABLE, DTRACE_STABILITY_PRIVATE,
DTRACE_CLASS_COMMON }, DT_VERS_1_0, DTRACE_CLASS_COMMON }, DT_VERS_1_0,
#if defined(sun) #ifdef illumos
&dt_idops_type, "genunix`kthread_t *" }, &dt_idops_type, "genunix`kthread_t *" },
#else #else
&dt_idops_type, curthread_str }, &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, { "index", DT_IDENT_FUNC, 0, DIF_SUBR_INDEX, DT_ATTR_STABCMN, DT_VERS_1_1,
&dt_idops_func, "int(const char *, const char *, [int])" }, &dt_idops_func, "int(const char *, const char *, [int])" },
{ "inet_ntoa", DT_IDENT_FUNC, 0, DIF_SUBR_INET_NTOA, DT_ATTR_STABCMN, { "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 *)" }, DT_VERS_1_5, &dt_idops_func, "string(ipaddr_t *)" },
#else #else
DT_VERS_1_5, &dt_idops_func, "string(in_addr_t *)" }, DT_VERS_1_5, &dt_idops_func, "string(in_addr_t *)" },
#endif #endif
{ "inet_ntoa6", DT_IDENT_FUNC, 0, DIF_SUBR_INET_NTOA6, DT_ATTR_STABCMN, { "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 *)" }, DT_VERS_1_5, &dt_idops_func, "string(in6_addr_t *)" },
#else #else
DT_VERS_1_5, &dt_idops_func, "string(struct in6_addr *)" }, 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(@)" }, &dt_idops_func, "void(@)" },
{ "memref", DT_IDENT_FUNC, 0, DIF_SUBR_MEMREF, DT_ATTR_STABCMN, DT_VERS_1_1, { "memref", DT_IDENT_FUNC, 0, DIF_SUBR_MEMREF, DT_ATTR_STABCMN, DT_VERS_1_1,
&dt_idops_func, "uintptr_t *(void *, size_t)" }, &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, { "memstr", DT_IDENT_FUNC, 0, DIF_SUBR_MEMSTR, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "string(void *, char, size_t)" }, &dt_idops_func, "string(void *, char, size_t)" },
#endif #endif
@ -342,7 +341,7 @@ static const dt_ident_t _dtrace_globals[] = {
{ "msgsize", DT_IDENT_FUNC, 0, DIF_SUBR_MSGSIZE, { "msgsize", DT_IDENT_FUNC, 0, DIF_SUBR_MSGSIZE,
DT_ATTR_STABCMN, DT_VERS_1_0, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "size_t(mblk_t *)" }, &dt_idops_func, "size_t(mblk_t *)" },
#if defined(sun) #ifdef illumos
{ "mutex_owned", DT_IDENT_FUNC, 0, DIF_SUBR_MUTEX_OWNED, { "mutex_owned", DT_IDENT_FUNC, 0, DIF_SUBR_MUTEX_OWNED,
DT_ATTR_EVOLCMN, DT_VERS_1_0, DT_ATTR_EVOLCMN, DT_VERS_1_0,
&dt_idops_func, "int(genunix`kmutex_t *)" }, &dt_idops_func, "int(genunix`kmutex_t *)" },
@ -413,7 +412,7 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_func, "int()" }, &dt_idops_func, "int()" },
{ "rindex", DT_IDENT_FUNC, 0, DIF_SUBR_RINDEX, DT_ATTR_STABCMN, DT_VERS_1_1, { "rindex", DT_IDENT_FUNC, 0, DIF_SUBR_RINDEX, DT_ATTR_STABCMN, DT_VERS_1_1,
&dt_idops_func, "int(const char *, const char *, [int])" }, &dt_idops_func, "int(const char *, const char *, [int])" },
#if defined(sun) #ifdef illumos
{ "rw_iswriter", DT_IDENT_FUNC, 0, DIF_SUBR_RW_ISWRITER, { "rw_iswriter", DT_IDENT_FUNC, 0, DIF_SUBR_RW_ISWRITER,
DT_ATTR_EVOLCMN, DT_VERS_1_0, DT_ATTR_EVOLCMN, DT_VERS_1_0,
&dt_idops_func, "int(genunix`krwlock_t *)" }, &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])" }, &dt_idops_func, "string(const char *, int, [int])" },
{ "sum", DT_IDENT_AGGFUNC, 0, DTRACEAGG_SUM, DT_ATTR_STABCMN, DT_VERS_1_0, { "sum", DT_IDENT_AGGFUNC, 0, DTRACEAGG_SUM, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "void(@)" }, &dt_idops_func, "void(@)" },
#if !defined(sun) #ifndef illumos
{ "sx_isexclusive", DT_IDENT_FUNC, 0, DIF_SUBR_SX_ISEXCLUSIVE, { "sx_isexclusive", DT_IDENT_FUNC, 0, DIF_SUBR_SX_ISEXCLUSIVE,
DT_ATTR_EVOLCMN, DT_VERS_1_0, DT_ATTR_EVOLCMN, DT_VERS_1_0,
&dt_idops_func, sxlock_str }, &dt_idops_func, sxlock_str },
@ -531,12 +530,12 @@ static const dt_ident_t _dtrace_globals[] = {
{ "walltimestamp", DT_IDENT_SCALAR, 0, DIF_VAR_WALLTIMESTAMP, { "walltimestamp", DT_IDENT_SCALAR, 0, DIF_VAR_WALLTIMESTAMP,
DT_ATTR_STABCMN, DT_VERS_1_0, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_type, "int64_t" }, &dt_idops_type, "int64_t" },
#if defined(sun) #ifdef illumos
{ "zonename", DT_IDENT_SCALAR, 0, DIF_VAR_ZONENAME, { "zonename", DT_IDENT_SCALAR, 0, DIF_VAR_ZONENAME,
DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" }, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" },
#endif #endif
#if !defined(sun) #ifndef illumos
{ "cpu", DT_IDENT_SCALAR, 0, DIF_VAR_CPU, { "cpu", DT_IDENT_SCALAR, 0, DIF_VAR_CPU,
DT_ATTR_STABCMN, DT_VERS_1_6_3, &dt_idops_type, "int" }, DT_ATTR_STABCMN, DT_VERS_1_6_3, &dt_idops_type, "int" },
#endif #endif
@ -780,7 +779,7 @@ const dtrace_pattr_t _dtrace_prvdesc = {
{ DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_COMMON }, { 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_defcpp = "/usr/ccs/lib/cpp"; /* default cpp(1) to invoke */
const char *_dtrace_defld = "/usr/ccs/bin/ld"; /* default ld(1) to invoke */ const char *_dtrace_defld = "/usr/ccs/bin/ld"; /* default ld(1) to invoke */
#else #else
@ -789,7 +788,7 @@ const char *_dtrace_defld = "ld"; /* default ld(1) to invoke */
#endif #endif
const char *_dtrace_libdir = "/usr/lib/dtrace"; /* default library directory */ const char *_dtrace_libdir = "/usr/lib/dtrace"; /* default library directory */
#if defined(sun) #ifdef illumos
const char *_dtrace_provdir = "/dev/dtrace/provider"; /* provider directory */ const char *_dtrace_provdir = "/dev/dtrace/provider"; /* provider directory */
#else #else
const char *_dtrace_provdir = "/dev/dtrace"; /* provider directory */ const char *_dtrace_provdir = "/dev/dtrace"; /* provider directory */
@ -814,7 +813,7 @@ typedef struct dt_fdlist {
uint_t df_size; /* size of df_fds[] */ uint_t df_size; /* size of df_fds[] */
} dt_fdlist_t; } dt_fdlist_t;
#if defined(sun) #ifdef illumos
#pragma init(_dtrace_init) #pragma init(_dtrace_init)
#else #else
void _dtrace_init(void) __attribute__ ((constructor)); 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; dt_provmod_t *prov;
char path[PATH_MAX]; char path[PATH_MAX];
int fd; int fd;
#if defined(sun) #ifdef illumos
struct dirent *dp, *ep; struct dirent *dp, *ep;
DIR *dirp; DIR *dirp;
@ -897,7 +896,7 @@ dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *dfp)
} }
(void) closedir(dirp); (void) closedir(dirp);
#else #else /* !illumos */
char *p; char *p;
char *p1; char *p1;
char *p_providers = NULL; char *p_providers = NULL;
@ -982,7 +981,7 @@ dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *dfp)
} }
if (p_providers != NULL) if (p_providers != NULL)
free(p_providers); free(p_providers);
#endif #endif /* illumos */
} }
static void static void
@ -999,7 +998,7 @@ dt_provmod_destroy(dt_provmod_t **provmod)
*provmod = NULL; *provmod = NULL;
} }
#if defined(sun) #ifdef illumos
static const char * static const char *
dt_get_sysinfo(int cmd, char *buf, size_t len) dt_get_sysinfo(int cmd, char *buf, size_t len)
{ {
@ -1112,7 +1111,7 @@ dt_vopen(int version, int flags, int *errp,
err = errno; err = errno;
} }
#endif #endif
#if defined(sun) #ifdef illumos
ftfd = open("/dev/dtrace/provider/fasttrap", O_RDWR); ftfd = open("/dev/dtrace/provider/fasttrap", O_RDWR);
#else #else
ftfd = open("/dev/dtrace/fasttrap", O_RDWR); ftfd = open("/dev/dtrace/fasttrap", O_RDWR);
@ -1154,7 +1153,7 @@ alloc:
bzero(dtp, sizeof (dtrace_hdl_t)); bzero(dtp, sizeof (dtrace_hdl_t));
dtp->dt_oflags = flags; dtp->dt_oflags = flags;
#if defined(sun) #ifdef illumos
dtp->dt_prcmode = DT_PROC_STOP_PREINIT; dtp->dt_prcmode = DT_PROC_STOP_PREINIT;
#else #else
dtp->dt_prcmode = DT_PROC_STOP_POSTINIT; dtp->dt_prcmode = DT_PROC_STOP_POSTINIT;
@ -1170,7 +1169,7 @@ alloc:
dtp->dt_fterr = fterr; dtp->dt_fterr = fterr;
dtp->dt_cdefs_fd = -1; dtp->dt_cdefs_fd = -1;
dtp->dt_ddefs_fd = -1; dtp->dt_ddefs_fd = -1;
#if defined(sun) #ifdef illumos
dtp->dt_stdout_fd = -1; dtp->dt_stdout_fd = -1;
#else #else
dtp->dt_freopen_fp = NULL; dtp->dt_freopen_fp = NULL;
@ -1202,7 +1201,7 @@ alloc:
dtp->dt_cpp_argv[0] = (char *)strbasename(dtp->dt_cpp_path); 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", (void) snprintf(isadef, sizeof (isadef), "-D__SUNW_D_%u",
(uint_t)(sizeof (void *) * NBBY)); (uint_t)(sizeof (void *) * NBBY));
@ -1242,7 +1241,7 @@ alloc:
return (set_open_errno(dtp, errp, EDT_NOMEM)); return (set_open_errno(dtp, errp, EDT_NOMEM));
#endif #endif
#if defined(sun) #ifdef illumos
#ifdef __x86 #ifdef __x86
/* /*
* On x86 systems, __i386 is defined for <sys/isa_defs.h> for 32-bit * On x86 systems, __i386 is defined for <sys/isa_defs.h> for 32-bit
@ -1282,7 +1281,7 @@ alloc:
* 'kern.bootfile' sysctl value tells us exactly which file is being * 'kern.bootfile' sysctl value tells us exactly which file is being
* used as the kernel. * used as the kernel.
*/ */
#if !defined(sun) #ifndef illumos
{ {
char bootfile[MAXPATHLEN]; char bootfile[MAXPATHLEN];
char *p; char *p;
@ -1644,7 +1643,7 @@ dtrace_close(dtrace_hdl_t *dtp)
(void) close(dtp->dt_cdefs_fd); (void) close(dtp->dt_cdefs_fd);
if (dtp->dt_ddefs_fd != -1) if (dtp->dt_ddefs_fd != -1)
(void) close(dtp->dt_ddefs_fd); (void) close(dtp->dt_ddefs_fd);
#if defined(sun) #ifdef illumos
if (dtp->dt_stdout_fd != -1) if (dtp->dt_stdout_fd != -1)
(void) close(dtp->dt_stdout_fd); (void) close(dtp->dt_stdout_fd);
#else #else

View File

@ -38,7 +38,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h> #include <limits.h>
#if defined(sun) #ifdef illumos
#include <alloca.h> #include <alloca.h>
#endif #endif
#include <errno.h> #include <errno.h>
@ -871,7 +871,7 @@ dt_options_load(dtrace_hdl_t *dtp)
bzero(&hdr, sizeof (dof_hdr_t)); bzero(&hdr, sizeof (dof_hdr_t));
hdr.dofh_loadsz = sizeof (dof_hdr_t); hdr.dofh_loadsz = sizeof (dof_hdr_t);
#if defined(sun) #ifdef illumos
if (dt_ioctl(dtp, DTRACEIOC_DOFGET, &hdr) == -1) if (dt_ioctl(dtp, DTRACEIOC_DOFGET, &hdr) == -1)
#else #else
dof = &hdr; dof = &hdr;
@ -889,7 +889,7 @@ dt_options_load(dtrace_hdl_t *dtp)
for (i = 0; i < DTRACEOPT_MAX; i++) for (i = 0; i < DTRACEOPT_MAX; i++)
dtp->dt_options[i] = DTRACEOPT_UNSET; dtp->dt_options[i] = DTRACEOPT_UNSET;
#if defined(sun) #ifdef illumos
if (dt_ioctl(dtp, DTRACEIOC_DOFGET, dof) == -1) if (dt_ioctl(dtp, DTRACEIOC_DOFGET, dof) == -1)
#else #else
if (dt_ioctl(dtp, DTRACEIOC_DOFGET, &dof) == -1) if (dt_ioctl(dtp, DTRACEIOC_DOFGET, &dof) == -1)

View File

@ -102,7 +102,7 @@
#include <setjmp.h> #include <setjmp.h>
#include <strings.h> #include <strings.h>
#include <assert.h> #include <assert.h>
#if defined(sun) #ifdef illumos
#include <alloca.h> #include <alloca.h>
#endif #endif
#include <stdlib.h> #include <stdlib.h>

View File

@ -33,7 +33,7 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <ctype.h> #include <ctype.h>
#if defined(sun) #ifdef illumos
#include <alloca.h> #include <alloca.h>
#endif #endif
#include <libgen.h> #include <libgen.h>
@ -44,7 +44,7 @@
#include <dt_program.h> #include <dt_program.h>
#include <dt_pid.h> #include <dt_pid.h>
#include <dt_string.h> #include <dt_string.h>
#if !defined(sun) #ifndef illumos
#include <libproc_compat.h> #include <libproc_compat.h>
#endif #endif
#include <dt_module.h> #include <dt_module.h>
@ -74,7 +74,7 @@ typedef struct dt_pid_probe {
static void static void
dt_pid_objname(char *buf, size_t len, Lmid_t lmid, const char *obj) dt_pid_objname(char *buf, size_t len, Lmid_t lmid, const char *obj)
{ {
#if defined(sun) #ifdef illumos
if (lmid == LM_ID_BASE) if (lmid == LM_ID_BASE)
(void) strncpy(buf, obj, len); (void) strncpy(buf, obj, len);
else 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; int isdash = strcmp("-", func) == 0;
pid_t pid; pid_t pid;
#if defined(sun) #ifdef illumos
pid = Pstatus(pp->dpp_pr)->pr_pid; pid = Pstatus(pp->dpp_pr)->pr_pid;
#else #else
pid = proc_getpid(pp->dpp_pr); 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) if (obj == NULL)
return (0); return (0);
#if defined(sun) #ifdef illumos
(void) Plmid(pp->dpp_pr, pmp->pr_vaddr, &pp->dpp_lmid); (void) Plmid(pp->dpp_pr, pmp->pr_vaddr, &pp->dpp_lmid);
#endif #endif
@ -279,7 +279,7 @@ dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj)
pp->dpp_obj = obj; pp->dpp_obj = obj;
else else
pp->dpp_obj++; pp->dpp_obj++;
#if defined(sun) #ifdef illumos
if (Pxlookup_by_name(pp->dpp_pr, pp->dpp_lmid, obj, ".stret1", &sym, if (Pxlookup_by_name(pp->dpp_pr, pp->dpp_lmid, obj, ".stret1", &sym,
NULL) == 0) NULL) == 0)
pp->dpp_stret[0] = sym.st_value; 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); GELF_ST_INFO(STB_LOCAL, STT_FUNC);
sym.st_other = 0; sym.st_other = 0;
sym.st_value = 0; sym.st_value = 0;
#if defined(sun) #ifdef illumos
sym.st_size = Pstatus(pp->dpp_pr)->pr_dmodel == sym.st_size = Pstatus(pp->dpp_pr)->pr_dmodel ==
PR_MODEL_ILP32 ? -1U : -1ULL; PR_MODEL_ILP32 ? -1U : -1ULL;
#else #else
@ -404,7 +404,7 @@ dt_pid_mod_filt(void *arg, const prmap_t *pmp, const char *obj)
if (gmatch(obj, pp->dpp_mod)) if (gmatch(obj, pp->dpp_mod))
return (dt_pid_per_mod(pp, pmp, obj)); return (dt_pid_per_mod(pp, pmp, obj));
#if defined(sun) #ifdef illumos
(void) Plmid(pp->dpp_pr, pmp->pr_vaddr, &pp->dpp_lmid); (void) Plmid(pp->dpp_pr, pmp->pr_vaddr, &pp->dpp_lmid);
#else #else
pp->dpp_lmid = 0; 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)) if (gmatch(pp->dpp_obj, pp->dpp_mod))
return (dt_pid_per_mod(pp, pmp, obj)); return (dt_pid_per_mod(pp, pmp, obj));
#if defined(sun) #ifdef illumos
(void) Plmid(pp->dpp_pr, pmp->pr_vaddr, &pp->dpp_lmid); (void) Plmid(pp->dpp_pr, pmp->pr_vaddr, &pp->dpp_lmid);
#endif #endif
@ -468,7 +468,7 @@ dt_pid_fix_mod(dtrace_probedesc_t *pdp, struct ps_prochandle *P)
else else
obj++; obj++;
#if defined(sun) #ifdef illumos
(void) Plmid(P, pmp->pr_vaddr, &lmid); (void) Plmid(P, pmp->pr_vaddr, &lmid);
#endif #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; dh.dofhp_addr = (e_type == ET_EXEC) ? 0 : pmp->pr_vaddr;
dt_pid_objname(dh.dofhp_mod, sizeof (dh.dofhp_mod), dt_pid_objname(dh.dofhp_mod, sizeof (dh.dofhp_mod),
#if defined(sun) #ifdef illumos
sip.prs_lmid, mname); sip.prs_lmid, mname);
#else #else
0, mname); 0, mname);
#endif #endif
#if defined(sun) #ifdef illumos
if (fd == -1 && if (fd == -1 &&
(fd = pr_open(P, "/dev/dtrace/helper", O_RDWR, 0)) < 0) { (fd = pr_open(P, "/dev/dtrace/helper", O_RDWR, 0)) < 0) {
dt_dprintf("pr_open of helper device failed: %s\n", 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 #endif
} }
#if defined(sun) #ifdef illumos
if (fd != -1) if (fd != -1)
(void) pr_close(P, fd); (void) pr_close(P, fd);
#endif #endif
@ -634,13 +634,13 @@ dt_pid_create_usdt_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp,
int ret = 0; int ret = 0;
assert(DT_MUTEX_HELD(&dpr->dpr_lock)); assert(DT_MUTEX_HELD(&dpr->dpr_lock));
#if defined(sun) #ifdef illumos
(void) Pupdate_maps(P); (void) Pupdate_maps(P);
if (Pobject_iter(P, dt_pid_usdt_mapping, P) != 0) { if (Pobject_iter(P, dt_pid_usdt_mapping, P) != 0) {
ret = -1; ret = -1;
(void) dt_pid_error(dtp, pcb, dpr, NULL, D_PROC_USDT, (void) dt_pid_error(dtp, pcb, dpr, NULL, D_PROC_USDT,
"failed to instantiate probes for pid %d: %s", "failed to instantiate probes for pid %d: %s",
#if defined(sun) #ifdef illumos
(int)Pstatus(P)->pr_pid, strerror(errno)); (int)Pstatus(P)->pr_pid, strerror(errno));
#else #else
(int)proc_getpid(P), strerror(errno)); (int)proc_getpid(P), strerror(errno));

View File

@ -28,7 +28,7 @@
#include <assert.h> #include <assert.h>
#include <strings.h> #include <strings.h>
#if defined(sun) #ifdef illumos
#include <alloca.h> #include <alloca.h>
#endif #endif
#include <fcntl.h> #include <fcntl.h>

View File

@ -25,7 +25,7 @@
* Copyright (c) 2013 by Delphix. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved.
*/ */
#if defined(sun) #ifdef illumos
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#else #else
#define ABS(a) ((a) < 0 ? -(a) : (a)) #define ABS(a) ((a) < 0 ? -(a) : (a))
@ -33,7 +33,7 @@
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include <stdlib.h> #include <stdlib.h>
#if defined(sun) #ifdef illumos
#include <alloca.h> #include <alloca.h>
#endif #endif
#include <assert.h> #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, * Below, we turn this into the canonical adb/mdb /[yY] format,
* "1973 Dec 3 17:20:00". * "1973 Dec 3 17:20:00".
*/ */
#if defined(sun) #ifdef illumos
(void) ctime_r(&sec, src, sizeof (src)); (void) ctime_r(&sec, src, sizeof (src));
#else #else
(void) ctime_r(&sec, src); (void) ctime_r(&sec, src);
@ -518,7 +518,7 @@ pfprint_port(dtrace_hdl_t *dtp, FILE *fp, const char *format,
char buf[256]; char buf[256];
struct servent *sv, res; struct servent *sv, res;
#if defined(sun) #ifdef illumos
if ((sv = getservbyport_r(port, NULL, &res, buf, sizeof (buf))) != NULL) if ((sv = getservbyport_r(port, NULL, &res, buf, sizeof (buf))) != NULL)
#else #else
if (getservbyport_r(port, NULL, &res, buf, sizeof (buf), &sv) > 0) 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'; s[size] = '\0';
if (strchr(s, ':') == NULL && inet_pton(AF_INET, s, inetaddr) != -1) { if (strchr(s, ':') == NULL && inet_pton(AF_INET, s, inetaddr) != -1) {
#if defined(sun) #ifdef illumos
if ((host = gethostbyaddr_r(inetaddr, NS_INADDRSZ, if ((host = gethostbyaddr_r(inetaddr, NS_INADDRSZ,
AF_INET, &res, buf, sizeof (buf), &e)) != NULL) AF_INET, &res, buf, sizeof (buf), &e)) != NULL)
#else #else
@ -694,7 +694,7 @@ static const dt_pfconv_t _dtrace_conversions[] = {
{ "S", "s", pfproto_cstr, pfcheck_str, pfprint_estr }, { "S", "s", pfproto_cstr, pfcheck_str, pfprint_estr },
{ "T", "s", "int64_t", pfcheck_time, pfprint_time822 }, { "T", "s", "int64_t", pfcheck_time, pfprint_time822 },
{ "u", "u", pfproto_xint, pfcheck_xint, pfprint_uint }, { "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 */ { "wc", "wc", "int", pfcheck_type, pfprint_sint }, /* a.k.a. wchar_t */
{ "ws", "ws", pfproto_wstr, pfcheck_wstr, pfprint_wstr }, { "ws", "ws", pfproto_wstr, pfcheck_wstr, pfprint_wstr },
#else #else
@ -1657,7 +1657,7 @@ dtrace_freopen(dtrace_hdl_t *dtp, FILE *fp, void *fmtdata,
if (rval == -1 || fp == NULL) if (rval == -1 || fp == NULL)
return (rval); return (rval);
#if defined(sun) #ifdef illumos
if (pfd->pfd_preflen != 0 && if (pfd->pfd_preflen != 0 &&
strcmp(pfd->pfd_prefix, DT_FREOPEN_RESTORE) == 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); (void) fclose(nfp);
#else #else /* !illumos */
/* /*
* The 'standard output' (which is not necessarily stdout) * The 'standard output' (which is not necessarily stdout)
* treatment on FreeBSD is implemented differently than on * 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. */ /* Remember that the output has been redirected to the new file. */
dtp->dt_freopen_fp = nfp; dtp->dt_freopen_fp = nfp;
#endif #endif /* illumos */
return (rval); return (rval);
} }

View File

@ -77,7 +77,7 @@
*/ */
#include <sys/wait.h> #include <sys/wait.h>
#if defined(sun) #ifdef illumos
#include <sys/lwp.h> #include <sys/lwp.h>
#endif #endif
#include <strings.h> #include <strings.h>
@ -89,7 +89,7 @@
#include <dt_pid.h> #include <dt_pid.h>
#include <dt_impl.h> #include <dt_impl.h>
#if !defined(sun) #ifndef illumos
#include <sys/syscall.h> #include <sys/syscall.h>
#include <libproc_compat.h> #include <libproc_compat.h>
#define SYS_forksys SYS_fork #define SYS_forksys SYS_fork
@ -143,7 +143,7 @@ dt_proc_bpdestroy(dt_proc_t *dpr, int delbkpts)
static void static void
dt_proc_bpmatch(dtrace_hdl_t *dtp, dt_proc_t *dpr) 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; const lwpstatus_t *psp = &Pstatus(dpr->dpr_proc)->pr_lwp;
#else #else
unsigned long pc; 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)); assert(DT_MUTEX_HELD(&dpr->dpr_lock));
#if !defined(sun) #ifndef illumos
proc_regget(dpr->dpr_proc, REG_PC, &pc); proc_regget(dpr->dpr_proc, REG_PC, &pc);
proc_bkptregadj(&pc); proc_bkptregadj(&pc);
#endif #endif
for (dbp = dt_list_next(&dpr->dpr_bps); for (dbp = dt_list_next(&dpr->dpr_bps);
dbp != NULL; dbp = dt_list_next(dbp)) { dbp != NULL; dbp = dt_list_next(dbp)) {
#if defined(sun) #ifdef illumos
if (psp->pr_reg[R_PC] == dbp->dbp_addr) if (psp->pr_reg[R_PC] == dbp->dbp_addr)
break; break;
#else #else
@ -170,7 +170,7 @@ dt_proc_bpmatch(dtrace_hdl_t *dtp, dt_proc_t *dpr)
if (dbp == NULL) { if (dbp == NULL) {
dt_dprintf("pid %d: spurious breakpoint wakeup for %lx\n", 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]); (int)dpr->dpr_pid, (ulong_t)psp->pr_reg[R_PC]);
#else #else
(int)dpr->dpr_pid, pc); (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, (void) dt_proc_bpcreate(dpr, rdn.u.bptaddr,
#if defined(sun) #ifdef illumos
(dt_bkpt_f *)dt_proc_rdevent, (void *)evname); (dt_bkpt_f *)dt_proc_rdevent, (void *)evname);
#else #else
/* XXX ugly */ /* XXX ugly */
@ -357,7 +357,7 @@ dt_proc_rdwatch(dt_proc_t *dpr, rd_event_e event, const char *evname)
static void static void
dt_proc_attach(dt_proc_t *dpr, int exec) dt_proc_attach(dt_proc_t *dpr, int exec)
{ {
#if defined(sun) #ifdef illumos
const pstatus_t *psp = Pstatus(dpr->dpr_proc); const pstatus_t *psp = Pstatus(dpr->dpr_proc);
#endif #endif
rd_err_e err; rd_err_e err;
@ -366,23 +366,23 @@ dt_proc_attach(dt_proc_t *dpr, int exec)
assert(DT_MUTEX_HELD(&dpr->dpr_lock)); assert(DT_MUTEX_HELD(&dpr->dpr_lock));
if (exec) { if (exec) {
#if defined(sun) #ifdef illumos
if (psp->pr_lwp.pr_errno != 0) if (psp->pr_lwp.pr_errno != 0)
return; /* exec failed: nothing needs to be done */ return; /* exec failed: nothing needs to be done */
#endif #endif
dt_proc_bpdestroy(dpr, B_FALSE); dt_proc_bpdestroy(dpr, B_FALSE);
#if defined(sun) #ifdef illumos
Preset_maps(dpr->dpr_proc); Preset_maps(dpr->dpr_proc);
#endif #endif
} }
if ((dpr->dpr_rtld = Prd_agent(dpr->dpr_proc)) != NULL && if ((dpr->dpr_rtld = Prd_agent(dpr->dpr_proc)) != NULL &&
(err = rd_event_enable(dpr->dpr_rtld, B_TRUE)) == RD_OK) { (err = rd_event_enable(dpr->dpr_rtld, B_TRUE)) == RD_OK) {
#if defined(sun) #ifdef illumos
dt_proc_rdwatch(dpr, RD_PREINIT, "RD_PREINIT"); dt_proc_rdwatch(dpr, RD_PREINIT, "RD_PREINIT");
#endif #endif
dt_proc_rdwatch(dpr, RD_POSTINIT, "RD_POSTINIT"); dt_proc_rdwatch(dpr, RD_POSTINIT, "RD_POSTINIT");
#if defined(sun) #ifdef illumos
dt_proc_rdwatch(dpr, RD_DLACTIVITY, "RD_DLACTIVITY"); dt_proc_rdwatch(dpr, RD_DLACTIVITY, "RD_DLACTIVITY");
#endif #endif
} else { } else {
@ -507,7 +507,7 @@ dt_proc_control(void *arg)
struct ps_prochandle *P = dpr->dpr_proc; struct ps_prochandle *P = dpr->dpr_proc;
int pid = dpr->dpr_pid; int pid = dpr->dpr_pid;
#if defined(sun) #ifdef illumos
int pfd = Pctlfd(P); int pfd = Pctlfd(P);
const long wstop = PCWSTOP; const long wstop = PCWSTOP;
@ -529,7 +529,7 @@ dt_proc_control(void *arg)
*/ */
(void) pthread_mutex_lock(&dpr->dpr_lock); (void) pthread_mutex_lock(&dpr->dpr_lock);
#if defined(sun) #ifdef illumos
(void) Punsetflags(P, PR_ASYNC); /* require synchronous mode */ (void) Punsetflags(P, PR_ASYNC); /* require synchronous mode */
(void) Psetflags(P, PR_BPTADJ); /* always adjust eip on x86 */ (void) Psetflags(P, PR_BPTADJ); /* always adjust eip on x86 */
(void) Punsetflags(P, PR_FORK); /* do not inherit on fork */ (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. * 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. * Check for an appropriate stop request and wait for dt_proc_continue.
*/ */
#if defined(sun) #ifdef illumos
if (Pstatus(P)->pr_flags & PR_KLC) if (Pstatus(P)->pr_flags & PR_KLC)
#else #else
if (proc_getflags(P) & PR_KLC) if (proc_getflags(P) & PR_KLC)
@ -590,7 +590,7 @@ dt_proc_control(void *arg)
while (!dpr->dpr_quit) { while (!dpr->dpr_quit) {
const lwpstatus_t *psp; const lwpstatus_t *psp;
#if defined(sun) #ifdef illumos
if (write(pfd, &wstop, sizeof (wstop)) == -1 && errno == EINTR) if (write(pfd, &wstop, sizeof (wstop)) == -1 && errno == EINTR)
continue; /* check dpr_quit and continue waiting */ continue; /* check dpr_quit and continue waiting */
#else #else
@ -602,7 +602,7 @@ dt_proc_control(void *arg)
(void) pthread_mutex_lock(&dpr->dpr_lock); (void) pthread_mutex_lock(&dpr->dpr_lock);
#if defined(sun) #ifdef illumos
pwait_locked: pwait_locked:
if (Pstopstatus(P, PCNULL, 0) == -1 && errno == EINTR) { if (Pstopstatus(P, PCNULL, 0) == -1 && errno == EINTR) {
(void) pthread_mutex_unlock(&dpr->dpr_lock); (void) pthread_mutex_unlock(&dpr->dpr_lock);
@ -612,7 +612,7 @@ pwait_locked:
switch (Pstate(P)) { switch (Pstate(P)) {
case PS_STOP: case PS_STOP:
#if defined(sun) #ifdef illumos
psp = &Pstatus(P)->pr_lwp; psp = &Pstatus(P)->pr_lwp;
#else #else
psp = proc_getlwpstatus(P); psp = proc_getlwpstatus(P);
@ -661,7 +661,7 @@ pwait_locked:
break; break;
case PS_LOST: case PS_LOST:
#if defined(sun) #ifdef illumos
if (Preopen(P) == 0) if (Preopen(P) == 0)
goto pwait_locked; goto pwait_locked;
#endif #endif
@ -734,7 +734,7 @@ dt_proc_t *
dt_proc_lookup(dtrace_hdl_t *dtp, struct ps_prochandle *P, int remove) dt_proc_lookup(dtrace_hdl_t *dtp, struct ps_prochandle *P, int remove)
{ {
dt_proc_hash_t *dph = dtp->dt_procs; dt_proc_hash_t *dph = dtp->dt_procs;
#if defined(sun) #ifdef illumos
pid_t pid = Pstatus(P)->pr_pid; pid_t pid = Pstatus(P)->pr_pid;
#else #else
pid_t pid = proc_getpid(P); 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(). * an external debugger and we were waiting in dt_proc_waitrun().
* Leave the process in this condition using PRELEASE_HANG. * 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))) { if (!(Pstatus(dpr->dpr_proc)->pr_flags & (PR_KLC | PR_RLC))) {
#else #else
if (!(proc_getflags(dpr->dpr_proc) & (PR_KLC | PR_RLC))) { if (!(proc_getflags(dpr->dpr_proc) & (PR_KLC | PR_RLC))) {
#endif #endif
dt_dprintf("abandoning pid %d\n", (int)dpr->dpr_pid); dt_dprintf("abandoning pid %d\n", (int)dpr->dpr_pid);
rflag = PRELEASE_HANG; rflag = PRELEASE_HANG;
#if defined(sun) #ifdef illumos
} else if (Pstatus(dpr->dpr_proc)->pr_flags & PR_KLC) { } else if (Pstatus(dpr->dpr_proc)->pr_flags & PR_KLC) {
#else #else
} else if (proc_getflags(dpr->dpr_proc) & PR_KLC) { } 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); (void) pthread_mutex_lock(&dpr->dpr_lock);
dpr->dpr_quit = B_TRUE; dpr->dpr_quit = B_TRUE;
#if defined(sun) #ifdef illumos
(void) _lwp_kill(dpr->dpr_tid, SIGCANCEL); (void) _lwp_kill(dpr->dpr_tid, SIGCANCEL);
#else #else
pthread_kill(dpr->dpr_tid, SIGTHR); 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) sigfillset(&nset);
(void) sigdelset(&nset, SIGABRT); /* unblocked for assert() */ (void) sigdelset(&nset, SIGABRT); /* unblocked for assert() */
#if defined(sun) #ifdef illumos
(void) sigdelset(&nset, SIGCANCEL); /* see dt_proc_destroy() */ (void) sigdelset(&nset, SIGCANCEL); /* see dt_proc_destroy() */
#else #else
(void) sigdelset(&nset, SIGUSR1); /* see dt_proc_destroy() */ (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. * small amount of useful information to help figure it out.
*/ */
if (dpr->dpr_done) { if (dpr->dpr_done) {
#if defined(sun) #ifdef illumos
const psinfo_t *prp = Ppsinfo(dpr->dpr_proc); const psinfo_t *prp = Ppsinfo(dpr->dpr_proc);
int stat = prp ? prp->pr_wstat : 0; int stat = prp ? prp->pr_wstat : 0;
int pid = dpr->dpr_pid; 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_mutex_init(&dpr->dpr_lock, NULL);
(void) pthread_cond_init(&dpr->dpr_cv, 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) { if ((dpr->dpr_proc = Pcreate(file, argv, &err, NULL, 0)) == NULL) {
#else #else
if ((err = proc_create(file, argv, pcf, child_arg, 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; dpr->dpr_hdl = dtp;
#if defined(sun) #ifdef illumos
dpr->dpr_pid = Pstatus(dpr->dpr_proc)->pr_pid; dpr->dpr_pid = Pstatus(dpr->dpr_proc)->pr_pid;
#else #else
dpr->dpr_pid = proc_getpid(dpr->dpr_proc); 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_mutex_init(&dpr->dpr_lock, NULL);
(void) pthread_cond_init(&dpr->dpr_cv, NULL); (void) pthread_cond_init(&dpr->dpr_cv, NULL);
#if defined(sun) #ifdef illumos
if ((dpr->dpr_proc = Pgrab(pid, flags, &err)) == NULL) { if ((dpr->dpr_proc = Pgrab(pid, flags, &err)) == NULL) {
#else #else
if ((err = proc_attach(pid, flags, &dpr->dpr_proc)) != 0) { 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); struct ps_prochandle *P = dt_proc_create(dtp, file, argv, pcf, child_arg);
if (P != NULL && idp != NULL && idp->di_id == 0) { if (P != NULL && idp != NULL && idp->di_id == 0) {
#if defined(sun) #ifdef illumos
idp->di_id = Pstatus(P)->pr_pid; /* $target = created pid */ idp->di_id = Pstatus(P)->pr_pid; /* $target = created pid */
#else #else
idp->di_id = proc_getpid(P); /* $target = created pid */ idp->di_id = proc_getpid(P); /* $target = created pid */

View File

@ -30,7 +30,7 @@
#include <errno.h> #include <errno.h>
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
#if defined(sun) #ifdef illumos
#include <alloca.h> #include <alloca.h>
#endif #endif

View File

@ -28,7 +28,7 @@
*/ */
#include <sys/types.h> #include <sys/types.h>
#if defined(sun) #ifdef illumos
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#endif #endif
@ -36,7 +36,7 @@
#include <limits.h> #include <limits.h>
#include <strings.h> #include <strings.h>
#include <stdlib.h> #include <stdlib.h>
#if defined(sun) #ifdef illumos
#include <alloca.h> #include <alloca.h>
#endif #endif
#include <unistd.h> #include <unistd.h>

View File

@ -25,7 +25,7 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#if defined(sun) #ifdef illumos
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#endif #endif
#include <sys/isa_defs.h> #include <sys/isa_defs.h>
@ -38,7 +38,7 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <ctype.h> #include <ctype.h>
#if defined(sun) #ifdef illumos
#include <alloca.h> #include <alloca.h>
#else #else
#include <sys/sysctl.h> #include <sys/sysctl.h>
@ -477,7 +477,7 @@ dt_dprintf(const char *format, ...)
} }
int int
#if defined(sun) #ifdef illumos
dt_ioctl(dtrace_hdl_t *dtp, int val, void *arg) dt_ioctl(dtrace_hdl_t *dtp, int val, void *arg)
#else #else
dt_ioctl(dtrace_hdl_t *dtp, u_long val, void *arg) 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; const dtrace_vector_t *v = dtp->dt_vector;
#if !defined(sun) #ifndef illumos
/* Avoid sign extension. */ /* Avoid sign extension. */
val &= 0xffffffff; val &= 0xffffffff;
#endif #endif
@ -506,7 +506,7 @@ dt_status(dtrace_hdl_t *dtp, processorid_t cpu)
const dtrace_vector_t *v = dtp->dt_vector; const dtrace_vector_t *v = dtp->dt_vector;
if (v == NULL) { if (v == NULL) {
#if defined(sun) #ifdef illumos
return (p_online(cpu, P_STATUS)); return (p_online(cpu, P_STATUS));
#else #else
int maxid = 0; int maxid = 0;
@ -583,7 +583,7 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, const char *format, ...)
va_list ap; va_list ap;
int n; int n;
#if !defined(sun) #ifndef illumos
/* /*
* On FreeBSD, check if output is currently being re-directed * On FreeBSD, check if output is currently being re-directed
* to another file. If so, output to that file instead of the * 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))); return (popc + dt_popc(bp[maxw] & ((1UL << maxb) - 1)));
} }
#if defined(sun) #ifdef illumos
struct _rwlock; struct _rwlock;
struct _lwp_mutex; struct _lwp_mutex;
@ -867,7 +867,7 @@ dt_rw_write_held(pthread_rwlock_t *lock)
int int
dt_mutex_held(pthread_mutex_t *lock) dt_mutex_held(pthread_mutex_t *lock)
{ {
#if defined(sun) #ifdef illumos
extern int _mutex_held(struct _lwp_mutex *); extern int _mutex_held(struct _lwp_mutex *);
return (_mutex_held((struct _lwp_mutex *)lock)); return (_mutex_held((struct _lwp_mutex *)lock));
#else #else

View File

@ -82,7 +82,7 @@ dtrace_sleep(dtrace_hdl_t *dtp)
return; /* sleep duration has already past */ return; /* sleep duration has already past */
} }
#if defined(sun) #ifdef illumos
tv.tv_sec = (earliest - now) / NANOSEC; tv.tv_sec = (earliest - now) / NANOSEC;
tv.tv_nsec = (earliest - now) % NANOSEC; tv.tv_nsec = (earliest - now) % NANOSEC;

View File

@ -37,7 +37,7 @@
#include <stdio.h> #include <stdio.h>
#include <gelf.h> #include <gelf.h>
#include <libproc.h> #include <libproc.h>
#if !defined(sun) #ifndef illumos
#include <rtld_db.h> #include <rtld_db.h>
#endif #endif
@ -554,7 +554,7 @@ extern int dtrace_probe_info(dtrace_hdl_t *,
* entry point to obtain a library handle. * entry point to obtain a library handle.
*/ */
struct dtrace_vector { struct dtrace_vector {
#if defined(sun) #ifdef illumos
int (*dtv_ioctl)(void *, int, void *); int (*dtv_ioctl)(void *, int, void *);
#else #else
int (*dtv_ioctl)(void *, u_long, void *); int (*dtv_ioctl)(void *, u_long, void *);
@ -605,7 +605,7 @@ extern int _dtrace_debug;
} }
#endif #endif
#if !defined(sun) #ifndef illumos
#define _SC_CPUID_MAX _SC_NPROCESSORS_CONF #define _SC_CPUID_MAX _SC_NPROCESSORS_CONF
#define _SC_NPROCESSORS_MAX _SC_NPROCESSORS_CONF #define _SC_NPROCESSORS_MAX _SC_NPROCESSORS_CONF
#endif #endif

View File

@ -39,7 +39,7 @@
#include <dis_tables.h> #include <dis_tables.h>
#if !defined(sun) #ifndef illumos
#define PR_MODEL_ILP32 1 #define PR_MODEL_ILP32 1
#define PR_MODEL_LP64 2 #define PR_MODEL_LP64 2
#include <libproc_compat.h> #include <libproc_compat.h>
@ -88,7 +88,7 @@ dt_pid_has_jump_table(struct ps_prochandle *P, dtrace_hdl_t *dtp,
{ {
ulong_t i; ulong_t i;
int size; int size;
#if defined(sun) #ifdef illumos
pid_t pid = Pstatus(P)->pr_pid; pid_t pid = Pstatus(P)->pr_pid;
char dmodel = Pstatus(P)->pr_dmodel; char dmodel = Pstatus(P)->pr_dmodel;
#else #else
@ -144,7 +144,7 @@ dt_pid_create_return_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
uint8_t *text; uint8_t *text;
ulong_t i, end; ulong_t i, end;
int size; int size;
#if defined(sun) #ifdef illumos
pid_t pid = Pstatus(P)->pr_pid; pid_t pid = Pstatus(P)->pr_pid;
char dmodel = Pstatus(P)->pr_dmodel; char dmodel = Pstatus(P)->pr_dmodel;
#else #else
@ -305,7 +305,7 @@ dt_pid_create_offset_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
uint8_t *text; uint8_t *text;
ulong_t i; ulong_t i;
int size; int size;
#if defined(sun) #ifdef illumos
pid_t pid = Pstatus(P)->pr_pid; pid_t pid = Pstatus(P)->pr_pid;
char dmodel = Pstatus(P)->pr_dmodel; char dmodel = Pstatus(P)->pr_dmodel;
#else #else
@ -388,7 +388,7 @@ dt_pid_create_glob_offset_probes(struct ps_prochandle *P, dtrace_hdl_t *dtp,
uint8_t *text; uint8_t *text;
int size; int size;
ulong_t i, end = symp->st_size; ulong_t i, end = symp->st_size;
#if defined(sun) #ifdef illumos
pid_t pid = Pstatus(P)->pr_pid; pid_t pid = Pstatus(P)->pr_pid;
char dmodel = Pstatus(P)->pr_dmodel; char dmodel = Pstatus(P)->pr_dmodel;
#else #else

View File

@ -29,7 +29,7 @@
#pragma ident "%Z%%M% %I% %E% SMI" #pragma ident "%Z%%M% %I% %E% SMI"
#if defined(sun) #ifdef illumos
#pragma weak gmatch = _gmatch #pragma weak gmatch = _gmatch
#include "gen_synonyms.h" #include "gen_synonyms.h"
@ -38,7 +38,7 @@
#include <libgen.h> #include <libgen.h>
#include <stdlib.h> #include <stdlib.h>
#include <limits.h> #include <limits.h>
#if defined(sun) #ifdef illumos
#include <widec.h> #include <widec.h>
#include "_range.h" #include "_range.h"
#else #else

View File

@ -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 boolean_t libzfs_fru_notself(libzfs_handle_t *, const char *);
extern int zpool_fru_set(zpool_handle_t *, uint64_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 *, extern int zmount(const char *, const char *, int, char *, char *, int, char *,
int); int);
#endif /* !sun */ #endif
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1112,7 +1112,7 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
} }
case ZFS_PROP_MLSLABEL: case ZFS_PROP_MLSLABEL:
{ {
#ifdef sun #ifdef illumos
/* /*
* Verify the mlslabel string and convert to * Verify the mlslabel string and convert to
* internal hex label string. * internal hex label string.
@ -1161,11 +1161,11 @@ badlabel:
"invalid mlslabel '%s'"), strval); "invalid mlslabel '%s'"), strval);
(void) zfs_error(hdl, EZFS_BADPROP, errbuf); (void) zfs_error(hdl, EZFS_BADPROP, errbuf);
m_label_free(new_sl); /* OK if null */ m_label_free(new_sl); /* OK if null */
#else /* !sun */ #else /* !illumos */
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"mlslabel is not supported on FreeBSD")); "mlslabel is not supported on FreeBSD"));
(void) zfs_error(hdl, EZFS_BADPROP, errbuf); (void) zfs_error(hdl, EZFS_BADPROP, errbuf);
#endif /* !sun */ #endif /* illumos */
goto error; 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: case ZFS_PROP_MLSLABEL:
{ {
#ifdef sun #ifdef illumos
m_label_t *new_sl = NULL; m_label_t *new_sl = NULL;
char *ascii = NULL; /* human readable label */ 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); (void) strlcpy(propbuf, ascii, proplen);
free(ascii); free(ascii);
#else /* !sun */ #else /* !illumos */
propbuf[0] = '\0'; propbuf[0] = '\0';
#endif /* !sun */ #endif /* illumos */
} }
break; break;
@ -2569,7 +2569,7 @@ static int
idmap_id_to_numeric_domain_rid(uid_t id, boolean_t isuser, idmap_id_to_numeric_domain_rid(uid_t id, boolean_t isuser,
char **domainp, idmap_rid_t *ridp) char **domainp, idmap_rid_t *ridp)
{ {
#ifdef sun #ifdef illumos
idmap_get_handle_t *get_hdl = NULL; idmap_get_handle_t *get_hdl = NULL;
idmap_stat status; idmap_stat status;
int err = EINVAL; int err = EINVAL;
@ -2594,10 +2594,10 @@ out:
if (get_hdl) if (get_hdl)
idmap_get_destroy(get_hdl); idmap_get_destroy(get_hdl);
return (err); return (err);
#else /* !sun */ #else /* !illumos */
assert(!"invalid code path"); assert(!"invalid code path");
return (EINVAL); // silence compiler warning 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; cp = strchr(propname, '@') + 1;
if (strchr(cp, '@')) { if (strchr(cp, '@')) {
#ifdef sun #ifdef illumos
/* /*
* It's a SID name (eg "user@domain") that needs to be * It's a SID name (eg "user@domain") that needs to be
* turned into S-1-domainID-RID. * turned into S-1-domainID-RID.
@ -2678,9 +2678,9 @@ userquota_propname_decode(const char *propname, boolean_t zoned,
cp = numericsid; cp = numericsid;
*ridp = rid; *ridp = rid;
/* will be further decoded below */ /* will be further decoded below */
#else /* !sun */ #else /* !illumos */
return (ENOENT); return (ENOENT);
#endif /* !sun */ #endif /* illumos */
} }
if (strncmp(cp, "S-1-", 4) == 0) { 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 static int
zfs_smb_acl_mgmt(libzfs_handle_t *hdl, char *dataset, char *path, zfs_smb_acl_mgmt(libzfs_handle_t *hdl, char *dataset, char *path,
zfs_smb_acl_op_t cmd, char *resource1, char *resource2) 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, return (zfs_smb_acl_mgmt(hdl, dataset, path, ZFS_SMB_ACL_RENAME,
oldname, newname)); oldname, newname));
} }
#endif /* sun */ #endif /* illumos */
int int
zfs_userspace(zfs_handle_t *zhp, zfs_userquota_prop_t type, zfs_userspace(zfs_handle_t *zhp, zfs_userquota_prop_t type,

View File

@ -494,7 +494,7 @@ find_shares_object(differ_info_t *di)
(void) strlcat(fullpath, ZDIFF_SHARESDIR, MAXPATHLEN); (void) strlcat(fullpath, ZDIFF_SHARESDIR, MAXPATHLEN);
if (stat64(fullpath, &sb) != 0) { if (stat64(fullpath, &sb) != 0) {
#ifdef sun #ifdef illumos
(void) snprintf(di->errbuf, sizeof (di->errbuf), (void) snprintf(di->errbuf, sizeof (di->errbuf),
dgettext(TEXT_DOMAIN, "Cannot stat %s"), fullpath); dgettext(TEXT_DOMAIN, "Cannot stat %s"), fullpath);
return (zfs_error(di->zhp->zfs_hdl, EZFS_DIFF, di->errbuf)); return (zfs_error(di->zhp->zfs_hdl, EZFS_DIFF, di->errbuf));

View File

@ -952,7 +952,7 @@ slice_cache_compare(const void *arg1, const void *arg2)
return (rv > 0 ? 1 : -1); return (rv > 0 ? 1 : -1);
} }
#ifdef sun #ifdef illumos
static void static void
check_one_slice(avl_tree_t *r, char *diskname, uint_t partno, check_one_slice(avl_tree_t *r, char *diskname, uint_t partno,
diskaddr_t size, uint_t blksz) 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 = avl_find(r, &tmpnode, NULL)))
node->rn_nozpool = B_TRUE; node->rn_nozpool = B_TRUE;
} }
#endif /* sun */ #endif /* illumos */
static void static void
nozpool_all_slices(avl_tree_t *r, const char *sname) nozpool_all_slices(avl_tree_t *r, const char *sname)
{ {
#ifdef sun #ifdef illumos
char diskname[MAXNAMELEN]; char diskname[MAXNAMELEN];
char *ptr; char *ptr;
int i; int i;
@ -996,10 +996,10 @@ nozpool_all_slices(avl_tree_t *r, const char *sname)
ptr[0] = 'p'; ptr[0] = 'p';
for (i = 0; i <= FD_NUMPART; i++) for (i = 0; i <= FD_NUMPART; i++)
check_one_slice(r, diskname, i, 0, 1); check_one_slice(r, diskname, i, 0, 1);
#endif /* sun */ #endif /* illumos */
} }
#ifdef sun #ifdef illumos
static void static void
check_slices(avl_tree_t *r, int fd, const char *sname) 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); efi_free(gpt);
} }
} }
#endif /* sun */ #endif /* illumos */
static void static void
zpool_open_func(void *arg) zpool_open_func(void *arg)
@ -1063,7 +1063,7 @@ zpool_open_func(void *arg)
return; return;
} }
/* this file is too small to hold a zpool */ /* this file is too small to hold a zpool */
#ifdef sun #ifdef illumos
if (S_ISREG(statbuf.st_mode) && if (S_ISREG(statbuf.st_mode) &&
statbuf.st_size < SPA_MINDEVSIZE) { statbuf.st_size < SPA_MINDEVSIZE) {
(void) close(fd); (void) close(fd);
@ -1075,12 +1075,12 @@ zpool_open_func(void *arg)
*/ */
check_slices(rn->rn_avl, fd, rn->rn_name); check_slices(rn->rn_avl, fd, rn->rn_name);
} }
#else /* !sun */ #else /* !illumos */
if (statbuf.st_size < SPA_MINDEVSIZE) { if (statbuf.st_size < SPA_MINDEVSIZE) {
(void) close(fd); (void) close(fd);
return; return;
} }
#endif /* sun */ #endif /* illumos */
if ((zpool_read_label(fd, &config)) != 0) { if ((zpool_read_label(fd, &config)) != 0) {
(void) close(fd); (void) close(fd);

View File

@ -139,7 +139,7 @@ is_shared(libzfs_handle_t *hdl, const char *mountpoint, zfs_share_proto_t proto)
*tab = '\0'; *tab = '\0';
if (strcmp(buf, mountpoint) == 0) { if (strcmp(buf, mountpoint) == 0) {
#ifdef sun #ifdef illumos
/* /*
* the protocol field is the third field * the protocol field is the third field
* skip over second 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); return (SHARED_NOT_SHARED);
} }
#ifdef sun #ifdef illumos
/* /*
* Returns true if the specified directory is empty. If we can't open the * 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 * 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 * 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 * 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. * initialized in _zfs_init_libshare() are actually present.
*/ */
#ifdef sun #ifdef illumos
static sa_handle_t (*_sa_init)(int); static sa_handle_t (*_sa_init)(int);
static void (*_sa_fini)(sa_handle_t); static void (*_sa_fini)(sa_handle_t);
static sa_share_t (*_sa_find_share)(sa_handle_t, char *); 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 static void
_zfs_init_libshare(void) _zfs_init_libshare(void)
{ {
#ifdef sun #ifdef illumos
void *libshare; void *libshare;
char path[MAXPATHLEN]; char path[MAXPATHLEN];
char isa[MAXISALEN]; char isa[MAXISALEN];
@ -605,7 +605,7 @@ zfs_init_libshare(libzfs_handle_t *zhandle, int service)
{ {
int ret = SA_OK; int ret = SA_OK;
#ifdef sun #ifdef illumos
if (_sa_init == NULL) if (_sa_init == NULL)
ret = SA_CONFIG_ERR; ret = SA_CONFIG_ERR;
@ -646,7 +646,7 @@ void
zfs_uninit_libshare(libzfs_handle_t *zhandle) zfs_uninit_libshare(libzfs_handle_t *zhandle)
{ {
if (zhandle != NULL && zhandle->libzfs_sharehdl != NULL) { if (zhandle != NULL && zhandle->libzfs_sharehdl != NULL) {
#ifdef sun #ifdef illumos
if (_sa_fini != NULL) if (_sa_fini != NULL)
_sa_fini(zhandle->libzfs_sharehdl); _sa_fini(zhandle->libzfs_sharehdl);
#endif #endif
@ -663,7 +663,7 @@ zfs_uninit_libshare(libzfs_handle_t *zhandle)
int int
zfs_parse_options(char *options, zfs_share_proto_t proto) zfs_parse_options(char *options, zfs_share_proto_t proto)
{ {
#ifdef sun #ifdef illumos
if (_sa_parse_legacy_options != NULL) { if (_sa_parse_legacy_options != NULL) {
return (_sa_parse_legacy_options(NULL, options, return (_sa_parse_legacy_options(NULL, options,
proto_table[proto].p_name)); proto_table[proto].p_name));
@ -674,7 +674,7 @@ zfs_parse_options(char *options, zfs_share_proto_t proto)
#endif #endif
} }
#ifdef sun #ifdef illumos
/* /*
* zfs_sa_find_share(handle, path) * 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_disable_share(share, proto));
return (SA_CONFIG_ERR); return (SA_CONFIG_ERR);
} }
#endif /* sun */ #endif /* illumos */
/* /*
* Share the given filesystem according to the options in the specified * 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)) if (zfs_prop_get_int(zhp, ZFS_PROP_ZONED))
continue; continue;
#ifdef sun #ifdef illumos
share = zfs_sa_find_share(hdl->libzfs_sharehdl, mountpoint); share = zfs_sa_find_share(hdl->libzfs_sharehdl, mountpoint);
if (share == NULL) { if (share == NULL) {
/* /*
@ -856,7 +856,7 @@ static int
unshare_one(libzfs_handle_t *hdl, const char *name, const char *mountpoint, unshare_one(libzfs_handle_t *hdl, const char *name, const char *mountpoint,
zfs_share_proto_t proto) zfs_share_proto_t proto)
{ {
#ifdef sun #ifdef illumos
sa_share_t share; sa_share_t share;
int err; int err;
char *mntpt; char *mntpt;

View File

@ -409,7 +409,7 @@ bootfs_name_valid(const char *pool, char *bootfs)
static boolean_t static boolean_t
pool_uses_efi(nvlist_t *config) pool_uses_efi(nvlist_t *config)
{ {
#ifdef sun #ifdef illumos
nvlist_t **child; nvlist_t **child;
uint_t c, children; uint_t c, children;
@ -421,7 +421,7 @@ pool_uses_efi(nvlist_t *config)
if (pool_uses_efi(child[c])) if (pool_uses_efi(child[c]))
return (B_TRUE); return (B_TRUE);
} }
#endif /* sun */ #endif /* illumos */
return (B_FALSE); 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), verify(nvlist_lookup_nvlist(zpool_get_config(zhp, NULL),
ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0); ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0);
#ifdef sun #ifdef illumos
/* /*
* bootfs property cannot be set on a disk which has * bootfs property cannot be set on a disk which has
* been EFI labeled. * been EFI labeled.
@ -588,7 +588,7 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname,
zpool_close(zhp); zpool_close(zhp);
goto error; goto error;
} }
#endif /* sun */ #endif /* illumos */
zpool_close(zhp); zpool_close(zhp);
break; break;
@ -2384,7 +2384,7 @@ zpool_get_physpath(zpool_handle_t *zhp, char *physpath, size_t phypath_size)
static int static int
zpool_relabel_disk(libzfs_handle_t *hdl, const char *name) zpool_relabel_disk(libzfs_handle_t *hdl, const char *name)
{ {
#ifdef sun #ifdef illumos
char path[MAXPATHLEN]; char path[MAXPATHLEN];
char errbuf[1024]; char errbuf[1024];
int fd, error; 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); "relabel '%s': unable to read disk capacity"), name);
return (zfs_error(hdl, EZFS_NOCAP, errbuf)); return (zfs_error(hdl, EZFS_NOCAP, errbuf));
} }
#endif /* sun */ #endif /* illumos */
return (0); return (0);
} }
@ -3470,7 +3470,7 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv,
devid_str_free(newdevid); devid_str_free(newdevid);
} }
#ifdef sun #ifdef illumos
if (strncmp(path, "/dev/dsk/", 9) == 0) if (strncmp(path, "/dev/dsk/", 9) == 0)
path += 9; path += 9;
@ -3495,10 +3495,10 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv,
} }
return (tmp); return (tmp);
} }
#else /* !sun */ #else /* !illumos */
if (strncmp(path, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) if (strncmp(path, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
path += sizeof(_PATH_DEV) - 1; path += sizeof(_PATH_DEV) - 1;
#endif /* !sun */ #endif /* illumos */
} else { } else {
verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, &path) == 0); 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); free(mntpnt);
} }
#ifdef sun #ifdef illumos
/* /*
* Read the EFI label from the config, if a label does not exist then * 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 * 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); return (MAXOFFSET_T);
} }
#endif /* sun */ #endif /* illumos */
/* /*
* Label an individual disk. The name provided is the short name, * Label an individual disk. The name provided is the short name,
@ -3962,7 +3962,7 @@ find_start_block(nvlist_t *config)
int int
zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name) zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name)
{ {
#ifdef sun #ifdef illumos
char path[MAXPATHLEN]; char path[MAXPATHLEN];
struct dk_gpt *vtoc; struct dk_gpt *vtoc;
int fd; int fd;
@ -4067,7 +4067,7 @@ zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name)
(void) close(fd); (void) close(fd);
efi_free(vtoc); efi_free(vtoc);
#endif /* sun */ #endif /* illumos */
return (0); return (0);
} }

View File

@ -949,7 +949,7 @@ dump_ioctl(zfs_handle_t *zhp, const char *fromsnap, uint64_t fromsnap_obj,
case EIO: case EIO:
case ENOLINK: case ENOLINK:
case ENOSPC: case ENOSPC:
#ifdef sun #ifdef illumos
case ENOSTR: case ENOSTR:
#endif #endif
case ENXIO: case ENXIO:

View File

@ -687,7 +687,7 @@ libzfs_fini(libzfs_handle_t *hdl)
(void) fclose(hdl->libzfs_sharetab); (void) fclose(hdl->libzfs_sharetab);
zfs_uninit_libshare(hdl); zfs_uninit_libshare(hdl);
zpool_free_handles(hdl); zpool_free_handles(hdl);
#ifdef sun #ifdef illumos
libzfs_fru_clear(hdl, B_TRUE); libzfs_fru_clear(hdl, B_TRUE);
#endif #endif
namespace_clear(hdl); namespace_clear(hdl);
@ -739,7 +739,7 @@ zfs_path_to_zhandle(libzfs_handle_t *hdl, char *path, zfs_type_t argtype)
return (NULL); return (NULL);
} }
#ifdef sun #ifdef illumos
rewind(hdl->libzfs_mnttab); rewind(hdl->libzfs_mnttab);
while ((ret = getextmntent(hdl->libzfs_mnttab, &entry, 0)) == 0) { while ((ret = getextmntent(hdl->libzfs_mnttab, &entry, 0)) == 0) {
if (makedevice(entry.mnt_major, entry.mnt_minor) == 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)); strerror(errno));
} }
} }
#endif /* sun */ #endif /* illumos */
if (ret != 0) { if (ret != 0) {
return (NULL); return (NULL);
} }

View File

@ -38,7 +38,7 @@
*/ */
#include <pthread.h> #include <pthread.h>
#if defined(sun) #ifdef illumos
#include <synch.h> #include <synch.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
@ -49,7 +49,7 @@ void
barrier_init(barrier_t *bar, int nthreads) barrier_init(barrier_t *bar, int nthreads)
{ {
pthread_mutex_init(&bar->bar_lock, NULL); pthread_mutex_init(&bar->bar_lock, NULL);
#if defined(sun) #ifdef illumos
sema_init(&bar->bar_sem, 0, USYNC_THREAD, NULL); sema_init(&bar->bar_sem, 0, USYNC_THREAD, NULL);
#else #else
sem_init(&bar->bar_sem, 0, 0); sem_init(&bar->bar_sem, 0, 0);
@ -66,7 +66,7 @@ barrier_wait(barrier_t *bar)
if (++bar->bar_numin < bar->bar_nthr) { if (++bar->bar_numin < bar->bar_nthr) {
pthread_mutex_unlock(&bar->bar_lock); pthread_mutex_unlock(&bar->bar_lock);
#if defined(sun) #ifdef illumos
sema_wait(&bar->bar_sem); sema_wait(&bar->bar_sem);
#else #else
sem_wait(&bar->bar_sem); sem_wait(&bar->bar_sem);
@ -80,7 +80,7 @@ barrier_wait(barrier_t *bar)
/* reset for next use */ /* reset for next use */
bar->bar_numin = 0; bar->bar_numin = 0;
for (i = 1; i < bar->bar_nthr; i++) for (i = 1; i < bar->bar_nthr; i++)
#if defined(sun) #ifdef illumos
sema_post(&bar->bar_sem); sema_post(&bar->bar_sem);
#else #else
sem_post(&bar->bar_sem); sem_post(&bar->bar_sem);

View File

@ -33,7 +33,7 @@
* APIs for the barrier synchronization primitive. * APIs for the barrier synchronization primitive.
*/ */
#if defined(sun) #ifdef illumos
#include <synch.h> #include <synch.h>
#else #else
#include <semaphore.h> #include <semaphore.h>

View File

@ -155,7 +155,7 @@ main(int argc, char **argv)
int keep_stabs = 0; int keep_stabs = 0;
int c; int c;
#if defined(sun) #ifdef illumos
sighold(SIGINT); sighold(SIGINT);
sighold(SIGQUIT); sighold(SIGQUIT);
sighold(SIGTERM); sighold(SIGTERM);
@ -221,7 +221,7 @@ main(int argc, char **argv)
*/ */
set_terminate_cleanup(terminate_cleanup); set_terminate_cleanup(terminate_cleanup);
#if defined(sun) #ifdef illumos
sigset(SIGINT, handle_sig); sigset(SIGINT, handle_sig);
sigset(SIGQUIT, handle_sig); sigset(SIGQUIT, handle_sig);
sigset(SIGTERM, handle_sig); sigset(SIGTERM, handle_sig);

View File

@ -176,20 +176,20 @@
#include <unistd.h> #include <unistd.h>
#include <pthread.h> #include <pthread.h>
#include <assert.h> #include <assert.h>
#if defined(sun) #ifdef illumos
#include <synch.h> #include <synch.h>
#endif #endif
#include <signal.h> #include <signal.h>
#include <libgen.h> #include <libgen.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#if defined(sun) #ifdef illumos
#include <alloca.h> #include <alloca.h>
#endif #endif
#include <sys/param.h> #include <sys/param.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/mman.h> #include <sys/mman.h>
#if defined(sun) #ifdef illumos
#include <sys/sysconf.h> #include <sys/sysconf.h>
#endif #endif
@ -232,7 +232,7 @@ usage(void)
progname, progname); progname, progname);
} }
#if defined(sun) #ifdef illumos
static void static void
bigheap(void) bigheap(void)
{ {
@ -280,7 +280,7 @@ bigheap(void)
(void) memcntl(NULL, 0, MC_HAT_ADVISE, (caddr_t)&mha, 0, 0); (void) memcntl(NULL, 0, MC_HAT_ADVISE, (caddr_t)&mha, 0, 0);
} }
#endif #endif /* illumos */
static void static void
finalize_phase_one(workqueue_t *wq) finalize_phase_one(workqueue_t *wq)
@ -707,7 +707,7 @@ start_threads(workqueue_t *wq)
(void *(*)(void *))worker_thread, wq); (void *(*)(void *))worker_thread, wq);
} }
#if defined(sun) #ifdef illumos
sigset(SIGINT, handle_sig); sigset(SIGINT, handle_sig);
sigset(SIGQUIT, handle_sig); sigset(SIGQUIT, handle_sig);
sigset(SIGTERM, handle_sig); sigset(SIGTERM, handle_sig);

View File

@ -1390,7 +1390,7 @@ die_base_type2enc(dwarf_t *dw, Dwarf_Off off, Dwarf_Signed enc, size_t sz)
mult = 2; mult = 2;
col = 1; col = 1;
} else if (enc == DW_ATE_imaginary_float } else if (enc == DW_ATE_imaginary_float
#if defined(sun) #ifdef illumos
|| enc == DW_ATE_SUN_imaginary_float || enc == DW_ATE_SUN_imaginary_float
#endif #endif
) )
@ -1441,7 +1441,7 @@ die_base_from_dwarf(dwarf_t *dw, Dwarf_Die base, Dwarf_Off off, size_t sz)
case DW_ATE_float: case DW_ATE_float:
case DW_ATE_complex_float: case DW_ATE_complex_float:
case DW_ATE_imaginary_float: case DW_ATE_imaginary_float:
#if defined(sun) #ifdef illumos
case DW_ATE_SUN_imaginary_float: case DW_ATE_SUN_imaginary_float:
case DW_ATE_SUN_interval_float: case DW_ATE_SUN_interval_float:
#endif #endif

View File

@ -576,7 +576,7 @@ write_file(Elf *src, const char *srcname, Elf *dst, const char *dstname,
shdr.sh_name); shdr.sh_name);
} }
#if !defined(sun) #ifndef illumos
if (gelf_update_shdr(dscn, &shdr) == 0) if (gelf_update_shdr(dscn, &shdr) == 0)
elfterminate(dstname, "Cannot update sect %s", sname); elfterminate(dstname, "Cannot update sect %s", sname);
#endif #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); elfterminate(srcname, "Cannot get sect %s data", sname);
if ((ddata = elf_newdata(dscn)) == NULL) if ((ddata = elf_newdata(dscn)) == NULL)
elfterminate(dstname, "Can't make sect %s data", sname); elfterminate(dstname, "Can't make sect %s data", sname);
#if defined(sun) #ifdef illumos
bcopy(sdata, ddata, sizeof (Elf_Data)); bcopy(sdata, ddata, sizeof (Elf_Data));
#else #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) { if (ddata->d_buf == NULL && sdata->d_buf != NULL) {
ddata->d_buf = xmalloc(shdr.sh_size); ddata->d_buf = xmalloc(shdr.sh_size);
bcopy(sdata->d_buf, ddata->d_buf, shdr.sh_size); bcopy(sdata->d_buf, ddata->d_buf, shdr.sh_size);

View File

@ -173,7 +173,7 @@ tdesc_namecmp(void *arg1, void *arg2)
return (!streq(tdp1->t_name, tdp2->t_name)); return (!streq(tdp1->t_name, tdp2->t_name));
} }
#if defined(sun) #ifdef illumos
/*ARGSUSED1*/ /*ARGSUSED1*/
static int static int
tdesc_print(void *data, void *private __unused) tdesc_print(void *data, void *private __unused)

View File

@ -171,7 +171,7 @@ aborterr(const char *format, ...)
whine("ERROR", format, ap); whine("ERROR", format, ap);
va_end(ap); va_end(ap);
#if defined(sun) #ifdef illumos
abort(); abort();
#else #else
exit(0); exit(0);

View File

@ -44,7 +44,7 @@ extern "C" {
* safe in probe context. * 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 isalnum(ch) (isalpha(ch) || isdigit(ch))
#define isalpha(ch) (isupper(ch) || islower(ch)) #define isalpha(ch) (isupper(ch) || islower(ch))

File diff suppressed because it is too large Load Diff

View File

@ -38,13 +38,13 @@
#include <sys/modctl.h> #include <sys/modctl.h>
#include <sys/conf.h> #include <sys/conf.h>
#include <sys/systm.h> #include <sys/systm.h>
#if defined(sun) #ifdef illumos
#include <sys/ddi.h> #include <sys/ddi.h>
#endif #endif
#include <sys/sunddi.h> #include <sys/sunddi.h>
#include <sys/cpuvar.h> #include <sys/cpuvar.h>
#include <sys/kmem.h> #include <sys/kmem.h>
#if defined(sun) #ifdef illumos
#include <sys/strsubr.h> #include <sys/strsubr.h>
#endif #endif
#include <sys/fasttrap.h> #include <sys/fasttrap.h>
@ -55,12 +55,12 @@
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include <sys/proc.h> #include <sys/proc.h>
#include <sys/policy.h> #include <sys/policy.h>
#if defined(sun) #ifdef illumos
#include <util/qsort.h> #include <util/qsort.h>
#endif #endif
#include <sys/mutex.h> #include <sys/mutex.h>
#include <sys/kernel.h> #include <sys/kernel.h>
#if !defined(sun) #ifndef illumos
#include <sys/dtrace_bsd.h> #include <sys/dtrace_bsd.h>
#include <sys/eventhandler.h> #include <sys/eventhandler.h>
#include <sys/u8_textprep.h> #include <sys/u8_textprep.h>
@ -212,7 +212,7 @@ static void fasttrap_provider_free(fasttrap_provider_t *);
static fasttrap_proc_t *fasttrap_proc_lookup(pid_t); static fasttrap_proc_t *fasttrap_proc_lookup(pid_t);
static void fasttrap_proc_release(fasttrap_proc_t *); static void fasttrap_proc_release(fasttrap_proc_t *);
#if !defined(sun) #ifndef illumos
static void fasttrap_thread_dtor(void *, struct thread *); static void fasttrap_thread_dtor(void *, struct thread *);
#endif #endif
@ -221,7 +221,7 @@ static void fasttrap_thread_dtor(void *, struct thread *);
#define FASTTRAP_PROCS_INDEX(pid) ((pid) & fasttrap_procs.fth_mask) #define FASTTRAP_PROCS_INDEX(pid) ((pid) & fasttrap_procs.fth_mask)
#if !defined(sun) #ifndef illumos
static kmutex_t fasttrap_cpuc_pid_lock[MAXCPU]; static kmutex_t fasttrap_cpuc_pid_lock[MAXCPU];
static eventhandler_tag fasttrap_thread_dtor_tag; static eventhandler_tag fasttrap_thread_dtor_tag;
#endif #endif
@ -274,7 +274,7 @@ fasttrap_hash_str(const char *p)
void void
fasttrap_sigtrap(proc_t *p, kthread_t *t, uintptr_t pc) fasttrap_sigtrap(proc_t *p, kthread_t *t, uintptr_t pc)
{ {
#if defined(sun) #ifdef illumos
sigqueue_t *sqp = kmem_zalloc(sizeof (sigqueue_t), KM_SLEEP); sigqueue_t *sqp = kmem_zalloc(sizeof (sigqueue_t), KM_SLEEP);
sqp->sq_info.si_signo = SIGTRAP; sqp->sq_info.si_signo = SIGTRAP;
@ -300,7 +300,7 @@ fasttrap_sigtrap(proc_t *p, kthread_t *t, uintptr_t pc)
#endif #endif
} }
#if !defined(sun) #ifndef illumos
/* /*
* Obtain a chunk of scratch space in the address space of the target process. * Obtain a chunk of scratch space in the address space of the target process.
*/ */
@ -572,20 +572,20 @@ fasttrap_pid_cleanup(void)
static void static void
fasttrap_fork(proc_t *p, proc_t *cp) fasttrap_fork(proc_t *p, proc_t *cp)
{ {
#if !defined(sun) #ifndef illumos
fasttrap_scrblock_t *scrblk; fasttrap_scrblock_t *scrblk;
fasttrap_proc_t *fprc = NULL; fasttrap_proc_t *fprc = NULL;
#endif #endif
pid_t ppid = p->p_pid; pid_t ppid = p->p_pid;
int i; int i;
#if defined(sun) #ifdef illumos
ASSERT(curproc == p); ASSERT(curproc == p);
ASSERT(p->p_proc_flag & P_PR_LOCK); ASSERT(p->p_proc_flag & P_PR_LOCK);
#else #else
PROC_LOCK_ASSERT(p, MA_OWNED); PROC_LOCK_ASSERT(p, MA_OWNED);
#endif #endif
#if defined(sun) #ifdef illumos
ASSERT(p->p_dtrace_count > 0); ASSERT(p->p_dtrace_count > 0);
#else #else
if (p->p_dtrace_helpers) { if (p->p_dtrace_helpers) {
@ -624,7 +624,7 @@ fasttrap_fork(proc_t *p, proc_t *cp)
* We don't have to worry about the child process disappearing * We don't have to worry about the child process disappearing
* because we're in fork(). * because we're in fork().
*/ */
#if defined(sun) #ifdef illumos
mtx_lock_spin(&cp->p_slock); mtx_lock_spin(&cp->p_slock);
sprlock_proc(cp); sprlock_proc(cp);
mtx_unlock_spin(&cp->p_slock); mtx_unlock_spin(&cp->p_slock);
@ -661,14 +661,14 @@ fasttrap_fork(proc_t *p, proc_t *cp)
* mid-fork. * mid-fork.
*/ */
ASSERT(tp->ftt_proc->ftpc_acount != 0); ASSERT(tp->ftt_proc->ftpc_acount != 0);
#if !defined(sun) #ifndef illumos
fprc = tp->ftt_proc; fprc = tp->ftt_proc;
#endif #endif
} }
} }
mutex_exit(&bucket->ftb_mtx); mutex_exit(&bucket->ftb_mtx);
#if !defined(sun) #ifndef illumos
/* /*
* Unmap any scratch space inherited from the parent's address * Unmap any scratch space inherited from the parent's address
* space. * space.
@ -685,7 +685,7 @@ fasttrap_fork(proc_t *p, proc_t *cp)
#endif #endif
} }
#if defined(sun) #ifdef illumos
mutex_enter(&cp->p_lock); mutex_enter(&cp->p_lock);
sprunlock(cp); sprunlock(cp);
#else #else
@ -703,11 +703,11 @@ fasttrap_fork(proc_t *p, proc_t *cp)
static void static void
fasttrap_exec_exit(proc_t *p) fasttrap_exec_exit(proc_t *p)
{ {
#if !defined(sun) #ifndef illumos
struct thread *td; struct thread *td;
#endif #endif
#if defined(sun) #ifdef illumos
ASSERT(p == curproc); ASSERT(p == curproc);
#else #else
PROC_LOCK_ASSERT(p, MA_OWNED); PROC_LOCK_ASSERT(p, MA_OWNED);
@ -727,7 +727,7 @@ fasttrap_exec_exit(proc_t *p)
* static probes are handled by the meta-provider remove entry point. * static probes are handled by the meta-provider remove entry point.
*/ */
fasttrap_provider_retire(p->p_pid, FASTTRAP_PID_NAME, 0); fasttrap_provider_retire(p->p_pid, FASTTRAP_PID_NAME, 0);
#if !defined(sun) #ifndef illumos
if (p->p_dtrace_helpers) if (p->p_dtrace_helpers)
dtrace_helpers_destroy(p); dtrace_helpers_destroy(p);
PROC_LOCK(p); PROC_LOCK(p);
@ -762,7 +762,7 @@ fasttrap_tracepoint_enable(proc_t *p, fasttrap_probe_t *probe, uint_t index)
ASSERT(probe->ftp_tps[index].fit_tp->ftt_pid == pid); ASSERT(probe->ftp_tps[index].fit_tp->ftt_pid == pid);
#if defined(sun) #ifdef illumos
ASSERT(!(p->p_flag & SVFORK)); ASSERT(!(p->p_flag & SVFORK));
#endif #endif
@ -870,7 +870,7 @@ again:
* Increment the count of the number of tracepoints active in * Increment the count of the number of tracepoints active in
* the victim process. * the victim process.
*/ */
#if defined(sun) #ifdef illumos
ASSERT(p->p_proc_flag & P_PR_LOCK); ASSERT(p->p_proc_flag & P_PR_LOCK);
#endif #endif
p->p_dtrace_count++; p->p_dtrace_count++;
@ -1062,7 +1062,7 @@ fasttrap_tracepoint_disable(proc_t *p, fasttrap_probe_t *probe, uint_t index)
* Decrement the count of the number of tracepoints active * Decrement the count of the number of tracepoints active
* in the victim process. * in the victim process.
*/ */
#if defined(sun) #ifdef illumos
ASSERT(p->p_proc_flag & P_PR_LOCK); ASSERT(p->p_proc_flag & P_PR_LOCK);
#endif #endif
p->p_dtrace_count--; p->p_dtrace_count--;
@ -1115,7 +1115,7 @@ fasttrap_enable_callbacks(void)
static void static void
fasttrap_disable_callbacks(void) fasttrap_disable_callbacks(void)
{ {
#if defined(sun) #ifdef illumos
ASSERT(MUTEX_HELD(&cpu_lock)); ASSERT(MUTEX_HELD(&cpu_lock));
#endif #endif
@ -1124,7 +1124,7 @@ fasttrap_disable_callbacks(void)
ASSERT(fasttrap_pid_count > 0); ASSERT(fasttrap_pid_count > 0);
fasttrap_pid_count--; fasttrap_pid_count--;
if (fasttrap_pid_count == 0) { if (fasttrap_pid_count == 0) {
#if defined(sun) #ifdef illumos
cpu_t *cur, *cpu = CPU; cpu_t *cur, *cpu = CPU;
for (cur = cpu->cpu_next_onln; cur != cpu; for (cur = cpu->cpu_next_onln; cur != cpu;
@ -1134,7 +1134,7 @@ fasttrap_disable_callbacks(void)
#endif #endif
dtrace_pid_probe_ptr = NULL; dtrace_pid_probe_ptr = NULL;
dtrace_return_probe_ptr = NULL; dtrace_return_probe_ptr = NULL;
#if defined(sun) #ifdef illumos
for (cur = cpu->cpu_next_onln; cur != cpu; for (cur = cpu->cpu_next_onln; cur != cpu;
cur = cur->cpu_next_onln) { cur = cur->cpu_next_onln) {
rw_exit(&cur->cpu_ft_lock); rw_exit(&cur->cpu_ft_lock);
@ -1155,7 +1155,7 @@ fasttrap_pid_enable(void *arg, dtrace_id_t id, void *parg)
ASSERT(probe != NULL); ASSERT(probe != NULL);
ASSERT(!probe->ftp_enabled); ASSERT(!probe->ftp_enabled);
ASSERT(id == probe->ftp_id); ASSERT(id == probe->ftp_id);
#if defined(sun) #ifdef illumos
ASSERT(MUTEX_HELD(&cpu_lock)); ASSERT(MUTEX_HELD(&cpu_lock));
#endif #endif
@ -1182,7 +1182,7 @@ fasttrap_pid_enable(void *arg, dtrace_id_t id, void *parg)
* a fork in which the traced process is being born and we're copying * a fork in which the traced process is being born and we're copying
* USDT probes. Otherwise, the process is gone so bail. * USDT probes. Otherwise, the process is gone so bail.
*/ */
#if defined(sun) #ifdef illumos
if ((p = sprlock(probe->ftp_pid)) == NULL) { if ((p = sprlock(probe->ftp_pid)) == NULL) {
if ((curproc->p_flag & SFORKING) == 0) if ((curproc->p_flag & SFORKING) == 0)
return; return;
@ -1250,7 +1250,7 @@ fasttrap_pid_enable(void *arg, dtrace_id_t id, void *parg)
i--; i--;
} }
#if defined(sun) #ifdef illumos
mutex_enter(&p->p_lock); mutex_enter(&p->p_lock);
sprunlock(p); sprunlock(p);
#else #else
@ -1265,7 +1265,7 @@ fasttrap_pid_enable(void *arg, dtrace_id_t id, void *parg)
return; return;
} }
} }
#if defined(sun) #ifdef illumos
mutex_enter(&p->p_lock); mutex_enter(&p->p_lock);
sprunlock(p); sprunlock(p);
#else #else
@ -1344,7 +1344,7 @@ fasttrap_pid_disable(void *arg, dtrace_id_t id, void *parg)
probe->ftp_enabled = 0; probe->ftp_enabled = 0;
#if defined(sun) #ifdef illumos
ASSERT(MUTEX_HELD(&cpu_lock)); ASSERT(MUTEX_HELD(&cpu_lock));
#endif #endif
fasttrap_disable_callbacks(); fasttrap_disable_callbacks();
@ -1485,7 +1485,7 @@ fasttrap_proc_lookup(pid_t pid)
new_fprc->ftpc_pid = pid; new_fprc->ftpc_pid = pid;
new_fprc->ftpc_rcount = 1; new_fprc->ftpc_rcount = 1;
new_fprc->ftpc_acount = 1; new_fprc->ftpc_acount = 1;
#if !defined(sun) #ifndef illumos
mutex_init(&new_fprc->ftpc_mtx, "fasttrap proc mtx", MUTEX_DEFAULT, mutex_init(&new_fprc->ftpc_mtx, "fasttrap proc mtx", MUTEX_DEFAULT,
NULL); NULL);
#endif #endif
@ -1525,7 +1525,7 @@ fasttrap_proc_release(fasttrap_proc_t *proc)
fasttrap_bucket_t *bucket; fasttrap_bucket_t *bucket;
fasttrap_proc_t *fprc, **fprcp; fasttrap_proc_t *fprc, **fprcp;
pid_t pid = proc->ftpc_pid; pid_t pid = proc->ftpc_pid;
#if !defined(sun) #ifndef illumos
fasttrap_scrblock_t *scrblk, *scrblktmp; fasttrap_scrblock_t *scrblk, *scrblktmp;
fasttrap_scrspace_t *scrspc, *scrspctmp; fasttrap_scrspace_t *scrspc, *scrspctmp;
struct proc *p; struct proc *p;
@ -1542,7 +1542,7 @@ fasttrap_proc_release(fasttrap_proc_t *proc)
return; return;
} }
#if !defined(sun) #ifndef illumos
/* /*
* Free all structures used to manage per-thread scratch space. * Free all structures used to manage per-thread scratch space.
*/ */
@ -1664,7 +1664,7 @@ fasttrap_provider_lookup(pid_t pid, const char *name,
new_fp = kmem_zalloc(sizeof (fasttrap_provider_t), KM_SLEEP); new_fp = kmem_zalloc(sizeof (fasttrap_provider_t), KM_SLEEP);
new_fp->ftp_pid = pid; new_fp->ftp_pid = pid;
new_fp->ftp_proc = fasttrap_proc_lookup(pid); new_fp->ftp_proc = fasttrap_proc_lookup(pid);
#if !defined(sun) #ifndef illumos
mutex_init(&new_fp->ftp_mtx, "provider mtx", MUTEX_DEFAULT, NULL); mutex_init(&new_fp->ftp_mtx, "provider mtx", MUTEX_DEFAULT, NULL);
mutex_init(&new_fp->ftp_cmtx, "lock on creating", MUTEX_DEFAULT, NULL); mutex_init(&new_fp->ftp_cmtx, "lock on creating", MUTEX_DEFAULT, NULL);
#endif #endif
@ -1745,7 +1745,7 @@ fasttrap_provider_free(fasttrap_provider_t *provider)
fasttrap_proc_release(provider->ftp_proc); fasttrap_proc_release(provider->ftp_proc);
#if !defined(sun) #ifndef illumos
mutex_destroy(&provider->ftp_mtx); mutex_destroy(&provider->ftp_mtx);
mutex_destroy(&provider->ftp_cmtx); mutex_destroy(&provider->ftp_cmtx);
#endif #endif
@ -1763,7 +1763,7 @@ fasttrap_provider_free(fasttrap_provider_t *provider)
} }
p->p_dtrace_probes--; p->p_dtrace_probes--;
#if !defined(sun) #ifndef illumos
PROC_UNLOCK(p); PROC_UNLOCK(p);
#endif #endif
} }
@ -2304,7 +2304,7 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag,
proc_t *p; proc_t *p;
pid_t pid = probe->ftps_pid; pid_t pid = probe->ftps_pid;
#if defined(sun) #ifdef illumos
mutex_enter(&pidlock); mutex_enter(&pidlock);
#endif #endif
/* /*
@ -2317,12 +2317,12 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag,
fill_kinfo_proc(p, &kp); fill_kinfo_proc(p, &kp);
sx_sunlock(&proctree_lock); sx_sunlock(&proctree_lock);
if (p == NULL || kp.ki_stat == SIDL) { if (p == NULL || kp.ki_stat == SIDL) {
#if defined(sun) #ifdef illumos
mutex_exit(&pidlock); mutex_exit(&pidlock);
#endif #endif
return (ESRCH); return (ESRCH);
} }
#if defined(sun) #ifdef illumos
mutex_enter(&p->p_lock); mutex_enter(&p->p_lock);
mutex_exit(&pidlock); mutex_exit(&pidlock);
#else #else
@ -2332,7 +2332,7 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag,
#ifdef notyet #ifdef notyet
if ((ret = priv_proc_cred_perm(cr, p, NULL, if ((ret = priv_proc_cred_perm(cr, p, NULL,
VREAD | VWRITE)) != 0) { VREAD | VWRITE)) != 0) {
#if defined(sun) #ifdef illumos
mutex_exit(&p->p_lock); mutex_exit(&p->p_lock);
#else #else
PROC_UNLOCK(p); PROC_UNLOCK(p);
@ -2340,7 +2340,7 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag,
return (ret); return (ret);
} }
#endif /* notyet */ #endif /* notyet */
#if defined(sun) #ifdef illumos
mutex_exit(&p->p_lock); mutex_exit(&p->p_lock);
#else #else
PROC_UNLOCK(p); PROC_UNLOCK(p);
@ -2358,11 +2358,11 @@ err:
fasttrap_instr_query_t instr; fasttrap_instr_query_t instr;
fasttrap_tracepoint_t *tp; fasttrap_tracepoint_t *tp;
uint_t index; uint_t index;
#if defined(sun) #ifdef illumos
int ret; int ret;
#endif #endif
#if defined(sun) #ifdef illumos
if (copyin((void *)arg, &instr, sizeof (instr)) != 0) if (copyin((void *)arg, &instr, sizeof (instr)) != 0)
return (EFAULT); return (EFAULT);
#endif #endif
@ -2372,7 +2372,7 @@ err:
proc_t *p; proc_t *p;
pid_t pid = instr.ftiq_pid; pid_t pid = instr.ftiq_pid;
#if defined(sun) #ifdef illumos
mutex_enter(&pidlock); mutex_enter(&pidlock);
#endif #endif
/* /*
@ -2385,12 +2385,12 @@ err:
fill_kinfo_proc(p, &kp); fill_kinfo_proc(p, &kp);
sx_sunlock(&proctree_lock); sx_sunlock(&proctree_lock);
if (p == NULL || kp.ki_stat == SIDL) { if (p == NULL || kp.ki_stat == SIDL) {
#if defined(sun) #ifdef illumos
mutex_exit(&pidlock); mutex_exit(&pidlock);
#endif #endif
return (ESRCH); return (ESRCH);
} }
#if defined(sun) #ifdef illumos
mutex_enter(&p->p_lock); mutex_enter(&p->p_lock);
mutex_exit(&pidlock); mutex_exit(&pidlock);
#else #else
@ -2400,7 +2400,7 @@ err:
#ifdef notyet #ifdef notyet
if ((ret = priv_proc_cred_perm(cr, p, NULL, if ((ret = priv_proc_cred_perm(cr, p, NULL,
VREAD)) != 0) { VREAD)) != 0) {
#if defined(sun) #ifdef illumos
mutex_exit(&p->p_lock); mutex_exit(&p->p_lock);
#else #else
PROC_UNLOCK(p); PROC_UNLOCK(p);
@ -2409,7 +2409,7 @@ err:
} }
#endif /* notyet */ #endif /* notyet */
#if defined(sun) #ifdef illumos
mutex_exit(&p->p_lock); mutex_exit(&p->p_lock);
#else #else
PROC_UNLOCK(p); PROC_UNLOCK(p);
@ -2462,7 +2462,7 @@ fasttrap_load(void)
mutex_init(&fasttrap_count_mtx, "fasttrap count mtx", MUTEX_DEFAULT, mutex_init(&fasttrap_count_mtx, "fasttrap count mtx", MUTEX_DEFAULT,
NULL); NULL);
#if defined(sun) #ifdef illumos
fasttrap_max = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS, fasttrap_max = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS,
"fasttrap-max-probes", FASTTRAP_MAX_DEFAULT); "fasttrap-max-probes", FASTTRAP_MAX_DEFAULT);
#else #else
@ -2473,7 +2473,7 @@ fasttrap_load(void)
/* /*
* Conjure up the tracepoints hashtable... * Conjure up the tracepoints hashtable...
*/ */
#if defined(sun) #ifdef illumos
nent = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS, nent = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS,
"fasttrap-hash-size", FASTTRAP_TPOINTS_DEFAULT_SIZE); "fasttrap-hash-size", FASTTRAP_TPOINTS_DEFAULT_SIZE);
#else #else
@ -2491,7 +2491,7 @@ fasttrap_load(void)
fasttrap_tpoints.fth_mask = fasttrap_tpoints.fth_nent - 1; fasttrap_tpoints.fth_mask = fasttrap_tpoints.fth_nent - 1;
fasttrap_tpoints.fth_table = kmem_zalloc(fasttrap_tpoints.fth_nent * fasttrap_tpoints.fth_table = kmem_zalloc(fasttrap_tpoints.fth_nent *
sizeof (fasttrap_bucket_t), KM_SLEEP); sizeof (fasttrap_bucket_t), KM_SLEEP);
#if !defined(sun) #ifndef illumos
for (i = 0; i < fasttrap_tpoints.fth_nent; i++) for (i = 0; i < fasttrap_tpoints.fth_nent; i++)
mutex_init(&fasttrap_tpoints.fth_table[i].ftb_mtx, mutex_init(&fasttrap_tpoints.fth_table[i].ftb_mtx,
"tracepoints bucket mtx", MUTEX_DEFAULT, NULL); "tracepoints bucket mtx", MUTEX_DEFAULT, NULL);
@ -2509,7 +2509,7 @@ fasttrap_load(void)
fasttrap_provs.fth_mask = fasttrap_provs.fth_nent - 1; fasttrap_provs.fth_mask = fasttrap_provs.fth_nent - 1;
fasttrap_provs.fth_table = kmem_zalloc(fasttrap_provs.fth_nent * fasttrap_provs.fth_table = kmem_zalloc(fasttrap_provs.fth_nent *
sizeof (fasttrap_bucket_t), KM_SLEEP); sizeof (fasttrap_bucket_t), KM_SLEEP);
#if !defined(sun) #ifndef illumos
for (i = 0; i < fasttrap_provs.fth_nent; i++) for (i = 0; i < fasttrap_provs.fth_nent; i++)
mutex_init(&fasttrap_provs.fth_table[i].ftb_mtx, mutex_init(&fasttrap_provs.fth_table[i].ftb_mtx,
"providers bucket mtx", MUTEX_DEFAULT, NULL); "providers bucket mtx", MUTEX_DEFAULT, NULL);
@ -2519,7 +2519,7 @@ fasttrap_load(void)
&fasttrap_cleanup_proc, 0, 0, "ftcleanup"); &fasttrap_cleanup_proc, 0, 0, "ftcleanup");
if (ret != 0) { if (ret != 0) {
destroy_dev(fasttrap_cdev); destroy_dev(fasttrap_cdev);
#if !defined(sun) #ifndef illumos
for (i = 0; i < fasttrap_provs.fth_nent; i++) for (i = 0; i < fasttrap_provs.fth_nent; i++)
mutex_destroy(&fasttrap_provs.fth_table[i].ftb_mtx); mutex_destroy(&fasttrap_provs.fth_table[i].ftb_mtx);
for (i = 0; i < fasttrap_tpoints.fth_nent; i++) for (i = 0; i < fasttrap_tpoints.fth_nent; i++)
@ -2545,7 +2545,7 @@ fasttrap_load(void)
fasttrap_procs.fth_mask = fasttrap_procs.fth_nent - 1; fasttrap_procs.fth_mask = fasttrap_procs.fth_nent - 1;
fasttrap_procs.fth_table = kmem_zalloc(fasttrap_procs.fth_nent * fasttrap_procs.fth_table = kmem_zalloc(fasttrap_procs.fth_nent *
sizeof (fasttrap_bucket_t), KM_SLEEP); sizeof (fasttrap_bucket_t), KM_SLEEP);
#if !defined(sun) #ifndef illumos
for (i = 0; i < fasttrap_procs.fth_nent; i++) for (i = 0; i < fasttrap_procs.fth_nent; i++)
mutex_init(&fasttrap_procs.fth_table[i].ftb_mtx, mutex_init(&fasttrap_procs.fth_table[i].ftb_mtx,
"processes bucket mtx", MUTEX_DEFAULT, NULL); "processes bucket mtx", MUTEX_DEFAULT, NULL);
@ -2661,7 +2661,7 @@ fasttrap_unload(void)
mutex_exit(&fasttrap_count_mtx); mutex_exit(&fasttrap_count_mtx);
#endif #endif
#if !defined(sun) #ifndef illumos
EVENTHANDLER_DEREGISTER(thread_dtor, fasttrap_thread_dtor_tag); EVENTHANDLER_DEREGISTER(thread_dtor, fasttrap_thread_dtor_tag);
for (i = 0; i < fasttrap_tpoints.fth_nent; i++) for (i = 0; i < fasttrap_tpoints.fth_nent; i++)
@ -2683,7 +2683,7 @@ fasttrap_unload(void)
fasttrap_procs.fth_nent * sizeof (fasttrap_bucket_t)); fasttrap_procs.fth_nent * sizeof (fasttrap_bucket_t));
fasttrap_procs.fth_nent = 0; fasttrap_procs.fth_nent = 0;
#if !defined(sun) #ifndef illumos
destroy_dev(fasttrap_cdev); destroy_dev(fasttrap_cdev);
mutex_destroy(&fasttrap_count_mtx); mutex_destroy(&fasttrap_count_mtx);
CPU_FOREACH(i) { CPU_FOREACH(i) {

View File

@ -107,7 +107,7 @@
* gfs_root_create_file() * gfs_root_create_file()
*/ */
#ifdef sun #ifdef illumos
/* /*
* gfs_make_opsvec: take an array of vnode type definitions and create * gfs_make_opsvec: take an array of vnode type definitions and create
* their vnodeops_t structures * their vnodeops_t structures
@ -141,7 +141,7 @@ gfs_make_opsvec(gfs_opsvec_t *vec)
} }
return (error); return (error);
} }
#endif /* sun */ #endif /* illumos */
/* /*
* Low level directory routines * Low level directory routines
@ -347,7 +347,7 @@ gfs_readdir_emit(gfs_readdir_state_t *st, uio_t *uiop, offset_t voff,
cookies)); cookies));
} }
#ifdef sun #ifdef illumos
/* /*
* gfs_readdir_emitn: like gfs_readdir_emit(), but takes an integer * gfs_readdir_emitn: like gfs_readdir_emit(), but takes an integer
* instead of a string for the entry's name. * instead of a string for the entry's name.
@ -599,7 +599,7 @@ gfs_root_create(size_t size, vfs_t *vfsp, vnodeops_t *ops, ino64_t ino,
return (vp); return (vp);
} }
#ifdef sun #ifdef illumos
/* /*
* gfs_root_create_file(): create a root vnode for a GFS file as a filesystem * gfs_root_create_file(): create a root vnode for a GFS file as a filesystem
* *
@ -619,7 +619,7 @@ gfs_root_create_file(size_t size, vfs_t *vfsp, vnodeops_t *ops, ino64_t ino)
return (vp); return (vp);
} }
#endif /* sun */ #endif /* illumos */
/* /*
* gfs_file_inactive() * gfs_file_inactive()
@ -1146,7 +1146,7 @@ gfs_vop_readdir(ap)
} }
#ifdef sun #ifdef illumos
/* /*
* gfs_vop_map: VOP_MAP() entry point * gfs_vop_map: VOP_MAP() entry point
* *
@ -1218,7 +1218,7 @@ gfs_vop_map(vnode_t *vp, offset_t off, struct as *as, caddr_t *addrp,
return (rv); return (rv);
} }
#endif /* sun */ #endif /* illumos */
/* /*
* gfs_vop_reclaim: VOP_RECLAIM() entry point (solaris' VOP_INACTIVE()) * gfs_vop_reclaim: VOP_RECLAIM() entry point (solaris' VOP_INACTIVE())

View File

@ -1207,7 +1207,7 @@ arc_cksum_compute(arc_buf_t *buf, boolean_t force)
mutex_exit(&buf->b_hdr->b_freeze_lock); mutex_exit(&buf->b_hdr->b_freeze_lock);
#ifdef illumos #ifdef illumos
arc_buf_watch(buf); arc_buf_watch(buf);
#endif /* illumos */ #endif
} }
#ifdef illumos #ifdef illumos
@ -1282,7 +1282,7 @@ arc_buf_thaw(arc_buf_t *buf)
#ifdef illumos #ifdef illumos
arc_buf_unwatch(buf); arc_buf_unwatch(buf);
#endif /* illumos */ #endif
} }
void void
@ -1742,7 +1742,7 @@ arc_buf_destroy(arc_buf_t *buf, boolean_t recycle, boolean_t remove)
arc_cksum_verify(buf); arc_cksum_verify(buf);
#ifdef illumos #ifdef illumos
arc_buf_unwatch(buf); arc_buf_unwatch(buf);
#endif /* illumos */ #endif
if (!recycle) { if (!recycle) {
if (type == ARC_BUFC_METADATA) { if (type == ARC_BUFC_METADATA) {
@ -2595,7 +2595,7 @@ arc_reclaim_needed(void)
return (1); return (1);
} }
#ifdef sun #ifdef illumos
/* /*
* take 'desfree' extra pages, so we reclaim sooner, rather than later * take 'desfree' extra pages, so we reclaim sooner, rather than later
*/ */
@ -2631,7 +2631,7 @@ arc_reclaim_needed(void)
if (availrmem <= pages_pp_maximum) if (availrmem <= pages_pp_maximum)
return (1); return (1);
#endif /* sun */ #endif /* illumos */
#if defined(__i386) || !defined(UMA_MD_SMALL_ALLOC) #if defined(__i386) || !defined(UMA_MD_SMALL_ALLOC)
/* /*
* If we're on an i386 platform, it's possible that we'll exhaust the * If we're on an i386 platform, it's possible that we'll exhaust the
@ -2652,7 +2652,7 @@ arc_reclaim_needed(void)
return (1); return (1);
} }
#endif #endif
#ifdef sun #ifdef illumos
/* /*
* If zio data pages are being allocated out of a separate heap segment, * If zio data pages are being allocated out of a separate heap segment,
* then enforce that the size of available vmem for this arena remains * then enforce that the size of available vmem for this arena remains
@ -2666,7 +2666,7 @@ arc_reclaim_needed(void)
vmem_size(zio_arena, VMEM_FREE) < vmem_size(zio_arena, VMEM_FREE) <
(vmem_size(zio_arena, VMEM_ALLOC) >> 4)) (vmem_size(zio_arena, VMEM_ALLOC) >> 4))
return (1); return (1);
#endif /* sun */ #endif /* illumos */
#else /* _KERNEL */ #else /* _KERNEL */
if (spa_get_random(100) == 0) if (spa_get_random(100) == 0)
return (1); return (1);
@ -2725,7 +2725,7 @@ arc_kmem_reap_now(arc_reclaim_strategy_t strat)
kmem_cache_reap_now(hdr_cache); kmem_cache_reap_now(hdr_cache);
kmem_cache_reap_now(range_seg_cache); kmem_cache_reap_now(range_seg_cache);
#ifdef sun #ifdef illumos
/* /*
* Ask the vmem arena to reclaim unused memory from its * Ask the vmem arena to reclaim unused memory from its
* quantum caches. * quantum caches.
@ -3213,7 +3213,7 @@ arc_read_done(zio_t *zio)
arc_cksum_compute(buf, B_FALSE); arc_cksum_compute(buf, B_FALSE);
#ifdef illumos #ifdef illumos
arc_buf_watch(buf); arc_buf_watch(buf);
#endif /* illumos */ #endif
if (hash_lock && zio->io_error == 0 && hdr->b_state == arc_anon) { if (hash_lock && zio->io_error == 0 && hdr->b_state == arc_anon) {
/* /*
@ -3816,7 +3816,7 @@ arc_release(arc_buf_t *buf, void *tag)
arc_cksum_verify(buf); arc_cksum_verify(buf);
#ifdef illumos #ifdef illumos
arc_buf_unwatch(buf); arc_buf_unwatch(buf);
#endif /* illumos */ #endif
mutex_exit(hash_lock); mutex_exit(hash_lock);
@ -4186,7 +4186,7 @@ arc_init(void)
/* Start out with 1/8 of all memory */ /* Start out with 1/8 of all memory */
arc_c = kmem_size() / 8; arc_c = kmem_size() / 8;
#ifdef sun #ifdef illumos
#ifdef _KERNEL #ifdef _KERNEL
/* /*
* On architectures where the physical memory can be larger * On architectures where the physical memory can be larger
@ -4195,7 +4195,7 @@ arc_init(void)
*/ */
arc_c = MIN(arc_c, vmem_size(heap_arena, VMEM_ALLOC | VMEM_FREE) / 8); arc_c = MIN(arc_c, vmem_size(heap_arena, VMEM_ALLOC | VMEM_FREE) / 8);
#endif #endif
#endif /* sun */ #endif /* illumos */
/* set min cache to 1/32 of all memory, or 16MB, whichever is more */ /* set min cache to 1/32 of all memory, or 16MB, whichever is more */
arc_c_min = MAX(arc_c / 4, 64<<18); arc_c_min = MAX(arc_c / 4, 64<<18);
/* set max to 1/2 of all memory, or all but 1GB, whichever is more */ /* set max to 1/2 of all memory, or all but 1GB, whichever is more */

View File

@ -1238,7 +1238,7 @@ dmu_write_uio(objset_t *os, uint64_t object, uio_t *uio, uint64_t size,
return (err); return (err);
} }
#ifdef sun #ifdef illumos
int int
dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size,
page_t *pp, dmu_tx_t *tx) page_t *pp, dmu_tx_t *tx)
@ -1294,7 +1294,7 @@ dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size,
return (err); return (err);
} }
#else #else /* !illumos */
int int
dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size,
@ -1351,8 +1351,8 @@ dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size,
dmu_buf_rele_array(dbp, numbufs, FTAG); dmu_buf_rele_array(dbp, numbufs, FTAG);
return (err); return (err);
} }
#endif /* sun */ #endif /* illumos */
#endif #endif /* _KERNEL */
/* /*
* Allocate a loaned anonymous arc buffer. * Allocate a loaned anonymous arc buffer.

View File

@ -57,7 +57,7 @@ static dnode_phys_t dnode_phys_zero;
int zfs_default_bs = SPA_MINBLOCKSHIFT; int zfs_default_bs = SPA_MINBLOCKSHIFT;
int zfs_default_ibs = DN_MAX_INDBLKSHIFT; int zfs_default_ibs = DN_MAX_INDBLKSHIFT;
#ifdef sun #ifdef illumos
static kmem_cbrc_t dnode_move(void *, void *, size_t, void *); static kmem_cbrc_t dnode_move(void *, void *, size_t, void *);
#endif #endif
@ -813,7 +813,7 @@ dnode_move_impl(dnode_t *odn, dnode_t *ndn)
odn->dn_moved = (uint8_t)-1; odn->dn_moved = (uint8_t)-1;
} }
#ifdef sun #ifdef illumos
#ifdef _KERNEL #ifdef _KERNEL
/*ARGSUSED*/ /*ARGSUSED*/
static kmem_cbrc_t static kmem_cbrc_t
@ -956,7 +956,7 @@ dnode_move(void *buf, void *newbuf, size_t size, void *arg)
return (KMEM_CBRC_YES); return (KMEM_CBRC_YES);
} }
#endif /* _KERNEL */ #endif /* _KERNEL */
#endif /* sun */ #endif /* illumos */
void void
dnode_special_close(dnode_handle_t *dnh) dnode_special_close(dnode_handle_t *dnh)

View File

@ -3770,7 +3770,7 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props,
} }
#ifdef _KERNEL #ifdef _KERNEL
#if defined(sun) #ifdef illumos
/* /*
* Get the root pool information from the root disk, then import the root pool * Get the root pool information from the root disk, then import the root pool
* during the system boot up time. * during the system boot up time.
@ -3971,7 +3971,7 @@ out:
return (error); return (error);
} }
#else #else /* !illumos */
extern int vdev_geom_read_pool_label(const char *name, nvlist_t ***configs, extern int vdev_geom_read_pool_label(const char *name, nvlist_t ***configs,
uint64_t *count); uint64_t *count);
@ -4162,8 +4162,8 @@ spa_import_rootpool(const char *name)
return (0); return (0);
} }
#endif /* sun */ #endif /* illumos */
#endif #endif /* _KERNEL */
/* /*
* Import a non-root pool into the system. * Import a non-root pool into the system.
@ -5331,13 +5331,13 @@ spa_vdev_split_mirror(spa_t *spa, char *newname, nvlist_t *config,
spa_activate(newspa, spa_mode_global); spa_activate(newspa, spa_mode_global);
spa_async_suspend(newspa); spa_async_suspend(newspa);
#ifndef sun #ifndef illumos
/* mark that we are creating new spa by splitting */ /* mark that we are creating new spa by splitting */
newspa->spa_splitting_newspa = B_TRUE; newspa->spa_splitting_newspa = B_TRUE;
#endif #endif
/* create the new pool from the disks of the original pool */ /* create the new pool from the disks of the original pool */
error = spa_load(newspa, SPA_LOAD_IMPORT, SPA_IMPORT_ASSEMBLE, B_TRUE); error = spa_load(newspa, SPA_LOAD_IMPORT, SPA_IMPORT_ASSEMBLE, B_TRUE);
#ifndef sun #ifndef illumos
newspa->spa_splitting_newspa = B_FALSE; newspa->spa_splitting_newspa = B_FALSE;
#endif #endif
if (error) if (error)
@ -6578,12 +6578,12 @@ spa_sync(spa_t *spa, uint64_t txg)
#ifdef illumos #ifdef illumos
VERIFY(cyclic_reprogram(spa->spa_deadman_cycid, VERIFY(cyclic_reprogram(spa->spa_deadman_cycid,
spa->spa_sync_starttime + spa->spa_deadman_synctime)); spa->spa_sync_starttime + spa->spa_deadman_synctime));
#else /* FreeBSD */ #else /* !illumos */
#ifdef _KERNEL #ifdef _KERNEL
callout_reset(&spa->spa_deadman_cycid, callout_reset(&spa->spa_deadman_cycid,
hz * spa->spa_deadman_synctime / NANOSEC, spa_deadman, spa); hz * spa->spa_deadman_synctime / NANOSEC, spa_deadman, spa);
#endif #endif
#endif #endif /* illumos */
/* /*
* If we are upgrading to SPA_VERSION_RAIDZ_DEFLATE this txg, * If we are upgrading to SPA_VERSION_RAIDZ_DEFLATE this txg,
@ -6728,11 +6728,11 @@ spa_sync(spa_t *spa, uint64_t txg)
#ifdef illumos #ifdef illumos
VERIFY(cyclic_reprogram(spa->spa_deadman_cycid, CY_INFINITY)); VERIFY(cyclic_reprogram(spa->spa_deadman_cycid, CY_INFINITY));
#else /* FreeBSD */ #else /* !illumos */
#ifdef _KERNEL #ifdef _KERNEL
callout_drain(&spa->spa_deadman_cycid); callout_drain(&spa->spa_deadman_cycid);
#endif #endif
#endif #endif /* illumos */
/* /*
* Clear the dirty config list. * Clear the dirty config list.

View File

@ -616,7 +616,7 @@ int dmu_write_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size,
int dmu_write_uio_dbuf(dmu_buf_t *zdb, struct uio *uio, uint64_t size, int dmu_write_uio_dbuf(dmu_buf_t *zdb, struct uio *uio, uint64_t size,
dmu_tx_t *tx); dmu_tx_t *tx);
#ifdef _KERNEL #ifdef _KERNEL
#ifdef sun #ifdef illumos
int dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, int dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset,
uint64_t size, struct page *pp, dmu_tx_t *tx); uint64_t size, struct page *pp, dmu_tx_t *tx);
#else #else

View File

@ -601,7 +601,7 @@ extern int spa_get_stats(const char *pool, nvlist_t **config, char *altroot,
size_t buflen); size_t buflen);
extern int spa_create(const char *pool, nvlist_t *config, nvlist_t *props, extern int spa_create(const char *pool, nvlist_t *config, nvlist_t *props,
nvlist_t *zplprops); nvlist_t *zplprops);
#if defined(sun) #ifdef illumos
extern int spa_import_rootpool(char *devpath, char *devid); extern int spa_import_rootpool(char *devpath, char *devid);
#else #else
extern int spa_import_rootpool(const char *name); extern int spa_import_rootpool(const char *name);

View File

@ -245,7 +245,7 @@ struct spa {
uint64_t spa_feat_refcount_cache[SPA_FEATURES]; uint64_t spa_feat_refcount_cache[SPA_FEATURES];
#ifdef illumos #ifdef illumos
cyclic_id_t spa_deadman_cycid; /* cyclic id */ cyclic_id_t spa_deadman_cycid; /* cyclic id */
#else /* FreeBSD */ #else /* !illumos */
#ifdef _KERNEL #ifdef _KERNEL
struct callout spa_deadman_cycid; /* callout id */ struct callout spa_deadman_cycid; /* callout id */
#endif #endif
@ -275,7 +275,7 @@ struct spa {
*/ */
spa_config_lock_t spa_config_lock[SCL_LOCKS]; /* config changes */ spa_config_lock_t spa_config_lock[SCL_LOCKS]; /* config changes */
refcount_t spa_refcount; /* number of opens */ refcount_t spa_refcount; /* number of opens */
#ifndef sun #ifndef illumos
boolean_t spa_splitting_newspa; /* creating new spa in split */ boolean_t spa_splitting_newspa; /* creating new spa in split */
#endif #endif
}; };

View File

@ -45,7 +45,7 @@ extern int zvol_remove_minor(const char *);
extern void zvol_remove_minors(const char *); extern void zvol_remove_minors(const char *);
extern int zvol_set_volsize(const char *, uint64_t); extern int zvol_set_volsize(const char *, uint64_t);
#ifdef sun #ifdef illumos
extern int zvol_open(dev_t *devp, int flag, int otyp, cred_t *cr); extern int zvol_open(dev_t *devp, int flag, int otyp, cred_t *cr);
extern int zvol_dump(dev_t dev, caddr_t addr, daddr_t offset, int nblocks); extern int zvol_dump(dev_t dev, caddr_t addr, daddr_t offset, int nblocks);
extern int zvol_close(dev_t dev, int flag, int otyp, cred_t *cr); extern int zvol_close(dev_t dev, int flag, int otyp, cred_t *cr);
@ -54,14 +54,14 @@ extern int zvol_read(dev_t dev, uio_t *uiop, cred_t *cr);
extern int zvol_write(dev_t dev, uio_t *uiop, cred_t *cr); extern int zvol_write(dev_t dev, uio_t *uiop, cred_t *cr);
extern int zvol_aread(dev_t dev, struct aio_req *aio, cred_t *cr); extern int zvol_aread(dev_t dev, struct aio_req *aio, cred_t *cr);
extern int zvol_awrite(dev_t dev, struct aio_req *aio, cred_t *cr); extern int zvol_awrite(dev_t dev, struct aio_req *aio, cred_t *cr);
#endif /* sun */ #endif /* illumos */
extern int zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, extern int zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr,
int *rvalp); int *rvalp);
extern int zvol_busy(void); extern int zvol_busy(void);
extern void zvol_init(void); extern void zvol_init(void);
extern void zvol_fini(void); extern void zvol_fini(void);
#ifdef sun #ifdef illumos
extern int zvol_get_volume_params(minor_t minor, uint64_t *blksize, extern int zvol_get_volume_params(minor_t minor, uint64_t *blksize,
uint64_t *max_xfer_len, void **minor_hdl, void **objset_hdl, void **zil_hdl, uint64_t *max_xfer_len, void **minor_hdl, void **objset_hdl, void **zil_hdl,
void **rl_hdl, void **bonus_hdl); void **rl_hdl, void **bonus_hdl);
@ -69,7 +69,7 @@ extern uint64_t zvol_get_volume_size(void *minor_hdl);
extern int zvol_get_volume_wce(void *minor_hdl); extern int zvol_get_volume_wce(void *minor_hdl);
extern void zvol_log_write_minor(void *minor_hdl, dmu_tx_t *tx, offset_t off, extern void zvol_log_write_minor(void *minor_hdl, dmu_tx_t *tx, offset_t off,
ssize_t resid, boolean_t sync); ssize_t resid, boolean_t sync);
#endif /* sun */ #endif /* illumos */
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
extern int zvol_create_minors(const char *name); extern int zvol_create_minors(const char *name);

View File

@ -3360,7 +3360,7 @@ vdev_set_state(vdev_t *vd, boolean_t isopen, vdev_state_t state, vdev_aux_t aux)
boolean_t boolean_t
vdev_is_bootable(vdev_t *vd) vdev_is_bootable(vdev_t *vd)
{ {
#ifdef sun #ifdef illumos
if (!vd->vdev_ops->vdev_op_leaf) { if (!vd->vdev_ops->vdev_op_leaf) {
char *vdev_type = vd->vdev_ops->vdev_op_type; char *vdev_type = vd->vdev_ops->vdev_op_type;
@ -3379,7 +3379,7 @@ vdev_is_bootable(vdev_t *vd)
if (!vdev_is_bootable(vd->vdev_child[c])) if (!vdev_is_bootable(vd->vdev_child[c]))
return (B_FALSE); return (B_FALSE);
} }
#endif /* sun */ #endif /* illumos */
return (B_TRUE); return (B_TRUE);
} }

View File

@ -2053,7 +2053,7 @@ zfs_zaccess_dataset_check(znode_t *zp, uint32_t v4_mode)
return (SET_ERROR(EPERM)); return (SET_ERROR(EPERM));
} }
#ifdef sun #ifdef illumos
if ((v4_mode & (ACE_DELETE | ACE_DELETE_CHILD)) && if ((v4_mode & (ACE_DELETE | ACE_DELETE_CHILD)) &&
(zp->z_pflags & ZFS_NOUNLINK)) { (zp->z_pflags & ZFS_NOUNLINK)) {
return (SET_ERROR(EPERM)); return (SET_ERROR(EPERM));

View File

@ -112,7 +112,7 @@ snapentry_compare(const void *a, const void *b)
return (0); return (0);
} }
#ifdef sun #ifdef illumos
vnodeops_t *zfsctl_ops_root; vnodeops_t *zfsctl_ops_root;
vnodeops_t *zfsctl_ops_snapdir; vnodeops_t *zfsctl_ops_snapdir;
vnodeops_t *zfsctl_ops_snapshot; vnodeops_t *zfsctl_ops_snapshot;
@ -123,20 +123,20 @@ static const fs_operation_def_t zfsctl_tops_root[];
static const fs_operation_def_t zfsctl_tops_snapdir[]; static const fs_operation_def_t zfsctl_tops_snapdir[];
static const fs_operation_def_t zfsctl_tops_snapshot[]; static const fs_operation_def_t zfsctl_tops_snapshot[];
static const fs_operation_def_t zfsctl_tops_shares[]; static const fs_operation_def_t zfsctl_tops_shares[];
#else /* !sun */ #else
static struct vop_vector zfsctl_ops_root; static struct vop_vector zfsctl_ops_root;
static struct vop_vector zfsctl_ops_snapdir; static struct vop_vector zfsctl_ops_snapdir;
static struct vop_vector zfsctl_ops_snapshot; static struct vop_vector zfsctl_ops_snapshot;
static struct vop_vector zfsctl_ops_shares; static struct vop_vector zfsctl_ops_shares;
static struct vop_vector zfsctl_ops_shares_dir; static struct vop_vector zfsctl_ops_shares_dir;
#endif /* !sun */ #endif
static vnode_t *zfsctl_mknode_snapdir(vnode_t *); static vnode_t *zfsctl_mknode_snapdir(vnode_t *);
static vnode_t *zfsctl_mknode_shares(vnode_t *); static vnode_t *zfsctl_mknode_shares(vnode_t *);
static vnode_t *zfsctl_snapshot_mknode(vnode_t *, uint64_t objset); static vnode_t *zfsctl_snapshot_mknode(vnode_t *, uint64_t objset);
static int zfsctl_unmount_snap(zfs_snapentry_t *, int, cred_t *); static int zfsctl_unmount_snap(zfs_snapentry_t *, int, cred_t *);
#ifdef sun #ifdef illumos
static gfs_opsvec_t zfsctl_opsvec[] = { static gfs_opsvec_t zfsctl_opsvec[] = {
{ ".zfs", zfsctl_tops_root, &zfsctl_ops_root }, { ".zfs", zfsctl_tops_root, &zfsctl_ops_root },
{ ".zfs/snapshot", zfsctl_tops_snapdir, &zfsctl_ops_snapdir }, { ".zfs/snapshot", zfsctl_tops_snapdir, &zfsctl_ops_snapdir },
@ -145,7 +145,7 @@ static gfs_opsvec_t zfsctl_opsvec[] = {
{ ".zfs/shares/vnode", zfsctl_tops_shares, &zfsctl_ops_shares }, { ".zfs/shares/vnode", zfsctl_tops_shares, &zfsctl_ops_shares },
{ NULL } { NULL }
}; };
#endif /* sun */ #endif
/* /*
* Root directory elements. We only have two entries * Root directory elements. We only have two entries
@ -170,7 +170,7 @@ static gfs_dirent_t zfsctl_root_entries[] = {
void void
zfsctl_init(void) zfsctl_init(void)
{ {
#ifdef sun #ifdef illumos
VERIFY(gfs_make_opsvec(zfsctl_opsvec) == 0); VERIFY(gfs_make_opsvec(zfsctl_opsvec) == 0);
#endif #endif
} }
@ -178,7 +178,7 @@ zfsctl_init(void)
void void
zfsctl_fini(void) zfsctl_fini(void)
{ {
#ifdef sun #ifdef illumos
/* /*
* Remove vfsctl vnode ops * Remove vfsctl vnode ops
*/ */
@ -198,7 +198,7 @@ zfsctl_fini(void)
zfsctl_ops_snapshot = NULL; zfsctl_ops_snapshot = NULL;
zfsctl_ops_shares = NULL; zfsctl_ops_shares = NULL;
zfsctl_ops_shares_dir = NULL; zfsctl_ops_shares_dir = NULL;
#endif /* sun */ #endif /* illumos */
} }
boolean_t boolean_t
@ -549,7 +549,7 @@ zfsctl_root_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, pathname_t *pnp,
return (err); return (err);
} }
#ifdef sun #ifdef illumos
static int static int
zfsctl_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr, zfsctl_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr,
caller_context_t *ct) caller_context_t *ct)
@ -565,9 +565,9 @@ zfsctl_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr,
return (fs_pathconf(vp, cmd, valp, cr, ct)); return (fs_pathconf(vp, cmd, valp, cr, ct));
} }
#endif /* sun */ #endif /* illumos */
#ifdef sun #ifdef illumos
static const fs_operation_def_t zfsctl_tops_root[] = { static const fs_operation_def_t zfsctl_tops_root[] = {
{ VOPNAME_OPEN, { .vop_open = zfsctl_common_open } }, { VOPNAME_OPEN, { .vop_open = zfsctl_common_open } },
{ VOPNAME_CLOSE, { .vop_close = zfsctl_common_close } }, { VOPNAME_CLOSE, { .vop_close = zfsctl_common_close } },
@ -582,7 +582,7 @@ static const fs_operation_def_t zfsctl_tops_root[] = {
{ VOPNAME_FID, { .vop_fid = zfsctl_common_fid } }, { VOPNAME_FID, { .vop_fid = zfsctl_common_fid } },
{ NULL } { NULL }
}; };
#endif /* sun */ #endif /* illumos */
/* /*
* Special case the handling of "..". * Special case the handling of "..".
@ -676,7 +676,7 @@ zfsctl_unmount_snap(zfs_snapentry_t *sep, int fflags, cred_t *cr)
if ((error = vn_vfswlock(svp)) != 0) if ((error = vn_vfswlock(svp)) != 0)
return (error); return (error);
#ifdef sun #ifdef illumos
VN_HOLD(svp); VN_HOLD(svp);
error = dounmount(vn_mountedvfs(svp), fflags, cr); error = dounmount(vn_mountedvfs(svp), fflags, cr);
if (error) { if (error) {
@ -696,12 +696,12 @@ zfsctl_unmount_snap(zfs_snapentry_t *sep, int fflags, cred_t *cr)
kmem_free(sep, sizeof (zfs_snapentry_t)); kmem_free(sep, sizeof (zfs_snapentry_t));
return (0); return (0);
#else /* !sun */ #else
return (dounmount(vn_mountedvfs(svp), fflags, curthread)); return (dounmount(vn_mountedvfs(svp), fflags, curthread));
#endif /* !sun */ #endif
} }
#ifdef sun #ifdef illumos
static void static void
zfsctl_rename_snap(zfsctl_snapdir_t *sdp, zfs_snapentry_t *sep, const char *nm) zfsctl_rename_snap(zfsctl_snapdir_t *sdp, zfs_snapentry_t *sep, const char *nm)
{ {
@ -754,9 +754,9 @@ zfsctl_rename_snap(zfsctl_snapdir_t *sdp, zfs_snapentry_t *sep, const char *nm)
vfs_unlock(vfsp); vfs_unlock(vfsp);
} }
#endif /* sun */ #endif /* illumos */
#ifdef sun #ifdef illumos
/*ARGSUSED*/ /*ARGSUSED*/
static int static int
zfsctl_snapdir_rename(vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm, zfsctl_snapdir_rename(vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm,
@ -821,9 +821,9 @@ zfsctl_snapdir_rename(vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm,
return (err); return (err);
} }
#endif /* sun */ #endif /* illumos */
#ifdef sun #ifdef illumos
/* ARGSUSED */ /* ARGSUSED */
static int static int
zfsctl_snapdir_remove(vnode_t *dvp, char *name, vnode_t *cwd, cred_t *cr, zfsctl_snapdir_remove(vnode_t *dvp, char *name, vnode_t *cwd, cred_t *cr,
@ -879,7 +879,7 @@ zfsctl_snapdir_remove(vnode_t *dvp, char *name, vnode_t *cwd, cred_t *cr,
return (err); return (err);
} }
#endif /* sun */ #endif /* illumos */
/* /*
* This creates a snapshot under '.zfs/snapshot'. * This creates a snapshot under '.zfs/snapshot'.
@ -1067,7 +1067,7 @@ zfsctl_snapdir_lookup(ap)
} }
ZFS_EXIT(zfsvfs); ZFS_EXIT(zfsvfs);
return (err); return (err);
#endif /* !illumos */ #endif /* illumos */
} }
sep = kmem_alloc(sizeof (zfs_snapentry_t), KM_SLEEP); sep = kmem_alloc(sizeof (zfs_snapentry_t), KM_SLEEP);
@ -1374,7 +1374,7 @@ zfsctl_snapdir_inactive(ap)
return (0); return (0);
} }
#ifdef sun #ifdef illumos
static const fs_operation_def_t zfsctl_tops_snapdir[] = { static const fs_operation_def_t zfsctl_tops_snapdir[] = {
{ VOPNAME_OPEN, { .vop_open = zfsctl_common_open } }, { VOPNAME_OPEN, { .vop_open = zfsctl_common_open } },
{ VOPNAME_CLOSE, { .vop_close = zfsctl_common_close } }, { VOPNAME_CLOSE, { .vop_close = zfsctl_common_close } },
@ -1405,7 +1405,7 @@ static const fs_operation_def_t zfsctl_tops_shares[] = {
{ VOPNAME_FID, { .vop_fid = zfsctl_shares_fid } }, { VOPNAME_FID, { .vop_fid = zfsctl_shares_fid } },
{ NULL } { NULL }
}; };
#else /* !sun */ #else /* !illumos */
static struct vop_vector zfsctl_ops_snapdir = { static struct vop_vector zfsctl_ops_snapdir = {
.vop_default = &default_vnodeops, .vop_default = &default_vnodeops,
.vop_open = zfsctl_common_open, .vop_open = zfsctl_common_open,
@ -1434,7 +1434,7 @@ static struct vop_vector zfsctl_ops_shares = {
.vop_reclaim = gfs_vop_reclaim, .vop_reclaim = gfs_vop_reclaim,
.vop_fid = zfsctl_shares_fid, .vop_fid = zfsctl_shares_fid,
}; };
#endif /* !sun */ #endif /* illumos */
/* /*
* pvp is the GFS vnode '.zfs/snapshot'. * pvp is the GFS vnode '.zfs/snapshot'.

View File

@ -406,7 +406,7 @@ zfs_fuid_map_id(zfsvfs_t *zfsvfs, uint64_t fuid,
domain = zfs_fuid_find_by_idx(zfsvfs, index); domain = zfs_fuid_find_by_idx(zfsvfs, index);
ASSERT(domain != NULL); ASSERT(domain != NULL);
#ifdef sun #ifdef illumos
if (type == ZFS_OWNER || type == ZFS_ACE_USER) { if (type == ZFS_OWNER || type == ZFS_ACE_USER) {
(void) kidmap_getuidbysid(crgetzone(cr), domain, (void) kidmap_getuidbysid(crgetzone(cr), domain,
FUID_RID(fuid), &id); FUID_RID(fuid), &id);
@ -414,9 +414,9 @@ zfs_fuid_map_id(zfsvfs_t *zfsvfs, uint64_t fuid,
(void) kidmap_getgidbysid(crgetzone(cr), domain, (void) kidmap_getgidbysid(crgetzone(cr), domain,
FUID_RID(fuid), &id); FUID_RID(fuid), &id);
} }
#else /* !sun */ #else
id = UID_NOBODY; id = UID_NOBODY;
#endif /* !sun */ #endif
return (id); return (id);
} }
@ -703,13 +703,13 @@ zfs_fuid_info_free(zfs_fuid_info_t *fuidp)
boolean_t boolean_t
zfs_groupmember(zfsvfs_t *zfsvfs, uint64_t id, cred_t *cr) zfs_groupmember(zfsvfs_t *zfsvfs, uint64_t id, cred_t *cr)
{ {
#ifdef sun #ifdef illumos
ksid_t *ksid = crgetsid(cr, KSID_GROUP); ksid_t *ksid = crgetsid(cr, KSID_GROUP);
ksidlist_t *ksidlist = crgetsidlist(cr); ksidlist_t *ksidlist = crgetsidlist(cr);
#endif /* !sun */ #endif
uid_t gid; uid_t gid;
#ifdef sun #ifdef illumos
if (ksid && ksidlist) { if (ksid && ksidlist) {
int i; int i;
ksid_t *ksid_groups; ksid_t *ksid_groups;
@ -741,7 +741,7 @@ zfs_groupmember(zfsvfs_t *zfsvfs, uint64_t id, cred_t *cr)
} }
} }
} }
#endif /* !sun */ #endif /* illumos */
/* /*
* Not found in ksidlist, check posix groups * Not found in ksidlist, check posix groups

View File

@ -4823,7 +4823,7 @@ zfs_ioc_userspace_upgrade(zfs_cmd_t *zc)
return (error); return (error);
} }
#ifdef sun #ifdef illumos
/* /*
* We don't want to have a hard dependency * We don't want to have a hard dependency
* against some special symbols in sharefs * against some special symbols in sharefs
@ -4841,10 +4841,10 @@ int zfs_smbshare_inited;
ddi_modhandle_t nfs_mod; ddi_modhandle_t nfs_mod;
ddi_modhandle_t sharefs_mod; ddi_modhandle_t sharefs_mod;
ddi_modhandle_t smbsrv_mod; ddi_modhandle_t smbsrv_mod;
#endif /* sun */ #endif /* illumos */
kmutex_t zfs_share_lock; kmutex_t zfs_share_lock;
#ifdef sun #ifdef illumos
static int static int
zfs_init_sharefs() zfs_init_sharefs()
{ {
@ -4864,12 +4864,12 @@ zfs_init_sharefs()
} }
return (0); return (0);
} }
#endif /* sun */ #endif /* illumos */
static int static int
zfs_ioc_share(zfs_cmd_t *zc) zfs_ioc_share(zfs_cmd_t *zc)
{ {
#ifdef sun #ifdef illumos
int error; int error;
int opcode; int opcode;
@ -4960,9 +4960,9 @@ zfs_ioc_share(zfs_cmd_t *zc)
return (error); return (error);
#else /* !sun */ #else /* !illumos */
return (ENOSYS); return (ENOSYS);
#endif /* !sun */ #endif /* illumos */
} }
ace_t full_access[] = { ace_t full_access[] = {
@ -5065,7 +5065,7 @@ zfs_ioc_diff(zfs_cmd_t *zc)
return (error); return (error);
} }
#ifdef sun #ifdef illumos
/* /*
* Remove all ACL files in shares dir * Remove all ACL files in shares dir
*/ */
@ -5087,12 +5087,12 @@ zfs_smb_acl_purge(znode_t *dzp)
zap_cursor_fini(&zc); zap_cursor_fini(&zc);
return (error); return (error);
} }
#endif /* sun */ #endif /* illumos */
static int static int
zfs_ioc_smb_acl(zfs_cmd_t *zc) zfs_ioc_smb_acl(zfs_cmd_t *zc)
{ {
#ifdef sun #ifdef illumos
vnode_t *vp; vnode_t *vp;
znode_t *dzp; znode_t *dzp;
vnode_t *resourcevp = NULL; vnode_t *resourcevp = NULL;
@ -5215,9 +5215,9 @@ zfs_ioc_smb_acl(zfs_cmd_t *zc)
ZFS_EXIT(zfsvfs); ZFS_EXIT(zfsvfs);
return (error); return (error);
#else /* !sun */ #else /* !illumos */
return (EOPNOTSUPP); return (EOPNOTSUPP);
#endif /* !sun */ #endif /* illumos */
} }
/* /*
@ -5908,7 +5908,7 @@ zfsdev_open(struct cdev *devp, int flag, int mode, struct thread *td)
{ {
int error = 0; int error = 0;
#ifdef sun #ifdef illumos
if (getminor(*devp) != 0) if (getminor(*devp) != 0)
return (zvol_open(devp, flag, otyp, cr)); return (zvol_open(devp, flag, otyp, cr));
#endif #endif
@ -6245,7 +6245,7 @@ out:
return (error); return (error);
} }
#ifdef sun #ifdef illumos
static int static int
zfs_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) zfs_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
{ {
@ -6296,7 +6296,7 @@ zfs_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
return (DDI_FAILURE); return (DDI_FAILURE);
} }
#endif /* sun */ #endif /* illumos */
/* /*
* OK, so this is a little weird. * OK, so this is a little weird.
@ -6307,7 +6307,7 @@ zfs_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
* /dev/zfs has basically nothing to do except serve up ioctls, * /dev/zfs has basically nothing to do except serve up ioctls,
* so most of the standard driver entry points are in zvol.c. * so most of the standard driver entry points are in zvol.c.
*/ */
#ifdef sun #ifdef illumos
static struct cb_ops zfs_cb_ops = { static struct cb_ops zfs_cb_ops = {
zfsdev_open, /* open */ zfsdev_open, /* open */
zfsdev_close, /* close */ zfsdev_close, /* close */
@ -6356,7 +6356,7 @@ static struct modlinkage modlinkage = {
(void *)&zfs_modldrv, (void *)&zfs_modldrv,
NULL NULL
}; };
#endif /* sun */ #endif /* illumos */
static struct cdevsw zfs_cdevsw = { static struct cdevsw zfs_cdevsw = {
.d_version = D_VERSION, .d_version = D_VERSION,
@ -6389,7 +6389,7 @@ zfsdev_fini(void)
static struct root_hold_token *zfs_root_token; static struct root_hold_token *zfs_root_token;
struct proc *zfsproc; struct proc *zfsproc;
#ifdef sun #ifdef illumos
int int
_init(void) _init(void)
{ {
@ -6452,7 +6452,7 @@ _info(struct modinfo *modinfop)
{ {
return (mod_info(&modlinkage, modinfop)); return (mod_info(&modlinkage, modinfop));
} }
#endif /* sun */ #endif /* illumos */
static int zfs__init(void); static int zfs__init(void);
static int zfs__fini(void); static int zfs__fini(void);

View File

@ -820,7 +820,7 @@ top:
static int static int
zfs_replay_truncate(zfsvfs_t *zfsvfs, lr_truncate_t *lr, boolean_t byteswap) zfs_replay_truncate(zfsvfs_t *zfsvfs, lr_truncate_t *lr, boolean_t byteswap)
{ {
#ifdef sun #ifdef illumos
znode_t *zp; znode_t *zp;
flock64_t fl; flock64_t fl;
int error; int error;
@ -843,10 +843,10 @@ zfs_replay_truncate(zfsvfs_t *zfsvfs, lr_truncate_t *lr, boolean_t byteswap)
VN_RELE(ZTOV(zp)); VN_RELE(ZTOV(zp));
return (error); return (error);
#else /* !sun */ #else
ZFS_LOG(0, "Unexpected code path, report to pjd@FreeBSD.org"); ZFS_LOG(0, "Unexpected code path, report to pjd@FreeBSD.org");
return (EOPNOTSUPP); return (EOPNOTSUPP);
#endif /* !sun */ #endif
} }
static int static int

View File

@ -1635,13 +1635,13 @@ zfs_mount(vfs_t *vfsp)
* can be interrogated. * can be interrogated.
*/ */
if ((uap->flags & MS_DATA) && uap->datalen > 0) if ((uap->flags & MS_DATA) && uap->datalen > 0)
#else #else /* !illumos */
if (!prison_allow(td->td_ucred, PR_ALLOW_MOUNT_ZFS)) if (!prison_allow(td->td_ucred, PR_ALLOW_MOUNT_ZFS))
return (SET_ERROR(EPERM)); return (SET_ERROR(EPERM));
if (vfs_getopt(vfsp->mnt_optnew, "from", (void **)&osname, NULL)) if (vfs_getopt(vfsp->mnt_optnew, "from", (void **)&osname, NULL))
return (SET_ERROR(EINVAL)); return (SET_ERROR(EINVAL));
#endif /* ! illumos */ #endif /* illumos */
/* /*
* If full-owner-access is enabled and delegated administration is * If full-owner-access is enabled and delegated administration is
@ -1734,14 +1734,14 @@ zfs_mount(vfs_t *vfsp)
error = zfs_domount(vfsp, osname); error = zfs_domount(vfsp, osname);
PICKUP_GIANT(); PICKUP_GIANT();
#ifdef sun #ifdef illumos
/* /*
* Add an extra VFS_HOLD on our parent vfs so that it can't * Add an extra VFS_HOLD on our parent vfs so that it can't
* disappear due to a forced unmount. * disappear due to a forced unmount.
*/ */
if (error == 0 && ((zfsvfs_t *)vfsp->vfs_data)->z_issnap) if (error == 0 && ((zfsvfs_t *)vfsp->vfs_data)->z_issnap)
VFS_HOLD(mvp->v_vfsp); VFS_HOLD(mvp->v_vfsp);
#endif /* sun */ #endif
out: out:
return (error); return (error);
@ -1996,7 +1996,7 @@ zfs_umount(vfs_t *vfsp, int fflag)
return (ret); return (ret);
} }
#ifdef sun #ifdef illumos
if (!(fflag & MS_FORCE)) { if (!(fflag & MS_FORCE)) {
/* /*
* Check the number of active vnodes in the file system. * Check the number of active vnodes in the file system.
@ -2321,7 +2321,7 @@ zfs_freevfs(vfs_t *vfsp)
{ {
zfsvfs_t *zfsvfs = vfsp->vfs_data; zfsvfs_t *zfsvfs = vfsp->vfs_data;
#ifdef sun #ifdef illumos
/* /*
* If this is a snapshot, we have an extra VFS_HOLD on our parent * If this is a snapshot, we have an extra VFS_HOLD on our parent
* from zfs_mount(). Release it here. If we came through * from zfs_mount(). Release it here. If we came through
@ -2330,7 +2330,7 @@ zfs_freevfs(vfs_t *vfsp)
*/ */
if (zfsvfs->z_issnap && (vfsp != rootvfs)) if (zfsvfs->z_issnap && (vfsp != rootvfs))
VFS_RELE(zfsvfs->z_parent->z_vfs); VFS_RELE(zfsvfs->z_parent->z_vfs);
#endif /* sun */ #endif
zfsvfs_free(zfsvfs); zfsvfs_free(zfsvfs);

View File

@ -311,7 +311,7 @@ zfs_ioctl(vnode_t *vp, u_long com, intptr_t data, int flag, cred_t *cred,
case _FIO_SEEK_DATA: case _FIO_SEEK_DATA:
case _FIO_SEEK_HOLE: case _FIO_SEEK_HOLE:
#ifdef sun #ifdef illumos
if (ddi_copyin((void *)data, &off, sizeof (off), flag)) if (ddi_copyin((void *)data, &off, sizeof (off), flag))
return (SET_ERROR(EFAULT)); return (SET_ERROR(EFAULT));
#else #else
@ -327,7 +327,7 @@ zfs_ioctl(vnode_t *vp, u_long com, intptr_t data, int flag, cred_t *cred,
ZFS_EXIT(zfsvfs); ZFS_EXIT(zfsvfs);
if (error) if (error)
return (error); return (error);
#ifdef sun #ifdef illumos
if (ddi_copyout(&off, (void *)data, sizeof (off), flag)) if (ddi_copyout(&off, (void *)data, sizeof (off), flag))
return (SET_ERROR(EFAULT)); return (SET_ERROR(EFAULT));
#else #else
@ -714,7 +714,7 @@ zfs_read(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct)
ASSERT(uio->uio_loffset < zp->z_size); ASSERT(uio->uio_loffset < zp->z_size);
n = MIN(uio->uio_resid, zp->z_size - uio->uio_loffset); n = MIN(uio->uio_resid, zp->z_size - uio->uio_loffset);
#ifdef sun #ifdef illumos
if ((uio->uio_extflg == UIO_XUIO) && if ((uio->uio_extflg == UIO_XUIO) &&
(((xuio_t *)uio)->xu_type == UIOTYPE_ZEROCOPY)) { (((xuio_t *)uio)->xu_type == UIOTYPE_ZEROCOPY)) {
int nblk; int nblk;
@ -743,7 +743,7 @@ zfs_read(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct)
} }
} }
} }
#endif /* sun */ #endif /* illumos */
while (n > 0) { while (n > 0) {
nbytes = MIN(n, zfs_read_chunk_size - nbytes = MIN(n, zfs_read_chunk_size -
@ -885,7 +885,7 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct)
return (error); return (error);
} }
#ifdef sun #ifdef illumos
/* /*
* Pre-fault the pages to ensure slow (eg NFS) pages * Pre-fault the pages to ensure slow (eg NFS) pages
* don't hold up txg. * don't hold up txg.
@ -896,7 +896,7 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct)
xuio = (xuio_t *)uio; xuio = (xuio_t *)uio;
else else
uio_prefaultpages(MIN(n, max_blksz), uio); uio_prefaultpages(MIN(n, max_blksz), uio);
#endif /* sun */ #endif
/* /*
* If in append mode, set the io offset pointer to eof. * If in append mode, set the io offset pointer to eof.
@ -1148,10 +1148,10 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct)
ASSERT(tx_bytes == nbytes); ASSERT(tx_bytes == nbytes);
n -= nbytes; n -= nbytes;
#ifdef sun #ifdef illumos
if (!xuio && n > 0) if (!xuio && n > 0)
uio_prefaultpages(MIN(n, max_blksz), uio); uio_prefaultpages(MIN(n, max_blksz), uio);
#endif /* sun */ #endif
} }
zfs_range_unlock(rl); zfs_range_unlock(rl);
@ -2823,7 +2823,7 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr,
mutex_enter(&zp->z_lock); mutex_enter(&zp->z_lock);
vap->va_type = IFTOVT(zp->z_mode); vap->va_type = IFTOVT(zp->z_mode);
vap->va_mode = zp->z_mode & ~S_IFMT; vap->va_mode = zp->z_mode & ~S_IFMT;
#ifdef sun #ifdef illumos
vap->va_fsid = zp->z_zfsvfs->z_vfs->vfs_dev; vap->va_fsid = zp->z_zfsvfs->z_vfs->vfs_dev;
#else #else
vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0]; vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
@ -2835,7 +2835,7 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr,
links = zp->z_links; links = zp->z_links;
vap->va_nlink = MIN(links, LINK_MAX); /* nlink_t limit! */ vap->va_nlink = MIN(links, LINK_MAX); /* nlink_t limit! */
vap->va_size = zp->z_size; vap->va_size = zp->z_size;
#ifdef sun #ifdef illumos
vap->va_rdev = vp->v_rdev; vap->va_rdev = vp->v_rdev;
#else #else
if (vp->v_type == VBLK || vp->v_type == VCHR) if (vp->v_type == VBLK || vp->v_type == VCHR)
@ -4462,7 +4462,7 @@ top:
return (error); return (error);
} }
#ifdef sun #ifdef illumos
/* /*
* zfs_null_putapage() is used when the file system has been force * zfs_null_putapage() is used when the file system has been force
* unmounted. It just drops the pages. * unmounted. It just drops the pages.
@ -4690,7 +4690,7 @@ out:
ZFS_EXIT(zfsvfs); ZFS_EXIT(zfsvfs);
return (error); return (error);
} }
#endif /* sun */ #endif /* illumos */
/*ARGSUSED*/ /*ARGSUSED*/
void void
@ -4743,7 +4743,7 @@ zfs_inactive(vnode_t *vp, cred_t *cr, caller_context_t *ct)
rw_exit(&zfsvfs->z_teardown_inactive_lock); rw_exit(&zfsvfs->z_teardown_inactive_lock);
} }
#ifdef sun #ifdef illumos
/* /*
* Bounds-check the seek operation. * Bounds-check the seek operation.
* *
@ -5169,7 +5169,7 @@ zfs_space(vnode_t *vp, int cmd, flock64_t *bfp, int flag,
ZFS_EXIT(zfsvfs); ZFS_EXIT(zfsvfs);
return (error); return (error);
} }
#endif /* sun */ #endif /* illumos */
CTASSERT(sizeof(struct zfid_short) <= sizeof(struct fid)); CTASSERT(sizeof(struct zfid_short) <= sizeof(struct fid));
CTASSERT(sizeof(struct zfid_long) <= sizeof(struct fid)); CTASSERT(sizeof(struct zfid_long) <= sizeof(struct fid));
@ -5257,7 +5257,7 @@ zfs_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr,
case _PC_FILESIZEBITS: case _PC_FILESIZEBITS:
*valp = 64; *valp = 64;
return (0); return (0);
#ifdef sun #ifdef illumos
case _PC_XATTR_EXISTS: case _PC_XATTR_EXISTS:
zp = VTOZ(vp); zp = VTOZ(vp);
zfsvfs = zp->z_zfsvfs; zfsvfs = zp->z_zfsvfs;
@ -5295,16 +5295,16 @@ zfs_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr,
case _PC_ACL_ENABLED: case _PC_ACL_ENABLED:
*valp = _ACL_ACE_ENABLED; *valp = _ACL_ACE_ENABLED;
return (0); return (0);
#endif /* sun */ #endif /* illumos */
case _PC_MIN_HOLE_SIZE: case _PC_MIN_HOLE_SIZE:
*valp = (int)SPA_MINBLOCKSIZE; *valp = (int)SPA_MINBLOCKSIZE;
return (0); return (0);
#ifdef sun #ifdef illumos
case _PC_TIMESTAMP_RESOLUTION: case _PC_TIMESTAMP_RESOLUTION:
/* nanosecond timestamp resolution */ /* nanosecond timestamp resolution */
*valp = 1L; *valp = 1L;
return (0); return (0);
#endif /* sun */ #endif
case _PC_ACL_EXTENDED: case _PC_ACL_EXTENDED:
*valp = 0; *valp = 0;
return (0); return (0);
@ -5363,7 +5363,7 @@ zfs_setsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr,
return (error); return (error);
} }
#ifdef sun #ifdef illumos
/* /*
* The smallest read we may consider to loan out an arcbuf. * The smallest read we may consider to loan out an arcbuf.
* This must be a power of 2. * This must be a power of 2.
@ -5694,7 +5694,7 @@ const fs_operation_def_t zfs_evnodeops_template[] = {
VOPNAME_PATHCONF, { .vop_pathconf = zfs_pathconf }, VOPNAME_PATHCONF, { .vop_pathconf = zfs_pathconf },
NULL, NULL NULL, NULL
}; };
#endif /* sun */ #endif /* illumos */
static int static int
ioflags(int ioflags) ioflags(int ioflags)

View File

@ -172,7 +172,7 @@ static struct {
} znode_move_stats; } znode_move_stats;
#endif /* ZNODE_STATS */ #endif /* ZNODE_STATS */
#ifdef sun #ifdef illumos
static void static void
zfs_znode_move_impl(znode_t *ozp, znode_t *nzp) zfs_znode_move_impl(znode_t *ozp, znode_t *nzp)
{ {
@ -343,7 +343,7 @@ zfs_znode_move(void *buf, void *newbuf, size_t size, void *arg)
return (KMEM_CBRC_YES); return (KMEM_CBRC_YES);
} }
#endif /* sun */ #endif /* illumos */
void void
zfs_znode_init(void) zfs_znode_init(void)
@ -362,12 +362,12 @@ zfs_znode_init(void)
void void
zfs_znode_fini(void) zfs_znode_fini(void)
{ {
#ifdef sun #ifdef illumos
/* /*
* Cleanup vfs & vnode ops * Cleanup vfs & vnode ops
*/ */
zfs_remove_op_tables(); zfs_remove_op_tables();
#endif /* sun */ #endif
/* /*
* Cleanup zcache * Cleanup zcache
@ -378,7 +378,7 @@ zfs_znode_fini(void)
rw_destroy(&zfsvfs_lock); rw_destroy(&zfsvfs_lock);
} }
#ifdef sun #ifdef illumos
struct vnodeops *zfs_dvnodeops; struct vnodeops *zfs_dvnodeops;
struct vnodeops *zfs_fvnodeops; struct vnodeops *zfs_fvnodeops;
struct vnodeops *zfs_symvnodeops; struct vnodeops *zfs_symvnodeops;
@ -470,7 +470,7 @@ zfs_create_op_tables()
return (error); return (error);
} }
#endif /* sun */ #endif /* illumos */
int int
zfs_create_share_dir(zfsvfs_t *zfsvfs, dmu_tx_t *tx) zfs_create_share_dir(zfsvfs_t *zfsvfs, dmu_tx_t *tx)
@ -689,7 +689,7 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz,
case VDIR: case VDIR:
zp->z_zn_prefetch = B_TRUE; /* z_prefetch default is enabled */ zp->z_zn_prefetch = B_TRUE; /* z_prefetch default is enabled */
break; break;
#ifdef sun #ifdef illumos
case VBLK: case VBLK:
case VCHR: case VCHR:
{ {
@ -700,12 +700,12 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz,
vp->v_rdev = zfs_cmpldev(rdev); vp->v_rdev = zfs_cmpldev(rdev);
} }
break; break;
#endif /* sun */ #endif
case VFIFO: case VFIFO:
#ifdef sun #ifdef illumos
case VSOCK: case VSOCK:
case VDOOR: case VDOOR:
#endif /* sun */ #endif
vp->v_op = &zfs_fifoops; vp->v_op = &zfs_fifoops;
break; break;
case VREG: case VREG:
@ -714,14 +714,14 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz,
vp->v_op = &zfs_shareops; vp->v_op = &zfs_shareops;
} }
break; break;
#ifdef sun #ifdef illumos
case VLNK: case VLNK:
vn_setops(vp, zfs_symvnodeops); vn_setops(vp, zfs_symvnodeops);
break; break;
default: default:
vn_setops(vp, zfs_evnodeops); vn_setops(vp, zfs_evnodeops);
break; break;
#endif /* sun */ #endif
} }
mutex_enter(&zfsvfs->z_znodes_lock); mutex_enter(&zfsvfs->z_znodes_lock);
@ -1490,7 +1490,7 @@ zfs_grow_blocksize(znode_t *zp, uint64_t size, dmu_tx_t *tx)
dmu_object_size_from_db(sa_get_db(zp->z_sa_hdl), &zp->z_blksz, &dummy); dmu_object_size_from_db(sa_get_db(zp->z_sa_hdl), &zp->z_blksz, &dummy);
} }
#ifdef sun #ifdef illumos
/* /*
* This is a dummy interface used when pvn_vplist_dirty() should *not* * This is a dummy interface used when pvn_vplist_dirty() should *not*
* be calling back into the fs for a putpage(). E.g.: when truncating * be calling back into the fs for a putpage(). E.g.: when truncating
@ -1504,7 +1504,7 @@ zfs_no_putpage(vnode_t *vp, page_t *pp, u_offset_t *offp, size_t *lenp,
ASSERT(0); ASSERT(0);
return (0); return (0);
} }
#endif /* sun */ #endif
/* /*
* Increase the file length * Increase the file length

View File

@ -368,7 +368,7 @@ callb_unlock_table(void)
mutex_exit(&ct->ct_lock); mutex_exit(&ct->ct_lock);
} }
#ifdef sun #ifdef illumos
/* /*
* Return a boolean value indicating whether a particular kernel thread is * Return a boolean value indicating whether a particular kernel thread is
* stopped in accordance with the cpr callback protocol. If returning * stopped in accordance with the cpr callback protocol. If returning
@ -432,7 +432,7 @@ callb_is_stopped(kthread_id_t tp, caddr_t *thread_name)
mutex_exit(&ct->ct_lock); mutex_exit(&ct->ct_lock);
return (ret_val); return (ret_val);
} }
#endif /* sun */ #endif /* illumos */
SYSINIT(sol_callb, SI_SUB_DRIVERS, SI_ORDER_FIRST, callb_init, NULL); SYSINIT(sol_callb, SI_SUB_DRIVERS, SI_ORDER_FIRST, callb_init, NULL);
SYSUNINIT(sol_callb, SI_SUB_DRIVERS, SI_ORDER_FIRST, callb_fini, NULL); SYSUNINIT(sol_callb, SI_SUB_DRIVERS, SI_ORDER_FIRST, callb_fini, NULL);

View File

@ -79,7 +79,7 @@ static const char *fm_url = "http://www.sun.com/msg";
static const char *fm_msgid = "SUNOS-8000-0G"; static const char *fm_msgid = "SUNOS-8000-0G";
static char *volatile fm_panicstr = NULL; static char *volatile fm_panicstr = NULL;
#ifdef sun #ifdef illumos
errorq_t *ereport_errorq; errorq_t *ereport_errorq;
#endif #endif
void *ereport_dumpbuf; void *ereport_dumpbuf;
@ -112,7 +112,7 @@ static struct erpt_kstat erpt_kstat_data = {
{ "payload-set-failed", KSTAT_DATA_UINT64 } { "payload-set-failed", KSTAT_DATA_UINT64 }
}; };
#ifdef sun #ifdef illumos
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
fm_drain(void *private, void *data, errorq_elem_t *eep) fm_drain(void *private, void *data, errorq_elem_t *eep)
@ -131,7 +131,7 @@ fm_init(void)
{ {
kstat_t *ksp; kstat_t *ksp;
#ifdef sun #ifdef illumos
(void) sysevent_evc_bind(FM_ERROR_CHAN, (void) sysevent_evc_bind(FM_ERROR_CHAN,
&ereport_chan, EVCH_CREAT | EVCH_HOLD_PEND); &ereport_chan, EVCH_CREAT | EVCH_HOLD_PEND);
@ -145,7 +145,7 @@ fm_init(void)
if (ereport_size == 0) if (ereport_size == 0)
ereport_size = ERPT_DATA_SZ; ereport_size = ERPT_DATA_SZ;
#ifdef sun #ifdef illumos
ereport_errorq = errorq_nvcreate("fm_ereport_queue", ereport_errorq = errorq_nvcreate("fm_ereport_queue",
(errorq_func_t)fm_drain, NULL, ereport_qlen, ereport_size, (errorq_func_t)fm_drain, NULL, ereport_qlen, ereport_size,
FM_ERR_PIL, ERRORQ_VITAL); FM_ERR_PIL, ERRORQ_VITAL);
@ -170,7 +170,7 @@ fm_init(void)
} }
} }
#ifdef sun #ifdef illumos
/* /*
* Formatting utility function for fm_nvprintr. We attempt to wrap chunks of * Formatting utility function for fm_nvprintr. We attempt to wrap chunks of
* output so they aren't split across console lines, and return the end column. * output so they aren't split across console lines, and return the end column.
@ -528,7 +528,7 @@ fm_ereport_post(nvlist_t *ereport, int evc_flag)
return; return;
} }
#ifdef sun #ifdef illumos
if (sysevent_evc_bind(FM_ERROR_CHAN, &error_chan, if (sysevent_evc_bind(FM_ERROR_CHAN, &error_chan,
EVCH_CREAT|EVCH_HOLD_PEND) != 0) { EVCH_CREAT|EVCH_HOLD_PEND) != 0) {
atomic_inc_64(&erpt_kstat_data.erpt_dropped.value.ui64); atomic_inc_64(&erpt_kstat_data.erpt_dropped.value.ui64);
@ -1262,7 +1262,7 @@ fm_ena_time_get(uint64_t ena)
return (time); return (time);
} }
#ifdef sun #ifdef illumos
/* /*
* Convert a getpcstack() trace to symbolic name+offset, and add the resulting * Convert a getpcstack() trace to symbolic name+offset, and add the resulting
* string array to a Fault Management ereport as FM_EREPORT_PAYLOAD_NAME_STACK. * string array to a Fault Management ereport as FM_EREPORT_PAYLOAD_NAME_STACK.
@ -1290,7 +1290,7 @@ fm_payload_stack_add(nvlist_t *payload, const pc_t *stack, int depth)
} }
#endif #endif
#ifdef sun #ifdef illumos
void void
print_msg_hwerr(ctid_t ct_id, proc_t *p) print_msg_hwerr(ctid_t ct_id, proc_t *p)
{ {

View File

@ -27,7 +27,7 @@
#ifndef _CTF_H #ifndef _CTF_H
#define _CTF_H #define _CTF_H
#if defined(sun) #ifdef illumos
#pragma ident "%Z%%M% %I% %E% SMI" #pragma ident "%Z%%M% %I% %E% SMI"
#endif #endif

View File

@ -69,7 +69,7 @@ typedef struct ctf_sect {
const char *cts_name; /* section name (if any) */ const char *cts_name; /* section name (if any) */
ulong_t cts_type; /* section type (ELF SHT_... value) */ ulong_t cts_type; /* section type (ELF SHT_... value) */
ulong_t cts_flags; /* section flags (ELF SHF_... value) */ ulong_t cts_flags; /* section flags (ELF SHF_... value) */
#if defined(sun) #ifdef illumos
const void *cts_data; /* pointer to section data */ const void *cts_data; /* pointer to section data */
#else #else
void *cts_data; /* pointer to section data */ void *cts_data; /* pointer to section data */

View File

@ -54,7 +54,7 @@ extern "C" {
#include <sys/types.h> #include <sys/types.h>
#include <sys/modctl.h> #include <sys/modctl.h>
#include <sys/processor.h> #include <sys/processor.h>
#if defined(sun) #ifdef illumos
#include <sys/systm.h> #include <sys/systm.h>
#else #else
#include <sys/cpuvar.h> #include <sys/cpuvar.h>
@ -65,7 +65,7 @@ extern "C" {
typedef int model_t; typedef int model_t;
#endif #endif
#include <sys/ctf_api.h> #include <sys/ctf_api.h>
#if defined(sun) #ifdef illumos
#include <sys/cyclic.h> #include <sys/cyclic.h>
#include <sys/int_limits.h> #include <sys/int_limits.h>
#else #else
@ -257,7 +257,7 @@ typedef enum dtrace_probespec {
#define DIF_VAR_ERRNO 0x0120 /* thread errno */ #define DIF_VAR_ERRNO 0x0120 /* thread errno */
#define DIF_VAR_EXECARGS 0x0121 /* process arguments */ #define DIF_VAR_EXECARGS 0x0121 /* process arguments */
#if !defined(sun) #ifndef illumos
#define DIF_VAR_CPU 0x0200 #define DIF_VAR_CPU 0x0200
#endif #endif
@ -1277,7 +1277,7 @@ typedef struct dtrace_providerdesc {
* pseudodevice driver. These ioctls comprise the user-kernel interface to * pseudodevice driver. These ioctls comprise the user-kernel interface to
* DTrace. * DTrace.
*/ */
#if defined(sun) #ifdef illumos
#define DTRACEIOC (('d' << 24) | ('t' << 16) | ('r' << 8)) #define DTRACEIOC (('d' << 24) | ('t' << 16) | ('r' << 8))
#define DTRACEIOC_PROVIDER (DTRACEIOC | 1) /* provider query */ #define DTRACEIOC_PROVIDER (DTRACEIOC | 1) /* provider query */
#define DTRACEIOC_PROBES (DTRACEIOC | 2) /* probe query */ #define DTRACEIOC_PROBES (DTRACEIOC | 2) /* probe query */
@ -1408,7 +1408,7 @@ typedef struct {
* helpers and should no longer be used. No other ioctls are valid on the * helpers and should no longer be used. No other ioctls are valid on the
* helper minor node. * helper minor node.
*/ */
#if defined(sun) #ifdef illumos
#define DTRACEHIOC (('d' << 24) | ('t' << 16) | ('h' << 8)) #define DTRACEHIOC (('d' << 24) | ('t' << 16) | ('h' << 8))
#define DTRACEHIOC_ADD (DTRACEHIOC | 1) /* add helper */ #define DTRACEHIOC_ADD (DTRACEHIOC | 1) /* add helper */
#define DTRACEHIOC_REMOVE (DTRACEHIOC | 2) /* remove helper */ #define DTRACEHIOC_REMOVE (DTRACEHIOC | 2) /* remove helper */
@ -1423,7 +1423,7 @@ typedef struct dof_helper {
char dofhp_mod[DTRACE_MODNAMELEN]; /* executable or library name */ char dofhp_mod[DTRACE_MODNAMELEN]; /* executable or library name */
uint64_t dofhp_addr; /* base address of object */ uint64_t dofhp_addr; /* base address of object */
uint64_t dofhp_dof; /* address of helper DOF */ uint64_t dofhp_dof; /* address of helper DOF */
#if !defined(sun) #ifndef illumos
int gen; int gen;
#endif #endif
} dof_helper_t; } dof_helper_t;
@ -2325,7 +2325,7 @@ typedef enum dtrace_vtime_state {
DTRACE_VTIME_ACTIVE_TNF /* DTrace virtual time _and_ TNF */ DTRACE_VTIME_ACTIVE_TNF /* DTrace virtual time _and_ TNF */
} dtrace_vtime_state_t; } dtrace_vtime_state_t;
#if defined(sun) #ifdef illumos
extern dtrace_vtime_state_t dtrace_vtime_active; extern dtrace_vtime_state_t dtrace_vtime_active;
#endif #endif
extern void dtrace_vtime_switch(kthread_t *next); extern void dtrace_vtime_switch(kthread_t *next);
@ -2337,7 +2337,7 @@ extern void dtrace_vtime_disable(void);
struct regs; struct regs;
struct reg; struct reg;
#if defined(sun) #ifdef illumos
extern int (*dtrace_pid_probe_ptr)(struct reg *); extern int (*dtrace_pid_probe_ptr)(struct reg *);
extern int (*dtrace_return_probe_ptr)(struct reg *); extern int (*dtrace_return_probe_ptr)(struct reg *);
extern void (*dtrace_fasttrap_fork_ptr)(proc_t *, proc_t *); extern void (*dtrace_fasttrap_fork_ptr)(proc_t *, proc_t *);
@ -2356,7 +2356,7 @@ extern void dtrace_membar_producer(void);
extern void dtrace_membar_consumer(void); extern void dtrace_membar_consumer(void);
extern void (*dtrace_cpu_init)(processorid_t); extern void (*dtrace_cpu_init)(processorid_t);
#if defined(sun) #ifdef illumos
extern void (*dtrace_modload)(modctl_t *); extern void (*dtrace_modload)(modctl_t *);
extern void (*dtrace_modunload)(modctl_t *); extern void (*dtrace_modunload)(modctl_t *);
#endif #endif
@ -2370,7 +2370,7 @@ extern void (*dtrace_debugger_init)(void);
extern void (*dtrace_debugger_fini)(void); extern void (*dtrace_debugger_fini)(void);
extern dtrace_cacheid_t dtrace_predcache_id; extern dtrace_cacheid_t dtrace_predcache_id;
#if defined(sun) #ifdef illumos
extern hrtime_t dtrace_gethrtime(void); extern hrtime_t dtrace_gethrtime(void);
#else #else
void dtrace_debug_printf(const char *, ...) __printflike(1, 2); void dtrace_debug_printf(const char *, ...) __printflike(1, 2);
@ -2399,7 +2399,7 @@ extern int dtrace_blksuword32(uintptr_t, uint32_t *, int);
extern void dtrace_getfsr(uint64_t *); extern void dtrace_getfsr(uint64_t *);
#endif #endif
#if !defined(sun) #ifndef illumos
extern void dtrace_helpers_duplicate(proc_t *, proc_t *); extern void dtrace_helpers_duplicate(proc_t *, proc_t *);
extern void dtrace_helpers_destroy(proc_t *); extern void dtrace_helpers_destroy(proc_t *);
#endif #endif

View File

@ -50,7 +50,7 @@ extern "C" {
*/ */
#include <sys/dtrace.h> #include <sys/dtrace.h>
#if !defined(sun) #ifndef illumos
#ifdef __sparcv9 #ifdef __sparcv9
typedef uint32_t pc_t; typedef uint32_t pc_t;
#else #else
@ -1122,7 +1122,7 @@ typedef struct dtrace_cred {
* dtrace_state structure. * dtrace_state structure.
*/ */
struct dtrace_state { struct dtrace_state {
#if defined(sun) #ifdef illumos
dev_t dts_dev; /* device */ dev_t dts_dev; /* device */
#else #else
struct cdev *dts_dev; /* device */ struct cdev *dts_dev; /* device */
@ -1140,7 +1140,7 @@ struct dtrace_state {
int dts_nspeculations; /* number of speculations */ int dts_nspeculations; /* number of speculations */
int dts_naggregations; /* number of aggregations */ int dts_naggregations; /* number of aggregations */
dtrace_aggregation_t **dts_aggregations; /* aggregation array */ dtrace_aggregation_t **dts_aggregations; /* aggregation array */
#if defined(sun) #ifdef illumos
vmem_t *dts_aggid_arena; /* arena for aggregation IDs */ vmem_t *dts_aggid_arena; /* arena for aggregation IDs */
#else #else
struct unrhdr *dts_aggid_arena; /* arena for aggregation IDs */ struct unrhdr *dts_aggid_arena; /* arena for aggregation IDs */
@ -1152,7 +1152,7 @@ struct dtrace_state {
uint32_t dts_dblerrors; /* errors in ERROR probes */ uint32_t dts_dblerrors; /* errors in ERROR probes */
uint32_t dts_reserve; /* space reserved for END */ uint32_t dts_reserve; /* space reserved for END */
hrtime_t dts_laststatus; /* time of last status */ hrtime_t dts_laststatus; /* time of last status */
#if defined(sun) #ifdef illumos
cyclic_id_t dts_cleaner; /* cleaning cyclic */ cyclic_id_t dts_cleaner; /* cleaning cyclic */
cyclic_id_t dts_deadman; /* deadman cyclic */ cyclic_id_t dts_deadman; /* deadman cyclic */
#else #else
@ -1270,7 +1270,7 @@ typedef struct dtrace_toxrange {
uintptr_t dtt_limit; /* limit of toxic range */ uintptr_t dtt_limit; /* limit of toxic range */
} dtrace_toxrange_t; } dtrace_toxrange_t;
#if defined(sun) #ifdef illumos
extern uint64_t dtrace_getarg(int, int); extern uint64_t dtrace_getarg(int, int);
#else #else
extern uint64_t __noinline dtrace_getarg(int, int); extern uint64_t __noinline dtrace_getarg(int, int);
@ -1300,7 +1300,7 @@ extern void dtrace_probe_error(dtrace_state_t *, dtrace_epid_t, int, int,
int, uintptr_t); int, uintptr_t);
extern int dtrace_assfail(const char *, const char *, int); extern int dtrace_assfail(const char *, const char *, int);
extern int dtrace_attached(void); extern int dtrace_attached(void);
#if defined(sun) #ifdef illumos
extern hrtime_t dtrace_gethrestime(void); extern hrtime_t dtrace_gethrestime(void);
#endif #endif

View File

@ -37,7 +37,7 @@
extern "C" { extern "C" {
#endif #endif
#if defined(sun) #ifdef illumos
#define FASTTRAPIOC (('m' << 24) | ('r' << 16) | ('f' << 8)) #define FASTTRAPIOC (('m' << 24) | ('r' << 16) | ('f' << 8))
#define FASTTRAPIOC_MAKEPROBE (FASTTRAPIOC | 1) #define FASTTRAPIOC_MAKEPROBE (FASTTRAPIOC | 1)
#define FASTTRAPIOC_GETINSTR (FASTTRAPIOC | 2) #define FASTTRAPIOC_GETINSTR (FASTTRAPIOC | 2)

View File

@ -79,7 +79,7 @@ extern "C" {
* until it exits. * until it exits.
*/ */
#if !defined(sun) #ifndef illumos
typedef struct fasttrap_scrblock { typedef struct fasttrap_scrblock {
vm_offset_t ftsb_addr; /* address of a scratch block */ vm_offset_t ftsb_addr; /* address of a scratch block */
LIST_ENTRY(fasttrap_scrblock) ftsb_next;/* next block in list */ LIST_ENTRY(fasttrap_scrblock) ftsb_next;/* next block in list */
@ -99,7 +99,7 @@ typedef struct fasttrap_proc {
uint64_t ftpc_rcount; /* count of extant providers */ uint64_t ftpc_rcount; /* count of extant providers */
kmutex_t ftpc_mtx; /* lock on all but acount */ kmutex_t ftpc_mtx; /* lock on all but acount */
struct fasttrap_proc *ftpc_next; /* next proc in hash chain */ struct fasttrap_proc *ftpc_next; /* next proc in hash chain */
#if !defined(sun) #ifndef illumos
LIST_HEAD(, fasttrap_scrblock) ftpc_scrblks; /* mapped scratch blocks */ LIST_HEAD(, fasttrap_scrblock) ftpc_scrblks; /* mapped scratch blocks */
LIST_HEAD(, fasttrap_scrspace) ftpc_fscr; /* free scratch space */ LIST_HEAD(, fasttrap_scrspace) ftpc_fscr; /* free scratch space */
LIST_HEAD(, fasttrap_scrspace) ftpc_ascr; /* used scratch space */ LIST_HEAD(, fasttrap_scrspace) ftpc_ascr; /* used scratch space */
@ -198,7 +198,7 @@ typedef struct fasttrap_hash {
#endif #endif
extern void fasttrap_sigtrap(proc_t *, kthread_t *, uintptr_t); extern void fasttrap_sigtrap(proc_t *, kthread_t *, uintptr_t);
#if !defined(sun) #ifndef illumos
extern fasttrap_scrspace_t *fasttrap_scraddr(struct thread *, extern fasttrap_scrspace_t *fasttrap_scraddr(struct thread *,
fasttrap_proc_t *); fasttrap_proc_t *);
#endif #endif

View File

@ -235,7 +235,7 @@ extern "C" {
/* /*
* Define the appropriate "processor characteristics" * Define the appropriate "processor characteristics"
*/ */
#if defined(sun) #ifdef illumos
#define _LITTLE_ENDIAN #define _LITTLE_ENDIAN
#endif #endif
#define _STACK_GROWS_DOWNWARD #define _STACK_GROWS_DOWNWARD
@ -302,7 +302,7 @@ extern "C" {
/* /*
* Define the appropriate "processor characteristics" * Define the appropriate "processor characteristics"
*/ */
#if defined(sun) #ifdef illumos
#define _LITTLE_ENDIAN #define _LITTLE_ENDIAN
#endif #endif
#define _STACK_GROWS_DOWNWARD #define _STACK_GROWS_DOWNWARD
@ -508,7 +508,7 @@ extern "C" {
* Define the appropriate "processor characteristics" shared between * Define the appropriate "processor characteristics" shared between
* all Solaris on SPARC systems. * all Solaris on SPARC systems.
*/ */
#if defined(sun) #ifdef illumos
#define _BIG_ENDIAN #define _BIG_ENDIAN
#endif #endif
#define _STACK_GROWS_DOWNWARD #define _STACK_GROWS_DOWNWARD

View File

@ -143,7 +143,7 @@ typedef struct procset {
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
#if defined(sun) #ifdef illumos
#ifdef _KERNEL #ifdef _KERNEL
struct proc; struct proc;

View File

@ -214,7 +214,7 @@ typedef struct sysevent_value {
#define EVCH_SET_CHAN_LEN 3 /* Set event queue length */ #define EVCH_SET_CHAN_LEN 3 /* Set event queue length */
#define EVCH_CMD_LAST EVCH_SET_CHAN_LEN /* Last command */ #define EVCH_CMD_LAST EVCH_SET_CHAN_LEN /* Last command */
#ifdef sun #ifdef illumos
/* /*
* Shared user/kernel event channel interface definitions * Shared user/kernel event channel interface definitions
*/ */
@ -228,11 +228,11 @@ extern int sysevent_evc_publish(evchan_t *, const char *, const char *,
extern int sysevent_evc_control(evchan_t *, int, ...); extern int sysevent_evc_control(evchan_t *, int, ...);
extern int sysevent_evc_setpropnvl(evchan_t *, nvlist_t *); extern int sysevent_evc_setpropnvl(evchan_t *, nvlist_t *);
extern int sysevent_evc_getpropnvl(evchan_t *, nvlist_t **); extern int sysevent_evc_getpropnvl(evchan_t *, nvlist_t **);
#endif /* sun */ #endif /* illumos */
#ifndef _KERNEL #ifndef _KERNEL
#ifdef sun #ifdef illumos
/* /*
* Userland-only event channel interfaces * Userland-only event channel interfaces
*/ */
@ -254,7 +254,7 @@ extern void sysevent_subattr_thrsetup(sysevent_subattr_t *,
extern int sysevent_evc_xsubscribe(evchan_t *, const char *, const char *, extern int sysevent_evc_xsubscribe(evchan_t *, const char *, const char *,
int (*)(sysevent_t *, void *), void *, uint32_t, sysevent_subattr_t *); int (*)(sysevent_t *, void *), void *, uint32_t, sysevent_subattr_t *);
#endif /* sun */ #endif /* illumos */
#else #else
@ -270,7 +270,7 @@ extern int sysevent_add_attr(sysevent_attr_list_t **, char *,
extern void sysevent_free_attr(sysevent_attr_list_t *); extern void sysevent_free_attr(sysevent_attr_list_t *);
extern int sysevent_attach_attributes(sysevent_t *, sysevent_attr_list_t *); extern int sysevent_attach_attributes(sysevent_t *, sysevent_attr_list_t *);
extern void sysevent_detach_attributes(sysevent_t *); extern void sysevent_detach_attributes(sysevent_t *);
#ifdef sun #ifdef illumos
extern char *sysevent_get_class_name(sysevent_t *); extern char *sysevent_get_class_name(sysevent_t *);
extern char *sysevent_get_subclass_name(sysevent_t *); extern char *sysevent_get_subclass_name(sysevent_t *);
extern uint64_t sysevent_get_seq(sysevent_t *); extern uint64_t sysevent_get_seq(sysevent_t *);
@ -278,7 +278,7 @@ extern void sysevent_get_time(sysevent_t *, hrtime_t *);
extern size_t sysevent_get_size(sysevent_t *); extern size_t sysevent_get_size(sysevent_t *);
extern char *sysevent_get_pub(sysevent_t *); extern char *sysevent_get_pub(sysevent_t *);
extern int sysevent_get_attr_list(sysevent_t *, nvlist_t **); extern int sysevent_get_attr_list(sysevent_t *, nvlist_t **);
#endif /* sun */ #endif /* illumos */
#endif /* _KERNEL */ #endif /* _KERNEL */

View File

@ -112,7 +112,7 @@ extern unsigned char bcd_to_byte[256];
#define L_MAXMIN L_MAXMIN32 #define L_MAXMIN L_MAXMIN32
#endif #endif
#ifdef sun #ifdef illumos
#ifdef _KERNEL #ifdef _KERNEL
/* major part of a device internal to the kernel */ /* major part of a device internal to the kernel */
@ -172,7 +172,7 @@ extern unsigned char bcd_to_byte[256];
#define getemajor(x) (major_t)((((dev_t)(x) >> L_BITSMINOR) > L_MAXMAJ) ? \ #define getemajor(x) (major_t)((((dev_t)(x) >> L_BITSMINOR) > L_MAXMAJ) ? \
NODEV : (((dev_t)(x) >> L_BITSMINOR) & L_MAXMAJ)) NODEV : (((dev_t)(x) >> L_BITSMINOR) & L_MAXMAJ))
#define geteminor(x) (minor_t)((x) & L_MAXMIN) #define geteminor(x) (minor_t)((x) & L_MAXMIN)
#endif /* sun */ #endif /* illumos */
/* /*
* These are versions of the kernel routines for compressing and * These are versions of the kernel routines for compressing and

View File

@ -36,7 +36,7 @@
extern "C" { extern "C" {
#endif #endif
#ifdef sun #ifdef illumos
/* /*
* Unicode encoding conversion functions and their macros. * Unicode encoding conversion functions and their macros.
*/ */
@ -58,7 +58,7 @@ extern int uconv_u32tou16(const uint32_t *, size_t *, uint16_t *, size_t *,
extern int uconv_u32tou8(const uint32_t *, size_t *, uchar_t *, size_t *, int); extern int uconv_u32tou8(const uint32_t *, size_t *, uchar_t *, size_t *, int);
extern int uconv_u8tou16(const uchar_t *, size_t *, uint16_t *, size_t *, int); extern int uconv_u8tou16(const uchar_t *, size_t *, uint16_t *, size_t *, int);
extern int uconv_u8tou32(const uchar_t *, size_t *, uint32_t *, size_t *, int); extern int uconv_u8tou32(const uchar_t *, size_t *, uint32_t *, size_t *, int);
#endif /* sun */ #endif /* illumos */
/* /*
* UTF-8 text preparation functions and their macros. * UTF-8 text preparation functions and their macros.

View File

@ -28,7 +28,7 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
#if defined(sun) #ifdef illumos
#pragma ident "%Z%%M% %I% %E% SMI" #pragma ident "%Z%%M% %I% %E% SMI"
#endif #endif
@ -37,7 +37,7 @@
#include <sys/dtrace.h> #include <sys/dtrace.h>
#include <sys/dtrace_impl.h> #include <sys/dtrace_impl.h>
#include <sys/cmn_err.h> #include <sys/cmn_err.h>
#if defined(sun) #ifdef illumos
#include <sys/regset.h> #include <sys/regset.h>
#include <sys/privregs.h> #include <sys/privregs.h>
#include <sys/segments.h> #include <sys/segments.h>
@ -53,7 +53,7 @@
#include <machine/pcb.h> #include <machine/pcb.h>
#endif #endif
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#if defined(sun) #ifdef illumos
#include <sys/trap.h> #include <sys/trap.h>
#include <sys/archsystm.h> #include <sys/archsystm.h>
#else #else
@ -97,7 +97,7 @@ uwrite(proc_t *p, void *kaddr, size_t len, uintptr_t uaddr)
return (proc_ops(UIO_WRITE, p, kaddr, uaddr, len)); return (proc_ops(UIO_WRITE, p, kaddr, uaddr, len));
} }
#endif /* sun */ #endif /* illumos */
#ifdef __i386__ #ifdef __i386__
#define r_rax r_eax #define r_rax r_eax
#define r_rbx r_ebx #define r_rbx r_ebx
@ -747,11 +747,11 @@ fasttrap_return_common(struct reg *rp, uintptr_t pc, pid_t pid,
fasttrap_tracepoint_t *tp; fasttrap_tracepoint_t *tp;
fasttrap_bucket_t *bucket; fasttrap_bucket_t *bucket;
fasttrap_id_t *id; fasttrap_id_t *id;
#if defined(sun) #ifdef illumos
kmutex_t *pid_mtx; kmutex_t *pid_mtx;
#endif #endif
#if defined(sun) #ifdef illumos
pid_mtx = &cpu_core[CPU->cpu_id].cpuc_pid_lock; pid_mtx = &cpu_core[CPU->cpu_id].cpuc_pid_lock;
mutex_enter(pid_mtx); mutex_enter(pid_mtx);
#endif #endif
@ -769,7 +769,7 @@ fasttrap_return_common(struct reg *rp, uintptr_t pc, pid_t pid,
* is not essential to the correct execution of the process. * is not essential to the correct execution of the process.
*/ */
if (tp == NULL) { if (tp == NULL) {
#if defined(sun) #ifdef illumos
mutex_exit(pid_mtx); mutex_exit(pid_mtx);
#endif #endif
return; return;
@ -792,7 +792,7 @@ fasttrap_return_common(struct reg *rp, uintptr_t pc, pid_t pid,
rp->r_rax, rp->r_rbx, 0, 0); rp->r_rax, rp->r_rbx, 0, 0);
} }
#if defined(sun) #ifdef illumos
mutex_exit(pid_mtx); mutex_exit(pid_mtx);
#endif #endif
} }
@ -800,7 +800,7 @@ fasttrap_return_common(struct reg *rp, uintptr_t pc, pid_t pid,
static void static void
fasttrap_sigsegv(proc_t *p, kthread_t *t, uintptr_t addr) fasttrap_sigsegv(proc_t *p, kthread_t *t, uintptr_t addr)
{ {
#if defined(sun) #ifdef illumos
sigqueue_t *sqp = kmem_zalloc(sizeof (sigqueue_t), KM_SLEEP); sigqueue_t *sqp = kmem_zalloc(sizeof (sigqueue_t), KM_SLEEP);
sqp->sq_info.si_signo = SIGSEGV; sqp->sq_info.si_signo = SIGSEGV;
@ -1001,13 +1001,13 @@ int
fasttrap_pid_probe(struct reg *rp) fasttrap_pid_probe(struct reg *rp)
{ {
proc_t *p = curproc; proc_t *p = curproc;
#if !defined(sun) #ifndef illumos
proc_t *pp; proc_t *pp;
#endif #endif
uintptr_t pc = rp->r_rip - 1; uintptr_t pc = rp->r_rip - 1;
uintptr_t new_pc = 0; uintptr_t new_pc = 0;
fasttrap_bucket_t *bucket; fasttrap_bucket_t *bucket;
#if defined(sun) #ifdef illumos
kmutex_t *pid_mtx; kmutex_t *pid_mtx;
#endif #endif
fasttrap_tracepoint_t *tp, tp_local; fasttrap_tracepoint_t *tp, tp_local;
@ -1044,7 +1044,7 @@ fasttrap_pid_probe(struct reg *rp)
* parent. We know that there's only one thread of control in such a * parent. We know that there's only one thread of control in such a
* process: this one. * process: this one.
*/ */
#if defined(sun) #ifdef illumos
while (p->p_flag & SVFORK) { while (p->p_flag & SVFORK) {
p = p->p_parent; p = p->p_parent;
} }
@ -1082,7 +1082,7 @@ fasttrap_pid_probe(struct reg *rp)
* fasttrap_ioctl), or somehow we have mislaid this tracepoint. * fasttrap_ioctl), or somehow we have mislaid this tracepoint.
*/ */
if (tp == NULL) { if (tp == NULL) {
#if defined(sun) #ifdef illumos
mutex_exit(pid_mtx); mutex_exit(pid_mtx);
#else #else
_PRELE(p); _PRELE(p);
@ -1209,7 +1209,7 @@ fasttrap_pid_probe(struct reg *rp)
* tracepoint again later if we need to light up any return probes. * tracepoint again later if we need to light up any return probes.
*/ */
tp_local = *tp; tp_local = *tp;
#if defined(sun) #ifdef illumos
mutex_exit(pid_mtx); mutex_exit(pid_mtx);
#else #else
PROC_UNLOCK(p); PROC_UNLOCK(p);
@ -1537,7 +1537,7 @@ fasttrap_pid_probe(struct reg *rp)
uint8_t scratch[2 * FASTTRAP_MAX_INSTR_SIZE + 7]; uint8_t scratch[2 * FASTTRAP_MAX_INSTR_SIZE + 7];
#endif #endif
uint_t i = 0; uint_t i = 0;
#if defined(sun) #ifdef illumos
klwp_t *lwp = ttolwp(curthread); klwp_t *lwp = ttolwp(curthread);
/* /*
@ -1558,7 +1558,7 @@ fasttrap_pid_probe(struct reg *rp)
addr = USD_GETBASE(&lwp->lwp_pcb.pcb_gsdesc); addr = USD_GETBASE(&lwp->lwp_pcb.pcb_gsdesc);
addr += sizeof (void *); addr += sizeof (void *);
#endif #endif
#else #else /* !illumos */
fasttrap_scrspace_t *scrspace; fasttrap_scrspace_t *scrspace;
scrspace = fasttrap_scraddr(curthread, tp->ftt_proc); scrspace = fasttrap_scraddr(curthread, tp->ftt_proc);
if (scrspace == NULL) { if (scrspace == NULL) {
@ -1574,7 +1574,7 @@ fasttrap_pid_probe(struct reg *rp)
break; break;
} }
addr = scrspace->ftss_addr; addr = scrspace->ftss_addr;
#endif /* sun */ #endif /* illumos */
/* /*
* Generic Instruction Tracing * Generic Instruction Tracing
@ -1760,7 +1760,7 @@ fasttrap_pid_probe(struct reg *rp)
ASSERT(i <= sizeof (scratch)); ASSERT(i <= sizeof (scratch));
#if defined(sun) #ifdef illumos
if (fasttrap_copyout(scratch, (char *)addr, i)) { if (fasttrap_copyout(scratch, (char *)addr, i)) {
#else #else
if (uwrite(p, scratch, i, addr)) { if (uwrite(p, scratch, i, addr)) {
@ -1822,7 +1822,7 @@ done:
rp->r_rip = new_pc; rp->r_rip = new_pc;
#if !defined(sun) #ifndef illumos
PROC_LOCK(p); PROC_LOCK(p);
proc_write_regs(curthread, rp); proc_write_regs(curthread, rp);
_PRELE(p); _PRELE(p);
@ -1844,7 +1844,7 @@ fasttrap_return_probe(struct reg *rp)
curthread->t_dtrace_scrpc = 0; curthread->t_dtrace_scrpc = 0;
curthread->t_dtrace_astpc = 0; curthread->t_dtrace_astpc = 0;
#if defined(sun) #ifdef illumos
/* /*
* Treat a child created by a call to vfork(2) as if it were its * Treat a child created by a call to vfork(2) as if it were its
* parent. We know that there's only one thread of control in such a * parent. We know that there's only one thread of control in such a
@ -1917,7 +1917,7 @@ fasttrap_getreg(struct reg *rp, uint_t reg)
case REG_ERR: return (rp->r_err); case REG_ERR: return (rp->r_err);
case REG_RIP: return (rp->r_rip); case REG_RIP: return (rp->r_rip);
case REG_CS: return (rp->r_cs); case REG_CS: return (rp->r_cs);
#if defined(sun) #ifdef illumos
case REG_RFL: return (rp->r_rfl); case REG_RFL: return (rp->r_rfl);
#endif #endif
case REG_RSP: return (rp->r_rsp); case REG_RSP: return (rp->r_rsp);

View File

@ -30,14 +30,14 @@
/* All Rights Reserved */ /* All Rights Reserved */
#if defined(sun) #ifdef illumos
#pragma ident "@(#)instr_size.c 1.14 05/07/08 SMI" #pragma ident "@(#)instr_size.c 1.14 05/07/08 SMI"
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/proc.h> #include <sys/proc.h>
#if defined(sun) #ifdef illumos
#include <sys/cmn_err.h> #include <sys/cmn_err.h>
#include <sys/archsystm.h> #include <sys/archsystm.h>
#include <sys/copyops.h> #include <sys/copyops.h>
@ -104,7 +104,7 @@ dtrace_dis_isize(uchar_t *instr, dis_isize_t which, model_t model, int *rmindex)
dis86_t x; dis86_t x;
uint_t mode = SIZE64; uint_t mode = SIZE64;
#if defined(sun) #ifdef illumos
mode = (model == DATAMODEL_LP64) ? SIZE64 : SIZE32; mode = (model == DATAMODEL_LP64) ? SIZE64 : SIZE32;
#endif #endif

View File

@ -578,14 +578,14 @@ dtrace_ioctl(struct cdev *dev, u_long cmd, caddr_t addr,
return (EINVAL); return (EINVAL);
mutex_enter(&dtrace_provider_lock); mutex_enter(&dtrace_provider_lock);
#if defined(sun) #ifdef illumos
mutex_enter(&mod_lock); mutex_enter(&mod_lock);
#endif #endif
mutex_enter(&dtrace_lock); mutex_enter(&dtrace_lock);
if (desc->dtargd_id > dtrace_nprobes) { if (desc->dtargd_id > dtrace_nprobes) {
mutex_exit(&dtrace_lock); mutex_exit(&dtrace_lock);
#if defined(sun) #ifdef illumos
mutex_exit(&mod_lock); mutex_exit(&mod_lock);
#endif #endif
mutex_exit(&dtrace_provider_lock); mutex_exit(&dtrace_provider_lock);
@ -594,7 +594,7 @@ dtrace_ioctl(struct cdev *dev, u_long cmd, caddr_t addr,
if ((probe = dtrace_probes[desc->dtargd_id - 1]) == NULL) { if ((probe = dtrace_probes[desc->dtargd_id - 1]) == NULL) {
mutex_exit(&dtrace_lock); mutex_exit(&dtrace_lock);
#if defined(sun) #ifdef illumos
mutex_exit(&mod_lock); mutex_exit(&mod_lock);
#endif #endif
mutex_exit(&dtrace_provider_lock); mutex_exit(&dtrace_provider_lock);
@ -620,7 +620,7 @@ dtrace_ioctl(struct cdev *dev, u_long cmd, caddr_t addr,
probe->dtpr_id, probe->dtpr_arg, desc); probe->dtpr_id, probe->dtpr_arg, desc);
} }
#if defined(sun) #ifdef illumos
mutex_exit(&mod_lock); mutex_exit(&mod_lock);
#endif #endif
mutex_exit(&dtrace_provider_lock); mutex_exit(&dtrace_provider_lock);
@ -779,7 +779,7 @@ dtrace_ioctl(struct cdev *dev, u_long cmd, caddr_t addr,
dstate = &state->dts_vstate.dtvs_dynvars; dstate = &state->dts_vstate.dtvs_dynvars;
for (i = 0; i < NCPU; i++) { for (i = 0; i < NCPU; i++) {
#if !defined(sun) #ifndef illumos
if (pcpu_find(i) == NULL) if (pcpu_find(i) == NULL)
continue; continue;
#endif #endif

View File

@ -30,14 +30,14 @@
/* All Rights Reserved */ /* All Rights Reserved */
#if defined(sun) #ifdef illumos
#pragma ident "@(#)instr_size.c 1.14 05/07/08 SMI" #pragma ident "@(#)instr_size.c 1.14 05/07/08 SMI"
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/proc.h> #include <sys/proc.h>
#if defined(sun) #ifdef illumos
#include <sys/cmn_err.h> #include <sys/cmn_err.h>
#include <sys/archsystm.h> #include <sys/archsystm.h>
#include <sys/copyops.h> #include <sys/copyops.h>
@ -104,7 +104,7 @@ dtrace_dis_isize(uchar_t *instr, dis_isize_t which, model_t model, int *rmindex)
dis86_t x; dis86_t x;
uint_t mode = SIZE32; uint_t mode = SIZE32;
#if defined(sun) #ifdef illumos
mode = (model == DATAMODEL_LP64) ? SIZE64 : SIZE32; mode = (model == DATAMODEL_LP64) ? SIZE64 : SIZE32;
#endif #endif

View File

@ -61,7 +61,7 @@ extern "C" {
#define REG_GSBASE 27 #define REG_GSBASE 27
#define REG_FSBASE 26 #define REG_FSBASE 26
#if defined(sun) #ifdef illumos
#define REG_DS 25 #define REG_DS 25
#define REG_ES 24 #define REG_ES 24
@ -89,7 +89,7 @@ extern "C" {
#define REG_R13 2 #define REG_R13 2
#define REG_R14 1 #define REG_R14 1
#define REG_R15 0 #define REG_R15 0
#else #else /* !illumos */
#define REG_SS 25 #define REG_SS 25
#define REG_RSP 24 #define REG_RSP 24
#define REG_RFL 23 #define REG_RFL 23
@ -116,13 +116,13 @@ extern "C" {
#define REG_R13 2 #define REG_R13 2
#define REG_R14 1 #define REG_R14 1
#define REG_R15 0 #define REG_R15 0
#endif #endif /* illumos */
/* /*
* The names and offsets defined here are specified by i386 ABI suppl. * The names and offsets defined here are specified by i386 ABI suppl.
*/ */
#if defined(sun) #ifdef illumos
#define SS 18 /* only stored on a privilege transition */ #define SS 18 /* only stored on a privilege transition */
#define UESP 17 /* only stored on a privilege transition */ #define UESP 17 /* only stored on a privilege transition */
#define EFL 16 #define EFL 16
@ -142,7 +142,7 @@ extern "C" {
#define ES 2 #define ES 2
#define FS 1 #define FS 1
#define GS 0 #define GS 0
#else #else /* !illumos */
#define GS 18 #define GS 18
#define SS 17 /* only stored on a privilege transition */ #define SS 17 /* only stored on a privilege transition */
#define UESP 16 /* only stored on a privilege transition */ #define UESP 16 /* only stored on a privilege transition */
@ -162,7 +162,7 @@ extern "C" {
#define DS 2 #define DS 2
#define ES 1 #define ES 1
#define FS 0 #define FS 0
#endif #endif /* illumos */
#define REG_PC EIP #define REG_PC EIP
#define REG_FP EBP #define REG_FP EBP