; _______________________________________________________________________________________
;|                                                                                       |
;| ..::FreshLib::..  Free, open source. Licensed under "BSD 2-clause" license."          |
;|_______________________________________________________________________________________|
;
;  Description: Common Linux equates.
;
;  Target OS: Linux
;
;  Dependencies:
;
;  Notes:
;_________________________________________________________________________________________

; New line symbol

CRLF equ 10

UNIX_PATH_MAX = 108


; Error numbers from the kernel

EPERM       =     1      ; Operation not permitted
ENOENT      =     2      ; No such file or directory
ESRCH       =     3      ; No such process
EINTR       =     4      ; Interrupted system call
EIO         =     5      ; I/O error
ENXIO       =     6      ; No such device or address
E2BIG       =     7      ; Argument list too long
ENOEXEC     =     8      ; Exec format error
EBADF       =     9      ; Bad file number
ECHILD      =    10      ; No child processes
EAGAIN      =    11      ; Try again
ENOMEM      =    12      ; Out of memory
EACCES      =    13      ; Permission denied
EFAULT      =    14      ; Bad address
ENOTBLK     =    15      ; Block device required
EBUSY       =    16      ; Device or resource busy
EEXIST      =    17      ; File exists
EXDEV       =    18      ; Cross-device link
ENODEV      =    19      ; No such device
ENOTDIR     =    20      ; Not a directory
EISDIR      =    21      ; Is a directory
EINVAL      =    22      ; Invalid argument
ENFILE      =    23      ; File table overflow
EMFILE      =    24      ; Too many open files
ENOTTY      =    25      ; Not a typewriter
ETXTBSY     =    26      ; Text file busy
EFBIG       =    27      ; File too large
ENOSPC      =    28      ; No space left on device
ESPIPE      =    29      ; Illegal seek
EROFS       =    30      ; Read-only file system
EMLINK      =    31      ; Too many links
EPIPE       =    32      ; Broken pipe
EDOM        =    33      ; Math argument out of domain of func
ERANGE      =    34      ; Math result not representable

EDEADLK       =  35      ; Resource deadlock would occur
ENAMETOOLONG  =  36      ; File name too long
ENOLCK        =  37      ; No record locks available
ENOSYS        =  38      ; Function not implemented
ENOTEMPTY     =  39      ; Directory not empty
ELOOP         =  40      ; Too many symbolic links encountered
EWOULDBLOCK   =  EAGAIN  ; Operation would block
ENOMSG        =  42      ; No message of desired type
EIDRM         =  43      ; Identifier removed
ECHRNG        =  44      ; Channel number out of range
EL2NSYNC      =  45      ; Level 2 not synchronized
EL3HLT        =  46      ; Level 3 halted
EL3RST        =  47      ; Level 3 reset
ELNRNG        =  48      ; Link number out of range
EUNATCH       =  49      ; Protocol driver not attached
ENOCSI        =  50      ; No CSI structure available
EL2HLT        =  51      ; Level 2 halted
EBADE         =  52      ; Invalid exchange
EBADR         =  53      ; Invalid request descriptor
EXFULL        =  54      ; Exchange full
ENOANO        =  55      ; No anode
EBADRQC       =  56      ; Invalid request code
EBADSLT       =  57      ; Invalid slot

EDEADLOCK     =  EDEADLK

EBFONT        =  59      ; Bad font file format
ENOSTR        =  60      ; Device not a stream
ENODATA       =  61      ; No data available
ETIME         =  62      ; Timer expired
ENOSR         =  63      ; Out of streams resources
ENONET        =  64      ; Machine is not on the network
ENOPKG        =  65      ; Package not installed
EREMOTE       =  66      ; Object is remote
ENOLINK       =  67      ; Link has been severed
EADV          =  68      ; Advertise error
ESRMNT        =  69      ; Srmount error
ECOMM         =  70      ; Communication error on send
EPROTO        =  71      ; Protocol error
EMULTIHOP     =  72      ; Multihop attempted
EDOTDOT       =  73      ; RFS specific error
EBADMSG       =  74      ; Not a data message
EOVERFLOW     =  75      ; Value too large for defined data type
ENOTUNIQ      =  76      ; Name not unique on network
EBADFD        =  77      ; File descriptor in bad state
EREMCHG       =  78      ; Remote address changed
ELIBACC       =  79      ; Can not access a needed shared library
ELIBBAD       =  80      ; Accessing a corrupted shared library
ELIBSCN       =  81      ; .lib section in a.out corrupted
ELIBMAX       =  82      ; Attempting to link in too many shared libraries
ELIBEXEC      =  83      ; Cannot exec a shared library directly
EILSEQ        =  84      ; Illegal byte sequence
ERESTART      =  85      ; Interrupted system call should be restarted
ESTRPIPE      =  86      ; Streams pipe error
EUSERS        =  87      ; Too many users
ENOTSOCK      =  88      ; Socket operation on non-socket
EDESTADDRREQ  =  89      ; Destination address required
EMSGSIZE      =  90      ; Message too long
EPROTOTYPE    =  91      ; Protocol wrong type for socket
ENOPROTOOPT   =  92      ; Protocol not available
EPROTONOSUPPORT =93      ; Protocol not supported
ESOCKTNOSUPPORT =94      ; Socket type not supported
EOPNOTSUPP      =95      ; Operation not supported on transport endpoint
EPFNOSUPPORT  =  96      ; Protocol family not supported
EAFNOSUPPORT  =  97      ; Address family not supported by protocol
EADDRINUSE    =  98      ; Address already in use
EADDRNOTAVAIL =  99      ; Cannot assign requested address
ENETDOWN      =  100     ; Network is down
ENETUNREACH   =  101     ; Network is unreachable
ENETRESET     =  102     ; Network dropped connection because of reset
ECONNABORTED  =  103     ; Software caused connection abort
ECONNRESET    =  104     ; Connection reset by peer
ENOBUFS       =  105     ; No buffer space available
EISCONN       =  106     ; Transport endpoint is already connected
ENOTCONN      =  107     ; Transport endpoint is not connected
ESHUTDOWN     =  108     ; Cannot send after transport endpoint shutdown
ETOOMANYREFS  =  109     ; Too many references: cannot splice
ETIMEDOUT     =  110     ; Connection timed out
ECONNREFUSED  =  111     ; Connection refused
EHOSTDOWN     =  112     ; Host is down
EHOSTUNREACH  =  113     ; No route to host
EALREADY      =  114     ; Operation already in progress
EINPROGRESS   =  115     ; Operation now in progress
ESTALE        =  116     ; Stale NFS file handle
EUCLEAN       =  117     ; Structure needs cleaning
ENOTNAM       =  118     ; Not a XENIX named type file
ENAVAIL       =  119     ; No XENIX semaphores available
EISNAM        =  120     ; Is a named type file
EREMOTEIO     =  121     ; Remote I/O error
EDQUOT        =  122     ; Quota exceeded

