Print this page
5383 5234 breaks build on sparc
*** 24,33 ****
--- 24,34 ----
*/
/*
* 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,57 ****
--- 48,60 ----
#include "libproc.h"
#include "Pcontrol.h"
#include "P32ton.h"
#include "Putil.h"
+ #ifdef __x86
#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
*** 217,227 ****
__priv_free_info(core->core_privinfo);
if (core->core_ppii != NULL)
free(core->core_ppii);
if (core->core_zonename != NULL)
free(core->core_zonename);
! #if defined(__i386) || defined(__amd64)
if (core->core_ldt != NULL)
free(core->core_ldt);
#endif
free(core);
--- 220,230 ----
__priv_free_info(core->core_privinfo);
if (core->core_ppii != NULL)
free(core->core_ppii);
if (core->core_zonename != NULL)
free(core->core_zonename);
! #ifdef __x86
if (core->core_ldt != NULL)
free(core->core_ldt);
#endif
free(core);
*** 269,279 ****
}
(void) strlcpy(s, core->core_zonename, n);
return (s);
}
! #if defined(__i386) || defined(__amd64)
/*ARGSUSED*/
static int
Pldt_core(struct ps_prochandle *P, struct ssd *pldt, int nldt, void *data)
{
core_info_t *core = data;
--- 272,282 ----
}
(void) strlcpy(s, core->core_zonename, n);
return (s);
}
! #ifdef __x86
/*ARGSUSED*/
static int
Pldt_core(struct ps_prochandle *P, struct ssd *pldt, int nldt, void *data)
{
core_info_t *core = data;
*** 303,313 ****
.pop_psinfo = Ppsinfo_core,
.pop_fini = Pfini_core,
.pop_platform = Pplatform_core,
.pop_uname = Puname_core,
.pop_zonename = Pzonename_core,
! #if defined(__i386) || defined(__amd64)
.pop_ldt = Pldt_core
#endif
};
/*
--- 306,316 ----
.pop_psinfo = Ppsinfo_core,
.pop_fini = Pfini_core,
.pop_platform = Pplatform_core,
.pop_uname = Puname_core,
.pop_zonename = Pzonename_core,
! #ifdef __x86
.pop_ldt = Pldt_core
#endif
};
/*
*** 429,438 ****
--- 432,443 ----
err:
dprintf("Pgrab_core: failed to read NT_LWPSTATUS\n");
return (-1);
}
+ #ifdef __x86
+
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,636 ****
--- 632,643 ----
err:
dprintf("Pgrab_core: failed to read NT_PRSTATUS\n");
return (-1);
}
+ #endif /* __x86 */
+
static int
note_psinfo(struct ps_prochandle *P, size_t nbytes)
{
#ifdef _LP64
core_info_t *core = P->data;
*** 825,835 ****
core->core_cred = pcrp;
return (0);
}
! #if defined(__i386) || defined(__amd64)
static int
note_ldt(struct ps_prochandle *P, size_t nbytes)
{
core_info_t *core = P->data;
struct ssd *pldt;
--- 832,842 ----
core->core_cred = pcrp;
return (0);
}
! #ifdef __x86
static int
note_ldt(struct ps_prochandle *P, size_t nbytes)
{
core_info_t *core = P->data;
struct ssd *pldt;
*** 1123,1135 ****
--- 1130,1150 ----
* 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 */
+ #ifdef __x86
note_linux_prstatus, /* 1 NT_PRSTATUS (old) */
+ #else
+ note_notsup, /* 1 NT_PRSTATUS (old) */
+ #endif
note_notsup, /* 2 NT_PRFPREG (old) */
+ #ifdef __x86
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
*** 1144,1154 ****
#endif
#else
note_notsup, /* 7 NT_GWINDOWS */
note_notsup, /* 8 NT_ASRS */
#endif
! #if defined(__i386) || defined(__amd64)
note_ldt, /* 9 NT_LDT */
#else
note_notsup, /* 9 NT_LDT */
#endif
note_pstatus, /* 10 NT_PSTATUS */
--- 1159,1169 ----
#endif
#else
note_notsup, /* 7 NT_GWINDOWS */
note_notsup, /* 8 NT_ASRS */
#endif
! #ifdef __x86
note_ldt, /* 9 NT_LDT */
#else
note_notsup, /* 9 NT_LDT */
#endif
note_pstatus, /* 10 NT_PSTATUS */
*** 2199,2209 ****
--- 2214,2226 ----
int i, notes, pagesize;
uintptr_t addr, base_addr;
struct stat64 stbuf;
void *phbuf, *php;
size_t nbytes;
+ #ifdef __x86
boolean_t from_linux = B_FALSE;
+ #endif
elf_file_t aout;
elf_file_t core;
Elf_Scn *scn, *intp_scn = NULL;
*** 2447,2459 ****
--- 2464,2478 ----
}
/*
* The presence of either of these notes indicates that
* the dump was generated on Linux.
*/
+ #ifdef __x86
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,2480 ****
--- 2490,2500 ----
* we have left to process.
*/
nleft -= sizeof (nhdr) + namesz + descsz;
}
+ #ifdef __x86
if (from_linux) {
size_t tcount, pid;
lwp_info_t *lwp;
P->status.pr_dmodel = core_info->core_dmodel;
*** 2524,2533 ****
--- 2544,2554 ----
/* set representative thread */
(void) memcpy(&P->status.pr_lwp, &lwp->lwp_status,
sizeof (P->status.pr_lwp));
}
+ #endif /* __x86 */
if (nleft != 0) {
dprintf("Pgrab_core: note section malformed\n");
*perr = G_STRANGE;
goto err;