home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 2 / DATAFILE_PDCD2.iso / utilities2 / unixlib36d / UnixLib36d / clib / sys / h / unix < prev   
Encoding:
Text File  |  1994-03-08  |  2.6 KB  |  131 lines

  1. /* sys/unix.h (c) Copyright 1990 H.Rogers */
  2.  
  3. /* UNIX is a registered trademark of AT&T Bell Laboratories */
  4.  
  5. #ifndef __SYS_UNIX_H
  6. #define __SYS_UNIX_H
  7.  
  8. #ifndef __SYS_TYPES_H
  9. #include <sys/types.h>
  10. #endif
  11.  
  12. #ifndef __SYS_STAT_H
  13. #include <sys/stat.h>
  14. #endif
  15.  
  16. #ifndef __SYS_PARAM_H
  17. #include <sys/param.h>
  18. #endif
  19.  
  20. #ifndef __SYS_TTY_H
  21. #include <sys/tty.h>
  22. #endif
  23.  
  24. #ifndef __SETJMP_H
  25. #include <setjmp.h>
  26. #endif
  27.  
  28. #define MAXFD 64
  29.  
  30. #ifndef __UNISTD_H
  31. #include <unistd.h>
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. /* the 2 functions below are automatically called in normal circumstances */
  39.  
  40. extern    void    __unixinit(void);    /* initialise UNIX */
  41. extern    void    __unixexit(void);    /* shutdown UNIX */
  42.  
  43. struct file
  44.   {
  45.   dev_t         dev;        /* device */
  46.   int            oflag;        /* oflag */
  47.   struct file        *dup;        /* dup list */
  48.   int            pid;        /* pid of owner */
  49.   int            r[6];        /* OS_File r0 -> r5 */
  50.   };
  51.  
  52. #define BADF(f) (!(((f) >= 0 && (f) < MAXFD) ? (__u->file[f].dup) : 0))
  53.  
  54. extern    int    __fdalloc(void);
  55.  
  56. #define __U_ZCLD    000000000001    /* 'zombie child exists' flag */
  57. #define __U_PPROC    000000000002    /* 'u_pproc valid' flag */
  58. #define __U_TTY     000000177400    /* controlling tty */
  59. #define __U_TTYSHIFT    8
  60.  
  61. struct proc
  62.   {
  63.   int        argc;        /* main(argc,argv) */
  64.   char        **argv;
  65.   char        *argb;
  66.   struct file    file[MAXFD];    /* FD set */
  67.   struct tty    *tty;
  68.   int        uid;
  69.   int        euid;
  70.   int        gid;
  71.   int        egid;
  72.   int        pgrp;
  73.   int        pid;
  74.   int        ppid;
  75.   int        umask;
  76.   int        alarm;        /* alarm() time */
  77.   int        wait;        /* wait() return */
  78.   int        flag;        /* flags - see #defines above */
  79.   struct proc    *pproc;     /* parent's struct proc */
  80.   jmp_buf    vreg;        /* process context */
  81.   };
  82.  
  83. extern struct proc *__u;    /* current process */
  84.  
  85. struct sfile            /* special file list */
  86.   {
  87.   char        *name;
  88.   dev_t     dev;
  89.   };
  90.  
  91. extern struct sfile __sfile[];        /* defined in open.c */
  92.  
  93. struct sdir                /* special directory list */
  94.   {
  95.   char        *name;
  96.   char        *riscos_name;
  97.   };
  98.  
  99. #define MAXSDIR 16
  100.  
  101. extern struct sdir __sdir[MAXSDIR];    /* defined in unix.c */
  102.  
  103. #define MAXSFIX 32
  104.  
  105. extern char *__sfix[MAXSFIX];        /* special suffix list */
  106.  
  107. struct pipe
  108.   {
  109.   struct file    *p[2];
  110.   char        *file;
  111.   struct pipe    *next;
  112.   };
  113.  
  114. extern struct pipe *__pipe;    /* list of currently active pipes */
  115.  
  116.  
  117. extern int __envcnt,__envsiz;        /* count of strings in **environ */
  118. extern char *__addenv(const char *,char *);    /* add/replace string,value */
  119. extern char *__chkenv(const char *); /* check if string exists in **environ */
  120.  
  121. extern char *__getenv(const char *,int);
  122. extern int __intenv(const char *,int); /* integer getenv() - 0 if nonexistent */
  123.  
  124. extern char *__permstr(const char *);    /* malloc() + memcpy() */
  125.  
  126. #ifdef __cplusplus
  127.     }
  128. #endif
  129.  
  130. #endif
  131.