ENOMEDIUM     =  123     ; No medium found
EMEDIUMTYPE   =  124     ; Wrong medium type
ECANCELED     =  125     ; Operation Canceled
ENOKEY        =  126     ; Required key not available
EKEYEXPIRED   =  127     ; Key has expired
EKEYREVOKED   =  128     ; Key has been revoked
EKEYREJECTED  =  129     ; Key was rejected by service

; for robust mutexes
EOWNERDEAD     = 130     ; Owner died
ENOTRECOVERABLE= 131     ; State not recoverable





; System functions ( int $80 )

;         Name              EAX

sys_restart_syscall      =  $00
sys_exit                 =  $01
sys_fork                 =  $02
sys_read                 =  $03
sys_write                =  $04
sys_open                 =  $05
sys_close                =  $06
sys_waitpid              =  $07
sys_creat                =  $08
sys_link                 =  $09
sys_unlink               =  $0a
sys_execve               =  $0b
sys_chdir                =  $0c
sys_time                 =  $0d
sys_mknod                =  $0e
sys_chmod                =  $0f
sys_lchown16             =  $10
sys_stat                 =  $12
sys_lseek                =  $13
sys_getpid               =  $14
sys_mount                =  $15
sys_oldumount            =  $16
sys_setuid16             =  $17
sys_getuid16             =  $18
sys_stime                =  $19
sys_ptrace               =  $1a
sys_alarm                =  $1b
sys_fstat                =  $1c
sys_pause                =  $1d
sys_utime                =  $1e
sys_access               =  $21
sys_nice                 =  $22
sys_sync                 =  $24
sys_kill                 =  $25
sys_rename               =  $26
sys_mkdir                =  $27
sys_rmdir                =  $28
sys_dup                  =  $29
sys_pipe                 =  $2a
sys_times                =  $2b
sys_brk                  =  $2d
sys_setgid16             =  $2e
sys_getgid16             =  $2f
sys_signal               =  $30
sys_geteuid16            =  $31
sys_getegid16            =  $32
sys_acct                 =  $33
sys_umount               =  $34
sys_ioctl                =  $36
sys_fcntl                =  $37
sys_setpgid              =  $39
sys_olduname             =  $3b
sys_umask                =  $3c
sys_chroot               =  $3d
sys_ustat                =  $3e
sys_dup2                 =  $3f
sys_getppid              =  $40
sys_getpgrp              =  $41
sys_setsid               =  $42
sys_sigaction            =  $43
sys_sgetmask             =  $44
sys_ssetmask             =  $45
sys_setreuid16           =  $46
sys_setregid16           =  $47
sys_sigsuspend           =  $48
sys_sigpending           =  $49
sys_sethostname          =  $4a
sys_setrlimit            =  $4b
sys_old_getrlimit        =  $4c
sys_getrusage            =  $4d
sys_gettimeofday         =  $4e
sys_settimeofday         =  $4f
sys_getgroups16          =  $50
sys_setgroups16          =  $51
sys_old_select           =  $52
sys_symlink              =  $53
sys_lstat                =  $54
sys_readlink             =  $55
sys_uselib               =  $56
sys_swapon               =  $57
sys_reboot               =  $58
sys_old_readdir          =  $59
sys_old_mmap             =  $5a
sys_munmap               =  $5b
sys_truncate             =  $5c
sys_ftruncate            =  $5d
sys_fchmod               =  $5e
sys_fchown16             =  $5f
sys_getpriority          =  $60
sys_setpriority          =  $61
sys_statfs               =  $63
sys_fstatfs              =  $64
sys_ioperm               =  $65
sys_socketcall           =  $66
sys_syslog               =  $67
sys_setitimer            =  $68
sys_getitimer            =  $69
sys_newstat              =  $6a
sys_newlstat             =  $6b
sys_newfstat             =  $6c
sys_uname                =  $6d
sys_iopl                 =  $6e
sys_vhangup              =  $6f
sys_vm86old              =  $71
sys_wait4                =  $72
sys_swapoff              =  $73
sys_sysinfo              =  $74
sys_ipc                  =  $75
sys_fsync                =  $76
sys_sigreturn            =  $77
sys_clone                =  $78
sys_setdomainname        =  $79
sys_newuname             =  $7a
sys_modify_ldt           =  $7b
sys_adjtimex             =  $7c
sys_mprotect             =  $7d
sys_sigprocmask          =  $7e
sys_init_module          =  $80
sys_delete_module        =  $81
sys_quotactl             =  $83
sys_getpgid              =  $84
sys_fchdir               =  $85
sys_bdflush              =  $86
sys_sysfs                =  $87
sys_personality          =  $88
sys_setfsuid16           =  $8a
sys_setfsgid16           =  $8b
sys_llseek               =  $8c
sys_getdents             =  $8d
sys_select               =  $8e
sys_flock                =  $8f
sys_msync                =  $90
sys_readv                =  $91
sys_writev               =  $92
sys_getsid               =  $93
sys_fdatasync            =  $94
sys_sysctl               =  $95
sys_mlock                =  $96
sys_munlock              =  $97
sys_mlockall             =  $98
sys_munlockall           =  $99
sys_sched_setparam       =  $9a
sys_sched_getparam       =  $9b
sys_sched_setscheduler   =  $9c
sys_sched_getscheduler   =  $9d
sys_sched_yield          =  $9e
sys_sched_get_priority_m =  $9f
sys_sched_get_priority_m =  $a0
sys_sched_rr_get_interva =  $a1
sys_nanosleep            =  $a2
sys_mremap               =  $a3
sys_setresuid16          =  $a4
sys_getresuid16          =  $a5
sys_vm86                 =  $a6
sys_poll                 =  $a8
sys_nfsservctl           =  $a9
sys_setresgid16          =  $aa
sys_getresgid16          =  $ab
sys_prctl                =  $ac
sys_rt_sigreturn         =  $ad
sys_rt_sigaction         =  $ae
sys_rt_sigprocmask       =  $af
sys_rt_sigpending        =  $b0
sys_rt_sigtimedwait      =  $b1
sys_rt_sigqueueinfo      =  $b2
sys_rt_sigsuspend        =  $b3
sys_pread64              =  $b4
sys_pwrite64             =  $b5
sys_chown16              =  $b6
sys_getcwd               =  $b7
sys_capget               =  $b8
sys_capset               =  $b9
sys_sigaltstack          =  $ba
sys_sendfile             =  $bb
sys_vfork                =  $be
sys_getrlimit            =  $bf
sys_mmap2                =  $c0
sys_truncate64           =  $c1
sys_ftruncate64          =  $c2
sys_stat64               =  $c3
sys_lstat64              =  $c4
sys_fstat64              =  $c5
sys_lchown               =  $c6
sys_getuid               =  $c7
sys_getgid               =  $c8
sys_geteuid              =  $c9
sys_getegid              =  $ca
sys_setreuid             =  $cb
sys_setregid             =  $cc
sys_getgroups            =  $cd
sys_setgroups            =  $ce
sys_fchown               =  $cf
sys_setresuid            =  $d0
sys_getresuid            =  $d1
sys_setresgid            =  $d2
sys_getresgid            =  $d3
sys_chown                =  $d4
sys_setuid               =  $d5
sys_setgid               =  $d6
sys_setfsuid             =  $d7
sys_setfsgid             =  $d8
sys_pivot_root           =  $d9
sys_mincore              =  $da
sys_madvise              =  $db
sys_getdents64           =  $dc
sys_fcntl64              =  $dd
sys_gettid               =  $e0
sys_readahead            =  $e1
sys_setxattr             =  $e2
sys_lsetxattr            =  $e3
sys_fsetxattr            =  $e4
sys_getxattr             =  $e5
sys_lgetxattr            =  $e6
sys_fgetxattr            =  $e7
sys_listxattr            =  $e8
sys_llistxattr           =  $e9
sys_flistxattr           =  $ea
sys_removexattr          =  $eb
sys_lremovexattr         =  $ec
sys_fremovexattr         =  $ed
sys_tkill                =  $ee
sys_sendfile64           =  $ef
sys_futex                =  $f0
sys_sched_setaffinity    =  $f1
sys_sched_getaffinity    =  $f2
sys_set_thread_area      =  $f3
sys_get_thread_area      =  $f4
sys_io_setup             =  $f5
sys_io_destroy           =  $f6
sys_io_getevents         =  $f7
sys_io_submit            =  $f8
sys_io_cancel            =  $f9
sys_fadvise64            =  $fa
sys_exit_group           =  $fc
sys_lookup_dcookie       =  $fd
sys_epoll_create         =  $fe
sys_epoll_ctl            =  $ff
sys_epoll_wait           =  $100
sys_remap_file_pages     =  $101
sys_set_tid_address      =  $102
sys_timer_create         =  $103
sys_timer_settime        =  $104
sys_timer_gettime        =  $105
sys_timer_getoverrun     =  $106
sys_timer_delete         =  $107
sys_clock_settime        =  $108
sys_clock_gettime        =  $109
sys_clock_getres         =  $10a
sys_clock_nanosleep      =  $10b
sys_statfs64             =  $10c
sys_fstatfs64            =  $10d
sys_tgkill               =  $10e
sys_utimes               =  $10f
sys_fadvise64_64         =  $110
sys_mbind                =  $112
sys_get_mempolicy        =  $113
sys_set_mempolicy        =  $114
sys_mq_open              =  $115
sys_mq_unlink            =  $116
sys_mq_timedsend         =  $117
sys_mq_timedreceive      =  $118
sys_mq_notify            =  $119
sys_mq_getsetattr        =  $11a
sys_kexec_load           =  $11b
sys_waitid               =  $11c
sys_add_key              =  $11e
sys_request_key          =  $11f
sys_keyctl               =  $120
sys_ioprio_set           =  $121
sys_ioprio_get           =  $122
sys_inotify_init         =  $123
sys_inotify_add_watch    =  $124
sys_inotify_rm_watch     =  $125
sys_migrate_pages        =  $126
sys_openat               =  $127
sys_mkdirat              =  $128
sys_mknodat              =  $129
sys_fchownat             =  $12a
sys_futimesat            =  $12b
sys_fstatat64            =  $12c
sys_unlinkat             =  $12d
sys_renameat             =  $12e
sys_linkat               =  $12f
sys_symlinkat            =  $130
sys_readlinkat           =  $131
sys_fchmodat             =  $132
sys_faccessat            =  $133
sys_pselect6             =  $134
sys_ppoll                =  $135
sys_unshare              =  $136
sys_set_robust_list      =  $137
sys_get_robust_list      =  $138
sys_splice               =  $139
sys_sync_file_range      =  $13a
sys_tee                  =  $13b
sys_vmsplice             =  $13c
sys_move_pages           =  $13d
sys_getcpu               =  $13e
sys_epoll_pwait          =  $13f
sys_utimensat            =  $140
sys_signalfd             =  $141
sys_timerfd_create       =  $142
sys_eventfd              =  $143
sys_fallocate            =  $144
sys_timerfd_settime      =  $145
sys_timerfd_gettime      =  $146
sys_signalfd4            =  $147
sys_eventfd2             =  $148
sys_epoll_create1        =  $149
sys_dup3                 =  $14a
sys_pipe2                =  $14b
sys_inotify_init1        =  $14c
sys_preadv               =  $14d
sys_pwritev              =  $14e
sys_rt_tgsigqueueinfo    =  $14f
sys_perf_event_open      =  $150
sys_recvmmsg             =  $151


