Commit | Line | Data |
---|---|---|
a028c28a | 1 | import signal |
cb87ff89 | 2 | import hashlib |
a028c28a | 3 | |
85a9e11c JR |
4 | def line_count(file_path): |
5 | line_count = 0 | |
6 | with open(file_path) as f: | |
7 | for line in f: | |
8 | line_count += 1 | |
9 | return line_count | |
a028c28a JR |
10 | |
11 | ||
cb87ff89 JR |
12 | def sha256_checksum(filename, block_size=65536): |
13 | sha256 = hashlib.sha256() | |
14 | with open(filename, 'rb') as f: | |
15 | for block in iter(lambda: f.read(block_size), b''): | |
16 | sha256.update(block) | |
17 | return sha256.hexdigest() | |
18 | ||
19 | ||
a028c28a JR |
20 | def __dummy_sigusr1_handler(): |
21 | pass | |
22 | ||
23 | ||
24 | def sessiond_spawn(runtime): | |
29cf55b3 JR |
25 | previous_handler = signal.signal(signal.SIGUSR1, __dummy_sigusr1_handler) |
26 | sessiond = runtime.spawn_subprocess("lttng-sessiond -vvv -S") | |
27 | signal.sigtimedwait({signal.SIGUSR1}, 60) | |
28 | previous_handler = signal.signal(signal.SIGUSR1, previous_handler) | |
29 | return sessiond | |
30 | ||
31 | ||
32 |