Alexander Shiryaev 12 лет назад
Родитель
Сommit
ac9e9b4387
66 измененных файлов с 1946 добавлено и 1157 удалено
  1. 0 0
      new/_FreeBSDLinuxOpenBSD_/Host/Mod/Lang.odc
  2. 0 0
      new/_FreeBSDLinuxOpenBSD_/Host/Mod/PackedFiles.odc
  3. 0 0
      new/_FreeBSDLinuxOpenBSD_/Host/Mod/TextConv.odc
  4. 211 0
      new/_FreeBSDLinuxOpenBSD_/Lin/Rsrc/Mod/gen-Libc/Libc.txt.templ
  5. 0 0
      new/_FreeBSDLinuxOpenBSD_/Lin/Rsrc/loader/loader.c
  6. 0 0
      new/_FreeBSDLinuxOpenBSD_/System/Mod/Config.odc
  7. 0 0
      new/_FreeBSDLinuxOpenBSD_/System/Mod/Kernel_so_init.odc
  8. 0 0
      new/_FreeBSDLinuxOpenBSD_Interp/Host/Mod/DevPackedFiles.odc
  9. 0 0
      new/_FreeBSDLinuxOpenBSD_Interp/build
  10. 0 0
      new/_FreeBSDLinuxOpenBSD_Interp/pack-dev0
  11. BIN
      new/_FreeBSDLinux_/Host/Mod/Console.odc
  12. BIN
      new/_FreeBSDOpenBSD_/Host/Mod/Dates.odc
  13. BIN
      new/_FreeBSD_/Host/Mod/Files.odc
  14. 32 0
      new/_FreeBSD_/Lin/Mod/Dl.txt
  15. 22 0
      new/_FreeBSD_/Lin/Mod/Iconv.txt
  16. 657 0
      new/_FreeBSD_/Lin/Mod/Libc.txt
  17. 74 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/Makefile
  18. 6 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/custom
  19. 1 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/dumpdefs.py
  20. 6 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/fields-dirent
  21. 4 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/fields-sigaction
  22. 31 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/fields-siginfo
  23. 4 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/fields-stack
  24. 35 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/fields-stat
  25. 12 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/fields-tm
  26. 35 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/fields-ucontext
  27. 1 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/libver
  28. 1 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/machine
  29. 1 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/mkdumpstrerrno.py
  30. 1 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/mkstrerrnocase.py
  31. 1 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/nsig
  32. 1 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/osname
  33. 1 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/sigstksz
  34. 88 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/sizeofs.c
  35. 1 0
      new/_FreeBSD_/Lin/Mod/gen-Libc/untempl.py
  36. 15 0
      new/_FreeBSD_/Lin/Rsrc/loader/Makefile
  37. BIN
      new/_FreeBSD_/Lin/Rsrc/loader/loader
  38. BIN
      new/_FreeBSD_/System/Mod/Kernel.odc
  39. BIN
      new/_FreeBSD_/libBB.so
  40. BIN
      new/_FreeBSD_/libBB0.so
  41. 1 0
      new/_FreeBSD_/loader
  42. BIN
      new/_Linux_/Host/Mod/Console.odc
  43. 1 0
      new/_Linux_/Lin/Mod/gen-Libc/mkdumpstrerrno.py
  44. 1 0
      new/_Linux_/Lin/Mod/gen-Libc/mkstrerrnocase.py
  45. 1 1
      new/_Linux_/Lin/Mod/gen-Net/Makefile
  46. BIN
      new/_Linux_/System/Mod/Kernel.odc
  47. 0 2
      new/_OpenBSD_/Lin/Mod/Dl.txt
  48. 457 606
      new/_OpenBSD_/Lin/Mod/Libc.txt
  49. 0 501
      new/_OpenBSD_/Lin/Mod/gen-Libc/Libc.txt.templ
  50. 36 33
      new/_OpenBSD_/Lin/Mod/gen-Libc/Makefile
  51. 13 0
      new/_OpenBSD_/Lin/Mod/gen-Libc/custom
  52. 6 0
      new/_OpenBSD_/Lin/Mod/gen-Libc/fields-dirent
  53. 4 0
      new/_OpenBSD_/Lin/Mod/gen-Libc/fields-sigaction
  54. 28 0
      new/_OpenBSD_/Lin/Mod/gen-Libc/fields-siginfo
  55. 4 0
      new/_OpenBSD_/Lin/Mod/gen-Libc/fields-stack
  56. 27 0
      new/_OpenBSD_/Lin/Mod/gen-Libc/fields-stat
  57. 12 0
      new/_OpenBSD_/Lin/Mod/gen-Libc/fields-tm
  58. 36 0
      new/_OpenBSD_/Lin/Mod/gen-Libc/fields-ucontext
  59. 1 0
      new/_OpenBSD_/Lin/Mod/gen-Libc/libver
  60. 1 0
      new/_OpenBSD_/Lin/Mod/gen-Libc/machine
  61. 1 0
      new/_OpenBSD_/Lin/Mod/gen-Libc/osname
  62. 1 0
      new/_OpenBSD_/Lin/Mod/gen-Libc/sigstksz
  63. 74 14
      new/_OpenBSD_/Lin/Mod/gen-Libc/sizeofs.c
  64. BIN
      new/_OpenBSD_/System/Mod/Kernel.odc
  65. BIN
      new/_OpenBSD_/libBB.so
  66. BIN
      new/_OpenBSD_/libBB0.so

+ 0 - 0
new/_LinuxOpenBSD_/Host/Mod/Lang.odc → new/_FreeBSDLinuxOpenBSD_/Host/Mod/Lang.odc


+ 0 - 0
new/_LinuxOpenBSD_/Host/Mod/PackedFiles.odc → new/_FreeBSDLinuxOpenBSD_/Host/Mod/PackedFiles.odc


+ 0 - 0
new/_LinuxOpenBSD_/Host/Mod/TextConv.odc → new/_FreeBSDLinuxOpenBSD_/Host/Mod/TextConv.odc


+ 211 - 0
new/_FreeBSDLinuxOpenBSD_/Lin/Rsrc/Mod/gen-Libc/Libc.txt.templ

@@ -0,0 +1,211 @@
+MODULE LinLibc ["libc.so%%libver%%"];
+
+	(*
+		%%osname%%
+		%%machine%%
+	*)
+
+	CONST
+		NULL* = 0H;
+		FALSE* = 0;
+		TRUE* = 1;
+
+		CLOCKS_PER_SEC* = %%clockspersec%%;
+
+		MAP_FAILED* = -1;
+
+		(* MAP_PRIVATE, MAP_ANON (intFlags) *)
+%%defs-map%%
+
+		(* PROT_READ, PROT_WRITE, PROT_EXEC (intFlags) *)
+%%defs-prot%%
+
+		(* SIG_UNBLOCK, SIG_SETMASK (int) *)
+%%defs-sigmask%%
+
+		(* FPE_INTDIV, FPE_INTOVF, FPE_FLTDIV, FPE_FLTOVF, FPE_FLTUND, FPE_FLTRES, FPE_FLTINV, FPE_FLTSUB (int) *)
+%%defs-fpe%%
+
+		(* SA_SIGINFO (intFlags) *)
+%%defs-sa%%
+
+		(* SIGINT, SIGILL, SIGFPE, SIGSEGV, SIGKILL, SIGSTOP, SIGWINCH, SIGTHR (int) *)
+%%defs-signo%%
+		_NSIG* = %%nsig%%;
+
+(*
+		PAGE_SIZE* = 4096;
+*)
+%%defs-sc%%
+
+		SIGSTKSZ* = %%sigstksz%%;
+
+		(* ENOENT, EEXIST, EACCES, ENOMEM, EDQUOT, EMFILE, ENOTDIR (int) *)
+%%defs-errno%%
+
+		NAME_MAX* = %%namemax%%;
+
+		SEEK_SET* = 0;
+		SEEK_CUR* = 1;
+		SEEK_END* = 2;
+
+		P_tmpdir* = "/tmp";
+
+		(* O_RDWR, O_NONBLOCK (intFlags) *)
+%%defs-fcntlo%%
+
+	TYPE
+		StrArray* = POINTER TO ARRAY [untagged] OF PtrSTR;
+		PtrSTR* = POINTER TO ARRAY [untagged] OF SHORTCHAR;
+
+		(* PtrVoid, int, long, size_t, ssize_t, off_t, time_t, clock_t, sigjmp_buf *)
+		(* mode_t, intFlags, sigset_t (set) *)
+%%defs-basictypes%%
+
+		tm* = POINTER TO tmDesc;
+		tmDesc* = RECORD [untagged]
+			(* NOTE: check record size *)
+			(* tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec, tm_wday [ , tm_gmtoff ] *)
+%%fields-tm%%
+		END;
+
+		Ptrsiginfo_t* = POINTER TO siginfo_t;
+		siginfo_t = RECORD [untagged]
+			(* si_code, fault address *)
+%%fields-siginfo%%
+		END;
+
+		Ptrucontext_t* = POINTER TO ucontext_t;
+		ucontext_t = RECORD [untagged]
+			(* IP, SP, FP *)
+%%fields-ucontext%%
+		END;
+
+		sigaction_t* = RECORD [untagged]
+(*
+			sa_sigaction*: PROCEDURE [ccall] (sig: INTEGER; siginfo: Ptrsiginfo_t; context: Ptrucontext_t),
+			sa_flags*: intFlags, sa_mask*: sigset_t
+*)
+%%fields-sigaction%%
+		END;
+
+		stack_t* = RECORD [untagged]
+(*
+			ss_sp*: PtrVoid, ss_size*: size_t, ss_flags*: intFlags
+*)
+%%fields-stack%%
+		END;
+
+		stat_t* = RECORD [untagged]
+(*
+			NOTE: check record size
+			st_mode*: mode_t, st_size*: off_t, st_mtime*: time_t
+*)
+%%fields-stat%%
+		END;
+
+		PtrFILE* = PtrVoid;
+		PtrDIR* = PtrVoid;
+
+		PtrDirent* = POINTER TO Dirent;
+		Dirent = RECORD [untagged]
+(*
+			d_name*: ARRAY [untagged] NAME_MAX + 1 OF SHORTCHAR
+*)
+%%fields-dirent%%
+		END;
+
+(*
+	VAR
+		stdin*: INTEGER;
+		timezone*: INTEGER; (* or tm.tm_gmtoff *)
+*)
+(*
+	PROCEDURE [ccall] __errno_location* (): PtrVoid;
+*)
+(*
+	(* POSIX.1 *)
+		PROCEDURE [ccall] stat* (path: PtrSTR; VAR sp: stat_t): int;
+*)
+%%custom%%
+
+	(* ANSI C 89 *)
+		PROCEDURE [ccall] clock* (): clock_t;
+
+	PROCEDURE [ccall] mmap* (adr: PtrVoid; len: size_t; prot: intFlags; flags: intFlags; fd: int; offset: off_t): PtrVoid;
+	(* BSD *)
+		PROCEDURE [ccall] munmap* (adr: PtrVoid; len: size_t): int;
+		PROCEDURE [ccall] mprotect* (adr: PtrVoid; len: size_t; prot: intFlags): int;
+
+(*
+	PROCEDURE [ccall] calloc* (nmemb: size_t; size: size_t): PtrVoid;
+	(* ANSI C 89 *)
+		PROCEDURE [ccall] malloc* (size: size_t): PtrVoid;
+*)
+		PROCEDURE [ccall] free* (ptr: PtrVoid);
+
+	(* AT&T *)
+		PROCEDURE [ccall] time* (VAR [nil] t: time_t): time_t;
+	PROCEDURE [ccall] gmtime* (VAR [nil] t: time_t): tm;
+	PROCEDURE [ccall] localtime* (VAR [nil] t: time_t): tm;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] sigsetjmp* (VAR env: sigjmp_buf; savemask: int): int;
+		PROCEDURE [ccall] siglongjmp* (VAR env: sigjmp_buf; val: int);
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] sigemptyset* (VAR set: sigset_t): int;
+		PROCEDURE [ccall] sigfillset* (VAR set: sigset_t): int;
+		PROCEDURE [ccall] sigaddset* (VAR set: sigset_t; signo: int): int;
+		PROCEDURE [ccall] sigprocmask* (how: int; VAR [nil] set: sigset_t; VAR [nil] oset: sigset_t): int;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] sigaction* (sig: int; VAR [nil] act: sigaction_t; VAR [nil] oact: sigaction_t): int;
+
+	(* BSD *)
+		PROCEDURE [ccall] sigaltstack* (VAR [nil] ss: stack_t; VAR [nil] oss: stack_t): int;
+
+	(* ANSI C 89 *)
+		PROCEDURE [ccall] getenv* (s: PtrSTR): PtrSTR;
+
+	(* ANSI C 89 *)
+		PROCEDURE [ccall] fopen* (path, mode: PtrSTR): PtrFILE;
+		PROCEDURE [ccall] fclose* (stream: PtrFILE): int;
+		PROCEDURE [ccall] fread* (ptr: PtrVoid; size: size_t; nmemb: size_t; stream: PtrFILE): size_t;
+		PROCEDURE [ccall] fwrite* (ptr: PtrVoid; size: size_t; nmemb: size_t; stream: PtrFILE): size_t;
+		PROCEDURE [ccall] fflush* (s: PtrFILE): int;
+		PROCEDURE [ccall] printf* (s: PtrSTR): int;
+	(* ANSI C 89, XPG4 *)
+		PROCEDURE [ccall] fseek* (stream: PtrFILE; offset: long; whence: int): int;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] rename* (from, to: PtrSTR): int;
+		PROCEDURE [ccall] mkdir* (path: PtrSTR; mode: mode_t): int;
+		PROCEDURE [ccall] opendir* (filename: PtrSTR): PtrDIR;
+		PROCEDURE [ccall] readdir* (dirp: PtrDIR): PtrDirent;
+		PROCEDURE [ccall] closedir* (dirp: PtrDIR): int;
+	(* ANSI C 89, XPG4.2 *)
+		PROCEDURE [ccall] remove* (path: PtrSTR): int;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] getcwd* (buf: PtrSTR; size: size_t): PtrSTR;
+
+	(* ANSI C 99 *)
+		PROCEDURE [ccall] exit* (status: int);
+
+	(* ANSI C 89 *)
+		PROCEDURE [ccall] strftime* (buf: PtrSTR; maxsize: size_t; format: PtrSTR; timeptr: tm): size_t;
+
+	(* XXX: use fread instead *)
+		PROCEDURE [ccall] fgets* (str: PtrSTR; size: int; stream: PtrFILE): PtrSTR;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] open* (path: PtrSTR; flags: intFlags; mode: mode_t): int;
+		PROCEDURE [ccall] write* (d: int; buf: PtrVoid; nbytes: size_t): ssize_t;
+		PROCEDURE [ccall] read* (d: int; buf: PtrVoid; nbytes: size_t): ssize_t;
+		PROCEDURE [ccall] close* (d: int): int;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] sysconf* (name: int): long;
+
+END LinLibc.

+ 0 - 0
new/_LinuxOpenBSD_/Lin/Rsrc/loader/loader.c → new/_FreeBSDLinuxOpenBSD_/Lin/Rsrc/loader/loader.c


+ 0 - 0
new/_LinuxOpenBSD_/System/Mod/Config.odc → new/_FreeBSDLinuxOpenBSD_/System/Mod/Config.odc


+ 0 - 0
new/_LinuxOpenBSD_/System/Mod/Kernel_so_init.odc → new/_FreeBSDLinuxOpenBSD_/System/Mod/Kernel_so_init.odc


+ 0 - 0
new/_LinuxOpenBSD_Interp/Host/Mod/DevPackedFiles.odc → new/_FreeBSDLinuxOpenBSD_Interp/Host/Mod/DevPackedFiles.odc


+ 0 - 0
new/_LinuxOpenBSD_Interp/build → new/_FreeBSDLinuxOpenBSD_Interp/build


+ 0 - 0
new/_LinuxOpenBSD_Interp/pack-dev0 → new/_FreeBSDLinuxOpenBSD_Interp/pack-dev0


BIN
new/_FreeBSDLinux_/Host/Mod/Console.odc


BIN
new/_OpenBSD_/Host/Mod/Dates.odc → new/_FreeBSDOpenBSD_/Host/Mod/Dates.odc


BIN
new/_FreeBSD_/Host/Mod/Files.odc


+ 32 - 0
new/_FreeBSD_/Lin/Mod/Dl.txt

@@ -0,0 +1,32 @@
+MODULE LinDl ["libc.so.7"];
+
+	(*
+		A. V. Shiryaev, 2012.11
+
+		FreeBSD 9.0
+		32-bit
+	*)
+
+	CONST
+		NULL* = 0H;
+
+		(* from FreeBSD 9.0 /usr/include/dlfcn.h *)
+			RTLD_LAZY* = 1;
+			RTLD_NOW* = 2;
+
+			RTLD_GLOBAL* = 100H;
+			RTLD_LOCAL* = 000H;
+			RTLD_TRACE* = 200H;
+
+	TYPE
+		PtrVoid* = INTEGER;
+		HANDLE* = PtrVoid;
+		PtrSTR* = POINTER TO ARRAY [untagged] OF SHORTCHAR;
+
+	PROCEDURE [ccall] dlopen* (file: PtrSTR; mode: INTEGER): HANDLE;
+	PROCEDURE [ccall] dlclose* (handle: HANDLE): INTEGER;
+	PROCEDURE [ccall] dlsym* (handle: HANDLE; symbol: PtrSTR): HANDLE;
+
+	PROCEDURE [ccall] dlerror* (): PtrSTR;
+
+END LinDl.

+ 22 - 0
new/_FreeBSD_/Lin/Mod/Iconv.txt

@@ -0,0 +1,22 @@
+MODULE LinIconv ["libiconv.so.3"];
+
+	IMPORT Libc := LinLibc;
+
+	TYPE
+		PtrVoid = Libc.PtrVoid;
+		PtrSTR* = Libc.PtrSTR;
+		PtrLSTR* = POINTER TO ARRAY [untagged] OF CHAR;
+		size_t* = Libc.size_t;
+
+		iconv_t* = PtrVoid;
+
+	PROCEDURE [ccall] iconv_open* ["libiconv_open"] (tocode, fromcode: PtrSTR): iconv_t;
+	PROCEDURE [ccall] iconv_close* ["libiconv_close"] (cd: iconv_t): INTEGER;
+
+	PROCEDURE [ccall] iconv* ["libiconv"] (cd: iconv_t; VAR [nil] inbuf: PtrSTR; VAR inbytesleft: size_t; VAR [nil] outbuf: PtrSTR; VAR outbytesleft: size_t): size_t;
+
+	PROCEDURE [ccall] iconv_encode* ["libiconv"] (cd: iconv_t; VAR [nil] inbuf: PtrLSTR; VAR inbytesleft: size_t; VAR [nil] outbuf: PtrSTR; VAR outbytesleft: size_t): size_t;
+
+	PROCEDURE [ccall] iconv_decode* ["libiconv"] (cd: iconv_t; VAR [nil] inbuf: PtrSTR; VAR inbytesleft: size_t; VAR [nil] outbuf: PtrLSTR; VAR outbytesleft: size_t): size_t;
+
+END LinIconv.

+ 657 - 0
new/_FreeBSD_/Lin/Mod/Libc.txt