; file open access flags to be used with sys_open and other file functions.
O_ACCMODE       =     0003o
O_RDONLY        =       00o
O_WRONLY        =       01o
O_RDWR          =       02o
O_CREAT         =     0100o
O_EXCL          =     0200o
O_NOCTTY        =     0400o
O_TRUNC         =    01000o
O_APPEND        =    02000o
O_NONBLOCK      =    04000o
O_NDELAY        =   O_NONBLOCK
O_SYNC          =   010000o ;specific to ext2 fs and block devices
FASYNC          =   020000o ;fcntl, for BSD compatibility
O_DIRECT        =   040000o ;direct disk access hint - currently ignored
O_LARGEFILE     =  0100000o
O_DIRECTORY     =  0200000o ;must be a directory
O_NOFOLLOW      =  0400000o ;don't follow links
O_NOATIME       = 01000000o

;   file permissions flags
S_ISUID         = 04000o ;set user ID on execution
S_ISGID         = 02000o ;set group ID on execution
S_ISVTX         = 01000o ;sticky bit
S_IRUSR         = 00400o ;read by owner (S_IREAD)
S_IWUSR         = 00200o ;write by owner (S_IWRITE)
S_IXUSR         = 00100o ;execute/search by owner (S_IEXEC)
S_IRGRP         = 00040o ;read by group
S_IWGRP         = 00020o ;write by group
S_IXGRP         = 00010o ;execute/search by group
S_IROTH         = 00004o ;read by others (R_OK)
S_IWOTH         = 00002o ;write by others (W_OK)
S_IXOTH         = 00001o ;execute/search by others (X_OK)



