DEADSOFTWARE

HostPackedFiles implemented; DevPacked added; loader simplified
[bbcp.git] / new / _OpenBSD_ / Lin / Mod / Libc.txt
1 MODULE LinLibc ["libc.so.66.0"];
3 (*
4 A. V. Shiryaev, 2012.11
6 Based on Linux' LinLibc (OpenBUGS Lin/Mod/Libc.odc)
8 OpenBSD 5.2
9 32-bit
10 *)
12 IMPORT SYSTEM;
14 CONST
15 NULL* = 0H;
16 TRUE* = 1;
17 FALSE* = 0;
19 (* file constants *)
20 SEEK_SET* = 0;
21 SEEK_CUR* = 1;
22 SEEK_END* = 2;
23 NAME_MAX* = 255; (* OpenBSD /usr/include/sys/syslimits.h *)
25 (* The value of CLOCKS_PER_SEC is required to be 1 million on all XSI-conformant systems.*)
26 CLOCKS_PER_SEC* = 100; (* OpenBSD 5.2 /usr/include/time.h CLOCKS_PER_SEC *)
28 (* temp directory defined in stdio.h *)
29 P_tmpdir* = "/tmp";
31 (* signal constants *) (* Fake signal functions. *)
32 (* OpenBSD 5.2 /usr/include/sys/signal.h *)
33 SIG_ERR* = -1; (* Error return. *)
34 SIG_DFL* = 0; (* Default action. *)
35 SIG_IGN* = 1; (* Ignore signal. *)
36 SIG_HOLD* = 3; (* Add signal to hold mask. *) (* OpenBSD 5.2 /usr/include/sys/signalvar.h *)
38 (* Signals. *)
39 (* OpenBSD /usr/include/sys/signal.h *)
40 _NSIG* = 33; (* counting 0 (mask is 1-32) *)
41 SIGHUP* = 1; (* hangup *)
42 SIGINT* = 2; (* interrupt *)
43 SIGQUIT* = 3; (* quit *)
44 SIGILL* = 4; (* illegal instruction (not reset when caught) *)
45 SIGTRAP* = 5; (* trace trap (not reset when caught) *)
46 SIGABRT* = 6; (* abort() *)
47 SIGFPE* = 8; (* floating point exception *)
48 SIGKILL* = 9; (* kill (cannot be caught or ignored) *)
49 SIGBUS* = 10; (* bus error *)
50 SIGSEGV* = 11; (* segmentation violation *)
51 SIGSYS* = 12; (* bad argument to system call *)
52 SIGPIPE* = 13; (* write on a pipe with no one to read it *)
53 SIGALRM* = 14; (* alarm clock *)
54 SIGTERM* = 15; (* software termination signal from kill *)
55 SIGURG* = 16; (* urgent condition on IO channel *)
56 SIGSTOP* = 17; (* sendable stop signal not from tty *)
57 SIGTSTP* = 18; (* stop signal from tty *)
58 SIGCONT* = 19; (* continue a stopped process *)
59 SIGCHLD* = 20; (* to parent on child stop or exit *)
60 SIGTTIN* = 21; (* to readers pgrp upon background tty read *)
61 SIGTTOU* = 22; (* like TTIN for output if (tp->t_local&LTOSTOP) *)
62 SIGXCPU* = 24; (* exceeded CPU time limit *)
63 SIGXFSZ* = 25; (* exceeded file size limit *)
64 SIGVTALRM* = 26; (* virtual time alarm *)
65 SIGPROF* = 27; (* profiling time alarm *)
66 SIGUSR1* = 30; (* user defined signal 1 *)
67 SIGUSR2* = 31; (* user defined signal 2 *)
68 SIGWINCH* = 28; (* window size changes *)
69 SIGTHR* = 32; (* thread library AST *)
71 (* Bits in `sa_flags'. *)
72 SA_NOCLDSTOP* = {3}; (* do not generate SIGCHLD on child stop *)
73 SA_ONSTACK* = {0}; (* take signal on signal stack *)
74 SA_RESTART* = {1}; (* restart system on signal return *)
75 SA_RESETHAND* = {2}; (* reset to SIG_DFL when taking signal *)
76 SA_NODEFER* = {4}; (* don't mask the signal we're delivering *)
77 SA_NOCLDWAIT* = {5}; (* don't create zombies (assign to pid 1) *)
78 SA_SIGINFO* = {6}; (* generate siginfo_t *)
80 (* Some aliases for the SA_ constants. *)
81 (*
82 SA_NOMASK* = SA_NODEFER;
83 SA_ONESHOT* = SA_RESETHAND;
84 SA_STACK* = SA_ONSTACK;
85 *)
87 (* code values for siginfo_t.si_code *)
88 (* OpenBSD /usr/include/sys/siginfo.h *)
89 FPE_INTDIV* = 1; (* integer divide by zero *)
90 FPE_INTOVF* = 2; (* integer overflow *)
91 FPE_FLTDIV* = 3; (* floating point divide by zero *)
92 FPE_FLTOVF* = 4; (* floating point overflow *)
93 FPE_FLTUND* = 5; (* floating point underflow *)
94 FPE_FLTRES* = 6; (* floating point inexact result *)
95 FPE_FLTINV* = 7; (* invalid floating point operation *)
96 FPE_FLTSUB* = 8; (* subscript out of range *)
97 ILL_ILLOPC* = 1; (* illegal opcode *)
98 ILL_ILLOPN* = 2; (* illegal operand *)
99 ILL_ILLADR* = 3; (* illegal addressing mode *)
100 ILL_ILLTRP* = 4; (* illegal trap *)
101 ILL_PRVOPC* = 5; (* privileged opcode *)
102 ILL_PRVREG* = 6; (* privileged register *)
103 ILL_COPROC* = 7; (* co-processor *)
104 ILL_BADSTK* = 8; (* bad stack *)
105 SEGV_MAPERR* = 1; (* address not mapped to object *)
106 SEGV_ACCERR* = 2; (* invalid permissions *)
107 BUS_ADRALN* = 1; (* invalid address alignment *)
108 BUS_ADRERR* = 2; (* non-existent physical address *)
109 BUS_OBJERR* = 3; (* object specific hardware error *)
112 (* possible error constants for errno *)
113 (* /usr/include/sys/errno.h *)
114 EPERM* = 1; (* Operation not permitted *)
115 ENOENT* = 2; (* No such file or directory *)
116 ESRCH* = 3; (* No such process *)
117 EINTR* = 4; (* Interrupted system call *)
118 EIO* = 5; (* Input/output error *)
119 ENXIO* = 6; (* Device not configured *)
120 E2BIG* = 7; (* Argument list too long *)
121 ENOEXEC* = 8; (* Exec format error *)
122 EBADF* = 9; (* Bad file descriptor *)
123 ECHILD* = 10; (* No child processes *)
124 EDEADLK* = 11; (* Resource deadlock avoided *)
125 ENOMEM* = 12; (* Cannot allocate memory *)
126 EACCES* = 13; (* Permission denied *)
127 EFAULT* = 14; (* Bad address *)
128 EBUSY* = 16; (* Device busy *)
129 EEXIST* = 17; (* File exists *)
130 EXDEV* = 18; (* Cross-device link *)
131 ENODEV* = 19; (* Operation not supported by device *)
132 ENOTDIR* = 20; (* Not a directory *)
133 EISDIR* = 21; (* Is a directory *)
134 EINVAL* = 22; (* Invalid argument *)
135 ENFILE* = 23; (* Too many open files in system *)
136 EMFILE* = 24; (* Too many open files *)
137 ENOTTY* = 25; (* Inappropriate ioctl for device *)
138 ETXTBSY* = 26; (* Text file busy *)
139 EFBIG* = 27; (* File too large *)
140 ENOSPC* = 28; (* No space left on device *)
141 ESPIPE* = 29; (* Illegal seek *)
142 EROFS* = 30; (* Read-only file system *)
143 EMLINK* = 31; (* Too many links *)
144 EPIPE* = 32; (* Broken pipe *)
145 EDOM* = 33; (* Numerical argument out of domain *)
146 ERANGE* = 34; (* Result too large *)
147 EAGAIN* = 35; (* Resource temporarily unavailable *)
148 EWOULDBLOCK* = EAGAIN; (* Operation would block *)
149 EINPROGRESS* = 36; (* Operation now in progress *)
150 EALREADY* = 37; (* Operation already in progress *)
151 ENOTSOCK* = 38; (* Socket operation on non-socket *)
152 EDESTADDRREQ* = 39; (* Destination address required *)
153 EMSGSIZE* = 40; (* Message too long *)
154 EPROTOTYPE* = 41; (* Protocol wrong type for socket *)
155 ENOPROTOOPT* = 42; (* Protocol not available *)
156 EPROTONOSUPPORT* = 43; (* Protocol not supported *)
157 EOPNOTSUPP* = 45; (* Operation not supported *)
158 EAFNOSUPPORT* = 47; (* Address family not supported by protocol family *)
159 EADDRINUSE* = 48; (* Address already in use *)
160 EADDRNOTAVAIL* = 49; (* Can't assign requested address *)
161 ENETDOWN* = 50; (* Network is down *)
162 ENETUNREACH* = 51; (* Network is unreachable *)
163 ENETRESET* = 52; (* Network dropped connection on reset *)
164 ECONNABORTED* = 53; (* Software caused connection abort *)
165 ECONNRESET* = 54; (* Connection reset by peer *)
166 ENOBUFS* = 55; (* No buffer space available *)
167 EISCONN* = 56; (* Socket is already connected *)
168 ENOTCONN* = 57; (* Socket is not connected *)
169 ETIMEDOUT* = 60; (* Operation timed out *)
170 ECONNREFUSED* = 61; (* Connection refused *)
171 ELOOP* = 62; (* Too many levels of symbolic links *)
172 ENAMETOOLONG* = 63; (* File name too long *)
173 ENOTEMPTY* = 66; (* Directory not empty *)
174 EDQUOT* = 69; (* Disk quota exceeded *)
175 ESTALE* = 70; (* Stale NFS file handle *)
176 ENOLCK* = 77; (* No locks available *)
177 ENOSYS* = 78; (* Function not implemented *)
178 EILSEQ* = 84; (* Illegal byte sequence *)
179 EIDRM* = 89; (* Identifier removed *)
180 ENOMSG* = 90; (* No message of desired type *)
181 ENOTSUP* = 91; (* Not supported *)
182 ENOTBLK* = 15; (* Block device required *)
183 ESOCKTNOSUPPORT* = 44; (* Socket type not supported *)
184 EPFNOSUPPORT* = 46; (* Protocol family not supported *)
185 ESHUTDOWN* = 58; (* Can't send after socket shutdown *)
186 ETOOMANYREFS* = 59; (* Too many references: can't splice *)
187 EHOSTDOWN* = 64; (* Host is down *)
188 EHOSTUNREACH* = 65; (* No route to host *)
189 EPROCLIM* = 67; (* Too many processes *)
190 EUSERS* = 68; (* Too many users *)
191 EREMOTE* = 71; (* Too many levels of remote in path *)
192 EBADRPC* = 72; (* RPC struct is bad *)
193 ERPCMISMATCH* = 73; (* RPC version wrong *)
194 EPROGUNAVAIL* = 74; (* RPC prog. not avail *)
195 EPROGMISMATCH* = 75; (* Program version wrong *)
196 EPROCUNAVAIL* = 76; (* Bad procedure for program *)
197 EFTYPE* = 79; (* Inappropriate file type or format *)
198 EAUTH* = 80; (* Authentication error *)
199 ENEEDAUTH* = 81; (* Need authenticator *)
200 EIPSEC* = 82; (* IPsec processing failure *)
201 ENOATTR* = 83; (* Attribute not found *)
202 ENOMEDIUM* = 85; (* No medium found *)
203 EMEDIUMTYPE* = 86; (* Wrong Medium Type *)
204 EOVERFLOW* = 87; (* Conversion overflow *)
205 ECANCELED* = 88; (* Operation canceled *)
206 ELAST* = 91; (* Must be equal largest errno *)
207 ERESTART* = -1; (* restart syscall *)
208 EJUSTRETURN* = -2; (* don't modify regs, just return *)
211 (* OpenBSD 5.2 /usr/include/i386/setjmp.h *)
212 _JBLEN = 10;
214 (* OpenBSD 5.2 /usr/include/sys/mman.h *)
215 MAP_FAILED* = -1;
216 PROT_NONE* = {}; (* no permissions *)
217 PROT_READ* = {0}; (* pages can be read *)
218 PROT_WRITE* = {1}; (* pages can be written *)
219 PROT_EXEC* = {2}; (* pages can be executed *)
220 MAP_SHARED* = {0}; (* share changes *)
221 MAP_PRIVATE* = {1}; (* changes are private *)
222 MAP_COPY* = {2}; (* "copy" region at mmap time *)
223 MAP_FIXED* = {4}; (* map addr must be exactly as requested *)
224 MAP_RENAME* = {5}; (* Sun: rename private pages to file *)
225 MAP_NORESERVE* = {6}; (* Sun: don't reserve needed swap area *)
226 MAP_INHERIT* = {7}; (* region is retained after exec *)
227 MAP_NOEXTEND* = {8}; (* for MAP_FILE, don't change file size *)
228 MAP_HASSEMAPHORE* = {9}; (* region may contain semaphores *)
229 MAP_TRYFIXED* = {10}; (* attempt hint address, even within heap *)
230 MAP_FILE* = {}; (* map from file (default) *)
231 MAP_ANON* = {12}; (* allocated from memory, swap space *)
232 MAP_FLAGMASK* = {0..2,4..12};
233 MAP_INHERIT_SHARE* = {}; (* share with child *)
234 MAP_INHERIT_COPY* = {0}; (* copy into child *)
235 MAP_INHERIT_NONE* = {1}; (* absent from child *)
238 (* OpenBSD 5.2 /usr/include/i386/param.h *)
239 PAGE_SHIFT* = 12;
240 PAGE_SIZE* = 4096; (* LSL(1, PAGE_SHIFT) *)
241 PAGE_MASK* = PAGE_SIZE - 1;
243 (* OpenBSD 5.2: /usr/include/fcntl.h *)
244 O_SHLOCK* = {4}; (* open with shared file lock *)
245 O_EXLOCK* = {5}; (* open with exclusive file lock *)
246 O_ASYNC* = {6}; (* signal pgrp when data ready *)
247 O_NOFOLLOW* = {8}; (* if path is a symlink, don't follow *)
248 O_SYNC* = {7}; (* synchronous writes *)
249 O_RDONLY* = {}; (* open for reading only *)
250 O_WRONLY* = {0}; (* open for writing only *)
251 O_RDWR* = {1}; (* open for reading and writing *)
252 O_ACCMODE* = {0,1}; (* mask for above modes *)
253 O_NONBLOCK* = {2}; (* no delay *)
254 O_APPEND* = {3}; (* set append mode *)
255 O_CREAT* = {9}; (* create if nonexistent *)
256 O_TRUNC* = {10}; (* truncate to zero length *)
257 O_EXCL* = {11}; (* error if already exists *)
258 O_DSYNC* = O_SYNC; (* synchronous data writes *)
259 O_RSYNC* = O_SYNC; (* synchronous reads *)
260 O_NOCTTY* = {15}; (* don't assign controlling terminal *)
261 O_CLOEXEC* = {16}; (* atomically set FD_CLOEXEC *)
262 O_DIRECTORY* = {17}; (* fail if not a directory *)
265 (* OpenBSD 5.2 /usr/include/unistd.h *)
266 _SC_ARG_MAX* = 1;
267 _SC_CHILD_MAX* = 2;
268 _SC_CLK_TCK* = 3;
269 _SC_NGROUPS_MAX* = 4;
270 _SC_OPEN_MAX* = 5;
271 _SC_JOB_CONTROL* = 6;
272 _SC_SAVED_IDS* = 7;
273 _SC_VERSION* = 8;
274 _SC_BC_BASE_MAX* = 9;
275 _SC_BC_DIM_MAX* = 10;
276 _SC_BC_SCALE_MAX* = 11;
277 _SC_BC_STRING_MAX* = 12;
278 _SC_COLL_WEIGHTS_MAX* = 13;
279 _SC_EXPR_NEST_MAX* = 14;
280 _SC_LINE_MAX* = 15;
281 _SC_RE_DUP_MAX* = 16;
282 _SC_2_VERSION* = 17;
283 _SC_2_C_BIND* = 18;
284 _SC_2_C_DEV* = 19;
285 _SC_2_CHAR_TERM* = 20;
286 _SC_2_FORT_DEV* = 21;
287 _SC_2_FORT_RUN* = 22;
288 _SC_2_LOCALEDEF* = 23;
289 _SC_2_SW_DEV* = 24;
290 _SC_2_UPE* = 25;
291 _SC_STREAM_MAX* = 26;
292 _SC_TZNAME_MAX* = 27;
293 _SC_PAGESIZE* = 28;
294 _SC_PAGE_SIZE* = _SC_PAGESIZE; (* 1170 compatibility *)
295 _SC_FSYNC* = 29;
296 _SC_XOPEN_SHM* = 30;
297 _SC_SEM_NSEMS_MAX* = 31;
298 _SC_SEM_VALUE_MAX* = 32;
299 _SC_HOST_NAME_MAX* = 33;
300 _SC_MONOTONIC_CLOCK* = 34;
301 _SC_2_PBS* = 35;
302 _SC_2_PBS_ACCOUNTING* = 36;
303 _SC_2_PBS_CHECKPOINT* = 37;
304 _SC_2_PBS_LOCATE* = 38;
305 _SC_2_PBS_MESSAGE* = 39;
306 _SC_2_PBS_TRACK* = 40;
307 _SC_ADVISORY_INFO* = 41;
308 _SC_AIO_LISTIO_MAX* = 42;
309 _SC_AIO_MAX* = 43;
310 _SC_AIO_PRIO_DELTA_MAX* = 44;
311 _SC_ASYNCHRONOUS_IO* = 45;
312 _SC_ATEXIT_MAX* = 46;
313 _SC_BARRIERS* = 47;
314 _SC_CLOCK_SELECTION* = 48;
315 _SC_CPUTIME* = 49;
316 _SC_DELAYTIMER_MAX* = 50;
317 _SC_IOV_MAX* = 51;
318 _SC_IPV6* = 52;
319 _SC_MAPPED_FILES* = 53;
320 _SC_MEMLOCK* = 54;
321 _SC_MEMLOCK_RANGE* = 55;
322 _SC_MEMORY_PROTECTION* = 56;
323 _SC_MESSAGE_PASSING* = 57;
324 _SC_MQ_OPEN_MAX* = 58;
325 _SC_MQ_PRIO_MAX* = 59;
326 _SC_PRIORITIZED_IO* = 60;
327 _SC_PRIORITY_SCHEDULING* = 61;
328 _SC_RAW_SOCKETS* = 62;
329 _SC_READER_WRITER_LOCKS* = 63;
330 _SC_REALTIME_SIGNALS* = 64;
331 _SC_REGEXP* = 65;
332 _SC_RTSIG_MAX* = 66;
333 _SC_SEMAPHORES* = 67;
334 _SC_SHARED_MEMORY_OBJECTS* = 68;
335 _SC_SHELL* = 69;
336 _SC_SIGQUEUE_MAX* = 70;
337 _SC_SPAWN* = 71;
338 _SC_SPIN_LOCKS* = 72;
339 _SC_SPORADIC_SERVER* = 73;
340 _SC_SS_REPL_MAX* = 74;
341 _SC_SYNCHRONIZED_IO* = 75;
342 _SC_SYMLOOP_MAX* = 76;
343 _SC_THREAD_ATTR_STACKADDR* = 77;
344 _SC_THREAD_ATTR_STACKSIZE* = 78;
345 _SC_THREAD_CPUTIME* = 79;
346 _SC_THREAD_DESTRUCTOR_ITERATIONS* = 80;
347 _SC_THREAD_KEYS_MAX* = 81;
348 _SC_THREAD_PRIO_INHERIT* = 82;
349 _SC_THREAD_PRIO_PROTECT* = 83;
350 _SC_THREAD_PRIORITY_SCHEDULING* = 84;
351 _SC_THREAD_PROCESS_SHARED* = 85;
352 _SC_THREAD_ROBUST_PRIO_INHERIT* = 86;
353 _SC_THREAD_ROBUST_PRIO_PROTECT* = 87;
354 _SC_THREAD_SPORADIC_SERVER* = 88;
355 _SC_THREAD_STACK_MIN* = 89;
356 _SC_THREAD_THREADS_MAX* = 90;
357 _SC_THREADS* = 91;
358 _SC_TIMEOUTS* = 92;
359 _SC_TIMER_MAX* = 93;
360 _SC_TIMERS* = 94;
361 _SC_TRACE* = 95;
362 _SC_TRACE_EVENT_FILTER* = 96;
363 _SC_TRACE_EVENT_NAME_MAX* = 97;
364 _SC_TRACE_INHERIT* = 98;
365 _SC_TRACE_LOG* = 99;
366 _SC_GETGR_R_SIZE_MAX* = 100;
367 _SC_GETPW_R_SIZE_MAX* = 101;
368 _SC_LOGIN_NAME_MAX* = 102;
369 _SC_THREAD_SAFE_FUNCTIONS* = 103;
370 _SC_TRACE_NAME_MAX* = 104;
371 _SC_TRACE_SYS_MAX* = 105;
372 _SC_TRACE_USER_EVENT_MAX* = 106;
373 _SC_TTY_NAME_MAX* = 107;
374 _SC_TYPED_MEMORY_OBJECTS* = 108;
375 _SC_V6_ILP32_OFF32* = 109;
376 _SC_V6_ILP32_OFFBIG* = 110;
377 _SC_V6_LP64_OFF64* = 111;
378 _SC_V6_LPBIG_OFFBIG* = 112;
379 _SC_V7_ILP32_OFF32* = 113;
380 _SC_V7_ILP32_OFFBIG* = 114;
381 _SC_V7_LP64_OFF64* = 115;
382 _SC_V7_LPBIG_OFFBIG* = 116;
383 _SC_XOPEN_CRYPT* = 117;
384 _SC_XOPEN_ENH_I18N* = 118;
385 _SC_XOPEN_LEGACY* = 119;
386 _SC_XOPEN_REALTIME* = 120;
387 _SC_XOPEN_REALTIME_THREADS* = 121;
388 _SC_XOPEN_STREAMS* = 122;
389 _SC_XOPEN_UNIX* = 123;
390 _SC_XOPEN_UUCP* = 124;
391 _SC_XOPEN_VERSION* = 125;
392 _SC_PHYS_PAGES* = 500;
393 _SC_AVPHYS_PAGES* = 501;
394 _SC_NPROCESSORS_CONF* = 502;
395 _SC_NPROCESSORS_ONLN* = 503;
398 (* OpenBSD 5.2 /usr/include/sys/mman.h *)
399 POSIX_MADV_NORMAL* = 0; (* no further special treatment *)
400 POSIX_MADV_RANDOM* = 1; (* expect random page references *)
401 POSIX_MADV_SEQUENTIAL* = 2; (* expect sequential page references *)
402 POSIX_MADV_WILLNEED* = 3; (* will need these pages *)
403 POSIX_MADV_DONTNEED* = 4; (* don't need these pages *)
404 MADV_SPACEAVAIL* = 5; (* insure that resources are reserved *)
405 MADV_FREE* = 6; (* pages are empty, free them *)
407 MADV_NORMAL* = POSIX_MADV_NORMAL;
408 MADV_RANDOM* = POSIX_MADV_RANDOM;
409 MADV_SEQUENTIAL* = POSIX_MADV_SEQUENTIAL;
410 MADV_WILLNEED* = POSIX_MADV_WILLNEED;
411 MADV_DONTNEED* = POSIX_MADV_DONTNEED;
413 (* OpenBSD 5.2 /usr/include/sys/signal.h *)
414 MINSIGSTKSZ* = 8192; (* minimum allowable stack *)
415 SIGSTKSZ* = MINSIGSTKSZ + 32768; (* recommended stack size *)
417 (* OpenBSD 5.2 /usr/include/sys/signal.h *)
418 SIG_BLOCK* = 1; (* block specified signal set *)
419 SIG_UNBLOCK* = 2; (* unblock specified signal set *)
420 SIG_SETMASK* = 3; (* set specified signal set *)
423 TYPE
424 (* OpenBSD OK *)
425 __ftw_func_t* = PROCEDURE (fileName: PtrSTR; VAR [nil] stat: stat_t; flag: INTEGER): INTEGER; (* OpenBSD 5.2: OK *)
426 PtrVoid* = INTEGER;
427 PtrSTR* = POINTER TO ARRAY [untagged] OF SHORTCHAR;
428 (* PtrWSTR* = POINTER TO ARRAY [untagged] OF CHAR; *)
429 PtrInt* = INTEGER;
430 StrArray* = POINTER TO ARRAY [untagged] OF PtrSTR;
431 PtrFILE* = INTEGER;
432 PtrDIR* = INTEGER;
433 PtrProc* = INTEGER;
434 clock_t* = INTEGER; (* OpenBSD 5.2 /usr/include/i386/_types.h: 32-bit *)
436 (* jmp_buf* = ARRAY [untagged] 6 OF INTEGER; (* bx, si, di, bp, sp, pc *) *)
437 jmp_buf* = ARRAY [untagged] _JBLEN OF INTEGER; (* OpenBSD 5.2 *)
439 mode_t* = SET; (* OpenBSD 5.2: 32-bit *)
440 off_t* = LONGINT; (* OpenBSD 5.2: 64-bit *)
442 SelectorFunc* = PROCEDURE (dirent: Dirent): INTEGER; (* OpenBSD 5.2: OK *)
443 CmpFunc* = PROCEDURE (VAR [nil] dirent1, dirent2: PtrDirent): INTEGER; (* OpenBSD 5.2: OK *)
445 size_t* = INTEGER; (* should be unsigned int *) (* OpenBSD 5.2: /usr/include/i386/_types.h: 32-bit *)
446 ssize_t* = INTEGER; (* signed int *) (* OpenBSD 5.2: /usr/include/i386/_types.h: 32-bit *)
448 sigjmp_buf* = RECORD [untagged] (* OpenBSD 5.2 *)
449 buf*: jmp_buf;
451 (* mask_was_saved*: INTEGER;
452 saved_mask*: sigset_t; *) (* OpenBSD *)
454 xxx: INTEGER;
455 END;
457 PtrDirent* = POINTER TO Dirent;
458 PtrDirentArray* = POINTER TO ARRAY [untagged] OF Dirent;
460 Dirent* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/sys/dirent.h *)
461 (*
462 d_ino*: INTEGER; (* inode number *)
463 d_off*: off_t; (* offset to this dirent *)
464 d_reclen*: SHORTINT; (* length of this d_name *)
465 d_type*: BYTE;
466 d_name*: ARRAY[untagged] NAME_MAX+1 OF SHORTCHAR; (* file name (null-terminated) *)
467 *)
469 d_fileno*: INTEGER;
470 d_reclen*: SHORTINT;
471 d_type*: BYTE;
472 d_namlen*: BYTE;
473 d_name*: ARRAY [untagged] NAME_MAX + 1 (* 256 *) OF SHORTCHAR;
474 END;
476 pid_t* = INTEGER; (* OpenBSD 5.2: 32-bit *)
477 uid_t* = INTEGER; (* OpenBSD 5.2: 32-bit *)
479 sigval_t* = INTEGER; (* OpenBSD: 32-bit (union sigval) *)
481 siginfo_t* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/sys/siginfo.h *)
482 si_signo*: INTEGER; (* Signal number *) (* OpenBSD: 32-bit *)
483 si_code*: INTEGER; (* Signal code *) (* OpenBSD: 32-bit *)
484 si_errno*: INTEGER; (* An errno value *) (* OpenBSD: 32-bit *)
486 (* OpenBSD 5.2: 29 * 4 B below *)
488 si_pid*: pid_t; (* Sending process ID *)
489 si_uid*: uid_t; (* Real user ID of sending process *)
490 si_status*: INTEGER; (* Exit value or signal *) (* OpenBSD 5.2: 32-bit *)
492 (* si_utime*: clock_t; (* User time consumed *) *) (* OpenBSD: XXX *)
493 si_stime*: clock_t; (* System time consumed *)
494 (* si_value*: sigval_t; (* Signal value *) *) (* OpenBSD: XXX *)
495 (* si_int*: INTEGER; (* POSIX.1b signal *) *) (* OpenBSD: XXX *)
496 (* si_ptr*: PtrVoid; (* POSIX.1b signal *) *) (* OpenBSD: XXX *)
497 (* si_addr*: PtrVoid; (* Memory location which caused fault *) *) (* OpenBSD: XXX *)
498 (* si_band*: INTEGER; (* Band event *) *) (* OpenBSD: XXX *)
499 (* si_fd*: INTEGER; (* File descriptor *) *) (* OpenBSD: XXX *)
501 xxx: ARRAY [untagged] 25 OF INTEGER; (* OpenBSD *)
502 END;
503 Ptrsiginfo_t* = POINTER TO siginfo_t;
505 (* sigset_t* = ARRAY [untagged] 128 OF BYTE; *)
506 (* OpenBSD 5.2 /usr/include/sys/signal.h *)
507 (* sigset_t* = ARRAY [untagged] 4 OF BYTE; *)
508 sigset_t* = SET;
510 Ptrsigset_t* = INTEGER;
511 sigaction_t* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/sys/signal.h *)
512 sa_sigaction*: PROCEDURE [ccall] (sig: INTEGER; siginfo: Ptrsiginfo_t; ptr: Ptrucontext_t); (* union with sa_handler*: PtrProc;*)
513 sa_mask*: sigset_t;
514 sa_flags*: SET;
515 (* sa_restorer*: LONGINT; *) (* OpenBSD *)
516 END;
518 stack_t* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/sys/signal.h *)
519 ss_sp*: PtrVoid;
520 ss_size*: size_t; (* OpenBSD *)
521 ss_flags*: INTEGER; (* OpenBSD *)
522 END;
524 dev_t* = INTEGER; (* OpenBSD: 32-bit *)
525 gid_t* = INTEGER; (* OpenBSD: 32-bit *)
527 stat_t* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/sys/stat.h *)
528 st_dev*: dev_t; (* device *) (* OpenBSD: 32-bit *)
529 (* __pad1: SHORTINT; *) (* OpenBSD *)
530 st_ino*: INTEGER; (* 64? inode *) (* OpenBSD: 32-bit *)
531 st_mode*: mode_t; (* protection *) (* OpenBSD: 32-bit *)
532 st_nlink*: INTEGER; (* number of hard links *) (* OpenBSD: 32-bit *)
533 st_uid*: uid_t; (* user ID of owner *) (* OpenBSD: 32-bit *)
534 st_gid*: gid_t; (* group ID of owner *) (* OpenBSD: 32-bit *)
535 st_rdev*: dev_t; (* device type (if inode device) *) (* OpenBSD: 32-bit *)
536 st_lspare0*: INTEGER; (* OpenBSD *)
537 (* __pad2: SHORTINT; *) (* OpenBSD *)
539 (* OpenBSD *)
540 st_atime*: time_t;
541 st_atimensec*: INTEGER;
542 st_mtime*: time_t;
543 st_mtimensec*: INTEGER;
544 st_ctime*: time_t;
545 st_ctimensec*: INTEGER;
547 st_size*: off_t; (* 64? total size, in bytes *) (* OpenBSD *)
548 st_blocks*: LONGINT; (* OpenBSD: 64-bit *)
549 st_blksize*: INTEGER; (* blocksize for filesystem I/O *)
550 (* st_blocks*: INTEGER; (* 64? number of blocks allocated *) *) (* OpenBSD *)
551 st_flags*: INTEGER; (* OpenBSD: 32-bit *)
552 st_gen*: INTEGER; (* OpenBSD: 32-bit *)
553 st_lspare1*: INTEGER; (* OpenBSD: 32-bit *)
555 (* OpenBSD
556 st_atime*: INTEGER; (* time of last access *)
557 __unused1: INTEGER;
558 st_mtime*: INTEGER; (* time of last modification *)
559 __unused2: INTEGER;
560 st_ctime*: INTEGER; (* time of last change *)
561 __unused3: INTEGER;
562 __unused4: INTEGER;
563 __unused5: INTEGER;
564 *)
566 (* OpenBSD *)
567 __st_birthtime*: time_t;
568 __st_birthtimensec*: INTEGER;
569 st_qspare*: ARRAY [untagged] 2 OF LONGINT;
570 END;
572 (* OpenBSD
573 fpreg* = RECORD [untagged]
574 significand*: ARRAY [untagged] 4 OF CHAR;
575 exponent*: CHAR;
576 END;
577 *)
579 (* OpenBSD *)
580 (*
581 fpstate* = RECORD [untagged]
582 cw*: INTEGER; (* unsigned long int *)
583 sw*: INTEGER; (* unsigned long int *)
584 tag*: INTEGER; (* unsigned long int *)
585 ipoff*: INTEGER; (* unsigned long int *)
586 cssel*: INTEGER; (* unsigned long int *)
587 dataoff*: INTEGER; (* unsigned long int *)
588 datasel*: INTEGER; (* unsigned long int *)
589 _st: ARRAY [untagged] 8 OF fpreg;
590 status*: INTEGER; (* unsigned long int *)
591 END;
592 *)
593 envxmm* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/i386/npx.h *)
594 (*0*)
595 en_cw*: SHORTINT; (* FPU Control Word *)
596 en_sw*: SHORTINT; (* FPU Status Word *)
597 en_tw*: BYTE; (* FPU Tag Word (abridged) *)
598 en_rsvd0*: BYTE;
599 en_opcode*: SHORTINT; (* FPU Opcode *)
600 en_fip*: INTEGER; (* FPU Instruction Pointer *)
601 en_fcs*: SHORTINT; (* FPU IP selector *)
602 en_rsvd1*: SHORTINT;
603 (*16*)
604 en_foo*: INTEGER; (* FPU Data pointer *)
605 en_fos*: SHORTINT; (* FPU Data pointer selector *)
606 en_rsvd2*: SHORTINT;
607 en_mxcsr*: INTEGER; (* MXCSR Register State *)
608 en_mxcsr_mask*: INTEGER; (* Mask for valid MXCSR bits (may be 0) *)
609 END;
610 (* FPU regsters in the extended save format. *)
611 fpaccxmm* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/i386/npx.h *)
612 fp_bytes*: ARRAY [untagged] 10 OF BYTE;
613 fp_rsvd*: ARRAY [untagged] 6 OF BYTE;
614 END;
615 (* SSE/SSE2 registers. *)
616 xmmreg* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/i386/npx.h *)
617 sse_bytes*: ARRAY [untagged] 16 OF BYTE;
618 END;
619 fpstate* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/i386/npx.h savefpu.savexmm *)
620 sv_env*: envxmm; (* control/status context *)
621 sv_ac*: ARRAY [untagged] 8 OF fpaccxmm; (* ST/MM regs *)
622 sv_xmmregs*: ARRAY [untagged] 8 OF xmmreg; (* XMM regs *)
623 sv_rsvd*: ARRAY [untagged] 16 * 14 OF BYTE;
624 (* 512-bytes --- end of hardware portion of save area *)
625 sv_ex_sw*: INTEGER; (* saved SW from last exception *)
626 sv_ex_tw*: INTEGER; (* saved TW from last exception *)
627 END;
629 (* OpenBSD
630 gregset_t* = ARRAY [untagged] 19 OF INTEGER;
631 *)
632 fpregset_t* = POINTER TO fpstate;
634 (* OpenBSD
635 mcontext_t* = RECORD [untagged]
636 gregs*: gregset_t;
637 fpregs*: fpregset_t;
638 oldmask*: INTEGER; (* unsigned long int *)
639 cr2*: INTEGER; (* unsigned long int *)
640 END;
641 *)
643 Ptrucontext_t* = POINTER TO ucontext_t;
644 ucontext_t* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/i386/signal.h struct sigcontext *)
645 (*
646 uc_flags*: INTEGER; (* unsigned long int *)
647 uc_link*: Ptrucontext_t;
648 uc_stack*: stack_t;
649 uc_mcontext*: mcontext_t;
650 uc_sigmask: sigset_t;
651 __fpregs_mem*: fpstate;
652 *)
654 sc_gs*: INTEGER;
655 sc_fs*: INTEGER;
656 sc_es*: INTEGER;
657 sc_ds*: INTEGER;
658 sc_edi*: INTEGER;
659 sc_esi*: INTEGER;
660 sc_ebp*: INTEGER;
661 sc_ebx*: INTEGER;
662 sc_edx*: INTEGER;
663 sc_ecx*: INTEGER;
664 sc_eax*: INTEGER;
665 (* XXX *)
666 sc_eip*: INTEGER;
667 sc_cs*: INTEGER;
668 sc_eflags*: INTEGER;
669 sc_esp*: INTEGER;
670 sc_ss*: INTEGER;
672 sc_onstack*: INTEGER; (* sigstack state to restore *)
673 sc_mask*: INTEGER; (* signal mask to restore *)
674 sc_trapno*: INTEGER; (* XXX should be above *)
675 sc_err*: INTEGER;
677 sc_fpstate*: fpregset_t; (* POINTER TO savefpu *)
678 END;
680 (* Times and Dates *)
682 tm* = POINTER TO tmDesc;
683 tmDesc* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/time.h *)
684 tm_sec*: INTEGER; (* seconds *)
685 tm_min*: INTEGER; (* minutes *)
686 tm_hour*: INTEGER; (* hours *)
687 tm_mday*: INTEGER; (* day of the month *)
688 tm_mon*: INTEGER; (* month *)
689 tm_year*: INTEGER; (* year *)
690 tm_wday*: INTEGER; (* day of the week *)
691 tm_yday*: INTEGER; (* day in the year *)
692 tm_isdst*: INTEGER; (* daylight saving time *)
694 tm_gmtoff*: INTEGER; (* OpenBSD *)
695 tm_zone*: PtrSTR; (* OpenBSD *)
696 END;
698 time_t* = INTEGER; (* OpenBSD 5.2 /usr/include/i386/_types.h: 32-bit *)
700 FILE = ARRAY [untagged] 88 OF BYTE; (* OpenBSD 5.2 /usr/include/stdio.h *)
702 wchar_t* = INTEGER; (* OpenBSD 5.2: 32-bit *)
703 PtrWSTR* = POINTER TO ARRAY [untagged] OF wchar_t;
705 (* OpenBSD 5.2 *)
706 sigaltstack_t* = RECORD [untagged]
707 ss_sp*: PtrVoid;
708 ss_size*: size_t;
709 ss_flags*: INTEGER;
710 END;
712 VAR
713 (* timezone*: INTEGER; (* seconds from GMT *) *) (* OpenBSD: not present *)
714 (* stdin*, stdout*, stderr* : PtrFILE; (* OpenBSD: not present *) *)
716 (* OpenBSD: stdin, stdout, stderr *)
717 __sF*: ARRAY [untagged] 3 OF FILE; (* OpenBSD 5.2 /usr/include/stdio.h *)
718 (*
719 stdin = SYSTEM.ADR(__sF[0])
720 stdout = SYSTEM.ADR(__sF[1])
721 stderr = SYSTEM.ADR(__sF[2])
722 *)
724 PROCEDURE [ccall] calloc* (nmemb, size: size_t): PtrVoid;
725 PROCEDURE [ccall] clock* (): clock_t;
727 PROCEDURE [ccall] closedir* (dir: PtrDIR): INTEGER;
729 PROCEDURE [ccall] chmod* (path: PtrSTR; mode: mode_t);
730 PROCEDURE [ccall] exit* (status: INTEGER);
732 PROCEDURE [ccall] fclose* (fp: PtrFILE): INTEGER;
733 PROCEDURE [ccall] fflush* (fp: PtrFILE): INTEGER;
734 PROCEDURE [ccall] fopen* (filename, mode: PtrSTR): PtrFILE;
735 PROCEDURE [ccall] feof* (fp: PtrFILE): INTEGER;
736 PROCEDURE [ccall] fread* (ptr: PtrVoid; size, nmemb: size_t; stream: PtrFILE): size_t;
737 PROCEDURE [ccall] fseek* (stream: PtrFILE; offset, origin: INTEGER): INTEGER;
738 PROCEDURE [ccall] free* (p: PtrVoid);
740 PROCEDURE [ccall] ftell* (stream: PtrFILE): (* LONGINT; *) INTEGER; (* OpenBSD 5.2 *)
742 PROCEDURE [ccall] ftw* (filename: PtrSTR; func: __ftw_func_t; maxfds: INTEGER): INTEGER;
743 PROCEDURE [ccall] fwrite* (ptr: PtrVoid; size, nmemb: size_t; stream: PtrFILE): size_t;
744 PROCEDURE [ccall] getcwd* (buf: PtrSTR; size: size_t): PtrSTR;
746 (* PROCEDURE [ccall] getcontext* (ucontext_t: Ptrucontext_t): INTEGER; *) (* OpenBSD *)
748 (* PROCEDURE [ccall] gets* (s: PtrSTR); *)
749 PROCEDURE [ccall] gets* (s: PtrSTR): PtrSTR; (* OpenBSD 5.2 *)
751 PROCEDURE [ccall] fgets* (s: PtrSTR; n: INTEGER; fp: PtrFILE): PtrSTR;
752 PROCEDURE [ccall] gmtime* (VAR timep: time_t): tm;
753 PROCEDURE [ccall] kill* (pid: pid_t; sig: INTEGER): INTEGER;
754 PROCEDURE [ccall] localtime* (VAR timep: time_t): tm;
755 PROCEDURE [ccall] malloc* (size: size_t): PtrVoid;
756 PROCEDURE [ccall] mkdir* (path: PtrSTR; mode: mode_t): INTEGER;
757 PROCEDURE [ccall] mktime* (timeptr: tm): time_t;
758 PROCEDURE [ccall] opendir* (filename: PtrSTR): PtrDIR;
759 PROCEDURE [ccall] printf* (s: PtrSTR): INTEGER;
760 PROCEDURE [ccall] readdir* (dir: PtrDIR): PtrDirent;
761 PROCEDURE [ccall] remove* (path: PtrSTR): INTEGER;
762 PROCEDURE [ccall] rename* (from, to: PtrSTR): INTEGER;
763 PROCEDURE [ccall] scandir* (dir: PtrDIR; namelist: PtrDirentArray; selector: SelectorFunc; cmp: CmpFunc): INTEGER;
765 (* PROCEDURE [ccall] setcontext* (ucontext_t: Ptrucontext_t): INTEGER; *) (* OpenBSD *)
767 PROCEDURE [ccall] setjmp* (VAR env: jmp_buf): INTEGER;
768 PROCEDURE [ccall] sigaction* (sig_num: INTEGER; VAR [nil] act: sigaction_t; VAR [nil] oldact: sigaction_t): INTEGER;
769 PROCEDURE [ccall] sigaddset* (set: Ptrsigset_t; sig: INTEGER): INTEGER;
770 PROCEDURE [ccall] sigdelset* (set: Ptrsigset_t; sig: INTEGER): INTEGER;
771 PROCEDURE [ccall] sigemptyset* (set: Ptrsigset_t): INTEGER;
772 PROCEDURE [ccall] sigfillset* (set: Ptrsigset_t): INTEGER;
773 PROCEDURE [ccall] sigismemeber* (set: Ptrsigset_t; sig: INTEGER): INTEGER;
774 PROCEDURE [ccall] siglongjmp* (VAR env: sigjmp_buf; val: INTEGER);
776 PROCEDURE [ccall] signal* (sig_num: INTEGER; sighandler: PtrProc): PtrProc;
777 (* PROCEDURE [ccall] sigsetjmp* ["__sigsetjmp"] (VAR env: sigjmp_buf; savemask: INTEGER): INTEGER; *)
778 PROCEDURE [ccall] sigsetjmp* (VAR env: sigjmp_buf; savemask: INTEGER): INTEGER; (* OpenBSD *)
780 (* OpenBSD *)
781 PROCEDURE [ccall] stat* (filename: PtrSTR; VAR buf: stat_t): INTEGER; (* stat is a macro and expands to __xstat(3, filename, buf) *)
782 (* OpenBSD: __xstat not present
783 PROCEDURE [ccall] __xstat* (version: INTEGER; filename: PtrSTR; VAR buf: stat_t): INTEGER;
784 *)
786 PROCEDURE [ccall] strftime* (s: PtrSTR; max: size_t; format: PtrSTR; ptm: tm): size_t;
787 PROCEDURE [ccall] time* (VAR [nil] t: time_t): time_t;
789 (* PROCEDURE [ccall] __errno_location*(): INTEGER; *)
790 PROCEDURE [ccall] __errno_location* ["__errno"] (): INTEGER; (* OpenBSD *)
792 PROCEDURE [ccall] open* (path: PtrSTR; flags: SET; mode: mode_t): INTEGER;
793 PROCEDURE [ccall] close* (d: INTEGER): INTEGER;
794 PROCEDURE [ccall] read* (d: INTEGER; buf: PtrVoid; nbytes: size_t): ssize_t;
795 PROCEDURE [ccall] write* (d: INTEGER; buf: PtrVoid; nBytes: size_t): ssize_t;
797 (* OpenBSD *)
798 PROCEDURE [ccall] mprotect* (addr: PtrVoid; len: size_t; prot: SET): INTEGER;
800 (* OpenBSD 5.2 *)
801 PROCEDURE [ccall] madvise* (addr: PtrVoid; len: size_t; behav: INTEGER): INTEGER;
803 PROCEDURE [ccall] mmap* (addr: PtrVoid; len: size_t; prot: SET; flags: SET; fd: INTEGER; offset: off_t): PtrVoid;
804 PROCEDURE [ccall] munmap* (addr: PtrVoid; len: size_t): INTEGER;
806 PROCEDURE [ccall] getenv* (name: PtrSTR): PtrSTR;
808 (* OpenBSD 5.2: Ok *)
809 PROCEDURE [ccall] wctomb* (s: PtrSTR; wchar: wchar_t): INTEGER;
810 PROCEDURE [ccall] wcstombs* (s: PtrSTR; pwcs: PtrWSTR; n: size_t): size_t;
811 PROCEDURE [ccall] mbtowc* (pwc: PtrWSTR; s: PtrSTR; n: size_t): INTEGER;
812 PROCEDURE [ccall] mbstowcs* (pwcs: PtrWSTR; s: PtrSTR; n: size_t): size_t;
814 (* OpenBSD 5.2 *)
815 PROCEDURE [ccall] sysconf* (name: INTEGER): INTEGER;
817 PROCEDURE [ccall] sigaltstack* (VAR [nil] ss: sigaltstack_t; VAR [nil] oss: sigaltstack_t): INTEGER;
819 PROCEDURE [ccall] sigreturn* (ucontext_t: Ptrucontext_t): INTEGER;
821 PROCEDURE [ccall] sigprocmask* (how: INTEGER; VAR [nil] set: sigset_t; VAR [nil] oset: sigset_t): INTEGER;
823 END LinLibc.