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

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

unix.superglobalmegacorp.com

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