;socket commands

SYS_SOCKET      = 1
SYS_BIND        = 2
SYS_CONNECT     = 3
SYS_LISTEN      = 4
SYS_ACCEPT      = 5
SYS_GETSOCKNAME = 6
SYS_GETPEERNAME = 7
SYS_SOCKETPAIR  = 8
SYS_SEND        = 9
SYS_RECV        = 10
SYS_SENDTO      = 11
SYS_RECVFROM    = 12
SYS_SHUTDOWN    = 13
SYS_SETSOCKOPT  = 14
SYS_GETSOCKOPT  = 15
SYS_SENDMSG     = 16
SYS_RECVMSG     = 17

;socket constants

AF_UNSPEC       = 0
AF_UNIX         = 1
AF_LOCAL        = 1
AF_INET         = 2
AF_AX25         = 3
AF_IPX          = 4
AF_APPLETALK    = 5
AF_NETROM       = 6
AF_BRIDGE       = 7
AF_ATMPVC       = 8
AF_X25          = 9
AF_INET6        = 10
AF_ROSE         = 11
AF_DECnet       = 12
AF_NETBEUI      = 13
AF_SECURITY     = 14
AF_KEY          = 15
AF_NETLINK      = 16
AF_ROUTE        = AF_NETLINK
AF_PACKET       = 17
AF_ASH          = 18
AF_ECONET       = 19
AF_ATMSVC       = 20
AF_SNA          = 22
AF_IRDA         = 23
AF_PPPOX        = 24
AF_WANPIPE      = 25
AF_LLC          = 26
AF_TIPC         = 30
AF_BLUETOOTH    = 31
AF_MAX          = 32

PF_UNSPEC       = AF_UNSPEC
PF_UNIX         = AF_UNIX
PF_LOCAL        = AF_LOCAL
PF_INET         = AF_INET
PF_AX25         = AF_AX25
PF_IPX          = AF_IPX
PF_APPLETALK    = AF_APPLETALK
PF_NETROM       = AF_NETROM
PF_BRIDGE       = AF_BRIDGE
PF_ATMPVC       = AF_ATMPVC
PF_X25          = AF_X25
PF_INET6        = AF_INET6
PF_ROSE         = AF_ROSE
PF_DECnet       = AF_DECnet
PF_NETBEUI      = AF_NETBEUI
PF_SECURITY     = AF_SECURITY
PF_KEY          = AF_KEY
PF_NETLINK      = AF_NETLINK
PF_ROUTE        = AF_ROUTE
PF_PACKET       = AF_PACKET
PF_ASH          = AF_ASH
PF_ECONET       = AF_ECONET
PF_ATMSVC       = AF_ATMSVC
PF_SNA          = AF_SNA
PF_IRDA         = AF_IRDA
PF_PPPOX        = AF_PPPOX
PF_WANPIPE      = AF_WANPIPE
PF_LLC          = AF_LLC
PF_TIPC         = AF_TIPC
PF_BLUETOOTH    = AF_BLUETOOTH
PF_MAX          = AF_MAX

SOCK_STREAM     = 1
SOCK_DGRAM      = 2
SOCK_RAW        = 3
SOCK_RDM        = 4
SOCK_SEQPACKET  = 5
SOCK_DCCP       = 6
SOCK_PACKET     = 10


; socket flags
MSG_OOB         = 1
MSG_PEEK        = 2
MSG_DONTROUTE   = 4
MSG_TRYHARD     = 4
MSG_CTRUNC      = 8
MSG_PROBE       = 0x10
MSG_TRUNC       = 0x20
MSG_DONTWAIT    = 0x40
MSG_EOR         = 0x80
MSG_WAITALL     = 0x100
MSG_FIN         = 0x200
MSG_SYN         = 0x400
MSG_CONFIRM     = 0x800
MSG_RST         = 0x1000
MSG_ERRQUEUE    = 0x2000
MSG_NOSIGNAL    = 0x4000
MSG_MORE        = 0x8000


SOL_SOCKET      = 1

SO_DEBUG        = 1
SO_REUSEADDR    = 2
SO_TYPE         = 3
SO_ERROR        = 4
SO_DONTROUTE    = 5
SO_BROADCAST    = 6
SO_SNDBUF       = 7
SO_RCVBUF       = 8
SO_SNDBUFFORCE  = 32
SO_RCVBUFFORCE  = 33
SO_KEEPALIVE    = 9
SO_OOBINLINE    = 10
SO_NO_CHECK     = 11
SO_PRIORITY     = 12
SO_LINGER       = 13
SO_BSDCOMPAT    = 14
SO_PASSCRED     = 16
SO_PEERCRED     = 17
SO_RCVLOWAT     = 18
SO_SNDLOWAT     = 19
SO_RCVTIMEO     = 20
SO_SNDTIMEO     = 21


IPPROTO_IP              =  0               ;  dummy for IP
IPPROTO_HOPOPTS         =  0               ;  IPv6 hop-by-hop options
IPPROTO_ICMP            =  1               ;  control message protocol
IPPROTO_IGMP            =  2               ;  group mgmt protocol
IPPROTO_IPV4            =  4
IPPROTO_TCP             =  6               ;  tcp
IPPROTO_EGP             =  8               ;  exterior gateway protocol
IPPROTO_PIGP            =  9
IPPROTO_UDP             =  17              ;  user datagram protocol
IPPROTO_DCCP            =  33              ;  datagram congestion control protocol
IPPROTO_IPV6            =  41
IPPROTO_ROUTING         =  43              ;  IPv6 routing header
IPPROTO_FRAGMENT        =  44              ;  IPv6 fragmentation header
IPPROTO_RSVP            =  46              ;  resource reservation
IPPROTO_GRE             =  47              ;  General Routing Encap.
IPPROTO_ESP             =  50              ;  SIPP Encap Sec. Payload
IPPROTO_AH              =  51              ;  SIPP Auth Header
IPPROTO_MOBILE          =  55
IPPROTO_ICMPV6          =  58              ;  ICMPv6
IPPROTO_NONE            =  59              ;  IPv6 no next header
IPPROTO_DSTOPTS         =  60              ;  IPv6 destination options
IPPROTO_MOBILITY_OLD    =  62
IPPROTO_ND              =  77              ;  Sun net disk proto (temp.)
IPPROTO_EIGRP           =  88              ;  Cisco/GXS IGRP
IPPROTO_OSPF            =  89
IPPROTO_PIM             =  103
IPPROTO_IPCOMP          =  108
IPPROTO_VRRP            =  112
IPPROTO_PGM             =  113
IPPROTO_SCTP            =  132
IPPROTO_MOBILITY        =  135