@@ -0,0 +1,657 @@
+MODULE LinLibc ["libc.so.7"];
+
+	(*
+		FreeBSD 9.0
+		i386
+	*)
+
+	CONST
+		NULL* = 0H;
+		FALSE* = 0;
+		TRUE* = 1;
+
+		CLOCKS_PER_SEC* = 128;
+
+		MAP_FAILED* = -1;
+
+		(* MAP_PRIVATE, MAP_ANON (intFlags) *)
+		MAP_SHARED* = {0}; (* share changes *)
+		MAP_PRIVATE* = {1}; (* changes are private *)
+		MAP_FIXED* = {4}; (* map addr must be exactly as requested *)
+		MAP_COPY* = MAP_PRIVATE; (* Obsolete *)
+		MAP_RENAME* = {5}; (* Sun: rename private pages to file *)
+		MAP_NORESERVE* = {6}; (* Sun: don't reserve needed swap area *)
+		MAP_RESERVED0080* = {7}; (* previously misimplemented MAP_INHERIT *)
+		MAP_RESERVED0100* = {8}; (* previously unimplemented MAP_NOEXTEND *)
+		MAP_HASSEMAPHORE* = {9}; (* region may contain semaphores *)
+		MAP_STACK* = {10}; (* region grows down, like a stack *)
+		MAP_NOSYNC* = {11}; (* page to but do not sync underlying file *)
+		MAP_FILE* = {}; (* map from file (default) *)
+		MAP_ANON* = {12}; (* allocated from memory, swap space *)
+		MAP_NOCORE* = {17}; (* dont include these pages in a coredump *)
+		MAP_PREFAULT_READ* = {18}; (* prefault mapping for reading *)
+
+
+		(* PROT_READ, PROT_WRITE, PROT_EXEC (intFlags) *)
+		PROT_NONE* = {}; (* no permissions *)
+		PROT_READ* = {0}; (* pages can be read *)
+		PROT_WRITE* = {1}; (* pages can be written *)
+		PROT_EXEC* = {2}; (* pages can be executed *)
+
+
+		(* SIG_UNBLOCK, SIG_SETMASK (int) *)
+		SIG_BLOCK* = 1; (* block specified signal set *)
+		SIG_UNBLOCK* = 2; (* unblock specified signal set *)
+		SIG_SETMASK* = 3; (* set specified signal set *)
+
+
+		(* FPE_INTDIV, FPE_INTOVF, FPE_FLTDIV, FPE_FLTOVF, FPE_FLTUND, FPE_FLTRES, FPE_FLTINV, FPE_FLTSUB (int) *)
+		FPE_INTOVF* = 1; (* Integer overflow. *)
+		FPE_INTDIV* = 2; (* Integer divide by zero. *)
+		FPE_FLTDIV* = 3; (* Floating point divide by zero. *)
+		FPE_FLTOVF* = 4; (* Floating point overflow. *)
+		FPE_FLTUND* = 5; (* Floating point underflow. *)
+		FPE_FLTRES* = 6; (* Floating point inexact result. *)
+		FPE_FLTINV* = 7; (* Invalid floating point operation. *)
+		FPE_FLTSUB* = 8; (* Subscript out of range. *)
+
+
+		(* SA_SIGINFO (intFlags) *)
+		SA_NOCLDSTOP* = {3}; (* do not generate SIGCHLD on child stop *)
+		SA_ONSTACK* = {0}; (* take signal on signal stack *)
+		SA_RESTART* = {1}; (* restart system call on signal return *)
+		SA_RESETHAND* = {2}; (* reset to SIG_DFL when taking signal *)
+		SA_NODEFER* = {4}; (* don't mask the signal we're delivering *)
+		SA_NOCLDWAIT* = {5}; (* don't keep zombies around *)
+		SA_SIGINFO* = {6}; (* signal handler with SA_SIGINFO args *)
+
+
+		(* SIGINT, SIGILL, SIGFPE, SIGSEGV, SIGKILL, SIGSTOP, SIGWINCH, SIGTHR (int) *)
+		SIGINT* = 2; (* interrupt *)
+		SIGILL* = 4; (* illegal instr. (not reset when caught) *)
+		SIGABRT* = 6; (* abort() *)
+		SIGFPE* = 8; (* floating point exception *)
+		SIGSEGV* = 11; (* segmentation violation *)
+		SIGTERM* = 15; (* software termination signal from kill *)
+		SIGRTMIN* = 65;
+		SIGRTMAX* = 126;
+		SIGHUP* = 1; (* hangup *)
+		SIGQUIT* = 3; (* quit *)
+		SIGTRAP* = 5; (* trace trap (not reset when caught) *)
+		SIGIOT* = SIGABRT; (* compatibility *)
+		SIGEMT* = 7; (* EMT instruction *)
+		SIGKILL* = 9; (* kill (cannot be caught or ignored) *)
+		SIGBUS* = 10; (* bus error *)
+		SIGSYS* = 12; (* non-existent system call invoked *)
+		SIGPIPE* = 13; (* write on a pipe with no one to read it *)
+		SIGALRM* = 14; (* alarm clock *)
+		SIGURG* = 16; (* urgent condition on IO channel *)
+		SIGSTOP* = 17; (* sendable stop signal not from tty *)
+		SIGTSTP* = 18; (* stop signal from tty *)
+		SIGCONT* = 19; (* continue a stopped process *)
+		SIGCHLD* = 20; (* to parent on child stop or exit *)
+		SIGTTIN* = 21; (* to readers pgrp upon background tty read *)
+		SIGTTOU* = 22; (* like TTIN if (tp->t_local&LTOSTOP) *)
+		SIGIO* = 23; (* input/output possible signal *)
+		SIGXCPU* = 24; (* exceeded CPU time limit *)
+		SIGXFSZ* = 25; (* exceeded file size limit *)
+		SIGVTALRM* = 26; (* virtual time alarm *)
+		SIGPROF* = 27; (* profiling time alarm *)
+		SIGWINCH* = 28; (* window size changes *)
+		SIGINFO* = 29; (* information request *)
+		SIGUSR1* = 30; (* user defined signal 1 *)
+		SIGUSR2* = 31; (* user defined signal 2 *)
+		SIGTHR* = 32; (* reserved by thread library. *)
+		SIGLWP* = SIGTHR;
+		SIGEV_NONE* = 0; (* No async notification. *)
+		SIGEV_SIGNAL* = 1; (* Generate a queued signal. *)
+		SIGEV_THREAD* = 2; (* Call back from another pthread. *)
+
+		_NSIG* = SIGTHR + 1;
+
+(*
+		PAGE_SIZE* = 4096;
+*)
+		_SC_ASYNCHRONOUS_IO* = 28;
+		_SC_MAPPED_FILES* = 29;
+		_SC_MEMLOCK* = 30;
+		_SC_MEMLOCK_RANGE* = 31;
+		_SC_MEMORY_PROTECTION* = 32;
+		_SC_MESSAGE_PASSING* = 33;
+		_SC_PRIORITIZED_IO* = 34;
+		_SC_PRIORITY_SCHEDULING* = 35;
+		_SC_REALTIME_SIGNALS* = 36;
+		_SC_SEMAPHORES* = 37;
+		_SC_FSYNC* = 38;
+		_SC_SHARED_MEMORY_OBJECTS* = 39;
+		_SC_SYNCHRONIZED_IO* = 40;
+		_SC_TIMERS* = 41;
+		_SC_AIO_LISTIO_MAX* = 42;
+		_SC_AIO_MAX* = 43;
+		_SC_AIO_PRIO_DELTA_MAX* = 44;
+		_SC_DELAYTIMER_MAX* = 45;
+		_SC_MQ_OPEN_MAX* = 46;
+		_SC_PAGESIZE* = 47;
+		_SC_RTSIG_MAX* = 48;
+		_SC_SEM_NSEMS_MAX* = 49;
+		_SC_SEM_VALUE_MAX* = 50;
+		_SC_SIGQUEUE_MAX* = 51;
+		_SC_TIMER_MAX* = 52;
+		_SC_2_PBS* = 59; (* user *)
+		_SC_2_PBS_ACCOUNTING* = 60; (* user *)
+		_SC_2_PBS_CHECKPOINT* = 61; (* user *)
+		_SC_2_PBS_LOCATE* = 62; (* user *)
+		_SC_2_PBS_MESSAGE* = 63; (* user *)
+		_SC_2_PBS_TRACK* = 64; (* user *)
+		_SC_ADVISORY_INFO* = 65;
+		_SC_BARRIERS* = 66; (* user *)
+		_SC_CLOCK_SELECTION* = 67;
+		_SC_CPUTIME* = 68;
+		_SC_FILE_LOCKING* = 69;
+		_SC_GETGR_R_SIZE_MAX* = 70; (* user *)
+		_SC_GETPW_R_SIZE_MAX* = 71; (* user *)
+		_SC_HOST_NAME_MAX* = 72;
+		_SC_LOGIN_NAME_MAX* = 73;
+		_SC_MONOTONIC_CLOCK* = 74;
+		_SC_MQ_PRIO_MAX* = 75;
+		_SC_READER_WRITER_LOCKS* = 76; (* user *)
+		_SC_REGEXP* = 77; (* user *)
+		_SC_SHELL* = 78; (* user *)
+		_SC_SPAWN* = 79; (* user *)
+		_SC_SPIN_LOCKS* = 80; (* user *)
+		_SC_SPORADIC_SERVER* = 81;
+		_SC_THREAD_ATTR_STACKADDR* = 82; (* user *)
+		_SC_THREAD_ATTR_STACKSIZE* = 83; (* user *)
+		_SC_THREAD_CPUTIME* = 84; (* user *)
+		_SC_THREAD_DESTRUCTOR_ITERATIONS* = 85; (* user *)
+		_SC_THREAD_KEYS_MAX* = 86; (* user *)
+		_SC_THREAD_PRIO_INHERIT* = 87; (* user *)
+		_SC_THREAD_PRIO_PROTECT* = 88; (* user *)
+		_SC_THREAD_PRIORITY_SCHEDULING* = 89; (* user *)
+		_SC_THREAD_PROCESS_SHARED* = 90; (* user *)
+		_SC_THREAD_SAFE_FUNCTIONS* = 91; (* user *)
+		_SC_THREAD_SPORADIC_SERVER* = 92; (* user *)
+		_SC_THREAD_STACK_MIN* = 93; (* user *)
+		_SC_THREAD_THREADS_MAX* = 94; (* user *)
+		_SC_TIMEOUTS* = 95; (* user *)
+		_SC_THREADS* = 96; (* user *)
+		_SC_TRACE* = 97; (* user *)
+		_SC_TRACE_EVENT_FILTER* = 98; (* user *)
+		_SC_TRACE_INHERIT* = 99; (* user *)
+		_SC_TRACE_LOG* = 100; (* user *)
+		_SC_TTY_NAME_MAX* = 101; (* user *)
+		_SC_TYPED_MEMORY_OBJECTS* = 102;
+		_SC_V6_ILP32_OFF32* = 103; (* user *)
+		_SC_V6_ILP32_OFFBIG* = 104; (* user *)
+		_SC_V6_LP64_OFF64* = 105; (* user *)
+		_SC_V6_LPBIG_OFFBIG* = 106; (* user *)
+		_SC_IPV6* = 118;
+		_SC_RAW_SOCKETS* = 119;
+		_SC_SYMLOOP_MAX* = 120;
+		_SC_ATEXIT_MAX* = 107; (* user *)
+		_SC_IOV_MAX* = 56;
+		_SC_XOPEN_CRYPT* = 108; (* user *)
+		_SC_XOPEN_ENH_I18N* = 109; (* user *)
+		_SC_XOPEN_LEGACY* = 110; (* user *)
+		_SC_XOPEN_REALTIME* = 111;
+		_SC_XOPEN_REALTIME_THREADS* = 112;
+		_SC_XOPEN_SHM* = 113;
+		_SC_XOPEN_STREAMS* = 114;
+		_SC_XOPEN_UNIX* = 115;
+		_SC_XOPEN_VERSION* = 116;
+		_SC_XOPEN_XCU_VERSION* = 117; (* user *)
+		_SC_NPROCESSORS_CONF* = 57;
+		_SC_NPROCESSORS_ONLN* = 58;
+		_SC_CPUSET_SIZE* = 122;
+
+
+		SIGSTKSZ* = 512 * 4 + 32768 (* FreeBSD 9.0 /usr/include/sys/signal.h *);
+
+		(* ENOENT, EEXIST, EACCES, ENOMEM, EDQUOT, EMFILE, ENOTDIR (int) *)
+		EPERM* = 1; (* Operation not permitted *)
+		ENOENT* = 2; (* No such file or directory *)
+		ESRCH* = 3; (* No such process *)
+		EINTR* = 4; (* Interrupted system call *)
+		EIO* = 5; (* Input/output error *)
+		ENXIO* = 6; (* Device not configured *)
+		E2BIG* = 7; (* Argument list too long *)
+		ENOEXEC* = 8; (* Exec format error *)
+		EBADF* = 9; (* Bad file descriptor *)
+		ECHILD* = 10; (* No child processes *)
+		EDEADLK* = 11; (* Resource deadlock avoided *)
+		ENOMEM* = 12; (* Cannot allocate memory *)
+		EACCES* = 13; (* Permission denied *)
+		EFAULT* = 14; (* Bad address *)
+		EBUSY* = 16; (* Device busy *)
+		EEXIST* = 17; (* File exists *)
+		EXDEV* = 18; (* Cross-device link *)
+		ENODEV* = 19; (* Operation not supported by device *)
+		ENOTDIR* = 20; (* Not a directory *)
+		EISDIR* = 21; (* Is a directory *)
+		EINVAL* = 22; (* Invalid argument *)
+		ENFILE* = 23; (* Too many open files in system *)
+		EMFILE* = 24; (* Too many open files *)
+		ENOTTY* = 25; (* Inappropriate ioctl for device *)
+		EFBIG* = 27; (* File too large *)
+		ENOSPC* = 28; (* No space left on device *)
+		ESPIPE* = 29; (* Illegal seek *)
+		EROFS* = 30; (* Read-only filesystem *)
+		EMLINK* = 31; (* Too many links *)
+		EPIPE* = 32; (* Broken pipe *)
+		EDOM* = 33; (* Numerical argument out of domain *)
+		ERANGE* = 34; (* Result too large *)
+		EAGAIN* = 35; (* Resource temporarily unavailable *)
+		ENAMETOOLONG* = 63; (* File name too long *)
+		ENOTEMPTY* = 66; (* Directory not empty *)
+		ENOLCK* = 77; (* No locks available *)
+		ENOSYS* = 78; (* Function not implemented *)
+		EBADMSG* = 89; (* Bad message *)
+		EMULTIHOP* = 90; (* Multihop attempted *)
+		ENOLINK* = 91; (* Link has been severed *)
+		EPROTO* = 92; (* Protocol error *)
+		ENOTBLK* = 15; (* Block device required *)
+		ETXTBSY* = 26; (* Text file busy *)
+		EWOULDBLOCK* = EAGAIN; (* Operation would block *)
+		EINPROGRESS* = 36; (* Operation now in progress *)
+		EALREADY* = 37; (* Operation already in progress *)
+		ENOTSOCK* = 38; (* Socket operation on non-socket *)
+		EDESTADDRREQ* = 39; (* Destination address required *)
+		EMSGSIZE* = 40; (* Message too long *)
+		EPROTOTYPE* = 41; (* Protocol wrong type for socket *)
+		ENOPROTOOPT* = 42; (* Protocol not available *)
+		EPROTONOSUPPORT* = 43; (* Protocol not supported *)
+		ESOCKTNOSUPPORT* = 44; (* Socket type not supported *)
+		EOPNOTSUPP* = 45; (* Operation not supported *)
+		ENOTSUP* = EOPNOTSUPP; (* Operation not supported *)
+		EPFNOSUPPORT* = 46; (* Protocol family not supported *)
+		EAFNOSUPPORT* = 47; (* Address family not supported by protocol family *)
+		EADDRINUSE* = 48; (* Address already in use *)
+		EADDRNOTAVAIL* = 49; (* Can't assign requested address *)
+		ENETDOWN* = 50; (* Network is down *)
+		ENETUNREACH* = 51; (* Network is unreachable *)
+		ENETRESET* = 52; (* Network dropped connection on reset *)
+		ECONNABORTED* = 53; (* Software caused connection abort *)
+		ECONNRESET* = 54; (* Connection reset by peer *)
+		ENOBUFS* = 55; (* No buffer space available *)
+		EISCONN* = 56; (* Socket is already connected *)
+		ENOTCONN* = 57; (* Socket is not connected *)
+		ESHUTDOWN* = 58; (* Can't send after socket shutdown *)
+		ETOOMANYREFS* = 59; (* Too many references: can't splice *)
+		ETIMEDOUT* = 60; (* Operation timed out *)
+		ECONNREFUSED* = 61; (* Connection refused *)
+		ELOOP* = 62; (* Too many levels of symbolic links *)
+		EHOSTDOWN* = 64; (* Host is down *)
+		EHOSTUNREACH* = 65; (* No route to host *)
+		EPROCLIM* = 67; (* Too many processes *)
+		EUSERS* = 68; (* Too many users *)
+		EDQUOT* = 69; (* Disc quota exceeded *)
+		ESTALE* = 70; (* Stale NFS file handle *)
+		EREMOTE* = 71; (* Too many levels of remote in path *)
+		EBADRPC* = 72; (* RPC struct is bad *)
+		ERPCMISMATCH* = 73; (* RPC version wrong *)
+		EPROGUNAVAIL* = 74; (* RPC prog. not avail *)
+		EPROGMISMATCH* = 75; (* Program version wrong *)
+		EPROCUNAVAIL* = 76; (* Bad procedure for program *)
+		EFTYPE* = 79; (* Inappropriate file type or format *)
+		EAUTH* = 80; (* Authentication error *)
+		ENEEDAUTH* = 81; (* Need authenticator *)
+		EIDRM* = 82; (* Identifier removed *)
+		ENOMSG* = 83; (* No message of desired type *)
+		EOVERFLOW* = 84; (* Value too large to be stored in data type *)
+		ECANCELED* = 85; (* Operation canceled *)
+		EILSEQ* = 86; (* Illegal byte sequence *)
+		ENOATTR* = 87; (* Attribute not found *)
+		EDOOFUS* = 88; (* Programming error *)
+		ENOTCAPABLE* = 93; (* Capabilities insufficient *)
+		ECAPMODE* = 94; (* Not permitted in capability mode *)
+		ELAST* = 94; (* Must be equal largest errno *)
+		ERESTART* = -1; (* restart syscall *)
+		EJUSTRETURN* = -2; (* don't modify regs, just return *)
+		ENOIOCTL* = -3; (* ioctl not handled by this layer *)
+		EDIRIOCTL* = -4; (* do direct ioctl in GEOM *)
+
+
+		NAME_MAX* = 255;
+
+		SEEK_SET* = 0;
+		SEEK_CUR* = 1;
+		SEEK_END* = 2;
+
+		P_tmpdir* = "/tmp";
+
+		(* O_RDWR, O_NONBLOCK (intFlags) *)
+		O_SHLOCK* = {4}; (* open with shared file lock *)
+		O_EXLOCK* = {5}; (* open with exclusive file lock *)
+		O_ASYNC* = {6}; (* signal pgrp when data ready *)
+		O_FSYNC* = {7}; (* synchronous writes *)
+		O_NOFOLLOW* = {8}; (* don't follow symlinks *)
+		O_DIRECT* = {16};
+		O_DIRECTORY* = {17}; (* Fail if not directory *)
+		O_EXEC* = {18}; (* Open for execute only *)
+		O_TTY_INIT* = {19}; (* Restore default termios attributes *)
+		O_CLOEXEC* = {20};
+		O_RDONLY* = {}; (* open for reading only *)
+		O_WRONLY* = {0}; (* open for writing only *)
+		O_RDWR* = {1}; (* open for reading and writing *)
+		O_ACCMODE* = {0,1}; (* mask for above modes *)
+		O_NONBLOCK* = {2}; (* no delay *)
+		O_APPEND* = {3}; (* set append mode *)
+		O_SYNC* = {7}; (* POSIX synonym for O_FSYNC *)
+		O_CREAT* = {9}; (* create if nonexistent *)
+		O_TRUNC* = {10}; (* truncate to zero length *)
+		O_EXCL* = {11}; (* error if already exists *)
+		O_NOCTTY* = {15}; (* don't assign controlling terminal *)
+
+
+	TYPE
+		StrArray* = POINTER TO ARRAY [untagged] OF PtrSTR;
+		PtrSTR* = POINTER TO ARRAY [untagged] OF SHORTCHAR;
+
+		(* PtrVoid, int, long, size_t, ssize_t, off_t, time_t, clock_t, sigjmp_buf *)
+		(* mode_t, intFlags, sigset_t (set) *)
+		PtrVoid* = INTEGER;
+		int* = INTEGER;
+		long* = INTEGER;
+		ulong* = INTEGER;
+		size_t* = INTEGER;
+		ssize_t* = INTEGER;
+		off_t* = LONGINT;
+		clock_t* = INTEGER;
+		time_t* = INTEGER;
+		mode_t* = SHORTINT;
+		pid_t* = INTEGER;
+		uid_t* = INTEGER;
+		gid_t* = INTEGER;
+		dev_t* = INTEGER;
+		ino_t* = INTEGER;
+		nlink_t* = SHORTINT;
+		int8_t* = SHORTCHAR;
+		uint8_t* = SHORTCHAR;
+		int16_t* = SHORTINT;
+		uint16_t* = SHORTINT;
+		int32_t* = INTEGER;
+		uint32_t* = INTEGER;
+		int64_t* = LONGINT;
+		uint64_t* = LONGINT;
+		wchar_t* = INTEGER;
+		sigset_t* = ARRAY [untagged] 4 OF SET;
+		sigjmp_buf* = ARRAY [untagged] 12 OF INTEGER;
+		intFlags* = SET;
+		blkcnt_t* = LONGINT;
+		blksize_t* = INTEGER;
+		fflags_t* = SET;
+
+
+		tm* = POINTER TO tmDesc;
+		tmDesc* = RECORD [untagged]
+			(* NOTE: check record size *)
+			(* tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec, tm_wday [ , tm_gmtoff ] *)
+			(* FreeBSD 9.0 /usr/include/time.h *)
+				tm_sec*: int; (* seconds after the minute [0-60] *)
+				tm_min*: int; (* minutes after the hour [0-59] *)
+				tm_hour*: int; (* hours since midnight [0-23] *)
+				tm_mday*: int; (* day of the month [1-31] *)
+				tm_mon*: int; (* months since January [0-11] *)
+				tm_year*: int; (* years since 1900 *)
+				tm_wday*: int; (* days since Sunday [0-6] *)
+				tm_yday*: int; (* days since January 1 [0-365] *)
+				tm_isdst*: int; (* Daylight Savings Time flag *)
+				tm_gmtoff*: long; (* offset from UTC in seconds *)
+				tm_zone*: PtrSTR; (* timezone abbreviation *)
+		END;
+
+		Ptrsiginfo_t* = POINTER TO siginfo_t;
+		siginfo_t = RECORD [untagged]
+			(* si_code, fault address *)
+			(* FreeBSD 9.0 /usr/include/sys/signal.h *)
+				si_signo*: int; (* signal number *)
+				si_errno*: int; (* errno association *)
+				si_code*: int; (* signal code *)
+				si_pid*: pid_t; (* sending process *)
+				si_uid*: uid_t; (* sender's ruid *)
+				si_status*: int; (* exit value *)
+				si_addr*: PtrVoid; (* faulting instruction *)
+(*
+				si_value*: sigval; (* signal value *)
+*)
+				si_value*: PtrVoid;
+				_reason*: RECORD [union]
+					_fault*: RECORD [untagged]
+						_trapno*: int; (* machine specific trap code *)
+					END;
+					_timer*: RECORD [untagged]
+						_timerid*: int;
+						_overrun*: int;
+					END;
+					_mesgq*: RECORD [untagged]
+						_mqd*: int;
+					END;
+					_poll*: RECORD [untagged]
+						_band*: long; (* band event for SIGPOLL *)
+					END;
+					__spare__: RECORD [untagged]
+						__spare1__: long;
+						__spare2__: ARRAY [untagged] 7 OF int;
+					END;
+				END;
+		END;
+
+		Ptrucontext_t* = POINTER TO ucontext_t;
+		ucontext_t = RECORD [untagged]
+			(* IP, SP, FP *)
+			(* FreeBSD 9.0 /usr/include/machine/signal.h *)
+				sc_mask*: sigset_t; (* signal mask to restore *)
+				sc_onstack*: int; (* sigstack state to restore *)
+				sc_gs*: int;  (* machine state (struct trapframe) *)
+				sc_fs*: int;
+				sc_es*: int;
+				sc_ds*: int;
+				sc_edi*: int;
+				sc_esi*: int;
+				sc_ebp*: int;
+				sc_isp*: int;
+				sc_ebx*: int;
+				sc_edx*: int;
+				sc_ecx*: int;
+				sc_eax*: int;
+				sc_trapno*: int;
+				sc_err*: int;
+				sc_eip*: int;
+				sc_cs*: int;
+				sc_efl*: int;
+				sc_esp*: int;
+				sc_ss*: int;
+				sc_len*: int; (* sizeof(mcontext_t) *)
+				
+				(*
+				 * XXX - See <machine/ucontext.h> and <machine/npx.h> for
+				 *       the following fields.
+				 *)
+				sc_fpformat: int;
+				sc_ownedfp: int;
+				sc_spare1: ARRAY [untagged] 1 OF int;
+				sc_fpstate: ARRAY [untagged] 128 OF int; (* FIXME: __aligned(16) *)
+				sc_fsbase: int;
+				sc_gsbase: int;
+				sc_spare2: ARRAY 6 OF int;
+		END;
+
+		sigaction_t* = RECORD [untagged]
+(*
+			sa_sigaction*: PROCEDURE [ccall] (sig: INTEGER; siginfo: Ptrsiginfo_t; context: Ptrucontext_t),
+			sa_flags*: intFlags, sa_mask*: sigset_t
+*)
+			(* FreeBSD 9.0 /usr/include/sys/signal.h *)
+				sa_sigaction*: PROCEDURE [ccall] (sig: int; siginfo: Ptrsiginfo_t; ptr: Ptrucontext_t); (* signal handler *)
+				sa_flags*: intFlags; (* see options *)
+				sa_mask*: sigset_t; (* signal mask to apply *)
+		END;
+
+		stack_t* = RECORD [untagged]
+(*
+			ss_sp*: PtrVoid, ss_size*: size_t, ss_flags*: intFlags
+*)
+			(* FreeBSD 9.0 /usr/include/sys/signal.h *)
+				ss_sp*: PtrVoid; (* signal stack base *)
+				ss_size*: size_t; (* signal stack length *)
+				ss_flags*: intFlags; (* SS_DISABLE and/or SS_ONSTACK *)
+		END;
+
+		stat_t* = RECORD [untagged]
+(*
+			NOTE: check record size
+			st_mode*: mode_t, st_size*: off_t, st_mtime*: time_t
+*)
+			(* FreeBSD 9.0 /usr/include/sys/stat.h *)
+				st_dev*: dev_t; (* inode's device *)
+				st_ino*: ino_t; (* inode's number *)
+				st_mode*: mode_t; (* inode protection mode *)
+				st_nlink*: nlink_t; (* number of hard links *)
+				st_uid*: uid_t; (* user ID of the file's owner *)
+				st_gid*: gid_t; (* group ID of the file's group *)
+				st_rdev*: dev_t; (* device type *)
+
+(*
+				st_atim: timespec_t; (* time of last access *)
+				st_mtim: timespec_t; (* time of last data modification *)
+				st_ctim: timespec_t; (* time of last file status change *)
+*)
+				st_atime*: time_t;
+				st_atimensec*: long;
+				st_mtime*: time_t;
+				st_mtimensec*: long;
+				st_ctime*: time_t;
+				st_ctimensec*: long;
+
+				st_size*: off_t; (* file size, in bytes *)
+				st_blocks*: blkcnt_t; (* blocks allocated for file *)
+				st_blksize*: blksize_t; (* optimal blocksize for I/O *)
+				st_flags*: fflags_t; (* user defined flags for file *)
+				st_gen*: uint32_t; (* file generation number *)
+				st_lspare*: int32_t;
+
+(*
+				st_birthtim: timespec_t; (* time of file creation *)
+*)
+				__st_birthtime*: time_t;
+				__st_birthtimensec*: long;
+
+				___pad: ARRAY [untagged] 2 OF INTEGER; (* FreeBSD 9.0: sizeof(struct stat) = 96 B *)
+		END;
+
+		PtrFILE* = PtrVoid;
+		PtrDIR* = PtrVoid;
+
+		PtrDirent* = POINTER TO Dirent;
+		Dirent = RECORD [untagged]
+(*
+			d_name*: ARRAY [untagged] NAME_MAX + 1 OF SHORTCHAR
+*)
+			(* FreeBSD 9.0 /usr/include/sys/dirent.h *)
+				d_fileno*: uint32_t; (* file number of entry *)
+				d_reclen*: uint16_t; (* length of this record *)
+				d_type*: uint8_t; (* file type, see below *)
+				d_namlen*: uint8_t; (* length of string in d_name *)
+				d_name*: ARRAY [untagged] 255 + 1 (* 256 *) OF SHORTCHAR;
+		END;
+
+(*
+	VAR
+		stdin*: INTEGER;
+		timezone*: INTEGER; (* or tm.tm_gmtoff *)
+*)
+(*
+	PROCEDURE [ccall] __errno_location* (): PtrVoid;
+*)
+(*
+	(* POSIX.1 *)
+		PROCEDURE [ccall] stat* (path: PtrSTR; VAR sp: stat_t): int;
+*)
+	VAR
+		errno*: INTEGER;
+		stdin* ["__stdinp"]: PtrFILE;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] stat* (path: PtrSTR; VAR sp: stat_t): int;
+
+
+	(* ANSI C 89 *)
+		PROCEDURE [ccall] clock* (): clock_t;
+
+	PROCEDURE [ccall] mmap* (adr: PtrVoid; len: size_t; prot: intFlags; flags: intFlags; fd: int; offset: off_t): PtrVoid;
+	(* BSD *)
+		PROCEDURE [ccall] munmap* (adr: PtrVoid; len: size_t): int;
+		PROCEDURE [ccall] mprotect* (adr: PtrVoid; len: size_t; prot: intFlags): int;
+
+(*
+	PROCEDURE [ccall] calloc* (nmemb: size_t; size: size_t): PtrVoid;
+	(* ANSI C 89 *)
+		PROCEDURE [ccall] malloc* (size: size_t): PtrVoid;
+*)
+		PROCEDURE [ccall] free* (ptr: PtrVoid);
+
+	(* AT&T *)
+		PROCEDURE [ccall] time* (VAR [nil] t: time_t): time_t;
+	PROCEDURE [ccall] gmtime* (VAR [nil] t: time_t): tm;
+	PROCEDURE [ccall] localtime* (VAR [nil] t: time_t): tm;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] sigsetjmp* (VAR env: sigjmp_buf; savemask: int): int;
+		PROCEDURE [ccall] siglongjmp* (VAR env: sigjmp_buf; val: int);
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] sigemptyset* (VAR set: sigset_t): int;
+		PROCEDURE [ccall] sigfillset* (VAR set: sigset_t): int;
+		PROCEDURE [ccall] sigaddset* (VAR set: sigset_t; signo: int): int;
+		PROCEDURE [ccall] sigprocmask* (how: int; VAR [nil] set: sigset_t; VAR [nil] oset: sigset_t): int;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] sigaction* (sig: int; VAR [nil] act: sigaction_t; VAR [nil] oact: sigaction_t): int;
+
+	(* BSD *)
+		PROCEDURE [ccall] sigaltstack* (VAR [nil] ss: stack_t; VAR [nil] oss: stack_t): int;
+
+	(* ANSI C 89 *)
+		PROCEDURE [ccall] getenv* (s: PtrSTR): PtrSTR;
+
+	(* ANSI C 89 *)
+		PROCEDURE [ccall] fopen* (path, mode: PtrSTR): PtrFILE;
+		PROCEDURE [ccall] fclose* (stream: PtrFILE): int;
+		PROCEDURE [ccall] fread* (ptr: PtrVoid; size: size_t; nmemb: size_t; stream: PtrFILE): size_t;
+		PROCEDURE [ccall] fwrite* (ptr: PtrVoid; size: size_t; nmemb: size_t; stream: PtrFILE): size_t;
+		PROCEDURE [ccall] fflush* (s: PtrFILE): int;
+		PROCEDURE [ccall] printf* (s: PtrSTR): int;
+	(* ANSI C 89, XPG4 *)
+		PROCEDURE [ccall] fseek* (stream: PtrFILE; offset: long; whence: int): int;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] rename* (from, to: PtrSTR): int;
+		PROCEDURE [ccall] mkdir* (path: PtrSTR; mode: mode_t): int;
+		PROCEDURE [ccall] opendir* (filename: PtrSTR): PtrDIR;
+		PROCEDURE [ccall] readdir* (dirp: PtrDIR): PtrDirent;
+		PROCEDURE [ccall] closedir* (dirp: PtrDIR): int;
+	(* ANSI C 89, XPG4.2 *)
+		PROCEDURE [ccall] remove* (path: PtrSTR): int;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] getcwd* (buf: PtrSTR; size: size_t): PtrSTR;
+
+	(* ANSI C 99 *)
+		PROCEDURE [ccall] exit* (status: int);
+
+	(* ANSI C 89 *)
+		PROCEDURE [ccall] strftime* (buf: PtrSTR; maxsize: size_t; format: PtrSTR; timeptr: tm): size_t;
+
+	(* XXX: use fread instead *)
+		PROCEDURE [ccall] fgets* (str: PtrSTR; size: int; stream: PtrFILE): PtrSTR;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] open* (path: PtrSTR; flags: intFlags; mode: mode_t): int;
+		PROCEDURE [ccall] write* (d: int; buf: PtrVoid; nbytes: size_t): ssize_t;
+		PROCEDURE [ccall] read* (d: int; buf: PtrVoid; nbytes: size_t): ssize_t;
+		PROCEDURE [ccall] close* (d: int): int;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] sysconf* (name: int): long;
+
+END LinLibc.

+ 74 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/Makefile

@@ -0,0 +1,74 @@
+# This is BSD Makefile
+#    BSD       GNU
+# ${.TARGET}    $@
+# ${.ALLSRC}    $^
+# ${.IMPSRC}    $<
+
+PY = python2.7
+
+DEFS = clockspersec defs-map defs-prot defs-sigmask defs-signo defs-fpe defs-sa defs-errno namemax defs-fcntlo defs-basictypes defs-sc
+
+all: Libc.txt ${DEFS} strerrnocase.txt
+
+Libc.txt: Libc.txt.templ ${DEFS} libver osname machine custom fields-dirent fields-sigaction fields-siginfo fields-stack fields-stat fields-tm fields-ucontext
+	${PY} ./untempl.py Libc.txt.templ ${.TARGET}
+
+clockspersec: /usr/include/time.h
+	grep CLOCKS_PER_SEC ${.ALLSRC} | head -1 | awk '{print $$3}' | tr -d '\n' > ${.TARGET}
+
+defs-map: /usr/include/sys/mman.h
+	./dumpdefs.py 2 1 s ${.ALLSRC} | grep "	MAP_" > ${.TARGET}
+	./dumpdefs.py 2 2 s ${.ALLSRC} | grep "	MAP_" >> ${.TARGET}
+
+defs-prot: /usr/include/sys/mman.h
+	./dumpdefs.py 2 1 s ${.ALLSRC} | grep "	PROT_" > ${.TARGET}
+
+defs-sigmask: /usr/include/sys/signal.h
+	./dumpdefs.py 2 2 i ${.ALLSRC} | grep "	SIG_" > ${.TARGET}
+
+defs-signo: /usr/include/sys/signal.h
+	./dumpdefs.py 2 1 i ${.ALLSRC} | grep "	SIG" > ${.TARGET}
+	./dumpdefs.py 2 2 i ${.ALLSRC} | grep "	SIG" | grep -v SIG_ >> ${.TARGET}
+
+defs-fpe: /usr/include/sys/signal.h
+	./dumpdefs.py 2 2 i ${.ALLSRC} | grep "	FPE_" > ${.TARGET}
+
+defs-sa: /usr/include/sys/signal.h
+	./dumpdefs.py 2 2 s ${.ALLSRC} | grep "	SA_" > ${.TARGET}
+
+defs-errno: /usr/include/sys/errno.h
+	./dumpdefs.py 2 0 i ${.ALLSRC} > ${.TARGET}
+	./dumpdefs.py 2 1 i ${.ALLSRC} >> ${.TARGET}
+	./dumpdefs.py 2 2 i ${.ALLSRC} >> ${.TARGET}
+
+namemax: /usr/include/sys/syslimits.h
+	grep "	NAME_MAX	" ${.ALLSRC} | head -1 | awk '{print $$3}' | tr -d '\n' > ${.TARGET}
+
+defs-fcntlo: /usr/include/fcntl.h
+	./dumpdefs.py 2 2 s ${.ALLSRC} | grep -v compat | grep "	O_" > ${.TARGET}
+	./dumpdefs.py 2 1 s ${.ALLSRC} | grep "	O_" >> ${.TARGET}
+
+defs-basictypes: sizeofs
+	./sizeofs > ${.TARGET}
+
+defs-sc: /usr/include/unistd.h
+	./dumpdefs.py 2 1 i ${.ALLSRC} | grep _SC_ > ${.TARGET}
+	./dumpdefs.py 2 2 i ${.ALLSRC} | grep _SC_ > ${.TARGET}
+
+#defs-madv:
+#	./dumpdefs.py 2 1 i /usr/include/sys/mman.h | grep MADV | sed 's/_//' > ${.TARGET}
+#	./dumpdefs.py 2 2 i /usr/include/sys/mman.h | grep MADV >> ${.TARGET}
+#
+#defs-signal1:
+#	./dumpdefs.py 2 2 i /usr/include/sys/signal.h | grep ILL_ >> ${.TARGET}
+#	./dumpdefs.py 2 2 i /usr/include/sys/signal.h | grep SEGV_ >> ${.TARGET}
+#	./dumpdefs.py 2 2 i /usr/include/sys/signal.h | grep BUS_ >> ${.TARGET}
+
+dumpstrerrno.c: defs-errno
+	grep -v ERESTART ${.ALLSRC} | grep -v EJUSTRETURN | grep -v ENOIOCTL | grep -v EDIRIOCTL | ./mkdumpstrerrno.py > ${.TARGET}
+
+strerrnocase.txt: dumpstrerrno
+	./dumpstrerrno | ./mkstrerrnocase.py > ${.TARGET}
+
+clean:
+	rm -f ${DEFS} Libc.txt dumpstrerrno dumpstrerrno.c strerrnocase.txt sizeofs

+ 6 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/custom

@@ -0,0 +1,6 @@
+	VAR
+		errno*: INTEGER;
+		stdin* ["__stdinp"]: PtrFILE;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] stat* (path: PtrSTR; VAR sp: stat_t): int;

+ 1 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/dumpdefs.py

@@ -0,0 +1 @@
+../../../../_OpenBSD_/Lin/Mod/gen-Libc/dumpdefs.py

+ 6 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/fields-dirent

@@ -0,0 +1,6 @@
+			(* FreeBSD 9.0 /usr/include/sys/dirent.h *)
+				d_fileno*: uint32_t; (* file number of entry *)
+				d_reclen*: uint16_t; (* length of this record *)
+				d_type*: uint8_t; (* file type, see below *)
+				d_namlen*: uint8_t; (* length of string in d_name *)
+				d_name*: ARRAY [untagged] 255 + 1 (* 256 *) OF SHORTCHAR;

+ 4 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/fields-sigaction

@@ -0,0 +1,4 @@
+			(* FreeBSD 9.0 /usr/include/sys/signal.h *)
+				sa_sigaction*: PROCEDURE [ccall] (sig: int; siginfo: Ptrsiginfo_t; ptr: Ptrucontext_t); (* signal handler *)
+				sa_flags*: intFlags; (* see options *)
+				sa_mask*: sigset_t; (* signal mask to apply *)

+ 31 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/fields-siginfo

@@ -0,0 +1,31 @@
+			(* FreeBSD 9.0 /usr/include/sys/signal.h *)
+				si_signo*: int; (* signal number *)
+				si_errno*: int; (* errno association *)
+				si_code*: int; (* signal code *)
+				si_pid*: pid_t; (* sending process *)
+				si_uid*: uid_t; (* sender's ruid *)
+				si_status*: int; (* exit value *)
+				si_addr*: PtrVoid; (* faulting instruction *)
+(*
+				si_value*: sigval; (* signal value *)
+*)
+				si_value*: PtrVoid;
+				_reason*: RECORD [union]
+					_fault*: RECORD [untagged]
+						_trapno*: int; (* machine specific trap code *)
+					END;
+					_timer*: RECORD [untagged]
+						_timerid*: int;
+						_overrun*: int;
+					END;
+					_mesgq*: RECORD [untagged]
+						_mqd*: int;
+					END;
+					_poll*: RECORD [untagged]
+						_band*: long; (* band event for SIGPOLL *)
+					END;
+					__spare__: RECORD [untagged]
+						__spare1__: long;
+						__spare2__: ARRAY [untagged] 7 OF int;
+					END;
+				END;

+ 4 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/fields-stack

@@ -0,0 +1,4 @@
+			(* FreeBSD 9.0 /usr/include/sys/signal.h *)
+				ss_sp*: PtrVoid; (* signal stack base *)
+				ss_size*: size_t; (* signal stack length *)
+				ss_flags*: intFlags; (* SS_DISABLE and/or SS_ONSTACK *)

+ 35 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/fields-stat

@@ -0,0 +1,35 @@
+			(* FreeBSD 9.0 /usr/include/sys/stat.h *)
+				st_dev*: dev_t; (* inode's device *)
+				st_ino*: ino_t; (* inode's number *)
+				st_mode*: mode_t; (* inode protection mode *)
+				st_nlink*: nlink_t; (* number of hard links *)
+				st_uid*: uid_t; (* user ID of the file's owner *)
+				st_gid*: gid_t; (* group ID of the file's group *)
+				st_rdev*: dev_t; (* device type *)
+
+(*
+				st_atim: timespec_t; (* time of last access *)
+				st_mtim: timespec_t; (* time of last data modification *)
+				st_ctim: timespec_t; (* time of last file status change *)
+*)
+				st_atime*: time_t;
+				st_atimensec*: long;
+				st_mtime*: time_t;
+				st_mtimensec*: long;
+				st_ctime*: time_t;
+				st_ctimensec*: long;
+
+				st_size*: off_t; (* file size, in bytes *)
+				st_blocks*: blkcnt_t; (* blocks allocated for file *)
+				st_blksize*: blksize_t; (* optimal blocksize for I/O *)
+				st_flags*: fflags_t; (* user defined flags for file *)
+				st_gen*: uint32_t; (* file generation number *)
+				st_lspare*: int32_t;
+
+(*
+				st_birthtim: timespec_t; (* time of file creation *)
+*)
+				__st_birthtime*: time_t;
+				__st_birthtimensec*: long;
+
+				___pad: ARRAY [untagged] 2 OF INTEGER; (* FreeBSD 9.0: sizeof(struct stat) = 96 B *)

+ 12 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/fields-tm

@@ -0,0 +1,12 @@
+			(* FreeBSD 9.0 /usr/include/time.h *)
+				tm_sec*: int; (* seconds after the minute [0-60] *)
+				tm_min*: int; (* minutes after the hour [0-59] *)
+				tm_hour*: int; (* hours since midnight [0-23] *)
+				tm_mday*: int; (* day of the month [1-31] *)
+				tm_mon*: int; (* months since January [0-11] *)
+				tm_year*: int; (* years since 1900 *)
+				tm_wday*: int; (* days since Sunday [0-6] *)
+				tm_yday*: int; (* days since January 1 [0-365] *)
+				tm_isdst*: int; (* Daylight Savings Time flag *)
+				tm_gmtoff*: long; (* offset from UTC in seconds *)
+				tm_zone*: PtrSTR; (* timezone abbreviation *)

+ 35 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/fields-ucontext

@@ -0,0 +1,35 @@
+			(* FreeBSD 9.0 /usr/include/machine/signal.h *)
+				sc_mask*: sigset_t; (* signal mask to restore *)
+				sc_onstack*: int; (* sigstack state to restore *)
+				sc_gs*: int;  (* machine state (struct trapframe) *)
+				sc_fs*: int;
+				sc_es*: int;
+				sc_ds*: int;
+				sc_edi*: int;
+				sc_esi*: int;
+				sc_ebp*: int;
+				sc_isp*: int;
+				sc_ebx*: int;
+				sc_edx*: int;
+				sc_ecx*: int;
+				sc_eax*: int;
+				sc_trapno*: int;
+				sc_err*: int;
+				sc_eip*: int;
+				sc_cs*: int;
+				sc_efl*: int;
+				sc_esp*: int;
+				sc_ss*: int;
+				sc_len*: int; (* sizeof(mcontext_t) *)
+				
+				(*
+				 * XXX - See <machine/ucontext.h> and <machine/npx.h> for
+				 *       the following fields.
+				 *)
+				sc_fpformat: int;
+				sc_ownedfp: int;
+				sc_spare1: ARRAY [untagged] 1 OF int;
+				sc_fpstate: ARRAY [untagged] 128 OF int; (* FIXME: __aligned(16) *)
+				sc_fsbase: int;
+				sc_gsbase: int;
+				sc_spare2: ARRAY 6 OF int;

+ 1 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/libver

@@ -0,0 +1 @@
+.7

+ 1 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/machine

@@ -0,0 +1 @@
+i386

+ 1 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/mkdumpstrerrno.py

@@ -0,0 +1 @@
+../../../../_OpenBSD_/Lin/Mod/gen-Libc/mkdumpstrerrno.py

+ 1 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/mkstrerrnocase.py

@@ -0,0 +1 @@
+../../../../_OpenBSD_/Lin/Mod/gen-Libc/mkstrerrnocase.py

+ 1 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/nsig

@@ -0,0 +1 @@
+SIGTHR + 1

+ 1 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/osname

@@ -0,0 +1 @@
+FreeBSD 9.0

+ 1 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/sigstksz

@@ -0,0 +1 @@
+512 * 4 + 32768 (* FreeBSD 9.0 /usr/include/sys/signal.h *)

+ 88 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/sizeofs.c

@@ -0,0 +1,88 @@
+#include <sys/types.h>
+#include <sys/signal.h>
+#include <setjmp.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#define TABS "\t\t"
+
+#define FALSE (0)
+#define TRUE (1)
+
+static void D (const char *s, int sz, int set, int export)
+{
+	int res;
+
+	res = printf("%s%s", TABS, s);
+	if (export) {
+		res = printf("*");
+	}
+	res = printf(" = ");
+	if (sz == 1) {
+		res = printf("SHORTCHAR");
+	} else if (sz == 2) {
+		res = printf("SHORTINT");
+	} else if (sz == 4) {
+		if (set) {
+			res = printf("SET");
+		} else {
+			res = printf("INTEGER");
+		}
+	} else if (sz == 8) {
+		if (set) {
+			res = printf("ARRAY [untagged] 2 OF SET");
+		} else {
+			res = printf("LONGINT");
+		}
+	} else {
+		res = printf("ARRAY [untagged] ");
+		if (sz % 4 == 0) {
+			if (set) {
+				res = printf("%d OF SET", sz / 4);
+			} else {
+				res = printf("%d OF INTEGER", sz / 4);
+			}
+		} else {
+			res = printf("%d OF SHORTCHAR", sz);
+		}
+	}
+	res = printf(";\n");
+}
+
+int main ()
+{
+	D("PtrVoid", sizeof(void *), FALSE, TRUE);
+	D("int", sizeof(int), FALSE, TRUE);
+	D("long", sizeof(long), FALSE, TRUE);
+	D("ulong", sizeof(unsigned long), FALSE, TRUE);
+	D("size_t", sizeof(size_t), FALSE, TRUE);
+	D("ssize_t", sizeof(ssize_t), FALSE, TRUE);
+	D("off_t", sizeof(off_t), FALSE, TRUE);
+	D("clock_t", sizeof(clock_t), FALSE, TRUE);
+	D("time_t", sizeof(time_t), FALSE, TRUE);
+	D("mode_t", sizeof(mode_t), TRUE, TRUE);
+	D("pid_t", sizeof(pid_t), FALSE, TRUE);
+	D("uid_t", sizeof(uid_t), FALSE, TRUE);
+	D("gid_t", sizeof(gid_t), FALSE, TRUE);
+	D("dev_t", sizeof(dev_t), FALSE, TRUE);
+	D("ino_t", sizeof(ino_t), FALSE, TRUE);
+	D("nlink_t", sizeof(nlink_t), FALSE, TRUE);
+	D("int8_t", sizeof(int8_t), FALSE, TRUE);
+	D("uint8_t", sizeof(u_int8_t), FALSE, TRUE);
+	D("int16_t", sizeof(int16_t), FALSE, TRUE);
+	D("uint16_t", sizeof(u_int16_t), FALSE, TRUE);
+	D("int32_t", sizeof(int32_t), FALSE, TRUE);
+	D("uint32_t", sizeof(u_int32_t), FALSE, TRUE);
+	D("int64_t", sizeof(int64_t), FALSE, TRUE);
+	D("uint64_t", sizeof(u_int64_t), FALSE, TRUE);
+	D("wchar_t", sizeof(wchar_t), FALSE, TRUE);
+	D("sigset_t", sizeof(sigset_t), TRUE, TRUE);
+	D("sigjmp_buf", sizeof(sigjmp_buf), FALSE, TRUE);
+	D("intFlags", sizeof(int), TRUE, TRUE);
+	/* D("FILE", sizeof(FILE), FALSE, FALSE); */
+	D("blkcnt_t", sizeof(blkcnt_t), FALSE, TRUE);
+	D("blksize_t", sizeof(blksize_t), FALSE, TRUE);
+	D("fflags_t", sizeof(fflags_t), TRUE, TRUE);
+
+	return 0;
+}

+ 1 - 0
new/_FreeBSD_/Lin/Mod/gen-Libc/untempl.py

@@ -0,0 +1 @@
+../../../../_OpenBSD_/Lin/Mod/gen-Libc/untempl.py

+ 15 - 0
new/_FreeBSD_/Lin/Rsrc/loader/Makefile

@@ -0,0 +1,15 @@
+# This is BSD Makefile
+#    BSD       GNU
+# ${.TARGET}    $@
+# ${.ALLSRC}    $^
+# ${.IMPSRC}    $<
+
+CFLAGS += -Wall -O0 -g
+
+all: loader
+
+loader: loader.c
+	${CC} ${CFLAGS} -o ${.TARGET} ${.ALLSRC}
+
+clean:
+	rm -f loader

BIN
new/_FreeBSD_/Lin/Rsrc/loader/loader


BIN
new/_FreeBSD_/System/Mod/Kernel.odc


BIN
new/_FreeBSD_/libBB.so


BIN
new/_FreeBSD_/libBB0.so


+ 1 - 0
new/_FreeBSD_/loader

@@ -0,0 +1 @@
+Lin/Rsrc/loader/loader

BIN
new/_Linux_/Host/Mod/Console.odc


+ 1 - 0
new/_Linux_/Lin/Mod/gen-Libc/mkdumpstrerrno.py

@@ -0,0 +1 @@
+../../../../_OpenBSD_/Lin/Mod/gen-Libc/mkdumpstrerrno.py

+ 1 - 0
new/_Linux_/Lin/Mod/gen-Libc/mkstrerrnocase.py

@@ -0,0 +1 @@
+../../../../_OpenBSD_/Lin/Mod/gen-Libc/mkstrerrnocase.py

+ 1 - 1
new/_Linux_/Lin/Mod/gen-Net/Makefile

@@ -1,6 +1,6 @@
 # This is GNU Makefile
 #    BSD       GNU
-# $@    $@
+# ${.TARGET}    $@
 # ${.ALLSRC}    $^
 # ${.IMPSRC}    $<
 

BIN
new/_Linux_/System/Mod/Kernel.odc


+ 0 - 2
new/_OpenBSD_/Lin/Mod/Dl.txt

@@ -7,8 +7,6 @@ MODULE LinDl ["ld.so"];
 		32-bit
 	*)
 
-	IMPORT SYSTEM;
-
 	CONST
 		NULL* = 0H;
 

+ 457 - 606
new/_OpenBSD_/Lin/Mod/Libc.txt

@@ -1,43 +1,73 @@
 MODULE LinLibc ["libc.so.66.0"];
 
 	(*
-		A. V. Shiryaev, 2012.11
-
-		Based on Linux' LinLibc (OpenBUGS Lin/Mod/Libc.odc)
-
 		OpenBSD 5.2
-		32-bit
+		i386
 	*)
 
-	IMPORT SYSTEM;
-
 	CONST
 		NULL* = 0H;
-		TRUE* = 1;
 		FALSE* = 0;
+		TRUE* = 1;
 
-		(* file constants *)
-		SEEK_SET* = 0;
-		SEEK_CUR* = 1;
-		SEEK_END* = 2;
-		NAME_MAX* = 255; (* OpenBSD /usr/include/sys/syslimits.h *)
+		CLOCKS_PER_SEC* = 100;
 
-		(* The value of CLOCKS_PER_SEC is required to be 1 million on all   XSI-conformant systems.*)
-		CLOCKS_PER_SEC* = 100; (* OpenBSD 5.2 /usr/include/time.h CLOCKS_PER_SEC *)
+		MAP_FAILED* = -1;
 
-		(* temp directory defined in stdio.h *)
-		P_tmpdir* = "/tmp";
+		(* MAP_PRIVATE, MAP_ANON (intFlags) *)
+		MAP_SHARED* = {0}; (* share changes *)
+		MAP_PRIVATE* = {1}; (* changes are private *)
+		MAP_COPY* = {2}; (* "copy" region at mmap time *)
+		MAP_FIXED* = {4}; (* map addr must be exactly as requested *)
+		MAP_RENAME* = {5}; (* Sun: rename private pages to file *)
+		MAP_NORESERVE* = {6}; (* Sun: don't reserve needed swap area *)
+		MAP_INHERIT* = {7}; (* region is retained after exec *)
+		MAP_NOEXTEND* = {8}; (* for MAP_FILE, don't change file size *)
+		MAP_HASSEMAPHORE* = {9}; (* region may contain semaphores *)
+		MAP_TRYFIXED* = {10}; (* attempt hint address, even within heap *)
+		MAP_FILE* = {}; (* map from file (default) *)
+		MAP_ANON* = {12}; (* allocated from memory, swap space *)
+		MAP_FLAGMASK* = {0..2,4..12};
+		MAP_INHERIT_SHARE* = {}; (* share with child *)
+		MAP_INHERIT_COPY* = {0}; (* copy into child *)
+		MAP_INHERIT_NONE* = {1}; (* absent from child *)
+
+
+		(* PROT_READ, PROT_WRITE, PROT_EXEC (intFlags) *)
+		PROT_NONE* = {}; (* no permissions *)
+		PROT_READ* = {0}; (* pages can be read *)
+		PROT_WRITE* = {1}; (* pages can be written *)
+		PROT_EXEC* = {2}; (* pages can be executed *)
+
+
+		(* SIG_UNBLOCK, SIG_SETMASK (int) *)
+		SIG_BLOCK* = 1; (* block specified signal set *)
+		SIG_UNBLOCK* = 2; (* unblock specified signal set *)
+		SIG_SETMASK* = 3; (* set specified signal set *)
+
+
+		(* FPE_INTDIV, FPE_INTOVF, FPE_FLTDIV, FPE_FLTOVF, FPE_FLTUND, FPE_FLTRES, FPE_FLTINV, FPE_FLTSUB (int) *)
+		FPE_INTDIV* = 1; (* integer divide by zero *)
+		FPE_INTOVF* = 2; (* integer overflow *)
+		FPE_FLTDIV* = 3; (* floating point divide by zero *)
+		FPE_FLTOVF* = 4; (* floating point overflow *)
+		FPE_FLTUND* = 5; (* floating point underflow *)
+		FPE_FLTRES* = 6; (* floating point inexact result *)
+		FPE_FLTINV* = 7; (* invalid floating point operation *)
+		FPE_FLTSUB* = 8; (* subscript out of range *)
+
+
+		(* SA_SIGINFO (intFlags) *)
+		SA_NOCLDSTOP* = {3}; (* do not generate SIGCHLD on child stop *)
+		SA_ONSTACK* = {0}; (* take signal on signal stack *)
+		SA_RESTART* = {1}; (* restart system on signal return *)
+		SA_RESETHAND* = {2}; (* reset to SIG_DFL when taking signal *)
+		SA_NODEFER* = {4}; (* don't mask the signal we're delivering *)
+		SA_NOCLDWAIT* = {5}; (* don't create zombies (assign to pid 1) *)
+		SA_SIGINFO* = {6}; (* generate siginfo_t *)
 
-		(* signal constants *)	(* Fake signal functions.  *)
-		(* OpenBSD 5.2 /usr/include/sys/signal.h *)
-		SIG_ERR* = -1; 	(* Error return.  *)
-		SIG_DFL* = 0;   	(* Default action.  *)
-		SIG_IGN* = 1;    	(* Ignore signal.  *)
-		SIG_HOLD* = 3;	(* Add signal to hold mask.  *) (* OpenBSD 5.2 /usr/include/sys/signalvar.h *)
 
-		(* Signals. *)
-		(* OpenBSD /usr/include/sys/signal.h *)
-		_NSIG* = 33; (* counting 0 (mask is 1-32) *)
+		(* SIGINT, SIGILL, SIGFPE, SIGSEGV, SIGKILL, SIGSTOP, SIGWINCH, SIGTHR (int) *)
 		SIGHUP* = 1; (* hangup *)
 		SIGINT* = 2; (* interrupt *)
 		SIGQUIT* = 3; (* quit *)
@@ -68,201 +98,11 @@ MODULE LinLibc ["libc.so.66.0"];
 		SIGWINCH* = 28; (* window size changes *)
 		SIGTHR* = 32; (* thread library AST *)
 
-		(* Bits in `sa_flags'. *)
-		SA_NOCLDSTOP* = {3}; (* do not generate SIGCHLD on child stop *)
-		SA_ONSTACK* = {0}; (* take signal on signal stack *)
-		SA_RESTART* = {1}; (* restart system on signal return *)
-		SA_RESETHAND* = {2}; (* reset to SIG_DFL when taking signal *)
-		SA_NODEFER* = {4}; (* don't mask the signal we're delivering *)
-		SA_NOCLDWAIT* = {5}; (* don't create zombies (assign to pid 1) *)
-		SA_SIGINFO* = {6}; (* generate siginfo_t *)
+		_NSIG* = 33;
 
-		(* Some aliases for the SA_ constants.  *)
 (*
-		SA_NOMASK* = SA_NODEFER;
-		SA_ONESHOT* = SA_RESETHAND;
-		SA_STACK* = SA_ONSTACK;
+		PAGE_SIZE* = 4096;
 *)
-
-		(* code values for siginfo_t.si_code *) 
-		(* OpenBSD /usr/include/sys/siginfo.h *)
-		FPE_INTDIV* = 1; (* integer divide by zero *)
-		FPE_INTOVF* = 2; (* integer overflow *)
-		FPE_FLTDIV* = 3; (* floating point divide by zero *)
-		FPE_FLTOVF* = 4; (* floating point overflow *)
-		FPE_FLTUND* = 5; (* floating point underflow *)
-		FPE_FLTRES* = 6; (* floating point inexact result *)
-		FPE_FLTINV* = 7; (* invalid floating point operation *)
-		FPE_FLTSUB* = 8; (* subscript out of range *)
-		ILL_ILLOPC* = 1; (* illegal opcode *)
-		ILL_ILLOPN* = 2; (* illegal operand *)
-		ILL_ILLADR* = 3; (* illegal addressing mode *)
-		ILL_ILLTRP* = 4; (* illegal trap *)
-		ILL_PRVOPC* = 5; (* privileged opcode *)
-		ILL_PRVREG* = 6; (* privileged register *)
-		ILL_COPROC* = 7; (* co-processor *)
-		ILL_BADSTK* = 8; (* bad stack *)
-		SEGV_MAPERR* = 1; (* address not mapped to object *)
-		SEGV_ACCERR* = 2; (* invalid permissions *)
-		BUS_ADRALN* = 1; (* invalid address alignment *)
-		BUS_ADRERR* = 2; (* non-existent physical address *)
-		BUS_OBJERR* = 3; (* object specific hardware error *)
-
-
-		(* possible error constants for errno *)
-		(* /usr/include/sys/errno.h *)
-		EPERM* = 1; (* Operation not permitted *)
-		ENOENT* = 2; (* No such file or directory *)
-		ESRCH* = 3; (* No such process *)
-		EINTR* = 4; (* Interrupted system call *)
-		EIO* = 5; (* Input/output error *)
-		ENXIO* = 6; (* Device not configured *)
-		E2BIG* = 7; (* Argument list too long *)
-		ENOEXEC* = 8; (* Exec format error *)
-		EBADF* = 9; (* Bad file descriptor *)
-		ECHILD* = 10; (* No child processes *)
-		EDEADLK* = 11; (* Resource deadlock avoided *)
-		ENOMEM* = 12; (* Cannot allocate memory *)
-		EACCES* = 13; (* Permission denied *)
-		EFAULT* = 14; (* Bad address *)
-		EBUSY* = 16; (* Device busy *)
-		EEXIST* = 17; (* File exists *)
-		EXDEV* = 18; (* Cross-device link *)
-		ENODEV* = 19; (* Operation not supported by device *)
-		ENOTDIR* = 20; (* Not a directory *)
-		EISDIR* = 21; (* Is a directory *)
-		EINVAL* = 22; (* Invalid argument *)
-		ENFILE* = 23; (* Too many open files in system *)
-		EMFILE* = 24; (* Too many open files *)
-		ENOTTY* = 25; (* Inappropriate ioctl for device *)
-		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; (* Numerical argument out of domain *)
-		ERANGE* = 34; (* Result too large *)
-		EAGAIN* = 35; (* Resource temporarily unavailable *)
-		EWOULDBLOCK* = EAGAIN; (* Operation would block *)
-		EINPROGRESS* = 36; (* Operation now in progress *)
-		EALREADY* = 37; (* Operation already in progress *)
-		ENOTSOCK* = 38; (* Socket operation on non-socket *)
-		EDESTADDRREQ* = 39; (* Destination address required *)
-		EMSGSIZE* = 40; (* Message too long *)
-		EPROTOTYPE* = 41; (* Protocol wrong type for socket *)
-		ENOPROTOOPT* = 42; (* Protocol not available *)
-		EPROTONOSUPPORT* = 43; (* Protocol not supported *)
-		EOPNOTSUPP* = 45; (* Operation not supported *)
-		EAFNOSUPPORT* = 47; (* Address family not supported by protocol family *)
-		EADDRINUSE* = 48; (* Address already in use *)
-		EADDRNOTAVAIL* = 49; (* Can't assign requested address *)
-		ENETDOWN* = 50; (* Network is down *)
-		ENETUNREACH* = 51; (* Network is unreachable *)
-		ENETRESET* = 52; (* Network dropped connection on reset *)
-		ECONNABORTED* = 53; (* Software caused connection abort *)
-		ECONNRESET* = 54; (* Connection reset by peer *)
-		ENOBUFS* = 55; (* No buffer space available *)
-		EISCONN* = 56; (* Socket is already connected *)
-		ENOTCONN* = 57; (* Socket is not connected *)
-		ETIMEDOUT* = 60; (* Operation timed out *)
-		ECONNREFUSED* = 61; (* Connection refused *)
-		ELOOP* = 62; (* Too many levels of symbolic links *)
-		ENAMETOOLONG* = 63; (* File name too long *)
-		ENOTEMPTY* = 66; (* Directory not empty *)
-		EDQUOT* = 69; (* Disk quota exceeded *)
-		ESTALE* = 70; (* Stale NFS file handle *)
-		ENOLCK* = 77; (* No locks available *)
-		ENOSYS* = 78; (* Function not implemented *)
-		EILSEQ* = 84; (* Illegal byte sequence *)
-		EIDRM* = 89; (* Identifier removed *)
-		ENOMSG* = 90; (* No message of desired type *)
-		ENOTSUP* = 91; (* Not supported *)
-		ENOTBLK* = 15; (* Block device required *)
-		ESOCKTNOSUPPORT* = 44; (* Socket type not supported *)
-		EPFNOSUPPORT* = 46; (* Protocol family not supported *)
-		ESHUTDOWN* = 58; (* Can't send after socket shutdown *)
-		ETOOMANYREFS* = 59; (* Too many references: can't splice *)
-		EHOSTDOWN* = 64; (* Host is down *)
-		EHOSTUNREACH* = 65; (* No route to host *)
-		EPROCLIM* = 67; (* Too many processes *)
-		EUSERS* = 68; (* Too many users *)
-		EREMOTE* = 71; (* Too many levels of remote in path *)
-		EBADRPC* = 72; (* RPC struct is bad *)
-		ERPCMISMATCH* = 73; (* RPC version wrong *)
-		EPROGUNAVAIL* = 74; (* RPC prog. not avail *)
-		EPROGMISMATCH* = 75; (* Program version wrong *)
-		EPROCUNAVAIL* = 76; (* Bad procedure for program *)
-		EFTYPE* = 79; (* Inappropriate file type or format *)
-		EAUTH* = 80; (* Authentication error *)
-		ENEEDAUTH* = 81; (* Need authenticator *)
-		EIPSEC* = 82; (* IPsec processing failure *)
-		ENOATTR* = 83; (* Attribute not found *)
-		ENOMEDIUM* = 85; (* No medium found *)
-		EMEDIUMTYPE* = 86; (* Wrong Medium Type *)
-		EOVERFLOW* = 87; (* Conversion overflow *)
-		ECANCELED* = 88; (* Operation canceled *)
-		ELAST* = 91; (* Must be equal largest errno *)
-		ERESTART* = -1; (* restart syscall *)
-		EJUSTRETURN* = -2; (* don't modify regs, just return *)
-
-
-		(* OpenBSD 5.2 /usr/include/i386/setjmp.h *)
-		_JBLEN = 10;
-
-		(* OpenBSD 5.2 /usr/include/sys/mman.h *)
-		MAP_FAILED* = -1;
-		PROT_NONE* = {}; (* no permissions *)
-		PROT_READ* = {0}; (* pages can be read *)
-		PROT_WRITE* = {1}; (* pages can be written *)
-		PROT_EXEC* = {2}; (* pages can be executed *)
-		MAP_SHARED* = {0}; (* share changes *)
-		MAP_PRIVATE* = {1}; (* changes are private *)
-		MAP_COPY* = {2}; (* "copy" region at mmap time *)
-		MAP_FIXED* = {4}; (* map addr must be exactly as requested *)
-		MAP_RENAME* = {5}; (* Sun: rename private pages to file *)
-		MAP_NORESERVE* = {6}; (* Sun: don't reserve needed swap area *)
-		MAP_INHERIT* = {7}; (* region is retained after exec *)
-		MAP_NOEXTEND* = {8}; (* for MAP_FILE, don't change file size *)
-		MAP_HASSEMAPHORE* = {9}; (* region may contain semaphores *)
-		MAP_TRYFIXED* = {10}; (* attempt hint address, even within heap *)
-		MAP_FILE* = {}; (* map from file (default) *)
-		MAP_ANON* = {12}; (* allocated from memory, swap space *)
-		MAP_FLAGMASK* = {0..2,4..12};
-		MAP_INHERIT_SHARE* = {}; (* share with child *)
-		MAP_INHERIT_COPY* = {0}; (* copy into child *)
-		MAP_INHERIT_NONE* = {1}; (* absent from child *)
-
-
-		(* OpenBSD 5.2 /usr/include/i386/param.h *)
-		PAGE_SHIFT* = 12;
-		PAGE_SIZE* = 4096; (* LSL(1, PAGE_SHIFT) *)
-		PAGE_MASK* = PAGE_SIZE - 1;
-
-		(* OpenBSD 5.2: /usr/include/fcntl.h *)
-		O_SHLOCK* = {4}; (* open with shared file lock *)
-		O_EXLOCK* = {5}; (* open with exclusive file lock *)
-		O_ASYNC* = {6}; (* signal pgrp when data ready *)
-		O_NOFOLLOW* = {8}; (* if path is a symlink, don't follow *)
-		O_SYNC* = {7}; (* synchronous writes *)
-		O_RDONLY* = {}; (* open for reading only *)
-		O_WRONLY* = {0}; (* open for writing only *)
-		O_RDWR* = {1}; (* open for reading and writing *)
-		O_ACCMODE* = {0,1}; (* mask for above modes *)
-		O_NONBLOCK* = {2}; (* no delay *)
-		O_APPEND* = {3}; (* set append mode *)
-		O_CREAT* = {9}; (* create if nonexistent *)
-		O_TRUNC* = {10}; (* truncate to zero length *)
-		O_EXCL* = {11}; (* error if already exists *)
-		O_DSYNC* = O_SYNC; (* synchronous data writes *)
-		O_RSYNC* = O_SYNC; (* synchronous reads *)
-		O_NOCTTY* = {15}; (* don't assign controlling terminal *)
-		O_CLOEXEC* = {16}; (* atomically set FD_CLOEXEC *)
-		O_DIRECTORY* = {17}; (* fail if not a directory *)
-
-
-		(* OpenBSD 5.2 /usr/include/unistd.h *)
 		_SC_ARG_MAX* = 1;
 		_SC_CHILD_MAX* = 2;
 		_SC_CLK_TCK* = 3;
@@ -395,429 +235,440 @@ MODULE LinLibc ["libc.so.66.0"];
 		_SC_NPROCESSORS_ONLN* = 503;
 
 
-		(* OpenBSD 5.2 /usr/include/sys/mman.h *)
-		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 *)
-		MADV_SPACEAVAIL* = 5; (* insure that resources are reserved *)
-		MADV_FREE* = 6; (* pages are empty, free them *)
-
-		MADV_NORMAL* = POSIX_MADV_NORMAL;
-		MADV_RANDOM* = POSIX_MADV_RANDOM;
-		MADV_SEQUENTIAL* = POSIX_MADV_SEQUENTIAL;
-		MADV_WILLNEED* = POSIX_MADV_WILLNEED;
-		MADV_DONTNEED* = POSIX_MADV_DONTNEED;
-
-		(* OpenBSD 5.2 /usr/include/sys/signal.h *)
-		MINSIGSTKSZ* = 8192; (* minimum allowable stack *)
-		SIGSTKSZ* = MINSIGSTKSZ + 32768; (* recommended stack size *)
-
-		(* OpenBSD 5.2 /usr/include/sys/signal.h *)
-		SIG_BLOCK* = 1; (* block specified signal set *)
-		SIG_UNBLOCK* = 2; (* unblock specified signal set *)
-		SIG_SETMASK* = 3; (* set specified signal set *)
-
-
-	TYPE
-		(* OpenBSD OK *)
-		__ftw_func_t* = PROCEDURE (fileName: PtrSTR; VAR [nil] stat: stat_t; flag: INTEGER): INTEGER; (* OpenBSD 5.2: OK *)
-		PtrVoid* = INTEGER;
-		PtrSTR* = POINTER TO ARRAY [untagged] OF SHORTCHAR;
-		(* PtrWSTR* = POINTER TO ARRAY [untagged] OF CHAR; *)
-		PtrInt* = INTEGER;
-		StrArray* = POINTER TO ARRAY [untagged] OF PtrSTR;
-		PtrFILE* = INTEGER;
-		PtrDIR* = INTEGER;
-		PtrProc* = INTEGER;
-		clock_t* = INTEGER; (* OpenBSD 5.2 /usr/include/i386/_types.h: 32-bit *)
-
-		(* jmp_buf* = ARRAY [untagged] 6 OF INTEGER; (* bx, si, di, bp, sp, pc *) *)
-		jmp_buf* = ARRAY [untagged] _JBLEN OF INTEGER; (* OpenBSD 5.2 *)
-
-		mode_t* = SET; (* OpenBSD 5.2: 32-bit *)
-		off_t* = LONGINT; (* OpenBSD 5.2: 64-bit *)
+		SIGSTKSZ* = 8192 + 32768;
 
-		SelectorFunc* = PROCEDURE (dirent: Dirent): INTEGER; (* OpenBSD 5.2: OK *)
-		CmpFunc* = PROCEDURE (VAR [nil] dirent1, dirent2: PtrDirent): INTEGER; (* OpenBSD 5.2: OK *)
-
-		size_t* = INTEGER; (* should be unsigned int *) (* OpenBSD 5.2: /usr/include/i386/_types.h: 32-bit *)
-		ssize_t* = INTEGER; (* signed int *) (* OpenBSD 5.2: /usr/include/i386/_types.h: 32-bit *)
-
-		sigjmp_buf* = RECORD [untagged] (* OpenBSD 5.2 *)
-			buf*: jmp_buf;
-
-			(* mask_was_saved*: INTEGER;
-			saved_mask*: sigset_t; *) (* OpenBSD *)
-
-			xxx: INTEGER;
-		END;
-
-		PtrDirent* = POINTER TO Dirent;
-		PtrDirentArray* = POINTER TO ARRAY [untagged] OF Dirent;
-
-		Dirent* = RECORD  [untagged] (* OpenBSD 5.2 /usr/include/sys/dirent.h *)
-			(*
-			d_ino*: INTEGER;	(* inode number *)
-			d_off*: off_t;	(* offset to this dirent *)
-			d_reclen*: SHORTINT;	(* length of this d_name *)
-			d_type*: BYTE;
-			d_name*: ARRAY[untagged]  NAME_MAX+1 OF SHORTCHAR;		(* file name (null-terminated) *)
-			*)
-
-			d_fileno*: INTEGER;
-			d_reclen*: SHORTINT;
-			d_type*: BYTE;
-			d_namlen*: BYTE;
-			d_name*: ARRAY [untagged] NAME_MAX + 1 (* 256 *) OF SHORTCHAR;
-		END;
+		(* ENOENT, EEXIST, EACCES, ENOMEM, EDQUOT, EMFILE, ENOTDIR (int) *)
+		EPERM* = 1; (* Operation not permitted *)
+		ENOENT* = 2; (* No such file or directory *)
+		ESRCH* = 3; (* No such process *)
+		EINTR* = 4; (* Interrupted system call *)
+		EIO* = 5; (* Input/output error *)
+		ENXIO* = 6; (* Device not configured *)
+		E2BIG* = 7; (* Argument list too long *)
+		ENOEXEC* = 8; (* Exec format error *)
+		EBADF* = 9; (* Bad file descriptor *)
+		ECHILD* = 10; (* No child processes *)
+		EDEADLK* = 11; (* Resource deadlock avoided *)
+		ENOMEM* = 12; (* Cannot allocate memory *)
+		EACCES* = 13; (* Permission denied *)
+		EFAULT* = 14; (* Bad address *)
+		EBUSY* = 16; (* Device busy *)
+		EEXIST* = 17; (* File exists *)
+		EXDEV* = 18; (* Cross-device link *)
+		ENODEV* = 19; (* Operation not supported by device *)
+		ENOTDIR* = 20; (* Not a directory *)
+		EISDIR* = 21; (* Is a directory *)
+		EINVAL* = 22; (* Invalid argument *)
+		ENFILE* = 23; (* Too many open files in system *)
+		EMFILE* = 24; (* Too many open files *)
+		ENOTTY* = 25; (* Inappropriate ioctl for device *)
+		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; (* Numerical argument out of domain *)
+		ERANGE* = 34; (* Result too large *)
+		EAGAIN* = 35; (* Resource temporarily unavailable *)
+		EWOULDBLOCK* = EAGAIN; (* Operation would block *)
+		EINPROGRESS* = 36; (* Operation now in progress *)
+		EALREADY* = 37; (* Operation already in progress *)
+		ENOTSOCK* = 38; (* Socket operation on non-socket *)
+		EDESTADDRREQ* = 39; (* Destination address required *)
+		EMSGSIZE* = 40; (* Message too long *)
+		EPROTOTYPE* = 41; (* Protocol wrong type for socket *)
+		ENOPROTOOPT* = 42; (* Protocol not available *)
+		EPROTONOSUPPORT* = 43; (* Protocol not supported *)
+		EOPNOTSUPP* = 45; (* Operation not supported *)
+		EAFNOSUPPORT* = 47; (* Address family not supported by protocol family *)
+		EADDRINUSE* = 48; (* Address already in use *)
+		EADDRNOTAVAIL* = 49; (* Can't assign requested address *)
+		ENETDOWN* = 50; (* Network is down *)
+		ENETUNREACH* = 51; (* Network is unreachable *)
+		ENETRESET* = 52; (* Network dropped connection on reset *)
+		ECONNABORTED* = 53; (* Software caused connection abort *)
+		ECONNRESET* = 54; (* Connection reset by peer *)
+		ENOBUFS* = 55; (* No buffer space available *)
+		EISCONN* = 56; (* Socket is already connected *)
+		ENOTCONN* = 57; (* Socket is not connected *)
+		ETIMEDOUT* = 60; (* Operation timed out *)
+		ECONNREFUSED* = 61; (* Connection refused *)
+		ELOOP* = 62; (* Too many levels of symbolic links *)
+		ENAMETOOLONG* = 63; (* File name too long *)
+		ENOTEMPTY* = 66; (* Directory not empty *)
+		EDQUOT* = 69; (* Disk quota exceeded *)
+		ESTALE* = 70; (* Stale NFS file handle *)
+		ENOLCK* = 77; (* No locks available *)
+		ENOSYS* = 78; (* Function not implemented *)
+		EILSEQ* = 84; (* Illegal byte sequence *)
+		EIDRM* = 89; (* Identifier removed *)
+		ENOMSG* = 90; (* No message of desired type *)
+		ENOTSUP* = 91; (* Not supported *)
+		ENOTBLK* = 15; (* Block device required *)
+		ESOCKTNOSUPPORT* = 44; (* Socket type not supported *)
+		EPFNOSUPPORT* = 46; (* Protocol family not supported *)
+		ESHUTDOWN* = 58; (* Can't send after socket shutdown *)
+		ETOOMANYREFS* = 59; (* Too many references: can't splice *)
+		EHOSTDOWN* = 64; (* Host is down *)
+		EHOSTUNREACH* = 65; (* No route to host *)
+		EPROCLIM* = 67; (* Too many processes *)
+		EUSERS* = 68; (* Too many users *)
+		EREMOTE* = 71; (* Too many levels of remote in path *)
+		EBADRPC* = 72; (* RPC struct is bad *)
+		ERPCMISMATCH* = 73; (* RPC version wrong *)
+		EPROGUNAVAIL* = 74; (* RPC prog. not avail *)
+		EPROGMISMATCH* = 75; (* Program version wrong *)
+		EPROCUNAVAIL* = 76; (* Bad procedure for program *)
+		EFTYPE* = 79; (* Inappropriate file type or format *)
+		EAUTH* = 80; (* Authentication error *)
+		ENEEDAUTH* = 81; (* Need authenticator *)
+		EIPSEC* = 82; (* IPsec processing failure *)
+		ENOATTR* = 83; (* Attribute not found *)
+		ENOMEDIUM* = 85; (* No medium found *)
+		EMEDIUMTYPE* = 86; (* Wrong Medium Type *)
+		EOVERFLOW* = 87; (* Conversion overflow *)
+		ECANCELED* = 88; (* Operation canceled *)
+		ELAST* = 91; (* Must be equal largest errno *)
+		ERESTART* = -1; (* restart syscall *)
+		EJUSTRETURN* = -2; (* don't modify regs, just return *)
 
-		pid_t* = INTEGER; (* OpenBSD 5.2: 32-bit *)
-		uid_t* = INTEGER; (* OpenBSD 5.2: 32-bit *)
 
-		sigval_t* = INTEGER; (* OpenBSD: 32-bit (union sigval) *)
+		NAME_MAX* = 255;
 
-		siginfo_t* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/sys/siginfo.h *)
-			si_signo*: INTEGER; 	(* Signal number *) (* OpenBSD: 32-bit *)
-			si_code*: INTEGER;   	(* Signal code *) (* OpenBSD: 32-bit *)
-			si_errno*: INTEGER;  	(* An errno value *) (* OpenBSD: 32-bit *)
+		SEEK_SET* = 0;
+		SEEK_CUR* = 1;
+		SEEK_END* = 2;
 
-			(* OpenBSD 5.2: 29 * 4 B below *)
+		P_tmpdir* = "/tmp";
 
-			si_pid*: pid_t;    	(* Sending process ID *)
-			si_uid*: uid_t;    	(* Real user ID of sending process *)
-			si_status*: INTEGER; 	(* Exit value or signal *) (* OpenBSD 5.2: 32-bit *)
+		(* O_RDWR, O_NONBLOCK (intFlags) *)
+		O_SHLOCK* = {4}; (* open with shared file lock *)
+		O_EXLOCK* = {5}; (* open with exclusive file lock *)
+		O_ASYNC* = {6}; (* signal pgrp when data ready *)
+		O_NOFOLLOW* = {8}; (* if path is a symlink, don't follow *)
+		O_SYNC* = {7}; (* synchronous writes *)
+		O_RDONLY* = {}; (* open for reading only *)
+		O_WRONLY* = {0}; (* open for writing only *)
+		O_RDWR* = {1}; (* open for reading and writing *)
+		O_ACCMODE* = {0,1}; (* mask for above modes *)
+		O_NONBLOCK* = {2}; (* no delay *)
+		O_APPEND* = {3}; (* set append mode *)
+		O_CREAT* = {9}; (* create if nonexistent *)
+		O_TRUNC* = {10}; (* truncate to zero length *)
+		O_EXCL* = {11}; (* error if already exists *)
+		O_DSYNC* = O_SYNC; (* synchronous data writes *)
+		O_RSYNC* = O_SYNC; (* synchronous reads *)
+		O_NOCTTY* = {15}; (* don't assign controlling terminal *)
+		O_CLOEXEC* = {16}; (* atomically set FD_CLOEXEC *)
+		O_DIRECTORY* = {17}; (* fail if not a directory *)
 
-			(* si_utime*: clock_t;  	(* User time consumed *) *) (* OpenBSD: XXX *)
-			si_stime*: clock_t;  	(* System time consumed *)
-			(* si_value*: sigval_t;  	(* Signal value *) *) (* OpenBSD: XXX *)
-			(* si_int*: INTEGER;    	(* POSIX.1b signal *) *) (* OpenBSD: XXX *)
-			(* si_ptr*: PtrVoid;    	(* POSIX.1b signal *) *) (* OpenBSD: XXX *)
-			(* si_addr*: PtrVoid;   	(* Memory location which caused fault *) *) (* OpenBSD: XXX *)
-			(* si_band*: INTEGER;   	(* Band event *) *) (* OpenBSD: XXX *)
-			(* si_fd*: INTEGER;     	(* File descriptor *) *) (* OpenBSD: XXX *)
 
-			xxx: ARRAY [untagged] 25 OF INTEGER; (* OpenBSD *)
-		END;
-		Ptrsiginfo_t* = POINTER TO siginfo_t;
+	TYPE
+		StrArray* = POINTER TO ARRAY [untagged] OF PtrSTR;
+		PtrSTR* = POINTER TO ARRAY [untagged] OF SHORTCHAR;
 
-		(* sigset_t* = ARRAY [untagged] 128 OF BYTE; *)
-		(* OpenBSD 5.2 /usr/include/sys/signal.h *)
-		(* sigset_t* = ARRAY [untagged] 4 OF BYTE; *)
+		(* PtrVoid, int, long, size_t, ssize_t, off_t, time_t, clock_t, sigjmp_buf *)
+		(* mode_t, intFlags, sigset_t (set) *)
+		PtrVoid* = INTEGER;
+		int* = INTEGER;
+		long* = INTEGER;
+		ulong* = INTEGER;
+		size_t* = INTEGER;
+		ssize_t* = INTEGER;
+		off_t* = LONGINT;
+		clock_t* = INTEGER;
+		time_t* = INTEGER;
+		mode_t* = SET;
+		pid_t* = INTEGER;
+		uid_t* = INTEGER;
+		gid_t* = INTEGER;
+		dev_t* = INTEGER;
+		ino_t* = INTEGER;
+		nlink_t* = INTEGER;
+		int8_t* = SHORTCHAR;
+		u_int8_t* = SHORTCHAR;
+		int16_t* = SHORTINT;
+		u_int16_t* = SHORTINT;
+		int32_t* = INTEGER;
+		u_int32_t* = INTEGER;
+		int64_t* = LONGINT;
+		u_int64_t* = LONGINT;
+		wchar_t* = INTEGER;
 		sigset_t* = SET;
+		sigjmp_buf* = ARRAY [untagged] 11 OF INTEGER;
+		intFlags* = SET;
+		FILE = ARRAY [untagged] 22 OF INTEGER;
 
-		Ptrsigset_t* = INTEGER;
-		sigaction_t* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/sys/signal.h *)
-			sa_sigaction*: PROCEDURE [ccall] (sig: INTEGER; siginfo: Ptrsiginfo_t; ptr: Ptrucontext_t); (* union with sa_handler*: PtrProc;*)
-			sa_mask*: sigset_t;
-			sa_flags*: SET;
-			(* sa_restorer*: LONGINT; *) (* OpenBSD *)
-		END;
 
-		stack_t* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/sys/signal.h *)
-			ss_sp*: PtrVoid;
-			ss_size*: size_t; (* OpenBSD *)
-			ss_flags*: INTEGER; (* OpenBSD *)
+		tm* = POINTER TO tmDesc;
+		tmDesc* = RECORD [untagged]
+			(* NOTE: check record size *)
+			(* tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec, tm_wday [ , tm_gmtoff ] *)
+			(* OpenBSD 5.2 /usr/include/time.h *)
+				tm_sec*: int; (* seconds after the minute [0-60] *)
+				tm_min*: int; (* minutes after the hour [0-59] *)
+				tm_hour*: int; (* hours since midnight [0-23] *)
+				tm_mday*: int; (* day of the month [1-31] *)
+				tm_mon*: int; (* months since January [0-11] *)
+				tm_year*: int; (* years since 1900 *)
+				tm_wday*: int; (* days since Sunday [0-6] *)
+				tm_yday*: int; (* days since January 1 [0-365] *)
+				tm_isdst*: int; (* Daylight Saving Time flag *)
+				tm_gmtoff*: long; (* offset from UTC in seconds *)
+				tm_zone*: PtrSTR; (* timezone abbreviation *)
 		END;
 
-		dev_t* = INTEGER; (* OpenBSD: 32-bit *)
-		gid_t* = INTEGER; (* OpenBSD: 32-bit *)
-
-		stat_t* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/sys/stat.h *)
-			st_dev*: dev_t;	(* device *) (* OpenBSD: 32-bit *)
-			(* __pad1: SHORTINT; *) (* OpenBSD *)
-			st_ino*: INTEGER;	(* 64? inode *) (* OpenBSD: 32-bit *)
-			st_mode*: mode_t;	(* protection *) (* OpenBSD: 32-bit *)
-			st_nlink*: INTEGER; 	(* number of hard links *) (* OpenBSD: 32-bit *)
-			st_uid*: uid_t;	(* user ID of owner *) (* OpenBSD: 32-bit *)
-			st_gid*: gid_t;	(* group ID of owner *) (* OpenBSD: 32-bit *)
-			st_rdev*: dev_t;	(* device type (if inode device) *) (* OpenBSD: 32-bit *)
-			st_lspare0*: INTEGER; (* OpenBSD *)
-			(* __pad2: SHORTINT; *) (* OpenBSD *)
-
-			(* OpenBSD *)
-			st_atime*: time_t;
-			st_atimensec*: INTEGER;
-			st_mtime*: time_t;
-			st_mtimensec*: INTEGER;
-			st_ctime*: time_t;
-			st_ctimensec*: INTEGER;
-
-			st_size*: off_t;	(* 64? total size, in bytes *) (* OpenBSD *)
-			st_blocks*: LONGINT; (* OpenBSD: 64-bit *)
-			st_blksize*: INTEGER;	(* blocksize for filesystem I/O *)
-			(* st_blocks*: INTEGER;	(* 64? number of blocks allocated *) *) (* OpenBSD *)
-			st_flags*: INTEGER; (* OpenBSD: 32-bit *)
-			st_gen*: INTEGER; (* OpenBSD: 32-bit *)
-			st_lspare1*: INTEGER; (* OpenBSD: 32-bit *)
-
-			(* OpenBSD
-			st_atime*: INTEGER;	(* time of last access *)
-			__unused1:  INTEGER;
-			st_mtime*: INTEGER;	(* time of last modification *)
-			__unused2:  INTEGER;
-			st_ctime*: INTEGER;	(* time of last change *)
-			__unused3:  INTEGER;
-			__unused4:  INTEGER;
-			__unused5:  INTEGER;
-			*)
-
-			(* OpenBSD *)
-			__st_birthtime*: time_t;
-			__st_birthtimensec*: INTEGER;
-			st_qspare*: ARRAY [untagged] 2 OF LONGINT;
+		Ptrsiginfo_t* = POINTER TO siginfo_t;
+		siginfo_t = RECORD [untagged]
+			(* si_code, fault address *)
+			(* OpenBSD 5.2 /usr/include/sys/siginfo.h *)
+				si_signo*: int; (* signal from signal.h *)
+				si_code*: int; (* code from above *)
+				si_errno*: int; (* error from errno.h *)
+				_data*: RECORD [union]
+					_pad*: ARRAY [untagged] 29 (* SI_PAD *) OF int; (* for future growth *)
+					_proc*: RECORD [untagged] (* kill(), SIGCLD, siqqueue() *)
+						_pid*: pid_t; (* process ID *)
+						_pdata*: RECORD [union]
+							_kill*: RECORD [untagged]
+								_uid*: uid_t;
+(*
+								_value*: sigval;
+*)
+								_value*: int
+							END;
+							_cld*: RECORD [untagged]
+								_utime*: clock_t;
+								_status*: int;
+								_stime*: clock_t;
+							END;
+						END;
+					END;
+					_fault*: RECORD [untagged] (* SIGSEGV, SIGBUS, SIGILL and SIGFPE *)
+						_addr*: PtrVoid; (* faulting address *)
+						_trapno*: int; (* illegal trap number *)
+					END;
+				END;
 		END;
 
-		(* OpenBSD
-		fpreg* = RECORD [untagged]
-			significand*: ARRAY [untagged] 4 OF CHAR;
-			exponent*: CHAR;
-		END;
-		*)
-
-		(* OpenBSD *)
-		(*
-		fpstate* = RECORD [untagged]
-			cw*: INTEGER; 	(* unsigned long int *)
-			sw*: INTEGER; 	(* unsigned long int *)
-			tag*: INTEGER; 	(* unsigned long int *)
-			ipoff*: INTEGER; 	(* unsigned long int *)
-			cssel*: INTEGER; 	(* unsigned long int *)
-			dataoff*: INTEGER; 	(* unsigned long int *)
-			datasel*: INTEGER; 	(* unsigned long int *)
-			_st: ARRAY [untagged] 8 OF fpreg;
-			status*: INTEGER; 	(* unsigned long int *)
-		END;
-		*)
-		envxmm* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/i386/npx.h *)
-			(*0*)
-				en_cw*: SHORTINT; (* FPU Control Word *)
-				en_sw*: SHORTINT; (* FPU Status Word *)
-				en_tw*: BYTE; (* FPU Tag Word (abridged) *)
-				en_rsvd0*: BYTE;
-				en_opcode*: SHORTINT; (* FPU Opcode *)
-				en_fip*: INTEGER; (* FPU Instruction Pointer *)
-				en_fcs*: SHORTINT; (* FPU IP selector *)
-				en_rsvd1*: SHORTINT;
-			(*16*)
-				en_foo*: INTEGER; (* FPU Data pointer *)
-				en_fos*: SHORTINT; (* FPU Data pointer selector *)
-				en_rsvd2*: SHORTINT;
-				en_mxcsr*: INTEGER; (* MXCSR Register State *)
-				en_mxcsr_mask*: INTEGER; (* Mask for valid MXCSR bits (may be 0) *)
-		END;
-		(* FPU regsters in the extended save format. *)
-		fpaccxmm* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/i386/npx.h *)
-			fp_bytes*: ARRAY [untagged] 10 OF BYTE;
-			fp_rsvd*: ARRAY [untagged] 6 OF BYTE;
-		END;
-		(* SSE/SSE2 registers. *)
-		xmmreg* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/i386/npx.h *)
-			sse_bytes*: ARRAY [untagged] 16 OF BYTE;
-		END;
-		fpstate* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/i386/npx.h savefpu.savexmm *)
-			sv_env*: envxmm; (* control/status context *)
-			sv_ac*: ARRAY [untagged] 8 OF fpaccxmm; (* ST/MM regs *)
-			sv_xmmregs*: ARRAY [untagged] 8 OF xmmreg; (* XMM regs *)
-			sv_rsvd*: ARRAY [untagged] 16 * 14 OF BYTE;
-			(* 512-bytes --- end of hardware portion of save area *)
-			sv_ex_sw*: INTEGER; (* saved SW from last exception *)
-			sv_ex_tw*: INTEGER; (* saved TW from last exception *)
+		Ptrucontext_t* = POINTER TO ucontext_t;
+		ucontext_t = RECORD [untagged]
+			(* IP, SP, FP *)
+			(* OpenBSD 5.2 /usr/include/i386/signal.h struct sigcontext *)
+				sc_gs*: int;
+				sc_fs*: int;
+				sc_es*: int;
+				sc_ds*: int;
+				sc_edi*: int;
+				sc_esi*: int;
+				sc_ebp*: int;
+				sc_ebx*: int;
+				sc_edx*: int;
+				sc_ecx*: int;
+				sc_eax*: int;
+				(* XXX *)
+				sc_eip*: int;
+				sc_cs*: int;
+				sc_eflags*: int;
+				sc_esp*: int;
+				sc_ss*: int;
+
+				sc_onstack*: int; (* sigstack state to restore *)
+				sc_mask*: int; (* signal mask to restore *)
+
+				sc_trapno*: int; (* XXX should be above *)
+				sc_err*: int;
+
+				sc_fpstate*: RECORD [union]
+					(* OpenBSD 5.2 /usr/include/i386/npx.h union savefpu *)
+(*
+						sv_87*: RECORD [untagged]
+							...
+						END;
+						sv_xmm*: RECORD [untagged]
+							...
+						END;
+*)
+				END;
 		END;
 
-		(* OpenBSD
-		gregset_t* = ARRAY [untagged] 19 OF INTEGER;
-		*)
-		fpregset_t* = POINTER TO fpstate;
-
-		(* OpenBSD
-		mcontext_t*  = RECORD [untagged]
-			gregs*: gregset_t;
-			fpregs*: fpregset_t;
-			oldmask*: INTEGER;	(* unsigned long int *)
-			cr2*: INTEGER; 	(* unsigned long int *)
+		sigaction_t* = RECORD [untagged]
+(*
+			sa_sigaction*: PROCEDURE [ccall] (sig: INTEGER; siginfo: Ptrsiginfo_t; context: Ptrucontext_t),
+			sa_flags*: intFlags, sa_mask*: sigset_t
+*)
+			(* OpenBSD 5.2 /usr/include/sys/signal.h *)
+				sa_sigaction*: PROCEDURE [ccall] (sig: int; siginfo: Ptrsiginfo_t; ctx: Ptrucontext_t);
+				sa_mask*: sigset_t;
+				sa_flags*: intFlags;
 		END;
-		*)
 
-		Ptrucontext_t* = POINTER TO ucontext_t;
-		ucontext_t* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/i386/signal.h struct sigcontext *)
-			(*
-			uc_flags*: INTEGER;	(* unsigned long int *)
-			uc_link*: Ptrucontext_t;
-			uc_stack*: stack_t;
-			uc_mcontext*: mcontext_t;
-			uc_sigmask: sigset_t;
-			__fpregs_mem*: fpstate;
-			*)
-
-			sc_gs*: INTEGER;
-			sc_fs*: INTEGER;
-			sc_es*: INTEGER;
-			sc_ds*: INTEGER;
-			sc_edi*: INTEGER;
-			sc_esi*: INTEGER;
-			sc_ebp*: INTEGER;
-			sc_ebx*: INTEGER;
-			sc_edx*: INTEGER;
-			sc_ecx*: INTEGER;
-			sc_eax*: INTEGER;
-			(* XXX *)
-			sc_eip*: INTEGER;
-			sc_cs*: INTEGER;
-			sc_eflags*: INTEGER;
-			sc_esp*: INTEGER;
-			sc_ss*: INTEGER;
-
-			sc_onstack*: INTEGER; (* sigstack state to restore *)
-			sc_mask*: INTEGER; (* signal mask to restore *)
-			sc_trapno*: INTEGER; (* XXX should be above *)
-			sc_err*: INTEGER;
-
-			sc_fpstate*: fpregset_t; (* POINTER TO savefpu *)
+		stack_t* = RECORD [untagged]
+(*
+			ss_sp*: PtrVoid, ss_size*: size_t, ss_flags*: intFlags
+*)
+			(* OpenBSD 5.2 /usr/include/sys/signal.h *)
+				ss_sp*: PtrVoid; (* signal stack base *)
+				ss_size*: size_t; (* signal stack length *)
+				ss_flags*: intFlags; (* SS_DISABLE and/or SS_ONSTACK *)
 		END;
 
-		(* Times and Dates *)
-
-		tm* = POINTER TO tmDesc;
-		tmDesc* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/time.h *)
-			tm_sec*: INTEGER;	(* seconds *)
-			tm_min*: INTEGER;	(* minutes *)
-			tm_hour*: INTEGER;	(* hours *)
-			tm_mday*: INTEGER;	(* day of the month *)
-			tm_mon*: INTEGER;	(* month *)
-			tm_year*: INTEGER;	(* year *)
-			tm_wday*: INTEGER;	(* day of the week *)
-			tm_yday*: INTEGER;	(* day in the year *)
-			tm_isdst*: INTEGER;	(* daylight saving time *)
-
-			tm_gmtoff*: INTEGER; (* OpenBSD *)
-			tm_zone*: PtrSTR; (* OpenBSD *)
+		stat_t* = RECORD [untagged]
+(*
+			NOTE: check record size
+			st_mode*: mode_t, st_size*: off_t, st_mtime*: time_t
+*)
+			(* OpenBSD 5.2 /usr/include/sys/stat.h *)
+				st_dev*: dev_t;
+				st_ino*: ino_t;
+				st_mode*: mode_t;
+				st_nlink*: nlink_t;
+				st_uid*: uid_t;
+				st_gid*: gid_t;
+				st_rdev*: dev_t;
+				st_lspare0*: int32_t;
+
+				st_atime*: time_t;
+				st_atimensec*: long;
+				st_mtime*: time_t;
+				st_mtimensec*: long;
+				st_ctime*: time_t;
+				st_ctimensec*: long;
+
+				st_size*: off_t;
+				st_blocks*: int64_t;
+				st_blksize*: u_int32_t;
+				st_flags*: u_int32_t;
+				st_gen*: u_int32_t;
+				st_lspare1*: int32_t;
+
+				__st_birthtime*: time_t;
+				__st_birthtimensec*: long;
+				st_qspare*: ARRAY [untagged] 2 OF int64_t;
 		END;
 
-		time_t* = INTEGER; (* OpenBSD 5.2 /usr/include/i386/_types.h: 32-bit *)
-
-		FILE = ARRAY [untagged] 88 OF BYTE; (* OpenBSD 5.2 /usr/include/stdio.h *)
+		PtrFILE* = PtrVoid;
+		PtrDIR* = PtrVoid;
 
-		wchar_t* = INTEGER; (* OpenBSD 5.2: 32-bit *)
-		PtrWSTR* = POINTER TO ARRAY [untagged] OF wchar_t;
-
-		(* OpenBSD 5.2 *)
-		sigaltstack_t* = RECORD [untagged]
-			ss_sp*: PtrVoid;
-			ss_size*: size_t;
-			ss_flags*: INTEGER;
+		PtrDirent* = POINTER TO Dirent;
+		Dirent = RECORD [untagged]
+(*
+			d_name*: ARRAY [untagged] NAME_MAX + 1 OF SHORTCHAR
+*)
+			(* OpenBSD 5.2 /usr/include/sys/dirent.h *)
+				d_fileno*: u_int32_t; (* file number of entry *)
+				d_reclen*: u_int16_t; (* length of this record *)
+				d_type*: u_int8_t; (* file type, see below *)
+				d_namlen*: u_int8_t; (* length of string in d_name *)
+				d_name*: ARRAY [untagged] 255 + 1 OF SHORTCHAR;
 		END;
 
+(*
+	VAR
+		stdin*: INTEGER;
+		timezone*: INTEGER; (* or tm.tm_gmtoff *)
+*)
+(*
+	PROCEDURE [ccall] __errno_location* (): PtrVoid;
+*)
+(*
+	(* POSIX.1 *)
+		PROCEDURE [ccall] stat* (path: PtrSTR; VAR sp: stat_t): int;
+*)
 	VAR
-		(* timezone*: INTEGER; (* seconds from GMT *) *) (* OpenBSD: not present *)
-		(* stdin*, stdout*, stderr* : PtrFILE; (* OpenBSD: not present *) *)
-
 		(* OpenBSD: stdin, stdout, stderr *)
 			__sF*: ARRAY [untagged] 3 OF FILE; (* OpenBSD 5.2 /usr/include/stdio.h *)
-			(*
-				stdin = SYSTEM.ADR(__sF[0])
-				stdout = SYSTEM.ADR(__sF[1])
-				stderr = SYSTEM.ADR(__sF[2])
-			*)
-
-	PROCEDURE [ccall] calloc* (nmemb, size: size_t): PtrVoid;
-	PROCEDURE [ccall] clock* (): clock_t;
-
-	PROCEDURE [ccall] closedir* (dir: PtrDIR): INTEGER;
-
-	PROCEDURE [ccall] chmod* (path: PtrSTR; mode: mode_t);
-	PROCEDURE [ccall] exit* (status: INTEGER);
-
-	PROCEDURE [ccall] fclose* (fp: PtrFILE): INTEGER;
-	PROCEDURE [ccall] fflush* (fp: PtrFILE): INTEGER;
-	PROCEDURE [ccall] fopen* (filename, mode: PtrSTR): PtrFILE;
-	PROCEDURE [ccall] feof* (fp: PtrFILE): INTEGER;
-	PROCEDURE [ccall] fread* (ptr: PtrVoid; size, nmemb: size_t; stream: PtrFILE): size_t;
-	PROCEDURE [ccall] fseek* (stream: PtrFILE; offset, origin: INTEGER): INTEGER;
-	PROCEDURE [ccall] free* (p: PtrVoid);
-
-	PROCEDURE [ccall] ftell* (stream: PtrFILE): (* LONGINT; *) INTEGER; (* OpenBSD 5.2 *)
-
-	PROCEDURE [ccall] ftw* (filename: PtrSTR; func: __ftw_func_t; maxfds: INTEGER): INTEGER;
-	PROCEDURE [ccall] fwrite* (ptr: PtrVoid; size, nmemb: size_t; stream: PtrFILE): size_t;
-	PROCEDURE [ccall] getcwd* (buf: PtrSTR; size: size_t): PtrSTR;
-
-	(* PROCEDURE [ccall] getcontext* (ucontext_t: Ptrucontext_t): INTEGER; *) (* OpenBSD *)
-
-	(* PROCEDURE [ccall] gets* (s: PtrSTR); *)
-	PROCEDURE [ccall] gets* (s: PtrSTR): PtrSTR; (* OpenBSD 5.2 *)
-
-	PROCEDURE [ccall] fgets* (s: PtrSTR; n: INTEGER; fp: PtrFILE): PtrSTR;
-	PROCEDURE [ccall] gmtime* (VAR timep: time_t): tm;
-	PROCEDURE [ccall] kill* (pid: pid_t; sig: INTEGER): INTEGER;
-	PROCEDURE [ccall] localtime* (VAR timep: time_t): tm;
-	PROCEDURE [ccall] malloc* (size: size_t): PtrVoid;
-	PROCEDURE [ccall] mkdir* (path: PtrSTR; mode: mode_t): INTEGER;
-	PROCEDURE [ccall] mktime* (timeptr: tm): time_t;
-	PROCEDURE [ccall] opendir* (filename: PtrSTR): PtrDIR;
-	PROCEDURE [ccall] printf* (s: PtrSTR): INTEGER;
-	PROCEDURE [ccall] readdir* (dir: PtrDIR): PtrDirent;
-	PROCEDURE [ccall] remove* (path: PtrSTR): INTEGER;
-	PROCEDURE [ccall] rename* (from, to: PtrSTR): INTEGER;
-	PROCEDURE [ccall] scandir* (dir: PtrDIR; namelist: PtrDirentArray; selector: SelectorFunc; cmp: CmpFunc): INTEGER;
-
-	(* PROCEDURE [ccall] setcontext* (ucontext_t: Ptrucontext_t): INTEGER; *) (* OpenBSD *)
-
-	PROCEDURE [ccall] setjmp* (VAR env: jmp_buf): INTEGER;
-	PROCEDURE [ccall] sigaction* (sig_num: INTEGER; VAR [nil] act: sigaction_t; VAR [nil] oldact: sigaction_t): INTEGER;
-	PROCEDURE [ccall] sigaddset* (set: Ptrsigset_t; sig: INTEGER): INTEGER;
-	PROCEDURE [ccall] sigdelset* (set: Ptrsigset_t; sig: INTEGER): INTEGER;
-	PROCEDURE [ccall] sigemptyset* (set: Ptrsigset_t): INTEGER;
-	PROCEDURE [ccall] sigfillset* (set: Ptrsigset_t): INTEGER;
-	PROCEDURE [ccall] sigismemeber* (set: Ptrsigset_t; sig: INTEGER): INTEGER;
-	PROCEDURE [ccall] siglongjmp* (VAR env: sigjmp_buf; val: INTEGER);
-
-	PROCEDURE [ccall] signal* (sig_num: INTEGER; sighandler: PtrProc): PtrProc;
-	(* PROCEDURE [ccall] sigsetjmp* ["__sigsetjmp"] (VAR env: sigjmp_buf; savemask: INTEGER): INTEGER; *)
-	PROCEDURE [ccall] sigsetjmp* (VAR env: sigjmp_buf; savemask: INTEGER): INTEGER; (* OpenBSD *)
-
-	(* OpenBSD *)
-	PROCEDURE [ccall] stat* (filename: PtrSTR; VAR buf: stat_t): INTEGER;  (* stat is a macro and expands to __xstat(3, filename, buf) *)
-(* OpenBSD: __xstat not present
-	PROCEDURE [ccall] __xstat* (version: INTEGER; filename: PtrSTR; VAR buf: stat_t): INTEGER;
-*)
-
-	PROCEDURE [ccall] strftime* (s: PtrSTR; max: size_t; format: PtrSTR; ptm: tm): size_t;
-	PROCEDURE [ccall] time* (VAR [nil] t: time_t): time_t;
-
-	(* PROCEDURE [ccall] __errno_location*(): INTEGER; *)
-	PROCEDURE [ccall] __errno_location* ["__errno"] (): INTEGER; (* OpenBSD *)
+				(*
+					stdin = SYSTEM.ADR(__sF[0])
+					stdout = SYSTEM.ADR(__sF[1])
+					stderr = SYSTEM.ADR(__sF[2])
+				*)
 
-	PROCEDURE [ccall] open* (path: PtrSTR; flags: SET; mode: mode_t): INTEGER;
-	PROCEDURE [ccall] close* (d: INTEGER): INTEGER;
-	PROCEDURE [ccall] read* (d: INTEGER; buf: PtrVoid; nbytes: size_t): ssize_t;
-	PROCEDURE [ccall] write* (d: INTEGER; buf: PtrVoid; nBytes: size_t): ssize_t;
+	PROCEDURE [ccall] __errno_location* ["__errno"] (): PtrVoid;
 
-	(* OpenBSD *)
-	PROCEDURE [ccall] mprotect* (addr: PtrVoid; len: size_t; prot: SET): INTEGER;
+	(* POSIX.1 *)
+		PROCEDURE [ccall] stat* (path: PtrSTR; VAR sp: stat_t): int;
 
-	(* OpenBSD 5.2 *)
-	PROCEDURE [ccall] madvise* (addr: PtrVoid; len: size_t; behav: INTEGER): INTEGER;
 
-	PROCEDURE [ccall] mmap* (addr: PtrVoid; len: size_t; prot: SET; flags: SET; fd: INTEGER; offset: off_t): PtrVoid;
-	PROCEDURE [ccall] munmap* (addr: PtrVoid; len: size_t): INTEGER;
+	(* ANSI C 89 *)
+		PROCEDURE [ccall] clock* (): clock_t;
 
-	PROCEDURE [ccall] getenv* (name: PtrSTR): PtrSTR;
+	PROCEDURE [ccall] mmap* (adr: PtrVoid; len: size_t; prot: intFlags; flags: intFlags; fd: int; offset: off_t): PtrVoid;
+	(* BSD *)
+		PROCEDURE [ccall] munmap* (adr: PtrVoid; len: size_t): int;
+		PROCEDURE [ccall] mprotect* (adr: PtrVoid; len: size_t; prot: intFlags): int;
 
-	(* OpenBSD 5.2: Ok *)
-	PROCEDURE [ccall] wctomb* (s: PtrSTR; wchar: wchar_t): INTEGER;
-	PROCEDURE [ccall] wcstombs* (s: PtrSTR; pwcs: PtrWSTR; n: size_t): size_t;
-	PROCEDURE [ccall] mbtowc* (pwc: PtrWSTR; s: PtrSTR; n: size_t): INTEGER;
-	PROCEDURE [ccall] mbstowcs* (pwcs: PtrWSTR; s: PtrSTR; n: size_t): size_t;
-
-	(* OpenBSD 5.2 *)
-	PROCEDURE [ccall] sysconf* (name: INTEGER): INTEGER;
-
-	PROCEDURE [ccall] sigaltstack* (VAR [nil] ss: sigaltstack_t; VAR [nil] oss: sigaltstack_t): INTEGER;
-
-	PROCEDURE [ccall] sigreturn* (ucontext_t: Ptrucontext_t): INTEGER;
-
-	PROCEDURE [ccall] sigprocmask* (how: INTEGER; VAR [nil] set: sigset_t; VAR [nil] oset: sigset_t): INTEGER;
+(*
+	PROCEDURE [ccall] calloc* (nmemb: size_t; size: size_t): PtrVoid;
+	(* ANSI C 89 *)
+		PROCEDURE [ccall] malloc* (size: size_t): PtrVoid;
+*)
+		PROCEDURE [ccall] free* (ptr: PtrVoid);
+
+	(* AT&T *)
+		PROCEDURE [ccall] time* (VAR [nil] t: time_t): time_t;
+	PROCEDURE [ccall] gmtime* (VAR [nil] t: time_t): tm;
+	PROCEDURE [ccall] localtime* (VAR [nil] t: time_t): tm;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] sigsetjmp* (VAR env: sigjmp_buf; savemask: int): int;
+		PROCEDURE [ccall] siglongjmp* (VAR env: sigjmp_buf; val: int);
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] sigemptyset* (VAR set: sigset_t): int;
+		PROCEDURE [ccall] sigfillset* (VAR set: sigset_t): int;
+		PROCEDURE [ccall] sigaddset* (VAR set: sigset_t; signo: int): int;
+		PROCEDURE [ccall] sigprocmask* (how: int; VAR [nil] set: sigset_t; VAR [nil] oset: sigset_t): int;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] sigaction* (sig: int; VAR [nil] act: sigaction_t; VAR [nil] oact: sigaction_t): int;
+
+	(* BSD *)
+		PROCEDURE [ccall] sigaltstack* (VAR [nil] ss: stack_t; VAR [nil] oss: stack_t): int;
+
+	(* ANSI C 89 *)
+		PROCEDURE [ccall] getenv* (s: PtrSTR): PtrSTR;
+
+	(* ANSI C 89 *)
+		PROCEDURE [ccall] fopen* (path, mode: PtrSTR): PtrFILE;
+		PROCEDURE [ccall] fclose* (stream: PtrFILE): int;
+		PROCEDURE [ccall] fread* (ptr: PtrVoid; size: size_t; nmemb: size_t; stream: PtrFILE): size_t;
+		PROCEDURE [ccall] fwrite* (ptr: PtrVoid; size: size_t; nmemb: size_t; stream: PtrFILE): size_t;
+		PROCEDURE [ccall] fflush* (s: PtrFILE): int;
+		PROCEDURE [ccall] printf* (s: PtrSTR): int;
+	(* ANSI C 89, XPG4 *)
+		PROCEDURE [ccall] fseek* (stream: PtrFILE; offset: long; whence: int): int;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] rename* (from, to: PtrSTR): int;
+		PROCEDURE [ccall] mkdir* (path: PtrSTR; mode: mode_t): int;
+		PROCEDURE [ccall] opendir* (filename: PtrSTR): PtrDIR;
+		PROCEDURE [ccall] readdir* (dirp: PtrDIR): PtrDirent;
+		PROCEDURE [ccall] closedir* (dirp: PtrDIR): int;
+	(* ANSI C 89, XPG4.2 *)
+		PROCEDURE [ccall] remove* (path: PtrSTR): int;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] getcwd* (buf: PtrSTR; size: size_t): PtrSTR;
+
+	(* ANSI C 99 *)
+		PROCEDURE [ccall] exit* (status: int);
+
+	(* ANSI C 89 *)
+		PROCEDURE [ccall] strftime* (buf: PtrSTR; maxsize: size_t; format: PtrSTR; timeptr: tm): size_t;
+
+	(* XXX: use fread instead *)
+		PROCEDURE [ccall] fgets* (str: PtrSTR; size: int; stream: PtrFILE): PtrSTR;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] open* (path: PtrSTR; flags: intFlags; mode: mode_t): int;
+		PROCEDURE [ccall] write* (d: int; buf: PtrVoid; nbytes: size_t): ssize_t;
+		PROCEDURE [ccall] read* (d: int; buf: PtrVoid; nbytes: size_t): ssize_t;
+		PROCEDURE [ccall] close* (d: int): int;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] sysconf* (name: int): long;
 
 END LinLibc.

+ 0 - 501
new/_OpenBSD_/Lin/Mod/gen-Libc/Libc.txt.templ

@@ -1,501 +0,0 @@
-MODULE LinLibc ["libc.so.66.0"];
-
-	(*
-		A. V. Shiryaev, 2012.11
-
-		Based on Linux' LinLibc (OpenBUGS Lin/Mod/Libc.odc)
-
-		OpenBSD 5.2
-		32-bit
-	*)
-
-	IMPORT SYSTEM;
-
-	CONST
-		NULL* = 0H;
-		TRUE* = 1;
-		FALSE* = 0;
-
-		(* file constants *)
-		SEEK_SET* = 0;
-		SEEK_CUR* = 1;
-		SEEK_END* = 2;
-		NAME_MAX* = 255; (* OpenBSD /usr/include/sys/syslimits.h *)
-
-		(* The value of CLOCKS_PER_SEC is required to be 1 million on all   XSI-conformant systems.*)
-		CLOCKS_PER_SEC* = 100; (* OpenBSD 5.2 /usr/include/time.h CLOCKS_PER_SEC *)
-
-		(* temp directory defined in stdio.h *)
-		P_tmpdir* = "/tmp";
-
-		(* signal constants *)	(* Fake signal functions.  *)
-		(* OpenBSD 5.2 /usr/include/sys/signal.h *)
-		SIG_ERR* = -1; 	(* Error return.  *)
-		SIG_DFL* = 0;   	(* Default action.  *)
-		SIG_IGN* = 1;    	(* Ignore signal.  *)
-		SIG_HOLD* = 3;	(* Add signal to hold mask.  *) (* OpenBSD 5.2 /usr/include/sys/signalvar.h *)
-
-		(* Signals. *)
-		(* OpenBSD /usr/include/sys/signal.h *)
-%%defs-signal%%
-		(* Bits in `sa_flags'. *)
-%%defs-sa%%
-		(* Some aliases for the SA_ constants.  *)
-(*
-		SA_NOMASK* = SA_NODEFER;
-		SA_ONESHOT* = SA_RESETHAND;
-		SA_STACK* = SA_ONSTACK;
-*)
-
-		(* code values for siginfo_t.si_code *) 
-		(* OpenBSD /usr/include/sys/siginfo.h *)
-%%defs-siginfo1%%
-
-		(* possible error constants for errno *)
-		(* /usr/include/sys/errno.h *)
-%%defs-errno%%
-
-		(* OpenBSD 5.2 /usr/include/i386/setjmp.h *)
-		_JBLEN = 10;
-
-		(* OpenBSD 5.2 /usr/include/sys/mman.h *)
-		MAP_FAILED* = -1;
-%%defs-mman%%
-
-		(* OpenBSD 5.2 /usr/include/i386/param.h *)
-		PAGE_SHIFT* = 12;
-		PAGE_SIZE* = 4096; (* LSL(1, PAGE_SHIFT) *)
-		PAGE_MASK* = PAGE_SIZE - 1;
-
-		(* OpenBSD 5.2: /usr/include/fcntl.h *)
-%%defs-fcntl%%
-
-		(* OpenBSD 5.2 /usr/include/unistd.h *)
-%%defs-sc%%
-
-		(* OpenBSD 5.2 /usr/include/sys/mman.h *)
-%%defs-madv%%
-		MADV_NORMAL* = POSIX_MADV_NORMAL;
-		MADV_RANDOM* = POSIX_MADV_RANDOM;
-		MADV_SEQUENTIAL* = POSIX_MADV_SEQUENTIAL;
-		MADV_WILLNEED* = POSIX_MADV_WILLNEED;
-		MADV_DONTNEED* = POSIX_MADV_DONTNEED;
-
-		(* OpenBSD 5.2 /usr/include/sys/signal.h *)
-		MINSIGSTKSZ* = 8192; (* minimum allowable stack *)
-		SIGSTKSZ* = MINSIGSTKSZ + 32768; (* recommended stack size *)
-
-		(* OpenBSD 5.2 /usr/include/sys/signal.h *)
-%%defs-sig%%
-
-	TYPE
-		(* OpenBSD OK *)
-		__ftw_func_t* = PROCEDURE (fileName: PtrSTR; VAR [nil] stat: stat_t; flag: INTEGER): INTEGER; (* OpenBSD 5.2: OK *)
-		PtrVoid* = INTEGER;
-		PtrSTR* = POINTER TO ARRAY [untagged] OF SHORTCHAR;
-		(* PtrWSTR* = POINTER TO ARRAY [untagged] OF CHAR; *)
-		PtrInt* = INTEGER;
-		StrArray* = POINTER TO ARRAY [untagged] OF PtrSTR;
-		PtrFILE* = INTEGER;
-		PtrDIR* = INTEGER;
-		PtrProc* = INTEGER;
-		clock_t* = INTEGER; (* OpenBSD 5.2 /usr/include/i386/_types.h: 32-bit *)
-
-		(* jmp_buf* = ARRAY [untagged] 6 OF INTEGER; (* bx, si, di, bp, sp, pc *) *)
-		jmp_buf* = ARRAY [untagged] _JBLEN OF INTEGER; (* OpenBSD 5.2 *)
-
-		mode_t* = SET; (* OpenBSD 5.2: 32-bit *)
-		off_t* = LONGINT; (* OpenBSD 5.2: 64-bit *)
-
-		SelectorFunc* = PROCEDURE (dirent: Dirent): INTEGER; (* OpenBSD 5.2: OK *)
-		CmpFunc* = PROCEDURE (VAR [nil] dirent1, dirent2: PtrDirent): INTEGER; (* OpenBSD 5.2: OK *)
-
-		size_t* = INTEGER; (* should be unsigned int *) (* OpenBSD 5.2: /usr/include/i386/_types.h: 32-bit *)
-		ssize_t* = INTEGER; (* signed int *) (* OpenBSD 5.2: /usr/include/i386/_types.h: 32-bit *)
-
-		sigjmp_buf* = RECORD [untagged] (* OpenBSD 5.2 *)
-			buf*: jmp_buf;
-
-			(* mask_was_saved*: INTEGER;
-			saved_mask*: sigset_t; *) (* OpenBSD *)
-
-			xxx: INTEGER;
-		END;
-
-		PtrDirent* = POINTER TO Dirent;
-		PtrDirentArray* = POINTER TO ARRAY [untagged] OF Dirent;
-
-		Dirent* = RECORD  [untagged] (* OpenBSD 5.2 /usr/include/sys/dirent.h *)
-			(*
-			d_ino*: INTEGER;	(* inode number *)
-			d_off*: off_t;	(* offset to this dirent *)
-			d_reclen*: SHORTINT;	(* length of this d_name *)
-			d_type*: BYTE;
-			d_name*: ARRAY[untagged]  NAME_MAX+1 OF SHORTCHAR;		(* file name (null-terminated) *)
-			*)
-
-			d_fileno*: INTEGER;
-			d_reclen*: SHORTINT;
-			d_type*: BYTE;
-			d_namlen*: BYTE;
-			d_name*: ARRAY [untagged] NAME_MAX + 1 (* 256 *) OF SHORTCHAR;
-		END;
-
-		pid_t* = INTEGER; (* OpenBSD 5.2: 32-bit *)
-		uid_t* = INTEGER; (* OpenBSD 5.2: 32-bit *)
-
-(*
-		sigval_t* = INTEGER; (* OpenBSD: 32-bit (union sigval) *)
-*)
-		sigval = RECORD [union]
-			sival_int*: INTEGER; (* integer value *)
-			sival_ptr*: PtrVoid; (* pointer value *)
-		END;
-
-		siginfo_t* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/sys/siginfo.h *)
-			si_signo*: INTEGER; (* signal from signal.h *)
-			si_code*: INTEGER; (* code from above *)
-			si_errno*: INTEGER; (* error from errno.h *)
-			_data*: RECORD [union]
-				_pad*: ARRAY [untagged] 29 (* SI_PAD *) OF INTEGER; (* for future growth *)
-				_proc*: RECORD [untagged] (* kill(), SIGCLD, siqqueue() *)
-					_pid*: pid_t; (* process ID *)
-					_pdata*: RECORD [union]
-						_kill*: RECORD [untagged]
-							_uid*: uid_t;
-							_value*: sigval;
-						END;
-						_cld*: RECORD [untagged]
-							_utime*: clock_t;
-							_status*: INTEGER;
-							_stime*: clock_t;
-						END;
-					END;
-				END;
-				_fault*: RECORD [untagged] (* SIGSEGV, SIGBUS, SIGILL and SIGFPE *)
-					_addr*: PtrVoid; (* faulting address *)
-					_trapno*: INTEGER; (* illegal trap number *)
-				END;
-			END;
-		END;
-		Ptrsiginfo_t* = POINTER TO siginfo_t;
-
-		(* sigset_t* = ARRAY [untagged] 128 OF BYTE; *)
-		(* OpenBSD 5.2 /usr/include/sys/signal.h *)
-		(* sigset_t* = ARRAY [untagged] 4 OF BYTE; *)
-		sigset_t* = SET;
-
-		Ptrsigset_t* = INTEGER;
-		sigaction_t* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/sys/signal.h *)
-			sa_sigaction*: PROCEDURE [ccall] (sig: INTEGER; siginfo: Ptrsiginfo_t; ptr: Ptrucontext_t); (* union with sa_handler*: PtrProc;*)
-			sa_mask*: sigset_t;
-			sa_flags*: SET;
-			(* sa_restorer*: LONGINT; *) (* OpenBSD *)
-		END;
-
-		stack_t* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/sys/signal.h *)
-			ss_sp*: PtrVoid;
-			ss_size*: size_t; (* OpenBSD *)
-			ss_flags*: INTEGER; (* OpenBSD *)
-		END;
-
-		dev_t* = INTEGER; (* OpenBSD: 32-bit *)
-		gid_t* = INTEGER; (* OpenBSD: 32-bit *)
-
-		stat_t* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/sys/stat.h *)
-			st_dev*: dev_t;	(* device *) (* OpenBSD: 32-bit *)
-			(* __pad1: SHORTINT; *) (* OpenBSD *)
-			st_ino*: INTEGER;	(* 64? inode *) (* OpenBSD: 32-bit *)
-			st_mode*: mode_t;	(* protection *) (* OpenBSD: 32-bit *)
-			st_nlink*: INTEGER; 	(* number of hard links *) (* OpenBSD: 32-bit *)
-			st_uid*: uid_t;	(* user ID of owner *) (* OpenBSD: 32-bit *)
-			st_gid*: gid_t;	(* group ID of owner *) (* OpenBSD: 32-bit *)
-			st_rdev*: dev_t;	(* device type (if inode device) *) (* OpenBSD: 32-bit *)
-			st_lspare0*: INTEGER; (* OpenBSD *)
-			(* __pad2: SHORTINT; *) (* OpenBSD *)
-
-			(* OpenBSD *)
-			st_atime*: time_t;
-			st_atimensec*: INTEGER;
-			st_mtime*: time_t;
-			st_mtimensec*: INTEGER;
-			st_ctime*: time_t;
-			st_ctimensec*: INTEGER;
-
-			st_size*: off_t;	(* 64? total size, in bytes *) (* OpenBSD *)
-			st_blocks*: LONGINT; (* OpenBSD: 64-bit *)
-			st_blksize*: INTEGER;	(* blocksize for filesystem I/O *)
-			(* st_blocks*: INTEGER;	(* 64? number of blocks allocated *) *) (* OpenBSD *)
-			st_flags*: INTEGER; (* OpenBSD: 32-bit *)
-			st_gen*: INTEGER; (* OpenBSD: 32-bit *)
-			st_lspare1*: INTEGER; (* OpenBSD: 32-bit *)
-
-			(* OpenBSD
-			st_atime*: INTEGER;	(* time of last access *)
-			__unused1:  INTEGER;
-			st_mtime*: INTEGER;	(* time of last modification *)
-			__unused2:  INTEGER;
-			st_ctime*: INTEGER;	(* time of last change *)
-			__unused3:  INTEGER;
-			__unused4:  INTEGER;
-			__unused5:  INTEGER;
-			*)
-
-			(* OpenBSD *)
-			__st_birthtime*: time_t;
-			__st_birthtimensec*: INTEGER;
-			st_qspare*: ARRAY [untagged] 2 OF LONGINT;
-		END;
-
-		(* OpenBSD
-		fpreg* = RECORD [untagged]
-			significand*: ARRAY [untagged] 4 OF CHAR;
-			exponent*: CHAR;
-		END;
-		*)
-
-		(* OpenBSD *)
-		(*
-		fpstate* = RECORD [untagged]
-			cw*: INTEGER; 	(* unsigned long int *)
-			sw*: INTEGER; 	(* unsigned long int *)
-			tag*: INTEGER; 	(* unsigned long int *)
-			ipoff*: INTEGER; 	(* unsigned long int *)
-			cssel*: INTEGER; 	(* unsigned long int *)
-			dataoff*: INTEGER; 	(* unsigned long int *)
-			datasel*: INTEGER; 	(* unsigned long int *)
-			_st: ARRAY [untagged] 8 OF fpreg;
-			status*: INTEGER; 	(* unsigned long int *)
-		END;
-		*)
-		envxmm* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/i386/npx.h *)
-			(*0*)
-				en_cw*: SHORTINT; (* FPU Control Word *)
-				en_sw*: SHORTINT; (* FPU Status Word *)
-				en_tw*: BYTE; (* FPU Tag Word (abridged) *)
-				en_rsvd0*: BYTE;
-				en_opcode*: SHORTINT; (* FPU Opcode *)
-				en_fip*: INTEGER; (* FPU Instruction Pointer *)
-				en_fcs*: SHORTINT; (* FPU IP selector *)
-				en_rsvd1*: SHORTINT;
-			(*16*)
-				en_foo*: INTEGER; (* FPU Data pointer *)
-				en_fos*: SHORTINT; (* FPU Data pointer selector *)
-				en_rsvd2*: SHORTINT;
-				en_mxcsr*: INTEGER; (* MXCSR Register State *)
-				en_mxcsr_mask*: INTEGER; (* Mask for valid MXCSR bits (may be 0) *)
-		END;
-		(* FPU regsters in the extended save format. *)
-		fpaccxmm* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/i386/npx.h *)
-			fp_bytes*: ARRAY [untagged] 10 OF BYTE;
-			fp_rsvd*: ARRAY [untagged] 6 OF BYTE;
-		END;
-		(* SSE/SSE2 registers. *)
-		xmmreg* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/i386/npx.h *)
-			sse_bytes*: ARRAY [untagged] 16 OF BYTE;
-		END;
-		fpstate* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/i386/npx.h savefpu.savexmm *)
-			sv_env*: envxmm; (* control/status context *)
-			sv_ac*: ARRAY [untagged] 8 OF fpaccxmm; (* ST/MM regs *)
-			sv_xmmregs*: ARRAY [untagged] 8 OF xmmreg; (* XMM regs *)
-			sv_rsvd*: ARRAY [untagged] 16 * 14 OF BYTE;
-			(* 512-bytes --- end of hardware portion of save area *)
-			sv_ex_sw*: INTEGER; (* saved SW from last exception *)
-			sv_ex_tw*: INTEGER; (* saved TW from last exception *)
-		END;
-
-		(* OpenBSD
-		gregset_t* = ARRAY [untagged] 19 OF INTEGER;
-		*)
-		fpregset_t* = POINTER TO fpstate;
-
-		(* OpenBSD
-		mcontext_t*  = RECORD [untagged]
-			gregs*: gregset_t;
-			fpregs*: fpregset_t;
-			oldmask*: INTEGER;	(* unsigned long int *)
-			cr2*: INTEGER; 	(* unsigned long int *)
-		END;
-		*)
-
-		Ptrucontext_t* = POINTER TO ucontext_t;
-		ucontext_t* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/i386/signal.h struct sigcontext *)
-			(*
-			uc_flags*: INTEGER;	(* unsigned long int *)
-			uc_link*: Ptrucontext_t;
-			uc_stack*: stack_t;
-			uc_mcontext*: mcontext_t;
-			uc_sigmask: sigset_t;
-			__fpregs_mem*: fpstate;
-			*)
-
-			sc_gs*: INTEGER;
-			sc_fs*: INTEGER;
-			sc_es*: INTEGER;
-			sc_ds*: INTEGER;
-			sc_edi*: INTEGER;
-			sc_esi*: INTEGER;
-			sc_ebp*: INTEGER;
-			sc_ebx*: INTEGER;
-			sc_edx*: INTEGER;
-			sc_ecx*: INTEGER;
-			sc_eax*: INTEGER;
-			(* XXX *)
-			sc_eip*: INTEGER;
-			sc_cs*: INTEGER;
-			sc_eflags*: INTEGER;
-			sc_esp*: INTEGER;
-			sc_ss*: INTEGER;
-
-			sc_onstack*: INTEGER; (* sigstack state to restore *)
-			sc_mask*: INTEGER; (* signal mask to restore *)
-			sc_trapno*: INTEGER; (* XXX should be above *)
-			sc_err*: INTEGER;
-
-			sc_fpstate*: fpregset_t; (* POINTER TO savefpu *)
-		END;
-
-		(* Times and Dates *)
-
-		tm* = POINTER TO tmDesc;
-		tmDesc* = RECORD [untagged] (* OpenBSD 5.2 /usr/include/time.h *)
-			tm_sec*: INTEGER;	(* seconds *)
-			tm_min*: INTEGER;	(* minutes *)
-			tm_hour*: INTEGER;	(* hours *)
-			tm_mday*: INTEGER;	(* day of the month *)
-			tm_mon*: INTEGER;	(* month *)
-			tm_year*: INTEGER;	(* year *)
-			tm_wday*: INTEGER;	(* day of the week *)
-			tm_yday*: INTEGER;	(* day in the year *)
-			tm_isdst*: INTEGER;	(* daylight saving time *)
-
-			tm_gmtoff*: INTEGER; (* OpenBSD *)
-			tm_zone*: PtrSTR; (* OpenBSD *)
-		END;
-
-		time_t* = INTEGER; (* OpenBSD 5.2 /usr/include/i386/_types.h: 32-bit *)
-
-		FILE = ARRAY [untagged] 88 OF BYTE; (* OpenBSD 5.2 /usr/include/stdio.h *)
-
-		wchar_t* = INTEGER; (* OpenBSD 5.2: 32-bit *)
-		PtrWSTR* = POINTER TO ARRAY [untagged] OF wchar_t;
-
-		(* OpenBSD 5.2 *)
-		sigaltstack_t* = RECORD [untagged]
-			ss_sp*: PtrVoid;
-			ss_size*: size_t;
-			ss_flags*: INTEGER;
-		END;
-
-	VAR
-		(* timezone*: INTEGER; (* seconds from GMT *) *) (* OpenBSD: not present *)
-		(* stdin*, stdout*, stderr* : PtrFILE; (* OpenBSD: not present *) *)
-
-		(* OpenBSD: stdin, stdout, stderr *)
-			__sF*: ARRAY [untagged] 3 OF FILE; (* OpenBSD 5.2 /usr/include/stdio.h *)
-			(*
-				stdin = SYSTEM.ADR(__sF[0])
-				stdout = SYSTEM.ADR(__sF[1])
-				stderr = SYSTEM.ADR(__sF[2])
-			*)
-
-	PROCEDURE [ccall] calloc* (nmemb, size: size_t): PtrVoid;
-	PROCEDURE [ccall] clock* (): clock_t;
-
-	PROCEDURE [ccall] closedir* (dir: PtrDIR): INTEGER;
-
-	PROCEDURE [ccall] chmod* (path: PtrSTR; mode: mode_t);
-	PROCEDURE [ccall] exit* (status: INTEGER);
-
-	PROCEDURE [ccall] fclose* (fp: PtrFILE): INTEGER;
-	PROCEDURE [ccall] fflush* (fp: PtrFILE): INTEGER;
-	PROCEDURE [ccall] fopen* (filename, mode: PtrSTR): PtrFILE;
-	PROCEDURE [ccall] feof* (fp: PtrFILE): INTEGER;
-	PROCEDURE [ccall] fread* (ptr: PtrVoid; size, nmemb: size_t; stream: PtrFILE): size_t;
-	PROCEDURE [ccall] fseek* (stream: PtrFILE; offset, origin: INTEGER): INTEGER;
-	PROCEDURE [ccall] free* (p: PtrVoid);
-
-	PROCEDURE [ccall] ftell* (stream: PtrFILE): (* LONGINT; *) INTEGER; (* OpenBSD 5.2 *)
-
-	PROCEDURE [ccall] ftw* (filename: PtrSTR; func: __ftw_func_t; maxfds: INTEGER): INTEGER;
-	PROCEDURE [ccall] fwrite* (ptr: PtrVoid; size, nmemb: size_t; stream: PtrFILE): size_t;
-	PROCEDURE [ccall] getcwd* (buf: PtrSTR; size: size_t): PtrSTR;
-
-	(* PROCEDURE [ccall] getcontext* (ucontext_t: Ptrucontext_t): INTEGER; *) (* OpenBSD *)
-
-	(* PROCEDURE [ccall] gets* (s: PtrSTR); *)
-	PROCEDURE [ccall] gets* (s: PtrSTR): PtrSTR; (* OpenBSD 5.2 *)
-
-	PROCEDURE [ccall] fgets* (s: PtrSTR; n: INTEGER; fp: PtrFILE): PtrSTR;
-	PROCEDURE [ccall] gmtime* (VAR timep: time_t): tm;
-	PROCEDURE [ccall] kill* (pid: pid_t; sig: INTEGER): INTEGER;
-	PROCEDURE [ccall] localtime* (VAR timep: time_t): tm;
-	PROCEDURE [ccall] malloc* (size: size_t): PtrVoid;
-	PROCEDURE [ccall] mkdir* (path: PtrSTR; mode: mode_t): INTEGER;
-	PROCEDURE [ccall] mktime* (timeptr: tm): time_t;
-	PROCEDURE [ccall] opendir* (filename: PtrSTR): PtrDIR;
-	PROCEDURE [ccall] printf* (s: PtrSTR): INTEGER;
-	PROCEDURE [ccall] readdir* (dir: PtrDIR): PtrDirent;
-	PROCEDURE [ccall] remove* (path: PtrSTR): INTEGER;
-	PROCEDURE [ccall] rename* (from, to: PtrSTR): INTEGER;
-	PROCEDURE [ccall] scandir* (dir: PtrDIR; namelist: PtrDirentArray; selector: SelectorFunc; cmp: CmpFunc): INTEGER;
-
-	(* PROCEDURE [ccall] setcontext* (ucontext_t: Ptrucontext_t): INTEGER; *) (* OpenBSD *)
-
-	PROCEDURE [ccall] setjmp* (VAR env: jmp_buf): INTEGER;
-	PROCEDURE [ccall] sigaction* (sig_num: INTEGER; VAR [nil] act: sigaction_t; VAR [nil] oldact: sigaction_t): INTEGER;
-	PROCEDURE [ccall] sigaddset* (set: Ptrsigset_t; sig: INTEGER): INTEGER;
-	PROCEDURE [ccall] sigdelset* (set: Ptrsigset_t; sig: INTEGER): INTEGER;
-	PROCEDURE [ccall] sigemptyset* (set: Ptrsigset_t): INTEGER;
-	PROCEDURE [ccall] sigfillset* (set: Ptrsigset_t): INTEGER;
-	PROCEDURE [ccall] sigismemeber* (set: Ptrsigset_t; sig: INTEGER): INTEGER;
-	PROCEDURE [ccall] siglongjmp* (VAR env: sigjmp_buf; val: INTEGER);
-
-	PROCEDURE [ccall] signal* (sig_num: INTEGER; sighandler: PtrProc): PtrProc;
-	(* PROCEDURE [ccall] sigsetjmp* ["__sigsetjmp"] (VAR env: sigjmp_buf; savemask: INTEGER): INTEGER; *)
-	PROCEDURE [ccall] sigsetjmp* (VAR env: sigjmp_buf; savemask: INTEGER): INTEGER; (* OpenBSD *)
-
-	(* OpenBSD *)
-	PROCEDURE [ccall] stat* (filename: PtrSTR; VAR buf: stat_t): INTEGER;  (* stat is a macro and expands to __xstat(3, filename, buf) *)
-(* OpenBSD: __xstat not present
-	PROCEDURE [ccall] __xstat* (version: INTEGER; filename: PtrSTR; VAR buf: stat_t): INTEGER;
-*)
-
-	PROCEDURE [ccall] strftime* (s: PtrSTR; max: size_t; format: PtrSTR; ptm: tm): size_t;
-	PROCEDURE [ccall] time* (VAR [nil] t: time_t): time_t;
-
-	(* PROCEDURE [ccall] __errno_location*(): INTEGER; *)
-	PROCEDURE [ccall] __errno_location* ["__errno"] (): INTEGER; (* OpenBSD *)
-
-	PROCEDURE [ccall] open* (path: PtrSTR; flags: SET; mode: mode_t): INTEGER;
-	PROCEDURE [ccall] close* (d: INTEGER): INTEGER;
-	PROCEDURE [ccall] read* (d: INTEGER; buf: PtrVoid; nbytes: size_t): ssize_t;
-	PROCEDURE [ccall] write* (d: INTEGER; buf: PtrVoid; nBytes: size_t): ssize_t;
-
-	(* OpenBSD *)
-	PROCEDURE [ccall] mprotect* (addr: PtrVoid; len: size_t; prot: SET): INTEGER;
-
-	(* OpenBSD 5.2 *)
-	PROCEDURE [ccall] madvise* (addr: PtrVoid; len: size_t; behav: INTEGER): INTEGER;
-
-	PROCEDURE [ccall] mmap* (addr: PtrVoid; len: size_t; prot: SET; flags: SET; fd: INTEGER; offset: off_t): PtrVoid;
-	PROCEDURE [ccall] munmap* (addr: PtrVoid; len: size_t): INTEGER;
-
-	PROCEDURE [ccall] getenv* (name: PtrSTR): PtrSTR;
-
-	(* OpenBSD 5.2: Ok *)
-	PROCEDURE [ccall] wctomb* (s: PtrSTR; wchar: wchar_t): INTEGER;
-	PROCEDURE [ccall] wcstombs* (s: PtrSTR; pwcs: PtrWSTR; n: size_t): size_t;
-	PROCEDURE [ccall] mbtowc* (pwc: PtrWSTR; s: PtrSTR; n: size_t): INTEGER;
-	PROCEDURE [ccall] mbstowcs* (pwcs: PtrWSTR; s: PtrSTR; n: size_t): size_t;
-
-	(* OpenBSD 5.2 *)
-	PROCEDURE [ccall] sysconf* (name: INTEGER): INTEGER;
-
-	PROCEDURE [ccall] sigaltstack* (VAR [nil] ss: sigaltstack_t; VAR [nil] oss: sigaltstack_t): INTEGER;
-
-	PROCEDURE [ccall] sigreturn* (ucontext_t: Ptrucontext_t): INTEGER;
-
-	PROCEDURE [ccall] sigprocmask* (how: INTEGER; VAR [nil] set: sigset_t; VAR [nil] oset: sigset_t): INTEGER;
-
-END LinLibc.

+ 36 - 33
new/_OpenBSD_/Lin/Mod/gen-Libc/Makefile

@@ -6,62 +6,65 @@
 
 PY = python2.7
 
-DEFS = defs-errno defs-signal defs-sc defs-madv defs-siginfo defs-siginfo1 defs-sa defs-mman defs-fcntl defs-sig
+DEFS = clockspersec defs-map defs-prot defs-sigmask nsig defs-signo defs-fpe defs-sa defs-errno namemax defs-fcntlo defs-basictypes defs-sc
 
 all: Libc.txt ${DEFS} strerrnocase.txt
 
-Libc.txt: Libc.txt.templ ${DEFS} sizeofs
+Libc.txt: Libc.txt.templ ${DEFS} libver osname machine custom fields-dirent fields-sigaction fields-siginfo fields-stack fields-stat fields-tm fields-ucontext
 	${PY} ./untempl.py Libc.txt.templ ${.TARGET}
-#	perl -pe 's/\n/\r\n/' < ${.TARGET}.tmp > ${.TARGET}
-#	${PY} ./untempl2.py ${.TARGET}.tmp ${.TARGET}
-#	rm -f ${.TARGET}.tmp
 
-sizeofs: sizeofs.c
-	${CC} -O0 -g -o ${.TARGET} ${.ALLSRC}
+clockspersec:
+	grep CLOCKS_PER_SEC /usr/include/time.h | head -1 | awk '{print $$3}' | tr -d '\n' > ${.TARGET}
 
-defs-errno:
-	./dumpdefs.py 2 0 i /usr/include/sys/errno.h > ${.TARGET}
-	./dumpdefs.py 2 1 i /usr/include/sys/errno.h >> ${.TARGET}
+defs-map:
+	./dumpdefs.py 2 0 s /usr/include/sys/mman.h | grep "	MAP_" > ${.TARGET}
 
-defs-tftp:
-	./dumpdefs.py 2 1 i /usr/include/arpa/tftp.h | grep EACCESS > ${.TARGET}
+defs-prot:
+	./dumpdefs.py 2 0 s /usr/include/sys/mman.h | grep "	PROT_" > ${.TARGET}
+
+defs-sigmask:
+	./dumpdefs.py 2 2 i /usr/include/sys/signal.h | grep "	SIG_" > ${.TARGET}
 
-defs-signal:
-	./dumpdefs.py 2 1 i /usr/include/sys/signal.h > ${.TARGET}
+defs-signo:
+	./dumpdefs.py 2 1 i /usr/include/sys/signal.h | grep "	SIG" > ${.TARGET}
 	./dumpdefs.py 2 2 i /usr/include/sys/signal.h | grep SIGWINCH >> ${.TARGET}
 	./dumpdefs.py 2 2 i /usr/include/sys/signal.h | grep SIGTHR >> ${.TARGET}
 
-defs-sig:
-	./dumpdefs.py 2 2 i /usr/include/sys/signal.h | grep SIG_ > ${.TARGET}
+nsig:
+	grep "#define _NSIG" /usr/include/sys/signal.h | head -1 | awk '{print $$3}' | tr -d '\n' > ${.TARGET}
+
+defs-fpe:
+	./dumpdefs.py 2 2 i /usr/include/sys/siginfo.h | grep "	FPE_" > ${.TARGET}
 
 defs-sa:
 	./dumpdefs.py 2 2 s /usr/include/sys/signal.h | grep "	SA_" > ${.TARGET}
 	./dumpdefs.py 2 3 s /usr/include/sys/signal.h | grep "	SA_" >> ${.TARGET}
 
-defs-mman:
-	./dumpdefs.py 2 0 s /usr/include/sys/mman.h | grep "	PROT_" > ${.TARGET}
-	./dumpdefs.py 2 0 s /usr/include/sys/mman.h | grep "	MAP_" >> ${.TARGET}
+defs-errno:
+	./dumpdefs.py 2 0 i /usr/include/sys/errno.h > ${.TARGET}
+	./dumpdefs.py 2 1 i /usr/include/sys/errno.h >> ${.TARGET}
+
+namemax:
+	grep "	NAME_MAX	" /usr/include/sys/syslimits.h | head -1 | awk '{print $$3}' | tr -d '\n' > ${.TARGET}
 
-defs-fcntl:
+defs-fcntlo:
 	./dumpdefs.py 2 2 s /usr/include/fcntl.h | grep -v compat | grep "	O_" > ${.TARGET}
 	./dumpdefs.py 2 1 s /usr/include/fcntl.h | grep "	O_" >> ${.TARGET}
 
-defs-siginfo:
-	./dumpdefs.py 2 1 i /usr/include/sys/siginfo.h > ${.TARGET}
-	./dumpdefs.py 2 2 i /usr/include/sys/siginfo.h >> ${.TARGET}
+defs-basictypes: sizeofs
+	./sizeofs > ${.TARGET}
 
 defs-sc:
 	./dumpdefs.py 2 1 i /usr/include/unistd.h | grep _SC_ > ${.TARGET}
 
-defs-madv:
-	./dumpdefs.py 2 0 i /usr/include/sys/mman.h | grep MADV > ${.TARGET}
-	./dumpdefs.py 2 1 i /usr/include/sys/mman.h | grep MADV >> ${.TARGET}
-
-defs-siginfo1:
-	./dumpdefs.py 2 2 i /usr/include/sys/siginfo.h | grep FPE_ > ${.TARGET}
-	./dumpdefs.py 2 2 i /usr/include/sys/siginfo.h | grep ILL_ >> ${.TARGET}
-	./dumpdefs.py 2 2 i /usr/include/sys/siginfo.h | grep SEGV_ >> ${.TARGET}
-	./dumpdefs.py 2 2 i /usr/include/sys/siginfo.h | grep BUS_ >> ${.TARGET}
+#defs-madv:
+#	./dumpdefs.py 2 0 i /usr/include/sys/mman.h | grep MADV > ${.TARGET}
+#	./dumpdefs.py 2 1 i /usr/include/sys/mman.h | grep MADV >> ${.TARGET}
+#
+#defs-siginfo1:
+#	./dumpdefs.py 2 2 i /usr/include/sys/siginfo.h | grep ILL_ >> ${.TARGET}
+#	./dumpdefs.py 2 2 i /usr/include/sys/siginfo.h | grep SEGV_ >> ${.TARGET}
+#	./dumpdefs.py 2 2 i /usr/include/sys/siginfo.h | grep BUS_ >> ${.TARGET}
 
 dumpstrerrno.c: defs-errno
 	grep -v ERESTART ${.ALLSRC} | grep -v EJUSTRETURN | ./mkdumpstrerrno.py > ${.TARGET}
@@ -70,4 +73,4 @@ strerrnocase.txt: dumpstrerrno
 	./dumpstrerrno | ./mkstrerrnocase.py > ${.TARGET}
 
 clean:
-	rm -f sizeofs ${DEFS} Libc.txt dumpstrerrno dumpstrerrno.c strerrnocase.txt
+	rm -f ${DEFS} Libc.txt dumpstrerrno dumpstrerrno.c strerrnocase.txt sizeofs

+ 13 - 0
new/_OpenBSD_/Lin/Mod/gen-Libc/custom

@@ -0,0 +1,13 @@
+	VAR
+		(* OpenBSD: stdin, stdout, stderr *)
+			__sF*: ARRAY [untagged] 3 OF FILE; (* OpenBSD 5.2 /usr/include/stdio.h *)
+				(*
+					stdin = SYSTEM.ADR(__sF[0])
+					stdout = SYSTEM.ADR(__sF[1])
+					stderr = SYSTEM.ADR(__sF[2])
+				*)
+
+	PROCEDURE [ccall] __errno_location* ["__errno"] (): PtrVoid;
+
+	(* POSIX.1 *)
+		PROCEDURE [ccall] stat* (path: PtrSTR; VAR sp: stat_t): int;

+ 6 - 0
new/_OpenBSD_/Lin/Mod/gen-Libc/fields-dirent

@@ -0,0 +1,6 @@
+			(* OpenBSD 5.2 /usr/include/sys/dirent.h *)
+				d_fileno*: u_int32_t; (* file number of entry *)
+				d_reclen*: u_int16_t; (* length of this record *)
+				d_type*: u_int8_t; (* file type, see below *)
+				d_namlen*: u_int8_t; (* length of string in d_name *)
+				d_name*: ARRAY [untagged] 255 + 1 OF SHORTCHAR;

+ 4 - 0
new/_OpenBSD_/Lin/Mod/gen-Libc/fields-sigaction

@@ -0,0 +1,4 @@
+			(* OpenBSD 5.2 /usr/include/sys/signal.h *)
+				sa_sigaction*: PROCEDURE [ccall] (sig: int; siginfo: Ptrsiginfo_t; ctx: Ptrucontext_t);
+				sa_mask*: sigset_t;
+				sa_flags*: intFlags;

+ 28 - 0
new/_OpenBSD_/Lin/Mod/gen-Libc/fields-siginfo

@@ -0,0 +1,28 @@
+			(* OpenBSD 5.2 /usr/include/sys/siginfo.h *)
+				si_signo*: int; (* signal from signal.h *)
+				si_code*: int; (* code from above *)
+				si_errno*: int; (* error from errno.h *)
+				_data*: RECORD [union]
+					_pad*: ARRAY [untagged] 29 (* SI_PAD *) OF int; (* for future growth *)
+					_proc*: RECORD [untagged] (* kill(), SIGCLD, siqqueue() *)
+						_pid*: pid_t; (* process ID *)
+						_pdata*: RECORD [union]
+							_kill*: RECORD [untagged]
+								_uid*: uid_t;
+(*
+								_value*: sigval;
+*)
+								_value*: int
+							END;
+							_cld*: RECORD [untagged]
+								_utime*: clock_t;
+								_status*: int;
+								_stime*: clock_t;
+							END;
+						END;
+					END;
+					_fault*: RECORD [untagged] (* SIGSEGV, SIGBUS, SIGILL and SIGFPE *)
+						_addr*: PtrVoid; (* faulting address *)
+						_trapno*: int; (* illegal trap number *)
+					END;
+				END;

+ 4 - 0
new/_OpenBSD_/Lin/Mod/gen-Libc/fields-stack

@@ -0,0 +1,4 @@
+			(* OpenBSD 5.2 /usr/include/sys/signal.h *)
+				ss_sp*: PtrVoid; (* signal stack base *)
+				ss_size*: size_t; (* signal stack length *)
+				ss_flags*: intFlags; (* SS_DISABLE and/or SS_ONSTACK *)

+ 27 - 0
new/_OpenBSD_/Lin/Mod/gen-Libc/fields-stat

@@ -0,0 +1,27 @@
+			(* OpenBSD 5.2 /usr/include/sys/stat.h *)
+				st_dev*: dev_t;
+				st_ino*: ino_t;
+				st_mode*: mode_t;
+				st_nlink*: nlink_t;
+				st_uid*: uid_t;
+				st_gid*: gid_t;
+				st_rdev*: dev_t;
+				st_lspare0*: int32_t;
+
+				st_atime*: time_t;
+				st_atimensec*: long;
+				st_mtime*: time_t;
+				st_mtimensec*: long;
+				st_ctime*: time_t;
+				st_ctimensec*: long;
+
+				st_size*: off_t;
+				st_blocks*: int64_t;
+				st_blksize*: u_int32_t;
+				st_flags*: u_int32_t;
+				st_gen*: u_int32_t;
+				st_lspare1*: int32_t;
+
+				__st_birthtime*: time_t;
+				__st_birthtimensec*: long;
+				st_qspare*: ARRAY [untagged] 2 OF int64_t;

+ 12 - 0
new/_OpenBSD_/Lin/Mod/gen-Libc/fields-tm

@@ -0,0 +1,12 @@
+			(* OpenBSD 5.2 /usr/include/time.h *)
+				tm_sec*: int; (* seconds after the minute [0-60] *)
+				tm_min*: int; (* minutes after the hour [0-59] *)
+				tm_hour*: int; (* hours since midnight [0-23] *)
+				tm_mday*: int; (* day of the month [1-31] *)
+				tm_mon*: int; (* months since January [0-11] *)
+				tm_year*: int; (* years since 1900 *)
+				tm_wday*: int; (* days since Sunday [0-6] *)
+				tm_yday*: int; (* days since January 1 [0-365] *)
+				tm_isdst*: int; (* Daylight Saving Time flag *)
+				tm_gmtoff*: long; (* offset from UTC in seconds *)
+				tm_zone*: PtrSTR; (* timezone abbreviation *)

+ 36 - 0
new/_OpenBSD_/Lin/Mod/gen-Libc/fields-ucontext

@@ -0,0 +1,36 @@
+			(* OpenBSD 5.2 /usr/include/i386/signal.h struct sigcontext *)
+				sc_gs*: int;
+				sc_fs*: int;
+				sc_es*: int;
+				sc_ds*: int;
+				sc_edi*: int;
+				sc_esi*: int;
+				sc_ebp*: int;
+				sc_ebx*: int;
+				sc_edx*: int;
+				sc_ecx*: int;
+				sc_eax*: int;
+				(* XXX *)
+				sc_eip*: int;
+				sc_cs*: int;
+				sc_eflags*: int;
+				sc_esp*: int;
+				sc_ss*: int;
+
+				sc_onstack*: int; (* sigstack state to restore *)
+				sc_mask*: int; (* signal mask to restore *)
+
+				sc_trapno*: int; (* XXX should be above *)
+				sc_err*: int;
+
+				sc_fpstate*: RECORD [union]
+					(* OpenBSD 5.2 /usr/include/i386/npx.h union savefpu *)
+(*
+						sv_87*: RECORD [untagged]
+							...
+						END;
+						sv_xmm*: RECORD [untagged]
+							...
+						END;
+*)
+				END;

+ 1 - 0
new/_OpenBSD_/Lin/Mod/gen-Libc/libver

@@ -0,0 +1 @@
+.66.0

+ 1 - 0
new/_OpenBSD_/Lin/Mod/gen-Libc/machine

@@ -0,0 +1 @@
+i386

+ 1 - 0
new/_OpenBSD_/Lin/Mod/gen-Libc/osname

@@ -0,0 +1 @@
+OpenBSD 5.2

+ 1 - 0
new/_OpenBSD_/Lin/Mod/gen-Libc/sigstksz

@@ -0,0 +1 @@
+8192 + 32768

+ 74 - 14
new/_OpenBSD_/Lin/Mod/gen-Libc/sizeofs.c

@@ -1,25 +1,85 @@
 #include <sys/types.h>
-
 #include <sys/signal.h>
-
+#include <setjmp.h>
 #include <stdlib.h>
-
 #include <stdio.h>
 
-#define SZ(A, B) printf("%s %d\n", A, sizeof(B));
+#define TABS "\t\t"
 
-int main ()
+#define FALSE (0)
+#define TRUE (1)
+
+static void D (const char *s, int sz, int set, int export)
 {
-	SZ("size_t", size_t);
-	SZ("ssize_t", ssize_t);
-	SZ("off_t", off_t);
-	SZ("clock_t", clock_t);
-	SZ("mode_t", mode_t);
-	SZ("pid_t", pid_t);
-	SZ("uid_t", uid_t);
-	SZ("sigset_t", sigset_t);
+	int res;
 
-	SZ("wchar_t", wchar_t);
+	res = printf("%s%s", TABS, s);
+	if (export) {
+		res = printf("*");
+	}
+	res = printf(" = ");
+	if (sz == 1) {
+		res = printf("SHORTCHAR");
+	} else if (sz == 2) {
+		res = printf("SHORTINT");
+	} else if (sz == 4) {
+		if (set) {
+			res = printf("SET");
+		} else {
+			res = printf("INTEGER");
+		}
+	} else if (sz == 8) {
+		if (set) {
+			res = printf("ARRAY [untagged] 2 OF SET");
+		} else {
+			res = printf("LONGINT");
+		}
+	} else {
+		res = printf("ARRAY [untagged] ");
+		if (sz % 4 == 0) {
+			if (set) {
+				res = printf("%d OF SET", sz / 4);
+			} else {
+				res = printf("%d OF INTEGER", sz / 4);
+			}
+		} else {
+			res = printf("%d OF SHORTCHAR", sz);
+		}
+	}
+	res = printf(";\n");
+}
+
+int main ()
+{
+	D("PtrVoid", sizeof(void *), FALSE, TRUE);
+	D("int", sizeof(int), FALSE, TRUE);
+	D("long", sizeof(long), FALSE, TRUE);
+	D("ulong", sizeof(unsigned long), FALSE, TRUE);
+	D("size_t", sizeof(size_t), FALSE, TRUE);
+	D("ssize_t", sizeof(ssize_t), FALSE, TRUE);
+	D("off_t", sizeof(off_t), FALSE, TRUE);
+	D("clock_t", sizeof(clock_t), FALSE, TRUE);
+	D("time_t", sizeof(time_t), FALSE, TRUE);
+	D("mode_t", sizeof(mode_t), TRUE, TRUE);
+	D("pid_t", sizeof(pid_t), FALSE, TRUE);
+	D("uid_t", sizeof(uid_t), FALSE, TRUE);
+	D("gid_t", sizeof(gid_t), FALSE, TRUE);
+	D("dev_t", sizeof(dev_t), FALSE, TRUE);
+	D("ino_t", sizeof(ino_t), FALSE, TRUE);
+	D("nlink_t", sizeof(nlink_t), FALSE, TRUE);
+	D("int8_t", sizeof(int8_t), FALSE, TRUE);
+	D("u_int8_t", sizeof(u_int8_t), FALSE, TRUE);
+	D("int16_t", sizeof(int16_t), FALSE, TRUE);
+	D("u_int16_t", sizeof(u_int16_t), FALSE, TRUE);
+	D("int32_t", sizeof(int32_t), FALSE, TRUE);
+	D("u_int32_t", sizeof(u_int32_t), FALSE, TRUE);
+	D("int64_t", sizeof(int64_t), FALSE, TRUE);
+	D("u_int64_t", sizeof(u_int64_t), FALSE, TRUE);
+	D("wchar_t", sizeof(wchar_t), FALSE, TRUE);
+	D("sigset_t", sizeof(sigset_t), TRUE, TRUE);
+	D("sigjmp_buf", sizeof(sigjmp_buf), FALSE, TRUE);
+	D("intFlags", sizeof(int), TRUE, TRUE);
+	D("FILE", sizeof(FILE), FALSE, FALSE);
 
 	return 0;
 }

BIN
new/_OpenBSD_/System/Mod/Kernel.odc


BIN
new/_OpenBSD_/libBB.so


BIN
new/_OpenBSD_/libBB0.so