DEADSOFTWARE

37fee0fb597098f48d2013a53dbc54bc45de3748
[bbcp.git] / BlackBox / _OpenBSD_ / Lin / Mod / Libc.txt
1 MODULE LinLibc ["libc.so.90.0"];
3 (*
4 OpenBSD 6.0
5 i386
6 *)
8 CONST
9 NULL* = 0H;
10 FALSE* = 0;
11 TRUE* = 1;
13 CLOCKS_PER_SEC* = 100;
15 MAP_FAILED* = -1;
17 (* MAP_PRIVATE, MAP_ANON (intFlags) *)
18 MAP_SHARED* = {0}; (* share changes *)
19 MAP_PRIVATE* = {1}; (* changes are private *)
20 MAP_FIXED* = {4}; (* map addr must be exactly as requested *)
21 MAP_ANON* = {12}; (* allocated from memory, swap space *)
22 MAP_ANONYMOUS* = MAP_ANON; (* alternate POSIX spelling *)
23 MAP_FLAGMASK* = {0..2,4..13};
24 MAP_INHERIT_SHARE* = {}; (* share with child *)
25 MAP_INHERIT_COPY* = {0}; (* copy into child *)
26 MAP_INHERIT_NONE* = {1}; (* absent from child *)
27 MAP_INHERIT_ZERO* = {0,1}; (* zero in child *)
30 (* PROT_READ, PROT_WRITE, PROT_EXEC (intFlags) *)
31 PROT_NONE* = {}; (* no permissions *)
32 PROT_READ* = {0}; (* pages can be read *)
33 PROT_WRITE* = {1}; (* pages can be written *)
34 PROT_EXEC* = {2}; (* pages can be executed *)
37 (* SIG_UNBLOCK, SIG_SETMASK (int) *)
38 SIG_BLOCK* = 1; (* block specified signal set *)
39 SIG_UNBLOCK* = 2; (* unblock specified signal set *)
40 SIG_SETMASK* = 3; (* set specified signal set *)
43 (* FPE_INTDIV, FPE_INTOVF, FPE_FLTDIV, FPE_FLTOVF, FPE_FLTUND, FPE_FLTRES, FPE_FLTINV, FPE_FLTSUB (int) *)
44 FPE_INTDIV* = 1; (* integer divide by zero *)
45 FPE_INTOVF* = 2; (* integer overflow *)
46 FPE_FLTDIV* = 3; (* floating point divide by zero *)
47 FPE_FLTOVF* = 4; (* floating point overflow *)
48 FPE_FLTUND* = 5; (* floating point underflow *)
49 FPE_FLTRES* = 6; (* floating point inexact result *)
50 FPE_FLTINV* = 7; (* invalid floating point operation *)
51 FPE_FLTSUB* = 8; (* subscript out of range *)
54 (* SA_SIGINFO (intFlags) *)
55 SA_NOCLDSTOP* = {3}; (* do not generate SIGCHLD on child stop *)
56 SA_ONSTACK* = {0}; (* take signal on signal stack *)
57 SA_RESTART* = {1}; (* restart system on signal return *)
58 SA_RESETHAND* = {2}; (* reset to SIG_DFL when taking signal *)
59 SA_NODEFER* = {4}; (* don't mask the signal we're delivering *)
60 SA_NOCLDWAIT* = {5}; (* don't create zombies (assign to pid 1) *)
61 SA_SIGINFO* = {6}; (* generate siginfo_t *)
64 (* SIGINT, SIGILL, SIGFPE, SIGSEGV, SIGKILL, SIGSTOP, SIGWINCH, SIGTHR (int) *)
65 SIGHUP* = 1; (* hangup *)
66 SIGINT* = 2; (* interrupt *)
67 SIGQUIT* = 3; (* quit *)
68 SIGILL* = 4; (* illegal instruction (not reset when caught) *)
69 SIGTRAP* = 5; (* trace trap (not reset when caught) *)
70 SIGABRT* = 6; (* abort() *)
71 SIGFPE* = 8; (* floating point exception *)
72 SIGKILL* = 9; (* kill (cannot be caught or ignored) *)
73 SIGBUS* = 10; (* bus error *)
74 SIGSEGV* = 11; (* segmentation violation *)
75 SIGSYS* = 12; (* bad argument to system call *)
76 SIGPIPE* = 13; (* write on a pipe with no one to read it *)
77 SIGALRM* = 14; (* alarm clock *)
78 SIGTERM* = 15; (* software termination signal from kill *)
79 SIGURG* = 16; (* urgent condition on IO channel *)
80 SIGSTOP* = 17; (* sendable stop signal not from tty *)
81 SIGTSTP* = 18; (* stop signal from tty *)
82 SIGCONT* = 19; (* continue a stopped process *)
83 SIGCHLD* = 20; (* to parent on child stop or exit *)
84 SIGTTIN* = 21; (* to readers pgrp upon background tty read *)
85 SIGTTOU* = 22; (* like TTIN for output if (tp->t_local&LTOSTOP) *)
86 SIGXCPU* = 24; (* exceeded CPU time limit *)
87 SIGXFSZ* = 25; (* exceeded file size limit *)
88 SIGVTALRM* = 26; (* virtual time alarm *)
89 SIGPROF* = 27; (* profiling time alarm *)
90 SIGUSR1* = 30; (* user defined signal 1 *)
91 SIGUSR2* = 31; (* user defined signal 2 *)
92 SIGWINCH* = 28; (* window size changes *)
93 SIGTHR* = 32; (* thread library AST *)
95 _NSIG* = 33;
97 (*
98 PAGE_SIZE* = 4096;
99 *)
100 _SC_ARG_MAX* = 1;
101 _SC_CHILD_MAX* = 2;
102 _SC_CLK_TCK* = 3;
103 _SC_NGROUPS_MAX* = 4;
104 _SC_OPEN_MAX* = 5;
105 _SC_JOB_CONTROL* = 6;
106 _SC_SAVED_IDS* = 7;
107 _SC_VERSION* = 8;
108 _SC_BC_BASE_MAX* = 9;
109 _SC_BC_DIM_MAX* = 10;
110 _SC_BC_SCALE_MAX* = 11;
111 _SC_BC_STRING_MAX* = 12;
112 _SC_COLL_WEIGHTS_MAX* = 13;
113 _SC_EXPR_NEST_MAX* = 14;
114 _SC_LINE_MAX* = 15;
115 _SC_RE_DUP_MAX* = 16;
116 _SC_2_VERSION* = 17;
117 _SC_2_C_BIND* = 18;
118 _SC_2_C_DEV* = 19;
119 _SC_2_CHAR_TERM* = 20;
120 _SC_2_FORT_DEV* = 21;
121 _SC_2_FORT_RUN* = 22;
122 _SC_2_LOCALEDEF* = 23;
123 _SC_2_SW_DEV* = 24;
124 _SC_2_UPE* = 25;
125 _SC_STREAM_MAX* = 26;
126 _SC_TZNAME_MAX* = 27;
127 _SC_PAGESIZE* = 28;
128 _SC_PAGE_SIZE* = _SC_PAGESIZE; (* 1170 compatibility *)
129 _SC_FSYNC* = 29;
130 _SC_XOPEN_SHM* = 30;
131 _SC_SEM_NSEMS_MAX* = 31;
132 _SC_SEM_VALUE_MAX* = 32;
133 _SC_HOST_NAME_MAX* = 33;
134 _SC_MONOTONIC_CLOCK* = 34;
135 _SC_2_PBS* = 35;
136 _SC_2_PBS_ACCOUNTING* = 36;
137 _SC_2_PBS_CHECKPOINT* = 37;
138 _SC_2_PBS_LOCATE* = 38;
139 _SC_2_PBS_MESSAGE* = 39;
140 _SC_2_PBS_TRACK* = 40;
141 _SC_ADVISORY_INFO* = 41;
142 _SC_AIO_LISTIO_MAX* = 42;
143 _SC_AIO_MAX* = 43;
144 _SC_AIO_PRIO_DELTA_MAX* = 44;
145 _SC_ASYNCHRONOUS_IO* = 45;
146 _SC_ATEXIT_MAX* = 46;
147 _SC_BARRIERS* = 47;
148 _SC_CLOCK_SELECTION* = 48;
149 _SC_CPUTIME* = 49;
150 _SC_DELAYTIMER_MAX* = 50;
151 _SC_IOV_MAX* = 51;
152 _SC_IPV6* = 52;
153 _SC_MAPPED_FILES* = 53;
154 _SC_MEMLOCK* = 54;
155 _SC_MEMLOCK_RANGE* = 55;
156 _SC_MEMORY_PROTECTION* = 56;
157 _SC_MESSAGE_PASSING* = 57;
158 _SC_MQ_OPEN_MAX* = 58;
159 _SC_MQ_PRIO_MAX* = 59;
160 _SC_PRIORITIZED_IO* = 60;
161 _SC_PRIORITY_SCHEDULING* = 61;
162 _SC_RAW_SOCKETS* = 62;
163 _SC_READER_WRITER_LOCKS* = 63;
164 _SC_REALTIME_SIGNALS* = 64;
165 _SC_REGEXP* = 65;
166 _SC_RTSIG_MAX* = 66;
167 _SC_SEMAPHORES* = 67;
168 _SC_SHARED_MEMORY_OBJECTS* = 68;
169 _SC_SHELL* = 69;
170 _SC_SIGQUEUE_MAX* = 70;
171 _SC_SPAWN* = 71;
172 _SC_SPIN_LOCKS* = 72;
173 _SC_SPORADIC_SERVER* = 73;
174 _SC_SS_REPL_MAX* = 74;
175 _SC_SYNCHRONIZED_IO* = 75;
176 _SC_SYMLOOP_MAX* = 76;
177 _SC_THREAD_ATTR_STACKADDR* = 77;
178 _SC_THREAD_ATTR_STACKSIZE* = 78;
179 _SC_THREAD_CPUTIME* = 79;
180 _SC_THREAD_DESTRUCTOR_ITERATIONS* = 80;
181 _SC_THREAD_KEYS_MAX* = 81;
182 _SC_THREAD_PRIO_INHERIT* = 82;
183 _SC_THREAD_PRIO_PROTECT* = 83;
184 _SC_THREAD_PRIORITY_SCHEDULING* = 84;
185 _SC_THREAD_PROCESS_SHARED* = 85;
186 _SC_THREAD_ROBUST_PRIO_INHERIT* = 86;
187 _SC_THREAD_ROBUST_PRIO_PROTECT* = 87;
188 _SC_THREAD_SPORADIC_SERVER* = 88;
189 _SC_THREAD_STACK_MIN* = 89;
190 _SC_THREAD_THREADS_MAX* = 90;
191 _SC_THREADS* = 91;
192 _SC_TIMEOUTS* = 92;
193 _SC_TIMER_MAX* = 93;
194 _SC_TIMERS* = 94;
195 _SC_TRACE* = 95;
196 _SC_TRACE_EVENT_FILTER* = 96;
197 _SC_TRACE_EVENT_NAME_MAX* = 97;
198 _SC_TRACE_INHERIT* = 98;
199 _SC_TRACE_LOG* = 99;
200 _SC_GETGR_R_SIZE_MAX* = 100;
201 _SC_GETPW_R_SIZE_MAX* = 101;
202 _SC_LOGIN_NAME_MAX* = 102;
203 _SC_THREAD_SAFE_FUNCTIONS* = 103;
204 _SC_TRACE_NAME_MAX* = 104;
205 _SC_TRACE_SYS_MAX* = 105;
206 _SC_TRACE_USER_EVENT_MAX* = 106;
207 _SC_TTY_NAME_MAX* = 107;
208 _SC_TYPED_MEMORY_OBJECTS* = 108;
209 _SC_V6_ILP32_OFF32* = 109;
210 _SC_V6_ILP32_OFFBIG* = 110;
211 _SC_V6_LP64_OFF64* = 111;
212 _SC_V6_LPBIG_OFFBIG* = 112;
213 _SC_V7_ILP32_OFF32* = 113;
214 _SC_V7_ILP32_OFFBIG* = 114;
215 _SC_V7_LP64_OFF64* = 115;
216 _SC_V7_LPBIG_OFFBIG* = 116;
217 _SC_XOPEN_CRYPT* = 117;
218 _SC_XOPEN_ENH_I18N* = 118;
219 _SC_XOPEN_LEGACY* = 119;
220 _SC_XOPEN_REALTIME* = 120;
221 _SC_XOPEN_REALTIME_THREADS* = 121;
222 _SC_XOPEN_STREAMS* = 122;
223 _SC_XOPEN_UNIX* = 123;
224 _SC_XOPEN_UUCP* = 124;
225 _SC_XOPEN_VERSION* = 125;
226 _SC_PHYS_PAGES* = 500;
227 _SC_AVPHYS_PAGES* = 501;
228 _SC_NPROCESSORS_CONF* = 502;
229 _SC_NPROCESSORS_ONLN* = 503;
232 SIGSTKSZ* = 8192 + 32768;
234 (* ENOENT, EEXIST, EACCES, ENOMEM, EDQUOT, EMFILE, ENOTDIR (int) *)
235 EPERM* = 1; (* Operation not permitted *)
236 ENOENT* = 2; (* No such file or directory *)
237 ESRCH* = 3; (* No such process *)
238 EINTR* = 4; (* Interrupted system call *)
239 EIO* = 5; (* Input/output error *)
240 ENXIO* = 6; (* Device not configured *)
241 E2BIG* = 7; (* Argument list too long *)
242 ENOEXEC* = 8; (* Exec format error *)
243 EBADF* = 9; (* Bad file descriptor *)
244 ECHILD* = 10; (* No child processes *)
245 EDEADLK* = 11; (* Resource deadlock avoided *)
246 ENOMEM* = 12; (* Cannot allocate memory *)
247 EACCES* = 13; (* Permission denied *)
248 EFAULT* = 14; (* Bad address *)
249 EBUSY* = 16; (* Device busy *)
250 EEXIST* = 17; (* File exists *)
251 EXDEV* = 18; (* Cross-device link *)
252 ENODEV* = 19; (* Operation not supported by device *)
253 ENOTDIR* = 20; (* Not a directory *)
254 EISDIR* = 21; (* Is a directory *)
255 EINVAL* = 22; (* Invalid argument *)
256 ENFILE* = 23; (* Too many open files in system *)
257 EMFILE* = 24; (* Too many open files *)
258 ENOTTY* = 25; (* Inappropriate ioctl for device *)
259 ETXTBSY* = 26; (* Text file busy *)
260 EFBIG* = 27; (* File too large *)
261 ENOSPC* = 28; (* No space left on device *)
262 ESPIPE* = 29; (* Illegal seek *)
263 EROFS* = 30; (* Read-only file system *)
264 EMLINK* = 31; (* Too many links *)
265 EPIPE* = 32; (* Broken pipe *)
266 EDOM* = 33; (* Numerical argument out of domain *)
267 ERANGE* = 34; (* Result too large *)
268 EAGAIN* = 35; (* Resource temporarily unavailable *)
269 EWOULDBLOCK* = EAGAIN; (* Operation would block *)
270 EINPROGRESS* = 36; (* Operation now in progress *)
271 EALREADY* = 37; (* Operation already in progress *)
272 ENOTSOCK* = 38; (* Socket operation on non-socket *)
273 EDESTADDRREQ* = 39; (* Destination address required *)
274 EMSGSIZE* = 40; (* Message too long *)
275 EPROTOTYPE* = 41; (* Protocol wrong type for socket *)
276 ENOPROTOOPT* = 42; (* Protocol not available *)
277 EPROTONOSUPPORT* = 43; (* Protocol not supported *)
278 EOPNOTSUPP* = 45; (* Operation not supported *)
279 EAFNOSUPPORT* = 47; (* Address family not supported by protocol family *)
280 EADDRINUSE* = 48; (* Address already in use *)
281 EADDRNOTAVAIL* = 49; (* Can't assign requested address *)
282 ENETDOWN* = 50; (* Network is down *)
283 ENETUNREACH* = 51; (* Network is unreachable *)
284 ENETRESET* = 52; (* Network dropped connection on reset *)
285 ECONNABORTED* = 53; (* Software caused connection abort *)
286 ECONNRESET* = 54; (* Connection reset by peer *)
287 ENOBUFS* = 55; (* No buffer space available *)
288 EISCONN* = 56; (* Socket is already connected *)
289 ENOTCONN* = 57; (* Socket is not connected *)
290 ETIMEDOUT* = 60; (* Operation timed out *)
291 ECONNREFUSED* = 61; (* Connection refused *)
292 ELOOP* = 62; (* Too many levels of symbolic links *)
293 ENAMETOOLONG* = 63; (* File name too long *)
294 EHOSTUNREACH* = 65; (* No route to host *)
295 ENOTEMPTY* = 66; (* Directory not empty *)
296 EDQUOT* = 69; (* Disk quota exceeded *)
297 ESTALE* = 70; (* Stale NFS file handle *)
298 ENOLCK* = 77; (* No locks available *)
299 ENOSYS* = 78; (* Function not implemented *)
300 EILSEQ* = 84; (* Illegal byte sequence *)
301 EOVERFLOW* = 87; (* Value too large to be stored in data type *)
302 ECANCELED* = 88; (* Operation canceled *)
303 EIDRM* = 89; (* Identifier removed *)
304 ENOMSG* = 90; (* No message of desired type *)
305 ENOTSUP* = 91; (* Not supported *)
306 ENOTBLK* = 15; (* Block device required *)
307 ESOCKTNOSUPPORT* = 44; (* Socket type not supported *)
308 EPFNOSUPPORT* = 46; (* Protocol family not supported *)
309 ESHUTDOWN* = 58; (* Can't send after socket shutdown *)
310 ETOOMANYREFS* = 59; (* Too many references: can't splice *)
311 EHOSTDOWN* = 64; (* Host is down *)
312 EPROCLIM* = 67; (* Too many processes *)
313 EUSERS* = 68; (* Too many users *)
314 EREMOTE* = 71; (* Too many levels of remote in path *)
315 EBADRPC* = 72; (* RPC struct is bad *)
316 ERPCMISMATCH* = 73; (* RPC version wrong *)
317 EPROGUNAVAIL* = 74; (* RPC program not available *)
318 EPROGMISMATCH* = 75; (* Program version wrong *)
319 EPROCUNAVAIL* = 76; (* Bad procedure for program *)
320 EFTYPE* = 79; (* Inappropriate file type or format *)
321 EAUTH* = 80; (* Authentication error *)
322 ENEEDAUTH* = 81; (* Need authenticator *)
323 EIPSEC* = 82; (* IPsec processing failure *)
324 ENOATTR* = 83; (* Attribute not found *)
325 ENOMEDIUM* = 85; (* No medium found *)
326 EMEDIUMTYPE* = 86; (* Wrong medium type *)
327 ELAST* = 91; (* Must be equal largest errno *)
328 ERESTART* = -1; (* restart syscall *)
329 EJUSTRETURN* = -2; (* don't modify regs, just return *)
332 NAME_MAX* = 255;
334 SEEK_SET* = 0;
335 SEEK_CUR* = 1;
336 SEEK_END* = 2;
338 STDIN_FILENO* = 0;
339 STDOUT_FILENO* = 1;
340 STDERR_FILENO* = 2;
342 P_tmpdir* = "/tmp";
344 (* O_RDWR, O_NONBLOCK (intFlags) *)
345 O_SHLOCK* = {4}; (* open with shared file lock *)
346 O_EXLOCK* = {5}; (* open with exclusive file lock *)
347 O_ASYNC* = {6}; (* signal pgrp when data ready *)
348 O_NOFOLLOW* = {8}; (* if path is a symlink, don't follow *)
349 O_SYNC* = {7}; (* synchronous writes *)
350 O_RDONLY* = {}; (* open for reading only *)
351 O_WRONLY* = {0}; (* open for writing only *)
352 O_RDWR* = {1}; (* open for reading and writing *)
353 O_ACCMODE* = {0,1}; (* mask for above modes *)
354 O_NONBLOCK* = {2}; (* no delay *)
355 O_APPEND* = {3}; (* set append mode *)
356 O_CREAT* = {9}; (* create if nonexistent *)
357 O_TRUNC* = {10}; (* truncate to zero length *)
358 O_EXCL* = {11}; (* error if already exists *)
359 O_DSYNC* = O_SYNC; (* synchronous data writes *)
360 O_RSYNC* = O_SYNC; (* synchronous reads *)
361 O_NOCTTY* = {15}; (* don't assign controlling terminal *)
362 O_CLOEXEC* = {16}; (* atomically set FD_CLOEXEC *)
363 O_DIRECTORY* = {17}; (* fail if not a directory *)
366 CLOCK_REALTIME* = 0;
367 CLOCK_PROCESS_CPUTIME_ID* = 2;
368 CLOCK_MONOTONIC* = 3;
369 CLOCK_THREAD_CPUTIME_ID* = 4;
370 CLOCK_UPTIME* = 5;
373 TYPE
374 StrArray* = POINTER TO ARRAY [untagged] OF PtrSTR;
375 PtrSTR* = POINTER TO ARRAY [untagged] OF SHORTCHAR;
377 (* PtrVoid, int, long, size_t, ssize_t, off_t, time_t, clock_t, sigjmp_buf *)
378 (* mode_t, intFlags, sigset_t (set) *)
379 PtrVoid* = INTEGER;
380 int* = INTEGER;
381 long* = INTEGER;
382 ulong* = INTEGER;
383 size_t* = INTEGER;
384 ssize_t* = INTEGER;
385 off_t* = LONGINT;
386 clock_t* = LONGINT;
387 clockid_t* = INTEGER;
388 time_t* = LONGINT;
389 mode_t* = SET;
390 pid_t* = INTEGER;
391 uid_t* = INTEGER;
392 gid_t* = INTEGER;
393 dev_t* = INTEGER;
394 ino_t* = LONGINT;
395 nlink_t* = INTEGER;
396 blkcnt_t = LONGINT;
397 blksize_t = INTEGER;
398 int8_t* = SHORTCHAR;
399 u_int8_t* = SHORTCHAR;
400 int16_t* = SHORTINT;
401 u_int16_t* = SHORTINT;
402 int32_t* = INTEGER;
403 u_int32_t* = INTEGER;
404 int64_t* = LONGINT;
405 u_int64_t* = LONGINT;
406 wchar_t* = INTEGER;
407 sigset_t* = SET;
408 sigjmp_buf* = ARRAY [untagged] 11 OF INTEGER;
409 intFlags* = SET;
410 FILE = ARRAY [untagged] 22 OF INTEGER;
413 tm* = POINTER TO tmDesc;
414 tmDesc* = RECORD [untagged]
415 (* NOTE: check record size *)
416 (* tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec, tm_wday [ , tm_gmtoff ] *)
417 (* OpenBSD 6.0 /usr/include/time.h *)
418 tm_sec*: int; (* seconds after the minute [0-60] *)
419 tm_min*: int; (* minutes after the hour [0-59] *)
420 tm_hour*: int; (* hours since midnight [0-23] *)
421 tm_mday*: int; (* day of the month [1-31] *)
422 tm_mon*: int; (* months since January [0-11] *)
423 tm_year*: int; (* years since 1900 *)
424 tm_wday*: int; (* days since Sunday [0-6] *)
425 tm_yday*: int; (* days since January 1 [0-365] *)
426 tm_isdst*: int; (* Daylight Saving Time flag *)
427 tm_gmtoff*: long; (* offset from UTC in seconds *)
428 tm_zone*: PtrSTR; (* timezone abbreviation *)
429 END;
431 Ptrsiginfo_t* = POINTER TO siginfo_t;
432 siginfo_t = RECORD [untagged]
433 (* si_code, fault address *)
434 (* OpenBSD 5.9 /usr/include/sys/siginfo.h *)
435 si_signo*: int; (* signal from signal.h *)
436 si_code*: int; (* code from above *)
437 si_errno*: int; (* error from errno.h *)
438 _data*: RECORD [union]
439 _pad*: ARRAY [untagged] 29 (* SI_PAD *) OF int; (* for future growth *)
440 _proc*: RECORD [untagged] (* kill(), SIGCLD, siqqueue() *)
441 _pid*: pid_t; (* process ID *)
442 _pdata*: RECORD [union]
443 _kill*: RECORD [untagged]
444 _uid*: uid_t;
445 (*
446 _value*: sigval;
447 *)
448 _value*: int
449 END;
450 _cld*: RECORD [untagged]
451 _utime*: clock_t;
452 _stime*: clock_t;
453 _status*: int;
454 END;
455 END;
456 END;
457 _fault*: RECORD [untagged] (* SIGSEGV, SIGBUS, SIGILL and SIGFPE *)
458 _addr*: PtrVoid; (* faulting address *)
459 _trapno*: int; (* illegal trap number *)
460 END;
461 END;
462 END;
464 Ptrucontext_t* = POINTER TO ucontext_t;
465 ucontext_t = RECORD [untagged]
466 (* IP, SP, FP *)
467 (* OpenBSD 5.9 /usr/include/i386/signal.h struct sigcontext *)
468 sc_gs*: int;
469 sc_fs*: int;
470 sc_es*: int;
471 sc_ds*: int;
472 sc_edi*: int;
473 sc_esi*: int;
474 sc_ebp*: int;
475 sc_ebx*: int;
476 sc_edx*: int;
477 sc_ecx*: int;
478 sc_eax*: int;
479 (* XXX *)
480 sc_eip*: int;
481 sc_cs*: int;
482 sc_eflags*: int;
483 sc_esp*: int;
484 sc_ss*: int;
486 __sc_unused: int;
487 sc_mask*: int; (* signal mask to restore *)
489 sc_trapno*: int; (* XXX should be above *)
490 sc_err*: int;
492 sc_fpstate*: RECORD [union]
493 (* OpenBSD 5.9 /usr/include/i386/npx.h union savefpu *)
494 (*
495 sv_87*: RECORD [untagged]
496 ...
497 END;
498 sv_xmm*: RECORD [untagged]
499 ...
500 END;
501 *)
502 END;
503 END;
505 sigaction_t* = RECORD [untagged]
506 (*
507 sa_sigaction*: PROCEDURE [ccall] (sig: INTEGER; siginfo: Ptrsiginfo_t; context: Ptrucontext_t),
508 sa_flags*: intFlags, sa_mask*: sigset_t
509 *)
510 (* OpenBSD 5.9 /usr/include/sys/signal.h *)
511 sa_sigaction*: PROCEDURE [ccall] (sig: int; siginfo: Ptrsiginfo_t; ctx: Ptrucontext_t);
512 sa_mask*: sigset_t;
513 sa_flags*: intFlags;
514 END;
516 stack_t* = RECORD [untagged]
517 (*
518 ss_sp*: PtrVoid, ss_size*: size_t, ss_flags*: intFlags
519 *)
520 (* OpenBSD 5.9 /usr/include/sys/signal.h *)
521 ss_sp*: PtrVoid; (* signal stack base *)
522 ss_size*: size_t; (* signal stack length *)
523 ss_flags*: intFlags; (* SS_DISABLE and/or SS_ONSTACK *)
524 END;
526 stat_t* = RECORD [untagged]
527 (*
528 NOTE: check record size
529 st_mode*: mode_t, st_size*: off_t, st_mtime*: time_t
530 *)
531 (* OpenBSD 5.9 /usr/include/sys/stat.h *)
532 st_mode*: mode_t;
533 st_dev*: dev_t;
534 st_ino*: ino_t;
535 st_nlink*: nlink_t;
536 st_uid*: uid_t;
537 st_gid*: gid_t;
538 st_rdev*: dev_t;
540 st_atime*: time_t;
541 st_atimensec*: long;
542 st_mtime*: time_t;
543 st_mtimensec*: long;
544 st_ctime*: time_t;
545 st_ctimensec*: long;
547 st_size*: off_t;
548 st_blocks*: blkcnt_t;
549 st_blksize*: blksize_t;
550 st_flags*: u_int32_t;
551 st_gen*: u_int32_t;
553 __st_birthtime*: time_t;
554 __st_birthtimensec*: long;
555 END;
557 PtrFILE* = PtrVoid;
558 PtrDIR* = PtrVoid;
560 PtrDirent* = POINTER TO Dirent;
561 Dirent = RECORD [untagged]
562 (*
563 d_name*: ARRAY [untagged] NAME_MAX + 1 OF SHORTCHAR
564 *)
565 (* OpenBSD 5.9 /usr/include/sys/dirent.h *)
566 d_fileno*: ino_t; (* file number of entry *)
567 d_off*: off_t; (* offset after this entry *)
568 d_reclen*: u_int16_t; (* length of this record *)
569 d_type*: u_int8_t; (* file type, see below *)
570 d_namlen*: u_int8_t; (* length of string in d_name *)
571 __d_padding: ARRAY [untagged] 4 OF u_int8_t; (* suppress padding after d_name *)
572 d_name*: ARRAY [untagged] 255 + 1 OF SHORTCHAR;
573 END;
575 timespec_t* = RECORD [untagged]
576 (* OpenBSD 5.9 /usr/include/time.h *)
577 tv_sec*: time_t; (* seconds *)
578 tv_nsec*: long; (* and nanoseconds *)
579 END;
581 (*
582 VAR
583 stdin*: INTEGER;
584 timezone*: INTEGER; (* or tm.tm_gmtoff *)
585 *)
586 (*
587 PROCEDURE [ccall] __errno_location* (): PtrVoid;
588 *)
589 (*
590 (* POSIX.1 *)
591 PROCEDURE [ccall] stat* (path: PtrSTR; VAR sp: stat_t): int;
592 *)
593 (*
594 VAR
595 (* OpenBSD: stdin, stdout, stderr *)
596 __sF*: ARRAY [untagged] 3 OF FILE; (* OpenBSD 5.8 /usr/include/stdio.h *)
597 (*
598 stdin = SYSTEM.ADR(__sF[0])
599 stdout = SYSTEM.ADR(__sF[1])
600 stderr = SYSTEM.ADR(__sF[2])
601 *)
602 *)
604 PROCEDURE [ccall] __errno_location* ["__errno"] (): PtrVoid;
606 (* POSIX.1 *)
607 PROCEDURE [ccall] stat* (path: PtrSTR; VAR sp: stat_t): int;
610 (* ANSI C 89 *)
611 PROCEDURE [ccall] clock* (): clock_t;
613 (* POSIX.1 *)
614 PROCEDURE [ccall] clock_gettime* (clock_id: clockid_t; VAR tp: timespec_t): int;
616 PROCEDURE [ccall] mmap* (adr: PtrVoid; len: size_t; prot: intFlags; flags: intFlags; fd: int; offset: off_t): PtrVoid;
617 (* BSD *)
618 PROCEDURE [ccall] munmap* (adr: PtrVoid; len: size_t): int;
619 PROCEDURE [ccall] mprotect* (adr: PtrVoid; len: size_t; prot: intFlags): int;
621 (*
622 PROCEDURE [ccall] calloc* (nmemb: size_t; size: size_t): PtrVoid;
623 (* ANSI C 89 *)
624 PROCEDURE [ccall] malloc* (size: size_t): PtrVoid;
625 *)
626 PROCEDURE [ccall] free* (ptr: PtrVoid);
628 (* AT&T *)
629 PROCEDURE [ccall] time* (VAR [nil] t: time_t): time_t;
630 PROCEDURE [ccall] gmtime* (VAR [nil] t: time_t): tm;
631 PROCEDURE [ccall] localtime* (VAR [nil] t: time_t): tm;
633 (* POSIX.1 *)
634 PROCEDURE [ccall] sigsetjmp* (VAR env: sigjmp_buf; savemask: int): int;
635 PROCEDURE [ccall] siglongjmp* (VAR env: sigjmp_buf; val: int);
637 (* POSIX.1 *)
638 PROCEDURE [ccall] sigemptyset* (VAR set: sigset_t): int;
639 PROCEDURE [ccall] sigfillset* (VAR set: sigset_t): int;
640 PROCEDURE [ccall] sigaddset* (VAR set: sigset_t; signo: int): int;
641 PROCEDURE [ccall] sigprocmask* (how: int; VAR [nil] set: sigset_t; VAR [nil] oset: sigset_t): int;
643 (* POSIX.1 *)
644 PROCEDURE [ccall] sigaction* (sig: int; VAR [nil] act: sigaction_t; VAR [nil] oact: sigaction_t): int;
646 (* BSD *)
647 PROCEDURE [ccall] sigaltstack* (VAR [nil] ss: stack_t; VAR [nil] oss: stack_t): int;
649 (* ANSI C 89 *)
650 PROCEDURE [ccall] getenv* (s: PtrSTR): PtrSTR;
652 (* ANSI C 89 *)
653 PROCEDURE [ccall] fopen* (path, mode: PtrSTR): PtrFILE;
654 PROCEDURE [ccall] fdopen* (fildes: int; mode: PtrSTR): PtrFILE;
655 PROCEDURE [ccall] fclose* (stream: PtrFILE): int;
656 PROCEDURE [ccall] fread* (ptr: PtrVoid; size: size_t; nmemb: size_t; stream: PtrFILE): size_t;
657 PROCEDURE [ccall] fwrite* (ptr: PtrVoid; size: size_t; nmemb: size_t; stream: PtrFILE): size_t;
658 PROCEDURE [ccall] fflush* (s: PtrFILE): int;
659 PROCEDURE [ccall] printf* (s: PtrSTR): int;
660 (* ANSI C 89, XPG4 *)
661 PROCEDURE [ccall] fseek* (stream: PtrFILE; offset: long; whence: int): int;
663 (* POSIX.1 *)
664 PROCEDURE [ccall] rename* (from, to: PtrSTR): int;
665 PROCEDURE [ccall] mkdir* (path: PtrSTR; mode: mode_t): int;
666 PROCEDURE [ccall] opendir* (filename: PtrSTR): PtrDIR;
667 PROCEDURE [ccall] readdir* (dirp: PtrDIR): PtrDirent;
668 PROCEDURE [ccall] closedir* (dirp: PtrDIR): int;
669 (* ANSI C 89, XPG4.2 *)
670 PROCEDURE [ccall] remove* (path: PtrSTR): int;
672 (* POSIX.1 *)
673 PROCEDURE [ccall] getcwd* (buf: PtrSTR; size: size_t): PtrSTR;
675 (* ANSI C 99 *)
676 PROCEDURE [ccall] exit* (status: int);
678 (* ANSI C 89 *)
679 PROCEDURE [ccall] strftime* (buf: PtrSTR; maxsize: size_t; format: PtrSTR; timeptr: tm): size_t;
681 (* XXX: use fread instead *)
682 PROCEDURE [ccall] fgets* (str: PtrSTR; size: int; stream: PtrFILE): PtrSTR;
684 (* POSIX.1 *)
685 PROCEDURE [ccall] open* (path: PtrSTR; flags: intFlags; mode: mode_t): int;
686 PROCEDURE [ccall] write* (d: int; buf: PtrVoid; nbytes: size_t): ssize_t;
687 PROCEDURE [ccall] read* (d: int; buf: PtrVoid; nbytes: size_t): ssize_t;
688 PROCEDURE [ccall] close* (d: int): int;
689 PROCEDURE [ccall] lseek* (d: int; offset: off_t; whence: int): off_t;
691 (* POSIX.1 *)
692 PROCEDURE [ccall] chmod* (path: PtrSTR; mode: mode_t): int;
693 PROCEDURE [ccall] fchmod* (fd: int; mode: mode_t): int;
695 (* POSIX.1 *)
696 PROCEDURE [ccall] sysconf* (name: int): long;
698 (* POSIX.2 *)
699 PROCEDURE [ccall] system* (string: PtrSTR): int;
701 PROCEDURE [ccall] popen* (command, type: PtrSTR): PtrFILE;
702 PROCEDURE [ccall] pclose* (stream: PtrFILE): int;
704 END LinLibc.