; Signal values
; default action is: "Term" - terminate; "Core" - terminate with core dump; "Ign" - ignore; "Stop" - stop the process; "Cont" - continue the process.

macro signal name, value {
  name = value
  name#.mask = 1 shl value
}

signal SIGHUP   ,  1    ; Term    Hangup detected on controlling terminal or death of controlling process
signal SIGINT   ,  2    ; Term    Interrupt from keyboard
signal SIGQUIT  ,  3    ; Core    Quit from keyboard
signal SIGILL   ,  4    ; Core    Illegal Instruction
signal SIGTRAP  ,  5    ; Core    Trace/breakpoint trap
signal SIGABRT  ,  6    ; Core    Abort signal from abort(3)
signal SIGIOT   ,  6    ; Core    IOT trap. A synonym for SIGABRT
signal SIGBUS   ,  7    ; Core    Bus error (bad memory access)
signal SIGFPE   ,  8    ; Core    Floating point exception
signal SIGKILL  ,  9    ; Term    Kill signal
signal SIGUSR1  , 10    ; Term    User-defined signal 1
signal SIGSEGV  , 11    ; Core    Invalid memory reference
signal SIGUSR2  , 12    ; Term    User-defined signal 2
signal SIGPIPE  , 13    ; Term    Broken pipe: write to pipe with no readers
signal SIGALRM  , 14    ; Term    Timer signal from alarm(2)
signal SIGTERM  , 15    ; Term    Termination signal
signal SIGSTKFLT, 16    ; Term    Stack fault on coprocessor (unused)
signal SIGCHLD  , 17    ; Ign     Child stopped or terminated
signal SIGCONT  , 18    ; Cont    Continue if stopped
signal SIGSTOP  , 19    ; Stop    Stop process
signal SIGTSTP  , 20    ; Stop    Stop typed at tty
signal SIGTTIN  , 21    ; Stop    tty input for background process
signal SIGTTOU  , 22    ; Stop    tty output for background process
signal SIGURG   , 23    ; Ign     Urgent condition on socket (4.2BSD)
signal SIGXCPU  , 24    ; Core    CPU time limit exceeded (4.2BSD)
signal SIGXFSZ  , 25    ; Core    File size limit exceeded (4.2BSD)
signal SIGVTALRM, 26    ; Term    Virtual alarm clock (4.2BSD)
signal SIGPROF  , 27    ; Term    Profiling timer expired
signal SIGWINCH , 28    ; Ign     Window resize signal (4.3BSD, Sun)
signal SIGIO    , 29    ; Term    I/O now possible (4.2BSD)
signal SIGPWR   , 30    ; Term    Power failure (System V)
signal SIGSYS   , 31    ; Core    Bad argument to routine (SVr4)
signal SIGUNUSED, 31    ; Core    Synonymous with SIGSYS

SIGRTMIN = 34
SIGRTMAX = 64

; signal flags

SA_ONSTACK    =  $00000001      ;  Call the signal handler on an alternate signal stack provided by
                                ;  sigaltstack(2).  If an alternate stack is not available, the
                                ;  default stack will be used.  This flag is only meaningful when
                                ;  establishing a signal handler.



SA_RESETHAND  =  $00000004      ;  Restore the signal action to the default state once the signal
                                ;  handler has been called.  This flag is only meaningful when
                                ;  establishing a signal handler.  SA_ONESHOT is an obsolete,
                                ;  nonstandard synonym for this flag.


SA_NOCLDSTOP  =  $00000008      ; If signum is SIGCHLD, do not receive notification when child
                                ; processes stop (i.e., when they receive one of SIGSTOP, SIGTSTP,
                                ; SIGTTIN or SIGTTOU) or resume (i.e., they receive SIGCONT) (see
                                ; wait(2)).  This flag is only meaningful when establishing a handler
                                ; for SIGCHLD.


SA_SIGINFO    =  $00000010      ;  The signal handler takes 3 arguments, not one.  In this case,
                                ;  sa_sigaction should be set instead of sa_handler.  This flag is
                                ;  only meaningful when establishing a signal handler.


SA_NODEFER    =  $00000020      ; Do not prevent the signal from being received from within its own
                                ; signal handler.  This flag is only meaningful when establishing a
                                ; signal handler.  SA_NOMASK is an obsolete, nonstandard synonym for
                                ; this flag.


SA_RESTART    =  $00000040      ;  Provide behavior compatible with BSD signal semantics by making
                                ;  certain system calls restartable across signals.  This flag is only
                                ;  meaningful when establishing a signal handler.  See signal(7) for a
                                ;  discussion of system call restarting.


SA_NOCLDWAIT  =  $00000080      ; If signum is SIGCHLD, do not transform children into zombies when
                                ; they terminate.  See also waitpid(2).  This flag is only meaningful
                                ; when establishing a handler for SIGCHLD, or when setting that
                                ; signal's disposition to SIG_DFL.
                                ;
                                ; If the SA_NOCLDWAIT flag is set when establishing a handler for
                                ; SIGCHLD, POSIX.1 leaves it unspecified whether a SIGCHLD signal is
                                ; generated when a child process terminates.  On Linux, a SIGCHLD
                                ; signal is generated in this case; on some other implementations, it
                                ; is not.


SA_NOMASK     =  SA_NODEFER
SA_ONESHOT    =  SA_RESETHAND
SA_INTERRUPT  =  $20000000      ; dummy -- ignored
SA_RESTORER   =  $04000000      ; obsolete -- ignored

; Signals hanlers constants

SIG_DFL = 0     ; default signal handling
SIG_IGN = 1     ; ignore signal
SIG_ERR = -1    ; error return from signal


; Interval timers structures

ITIMER_REAL    = 0
ITIMER_VIRTUAL = 1
ITIMER_PROF    = 2


struct lnx_sigaction
  .sa_handler   dd ?      ; SIG_DFL, SIG_IGN or ptr proc Handler, .signal
  .sa_sigaction dd ?      ; ptr proc SigAction, .signal, .ptrSignalInfo, .ptr
  .sa_mask      dd ?      ; mask of the signals
  .sa_flags     dd ?      ;
  .sa_restorer  dd ?      ; obsolete, don't use
