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