home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / programm / programi / ixemupd_.lzh / ixemupd-920129 / include / user.h < prev   
Encoding:
C/C++ Source or Header  |  1992-01-26  |  5.7 KB  |  163 lines

  1. /*
  2.  *  This file is part of ixemul.library for the Amiga.
  3.  *  Copyright (C) 1991, 1992  Markus M. Wild
  4.  *
  5.  *  This library is free software; you can redistribute it and/or
  6.  *  modify it under the terms of the GNU Library General Public
  7.  *  License as published by the Free Software Foundation; either
  8.  *  version 2 of the License, or (at your option) any later version.
  9.  *
  10.  *  This library is distributed in the hope that it will be useful,
  11.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  *  Library General Public License for more details.
  14.  *
  15.  *  You should have received a copy of the GNU Library General Public
  16.  *  License along with this library; if not, write to the Free
  17.  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  */
  19.  
  20.  
  21. #include <sys/time.h>
  22. #include <sys/resource.h>
  23. #include <setjmp.h>
  24.  
  25. /* internal structure used by malloc(), kmalloc() and friends */
  26. struct malloc_data {
  27.   struct Remember    *md_key;
  28.   unsigned int        md_malloc_sbrk_used;
  29.   struct mhead        *md_nextf[30];
  30.   char            md_busy[30];
  31.   int            md_gotpool;
  32. };
  33.  
  34. /*
  35.  * Per process structure
  36.  */
  37.  
  38. struct user {
  39.     /* both a magic cookie and a way to get at the library base thru u */
  40.     struct  ixemul_base *u_ixbase;
  41.  
  42. /* 1.3 - signal management */
  43.     sig_t    u_signal[NSIG];        /* disposition of signals */
  44.     int    u_sigmask[NSIG];    /* signals to be blocked */
  45.     sigset_t    u_sigonstack;        /* signals to take on sigstack */
  46.     sigset_t    u_sigintr;        /* signals that interrupt syscalls */
  47.     sigset_t    u_oldmask;        /* saved mask from before sigpause */
  48.     struct    sigstack u_sigstack;    /* sp & on stack state variable */
  49. #define    u_onstack    u_sigstack.ss_onstack
  50. #define    u_sigsp        u_sigstack.ss_sp
  51.     int    u_sig;            /* for core dump/debugger XXX */
  52.     int    u_code;            /* for core dump/debugger XXX */
  53.     
  54.     int    p_flag;            /* process flags, as necessary.. */
  55.     char    p_stat;
  56.     char    p_xstat;        /* what does this do... ? */
  57.     char    p_cursig;
  58.     sigset_t    p_sig;            /* signals pending to this process */
  59.     sigset_t    p_sigmask;        /* current signal mask */
  60.     sigset_t    p_sigignore;        /* signals being ignored */
  61.     sigset_t    p_sigcatch;        /* signals being caught by user */
  62.  
  63.     caddr_t p_wchan;        /* event process is awaiting */
  64.  
  65.  
  66. /* 1.4 - descriptor management (for shared library version) */
  67.     struct    file *u_ofile[NOFILE];    /* file structures for open files */
  68.     char    u_pofile[NOFILE];    /* per-process flags of open files */
  69.     int    u_lastfile;        /* high-water mark of u_ofile */
  70. #define    UF_EXCLOSE     0x1        /* auto-close on exec */
  71.     short    u_cmask;        /* mask for file creation */
  72.  
  73. /* 1.5 - timing and statistics */
  74.     struct    rusage u_ru;        /* stats for this proc */
  75.     struct    rusage u_cru;        /* sum of stats for reaped children */
  76.     struct    itimerval u_timer[3];
  77.     struct    timeval u_start;
  78.     short    u_acflag;
  79.  
  80.     struct uprof {            /* profile arguments */
  81.         short    *pr_base;    /* buffer base */
  82.         unsigned pr_size;    /* buffer size */
  83.         unsigned pr_off;    /* pc offset */
  84.         unsigned pr_scale;    /* pc scaling */
  85.     } u_prof;
  86.  
  87. /* 1.6 - resource controls */
  88.     struct    rlimit u_rlimit[RLIM_NLIMITS];
  89.  
  90. /* amiga specific stuff */
  91.     struct malloc_data    u_md;
  92.     
  93.     struct MsgPort        *u_mp;    /* used for packet protocol and timer */
  94.     struct timerequest     *u_time_req;
  95.     int            *u_errno;
  96.     BPTR            u_startup_cd;
  97.     
  98.     int            u_ringring;    /* used in sleep.c and usleep.c */
  99.  
  100.     /* support stuff for tc_Launch-signals    */
  101.     /* points to stack of sigreturn(), if p_flag & SRETSIG */
  102.         struct sigcontext    *u_ret_sc;
  103.     /* used to handle amigados signals. see SIGMSG  */
  104.         u_int            u_lastrcvsig;
  105.         char            u_sleep_sig;
  106.         
  107.         /* c-startup stuff */
  108.         jmp_buf            u_jmp_buf;
  109.         char             *u_argline;
  110.         u_int            u_arglinelen;
  111.         int            u_expand_cmd_line;
  112.  
  113.     struct atexit        *u_atexit;
  114.     
  115.     char            u_getenv_buf[255];
  116.     
  117.     UBYTE            u_otask_flags;
  118.     void            (*u_olaunch)();
  119.     APTR            u_otrap_code;
  120.     APTR            u_otrap_data;
  121.     struct Interrupt    u_itimerint;    /* 1 interrupt / task */
  122.     APTR            u_osp_reg;
  123.  
  124.     char            *u_strtok_last;    /* moved with 37.8 */
  125. };
  126.  
  127. /* flag codes */
  128. #define    SLOAD    0x0000001    /* in core */
  129. #define    SSYS    0x0000002    /* swapper or pager process */
  130. #define    SLOCK    0x0000004    /* process being swapped out */
  131. #define    SSWAP    0x0000008    /* save area flag */
  132. #define    STRC    0x0000010    /* process is being traced */
  133. #define    SWTED    0x0000020    /* parent has been told that this process stopped */
  134. #define    SULOCK    0x0000040    /* user settable lock in core */
  135. #define    SNOCLDSTOP    0x0000080    /* tc_Launch has to take a signal next time */
  136. #define    SRETSIG    0x0000100    /* tc_Launch should backup a prev task frame */
  137. #define    SOMASK    0x0000200    /* restore old mask after taking signal */
  138. #define    SWEXIT    0x0000400    /* working on exiting */
  139. #define    SPHYSIO    0x0000800    /* doing physical i/o (bio.c) */
  140. #define    SVFORK    0x0001000    /* process resulted from vfork() */
  141. #define    SVFDONE    0x0002000    /* another vfork flag */
  142. #define    SNOVM    0x0004000    /* no vm, parent in a vfork() */
  143. #define    SPAGI    0x0008000    /* init data space on demand, from inode */
  144. #define    SSEQL    0x0010000    /* user warned of sequential vm behavior */
  145. #define    SUANOM    0x0020000    /* user warned of random vm behavior */
  146. #define    STIMO    0x0040000    /* timing out during sleep */
  147. #define    SORPHAN    0x0080000    /* process is orphaned (can't be ^Z'ed) */
  148. #define    STRACNG    0x0100000    /* process is tracing another process */
  149. #define    SOWEUPC    0x0200000    /* owe process an addupc() call at next ast */
  150. #define    SSEL    0x0400000    /* selecting; wakeup/waiting danger */
  151. #define    SLOGIN    0x0800000    /* a login process (legit child of init) */
  152.  
  153. /* stat codes */
  154. #define    SSLEEP    1        /* awaiting an event */
  155. #define    SWAIT    2        /* (abandoned state) */
  156. #define    SRUN    3        /* running */
  157. #define    SIDL    4        /* intermediate state in process creation */
  158. #define    SZOMB    5        /* has exited, waiting for parent to pick up status */
  159. #define    SSTOP    6        /* stopped */
  160.  
  161. /* library global variable, set in every Switch() of registered tasks */
  162. extern struct user *u;
  163.