ends


struct sig_context
  .gs            dd  ?
  .fs            dd  ?
  .es            dd  ?
  .ds            dd  ?

  .edi           dd  ?
  .esi           dd  ?
  .ebp           dd  ?
  .esp           dd  ?
  .ebx           dd  ?
  .edx           dd  ?
  .ecx           dd  ?
  .eax           dd  ?

  .trapno        dd  ?
  .err           dd  ?
  .eip           dd  ?
  .cs            dd  ?
  .eflags        dd  ?
  .esp_at_signal dd  ?
  .ss            dd  ?
  .fpstate       dd  ?
  .oldmask       dd  ?
  .cr2           dd  ?
ends



struct lnx_timeval
  .tv_sec  dd ?
  .tv_usec dd ?
ends

struct lnx_timezone
  .tz_minuteswest dd ?
  .tz_dsttime     dd ?
ends



struct lnx_itimerval
  .it_interval lnx_timeval
  .it_value    lnx_timeval
ends


; structures and equates for timer_xxxx POSIX functions


CLOCK_REALTIME            =  0 ; Identifier for system-wide realtime clock.
CLOCK_MONOTONIC           =  1 ; Monotonic system-wide clock.
CLOCK_PROCESS_CPUTIME_ID  =  2 ; High-resolution timer from the CPU.
CLOCK_THREAD_CPUTIME_ID   =  3 ; Thread-specific CPU-time clock.

SIGEV_SIGNAL = 0     ; Notify via signal.
SIGEV_NONE   = 1     ; Other notification: meaningless.
SIGEV_THREAD = 2     ; Deliver via thread creation.
SIGEV_THREAD_ID = 4  ; Send signal to specific thread.


struct lnx_sigval
  .sival_int dd ?
  virtual at .sival_int
    .sival_ptr dd ?
  end virtual
ends

struct lnx_sigev_thread
  .function  dd ?
  .attribute dd ?
ends


struct lnx_sigevent
  .value      lnx_sigval
  .signo      dd ?
  .notify     dd ?
  ._pad       rd 13

  virtual at ._pad
    ._tid     dd ?
  end virtual

  virtual at ._pad
    .thread   lnx_sigev_thread
  end virtual
ends


struct lnx_timespec
  .tv_sec  dd ?   ; time in seconds
  .tv_nsec dd ?   ; time is nano seconds
ends


struct lnx_itimerspec
  .it_interval lnx_timespec
  .it_value    lnx_timespec
ends


; sys_clone function flags

CLONE_VM                =  $00000100      ; set if VM shared between processes
CLONE_FS                =  $00000200      ; set if fs info shared between processes
CLONE_FILES             =  $00000400      ; set if open files shared between processes
CLONE_SIGHAND           =  $00000800      ; set if signal handlers and blocked signals shared
CLONE_PTRACE            =  $00002000      ; set if we want to let tracing continue on the child too
CLONE_VFORK             =  $00004000      ; set if the parent wants the child to wake it up on mm_release
CLONE_PARENT            =  $00008000      ; set if we want to have the same parent as the cloner
CLONE_THREAD            =  $00010000      ; Same thread group?
CLONE_NEWNS             =  $00020000      ; New namespace group?
CLONE_SYSVSEM           =  $00040000      ; share system V SEM_UNDO semantics
CLONE_SETTLS            =  $00080000      ; create a new TLS for the child
CLONE_PARENT_SETTID     =  $00100000      ; set the TID in the parent
CLONE_CHILD_CLEARTID    =  $00200000      ; clear the TID in the child
CLONE_DETACHED          =  $00400000      ; Unused, ignored
CLONE_UNTRACED          =  $00800000      ; set if the tracing process can't force CLONE_PTRACE on this clone
CLONE_CHILD_SETTID      =  $01000000      ; set the TID in the child
CLONE_STOPPED           =  $02000000      ; Start in stopped state
CLONE_NEWUTS            =  $04000000      ; New utsname group?
CLONE_NEWIPC            =  $08000000      ; New ipcs
CLONE_NEWUSER           =  $10000000      ; New user namespace
CLONE_NEWPID            =  $20000000      ; New pid namespace
CLONE_NEWNET            =  $40000000      ; New network namespace
CLONE_IO                =  $80000000      ; Clone io context


; Memory constants

; Protections are chosen from these bits, OR'd together.  The
;   implementation does not necessarily support PROT_EXEC or PROT_WRITE
;   without PROT_READ.  The only guarantees are that no writing will be
;   allowed without PROT_WRITE and no access will be allowed for PROT_NONE.

PROT_READ       =  $1             ; Page can be read.
PROT_WRITE      =  $2             ; Page can be written.
PROT_EXEC       =  $4             ; Page can be executed.
PROT_NONE       =  $0             ; Page can not be accessed.
PROT_GROWSDOWN  =  $01000000      ; Extend change to start of
                                        ; growsdown vma (mprotect only).
PROT_GROWSUP    =  $02000000      ; Extend change to start of
                                        ; growsup vma (mprotect only).

; Sharing types (must choose one and only one of these).
MAP_SHARED      =  $01            ; Share changes.
MAP_PRIVATE     =  $02            ; Changes are private.
MAP_TYPE        =  $0f            ; Mask for type of mapping.


; Other flags.
MAP_FIXED       =  $10            ; Interpret addr exactly.
MAP_ANONYMOUS   =  $20            ; Don't use a file.
MAP_32BIT       =  $40            ; Only give out 32-bit addresses.


; These are Linux-specific.
MAP_GROWSDOWN  =  $00100          ; Stack-like segment.
MAP_DENYWRITE  =  $00800          ; ETXTBSY
MAP_EXECUTABLE =  $01000          ; Mark it as an executable.
MAP_LOCKED     =  $02000          ; Lock the mapping.
MAP_NORESERVE  =  $04000          ; Don't check for reservations.
MAP_POPULATE   =  $08000          ; Populate (prefault) pagetables.
MAP_NONBLOCK   =  $10000          ; Do not block on IO.
MAP_STACK      =  $20000          ; Allocation is for a stack.


; Flags to `msync'.
MS_ASYNC       = 1                ; Sync memory asynchronously.
MS_SYNC        = 4                ; Synchronous memory sync.
MS_INVALIDATE  = 2                ; Invalidate the caches.


; Flags for `mlockall'.
MCL_CURRENT    = 1                ; Lock all currently mapped pages.
MCL_FUTURE     = 2                ; Lock all additions to address space.

