|
|
1.1 root 1: /*
2:
1.1.1.3 root 3: Copyright 1991,1992 Eric R. Smith.
4:
1.1.1.5 root 5: Copyright 1992,1993,1994 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:
1.1.1.6 ! root 117: #define S_IFIFO 0120000 /* FIFO */
1.1 root 118:
1.1.1.6 ! root 119: #define S_IFMEM 0140000 /* memory region or process */
1.1 root 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:
1.1.1.5 root 163: ushort rdev; /* "real" device */
1.1 root 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.6 ! root 287: void ARGS_ON_STACK (*unselect) P_((FILEPTR *f, long proc, int mode));
! 288:
! 289: /* extensions, check dev_descr.drvsize (size of DEVDRV struct) before calling:
! 290:
! 291: * fast RAW tty byte io */
! 292:
! 293: long ARGS_ON_STACK (*writeb) P_((FILEPTR *f, const char *buf, long bytes));
! 294:
! 295: long ARGS_ON_STACK (*readb) P_((FILEPTR *f, char *buf, long bytes));
! 296:
! 297: /* what about: scatter/gather io for DMA devices...
! 298:
! 299: * long ARGS_ON_STACK (*writev) P_((FILEPTR *f, const struct iovec *iov, long cnt));
! 300:
! 301: * long ARGS_ON_STACK (*readv) P_((FILEPTR *f, const struct iovec *iov, long cnt));
! 302:
! 303: */
1.1 root 304:
305: } DEVDRV;
306:
307:
308:
309: typedef struct filesys {
310:
311: struct filesys *next; /* link to next file system on chain */
312:
313: long fsflags;
314:
315: #define FS_KNOPARSE 0x01 /* kernel shouldn't do parsing */
316:
317: #define FS_CASESENSITIVE 0x02 /* file names are case sensitive */
318:
319: #define FS_NOXBIT 0x04 /* if a file can be read, it can be executed */
320:
1.1.1.3 root 321: #define FS_LONGPATH 0x08 /* file system understands "size" argument to
1.1 root 322:
1.1.1.3 root 323: "getname" */
1.1 root 324:
1.1.1.2 root 325: long ARGS_ON_STACK (*root) P_((int drv, fcookie *fc));
1.1 root 326:
1.1.1.2 root 327: long ARGS_ON_STACK (*lookup) P_((fcookie *dir, const char *name, fcookie *fc));
1.1 root 328:
1.1.1.2 root 329: long ARGS_ON_STACK (*creat) P_((fcookie *dir, const char *name, unsigned mode,
1.1 root 330:
331: int attrib, fcookie *fc));
332:
1.1.1.2 root 333: DEVDRV * ARGS_ON_STACK (*getdev) P_((fcookie *fc, long *devspecial));
1.1 root 334:
1.1.1.2 root 335: long ARGS_ON_STACK (*getxattr) P_((fcookie *file, XATTR *xattr));
1.1 root 336:
1.1.1.2 root 337: long ARGS_ON_STACK (*chattr) P_((fcookie *file, int attr));
1.1 root 338:
1.1.1.2 root 339: long ARGS_ON_STACK (*chown) P_((fcookie *file, int uid, int gid));
1.1 root 340:
1.1.1.2 root 341: long ARGS_ON_STACK (*chmode) P_((fcookie *file, unsigned mode));
1.1 root 342:
1.1.1.2 root 343: long ARGS_ON_STACK (*mkdir) P_((fcookie *dir, const char *name, unsigned mode));
1.1 root 344:
1.1.1.2 root 345: long ARGS_ON_STACK (*rmdir) P_((fcookie *dir, const char *name));
1.1 root 346:
1.1.1.2 root 347: long ARGS_ON_STACK (*remove) P_((fcookie *dir, const char *name));
1.1 root 348:
1.1.1.3 root 349: long ARGS_ON_STACK (*getname) P_((fcookie *relto, fcookie *dir,
350:
351: char *pathname, int size));
1.1 root 352:
1.1.1.2 root 353: long ARGS_ON_STACK (*rename) P_((fcookie *olddir, char *oldname,
1.1 root 354:
355: fcookie *newdir, const char *newname));
356:
1.1.1.2 root 357: long ARGS_ON_STACK (*opendir) P_((DIR *dirh, int tosflag));
1.1 root 358:
1.1.1.2 root 359: long ARGS_ON_STACK (*readdir) P_((DIR *dirh, char *name, int namelen, fcookie *fc));
1.1 root 360:
1.1.1.2 root 361: long ARGS_ON_STACK (*rewinddir) P_((DIR *dirh));
1.1 root 362:
1.1.1.2 root 363: long ARGS_ON_STACK (*closedir) P_((DIR *dirh));
1.1 root 364:
1.1.1.2 root 365: long ARGS_ON_STACK (*pathconf) P_((fcookie *dir, int which));
1.1 root 366:
1.1.1.2 root 367: long ARGS_ON_STACK (*dfree) P_((fcookie *dir, long *buf));
1.1 root 368:
1.1.1.2 root 369: long ARGS_ON_STACK (*writelabel) P_((fcookie *dir, const char *name));
1.1 root 370:
1.1.1.2 root 371: long ARGS_ON_STACK (*readlabel) P_((fcookie *dir, char *name, int namelen));
1.1 root 372:
1.1.1.2 root 373: long ARGS_ON_STACK (*symlink) P_((fcookie *dir, const char *name, const char *to));
1.1 root 374:
1.1.1.2 root 375: long ARGS_ON_STACK (*readlink) P_((fcookie *dir, char *buf, int len));
1.1 root 376:
1.1.1.2 root 377: long ARGS_ON_STACK (*hardlink) P_((fcookie *fromdir, const char *fromname,
1.1 root 378:
379: fcookie *todir, const char *toname));
380:
1.1.1.2 root 381: long ARGS_ON_STACK (*fscntl) P_((fcookie *dir, const char *name, int cmd, long arg));
1.1 root 382:
1.1.1.2 root 383: long ARGS_ON_STACK (*dskchng) P_((int drv));
1.1 root 384:
1.1.1.3 root 385: long ARGS_ON_STACK (*release) P_((fcookie *));
386:
387: long ARGS_ON_STACK (*dupcookie) P_((fcookie *new, fcookie *old));
1.1 root 388:
389: } FILESYS;
390:
391:
392:
393: /*
394:
395: * this is the structure passed to loaded file systems to tell them
396:
397: * about the kernel
398:
399: */
400:
401:
402:
403: struct kerinfo {
404:
405: short maj_version; /* kernel version number */
406:
407: short min_version; /* minor kernel version number */
408:
409: ushort default_perm; /* default file permissions */
410:
411: short reserved1; /* room for expansion */
412:
413:
414:
415: /* OS functions */
416:
417: Func *bios_tab; /* pointer to the BIOS entry points */
418:
419: Func *dos_tab; /* pointer to the GEMDOS entry points */
420:
421:
422:
423: /* media change vector */
424:
1.1.1.2 root 425: void ARGS_ON_STACK (*drvchng) P_((unsigned));
1.1 root 426:
427:
428:
429: /* Debugging stuff */
430:
1.1.1.2 root 431: void ARGS_ON_STACK (*trace) P_((const char *, ...));
1.1 root 432:
1.1.1.2 root 433: void ARGS_ON_STACK (*debug) P_((const char *, ...));
1.1 root 434:
1.1.1.2 root 435: void ARGS_ON_STACK (*alert) P_((const char *, ...));
1.1 root 436:
1.1.1.6 ! root 437: EXITING void ARGS_ON_STACK (*fatal) P_((const char *, ...)) NORETURN;
1.1 root 438:
439:
440:
441: /* memory allocation functions */
442:
1.1.1.2 root 443: void * ARGS_ON_STACK (*kmalloc) P_((long));
1.1 root 444:
1.1.1.2 root 445: void ARGS_ON_STACK (*kfree) P_((void *));
1.1 root 446:
1.1.1.2 root 447: void * ARGS_ON_STACK (*umalloc) P_((long));
1.1 root 448:
1.1.1.2 root 449: void ARGS_ON_STACK (*ufree) P_((void *));
1.1 root 450:
451:
452:
453: /* utility functions for string manipulation */
454:
1.1.1.2 root 455: int ARGS_ON_STACK (*strnicmp) P_((const char *, const char *, int));
1.1 root 456:
1.1.1.2 root 457: int ARGS_ON_STACK (*stricmp) P_((const char *, const char *));
1.1 root 458:
1.1.1.2 root 459: char * ARGS_ON_STACK (*strlwr) P_((char *));
1.1 root 460:
1.1.1.2 root 461: char * ARGS_ON_STACK (*strupr) P_((char *));
1.1 root 462:
1.1.1.2 root 463: int ARGS_ON_STACK (*sprintf) P_((char *, const char *, ...));
1.1 root 464:
465:
466:
467: /* utility functions for manipulating time */
468:
1.1.1.2 root 469: void ARGS_ON_STACK (*millis_time) P_((unsigned long, short *));
1.1 root 470:
1.1.1.2 root 471: long ARGS_ON_STACK (*unixtim) P_((unsigned, unsigned));
1.1 root 472:
1.1.1.2 root 473: long ARGS_ON_STACK (*dostim) P_((long));
1.1 root 474:
475:
476:
477: /* utility functions for dealing with pauses, or for putting processes
478:
479: * to sleep
480:
481: */
482:
1.1.1.2 root 483: void ARGS_ON_STACK (*nap) P_((unsigned));
1.1 root 484:
1.1.1.5 root 485: int ARGS_ON_STACK (*sleep) P_((int que, long cond));
1.1 root 486:
1.1.1.2 root 487: void ARGS_ON_STACK (*wake) P_((int que, long cond));
1.1 root 488:
1.1.1.2 root 489: void ARGS_ON_STACK (*wakeselect) P_((long param));
1.1 root 490:
491:
492:
493: /* file system utility functions */
494:
1.1.1.2 root 495: int ARGS_ON_STACK (*denyshare) P_((FILEPTR *, FILEPTR *));
1.1 root 496:
1.1.1.4 root 497: LOCK * ARGS_ON_STACK (*denylock) P_((LOCK *, LOCK *));
1.1 root 498:
499:
500:
1.1.1.4 root 501: /* functions for adding/cancelling timeouts */
502:
503: struct timeout * ARGS_ON_STACK (*addtimeout) P_((long, void (*)()));
504:
505: void ARGS_ON_STACK (*canceltimeout) P_((struct timeout *));
1.1 root 506:
1.1.1.6 ! root 507: struct timeout * ARGS_ON_STACK (*addroottimeout) P_((long, void (*)(), short));
! 508:
! 509: void ARGS_ON_STACK (*cancelroottimeout) P_((struct timeout *));
! 510:
! 511:
! 512:
! 513: /* miscellaneous other things */
! 514:
! 515: long ARGS_ON_STACK (*ikill) P_((int, int));
! 516:
! 517: void ARGS_ON_STACK (*iwake) P_((int que, long cond, short pid));
! 518:
! 519:
1.1.1.4 root 520:
521: /* reserved for future use */
522:
1.1.1.6 ! root 523: long res2[3];
1.1 root 524:
525: };
526:
527:
528:
529: /* flags for open() modes */
530:
531: #define O_RWMODE 0x03 /* isolates file read/write mode */
532:
533: # define O_RDONLY 0x00
534:
535: # define O_WRONLY 0x01
536:
537: # define O_RDWR 0x02
538:
539: # define O_EXEC 0x03 /* execute file; used by kernel only */
540:
541:
542:
543: /* 0x04 is for future expansion */
544:
545: #define O_APPEND 0x08 /* all writes go to end of file */
546:
547:
548:
549: #define O_SHMODE 0x70 /* isolates file sharing mode */
550:
551: # define O_COMPAT 0x00 /* compatibility mode */
552:
553: # define O_DENYRW 0x10 /* deny both read and write access */
554:
555: # define O_DENYW 0x20 /* deny write access to others */
556:
557: # define O_DENYR 0x30 /* deny read access to others */
558:
559: # define O_DENYNONE 0x40 /* don't deny any access to others */
560:
561:
562:
563: #define O_NOINHERIT 0x80 /* private file (not passed to child) */
564:
565:
566:
567: #define O_NDELAY 0x100 /* don't block for i/o on this file */
568:
569: #define O_CREAT 0x200 /* create file if it doesn't exist */
570:
571: #define O_TRUNC 0x400 /* truncate file to 0 bytes if it does exist */
572:
573: #define O_EXCL 0x800 /* fail open if file exists */
574:
575:
576:
577: #define O_USER 0x0fff /* isolates user-settable flag bits */
578:
579:
580:
581: #define O_GLOBAL 0x1000 /* for opening a global file */
582:
583:
584:
585: /* kernel mode bits -- the user can't set these! */
586:
587: #define O_TTY 0x2000
588:
589: #define O_HEAD 0x4000
590:
591: #define O_LOCK 0x8000
592:
593:
594:
595: /* GEMDOS file attributes */
596:
597:
598:
599: /* macros to be applied to FILEPTRS to determine their type */
600:
601: #define is_terminal(f) (f->flags & O_TTY)
602:
603:
604:
605: /* lseek() origins */
606:
607: #define SEEK_SET 0 /* from beginning of file */
608:
609: #define SEEK_CUR 1 /* from current location */
610:
611: #define SEEK_END 2 /* from end of file */
612:
613:
614:
615: /* The requests for Dpathconf() */
616:
617: #define DP_IOPEN 0 /* internal limit on # of open files */
618:
619: #define DP_MAXLINKS 1 /* max number of hard links to a file */
620:
621: #define DP_PATHMAX 2 /* max path name length */
622:
623: #define DP_NAMEMAX 3 /* max length of an individual file name */
624:
625: #define DP_ATOMIC 4 /* # of bytes that can be written atomically */
626:
627: #define DP_TRUNC 5 /* file name truncation behavior */
628:
629: # define DP_NOTRUNC 0 /* long filenames give an error */
630:
631: # define DP_AUTOTRUNC 1 /* long filenames truncated */
632:
633: # define DP_DOSTRUNC 2 /* DOS truncation rules in effect */
634:
635: #define DP_CASE 6
636:
637: # define DP_CASESENS 0 /* case sensitive */
638:
639: # define DP_CASECONV 1 /* case always converted */
640:
641: # define DP_CASEINSENS 2 /* case insensitive, preserved */
642:
1.1.1.6 ! root 643: #define DP_MODEATTR 7
! 644:
! 645: # define DP_ATTRBITS 0x000000ffL /* mask for valid TOS attribs */
! 646:
! 647: # define DP_MODEBITS 0x000fff00L /* mask for valid Unix file modes */
! 648:
! 649: # define DP_FILETYPS 0xfff00000L /* mask for valid file types */
! 650:
! 651: # define DP_FT_DIR 0x00100000L /* directories (always if . is there) */
! 652:
! 653: # define DP_FT_CHR 0x00200000L /* character special files */
! 654:
! 655: # define DP_FT_BLK 0x00400000L /* block special files, currently unused */
! 656:
! 657: # define DP_FT_REG 0x00800000L /* regular files */
! 658:
! 659: # define DP_FT_LNK 0x01000000L /* symbolic links */
! 660:
! 661: # define DP_FT_SOCK 0x02000000L /* sockets, currently unused */
! 662:
! 663: # define DP_FT_FIFO 0x04000000L /* pipes */
! 664:
! 665: # define DP_FT_MEM 0x08000000L /* shared memory or proc files */
! 666:
! 667: #define DP_XATTRFIELDS 8
! 668:
! 669: # define DP_INDEX 0x0001
! 670:
! 671: # define DP_DEV 0x0002
! 672:
! 673: # define DP_RDEV 0x0004
! 674:
! 675: # define DP_NLINK 0x0008
! 676:
! 677: # define DP_UID 0x0010
! 678:
! 679: # define DP_GID 0x0020
! 680:
! 681: # define DP_BLKSIZE 0x0040
! 682:
! 683: # define DP_SIZE 0x0080
! 684:
! 685: # define DP_NBLOCKS 0x0100
! 686:
! 687: # define DP_ATIME 0x0200
! 688:
! 689: # define DP_CTIME 0x0400
! 690:
! 691: # define DP_MTIME 0x0800
! 692:
! 693: #define DP_MAXREQ 8 /* highest legal request */
1.1 root 694:
695:
696:
697: /* Dpathconf and Sysconf return this when a value is not limited
698:
699: (or is limited only by available memory) */
700:
701:
702:
703: #define UNLIMITED 0x7fffffffL
704:
705:
706:
707: /* various character constants and defines for TTY's */
708:
709: #define MiNTEOF 0x0000ff1a /* 1a == ^Z */
710:
711:
712:
713: /* defines for tty_read */
714:
715: #define RAW 0
716:
717: #define COOKED 0x1
718:
719: #define NOECHO 0
720:
721: #define ECHO 0x2
722:
723: #define ESCSEQ 0x04 /* cursor keys, etc. get escape sequences */
724:
725:
726:
727: /* constants for Fcntl calls */
728:
729: #define F_DUPFD 0 /* handled by kernel */
730:
731: #define F_GETFD 1 /* handled by kernel */
732:
733: #define F_SETFD 2 /* handled by kernel */
734:
735: # define FD_CLOEXEC 1 /* close on exec flag */
736:
737:
738:
739: #define F_GETFL 3 /* handled by kernel */
740:
741: #define F_SETFL 4 /* handled by kernel */
742:
743: #define F_GETLK 5
744:
745: #define F_SETLK 6
746:
1.1.1.2 root 747: #define F_SETLKW 7
748:
1.1 root 749:
750:
751: /* more constants for various Fcntl's */
752:
753: #define FSTAT (('F'<< 8) | 0) /* handled by kernel */
754:
755: #define FIONREAD (('F'<< 8) | 1)
756:
757: #define FIONWRITE (('F'<< 8) | 2)
758:
1.1.1.6 ! root 759: #define FIOEXCEPT (('F'<< 8) | 5)
1.1 root 760:
1.1.1.6 ! root 761: #define TIOCGETP (('T'<< 8) | 0)
1.1 root 762:
1.1.1.6 ! root 763: #define TIOCSETN (('T'<< 8) | 1)
1.1 root 764:
765: #define TIOCGETC (('T'<< 8) | 2)
766:
767: #define TIOCSETC (('T'<< 8) | 3)
768:
769: #define TIOCGLTC (('T'<< 8) | 4)
770:
771: #define TIOCSLTC (('T'<< 8) | 5)
772:
773: #define TIOCGPGRP (('T'<< 8) | 6)
774:
775: #define TIOCSPGRP (('T'<< 8) | 7)
776:
777: #define TIOCFLUSH (('T'<< 8) | 8)
778:
779: #define TIOCSTOP (('T'<< 8) | 9)
780:
781: #define TIOCSTART (('T'<< 8) | 10)
782:
783: #define TIOCGWINSZ (('T'<< 8) | 11)
784:
785: #define TIOCSWINSZ (('T'<< 8) | 12)
786:
787: #define TIOCGXKEY (('T'<< 8) | 13)
788:
789: #define TIOCSXKEY (('T'<< 8) | 14)
790:
791: #define TIOCIBAUD (('T'<< 8) | 18)
792:
793: #define TIOCOBAUD (('T'<< 8) | 19)
794:
795: #define TIOCCBRK (('T'<< 8) | 20)
796:
797: #define TIOCSBRK (('T'<< 8) | 21)
798:
799: #define TIOCGFLAGS (('T'<< 8) | 22)
800:
801: #define TIOCSFLAGS (('T'<< 8) | 23)
802:
1.1.1.5 root 803: #define TIOCOUTQ (('T'<< 8) | 24)
804:
1.1.1.6 ! root 805: #define TIOCSETP (('T'<< 8) | 25)
! 806:
! 807: #define TIOCHPCL (('T'<< 8) | 26)
! 808:
! 809: #define TIOCCAR (('T'<< 8) | 27)
! 810:
! 811: #define TIOCNCAR (('T'<< 8) | 28)
! 812:
! 813: #define TIOCWONLINE (('T'<< 8) | 29)
! 814:
! 815: #define TIOCSFLAGSB (('T'<< 8) | 30)
! 816:
! 817: #define TIOCGSTATE (('T'<< 8) | 31)
! 818:
! 819: #define TIOCSSTATEB (('T'<< 8) | 32)
! 820:
! 821: #define TIOCGVMIN (('T'<< 8) | 33)
! 822:
! 823: #define TIOCSVMIN (('T'<< 8) | 34)
! 824:
1.1 root 825:
826:
1.1.1.2 root 827: /* cursor control Fcntls:
828:
829: * NOTE THAT THESE MUST BE TOGETHER
830:
831: */
832:
833: #define TCURSOFF (('c'<< 8) | 0)
834:
835: #define TCURSON (('c'<< 8) | 1)
836:
837: #define TCURSBLINK (('c'<< 8) | 2)
838:
839: #define TCURSSTEADY (('c'<< 8) | 3)
840:
841: #define TCURSSRATE (('c'<< 8) | 4)
842:
843: #define TCURSGRATE (('c'<< 8) | 5)
844:
845:
846:
847: /* process stuff */
848:
1.1 root 849: #define PPROCADDR (('P'<< 8) | 1)
850:
851: #define PBASEADDR (('P'<< 8) | 2)
852:
853: #define PCTXTSIZE (('P'<< 8) | 3)
854:
855: #define PSETFLAGS (('P'<< 8) | 4)
856:
857: #define PGETFLAGS (('P'<< 8) | 5)
858:
1.1.1.2 root 859: #define PTRACESFLAGS (('P'<< 8) | 6)
860:
861: #define PTRACEGFLAGS (('P'<< 8) | 7)
862:
863: # define P_ENABLE (1 << 0) /* enable tracing */
864:
865: #ifdef NOTYETDEFINED
866:
867: # define P_DOS (1 << 1) /* trace DOS calls - unimplemented */
868:
869: # define P_BIOS (1 << 2) /* trace BIOS calls - unimplemented */
870:
871: # define P_XBIOS (1 << 3) /* trace XBIOS calls - unimplemented */
872:
873: #endif
874:
875:
876:
877: #define PTRACEGO (('P'<< 8) | 8) /* these 4 must be together */
878:
879: #define PTRACEFLOW (('P'<< 8) | 9)
880:
881: #define PTRACESTEP (('P'<< 8) | 10)
882:
883: #define PTRACE11 (('P'<< 8) | 11)
884:
1.1.1.4 root 885: #define PLOADINFO (('P'<< 8) | 12)
886:
1.1.1.5 root 887: #define PFSTAT (('P'<< 8) | 13)
888:
1.1.1.4 root 889:
890:
891: struct ploadinfo {
892:
893: /* passed */
894:
895: short fnamelen;
896:
897: /* returned */
898:
899: char *cmdlin, *fname;
900:
901: };
902:
903:
904:
1.1 root 905:
906:
907: #define SHMGETBLK (('M'<< 8) | 0)
908:
909: #define SHMSETBLK (('M'<< 8) | 1)
910:
911:
912:
913: /* terminal control constants (tty.sg_flags) */
914:
915: #define T_CRMOD 0x0001
916:
917: #define T_CBREAK 0x0002
918:
919: #define T_ECHO 0x0004
920:
921: /* #define T_XTABS 0x0008 unimplemented*/
922:
923: #define T_RAW 0x0010
924:
925: /* #define T_LCASE 0x0020 unimplemented */
926:
927:
928:
929: #define T_NOFLSH 0x0040 /* don't flush buffer when signals
930:
931: are received */
932:
933: #define T_TOS 0x0080
934:
935: #define T_TOSTOP 0x0100
936:
937: #define T_XKEY 0x0200 /* Fread returns escape sequences for
938:
939: cursor keys, etc. */
940:
1.1.1.6 ! root 941: #define T_ECHOCTL 0x0400 /* echo ctl chars as ^x */
! 942:
! 943: /* 0x0800 still available */
! 944:
! 945:
1.1 root 946:
947: #define T_TANDEM 0x1000
948:
949: #define T_RTSCTS 0x2000
950:
951: #define T_EVENP 0x4000 /* EVENP and ODDP are mutually exclusive */
952:
953: #define T_ODDP 0x8000
954:
955:
956:
957: #define TF_FLAGS 0xF000
958:
959:
960:
961: /* some flags for TIOC[GS]FLAGS */
962:
1.1.1.6 ! root 963: #define TF_CAR 0x800 /* nonlocal mode, require carrier */
! 964:
! 965: #define TF_NLOCAL TF_CAR
! 966:
! 967:
! 968:
! 969: #define TF_BRKINT 0x80 /* allow breaks interrupt (like ^C) */
! 970:
! 971:
! 972:
1.1 root 973: #define TF_STOPBITS 0x0003
974:
975: #define TF_1STOP 0x0001
976:
977: #define TF_15STOP 0x0002
978:
979: #define TF_2STOP 0x0003
980:
981:
982:
983: #define TF_CHARBITS 0x000C
984:
985: #define TF_8BIT 0
986:
987: #define TF_7BIT 0x4
988:
989: #define TF_6BIT 0x8
990:
991: #define TF_5BIT 0xC
992:
993:
994:
995: /* the following are terminal status flags (tty.state) */
996:
997: /* (the low byte of tty.state indicates a part of an escape sequence still
998:
999: * hasn't been read by Fread, and is an index into that escape sequence)
1000:
1001: */
1002:
1003: #define TS_ESC 0x00ff
1004:
1.1.1.6 ! root 1005: #define TS_BLIND 0x800 /* tty is `blind' i.e. has no carrier
! 1006:
! 1007: (cleared in local mode) */
! 1008:
1.1 root 1009: #define TS_HOLD 0x1000 /* hold (e.g. ^S/^Q) */
1010:
1.1.1.6 ! root 1011: #define TS_HPCL 0x4000 /* hang up on close */
! 1012:
1.1 root 1013: #define TS_COOKED 0x8000 /* interpret control chars */
1014:
1015:
1016:
1017: /* structures for terminals */
1018:
1019: struct tchars {
1020:
1021: char t_intrc;
1022:
1023: char t_quitc;
1024:
1025: char t_startc;
1026:
1027: char t_stopc;
1028:
1029: char t_eofc;
1030:
1031: char t_brkc;
1032:
1033: };
1034:
1035:
1036:
1037: struct ltchars {
1038:
1039: char t_suspc;
1040:
1041: char t_dsuspc;
1042:
1043: char t_rprntc;
1044:
1045: char t_flushc;
1046:
1047: char t_werasc;
1048:
1049: char t_lnextc;
1050:
1051: };
1052:
1053:
1054:
1055: struct sgttyb {
1056:
1057: char sg_ispeed;
1058:
1059: char sg_ospeed;
1060:
1061: char sg_erase;
1062:
1063: char sg_kill;
1064:
1065: ushort sg_flags;
1066:
1067: };
1068:
1069:
1070:
1071: struct winsize {
1072:
1073: short ws_row;
1074:
1075: short ws_col;
1076:
1077: short ws_xpixel;
1078:
1079: short ws_ypixel;
1080:
1081: };
1082:
1083:
1084:
1085: struct xkey {
1086:
1087: short xk_num;
1088:
1089: char xk_def[8];
1090:
1091: };
1092:
1093:
1094:
1095: struct tty {
1096:
1097: short pgrp; /* process group of terminal */
1098:
1099: short state; /* terminal status, e.g. stopped */
1100:
1101: short use_cnt; /* number of times terminal is open */
1102:
1.1.1.6 ! root 1103: short aux_cnt; /* number of times terminal is open as
! 1104:
! 1105: /dev/aux */
1.1 root 1106:
1107: struct sgttyb sg;
1108:
1109: struct tchars tc;
1110:
1111: struct ltchars ltc;
1112:
1113: struct winsize wsiz;
1114:
1115: long rsel; /* selecting process for read */
1116:
1117: long wsel; /* selecting process for write */
1118:
1119: char *xkey; /* extended keyboard table */
1120:
1.1.1.6 ! root 1121: long hup_ospeed; /* saved ospeed while hanging up */
! 1122:
! 1123: unsigned short vmin, vtime; /* min chars, timeout for RAW reads */
! 1124:
! 1125: long resrvd[1]; /* for future expansion */
! 1126:
! 1127: };
! 1128:
! 1129:
! 1130:
! 1131: struct bios_tty {
! 1132:
! 1133: IOREC_T *irec; /* From XBIOS ... */
! 1134:
! 1135: long *rsel; /* pointer to field in tty struct */
! 1136:
! 1137: IOREC_T *orec; /* Same, for output... */
! 1138:
! 1139: long *wsel;
! 1140:
! 1141: long ispeed, ospeed; /* last speeds set */
! 1142:
! 1143: long *baudmap, maxbaud; /* Rsconf baud word <-> bps table */
! 1144:
! 1145: short *baudx;
! 1146:
! 1147: struct tty *tty;
! 1148:
! 1149: long bticks; /* when to take a break for real */
! 1150:
! 1151: long vticks; /* ..check read buf next (vmin/speed) */
! 1152:
! 1153: char clocal, brkint; /* flags: local mode, break == ^C */
! 1154:
! 1155: short tosfd; /* if != EUNDEV: fd to pass Fcntl()s */
! 1156:
! 1157: short bdev, unused1;
1.1 root 1158:
1159: };
1160:
1161:
1162:
1163: /* Dcntl constants and types */
1164:
1165: #define DEV_NEWTTY 0xde00
1166:
1167: #define DEV_NEWBIOS 0xde01
1168:
1169: #define DEV_INSTALL 0xde02
1170:
1171:
1172:
1173: struct dev_descr {
1174:
1175: DEVDRV *driver;
1176:
1177: short dinfo;
1178:
1179: short flags;
1180:
1181: struct tty *tty;
1182:
1.1.1.6 ! root 1183: long drvsize; /* size of DEVDRV struct */
! 1184:
! 1185: long reserved[3];
1.1 root 1186:
1187: };
1188:
1189:
1190:
1191:
1192:
1.1.1.4 root 1193: #define FS_INSTALL 0xf001 /* let the kernel know about the file system */
1194:
1195: #define FS_MOUNT 0xf002 /* make a new directory for a file system */
1196:
1197: #define FS_UNMOUNT 0xf003 /* remove a directory for a file system */
1198:
1199: #define FS_UNINSTALL 0xf004 /* remove a file system from the list */
1200:
1201:
1202:
1203:
1204:
1205: struct fs_descr
1206:
1207: {
1208:
1209: FILESYS *file_system;
1210:
1211: short dev_no; /* this is filled in by MiNT if arg == FS_MOUNT*/
1212:
1213: long flags;
1214:
1215: long reserved[4];
1216:
1217: };
1218:
1219:
1220:
1221:
1222:
1.1.1.2 root 1223: /* number of BIOS drives */
1.1 root 1224:
1225: #define NUM_DRIVES 32
1226:
1227:
1228:
1.1.1.2 root 1229: #define BIOSDRV (NUM_DRIVES)
1230:
1231: #define PIPEDRV (NUM_DRIVES+1)
1.1 root 1232:
1.1.1.2 root 1233: #define PROCDRV (NUM_DRIVES+2)
1.1 root 1234:
1.1.1.2 root 1235: #define SHMDRV (NUM_DRIVES+3)
1.1 root 1236:
1.1.1.2 root 1237:
1238:
1239: #define UNI_NUM_DRVS (NUM_DRIVES+4)
1.1 root 1240:
1241: #define UNIDRV ('U'-'A')
1242:
1243:
1244:
1.1.1.2 root 1245: #define PSEUDODRVS ((1L<<UNIDRV))
1.1 root 1246:
1247:
1248:
1.1.1.5 root 1249: /* various fields for the "rdev" device numbers */
1250:
1251: #define BIOS_DRIVE_RDEV 0x0000
1252:
1253: #define BIOS_RDEV 0x0100
1254:
1255: #define FAKE_RDEV 0x0200
1256:
1257: #define PIPE_RDEV 0x7e00
1258:
1259: #define UNK_RDEV 0x7f00
1260:
1261: #define PROC_RDEV_BASE 0xa000
1.1 root 1262:
1263:
1264:
1.1.1.2 root 1265: #ifndef GENMAGIC
1266:
1267: /* external variables */
1268:
1269:
1270:
1271: extern FILESYS *drives[NUM_DRIVES];
1.1 root 1272:
1273: extern struct tty default_tty;
1274:
1.1.1.6 ! root 1275: #define follow_links ((char *)-1L)
1.1 root 1276:
1.1.1.2 root 1277: #endif
1278:
1.1 root 1279:
1280:
1.1.1.5 root 1281: /* internal bios file structure */
1282:
1283:
1284:
1285: #define BNAME_MAX 13
1286:
1287:
1288:
1289: struct bios_file {
1290:
1291: char name[BNAME_MAX+1]; /* device name */
1292:
1293: DEVDRV *device; /* device driver for device */
1294:
1295: short private; /* extra info for device driver */
1296:
1297: ushort flags; /* flags for device open */
1298:
1299: struct tty *tty; /* tty structure (if appropriate) */
1300:
1301: struct bios_file *next;
1302:
1303: short lockpid; /* owner of the lock */
1304:
1305: XATTR xattr; /* guess what... */
1306:
1.1.1.6 ! root 1307: long drvsize; /* size of DEVDRV struct */
! 1308:
1.1.1.5 root 1309: };
1310:
1311:
1312:
1.1 root 1313: #endif /* _filesys_h */
1314:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.