home *** CD-ROM | disk | FTP | other *** search
- /* sys/unix.h (c) Copyright 1990 H.Rogers */
-
- /* UNIX is a registered trademark of AT&T Bell Laboratories */
-
- #ifndef __SYS_UNIX_H
- #define __SYS_UNIX_H
-
- #ifndef __SYS_TYPES_H
- #include <sys/types.h>
- #endif
-
- #ifndef __SYS_STAT_H
- #include <sys/stat.h>
- #endif
-
- #ifndef __SYS_PARAM_H
- #include <sys/param.h>
- #endif
-
- #ifndef __SYS_TTY_H
- #include <sys/tty.h>
- #endif
-
- #ifndef __SETJMP_H
- #include <setjmp.h>
- #endif
-
- #define MAXFD 64
-
- #ifndef __UNISTD_H
- #include <unistd.h>
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /* the 2 functions below are automatically called in normal circumstances */
-
- extern void __unixinit(void); /* initialise UNIX */
- extern void __unixexit(void); /* shutdown UNIX */
-
- struct file
- {
- dev_t dev; /* device */
- int oflag; /* oflag */
- struct file *dup; /* dup list */
- int pid; /* pid of owner */
- int r[6]; /* OS_File r0 -> r5 */
- };
-
- #define BADF(f) (!(((f) >= 0 && (f) < MAXFD) ? (__u->file[f].dup) : 0))
-
- extern int __fdalloc(void);
-
- #define __U_ZCLD 000000000001 /* 'zombie child exists' flag */
- #define __U_PPROC 000000000002 /* 'u_pproc valid' flag */
- #define __U_TTY 000000177400 /* controlling tty */
- #define __U_TTYSHIFT 8
-
- struct proc
- {
- int argc; /* main(argc,argv) */
- char **argv;
- char *argb;
- struct file file[MAXFD]; /* FD set */
- struct tty *tty;
- int uid;
- int euid;
- int gid;
- int egid;
- int pgrp;
- int pid;
- int ppid;
- int umask;
- int alarm; /* alarm() time */
- int wait; /* wait() return */
- int flag; /* flags - see #defines above */
- struct proc *pproc; /* parent's struct proc */
- jmp_buf vreg; /* process context */
- };
-
- extern struct proc *__u; /* current process */
-
- struct sfile /* special file list */
- {
- char *name;
- dev_t dev;
- };
-
- extern struct sfile __sfile[]; /* defined in open.c */
-
- struct sdir /* special directory list */
- {
- char *name;
- char *riscos_name;
- };
-
- #define MAXSDIR 16
-
- extern struct sdir __sdir[MAXSDIR]; /* defined in unix.c */
-
- #define MAXSFIX 32
-
- extern char *__sfix[MAXSFIX]; /* special suffix list */
-
- struct pipe
- {
- struct file *p[2];
- char *file;
- struct pipe *next;
- };
-
- extern struct pipe *__pipe; /* list of currently active pipes */
-
-
- extern int __envcnt,__envsiz; /* count of strings in **environ */
- extern char *__addenv(const char *,char *); /* add/replace string,value */
- extern char *__chkenv(const char *); /* check if string exists in **environ */
-
- extern char *__getenv(const char *,int);
- extern int __intenv(const char *,int); /* integer getenv() - 0 if nonexistent */
-
- extern char *__permstr(const char *); /* malloc() + memcpy() */
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-