; Flags for `mremap'.
MREMAP_MAYMOVE = 1
MREMAP_FIXED   = 2

; Advice to `madvise'.
MADV_NORMAL     = 0      ; No further special treatment.
MADV_RANDOM     = 1      ; Expect random page references.
MADV_SEQUENTIAL = 2      ; Expect sequential page references.
MADV_WILLNEED   = 3      ; Will need these pages.
MADV_DONTNEED   = 4      ; Don't need these pages.
MADV_REMOVE     = 9      ; Remove these pages and resources.
MADV_DONTFORK   = 10     ; Do not inherit across fork.
MADV_DOFORK     = 11     ; Do inherit across fork.


; The POSIX people had to invent similar names for the same things.
POSIX_MADV_NORMAL      = 0 ; No further special treatment.
POSIX_MADV_RANDOM      = 1 ; Expect random page references.
POSIX_MADV_SEQUENTIAL  = 2 ; Expect sequential page references.
POSIX_MADV_WILLNEED    = 3 ; Will need these pages.
POSIX_MADV_DONTNEED    = 4 ; Don't need these pages.



; sys_futex constants


FUTEX_WAIT             = 0
FUTEX_WAKE             = 1
FUTEX_FD               = 2
FUTEX_REQUEUE          = 3
FUTEX_CMP_REQUEUE      = 4
FUTEX_WAKE_OP          = 5
FUTEX_LOCK_PI          = 6
FUTEX_UNLOCK_PI        = 7
FUTEX_TRYLOCK_PI       = 8
FUTEX_WAIT_BITSET      = 9
FUTEX_WAKE_BITSET      = 10

FUTEX_PRIVATE_FLAG  = $80

; sys_fstat and similar structures

struct STAT
  .st_dev     dw  ?     ; ID of device containing file
  .pad1       dw  ?
  .st_ino     dd  ?     ; inode number
  .st_mode    dw  ?     ; protection
  .st_nlink   dw  ?     ; number of hard links
  .st_uid     dw  ?     ; user ID of owner
  .st_gid     dw  ?     ; group ID of owner
  .st_rdev    dw  ?     ; device ID (if special file)
  .pad2       dw  ?
  .st_size    dd  ?     ; total size, in bytes
  .st_blksize dd  ?     ; block size
  .st_blocks  dd  ?

  .st_atime   dd  ?     ; time of last access
  .unused1    dd  ?

  .st_mtime   dd  ?     ; time of last modification
  .unused2    dd  ?

  .st_ctime   dd  ?     ; time of last status change
  .unused3    dd  ?
  .unused4    dd  ?
  .unused5    dd  ?
ends


; sys_getdents

; it is variable length structure.
struct linux_dirent
  .d_ino dd ?
  .d_off dd ?
  .d_reclen dw ?
  label .d_name byte
ends

; file types for the above structure.
; this value is written at the last byte of the structure. (linux_dirent.d_reclen-1)

DT_UNKNOWN   =   0
DT_FIFO      =   1
DT_CHR       =   2
DT_DIR       =   4
DT_BLK       =   6
DT_REG       =   8      ; regular file
DT_LNK       =   10
DT_SOCK      =   12
DT_WHT       =   14


; sys_ioctl constants and structures.

_IOC_NONE       = 0
_IOC_WRITE      = 1
_IOC_READ       = 2
_IOC_NRBITS     = 8
_IOC_TYPEBITS   = 8
_IOC_SIZEBITS   = 14
_IOC_DIRBITS    = 2
_IOC_NRSHIFT    = 0
_IOC_TYPESHIFT  = (_IOC_NRSHIFT+_IOC_NRBITS)
_IOC_SIZESHIFT  = (_IOC_TYPESHIFT+_IOC_TYPEBITS)
_IOC_DIRSHIFT   = (_IOC_SIZESHIFT+_IOC_SIZEBITS)


TCGETS          = 0x5401
TCSETS          = 0x5402
TCSETSW         = 0x5403
TCSETSF         = 0x5404
TCGETA          = 0x5405
TCSETA          = 0x5406
TCSETAW         = 0x5407
TCSETAF         = 0x5408
TCSBRK          = 0x5409
TCXONC          = 0x540A
TCFLSH          = 0x540B
TIOCEXCL        = 0x540C
TIOCNXCL        = 0x540D
TIOCSCTTY       = 0x540E
TIOCGPGRP       = 0x540F
TIOCSPGRP       = 0x5410
TIOCOUTQ        = 0x5411
TIOCSTI         = 0x5412
TIOCGWINSZ      = 0x5413
TIOCSWINSZ      = 0x5414
TIOCMGET        = 0x5415
TIOCMBIS        = 0x5416
TIOCMBIC        = 0x5417
TIOCMSET        = 0x5418
TIOCGSOFTCAR    = 0x5419
TIOCSSOFTCAR    = 0x541A
FIONREAD        = 0x541B
TIOCINQ         = FIONREAD
TIOCLINUX       = 0x541C
TIOCCONS        = 0x541D
TIOCGSERIAL     = 0x541E
TIOCSSERIAL     = 0x541F
TIOCPKT         = 0x5420
FIONBIO         = 0x5421
TIOCNOTTY       = 0x5422
TIOCSETD        = 0x5423
TIOCGETD        = 0x5424
TCSBRKP         = 0x542
TIOCSBRK        = 0x5427
TIOCCBRK        = 0x5428
TIOCGSID        = 0x5429
TIOCGPTN        = ((_IOC_READ shl _IOC_DIRSHIFT) or ("T" shl _IOC_TYPESHIFT) or (0x30 shl _IOC_NRSHIFT) or (4 shl _IOC_SIZESHIFT))
TIOCSPTLCK      = ((_IOC_WRITE shl _IOC_DIRSHIFT) or ("T" shl _IOC_TYPESHIFT) or (0x31 shl _IOC_NRSHIFT) or (4 shl _IOC_SIZESHIFT))
FIONCLEX        = 0x5450
FIOCLEX         = 0x5451
FIOASYNC        = 0x5452
TIOCSERCONFIG   = 0x5453
TIOCSERGWILD    = 0x5454
TIOCSERSWILD    = 0x5455
TIOCGLCKTRMIOS  = 0x5456
TIOCSLCKTRMIOS  = 0x5457
TIOCSERGSTRUCT  = 0x5458
TIOCSERGETLSR   = 0x5459
TIOCSERGETMULTI = 0x545A
TIOCSERSETMULTI = 0x545B
TIOCMIWAIT      = 0x545C
TIOCGICOUNT     = 0x545D
TIOCGHAYESESP   = 0x545E
TIOCSHAYESESP   = 0x545F
FIOQSIZE        = 0x5460


