From: mwilck@suse.com
To: Christophe Varoqui <christophe.varoqui@opensvc.com>,
Benjamin Marzinski <bmarzins@redhat.com>
Cc: dm-devel@redhat.com, Xose Vazquez Perez <xose.vazquez@gmail.com>,
Martin Wilck <mwilck@suse.com>
Subject: [dm-devel] [PATCH 3/4] multipath-tools: fix compilation errors on 32-bit musl
Date: Fri, 12 Feb 2021 00:46:49 +0100 [thread overview]
Message-ID: <20210211234650.21890-3-mwilck@suse.com> (raw)
In-Reply-To: <20210211234650.21890-1-mwilck@suse.com>
From: Martin Wilck <mwilck@suse.com>
gcc on alpine Linux/i386 throws errors because the "tv_sec" element
of struct timespec is a time_t, which is a "long long" in that
environment. In general, time_t is signed. As we only use CLOCK_MONOTONIC,
which starts at boot time, a cast to long should be no problem, even
in 32bit environments.
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
multipath/main.c | 2 +-
multipathd/main.c | 16 ++++++++--------
multipathd/uxlsnr.c | 4 ++--
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/multipath/main.c b/multipath/main.c
index 9ac4286..3f97582 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -417,7 +417,7 @@ static int print_cmd_valid(int k, const vector pathvec,
wait = find_multipaths_check_timeout(pp, 0, &until);
if (wait == FIND_MULTIPATHS_WAITING)
printf("FIND_MULTIPATHS_WAIT_UNTIL=\"%ld.%06ld\"\n",
- until.tv_sec, until.tv_nsec/1000);
+ (long)until.tv_sec, until.tv_nsec/1000);
else if (wait == FIND_MULTIPATHS_WAIT_DONE)
printf("FIND_MULTIPATHS_WAIT_UNTIL=\"0\"\n");
printf("DM_MULTIPATH_DEVICE_PATH=\"%d\"\n",
diff --git a/multipathd/main.c b/multipathd/main.c
index 1967984..5316643 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2408,8 +2408,8 @@ checkerloop (void *ap)
get_monotonic_time(&start_time);
if (start_time.tv_sec && last_time.tv_sec) {
timespecsub(&start_time, &last_time, &diff_time);
- condlog(4, "tick (%lu.%06lu secs)",
- diff_time.tv_sec, diff_time.tv_nsec / 1000);
+ condlog(4, "tick (%ld.%06lu secs)",
+ (long)diff_time.tv_sec, diff_time.tv_nsec / 1000);
last_time = start_time;
ticks = diff_time.tv_sec;
} else {
@@ -2470,18 +2470,18 @@ checkerloop (void *ap)
if (num_paths) {
unsigned int max_checkint;
- condlog(4, "checked %d path%s in %lu.%06lu secs",
+ condlog(4, "checked %d path%s in %ld.%06lu secs",
num_paths, num_paths > 1 ? "s" : "",
- diff_time.tv_sec,
+ (long)diff_time.tv_sec,
diff_time.tv_nsec / 1000);
conf = get_multipath_config();
max_checkint = conf->max_checkint;
put_multipath_config(conf);
if (diff_time.tv_sec > (time_t)max_checkint)
condlog(1, "path checkers took longer "
- "than %lu seconds, consider "
+ "than %ld seconds, consider "
"increasing max_polling_interval",
- diff_time.tv_sec);
+ (long)diff_time.tv_sec);
}
}
@@ -2507,8 +2507,8 @@ checkerloop (void *ap)
} else
diff_time.tv_sec = 1;
- condlog(3, "waiting for %lu.%06lu secs",
- diff_time.tv_sec,
+ condlog(3, "waiting for %ld.%06lu secs",
+ (long)diff_time.tv_sec,
diff_time.tv_nsec / 1000);
if (nanosleep(&diff_time, NULL) != 0) {
condlog(3, "nanosleep failed with error %d",
diff --git a/multipathd/uxlsnr.c b/multipathd/uxlsnr.c
index cd462b6..dbee0d6 100644
--- a/multipathd/uxlsnr.c
+++ b/multipathd/uxlsnr.c
@@ -154,8 +154,8 @@ static void check_timeout(struct timespec start_time, char *inbuf,
diff_time.tv_nsec / (1000 * 1000);
if (msecs > timeout)
condlog(2, "cli cmd '%s' timeout reached "
- "after %lu.%06lu secs", inbuf,
- diff_time.tv_sec, diff_time.tv_nsec / 1000);
+ "after %ld.%06lu secs", inbuf,
+ (long)diff_time.tv_sec, diff_time.tv_nsec / 1000);
}
}
--
2.29.2
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
next prev parent reply other threads:[~2021-02-11 23:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-11 23:46 [dm-devel] [PATCH 1/4] multipath-tools tests: allow control of test verbosity mwilck
2021-02-11 23:46 ` [dm-devel] [PATCH 2/4] multipath-tools: devt test: avoid failure when run in containers mwilck
2021-02-11 23:46 ` mwilck [this message]
2021-02-11 23:46 ` [dm-devel] [PATCH 4/4] libmultipath: fix compilation error with gcc 10 on i386 mwilck
2021-02-15 21:39 ` [dm-devel] [PATCH 1/4] multipath-tools tests: allow control of test verbosity Benjamin Marzinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210211234650.21890-3-mwilck@suse.com \
--to=mwilck@suse.com \
--cc=bmarzins@redhat.com \
--cc=christophe.varoqui@opensvc.com \
--cc=dm-devel@redhat.com \
--cc=xose.vazquez@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).