Print this page
5383 5234 breaks build on sparc

@@ -24,10 +24,11 @@
  */
 /*
  * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
  * Copyright (c) 2014, Joyent, Inc. All rights reserved.
  * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright 2015 Gary Mills
  */
 
 #include <sys/types.h>
 #include <sys/utsname.h>
 #include <sys/sysmacros.h>

@@ -47,11 +48,13 @@
 
 #include "libproc.h"
 #include "Pcontrol.h"
 #include "P32ton.h"
 #include "Putil.h"
+#if defined(__i386) || defined(__amd64)
 #include "Pcore_linux.h"
+#endif
 
 /*
  * Pcore.c - Code to initialize a ps_prochandle from a core dump.  We
  * allocate an additional structure to hold information from the core
  * file, and attach this to the standard ps_prochandle in place of the

@@ -429,10 +432,12 @@
 err:
         dprintf("Pgrab_core: failed to read NT_LWPSTATUS\n");
         return (-1);
 }
 
+#if defined(__i386) || defined(__amd64)
+
 static void
 lx_prpsinfo32_to_psinfo(lx_prpsinfo32_t *p32, psinfo_t *psinfo)
 {
         psinfo->pr_flag = p32->pr_flag;
         psinfo->pr_pid = p32->pr_pid;

@@ -627,10 +632,12 @@
 err:
         dprintf("Pgrab_core: failed to read NT_PRSTATUS\n");
         return (-1);
 }
 
+#endif /* defined(__i386) || defined(__amd64) */
+
 static int
 note_psinfo(struct ps_prochandle *P, size_t nbytes)
 {
 #ifdef _LP64
         core_info_t *core = P->data;

@@ -1123,13 +1130,21 @@
  * Populate a table of function pointers indexed by Note type with our
  * functions to process each type of core file note:
  */
 static int (*nhdlrs[])(struct ps_prochandle *, size_t) = {
         note_notsup,            /*  0   unassigned              */
+#if defined(__i386) || defined(__amd64)
         note_linux_prstatus,            /*  1   NT_PRSTATUS (old)       */
+#else
+        note_notsup,            /*  1   NT_PRSTATUS (old)       */
+#endif
         note_notsup,            /*  2   NT_PRFPREG (old)        */
+#if defined(__i386) || defined(__amd64)
         note_linux_psinfo,              /*  3   NT_PRPSINFO (old)       */
+#else
+        note_notsup,            /*  3   NT_PRPSINFO (old)       */
+#endif
 #ifdef __sparc
         note_xreg,              /*  4   NT_PRXREG               */
 #else
         note_notsup,            /*  4   NT_PRXREG               */
 #endif

@@ -2199,11 +2214,13 @@
         int i, notes, pagesize;
         uintptr_t addr, base_addr;
         struct stat64 stbuf;
         void *phbuf, *php;
         size_t nbytes;
+#if defined(__i386) || defined(__amd64)
         boolean_t from_linux = B_FALSE;
+#endif
 
         elf_file_t aout;
         elf_file_t core;
 
         Elf_Scn *scn, *intp_scn = NULL;

@@ -2447,13 +2464,15 @@
                         }
                         /*
                          * The presence of either of these notes indicates that
                          * the dump was generated on Linux.
                          */
+#if defined(__i386) || defined(__amd64)
                         if (nhdr.n_type == NT_PRSTATUS ||
                             nhdr.n_type == NT_PRPSINFO)
                                 from_linux = B_TRUE;
+#endif
                 } else {
                         (void) note_notsup(P, nhdr.n_descsz);
                 }
 
                 /*

@@ -2471,10 +2490,11 @@
                  * we have left to process.
                  */
                 nleft -= sizeof (nhdr) + namesz + descsz;
         }
 
+#if defined(__i386) || defined(__amd64)
         if (from_linux) {
                 size_t tcount, pid;
                 lwp_info_t *lwp;
 
                 P->status.pr_dmodel = core_info->core_dmodel;

@@ -2524,10 +2544,11 @@
 
                 /* set representative thread */
                 (void) memcpy(&P->status.pr_lwp, &lwp->lwp_status,
                     sizeof (P->status.pr_lwp));
         }
+#endif /* defined(__i386) || defined(__amd64) */
 
         if (nleft != 0) {
                 dprintf("Pgrab_core: note section malformed\n");
                 *perr = G_STRANGE;
                 goto err;