Annotation of Net2/sys/exec.h, revision 1.1.1.2

1.1       root        1: /*-
                      2:  * Copyright (c) 1982, 1986 The Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution and use in source and binary forms, with or without
                      6:  * modification, are permitted provided that the following conditions
                      7:  * are met:
                      8:  * 1. Redistributions of source code must retain the above copyright
                      9:  *    notice, this list of conditions and the following disclaimer.
                     10:  * 2. Redistributions in binary form must reproduce the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer in the
                     12:  *    documentation and/or other materials provided with the distribution.
                     13:  * 3. All advertising materials mentioning features or use of this software
                     14:  *    must display the following acknowledgement:
                     15:  *     This product includes software developed by the University of
                     16:  *     California, Berkeley and its contributors.
                     17:  * 4. Neither the name of the University nor the names of its contributors
                     18:  *    may be used to endorse or promote products derived from this software
                     19:  *    without specific prior written permission.
                     20:  *
                     21:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     22:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     23:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     24:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     25:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     26:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     27:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     28:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     29:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     30:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     31:  * SUCH DAMAGE.
                     32:  *
1.1.1.2 ! root       33:  *     from: @(#)exec.h        7.5 (Berkeley) 2/15/91
        !            34:  *     exec.h,v 1.14 1993/07/05 01:54:22 cgd Exp
1.1       root       35:  */
                     36: 
1.1.1.2 ! root       37: #ifndef        _SYS_EXEC_H_
        !            38: #define        _SYS_EXEC_H_
1.1       root       39: 
1.1.1.2 ! root       40: #include       <sys/param.h>
        !            41: #include       <sys/cdefs.h>
        !            42: 
        !            43: /*
        !            44:  * Header prepended to each a.out file.
        !            45:  * only manipulate the a_midmag field via the
        !            46:  * N_SETMAGIC/N_GET{MAGIC,MID,FLAG} macros in a.out.h
        !            47:  */
1.1       root       48: struct exec {
1.1.1.2 ! root       49:        unsigned long   a_midmag;       /* htonl(flags<<26 | mid<<16 | magic) */
        !            50:        unsigned long   a_text;         /* text segment size */
        !            51:        unsigned long   a_data;         /* initialized data size */
        !            52:        unsigned long   a_bss;          /* uninitialized data size */
        !            53:        unsigned long   a_syms;         /* symbol table size */
        !            54:        unsigned long   a_entry;        /* entry point */
        !            55:        unsigned long   a_trsize;       /* text relocation size */
        !            56:        unsigned long   a_drsize;       /* data relocation size */
1.1       root       57: };
                     58: 
                     59: /* a_magic */
                     60: #define        OMAGIC          0407    /* old impure format */
                     61: #define        NMAGIC          0410    /* read-only text */
                     62: #define        ZMAGIC          0413    /* demand load format */
1.1.1.2 ! root       63: #define QMAGIC         0314    /* "compact" demand load format -- DEPRICATE */
1.1       root       64: 
1.1.1.2 ! root       65: /*
        !            66:  * a_mid - keep sorted in numerical order for sanity's sake
        !            67:  * ensure that: 0 < mid < 0x3ff
        !            68:  */
1.1       root       69: #define        MID_ZERO        0       /* unknown - implementation dependent */
                     70: #define        MID_SUN010      1       /* sun 68010/68020 binary */
                     71: #define        MID_SUN020      2       /* sun 68020-only binary */
1.1.1.2 ! root       72: #define MID_PC386      100     /* 386 PC binary. (so quoth BFD) */
1.1       root       73: #define        MID_HP200       200     /* hp200 (68010) BSD binary */
1.1.1.2 ! root       74: #define MID_I386       134     /* i386 BSD binary */
1.1       root       75: #define        MID_HP300       300     /* hp300 (68020+68881) BSD binary */
                     76: #define        MID_HPUX        0x20C   /* hp200/300 HP-UX binary */
                     77: #define        MID_HPUX800     0x20B   /* hp800 HP-UX binary */
                     78: 
