From 92e0e017d80954cfc82fdac0ad6c68060a9eff0c Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Mon, 19 Jun 2023 06:25:37 +0900 Subject: [PATCH] lsfd: use \n as the separator in EVENTPOLL.TFDS column Signed-off-by: Masatake YAMATO --- misc-utils/lsfd-unkn.c | 9 +++++---- tests/expected/lsfd/mkfds-eventpoll | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/misc-utils/lsfd-unkn.c b/misc-utils/lsfd-unkn.c index 0045a6a472..d76701ed0d 100644 --- a/misc-utils/lsfd-unkn.c +++ b/misc-utils/lsfd-unkn.c @@ -499,7 +499,8 @@ static void anon_eventpoll_attach_xinfo(struct unkn *unkn) } static char *anon_eventpoll_make_tfds_string(struct anon_eventpoll_data *data, - const char *prefix) + const char *prefix, + const char sep) { char *str = prefix? xstrdup(prefix): NULL; @@ -508,7 +509,7 @@ static char *anon_eventpoll_make_tfds_string(struct anon_eventpoll_data *data, size_t offset = 0; if (i > 0) { - buf[0] = ','; + buf[0] = sep; offset = 1; } snprintf(buf + offset, sizeof(buf) - offset, "%d", data->tfds[i]); @@ -520,7 +521,7 @@ static char *anon_eventpoll_make_tfds_string(struct anon_eventpoll_data *data, static char *anon_eventpoll_get_name(struct unkn *unkn) { return anon_eventpoll_make_tfds_string((struct anon_eventpoll_data *)unkn->anon_data, - "tfds="); + "tfds=", ','); } static bool anon_eventpoll_fill_column(struct proc *proc __attribute__((__unused__)), @@ -534,7 +535,7 @@ static bool anon_eventpoll_fill_column(struct proc *proc __attribute__((__unuse switch(column_id) { case COL_EVENTPOLL_TFDS: - *str =anon_eventpoll_make_tfds_string(data, NULL); + *str =anon_eventpoll_make_tfds_string(data, NULL, '\n'); if (*str) return true; break; diff --git a/tests/expected/lsfd/mkfds-eventpoll b/tests/expected/lsfd/mkfds-eventpoll index e5f456e36c..1d5a69b551 100644 --- a/tests/expected/lsfd/mkfds-eventpoll +++ b/tests/expected/lsfd/mkfds-eventpoll @@ -1,2 +1,3 @@ - 3 eventpoll tfds=5,7 5,7 + 3 eventpoll tfds=5,7 5 + 7 ASSOC,TYPE,NAME,EVENTPOLL.TFDS: 0 -- 2.47.2