NCCS = 19

struct termios
.c_iflag rd 1 ; input mode flags
.c_oflag rd 1 ; output mode flags
.c_cflag rd 1 ; control mode flags
.c_lflag rd 1 ; local mode flags
.c_line  rb 1 ; line discipline
.c_cc    rb NCCS ; control characters
ends


;termios entries.

; c_cc characters
VINTR   = 0
VQUIT   = 1
VERASE  = 2
VKILL   = 3
VEOF    = 4
VTIME   = 5
VMIN    = 6
VSWTC   = 7
VSTART  = 8
VSTOP   = 9
VSUSP   = 10
VEOL    = 11
VREPRINT = 12
VDISCARD = 13
VWERASE = 14
VLNEXT  = 15
VEOL2   = 16

; c_iflag bits
IGNBRK  = 0000001o
BRKINT  = 0000002o
IGNPAR  = 0000004o
PARMRK  = 0000010o
INPCK   = 0000020o
ISTRIP  = 0000040o
INLCR   = 0000100o
IGNCR   = 0000200o
ICRNL   = 0000400o
IUCLC   = 0001000o
IXON    = 0002000o
IXANY   = 0004000o
IXOFF   = 0010000o
IMAXBEL = 0020000o
IUTF8   = 0040000o

; c_oflag bits
OPOST   = 0000001o
OLCUC   = 0000002o
ONLCR   = 0000004o
OCRNL   = 0000010o
ONOCR   = 0000020o
ONLRET  = 0000040o
OFILL   = 0000100o
OFDEL   = 0000200o
NLDLY   = 0000400o
NL0     = 0000000o
NL1     = 0000400o
CRDLY   = 0003000o
cCR0     = 0000000o
cCR1     = 0001000o
cCR2     = 0002000o
cCR3     = 0003000o
TABDLY  = 0014000o
TAB0    = 0000000o
TAB1    = 0004000o
TAB2    = 0010000o
TAB3    = 0014000o
XTABS   = 0014000o
BSDLY   = 0020000o
BS0     = 0000000o
BS1     = 0020000o
VTDLY   = 0040000o
VT0     = 0000000o
VT1     = 0040000o
FFDLY   = 0100000o
FF0     = 0000000o
FF1     = 0100000o

; c_cflag bit meaning
CBAUD   = 0010017o
B0      = 0000000o
B50     = 0000001o
B75     = 0000002o
B110    = 0000003o
B134    = 0000004o
B150    = 0000005o
B200    = 0000006o
B300    = 0000007o
B600    = 0000010o
B1200   = 0000011o
B1800   = 0000012o
B2400   = 0000013o
B4800   = 0000014o
B9600   = 0000015o
B19200  = 0000016o
B38400  = 0000017o
EXTA    = B19200
EXTB    = B38400
CSIZE    = 0000060o
CS5      = 0000000o
CS6      = 0000020o
CS7      = 0000040o
CS8      = 0000060o
CSTOPB   = 0000100o
CREAD    = 0000200o
PARENB   = 0000400o
PARODD   = 0001000o
HUPCL    = 0002000o
CLOCAL   = 0004000o
CBAUDEX  = 0010000o
B57600   = 0010001o
B115200  = 0010002o
B230400  = 0010003o
B460800  = 0010004o
B500000  = 0010005o
B576000  = 0010006o
B921600  = 0010007o
B1000000 = 0010010o
B1152000 = 0010011o
B1500000 = 0010012o
B2000000 = 0010013o
B2500000 = 0010014o
B3000000 = 0010015o
B3500000 = 0010016o
B4000000 = 0010017o
CIBAUD   = 002003600000o
CMSPAR   = 010000000000o
CRTSCTS  = 020000000000o

; c_lflag bits
ISIG    = 0000001o
ICANON  = 0000002o
XCASE   = 0000004o
ECHO    = 0000010o
ECHOE   = 0000020o
ECHOK   = 0000040o
ECHONL  = 0000100o
NOFLSH  = 0000200o
TOSTOP  = 0000400o
ECHOCTL = 0001000o
ECHOPRT = 0002000o
ECHOKE  = 0004000o
FLUSHO  = 0010000o
PENDIN  = 0040000o
IEXTEN  = 0100000o

;end of termios entries.



; Constants for sys_personality


ADDR_NO_RANDOMIZE   = $00040000
MMAP_PAGE_ZERO      = $00100000
ADDR_COMPAT_LAYOUT  = $00200000
READ_IMPLIES_EXEC   = $00400000
ADDR_LIMIT_32BIT    = $00800000
SHORT_INODE         = $01000000
WHOLE_SECONDS       = $02000000
STICKY_TIMEOUTS     = $04000000
ADDR_LIMIT_3GB      = $08000000


; Personality types.

;   These go in the low byte.  Avoid using the top bit, it will conflict with error returns.

PER_LINUX       = $0000
PER_LINUX_32BIT = $0000 or ADDR_LIMIT_32BIT
PER_SVR4        = $0001 or STICKY_TIMEOUTS or MMAP_PAGE_ZERO
PER_SVR3        = $0002 or STICKY_TIMEOUTS or SHORT_INODE
PER_SCOSVR3     = $0003 or STICKY_TIMEOUTS or WHOLE_SECONDS or SHORT_INODE
PER_OSR5        = $0003 or STICKY_TIMEOUTS or WHOLE_SECONDS
PER_WYSEV386    = $0004 or STICKY_TIMEOUTS or SHORT_INODE
PER_ISCR4       = $0005 or STICKY_TIMEOUTS
PER_BSD         = $0006
PER_SUNOS       = $0006 or STICKY_TIMEOUTS
PER_XENIX       = $0007 or STICKY_TIMEOUTS or SHORT_INODE
PER_LINUX32     = $0008
PER_LINUX32_3GB = $0008 or ADDR_LIMIT_3GB
PER_IRIX32      = $0009 or STICKY_TIMEOUTS      ; IRIX5 32-bit
PER_IRIXN32     = $000a or STICKY_TIMEOUTS      ; IRIX6 new 32-bit
PER_IRIX64      = $000b or STICKY_TIMEOUTS      ; IRIX6 64-bit
PER_RISCOS      = $000c
PER_SOLARIS     = $000d or STICKY_TIMEOUTS
PER_UW7         = $000e or STICKY_TIMEOUTS or MMAP_PAGE_ZERO
PER_OSF4        = $000f
PER_HPUX        = $0010
PER_MASK        = $00ff
