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

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

unix.superglobalmegacorp.com

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