21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
(declare (unit portlogger))
(declare (uses debugprint))
(declare (uses dbmod))
(module portlogger
*
(import scheme chicken data-structures)
(import srfi-1 posix srfi-69 hostinfo dot-locking z3
(srfi 18) extras s11n)
(import (prefix sqlite3 sqlite3:))
(import debugprint dbmod)
;; 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
(sqlite3:open-database fname)
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
>
|
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
|
(declare (unit portlogger))
(declare (uses debugprint))
(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
chicken.process
chicken.sort
chicken.string
chicken.time
chicken.random
system-information
)
(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)
;; 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
(sqlite3:open-database fname)
|