︙ | | | ︙ | |
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
(set! (current-effective-user-id) cid))
(proc)
(if (not (eq? eid cid))
(set! (current-effective-user-id) eid))))
;; use mutex to not open/close files at same time
;;
(define (checksum mtx file)
(mutex-lock! mtx)
(let-values (((inp oup pid)
(process "shasum" (list file))))
(mutex-unlock! mtx)
(let ((result (read-line inp)))
;; now flush out remaining output
(let loop ((inl (read-line inp)))
(if (eof-object? inl)
(if (string? result)
(begin
|
|
|
|
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
(set! (current-effective-user-id) cid))
(proc)
(if (not (eq? eid cid))
(set! (current-effective-user-id) eid))))
;; use mutex to not open/close files at same time
;;
(define (checksum mtx file #!key (cmd "shasum"))
(mutex-lock! mtx)
(let-values (((inp oup pid)
(process cmd (list file))))
(mutex-unlock! mtx)
(let ((result (read-line inp)))
;; now flush out remaining output
(let loop ((inl (read-line inp)))
(if (eof-object? inl)
(if (string? result)
(begin
|
︙ | | | ︙ | |
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
(define (gather-dir-info path)
(let ((mtx1 (make-mutex))
(threads (make-hash-table))
(last-num 0)
(req (nn-socket 'req)))
(print "starting client with pid " (current-process-id))
(nn-connect req
"tcp://localhost:5559")
;; "ipc:///tmp/test-ipc")
(find-files
path
;; test: #t
action: (lambda (p res)
(let ((info (cond
((not (file-read-access? p)) '(cant-read))
((directory? p) '(dir))
|
|
|
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
(define (gather-dir-info path)
(let ((mtx1 (make-mutex))
(threads (make-hash-table))
(last-num 0)
(req (nn-socket 'req)))
(print "starting client with pid " (current-process-id))
(nn-connect req
;; "tcp://localhost:5559")
"ipc:///tmp/test-ipc")
(find-files
path
;; test: #t
action: (lambda (p res)
(let ((info (cond
((not (file-read-access? p)) '(cant-read))
((directory? p) '(dir))
|
︙ | | | ︙ | |
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
;; (set! last-num num-threads)))
(mutex-unlock! mtx1)
(if ok-to-run
(let ((run-time-start (current-seconds)))
;; (print "num threads: " num-threads)
(let ((th1 (make-thread
(lambda ()
(let ((cksum (checksum mtx1 p))
(run-time (- (current-seconds) run-time-start)))
(mutex-lock! mtx1)
(client-send-receive req (conc p " " cksum))
(mutex-unlock! mtx1))
(let loop2 ()
(mutex-lock! mtx1)
(let ((registered (hash-table-exists? threads p)))
|
|
|
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
;; (set! last-num num-threads)))
(mutex-unlock! mtx1)
(if ok-to-run
(let ((run-time-start (current-seconds)))
;; (print "num threads: " num-threads)
(let ((th1 (make-thread
(lambda ()
(let ((cksum (checksum mtx1 p cmd: "md5sum"))
(run-time (- (current-seconds) run-time-start)))
(mutex-lock! mtx1)
(client-send-receive req (conc p " " cksum))
(mutex-unlock! mtx1))
(let loop2 ()
(mutex-lock! mtx1)
(let ((registered (hash-table-exists? threads p)))
|
︙ | | | ︙ | |
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
(p2dat (make-hash-table))
(numdone 0) ;; increment when recieved a quit. exit when > 2
(rep (nn-socket 'rep))
(p1len (string-length path1))
(p2len (string-length path2))
(both-seen (make-hash-table)))
(nn-bind rep
"tcp://*:5559")
;; "ipc:///tmp/test-ipc")
;; start clients
(thread-sleep! 0.1)
(system (conc "./remotediff-nmsg " path1 " &"))
(system (conc "./remotediff-nmsg " path2 " &"))
(let loop ((msg-in (nn-recv rep))
(last-print 0))
(if (equal? msg-in "quit")
|
|
|
|
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
(p2dat (make-hash-table))
(numdone 0) ;; increment when recieved a quit. exit when > 2
(rep (nn-socket 'rep))
(p1len (string-length path1))
(p2len (string-length path2))
(both-seen (make-hash-table)))
(nn-bind rep
;; "tcp://*:5559")
"ipc:///tmp/test-ipc")
;; start clients
(thread-sleep! 0.1)
(system (conc "./remotediff-nmsg " path1 " &"))
(system (conc "./remotediff-nmsg " path2 " &"))
(let loop ((msg-in (nn-recv rep))
(last-print 0))
(if (equal? msg-in "quit")
|
︙ | | | ︙ | |