Annotation of MiNT/src/file.h, revision 1.1.1.1

1.1       root        1: /*
                      2: 
                      3: Copyright 1991,1992 Eric R. Smith. All rights reserved.
                      4: 
                      5: */
                      6: 
                      7: 
                      8: 
                      9: #ifndef _filesys_h
                     10: 
                     11: #define _filesys_h
                     12: 
                     13: 
                     14: 
                     15: struct filesys;                /* forward declaration */
                     16: 
                     17: struct devdrv;         /* ditto */
                     18: 
                     19: 
                     20: 
                     21: typedef struct f_cookie {
                     22: 
                     23:        struct filesys *fs;     /* filesystem that knows about this cookie */
                     24: 
                     25:        ushort  dev;            /* device info (e.g. Rwabs device number) */
                     26: 
                     27:        ushort  aux;            /* extra data that the file system may want */
                     28: 
                     29:        long    index;          /* this+dev uniquely identifies a file */
                     30: 
                     31: } fcookie;
                     32: 
                     33: 
                     34: 
                     35: #define TOS_NAMELEN 13
                     36: 
                     37: 
                     38: 
                     39: typedef struct dtabuf {
                     40: 
                     41:        short   index;          /* index into arrays in the PROC struct */
                     42: 
                     43:        long    magic;
                     44: 
                     45: #define SVALID 0x1234fedc      /* magic for a valid search */
                     46: 
                     47: #define EVALID 0x5678ba90      /* magic for an exhausted search */
                     48: 
                     49: 
                     50: 
                     51:        char    dta_pat[TOS_NAMELEN+1]; /* pointer to pattern, if necessary */
                     52: 
                     53:        char    dta_sattrib;    /* attributes being searched for */
                     54: 
                     55: /* this stuff is returned to the user */
                     56: 
                     57:        char    dta_attrib;
                     58: 
                     59:        short   dta_time;
                     60: 
                     61:        short   dta_date;
                     62: 
                     63:        long    dta_size;
                     64: 
                     65:        char    dta_name[TOS_NAMELEN];
                     66: 
                     67: } DTABUF;
                     68: 
                     69: 
                     70: 
                     71: /* structure for opendir/readdir/closedir */
                     72: 
                     73: typedef struct dirstruct {
                     74: 
                     75:        fcookie fc;             /* cookie for this directory */
                     76: 
                     77:        ushort  index;          /* index of the current entry */
                     78: 
                     79:        ushort  flags;          /* flags (e.g. tos or not) */
                     80: 
                     81: #define TOS_SEARCH     0x01
                     82: 
                     83:        char    fsstuff[60];    /* anything else the file system wants */
                     84: 
                     85:                                /* NOTE: this must be at least 45 bytes */
                     86: 
                     87: } DIR;
                     88: 
                     89: 
                     90: 
                     91: /* structure for getxattr */
                     92: 
                     93: typedef struct xattr {
                     94: 
                     95:        ushort  mode;
                     96: 
                     97: /* file types */
                     98: 
                     99: #define S_IFMT 0170000         /* mask to select file type */
                    100: 
                    101: #define S_IFCHR        0020000         /* BIOS special file */
                    102: 
                    103: #define S_IFDIR        0040000         /* directory file */
                    104: 
                    105: #define S_IFREG 0100000                /* regular file */
                    106: 
                    107: #define S_IFIFO 0120000                /* FIFO */
                    108: 
                    109: #define S_IMEM 0140000         /* memory region or process */
                    110: 
                    111: #define S_IFLNK        0160000         /* symbolic link */
                    112: 
                    113: 
                    114: 
                    115: /* special bits: setuid, setgid, sticky bit */
                    116: 
                    117: #define S_ISUID        04000
                    118: 
                    119: #define S_ISGID 02000
                    120: 
                    121: #define S_ISVTX        01000
                    122: 
                    123: 
                    124: 
                    125: /* file access modes for user, group, and other*/
                    126: 
                    127: #define S_IRUSR        0400
                    128: 
                    129: #define S_IWUSR 0200
                    130: 
                    131: #define S_IXUSR 0100
                    132: 
                    133: #define S_IRGRP 0040
                    134: 
                    135: #define S_IWGRP        0020
                    136: 
                    137: #define S_IXGRP        0010
                    138: 
                    139: #define S_IROTH        0004
                    140: 
                    141: #define S_IWOTH        0002
                    142: 
                    143: #define S_IXOTH        0001
                    144: 
                    145: #define DEFAULT_DIRMODE (0777)
                    146: 
                    147: #define DEFAULT_MODE   (0666)
                    148: 
                    149:        long    index;
                    150: 
                    151:        ushort  dev;
                    152: 
                    153:        ushort  reserved1;
                    154: 
                    155:        ushort  nlink;
                    156: 
                    157:        ushort  uid;
                    158: 
                    159:        ushort  gid;
                    160: 
                    161:        long    size;
                    162: 
                    163:        long    blksize;
                    164: 
                    165:        long    nblocks;
                    166: 
                    167:        short   mtime, mdate;
                    168: 
                    169:        short   atime, adate;
                    170: 
                    171:        short   ctime, cdate;
                    172: 
                    173:        short   attr;
                    174: 
                    175: /* defines for TOS attribute bytes */
                    176: 
                    177: #ifndef FA_RDONLY
                    178: 
                    179: #define               FA_RDONLY               0x01
                    180: 
                    181: #define               FA_HIDDEN               0x02
                    182: 
                    183: #define               FA_SYSTEM               0x04
                    184: 
                    185: #define               FA_LABEL                0x08
                    186: 
                    187: #define               FA_DIR                  0x10
                    188: 
                    189: #define               FA_CHANGED              0x20
                    190: 
                    191: #endif
                    192: 
                    193:        short   reserved2;
                    194: 
                    195:        long    reserved3[2];
                    196: 
                    197: } XATTR;
                    198: 
                    199: 
                    200: 
                    201: typedef struct fileptr {
                    202: 
                    203:        short   links;      /* number of copies of this descriptor */
                    204: 
                    205:        ushort  flags;      /* file open mode and other file flags */
                    206: 
                    207:        long    pos;        /* position in file */
                    208: 
                    209:        long    devinfo;    /* device driver specific info */
                    210: 
                    211:        fcookie fc;         /* file system cookie for this file */
                    212: 
                    213:        struct devdrv *dev; /* device driver that knows how to deal with this */
                    214: 
                    215:        struct fileptr *next; /* link to next fileptr for this file */
                    216: 
                    217: } FILEPTR;
                    218: 
                    219: 
                    220: 
                    221: struct flock {
                    222: 
                    223:        short l_type;                   /* type of lock */
                    224: 
                    225: #define F_RDLCK                0
                    226: 
                    227: #define F_WRLCK                1
                    228: 
                    229: #define F_UNLCK                3
                    230: 
                    231:        short l_whence;                 /* SEEK_SET, SEEK_CUR, SEEK_END */
                    232: 
                    233:        long l_start;                   /* start of locked region */
                    234: 
                    235:        long l_len;                     /* length of locked region */
                    236: 
                    237:        short l_pid;                    /* pid of locking process
                    238: 
                    239:                                                (F_GETLK only) */
                    240: 
                    241: };
                    242: 
                    243: 
                    244: 
                    245: /* structure for internal kernel locks */
                    246: 
                    247: typedef struct ilock {
                    248: 
                    249:        struct flock l;         /* the actual lock */
                    250: 
                    251:        struct ilock *next;     /* next lock in the list */
                    252: 
                    253:        long    reserved[4];    /* reserved for future expansion */
                    254: 
                    255: } LOCK;
                    256: 
                    257: 
                    258: 
                    259: typedef struct devdrv {
                    260: 
                    261:        long (*open)    P_((FILEPTR *f));
                    262: 
                    263:        long (*write)   P_((FILEPTR *f, const char *buf, long bytes));
                    264: 
                    265:        long (*read)    P_((FILEPTR *f, char *buf, long bytes));
                    266: 
                    267:        long (*lseek)   P_((FILEPTR *f, long where, int whence));
                    268: 
                    269:        long (*ioctl)   P_((FILEPTR *f, int mode, void *buf));
                    270: 
                    271:        long (*datime)  P_((FILEPTR *f, short *timeptr, int rwflag));
                    272: 
                    273:        long (*close)   P_((FILEPTR *f, int pid));
                    274: 
                    275:        long (*select)  P_((FILEPTR *f, long proc, int mode));
                    276: 
                    277:        void (*unselect) P_((FILEPTR *f, long proc, int mode));
                    278: 
                    279: } DEVDRV;
                    280: 
                    281: 
                    282: 
                    283: typedef struct filesys {
                    284: 
                    285:        struct  filesys *next;  /* link to next file system on chain */
                    286: 
                    287:        long    fsflags;
                    288: 
                    289: #define FS_KNOPARSE    0x01    /* kernel shouldn't do parsing */
                    290: 
                    291: #define FS_CASESENSITIVE       0x02    /* file names are case sensitive */
                    292: 
                    293: #define FS_NOXBIT      0x04    /* if a file can be read, it can be executed */
                    294: 
                    295: 
                    296: 
                    297:        long    (*root) P_((int drv, fcookie *fc));
                    298: 
                    299:        long    (*lookup) P_((fcookie *dir, const char *name, fcookie *fc));
                    300: 
                    301:        long    (*creat) P_((fcookie *dir, const char *name, unsigned mode,
                    302: 
                    303:                                int attrib, fcookie *fc));
                    304: 
                    305:        DEVDRV *(*getdev) P_((fcookie *fc, long *devspecial));
                    306: 
                    307:        long    (*getxattr) P_((fcookie *file, XATTR *xattr));
                    308: 
                    309:        long    (*chattr) P_((fcookie *file, int attr));
                    310: 
                    311:        long    (*chown) P_((fcookie *file, int uid, int gid));
                    312: 
                    313:        long    (*chmode) P_((fcookie *file, unsigned mode));
                    314: 
                    315:        long    (*mkdir) P_((fcookie *dir, const char *name, unsigned mode));
                    316: 
                    317:        long    (*rmdir) P_((fcookie *dir, const char *name));
                    318: 
                    319:        long    (*remove) P_((fcookie *dir, const char *name));
                    320: 
                    321:        long    (*getname) P_((fcookie *relto, fcookie *dir, char *pathname));
                    322: 
                    323:        long    (*rename) P_((fcookie *olddir, char *oldname,
                    324: 
                    325:                            fcookie *newdir, const char *newname));
                    326: 
                    327:        long    (*opendir) P_((DIR *dirh, int tosflag));
                    328: 
                    329:        long    (*readdir) P_((DIR *dirh, char *name, int namelen, fcookie *fc));
                    330: 
                    331:        long    (*rewinddir) P_((DIR *dirh));
                    332: 
                    333:        long    (*closedir) P_((DIR *dirh));
                    334: 
                    335:        long    (*pathconf) P_((fcookie *dir, int which));
                    336: 
                    337:        long    (*dfree) P_((fcookie *dir, long *buf));
                    338: 
                    339:        long    (*writelabel) P_((fcookie *dir, const char *name));
                    340: 
                    341:        long    (*readlabel) P_((fcookie *dir, char *name, int namelen));
                    342: 
                    343:        long    (*symlink) P_((fcookie *dir, const char *name, const char *to));
                    344: 
                    345:        long    (*readlink) P_((fcookie *dir, char *buf, int len));
                    346: 
                    347:        long    (*hardlink) P_((fcookie *fromdir, const char *fromname,
                    348: 
                    349:                                fcookie *todir, const char *toname));
                    350: 
                    351:        long    (*fscntl) P_((fcookie *dir, const char *name, int cmd, long arg));
                    352: 
                    353:        long    (*dskchng) P_((int drv));
                    354: 
                    355:        long    zero;
                    356: 
                    357: } FILESYS;
                    358: 
                    359: 
                    360: 
                    361: /*
                    362: 
                    363:  * this is the structure passed to loaded file systems to tell them
                    364: 
                    365:  * about the kernel
                    366: 
                    367:  */
                    368: 
                    369: 
                    370: 
                    371: struct kerinfo {
                    372: 
                    373:        short   maj_version;    /* kernel version number */
                    374: 
                    375:        short   min_version;    /* minor kernel version number */
                    376: 
                    377:        ushort  default_perm;   /* default file permissions */
                    378: 
                    379:        short   reserved1;      /* room for expansion */
                    380: 
                    381: 
                    382: 
                    383: /* OS functions */
                    384: 
                    385:        Func    *bios_tab;      /* pointer to the BIOS entry points */
                    386: 
                    387:        Func    *dos_tab;       /* pointer to the GEMDOS entry points */
                    388: 
                    389: 
                    390: 
                    391: /* media change vector */
                    392: 
                    393:        void    (*drvchng) P_((unsigned));
                    394: 
                    395: 
                    396: 
                    397: /* Debugging stuff */
                    398: 
                    399:        void    (*trace) P_((const char *, ...));
                    400: 
                    401:        void    (*debug) P_((const char *, ...));
                    402: 
                    403:        void    (*alert) P_((const char *, ...));
                    404: 
                    405:        EXITING void (*fatal) P_((const char *, ...));
                    406: 
                    407: 
                    408: 
                    409: /* memory allocation functions */
                    410: 
                    411:        void *  (*kmalloc) P_((long));
                    412: 
                    413:        void    (*kfree) P_((void *));
                    414: 
                    415:        void *  (*umalloc) P_((long));
                    416: 
                    417:        void    (*ufree) P_((void *));
                    418: 
                    419: 
                    420: 
                    421: /* utility functions for string manipulation */
                    422: 
                    423:        int     (*strnicmp) P_((const char *, const char *, int));
                    424: 
                    425:        int     (*stricmp) P_((const char *, const char *));
                    426: 
                    427:        char *  (*strlwr) P_((char *));
                    428: 
                    429:        char *  (*strupr) P_((char *));
                    430: 
                    431:        int     (*sprintf) P_((char *, const char *, ...));
                    432: 
                    433: 
                    434: 
                    435: /* utility functions for manipulating time */
                    436: 
                    437:        void    (*millis_time) P_((unsigned long, short *));
                    438: 
                    439:        long    (*unixtim) P_((unsigned, unsigned));
                    440: 
                    441:        long    (*dostim) P_((long));
                    442: 
                    443: 
                    444: 
                    445: /* utility functions for dealing with pauses, or for putting processes
                    446: 
                    447:  * to sleep
                    448: 
                    449:  */
                    450: 
                    451:        void    (*nap) P_((unsigned));
                    452: 
                    453:        void    (*sleep) P_((int que, long cond));
                    454: 
                    455:        void    (*wake) P_((int que, long cond));
                    456: 
                    457:        void    (*wakeselect) P_((long param));
                    458: 
                    459: 
                    460: 
                    461: /* file system utility functions */
                    462: 
                    463:        int     (*denyshare) P_((FILEPTR *, FILEPTR *));
                    464: 
                    465: 
                    466: 
                    467: /* reserved for future use */
                    468: 
                    469:        LOCK *  (*denylock) P_((LOCK *, LOCK *));
                    470: 
                    471:        long    res2[9];
                    472: 
                    473: };
                    474: 
                    475: 
                    476: 
                    477: /* flags for open() modes */
                    478: 
                    479: #define O_RWMODE       0x03    /* isolates file read/write mode */
                    480: 
                    481: #      define O_RDONLY 0x00
                    482: 
                    483: #      define O_WRONLY 0x01
                    484: 
                    485: #      define O_RDWR   0x02
                    486: 
                    487: #      define O_EXEC   0x03    /* execute file; used by kernel only */
                    488: 
                    489: 
                    490: 
                    491: /* 0x04 is for future expansion */
                    492: 
                    493: #define O_APPEND       0x08    /* all writes go to end of file */
                    494: 
                    495: 
                    496: 
                    497: #define O_SHMODE       0x70    /* isolates file sharing mode */
                    498: 
                    499: #      define O_COMPAT 0x00    /* compatibility mode */
                    500: 
                    501: #      define O_DENYRW 0x10    /* deny both read and write access */
                    502: 
                    503: #      define O_DENYW  0x20    /* deny write access to others */
                    504: 
                    505: #      define O_DENYR  0x30    /* deny read access to others */
                    506: 
                    507: #      define O_DENYNONE 0x40  /* don't deny any access to others */
                    508: 
                    509: 
                    510: 
                    511: #define O_NOINHERIT    0x80    /* private file (not passed to child) */
                    512: 
                    513: 
                    514: 
                    515: #define O_NDELAY       0x100   /* don't block for i/o on this file */
                    516: 
                    517: #define O_CREAT                0x200   /* create file if it doesn't exist */
                    518: 
                    519: #define O_TRUNC                0x400   /* truncate file to 0 bytes if it does exist */
                    520: 
                    521: #define O_EXCL         0x800   /* fail open if file exists */
                    522: 
                    523: 
                    524: 
                    525: #define O_USER         0x0fff  /* isolates user-settable flag bits */
                    526: 
                    527: 
                    528: 
                    529: #define O_GLOBAL       0x1000  /* for opening a global file */
                    530: 
                    531: 
                    532: 
                    533: /* kernel mode bits -- the user can't set these! */
                    534: 
                    535: #define O_TTY          0x2000
                    536: 
                    537: #define O_HEAD         0x4000
                    538: 
                    539: #define O_LOCK         0x8000
                    540: 
                    541: 
                    542: 
                    543: /* GEMDOS file attributes */
                    544: 
                    545: 
                    546: 
                    547: /* macros to be applied to FILEPTRS to determine their type */
                    548: 
                    549: #define is_terminal(f) (f->flags & O_TTY)
                    550: 
                    551: 
                    552: 
                    553: /* lseek() origins */
                    554: 
                    555: #define        SEEK_SET        0               /* from beginning of file */
                    556: 
                    557: #define        SEEK_CUR        1               /* from current location */
                    558: 
                    559: #define        SEEK_END        2               /* from end of file */
                    560: 
                    561: 
                    562: 
                    563: /* The requests for Dpathconf() */
                    564: 
                    565: #define DP_IOPEN       0       /* internal limit on # of open files */
                    566: 
                    567: #define DP_MAXLINKS    1       /* max number of hard links to a file */
                    568: 
                    569: #define DP_PATHMAX     2       /* max path name length */
                    570: 
                    571: #define DP_NAMEMAX     3       /* max length of an individual file name */
                    572: 
                    573: #define DP_ATOMIC      4       /* # of bytes that can be written atomically */
                    574: 
                    575: #define DP_TRUNC       5       /* file name truncation behavior */
                    576: 
                    577: #      define  DP_NOTRUNC      0       /* long filenames give an error */
                    578: 
                    579: #      define  DP_AUTOTRUNC    1       /* long filenames truncated */
                    580: 
                    581: #      define  DP_DOSTRUNC     2       /* DOS truncation rules in effect */
                    582: 
                    583: #define DP_CASE                6
                    584: 
                    585: #      define  DP_CASESENS     0       /* case sensitive */
                    586: 
                    587: #      define  DP_CASECONV     1       /* case always converted */
                    588: 
                    589: #      define  DP_CASEINSENS   2       /* case insensitive, preserved */
                    590: 
                    591: #define DP_MAXREQ      6       /* highest legal request */
                    592: 
                    593: 
                    594: 
                    595: /* Dpathconf and Sysconf return this when a value is not limited
                    596: 
                    597:    (or is limited only by available memory) */
                    598: 
                    599: 
                    600: 
                    601: #define UNLIMITED      0x7fffffffL
                    602: 
                    603: 
                    604: 
                    605: /* various character constants and defines for TTY's */
                    606: 
                    607: #define MiNTEOF 0x0000ff1a     /* 1a == ^Z */
                    608: 
                    609: 
                    610: 
                    611: /* defines for tty_read */
                    612: 
                    613: #define RAW    0
                    614: 
                    615: #define COOKED 0x1
                    616: 
                    617: #define NOECHO 0
                    618: 
                    619: #define ECHO   0x2
                    620: 
                    621: #define ESCSEQ 0x04            /* cursor keys, etc. get escape sequences */
                    622: 
                    623: 
                    624: 
                    625: /* constants for Fcntl calls */
                    626: 
                    627: #define F_DUPFD                0               /* handled by kernel */
                    628: 
                    629: #define F_GETFD                1               /* handled by kernel */
                    630: 
                    631: #define F_SETFD                2               /* handled by kernel */
                    632: 
                    633: #      define FD_CLOEXEC       1       /* close on exec flag */
                    634: 
                    635: 
                    636: 
                    637: #define F_GETFL                3               /* handled by kernel */
                    638: 
                    639: #define F_SETFL                4               /* handled by kernel */
                    640: 
                    641: #define F_GETLK                5
                    642: 
                    643: #define F_SETLK                6
                    644: 
                    645: 
                    646: 
                    647: /* more constants for various Fcntl's */
                    648: 
                    649: #define FSTAT          (('F'<< 8) | 0)         /* handled by kernel */
                    650: 
                    651: #define FIONREAD       (('F'<< 8) | 1)
                    652: 
                    653: #define FIONWRITE      (('F'<< 8) | 2)
                    654: 
                    655: #define TIOCGETP       (('T'<< 8) | 0)
                    656: 
                    657: #define TIOCSETP       (('T'<< 8) | 1)
                    658: 
                    659: #define TIOCSETN       TIOCSETP
                    660: 
                    661: #define TIOCGETC       (('T'<< 8) | 2)
                    662: 
                    663: #define TIOCSETC       (('T'<< 8) | 3)
                    664: 
                    665: #define TIOCGLTC       (('T'<< 8) | 4)
                    666: 
                    667: #define TIOCSLTC       (('T'<< 8) | 5)
                    668: 
                    669: #define TIOCGPGRP      (('T'<< 8) | 6)
                    670: 
                    671: #define TIOCSPGRP      (('T'<< 8) | 7)
                    672: 
                    673: #define TIOCFLUSH      (('T'<< 8) | 8)
                    674: 
                    675: #define TIOCSTOP       (('T'<< 8) | 9)
                    676: 
                    677: #define TIOCSTART      (('T'<< 8) | 10)
                    678: 
                    679: #define TIOCGWINSZ     (('T'<< 8) | 11)
                    680: 
                    681: #define TIOCSWINSZ     (('T'<< 8) | 12)
                    682: 
                    683: #define TIOCGXKEY      (('T'<< 8) | 13)
                    684: 
                    685: #define TIOCSXKEY      (('T'<< 8) | 14)
                    686: 
                    687: #define TIOCIBAUD      (('T'<< 8) | 18)
                    688: 
                    689: #define TIOCOBAUD      (('T'<< 8) | 19)
                    690: 
                    691: #define TIOCCBRK       (('T'<< 8) | 20)
                    692: 
                    693: #define TIOCSBRK       (('T'<< 8) | 21)
                    694: 
                    695: #define TIOCGFLAGS     (('T'<< 8) | 22)
                    696: 
                    697: #define TIOCSFLAGS     (('T'<< 8) | 23)
                    698: 
                    699: 
                    700: 
                    701: #define PPROCADDR      (('P'<< 8) | 1)
                    702: 
                    703: #define PBASEADDR      (('P'<< 8) | 2)
                    704: 
                    705: #define PCTXTSIZE      (('P'<< 8) | 3)
                    706: 
                    707: #define PSETFLAGS      (('P'<< 8) | 4)
                    708: 
                    709: #define PGETFLAGS      (('P'<< 8) | 5)
                    710: 
                    711: 
                    712: 
                    713: #define SHMGETBLK      (('M'<< 8) | 0)
                    714: 
                    715: #define SHMSETBLK      (('M'<< 8) | 1)
                    716: 
                    717: 
                    718: 
                    719: /* terminal control constants (tty.sg_flags) */
                    720: 
                    721: #define T_CRMOD                0x0001
                    722: 
                    723: #define T_CBREAK       0x0002
                    724: 
                    725: #define T_ECHO         0x0004
                    726: 
                    727: /* #define T_XTABS     0x0008  unimplemented*/
                    728: 
                    729: #define T_RAW          0x0010
                    730: 
                    731: /* #define T_LCASE     0x0020  unimplemented */
                    732: 
                    733: 
                    734: 
                    735: #define T_NOFLSH       0x0040          /* don't flush buffer when signals
                    736: 
                    737:                                           are received */
                    738: 
                    739: #define T_TOS          0x0080
                    740: 
                    741: #define T_TOSTOP       0x0100
                    742: 
                    743: #define T_XKEY         0x0200          /* Fread returns escape sequences for
                    744: 
                    745:                                           cursor keys, etc. */
                    746: 
                    747: /* 0x0400 and 0x0800 still available */
                    748: 
                    749: #define T_TANDEM       0x1000
                    750: 
                    751: #define T_RTSCTS       0x2000
                    752: 
                    753: #define T_EVENP                0x4000          /* EVENP and ODDP are mutually exclusive */
                    754: 
                    755: #define T_ODDP         0x8000
                    756: 
                    757: 
                    758: 
                    759: #define TF_FLAGS       0xF000
                    760: 
                    761: 
                    762: 
                    763: /* some flags for TIOC[GS]FLAGS */
                    764: 
                    765: #define TF_STOPBITS    0x0003
                    766: 
                    767: #define TF_1STOP       0x0001
                    768: 
                    769: #define TF_15STOP      0x0002
                    770: 
                    771: #define        TF_2STOP        0x0003
                    772: 
                    773: 
                    774: 
                    775: #define TF_CHARBITS    0x000C
                    776: 
                    777: #define TF_8BIT                0
                    778: 
                    779: #define TF_7BIT                0x4
                    780: 
                    781: #define TF_6BIT                0x8
                    782: 
                    783: #define TF_5BIT                0xC
                    784: 
                    785: 
                    786: 
                    787: /* the following are terminal status flags (tty.state) */
                    788: 
                    789: /* (the low byte of tty.state indicates a part of an escape sequence still
                    790: 
                    791:  * hasn't been read by Fread, and is an index into that escape sequence)
                    792: 
                    793:  */
                    794: 
                    795: #define TS_ESC         0x00ff
                    796: 
                    797: #define TS_HOLD                0x1000          /* hold (e.g. ^S/^Q) */
                    798: 
                    799: #define TS_COOKED      0x8000          /* interpret control chars */
                    800: 
                    801: 
                    802: 
                    803: /* structures for terminals */
                    804: 
                    805: struct tchars {
                    806: 
                    807:        char t_intrc;
                    808: 
                    809:        char t_quitc;
                    810: 
                    811:        char t_startc;
                    812: 
                    813:        char t_stopc;
                    814: 
                    815:        char t_eofc;
                    816: 
                    817:        char t_brkc;
                    818: 
                    819: };
                    820: 
                    821: 
                    822: 
                    823: struct ltchars {
                    824: 
                    825:        char t_suspc;
                    826: 
                    827:        char t_dsuspc;
                    828: 
                    829:        char t_rprntc;
                    830: 
                    831:        char t_flushc;
                    832: 
                    833:        char t_werasc;
                    834: 
                    835:        char t_lnextc;
                    836: 
                    837: };
                    838: 
                    839: 
                    840: 
                    841: struct sgttyb {
                    842: 
                    843:        char sg_ispeed;
                    844: 
                    845:        char sg_ospeed;
                    846: 
                    847:        char sg_erase;
                    848: 
                    849:        char sg_kill;
                    850: 
                    851:        ushort sg_flags;
                    852: 
                    853: };
                    854: 
                    855: 
                    856: 
                    857: struct winsize {
                    858: 
                    859:        short   ws_row;
                    860: 
                    861:        short   ws_col;
                    862: 
                    863:        short   ws_xpixel;
                    864: 
                    865:        short   ws_ypixel;
                    866: 
                    867: };
                    868: 
                    869: 
                    870: 
                    871: struct xkey {
                    872: 
                    873:        short   xk_num;
                    874: 
                    875:        char    xk_def[8];
                    876: 
                    877: };
                    878: 
                    879: 
                    880: 
                    881: struct tty {
                    882: 
                    883:        short           pgrp;           /* process group of terminal */
                    884: 
                    885:        short           state;          /* terminal status, e.g. stopped */
                    886: 
                    887:        short           use_cnt;        /* number of times terminal is open */
                    888: 
                    889:        short           res1;           /* reserved for future expansion */
                    890: 
                    891:        struct sgttyb   sg;
                    892: 
                    893:        struct tchars   tc;
                    894: 
                    895:        struct ltchars  ltc;
                    896: 
                    897:        struct winsize  wsiz;
                    898: 
                    899:        long            rsel;           /* selecting process for read */
                    900: 
                    901:        long            wsel;           /* selecting process for write */
                    902: 
                    903:        char            *xkey;          /* extended keyboard table */
                    904: 
                    905:        long            resrvd[3];      /* for future expansion */
                    906: 
                    907: };
                    908: 
                    909: 
                    910: 
                    911: /* Dcntl constants and types */
                    912: 
                    913: #define DEV_NEWTTY     0xde00
                    914: 
                    915: #define DEV_NEWBIOS    0xde01
                    916: 
                    917: #define DEV_INSTALL    0xde02
                    918: 
                    919: 
                    920: 
                    921: struct dev_descr {
                    922: 
                    923:        DEVDRV  *driver;
                    924: 
                    925:        short   dinfo;
                    926: 
                    927:        short   flags;
                    928: 
                    929:        struct tty *tty;
                    930: 
                    931:        long    reserved[4];
                    932: 
                    933: };
                    934: 
                    935: 
                    936: 
                    937: /* external variables */
                    938: 
                    939: 
                    940: 
                    941: #define NUM_DRIVES 32
                    942: 
                    943: extern FILESYS *drives[NUM_DRIVES];
                    944: 
                    945: 
                    946: 
                    947: #define BIOSDRV ('V'-'A')
                    948: 
                    949: #define PIPEDRV ('Q'-'A')
                    950: 
                    951: #define PROCDRV ('X'-'A')
                    952: 
                    953: #define UNIDRV ('U'-'A')
                    954: 
                    955: 
                    956: 
                    957: #define PSEUDODRVS ((1L<<BIOSDRV)|(1L<<PIPEDRV)|(1L<<PROCDRV)|(1L<<UNIDRV))
                    958: 
                    959: 
                    960: 
                    961: #define PROC_BASE_DEV 0xA000
                    962: 
                    963: #define SHMDEVICE 0xB000
                    964: 
                    965: 
                    966: 
                    967: extern struct tty default_tty;
                    968: 
                    969: extern char follow_links[];
                    970: 
                    971: 
                    972: 
                    973: #endif /* _filesys_h */
                    974: 

unix.superglobalmegacorp.com

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