📄 book.t
字号:
01431 #define A_NONE 0x00 /* unknown */01432 #define A_I8086 0x04 /* intel i8086/8088 */01433 #define A_M68K 0x0B /* motorola m68000 */01434 #define A_NS16K 0x0C /* national semiconductor 16032 */01435 #define A_I80386 0x10 /* intel i80386 */01436 #define A_SPARC 0x17 /* Sun SPARC */01437 01438 #define A_BLR(cputype) ((cputype&0x01)!=0) /* TRUE if bytes left-to-right */01439 #define A_WLR(cputype) ((cputype&0x02)!=0) /* TRUE if words left-to-right */01440 01441 /* Flags. */01442 #define A_UZP 0x01 /* unmapped zero page (pages) */01443 #define A_PAL 0x02 /* page aligned executable */01444 #define A_NSYM 0x04 /* new style symbol table */01445 #define A_EXEC 0x10 /* executable */01446 #define A_SEP 0x20 /* separate I/D */01447 #define A_PURE 0x40 /* pure text */ /* not used */01448 #define A_TOVLY 0x80 /* text overlay */ /* not used */01449 01450 /* Offsets of various things. */01451 #define A_MINHDR 3201452 #define A_TEXTPOS(X) ((long)(X).a_hdrlen)01453 #define A_DATAPOS(X) (A_TEXTPOS(X) + (X).a_text)01454 #define A_HASRELS(X) ((X).a_hdrlen > (unsigned char) A_MINHDR)01455 #define A_HASEXT(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 8))01456 #define A_HASLNS(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 16))01457 #define A_HASTOFF(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 24))01458 #define A_TRELPOS(X) (A_DATAPOS(X) + (X).a_data)01459 #define A_DRELPOS(X) (A_TRELPOS(X) + (X).a_trsize)01460 #define A_SYMPOS(X) (A_TRELPOS(X) + (A_HASRELS(X) ? \01461 ((X).a_trsize + (X).a_drsize) : 0))01462 01463 struct reloc {01464 long r_vaddr; /* virtual address of reference */01465 unsigned short r_symndx; /* internal segnum or extern symbol num */01466 unsigned short r_type; /* relocation type */01467 };01468 01469 /* r_tyep values: */01470 #define R_ABBS 001471 #define R_RELLBYTE 201472 #define R_PCRBYTE 301473 #define R_RELWORD 401474 #define R_PCRWORD 5.Op 19 include/a.out.h01475 #define R_RELLONG 601476 #define R_PCRLONG 701477 #define R_REL3BYTE 801478 #define R_KBRANCHE 901479 01480 /* r_symndx for internal segments */01481 #define S_ABS ((unsigned short)-1)01482 #define S_TEXT ((unsigned short)-2)01483 #define S_DATA ((unsigned short)-3)01484 #define S_BSS ((unsigned short)-4)01485 01486 struct nlist { /* symbol table entry */01487 char n_name[8]; /* symbol name */01488 long n_value; /* value */01489 unsigned char n_sclass; /* storage class */01490 unsigned char n_numaux; /* number of auxiliary entries (not used) */01491 unsigned short n_type; /* language base and derived type (not used) */01492 };01493 01494 /* Low bits of storage class (section). */01495 #define N_SECT 07 /* section mask */01496 #define N_UNDF 00 /* undefined */01497 #define N_ABS 01 /* absolute */01498 #define N_TEXT 02 /* text */01499 #define N_DATA 03 /* data */01500 #define N_BSS 04 /* bss */01501 #define N_COMM 05 /* (common) */01502 01503 /* High bits of storage class. */01504 #define N_CLASS 0370 /* storage class mask */01505 #define C_NULL01506 #define C_EXT 0020 /* external symbol */01507 #define C_STAT 0030 /* static */01508 01509 /* Function prototypes. */01510 #ifndef _ANSI_H01511 #include <ansi.h>01512 #endif01513 01514 _PROTOTYPE( int nlist, (char *_file, struct nlist *_nl) );01515 01516 #endif /* _AOUT_H */++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/sys/types.h ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++01600 /* The <sys/types.h> header contains important data type definitions.01601 * It is considered good programming practice to use these definitions, 01602 * instead of the underlying base type. By convention, all type names end 01603 * with _t.01604 */01605 01606 #ifndef _TYPES_H01607 #define _TYPES_H01608 01609 /* _ANSI is somehow used to determine whether or not the compiler is a.Ep 20 include/sys/types.h01610 * 16 bit compiler01611 */01612 #ifndef _ANSI01613 #include <ansi.h>01614 #endif01615 01616 /* The type size_t holds all results of the sizeof operator. At first glance,01617 * it seems obvious that it should be an unsigned int, but this is not always 01618 * the case. For example, MINIX-ST (68000) has 32-bit pointers and 16-bit01619 * integers. When one asks for the size of a 70K struct or array, the result 01620 * requires 17 bits to express, so size_t must be a long type. The type 01621 * ssize_t is the signed version of size_t.01622 */01623 #ifndef _SIZE_T01624 #define _SIZE_T01625 typedef unsigned int size_t;01626 #endif01627 01628 #ifndef _SSIZE_T01629 #define _SSIZE_T01630 typedef int ssize_t;01631 #endif01632 01633 #ifndef _TIME_T01634 #define _TIME_T01635 typedef long time_t; /* time in sec since 1 Jan 1970 0000 GMT */01636 #endif01637 01638 #ifndef _CLOCK_T01639 #define _CLOCK_T01640 typedef long clock_t; /* unit for system accounting */01641 #endif01642 01643 #ifndef _SIGSET_T01644 #define _SIGSET_T01645 typedef unsigned long sigset_t;01646 #endif01647 01648 /* Types used in disk, inode, etc. data structures. */01649 typedef short dev_t; /* holds (major|minor) device pair */01650 typedef char gid_t; /* group id */01651 typedef unsigned short ino_t; /* i-node number */01652 typedef unsigned short mode_t; /* file type and permissions bits */01653 typedef char nlink_t; /* number of links to a file */01654 typedef unsigned long off_t; /* offset within a file */01655 typedef int pid_t; /* process id (must be signed) */01656 typedef short uid_t; /* user id */01657 typedef unsigned long zone_t; /* zone number */01658 typedef unsigned long block_t; /* block number */01659 typedef unsigned long bit_t; /* bit number in a bit map */01660 typedef unsigned short zone1_t; /* zone number for V1 file systems */01661 typedef unsigned short bitchunk_t; /* collection of bits in a bitmap */01662 01663 typedef unsigned char u8_t; /* 8 bit type */01664 typedef unsigned short u16_t; /* 16 bit type */01665 typedef unsigned long u32_t; /* 32 bit type */01666 01667 typedef char i8_t; /* 8 bit signed type */01668 typedef short i16_t; /* 16 bit signed type */01669 typedef long i32_t; /* 32 bit signed type */.Op 21 include/sys/types.h01670 01671 /* The following types are needed because MINIX uses K&R style function01672 * definitions (for maximum portability). When a short, such as dev_t, is01673 * passed to a function with a K&R definition, the compiler automatically01674 * promotes it to an int. The prototype must contain an int as the parameter,01675 * not a short, because an int is what an old-style function definition01676 * expects. Thus using dev_t in a prototype would be incorrect. It would be01677 * sufficient to just use int instead of dev_t in the prototypes, but Dev_t01678 * is clearer.01679 */01680 typedef int Dev_t;01681 typedef int Gid_t;01682 typedef int Nlink_t;01683 typedef int Uid_t;01684 typedef int U8_t;01685 typedef unsigned long U32_t;01686 typedef int I8_t;01687 typedef int I16_t;01688 typedef long I32_t;01689 01690 /* ANSI C makes writing down the promotion of unsigned types very messy. When01691 * sizeof(short) == sizeof(int), there is no promotion, so the type stays01692 * unsigned. When the compiler is not ANSI, there is usually no loss of01693 * unsignedness, and there are usually no prototypes so the promoted type01694 * doesn't matter. The use of types like Ino_t is an attempt to use ints01695 * (which are not promoted) while providing information to the reader.01696 */01697 01698 #ifndef _ANSI_H01699 #include <ansi.h>01700 #endif01701 01702 #if _EM_WSIZE == 2 || !defined(_ANSI)01703 typedef unsigned int Ino_t;01704 typedef unsigned int Zone1_t;01705 typedef unsigned int Bitchunk_t;01706 typedef unsigned int U16_t;01707 typedef unsigned int Mode_t;01708 01709 #else /* _EM_WSIZE == 4, or _EM_WSIZE undefined, or _ANSI defined */01710 typedef int Ino_t;01711 typedef int Zone1_t;01712 typedef int Bitchunk_t;01713 typedef int U16_t;01714 typedef int Mode_t;01715 01716 #endif /* _EM_WSIZE == 2, etc */01717 01718 /* Signal handler type, e.g. SIG_IGN */01719 #if defined(_ANSI)01720 typedef void (*sighandler_t) (int);01721 #else01722 typedef void (*sighandler_t)();01723 #endif01724 01725 #endif /* _TYPES_H */.Ep 22 include/sys/ioctl.h++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/sys/ioctl.h ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++01800 /* The ioctl.h header declares device controlling operations. */01801 01802 #ifndef _IOCTL_H01803 #define _IOCTL_H01804 01805 #if _EM_WSIZE >= 401806 /* Ioctls have the command encoded in the low-order word, and the size01807 * of the parameter in the high-order word. The 3 high bits of the high-01808 * order word are used to encode the in/out/void status of the parameter.01809 */01810 01811 #define _IOCPARM_MASK 0x1FFF01812 #define _IOC_VOID 0x2000000001813 #define _IOCTYPE_MASK 0xFFFF01814 #define _IOC_IN 0x4000000001815 #define _IOC_OUT 0x8000000001816 #define _IOC_INOUT (_IOC_IN | _IOC_OUT)01817 01818 #define _IO(x,y) ((x << 8) | y | _IOC_VOID)01819 #define _IOR(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\01820 _IOC_OUT)01821 #define _IOW(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\01822 _IOC_IN)01823 #define _IORW(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\01824 _IOC_INOUT)01825 #else01826 /* No fancy encoding on a 16-bit machine. */01827 01828 #define _IO(x,y) ((x << 8) | y)01829 #define _IOR(x,y,t) _IO(x,y)01830 #define _IOW(x,y,t) _IO(x,y)01831 #define _IORW(x,y,t) _IO(x,y)01832 #endif01833 01834 01835 /* Terminal ioctls. */01836 #define TCGETS _IOR('T', 8, struct termios) /* tcgetattr */01837 #define TCSETS _IOW('T', 9, struct termios) /* tcsetatt
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -