home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilss / sockets / include / sys / h / exec < prev    next >
Encoding:
Text File  |  1995-01-11  |  6.1 KB  |  171 lines

  1. /*
  2.  * $Header: /ax/networking:include/sys/exec.h:networking  1.1  $
  3.  * $Source: /ax/networking:include/sys/exec.h: $
  4.  *
  5.  * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
  6.  *
  7.  * $Log:    exec.h,v $
  8.  * Revision 1.1  95/01/11  10:19:13  kwelton
  9.  * Initial revision
  10.  * 
  11.  * Revision 1.13  88/10/25  22:29:02  brian
  12.  * Definition of MAXSHLIBS moved to sysconf.h
  13.  * 
  14.  * Revision 1.12  88/10/25  13:21:14  brian
  15.  * New magic numbers for shared libraries.
  16.  * 
  17.  * Revision 1.11  88/09/20  18:34:50  john
  18.  * Changed magic numbers for shared libraries, added as link
  19.  * time stamp.
  20.  * 
  21.  * Revision 1.10  88/09/15  18:34:14  abray
  22.  * Amended version part of exec header, so kernel can use a consistent format
  23.  * (new include file sys/version.h)
  24.  * 
  25.  * Revision 1.9  88/09/13  11:16:15  john
  26.  * Added RMAGIC magic number to deal with references to shared libraries.
  27.  * 
  28.  * Revision 1.8  88/08/25  02:51:26  keith
  29.  * Define exec_header to be the extended header that exists on the front
  30.  * of all types of file the kernel understands. For compatibility leave
  31.  * "struct exec" as it always has been.
  32.  * 
  33.  * Revision 1.7  88/08/24  12:02:46  keith
  34.  * Reverting to the original struct exec; with the additions
  35.  * in a new structure. This is a) to reduce space on disc within
  36.  * things like libraries which dont need the information, and
  37.  * b) because the bootstrapping problems encountered with changing
  38.  * the format were daunting.
  39.  * 
  40.  * Revision 1.6  88/08/19  10:46:45  keith
  41.  * Corret spelling of (as yet unused) SPZMAGIC a_magic type.
  42.  * Re-order fields (no users yet) of a_spare -> a_verstime.
  43.  * 
  44.  * Revision 1.5  88/08/18  15:05:29  keith
  45.  * Include <sys/types.h> to stop things that include this file complaining
  46.  * 
  47.  * Revision 1.4  88/08/11  09:23:57  keith
  48.  * exec struct extended to provide support for QMAGIC squeezed images
  49.  * and (future) shared libraries.
  50.  * A version string can also be inserted in the header.
  51.  * 
  52.  * Revision 1.3  88/06/17  20:19:09  beta
  53.  * Acorn Unix initial beta version
  54.  * 
  55.  */
  56. /* @(#)exec.h    1.2 87/05/15 3.2/4.3NFSSRC */
  57. /*
  58.  * Copyright (c) 1982, 1986 Regents of the University of California.
  59.  * All rights reserved.  The Berkeley software License Agreement
  60.  * specifies the terms and conditions for redistribution.
  61.  *
  62.  *    @(#)exec.h    7.1 (Berkeley) 6/4/86
  63.  */
  64.  
  65. /*
  66.  * Header prepended to each a.out file.
  67.  * For compatibility reasons this structure is called "exec"
  68.  * although an extended structure is actually prepended to all files
  69.  * that are actually executable. The (old) "exec" header is only
  70.  * now used on .o (i.e. type OMAGIC) files produced by compilers,
  71.  * and not on any file that has been completely ld'd.
  72.  */
  73.  
  74. struct exec {
  75.     long    a_magic;    /* magic number */
  76. unsigned long    a_text;        /* size of text segment */
  77. unsigned long    a_data;        /* size of initialized data */
  78. unsigned long    a_bss;        /* size of uninitialized data */
  79. unsigned long    a_syms;        /* size of symbol table */
  80. unsigned long    a_entry;    /* entry point */
  81. #define a_sldatabase a_entry    /* used as data address for shared libs */
  82. unsigned long    a_trsize;    /* size of text relocation */
  83. unsigned long    a_drsize;    /* size of data relocation */
  84. };
  85.  
  86. #ifdef    KERNEL
  87. #include "../h/types.h"
  88. #include "../h/version.h"
  89. #else
  90. #include <sys/types.h>
  91. #include <sys/version.h>
  92. #endif    KERNEL
  93.  
  94.  
  95. #define    SHLIBLEN    60
  96.  
  97. /* This is the structure that is actually prepended to all files that
  98.  * the kernel can execute. It contains slots for the extra information
  99.  * required to support shared libraries and/or squeezed images.
  100.  */
  101. struct exec_header {
  102.     struct    exec a_exec;    /* The (old) small header */
  103.     struct  version a_version;  /* Version number time and text */
  104. unsigned long    a_sq4items;    /* number of squeezed type 4 items */
  105. unsigned long    a_sq3items;    /* number of squeezed type 3 items */
  106. unsigned long    a_sq4size;    /* size of squeezed type 4 items */
  107. unsigned long    a_sq3size;    /* size of squeezed type 3 items */
  108. unsigned long    a_sq4last;    /* last entry in type 4 table (check only) */
  109. unsigned long    a_sq3last;    /* last entry in type 3 table (check only) */
  110.     time_t    a_timestamp;    /* link time of this object */
  111.     time_t    a_shlibtime;    /* timestamp of shared library */
  112.     char    a_shlibname[SHLIBLEN]; /* Path name of shared library */
  113. };
  114.  
  115.  
  116. /*
  117.  * Structure used for recording details of a shared library.
  118.  */
  119.  
  120. struct shlib_info
  121. {
  122.   struct vnode       *si_vp;    /* Vnode of file containing shared lib    */
  123.   struct exec_header si_eh;    /* Exec header from the file              */
  124.   int             si_xoffset;/* Offset (pages) of text in text segment */
  125. };
  126.  
  127.  
  128. /* Basic magic numbers */
  129.  
  130. #define    OMAGIC    0407        /* old impure format */
  131. #define    NMAGIC    0410        /* read-only text */
  132. #define    ZMAGIC    0413        /* demand load format (pure sharable text) */
  133.  
  134. /* Magic flags - all combinations are valid */
  135.  
  136. #define MF_IMPURE   00200    /* impure text                       */
  137. #define MF_SQUEEZED 01000    /* text and data squeezed            */
  138. #define MF_USES_SL  02000    /* this object uses a shared library */
  139. #define MF_IS_SL    04000    /* this object is a shared library   */
  140.  
  141. /* Names for some common magic number/flag combinations */
  142.  
  143. #define    IMAGIC     (MF_IMPURE|ZMAGIC)    /* demand load format (impure text) */
  144.  
  145. #define SPOMAGIC (MF_USES_SL|OMAGIC)    /* OMAGIC with a large header - may */
  146.                     /* contain a reference to a shared  */
  147.                     /* library required by the object.  */
  148.  
  149. #define SLOMAGIC (MF_IS_SL|OMAGIC)    /* a reference to a shared library. */
  150.                     /* The text portion of the object   */
  151.                     /* contains ``overflow text'' from  */
  152.                     /* the shared library to be linked  */
  153.                     /* in with an object.            */
  154.  
  155. #define    QMAGIC      (MF_SQUEEZED|ZMAGIC)    /* squeezed demand paged            */
  156. #define    SPZMAGIC  (MF_USES_SL|ZMAGIC)    /* program which uses shared lib    */
  157. #define    SPQMAGIC  (MF_USES_SL|QMAGIC)    /* squeezed         ditto           */
  158. #define    SLZMAGIC  (MF_IS_SL|ZMAGIC)    /* shared library part of program   */
  159. #define SLPZMAGIC (MF_USES_SL|SLZMAGIC)    /* shared lib which uses another    */
  160.  
  161. /* Squeezed shared libraries are not supported (and probably not worth the  */
  162. /* trouble they would cause).                                               */
  163.  
  164.  
  165. /* Macros for finding properties of magic numbers */
  166.  
  167. #define IS_SQUEEZED(magic)     (((magic) & MF_SQUEEZED) != 0)
  168. #define IS_SHARED_LIB(magic)    (((magic) & MF_IS_SL)    != 0)
  169.  
  170. /* EOF exec.h */
  171.