Megatest

Diff
Login

Differences From Artifact [9d6c3c801d]:

To Artifact [5e895e3307]:


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
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







+
-
+
















-







;;     You should have received a copy of the GNU General Public License
;;     along with Megatest.  If not, see <http://www.gnu.org/licenses/>.
;;


(declare (unit portlogger))
(declare (uses debugprint))
(declare (uses commonmod))
(declare (uses dbmod))
;; (declare (uses dbmod))

(module portlogger
*

(import scheme)

(cond-expand
 (chicken-4
  (import chicken data-structures)
  (import posix
	  ;; hostinfo
	  ;; dot-locking
	  extras
	  )
  
  (import (prefix sqlite3 sqlite3:))
  (import debugprint dbmod)
  )
 (chicken-5
  (import chicken.base
	  chicken.condition
	  chicken.file
	  chicken.pathname
	  chicken.process-context.posix
56
57
58
59
60
61
62
63




64
65
66
67
68
69
70
56
57
58
59
60
61
62

63
64
65
66
67
68
69
70
71
72
73







-
+
+
+
+







  (define file-write-access? file-writable?)
  (define random pseudo-random-integer)
  ))

(import srfi-1 srfi-69 z3
	(srfi 18) s11n)
(import (prefix sqlite3 sqlite3:))
(import debugprint dbmod)
(import debugprint
	;; dbmod
	commonmod
	)

;; lsof -i

(define (portlogger:open-db fname)
  (let* ((avail    (tasks:wait-on-journal fname 5 remove: #t)) ;; wait up to about 10 seconds for the journal to go away
	 (exists   (file-exists? fname))
	 (db       (if avail