elf_notes.c revision 4b835deeb9507998d1e01b7be950b7ddb0d2564f
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
* Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
#include <sys/sysmacros.h>
#include <sys/pathname.h>
#include <sys/systeminfo.h>
#include "elf_impl.h"
#if defined(__i386) || defined(__i386_COMPAT)
#endif
void
{
int nfd;
int fd;
nfd = 0;
nfd++;
}
}
if (pcrp->pr_ngroups != 0) {
} else {
}
#if defined(__i386) || defined(__i386_COMPAT)
mutex_enter(&p->p_ldtlock);
mutex_exit(&p->p_ldtlock);
if (size != 0)
#endif /* __i386 || __i386_COMPAT */
#if defined(__sparc)
/*
* Figure out the number and sizes of register windows.
*/
{
do {
size = sizeof (gwindows_t) -
(SPARC_MAXREGWINDOW - size) *
sizeof (struct rwindow);
}
}
/*
* Space for the Ancillary State Registers.
*/
if (p->p_model == DATAMODEL_LP64)
#endif /* __sparc */
}
int
{
union {
#if defined(__sparc)
#endif /* __sparc */
char xregs[1];
} *bigwad;
kthread_t *t;
int i;
int nlwp;
int nzomb;
int error;
int fd;
#if defined(__i386) || defined(__i386_COMPAT)
#endif /* __i386 || __i386_COMPAT */
/*
* The order of the elfnote entries should be same here
* and in the gcore(1) command. Synchronization is
* needed between the kernel and gcore(1).
*/
/*
* Get the psinfo, and set the wait status to indicate that a core was
* dumped. We have to forge this since p->p_wcode is not set yet.
*/
mutex_enter(&p->p_lock);
mutex_exit(&p->p_lock);
if (error)
goto done;
/*
* Modify t_whystop and lwp_cursig so it appears that the current LWP
* is stopped after faulting on the signal that caused the core dump.
* As a result, prgetstatus() will record that signal, the saved
* lwp_siginfo, and its signal handler in the core file status. We
* restore lwp_cursig in case a subsequent signal was received while
* dumping core.
*/
mutex_enter(&p->p_lock);
mutex_exit(&p->p_lock);
if (error)
goto done;
if (error)
goto done;
for (i = 0; i < __KERN_NAUXV_IMPL; i++) {
}
if (error)
goto done;
if (!INGLOBALZONE(p)) {
}
if (error)
goto done;
} else
if (error)
goto done;
if (error)
goto done;
if (error)
goto done;
prii = priv_hold_implinfo();
if (error)
goto done;
/* zone can't go away as long as process exists */
if (error)
goto done;
/* open file table */
continue;
}
/*
* There are some vnodes that have no corresponding
* path. Its reasonable for this to fail, in which
* case the path will remain an empty string.
*/
if (error != 0) {
goto done;
}
/*
* This logic mirrors fstat(), which we cannot use
* directly, as it calls copyout().
*/
if (error) {
goto done;
}
}
#if defined(__i386) || defined(__i386_COMPAT)
mutex_enter(&p->p_ldtlock);
if (ssdsize != 0) {
}
mutex_exit(&p->p_ldtlock);
if (error)
goto done;
#endif /* __i386 || defined(__i386_COMPAT) */
/* for each entry in the lwp directory ... */
continue;
nlwp--;
mutex_enter(&p->p_lock);
mutex_exit(&p->p_lock);
} else { /* zombie lwp */
nzomb--;
}
if (error)
goto done;
if (t == NULL) /* nothing more to do for a zombie */
continue;
mutex_enter(&p->p_lock);
if (t == curthread) {
/*
* Modify t_whystop and lwp_cursig so it appears that
* the current LWP is stopped after faulting on the
* signal that caused the core dump. As a result,
* prgetlwpstatus() will record that signal, the saved
* lwp_siginfo, and its signal handler in the core file
* status. We restore lwp_cursig in case a subsequent
* signal was received while dumping core.
*/
t->t_whystop = PR_FAULTED;
t->t_whystop = 0;
} else {
}
mutex_exit(&p->p_lock);
if (error)
goto done;
#if defined(__sparc)
/*
* Unspilled SPARC register windows.
*/
{
if (size != 0) {
size = sizeof (gwindows_t) -
(SPARC_MAXREGWINDOW - size) *
sizeof (struct rwindow);
if (error)
goto done;
}
}
/*
* Ancillary State Registers.
*/
if (p->p_model == DATAMODEL_LP64) {
if (error)
goto done;
}
#endif /* __sparc */
if (xregsize) {
if (error)
goto done;
}
#ifdef _ELF32_COMPAT
/*
* On a 64-bit kernel with 32-bit ELF compatibility,
* this file is compiled into two different objects:
* one is compiled normally, and the other is compiled
* with _ELF32_COMPAT set -- and therefore with a
* psinfo_t defined to be a psinfo32_t. However, the
* psinfo_t denoting our spymaster is always of the
* native type; if we are in the _ELF32_COMPAT case,
* we need to explicitly convert it.
*/
if (p->p_model == DATAMODEL_ILP32) {
}
#endif
if (error)
goto done;
}
}
done:
return (error);
}