Skip to content

Commit d5ffed6

Browse files
committed
add a session_locking option in tlog-rec-session.conf
defaults to true, preserving previous behaviour, only one tlog session will be recorded at a time per session ID. setting to false disables this locking, multiple recordings can be made simultaneously.
1 parent 3897015 commit d5ffed6

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/tlog/rec.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,7 @@ tlog_rec(struct tlog_errs **perrs, uid_t euid, gid_t egid,
11261126
clockid_t clock_id;
11271127
unsigned int session_id;
11281128
bool lock_acquired = false;
1129+
bool session_locking = true;
11291130
struct json_object *obj;
11301131
int64_t num;
11311132
unsigned int latency;
@@ -1144,6 +1145,11 @@ tlog_rec(struct tlog_errs **perrs, uid_t euid, gid_t egid,
11441145
}
11451146
}
11461147

1148+
/* Check for the session_locking flag */
1149+
if (json_object_object_get_ex(conf, "session_locking", &obj)) {
1150+
session_locking = json_object_get_boolean(obj);
1151+
}
1152+
11471153
/* Check for the version flag */
11481154
if (json_object_object_get_ex(conf, "version", &obj)) {
11491155
if (json_object_get_boolean(obj)) {
@@ -1198,7 +1204,7 @@ tlog_rec(struct tlog_errs **perrs, uid_t euid, gid_t egid,
11981204
TLOG_ERRS_RAISECS(grc, "Failed retrieving session ID");
11991205
}
12001206

1201-
if (opts & TLOG_REC_OPT_LOCK_SESS) {
1207+
if (opts & TLOG_REC_OPT_LOCK_SESS && session_locking) {
12021208
/* Attempt to lock the session */
12031209
grc = tlog_session_lock(perrs, session_id, euid, egid, &lock_acquired);
12041210
if (grc != TLOG_RC_OK) {

m4/tlog/rec_session_conf_schema.m4

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ M4_PARAM(`', `shell', `file-env',
3030
`SHELL is the ', `The ',
3131
`M4_LINES(`path to the shell executable which should be spawned.')')m4_dnl
3232
m4_dnl
33+
M4_PARAM(`', `session_locking', `file-env',
34+
`M4_TYPE_BOOL(true)', true,
35+
`n', `true', `Enable locking by session ID',
36+
`If specified, ', `If true ',
37+
`M4_LINES(`locking by session ID is enabled.')')m4_dnl
38+
m4_dnl
3339
M4_PARAM(`', `login', `name-',
3440
`M4_TYPE_BOOL()', false,
3541
`l', `', `Make the shell a login shell',

0 commit comments

Comments
 (0)