1.1.1.2 ! root       79: /*
        !            80:  * Magic number/exec function table... (execution class loader)
        !            81:  */
        !            82: struct execsw {
        !            83:        int     magic;          /* magic number this loader sees*/
        !            84:        int     m_size;         /* size of magic number (significant bytes)*/
        !            85:        int     (*load)();      /* loader function*/
        !            86: };
        !            87: 
        !            88: extern struct execsw execsw[];
        !            89: extern int     nexecs;
        !            90: 
        !            91: /*
        !            92:  * i (cgd) give up; it's damned impossible to find out where a process's
        !            93:  * args are.  4.4 actually puts pointers in the process address space,
        !            94:  * above the stack.  this is reasonable, and also allows the process to
        !            95:  * set its ps-visible arguments.
        !            96:  *
        !            97:  * PS_STRINGS defines the location of a process's ps_strings structure.
        !            98:  */
        !            99: 
        !           100: struct ps_strings {
        !           101:   char *ps_argvstr;       /* the argv strings */
        !           102:   int  ps_nargvstr;       /* number of argv strings */
        !           103:   char *ps_envstr;        /* the environment strings */
        !           104:   int  ps_nenvstr;        /* number of environment strings */
        !           105: };
        !           106: #define PS_STRINGS \
        !           107:         ((struct ps_strings *)(USRSTACK - sizeof(struct ps_strings)))
        !           108: 
        !           109: /*
        !           110:  * the following structures allow exec to put together processes
        !           111:  * in a more extensible and cleaner way.
        !           112:  *
        !           113:  * the exec_package struct defines an executable being execve()'d.
        !           114:  * it contains the header, the vmspace-building commands, the vnode
        !           115:  * information, and the arguments associated with the newly-execve'd
        !           116:  * process.
        !           117:  *
        !           118:  * the exec_vmcmd struct defines a command description to be used
        !           119:  * in creating the new process's vmspace.
        !           120:  */
        !           121: 
        !           122: struct exec_package {
        !           123:   struct exec *ep_execp;      /* file's exec header */
        !           124:   struct exec_vmcmd *ep_vcp;  /* exec_vmcmds used to build the vmspace */
        !           125:   struct vnode *ep_vp;        /* executable's vnode */
        !           126:   struct vattr *ep_vap;       /* executable's attributes */
        !           127:   unsigned long ep_taddr;     /* process's text address */
        !           128:   unsigned long ep_tsize;     /* size of process's text */
        !           129:   unsigned long ep_daddr;     /* process's data(+bss) address */
        !           130:   unsigned long ep_dsize;     /* size of process's data(+bss) */
        !           131:   unsigned long ep_maxsaddr;  /* process's max stack address ("top") */
        !           132:   unsigned long ep_minsaddr;  /* process's min stack address ("bottom") */
        !           133:   unsigned long ep_ssize;     /* size of process's stack */
        !           134:   unsigned long ep_entry;     /* process's entry point */
        !           135: #ifdef notdef
        !           136:   char   *ep_argbuf;          /* argument buffer. generally same as argv */
        !           137:   int    ep_argc;             /* count of process arguments */
        !           138:   char   *ep_argv;            /* process arguments, null seperated */
        !           139:   int    ep_envc;             /* count of process environment strings */
        !           140:   char   *ep_env;             /* process enviornment strings, null seperated */
        !           141: #endif
        !           142: };
        !           143: 
        !           144: struct proc;
        !           145: 
        !           146: struct exec_vmcmd {
        !           147:   struct exec_vmcmd *ev_next;   /* next command on the chain */
        !           148:                                 /* procedure to run */
        !           149:   int              (*ev_proc) __P((struct proc *p, struct exec_vmcmd *cmd));
        !           150:   unsigned long     ev_len;     /* length of the segment to map */
        !           151:   unsigned long     ev_addr;    /* address in the vmspace to place it at */
        !           152:   struct vnode      *ev_vp;     /* vnode pointer for the file w/the data */
        !           153:   unsigned long     ev_offset;  /* offset in the file for the data */
        !           154:   unsigned          ev_prot;    /* protections for segment */
        !           155: };
        !           156: 
        !           157: #ifdef KERNEL
        !           158: struct exec_vmcmd *new_vmcmd __P(( \
        !           159:      int (*proc) __P((struct proc *p, struct exec_vmcmd *)), \
        !           160:      unsigned long len, \
        !           161:      unsigned long addr, \
        !           162:      struct vnode *vp, \
        !           163:      unsigned long offset, \
        !           164:      unsigned long prot));
        !           165: void kill_vmcmd __P((struct exec_vmcmd **));
        !           166: int exec_makecmds __P((struct proc *, struct exec_package *));
        !           167: int exec_runcmds __P((struct proc *, struct exec_package *));
        !           168: int exec_prep_qmagic __P((struct proc *, struct exec_package *));
        !           169: int exec_prep_zmagic __P((struct proc *, struct exec_package *));
        !           170: int vmcmd_map_pagedvn __P((struct proc *, struct exec_vmcmd *));
        !           171: int vmcmd_map_zero __P((struct proc *, struct exec_vmcmd *));
        !           172: #endif
        !           173: 
        !           174: #endif /* !_SYS_EXEC_H_ */
        !           175: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.