]> gitweb.factorcode.org Git - factor.git/blob - basis/unix/ffi/macosx/macosx.factor
5a04ebe98ca3574009530b37e1810daa016540bc
[factor.git] / basis / unix / ffi / macosx / macosx.factor
1 USING: alien alien.c-types alien.libraries alien.syntax
2 classes.struct combinators kernel system unix unix.time
3 unix.types vocabs vocabs.loader ;
4 IN: unix.ffi
5
6 CONSTANT: MAXPATHLEN 1024
7
8 CONSTANT: O_RDONLY   0x0000
9 CONSTANT: O_WRONLY   0x0001
10 CONSTANT: O_RDWR     0x0002
11 CONSTANT: O_NONBLOCK 0x0004
12 CONSTANT: O_APPEND   0x0008
13 CONSTANT: O_CREAT    0x0200
14 CONSTANT: O_TRUNC    0x0400
15 CONSTANT: O_EXCL     0x0800
16 CONSTANT: O_NOCTTY   0x20000
17 ALIAS: O_NDELAY O_NONBLOCK
18
19 CONSTANT: SOL_SOCKET 0xffff
20 CONSTANT: SO_REUSEADDR 0x4
21 CONSTANT: SO_KEEPALIVE 0x8
22 CONSTANT: SO_DONTROUTE 0x10
23 CONSTANT: SO_BROADCAST 0x20
24 CONSTANT: SO_OOBINLINE 0x100
25 CONSTANT: SO_SNDBUF 0x1001
26 CONSTANT: SO_RCVBUF 0x1002
27 CONSTANT: SO_SNDTIMEO 0x1005
28 CONSTANT: SO_RCVTIMEO 0x1006
29
30 CONSTANT: F_SETFD 2
31 CONSTANT: F_SETFL 4
32 CONSTANT: FD_CLOEXEC 1
33
34 STRUCT: sockaddr-in
35     { len uchar }
36     { family uchar }
37     { port ushort }
38     { addr in_addr_t }
39     { unused longlong } ;
40
41 STRUCT: sockaddr-in6
42     { len uchar }
43     { family uchar }
44     { port ushort }
45     { flowinfo uint }
46     { addr uchar[16] }
47     { scopeid uint } ;
48
49 STRUCT: sockaddr-un
50     { len uchar }
51     { family uchar }
52     { path char[104] } ;
53
54 STRUCT: passwd
55     { pw_name c-string }
56     { pw_passwd c-string }
57     { pw_uid uid_t }
58     { pw_gid gid_t }
59     { pw_change time_t }
60     { pw_class c-string }
61     { pw_gecos c-string }
62     { pw_dir c-string }
63     { pw_shell c-string }
64     { pw_expire time_t }
65     { pw_fields int } ;
66
67 CONSTANT: max-un-path 104
68
69 CONSTANT: SOCK_STREAM 1
70 CONSTANT: SOCK_DGRAM 2
71 CONSTANT: SOCK_RAW 3
72
73 CONSTANT: AF_UNSPEC 0
74 CONSTANT: AF_UNIX 1
75 CONSTANT: AF_INET 2
76
77 ALIAS: PF_UNSPEC AF_UNSPEC
78 ALIAS: PF_UNIX AF_UNIX
79 ALIAS: PF_INET AF_INET
80
81 CONSTANT: IPPROTO_TCP 6
82 CONSTANT: IPPROTO_UDP 17
83
84 CONSTANT: AI_PASSIVE 1
85
86 CONSTANT: SEEK_SET 0
87 CONSTANT: SEEK_CUR 1
88 CONSTANT: SEEK_END 2
89
90 CONSTANT: FD_SETSIZE 1024
91
92 CONSTANT: AF_INET6 30
93 ALIAS: PF_INET6 AF_INET6
94
95 STRUCT: addrinfo
96     { flags int }
97     { family int } 
98     { socktype int }
99     { protocol int }
100     { addrlen socklen_t }
101     { canonname c-string }
102     { addr void* }
103     { next addrinfo* } ;
104
105 CONSTANT: _UTX_USERSIZE 256
106 CONSTANT: _UTX_LINESIZE 32
107 CONSTANT: _UTX_IDSIZE 4
108 CONSTANT: _UTX_HOSTSIZE 256
109
110 STRUCT: utmpx
111     { ut_user { char _UTX_USERSIZE } }
112     { ut_id   { char _UTX_IDSIZE   } }
113     { ut_line { char _UTX_LINESIZE } }
114     { ut_pid  pid_t }
115     { ut_type short }
116     { ut_tv   timeval }
117     { ut_host { char _UTX_HOSTSIZE } }
118     { ut_pad  { uint 16 } } ;
119
120 CONSTANT: __DARWIN_MAXPATHLEN 1024
121 CONSTANT: __DARWIN_MAXNAMELEN 255
122 CONSTANT: __DARWIN_MAXNAMELEN+1 256
123
124 STRUCT: dirent
125     { d_ino ino_t }
126     { d_reclen __uint16_t }
127     { d_type __uint8_t }
128     { d_namlen __uint8_t }
129     { d_name { char __DARWIN_MAXNAMELEN+1 } } ;
130
131 CONSTANT: EPERM 1
132 CONSTANT: ENOENT 2
133 CONSTANT: ESRCH 3
134 CONSTANT: EINTR 4
135 CONSTANT: EIO 5
136 CONSTANT: ENXIO 6
137 CONSTANT: E2BIG 7
138 CONSTANT: ENOEXEC 8
139 CONSTANT: EBADF 9
140 CONSTANT: ECHILD 10
141 CONSTANT: EDEADLK 11
142 CONSTANT: ENOMEM 12
143 CONSTANT: EACCES 13
144 CONSTANT: EFAULT 14
145 CONSTANT: ENOTBLK 15
146 CONSTANT: EBUSY 16
147 CONSTANT: EEXIST 17
148 CONSTANT: EXDEV 18
149 CONSTANT: ENODEV 19
150 CONSTANT: ENOTDIR 20
151 CONSTANT: EISDIR 21
152 CONSTANT: EINVAL 22
153 CONSTANT: ENFILE 23
154 CONSTANT: EMFILE 24
155 CONSTANT: ENOTTY 25
156 CONSTANT: ETXTBSY 26
157 CONSTANT: EFBIG 27
158 CONSTANT: ENOSPC 28
159 CONSTANT: ESPIPE 29
160 CONSTANT: EROFS 30
161 CONSTANT: EMLINK 31
162 CONSTANT: EPIPE 32
163 CONSTANT: EDOM 33
164 CONSTANT: ERANGE 34
165 CONSTANT: EAGAIN 35
166 ALIAS: EWOULDBLOCK EAGAIN
167 CONSTANT: EINPROGRESS 36
168 CONSTANT: EALREADY 37
169 CONSTANT: ENOTSOCK 38
170 CONSTANT: EDESTADDRREQ 39
171 CONSTANT: EMSGSIZE 40
172 CONSTANT: EPROTOTYPE 41
173 CONSTANT: ENOPROTOOPT 42
174 CONSTANT: EPROTONOSUPPORT 43
175 CONSTANT: ESOCKTNOSUPPORT 44
176 CONSTANT: ENOTSUP 45
177 CONSTANT: EPFNOSUPPORT 46
178 CONSTANT: EAFNOSUPPORT 47
179 CONSTANT: EADDRINUSE 48
180 CONSTANT: EADDRNOTAVAIL 49
181 CONSTANT: ENETDOWN 50
182 CONSTANT: ENETUNREACH 51
183 CONSTANT: ENETRESET 52
184 CONSTANT: ECONNABORTED 53
185 CONSTANT: ECONNRESET 54
186 CONSTANT: ENOBUFS 55
187 CONSTANT: EISCONN 56
188 CONSTANT: ENOTCONN 57
189 CONSTANT: ESHUTDOWN 58
190 CONSTANT: ETOOMANYREFS 59
191 CONSTANT: ETIMEDOUT 60
192 CONSTANT: ECONNREFUSED 61
193 CONSTANT: ELOOP 62
194 CONSTANT: ENAMETOOLONG 63
195 CONSTANT: EHOSTDOWN 64
196 CONSTANT: EHOSTUNREACH 65
197 CONSTANT: ENOTEMPTY 66
198 CONSTANT: EPROCLIM 67
199 CONSTANT: EUSERS 68
200 CONSTANT: EDQUOT 69
201 CONSTANT: ESTALE 70
202 CONSTANT: EREMOTE 71
203 CONSTANT: EBADRPC 72
204 CONSTANT: ERPCMISMATCH 73
205 CONSTANT: EPROGUNAVAIL 74
206 CONSTANT: EPROGMISMATCH 75
207 CONSTANT: EPROCUNAVAIL 76
208 CONSTANT: ENOLCK 77
209 CONSTANT: ENOSYS 78
210 CONSTANT: EFTYPE 79
211 CONSTANT: EAUTH 80
212 CONSTANT: ENEEDAUTH 81
213 CONSTANT: EPWROFF 82
214 CONSTANT: EDEVERR 83
215 CONSTANT: EOVERFLOW 84
216 CONSTANT: EBADEXEC 85
217 CONSTANT: EBADARCH 86
218 CONSTANT: ESHLIBVERS 87
219 CONSTANT: EBADMACHO 88
220 CONSTANT: ECANCELED 89
221 CONSTANT: EIDRM 90
222 CONSTANT: ENOMSG 91
223 CONSTANT: EILSEQ 92
224 CONSTANT: ENOATTR 93
225 CONSTANT: EBADMSG 94
226 CONSTANT: EMULTIHOP 95
227 CONSTANT: ENODATA 96
228 CONSTANT: ENOLINK 97
229 CONSTANT: ENOSR 98
230 CONSTANT: ENOSTR 99
231 CONSTANT: EPROTO 100
232 CONSTANT: ETIME 101
233 CONSTANT: EOPNOTSUPP 102
234 CONSTANT: ENOPOLICY 103
235
236 CONSTANT: SIGHUP     1
237 CONSTANT: SIGINT     2
238 CONSTANT: SIGQUIT    3
239 CONSTANT: SIGILL     4
240 CONSTANT: SIGTRAP    5
241 CONSTANT: SIGABRT    6
242 CONSTANT: SIGEMT     7
243 CONSTANT: SIGFPE     8
244 CONSTANT: SIGKILL    9
245 CONSTANT: SIGBUS    10
246 CONSTANT: SIGSEGV   11
247 CONSTANT: SIGSYS    12
248 CONSTANT: SIGPIPE   13
249 CONSTANT: SIGALRM   14
250 CONSTANT: SIGTERM   15
251 CONSTANT: SIGURG    16
252 CONSTANT: SIGSTOP   17
253 CONSTANT: SIGTSTP   18
254 CONSTANT: SIGCONT   19
255 CONSTANT: SIGCHLD   20
256 CONSTANT: SIGTTIN   21
257 CONSTANT: SIGTTOU   22
258 CONSTANT: SIGIO     23
259 CONSTANT: SIGXCPU   24
260 CONSTANT: SIGXFSZ   25
261 CONSTANT: SIGVTALRM 26
262 CONSTANT: SIGPROF   27
263 CONSTANT: SIGWINCH  28
264 CONSTANT: SIGINFO   29
265 CONSTANT: SIGUSR1   30
266 CONSTANT: SIGUSR2   31
267
268 STRUCT: sf_hdtr
269     { headers void* }
270     { hdr_cnt int }
271     { trailers void* }
272     { trl_cnt int } ;
273
274 FUNCTION: int sendfile ( int fd, int s, off_t offset, off_t* len, sf_hdtr* hdtr, int flags ) ;