clisp-2.49.92-after_glibc_cfree_bdb.patch 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. diff -r -U3 clisp-2.49.90.orig/modules/berkeley-db/bdb.c clisp-2.49.90/modules/berkeley-db/bdb.c
  2. --- clisp-2.49.90.orig/modules/berkeley-db/bdb.c 2018-01-27 12:03:01.000000000 +0100
  3. +++ clisp-2.49.90/modules/berkeley-db/bdb.c 2018-02-12 20:37:24.203803219 +0100
  4. @@ -2216,7 +2216,13 @@
  5. c_data.compact_timeout = timeout;
  6. c_data.compact_pages = pages;
  7. SYSCALL(db->compact,(db,txn,pstart,pstop,&c_data,flags,&end));
  8. - pushSTACK(uint32_to_I(c_data.compact_empty_buckets));
  9. + /* ====
  10. + * compact_empty_buckets is in bdb-5.3 as part of output stats
  11. + * however this version use bdb-4.8 which does not have it
  12. + * ====
  13. + *
  14. + * pushSTACK(uint32_to_I(c_data.compact_empty_buckets));
  15. + * */
  16. pushSTACK(uint32_to_I(c_data.compact_pages_free));
  17. pushSTACK(uint32_to_I(c_data.compact_pages_examine));
  18. pushSTACK(uint32_to_I(c_data.compact_levels));
  19. diff -r -U3 clisp-2.49.90.orig/modules/bindings/glibc/linux.lisp clisp-2.49.90/modules/bindings/glibc/linux.lisp
  20. --- clisp-2.49.90.orig/modules/bindings/glibc/linux.lisp 2018-01-10 00:32:25.000000000 +0100
  21. +++ clisp-2.49.90/modules/bindings/glibc/linux.lisp 2018-02-12 20:48:22.467775536 +0100
  22. @@ -1,7 +1,7 @@
  23. ;; Foreign functions provided by the Linux C library version 6,
  24. ;; i.e. the GNU C library version 2.0.7.
  25. ;; Bruno Haible 10.4.1998, 19.4.1998
  26. -;; Sam Steingold 2002-2008, 2011
  27. +;; Sam Steingold 2002-2008, 2011, 2013, 2016-2017
  28. ;; NB: quite a few functions here have more portable counterparts in POSIX
  29. @@ -686,9 +686,8 @@
  30. (def-call-out system? (:arguments (null c-string))
  31. (:return-type boolean) (:name "system"))
  32. -; You can uncomment this if your compiler sets __USE_GNU
  33. -; (def-call-out canonicalize_file_name (:arguments (name c-string))
  34. -; (:return-type c-string :malloc-free))
  35. +(def-call-out canonicalize_file_name (:arguments (name c-string))
  36. + (:return-type c-string :malloc-free))
  37. (def-call-out realpath
  38. (:arguments (name c-string)
  39. @@ -1040,9 +1039,8 @@
  40. (def-call-out access (:arguments (name c-string) (type int))
  41. (:return-type int))
  42. -; You can uncomment this if your compiler sets __USE_GNU
  43. -; (def-call-out euidaccess (:arguments (name c-string) (type int))
  44. -; (:return-type int))
  45. +(def-call-out euidaccess (:arguments (name c-string) (type int))
  46. + (:return-type int))
  47. (defconstant SEEK_SET 0)
  48. (defconstant SEEK_CUR 1)
  49. @@ -1093,9 +1091,8 @@
  50. ;(def-call-out getcwd (:arguments (buf c-string :out) (size size_t)) ; ??
  51. ; (:return-type c-string))
  52. -; You can uncomment this if your compiler sets __USE_GNU
  53. -; (def-call-out get_current_dir_name (:arguments)
  54. -; (:return-type c-string :malloc-free))
  55. +(def-call-out get_current_dir_name (:arguments)
  56. + (:return-type c-string :malloc-free))
  57. ;(def-call-out getwd (:arguments (buf c-string :out)) ; ??
  58. ; (:return-type c-string))
  59. @@ -1323,8 +1320,7 @@
  60. ; (:arguments (size int) (list (c-ptr (c-array gid_t ??)) :out)) ; ??
  61. ; (:return-type int))
  62. -; You can uncomment this if your compiler sets __USE_GNU
  63. -; (def-call-out group_member (:arguments (gid gid_t)) (:return-type boolean))
  64. +(def-call-out group_member (:arguments (gid gid_t)) (:return-type boolean))
  65. (def-call-out setuid (:arguments (uid uid_t)) (:return-type int))
  66. (def-call-out setreuid (:arguments (ruid uid_t) (euid uid_t))
  67. (:return-type int))
  68. @@ -1821,8 +1817,7 @@
  69. (:return-type c-string :malloc-free))
  70. (def-call-out ungetc (:arguments (c int) (fp FILE))
  71. (:return-type int))
  72. -; You can uncomment this if your compiler sets __USE_GNU
  73. -; (def-call-out fcloseall (:arguments) (:return-type int))
  74. +(def-call-out fcloseall (:arguments) (:return-type int))
  75. (def-call-out fdopen (:arguments (fildes int) (mode c-string))
  76. (:return-type c-pointer))
  77. (def-call-out fileno (:arguments (fp FILE)) (:return-type int))
  78. @@ -1900,11 +1895,11 @@
  79. (:return-type (c-ptr-null dirent)))
  80. (def-call-out readdir64 (:arguments (dirp c-pointer))
  81. (:return-type (c-ptr-null dirent64)))
  82. -(def-call-out readdir_r
  83. +(def-call-out readdir_r ; deprecated
  84. (:arguments (dirp c-pointer) (entry (c-ptr dirent) :out :alloca)
  85. (result (c-ptr (c-ptr dirent)) :out :alloca)) ; ??
  86. (:return-type int))
  87. -(def-call-out readdir64_r
  88. +(def-call-out readdir64_r ; deprecated
  89. (:arguments (dirp c-pointer) (entry (c-ptr dirent64) :out :alloca)
  90. (result (c-ptr (c-ptr dirent64)) :out :alloca)) ; ??
  91. (:return-type int))
  92. diff -r -U3 clisp-2.49.90.orig/modules/bindings/glibc/test.tst clisp-2.49.90/modules/bindings/glibc/test.tst
  93. --- clisp-2.49.90.orig/modules/bindings/glibc/test.tst 2018-01-10 00:04:26.000000000 +0100
  94. +++ clisp-2.49.90/modules/bindings/glibc/test.tst 2018-02-12 20:50:48.225769407 +0100
  95. @@ -14,6 +14,16 @@
  96. (= linux:DT_DIR (linux:dirent64-d_type (show (linux:readdir64 *d*)))) T
  97. (linux:closedir *d*) 0
  98. +(stringp (show (linux:get-domain-name))) T
  99. +(stringp (show (linux:get-host-name))) T
  100. +
  101. +;; usually __USE_GNU is defined, so this should work:
  102. +(let* ((d (linux:get_current_dir_name))
  103. + (c (linux:canonicalize_file_name (concatenate 'string d "/."))))
  104. + (or (string= d c)
  105. + (list :cur-dir d :canonical c)))
  106. +T
  107. +
  108. (defparameter *d* (show (linux:opendir "."))) *D*
  109. (linux:dirent-d_name (show (linux:readdir *d*))) "."
  110. (linux:dirent-d_name (show (linux:readdir *d*))) ".."
  111. diff -r -U3 clisp-2.49.90.orig/src/foreign1.lisp clisp-2.49.90/src/foreign1.lisp
  112. --- clisp-2.49.90.orig/src/foreign1.lisp 2018-01-10 00:04:26.000000000 +0100
  113. +++ clisp-2.49.90/src/foreign1.lisp 2018-02-12 21:03:56.768736245 +0100
  114. @@ -805,14 +805,17 @@
  115. c-name (to-c-string c-name) (third variable) (first variable))
  116. (when *foreign-guard* (format *coutput-stream* "# endif~%"))))
  117. (dolist (function *function-list*)
  118. - (let ((c-name (first function)))
  119. - (when *foreign-guard*
  120. - (format *coutput-stream* "# if defined(HAVE_~A)~%"
  121. - (string-upcase c-name)))
  122. + (let ((c-name (first function))
  123. + (guard (fourth function)))
  124. + (when guard
  125. + (format *coutput-stream* "# if ~A~%"
  126. + (if (eq guard t)
  127. + (format nil "defined(HAVE_~A)" (string-upcase c-name))
  128. + guard)))
  129. (format *coutput-stream*
  130. " register_foreign_function((void*)&~A,~A,~D);~%"
  131. c-name (to-c-string c-name) (svref (second function) 3))
  132. - (when *foreign-guard* (format *coutput-stream* "# endif~%"))))
  133. + (when guard (format *coutput-stream* "# endif~%"))))
  134. (maphash (lambda (type fun-vec)
  135. (declare (ignore type))
  136. (let ((c-name (to-c-name (car fun-vec))))
  137. @@ -1083,7 +1086,7 @@
  138. (defmacro DEF-CALL-OUT (&whole whole-form name &rest options)
  139. (setq name (check-symbol name (first whole-form)))
  140. (let* ((alist
  141. - (parse-options options '(:name :arguments :return-type :language
  142. + (parse-options options '(:name :arguments :return-type :language :guard
  143. :built-in :library :version :documentation)
  144. whole-form))
  145. (def (gensym "DEF-CALL-OUT-"))
  146. @@ -1095,6 +1098,7 @@
  147. (version (second (assoc :version alist)))
  148. (c-name (foreign-name name (assoc :name alist)))
  149. (built-in (second (assoc :built-in alist)))
  150. + (guard (get-assoc :guard alist '*foreign-guard*))
  151. ;; Maximize sharing in .fas file, reuse options
  152. ;; parse-c-function ignores unknown options, e.g. :name
  153. (ctype `(PARSE-C-FUNCTION ',options ',whole-form)))
  154. @@ -1102,7 +1106,7 @@
  155. ',c-name ,ctype ',properties ,library ,version NIL)))
  156. (EXT:COMPILER-LET ((,def ,ctype))
  157. (EVAL-WHEN (COMPILE)
  158. - (UNLESS ,LIBRARY (NOTE-C-FUN ',c-name ,def ',built-in)))
  159. + (UNLESS ,LIBRARY (NOTE-C-FUN ',c-name ,def ',built-in ,guard)))
  160. (SYSTEM::EVAL-WHEN-COMPILE
  161. (SYSTEM::C-DEFUN ',name (C-TYPE-TO-SIGNATURE ,ctype))))
  162. (WHEN ,def ; found library function
  163. @@ -1110,10 +1114,10 @@
  164. (SYSTEM::%PUTD ',name ,def))
  165. ',name)))
  166. -(defun note-c-fun (c-name ctype built-in) ; not ABI, compile-time only
  167. +(defun note-c-fun (c-name ctype built-in guard) ; not ABI, compile-time only
  168. (when (system::prepare-coutput-file)
  169. (prepare-module)
  170. - (push (list c-name ctype built-in)
  171. + (push (list c-name ctype built-in guard)
  172. *function-list*)))
  173. (defun count-inarguments (arg-vector)