]> gitweb.factorcode.org Git - factor.git/blob - basis/unix/ffi/bsd/netbsd/netbsd.factor
d755caf874605d662cc617bf1c58006bb798f242
[factor.git] / basis / unix / ffi / bsd / netbsd / netbsd.factor
1 USING: alien.syntax alien.c-types math vocabs.loader
2 classes.struct unix.types unix.time ;
3 IN: unix.ffi
4
5 CONSTANT: FD_SETSIZE 256
6
7 STRUCT: addrinfo
8     { flags int }
9     { family int }
10     { socktype int }
11     { protocol int }
12     { addrlen socklen_t }
13     { canonname char* }
14     { addr void* }
15     { next addrinfo* } ;
16
17 STRUCT: dirent
18     { d_fileno __uint32_t }
19     { d_reclen __uint16_t }
20     { d_type __uint8_t }
21     { d_namlen __uint8_t }
22     { d_name char[256] } ;
23
24 CONSTANT: EPERM 1
25 CONSTANT: ENOENT 2
26 CONSTANT: ESRCH 3
27 CONSTANT: EINTR 4
28 CONSTANT: EIO 5
29 CONSTANT: ENXIO 6
30 CONSTANT: E2BIG 7
31 CONSTANT: ENOEXEC 8
32 CONSTANT: EBADF 9
33 CONSTANT: ECHILD 10
34 CONSTANT: EDEADLK 11
35 CONSTANT: ENOMEM 12
36 CONSTANT: EACCES 13
37 CONSTANT: EFAULT 14
38 CONSTANT: ENOTBLK 15
39 CONSTANT: EBUSY 16
40 CONSTANT: EEXIST 17
41 CONSTANT: EXDEV 18
42 CONSTANT: ENODEV 19
43 CONSTANT: ENOTDIR 20
44 CONSTANT: EISDIR 21
45 CONSTANT: EINVAL 22
46 CONSTANT: ENFILE 23
47 CONSTANT: EMFILE 24
48 CONSTANT: ENOTTY 25
49 CONSTANT: ETXTBSY 26
50 CONSTANT: EFBIG 27
51 CONSTANT: ENOSPC 28
52 CONSTANT: ESPIPE 29
53 CONSTANT: EROFS 30
54 CONSTANT: EMLINK 31
55 CONSTANT: EPIPE 32
56 CONSTANT: EDOM 33
57 CONSTANT: ERANGE 34
58 CONSTANT: EAGAIN 35
59 ALIAS: EWOULDBLOCK EAGAIN
60 CONSTANT: EINPROGRESS 36
61 CONSTANT: EALREADY 37
62 CONSTANT: ENOTSOCK 38
63 CONSTANT: EDESTADDRREQ 39
64 CONSTANT: EMSGSIZE 40
65 CONSTANT: EPROTOTYPE 41
66 CONSTANT: ENOPROTOOPT 42
67 CONSTANT: EPROTONOSUPPORT 43
68 CONSTANT: ESOCKTNOSUPPORT 44
69 CONSTANT: EOPNOTSUPP 45
70 CONSTANT: EPFNOSUPPORT 46
71 CONSTANT: EAFNOSUPPORT 47
72 CONSTANT: EADDRINUSE 48
73 CONSTANT: EADDRNOTAVAIL 49
74 CONSTANT: ENETDOWN 50
75 CONSTANT: ENETUNREACH 51
76 CONSTANT: ENETRESET 52
77 CONSTANT: ECONNABORTED 53
78 CONSTANT: ECONNRESET 54
79 CONSTANT: ENOBUFS 55
80 CONSTANT: EISCONN 56
81 CONSTANT: ENOTCONN 57
82 CONSTANT: ESHUTDOWN 58
83 CONSTANT: ETOOMANYREFS 59
84 CONSTANT: ETIMEDOUT 60
85 CONSTANT: ECONNREFUSED 61
86 CONSTANT: ELOOP 62
87 CONSTANT: ENAMETOOLONG 63
88 CONSTANT: EHOSTDOWN 64
89 CONSTANT: EHOSTUNREACH 65
90 CONSTANT: ENOTEMPTY 66
91 CONSTANT: EPROCLIM 67
92 CONSTANT: EUSERS 68
93 CONSTANT: EDQUOT 69
94 CONSTANT: ESTALE 70
95 CONSTANT: EREMOTE 71
96 CONSTANT: EBADRPC 72
97 CONSTANT: ERPCMISMATCH 73
98 CONSTANT: EPROGUNAVAIL 74
99 CONSTANT: EPROGMISMATCH 75
100 CONSTANT: EPROCUNAVAIL 76
101 CONSTANT: ENOLCK 77
102 CONSTANT: ENOSYS 78
103 CONSTANT: EFTYPE 79
104 CONSTANT: EAUTH 80
105 CONSTANT: ENEEDAUTH 81
106 CONSTANT: EIDRM 82
107 CONSTANT: ENOMSG 83
108 CONSTANT: EOVERFLOW 84
109 CONSTANT: EILSEQ 85
110 CONSTANT: ENOTSUP 86
111 CONSTANT: ECANCELED 87
112 CONSTANT: EBADMSG 88
113 CONSTANT: ENODATA 89
114 CONSTANT: ENOSR 90
115 CONSTANT: ENOSTR 91
116 CONSTANT: ETIME 92
117 CONSTANT: ENOATTR 93
118 CONSTANT: EMULTIHOP 94
119 CONSTANT: ENOLINK 95
120 CONSTANT: EPROTO 96
121 CONSTANT: ELAST 96
122
123 TYPEDEF: __uint8_t sa_family_t
124
125 CONSTANT: _UTX_USERSIZE   32
126 CONSTANT: _UTX_LINESIZE   32
127 CONSTANT: _UTX_IDSIZE     4
128 CONSTANT: _UTX_HOSTSIZE   256
129
130 <<
131
132 CONSTANT: _SS_MAXSIZE 128
133
134 : _SS_ALIGNSIZE ( -- n )
135     __int64_t heap-size ; inline
136     
137 : _SS_PAD1SIZE ( -- n )
138     _SS_ALIGNSIZE 2 - ; inline
139     
140 : _SS_PAD2SIZE ( -- n )
141     _SS_MAXSIZE 2 - _SS_PAD1SIZE - _SS_ALIGNSIZE - ; inline
142
143 >>
144
145 STRUCT: sockaddr_storage
146     { ss_len __uint8_t }
147     { ss_family sa_family_t }
148     { __ss_pad1 { char _SS_PAD1SIZE } }
149     { __ss_align __int64_t }
150     { __ss_pad2 { char _SS_PAD2SIZE } } ;
151
152 STRUCT: exit_struct
153     { e_termination uint16_t }
154     { e_exit uint16_t } ;
155
156 STRUCT: utmpx
157     { ut_user { char _UTX_USERSIZE } }
158     { ut_id   { char _UTX_IDSIZE   } }
159     { ut_line { char _UTX_LINESIZE } }
160     { ut_host { char _UTX_HOSTSIZE } }
161     { ut_session uint16_t }
162     { ut_type uint16_t }
163     { ut_pid pid_t }
164     { ut_exit exit_struct }
165     { ut_ss sockaddr_storage }
166     { ut_tv timeval }
167     { ut_pad { uint32_t 10 } } ;