summaryrefslogtreecommitdiff
blob: b6e3ed363bab8c7e2163ea0af78a170f6a7a7886 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
===================================================================
RCS file: /cvsroot/clisp/clisp/modules/bindings/linuxlibc6/linux.lisp,v
retrieving revision 1.16
retrieving revision 1.18
diff -u -r1.16 -r1.18
--- clisp/clisp/modules/bindings/linuxlibc6/linux.lisp	2002/07/09 21:28:04	1.16 clisp_2_30-2002-09-15
+++ clisp/clisp/modules/bindings/linuxlibc6/linux.lisp	2003/02/09 23:27:40	1.18 HEAD
@@ -403,8 +403,11 @@
 ; ------------------------------ <errnos.h> -----------------------------------
 
 (def-call-out __errno_location (:arguments) (:return-type (c-ptr int)))
+;; both are broken:
 ;; (define-symbol-macro errno (deref (foreign-value (__errno_location))))
-(def-c-var errno (:type ffi:int))
+;; *** - FFI::%DEREF: argument is not a foreign variable: 22
+;; (def-c-var errno (:type ffi:int))
+;; link error: "undefined reference to `errno'"
 
 ; ------------------------------ <errno.h> ------------------------------------
 
@@ -506,7 +509,7 @@
 (defconstant PIPE_BUF 4096)
 )
 
-;;; ----------------------------- <local_lim.h> ---------------------------------
+;;; ----------------------------- <local_lim.h> -------------------------------
 
 (defconstant _POSIX_THREAD_KEYS_MAX 128)
 (defconstant PTHREAD_KEYS_MAX 1024)
@@ -518,7 +521,10 @@
 ;;; ---------------------------- <posix1_lim.h> ------------------------------
 
 (defconstant SSIZE_MAX INT_MAX)
-(defconstant NGROUPS_MAX _POSIX_NGROUPS_MAX)
+;; #ifndef NGROUPS_MAX
+;; # define NGROUPS_MAX _POSIX_NGROUPS_MAX
+;; #endif
+;; (defconstant NGROUPS_MAX _POSIX_NGROUPS_MAX)
 
 ;;; ---------------------------- <posix2_lim.h> ------------------------------
 
@@ -620,7 +626,7 @@
 (defconstant EXIT_FAILURE 1)
 (defconstant EXIT_SUCCESS 0)
 
-(def-call-out __ctype_get_mb_cur_max (:arguments) (:return-type int))
+(def-call-out __ctype_get_mb_cur_max (:arguments) (:return-type size_t))
 (define-symbol-macro MB_CUR_MAX (__ctype_get_mb_cur_max))
 
 (def-call-out atof (:arguments (nptr c-string)) (:return-type double-float))
@@ -657,10 +663,10 @@
 (def-call-out random (:arguments) (:return-type int32_t))
 (def-call-out srandom (:arguments (seed uint)) (:return-type nil))
 (def-call-out initstate
-    (:arguments (seed uint) (statebuf c-pointer) (statelen size_t))
-  (:return-type c-pointer))
-(def-call-out setstate (:arguments (statebuf c-pointer))
-  (:return-type c-pointer))
+    (:arguments (seed uint) (statebuf c-string) (statelen size_t))
+  (:return-type c-string))
+(def-call-out setstate (:arguments (statebuf c-string))
+  (:return-type c-string))
 
 ;; (def-c-struct random_data ...)
 (def-call-out random_r
@@ -691,8 +697,8 @@
   (:return-type long))
 (def-call-out srand48 (:arguments (seedval long))
   (:return-type nil))
-(def-call-out seed48 (:arguments (seed16v (c-ptr (c-array ushort 3))))
-  (:return-type (c-ptr (c-array ushort 3)) :none))
+(def-call-out seed48 (:arguments (seed16v (c-array ushort 3)))
+  (:return-type (c-ptr ushort) :none))
 (def-call-out lcong48 (:arguments (param (c-ptr (c-array ushort 7))))
   (:return-type nil))
 
@@ -755,7 +761,7 @@
 (def-call-out setenv
     (:arguments (name c-string) (value c-string) (replace boolean))
   (:return-type int))
-(def-call-out unsetenv (:arguments (name c-string)) (:return-type nil))
+(def-call-out unsetenv (:arguments (name c-string)) (:return-type int))
 
 (def-call-out clearenv (:arguments) (:return-type int))
 
@@ -778,7 +784,7 @@
     (:arguments (name c-string)
                 (resolved (c-ptr (c-array-max character #.PATH_MAX))
                           :out :alloca))
-  (:return-type (c-ptr (c-array-max character #.PATH_MAX))))
+  (:return-type c-string))
 
 (def-c-type comparison_fn_t
     (c-function (:arguments (p1 c-pointer) (p2 c-pointer))
@@ -1169,14 +1175,19 @@
 
 (def-c-var environ (:type (c-array-ptr c-string)) (:read-only t))
 
-;(def-call-out execve
-;    (:arguments (path c-string) (argv c-pointer) (envp c-pointer)) ; ??
-;  (:return-type int))
-;(def-call-out fexecve
-;    (:arguments (fd int) (argv c-pointer) (envp c-pointer)) ; ??
-;  (:return-type int)) ; is a stub (see <gnu/stubs.h>)
-;(def-call-out execv (:arguments (path c-string) (argv c-pointer)) ; ??
-;  (:return-type int))
+(def-call-out execv
+    (:arguments (path c-string) (argv (c-array-ptr c-string)))
+  (:return-type int)
+  (:name "execv"))
+(def-call-out execve
+    (:arguments (path c-string) (argv (c-array-ptr c-string))
+                (envp (c-array-ptr c-string)))
+  (:return-type int)
+  (:name "execv"))
+(def-call-out execvp
+    (:arguments (file c-string) (argv (c-array-ptr c-string)))
+  (:return-type int)
+  (:name "execvp"))
 
 (def-call-out execle0
     (:arguments (path c-string) (argv0 c-string) (null c-string)