exec.h revision 07678296a66d425e65d218730836cc0162649ce4
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#ifndef _SYS_EXEC_H
#define _SYS_EXEC_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Number of bytes to read for magic string
*/
#define MAGIC_BYTES 8
typedef struct execa {
const char *fname;
const char **argp;
const char **envp;
} execa_t;
typedef struct execenv {
short ex_magic;
} execenv_t;
#ifdef _KERNEL
#define LOADABLE_EXEC(e) ((e)->exec_lock)
#define LOADED_EXEC(e) ((e)->exec_func)
extern int nexectype; /* number of elements in execsw */
extern kmutex_t execsw_lock;
/*
* User argument structure for passing exec information around between the
* common and machine-dependent portions of exec and the exec modules.
*/
typedef struct uarg {
char *fname;
char *pathname;
char *stk_base;
char *stk_strp;
int *stk_offp;
int traceinval;
char *emulator;
char *brandname;
char *auxp_brand; /* address of first brand auxv on user stack */
} uarg_t;
/*
* Possible brand actions for exec.
*/
#define EBA_NONE 0
#define EBA_NATIVE 1
#define EBA_BRAND 2
/*
* The following macro is a machine dependent encapsulation of
* postfix processing to hide the stack direction from elf.c
* thereby making the elf.c code machine independent.
*/
/*
* This provides the current user stack address for an object of size BYTESIZE.
* Used to determine the stack address just before applying execpoststack().
*/
/*
*/
/* BEGIN CSTYLED */
/* END CSTYLED */
/*
* This convoluted stuff is necessitated by the fact that there is
* potential padding in the aux vector, but not necessarily and
* without clearing the padding there is a small, but potential
* security hole.
*/
#define ADDAUX(p, a, v) { \
(&(p)->a_type)[1] = 0; \
(p)->a_type = (a); \
++(p); \
}
#else
#define ADDAUX(p, a, v) { \
(p)->a_type = (a); \
}
#endif
#define INTPSZ MAXPATHLEN
typedef struct intpdata {
char *intp;
char *intp_name;
char *intp_arg;
} intpdata_t;
struct execsw {
char *exec_magic;
int exec_magoff;
int exec_maglen;
};
extern short elfmagic;
extern short intpmagic;
extern short javamagic;
#if defined(__sparc)
extern short aout_zmagic;
extern short aout_nmagic;
extern short aout_omagic;
#endif
extern short nomagic;
extern char elf32magicstr[];
extern char elf64magicstr[];
extern char intpmagicstr[];
extern char javamagicstr[];
#if defined(__sparc)
extern char aout_nmagicstr[];
extern char aout_zmagicstr[];
extern char aout_omagicstr[];
#endif
extern char nomagicstr[];
const char **envp, int brand_action);
extern void exec_set_sp(size_t);
/*
* Utility functions for branded process executing
*/
#if !defined(_ELF32_COMPAT)
/*
* When compiling 64-bit kernels we don't want these definitions included
* when compiling the 32-bit compatability elf code in the elfexec module.
*/
#endif /* !_ELF32_COMPAT */
#if defined(_LP64)
#endif /* _LP64 */
/*
* Utility functions for exec module core routines:
*/
/* a.out stuff */
struct exec;
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_EXEC_H */