소스 검색

OpenBSD Libc clarified

Alexander Shiryaev 12 년 전
부모
커밋
d375f46f13
1개의 변경된 파일48개의 추가작업 그리고 37개의 파일을 삭제
  1. 48 37
      BlackBox/_OpenBSD_/Lin/Mod/Libc.txt

+ 48 - 37
BlackBox/_OpenBSD_/Lin/Mod/Libc.txt

@@ -1,7 +1,7 @@
 MODULE LinLibc ["libc.so.66.0"];
 
 	(*
-		A. V. Shiryaev, 2012.09
+		A. V. Shiryaev, 2012.11
 
 		Based on Linux' LinLibc (OpenBUGS Lin/Mod/Libc.odc)
 
@@ -35,7 +35,7 @@ MODULE LinLibc ["libc.so.66.0"];
 		SIG_IGN* = 1;    	(* Ignore signal.  *)
 		SIG_HOLD* = 3;	(* Add signal to hold mask.  *) (* OpenBSD 5.2 /usr/include/sys/signalvar.h *)
 
-		(* Signals.  *)
+		(* Signals. *)
 		(* OpenBSD /usr/include/sys/signal.h *)
 		_NSIG* = 33; (* counting 0 (mask is 1-32) *)
 		SIGHUP* = 1; (* hangup *)
@@ -68,20 +68,21 @@ 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 *)
 
-		(* Bits in `sa_flags'.  *)
-		SA_NOCLDSTOP* = {3}; 	(* = 1 Don't send SIGCHLD when children stop.  *) (* OpenBSD *)
-		SA_NOCLDWAIT* = {5}; 	(* = 2 Don't create zombie on child death.  *) (* OpenBSD *)
-		SA_SIGINFO* = {6}; 	(* = 4 Invoke signal-catching function wth three arguments instead of one.  *) (* OpenBSD *)
-		SA_ONSTACK* = {0};	(* = 0x08000000 Use signal stack by using `sa_restorer'. *) (* OpenBSD *)
-		SA_RESTART* = {1};	(* = 0x10000000 Restart syscall on signal return.  *) (* OpenBSD *)
-		SA_NODEFER* = {4};	(* = 0x40000000 Don't automatically block the signal when its handler is being executed. *) (* OpenBSD *)
-		SA_RESETHAND* = {2};	(* = 0x80000000 Reset to SIG_DFL on entry to handler.  *) (* OpenBSD *)
-		(* SA_INTERRUPT* = {29};	(* = 0x20000000  Historical no-op.  *) *) (* OpenBSD *)
 		(* 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 *)
@@ -184,23 +185,28 @@ MODULE LinLibc ["libc.so.66.0"];
 		_JBLEN = 10;
 
 		(* OpenBSD 5.2 /usr/include/sys/mman.h *)
-		PROT_NONE* = {}; (* no permission *)
+		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 *)
-
-		(* OpenBSD 5.2 /usr/include/sys/mman.h *)
-		MAP_FILE* = {}; (* map from file (default) *)
-		MAP_ANON* = {12}; (* allocated from memory, swap space *)
+		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_HASSEMAPHORE* = {9}; (* region may contain semaphores *)
+		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_PRIVATE* = {1}; (* changes are private *)
-		MAP_SHARED* = {0}; (* share changes *)
+		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_COPY* = {2}; (* "copy" region at mmap time *)
+		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 *)
 
-		MAP_FAILED* = -1;
 
 		(* OpenBSD 5.2 /usr/include/i386/param.h *)
 		PAGE_SHIFT* = 12;
@@ -208,22 +214,26 @@ MODULE LinLibc ["libc.so.66.0"];
 		PAGE_MASK* = PAGE_SIZE - 1;
 
 		(* OpenBSD 5.2: /usr/include/fcntl.h *)
-		O_RDONLY* = {};
-		O_WRONLY* = {0};
-		O_RDWR* = {1};
-		O_ACCMODE* = {0,1};
-
-		O_NONBLOCK* = {2}; (* Do not block on open or for data to become available *)
-		O_APPEND* = {3}; (* Append on each write *)
-		O_CREAT* = {9}; (* Create file if it does not exist *)
-		O_TRUNC* = {10}; (* Truncate size to 0 *)
-		O_EXCL* = {11}; (* Error if create and file exists *)
-		O_SYNC* = {7}; (* Perform synchronous I/O operations *)
-		O_SHLOCK* = {4}; (* Atomically obtain a shared lock *)
-		O_EXLOCK* = {5}; (* Atomically obtain an exclusive lock *)
-		O_NOFOLLOW* = {8}; (* If last path element is a symlink, don't follow it *)
-		O_CLOEXEC* = {16}; (* Set FD_CLOEXEC on the new file descriptor *)
-		O_DIRECTORY* = {17}; (* Error if path does not name a directory *)
+		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;
@@ -382,6 +392,7 @@ MODULE LinLibc ["libc.so.66.0"];
 		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 *)