summaryrefslogtreecommitdiffstats
path: root/mdmon.c
diff options
context:
space:
mode:
authorMateusz Grzonka <mateusz.grzonka@intel.com>2022-08-12 16:36:02 +0200
committerJes Sorensen <jsorensen@fb.com>2022-08-22 23:34:52 +0200
commit239b3cc0b5da87e966746533b1873c439db54b16 (patch)
treec9a78bda8b8d53a8d9114cf0fc1ee4b06d411e58 /mdmon.c
parenttests: Add broken files for all broken tests (diff)
downloadmdadm-239b3cc0b5da87e966746533b1873c439db54b16.tar.xz
mdadm-239b3cc0b5da87e966746533b1873c439db54b16.zip
mdadm: Replace obsolete usleep with nanosleep
According to POSIX.1-2001, usleep is considered obsolete. Replace it with a wrapper that uses nanosleep, as recommended in man. Add handy macros for conversions between msec, usec and nsec. Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to 'mdmon.c')
-rw-r--r--mdmon.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mdmon.c b/mdmon.c
index c057da63..e9d035eb 100644
--- a/mdmon.c
+++ b/mdmon.c
@@ -99,7 +99,7 @@ static int clone_monitor(struct supertype *container)
if (rc)
return rc;
while (mon_tid == -1)
- usleep(10);
+ sleep_for(0, USEC_TO_NSEC(10), true);
pthread_attr_destroy(&attr);
mgr_tid = syscall(SYS_gettid);
@@ -209,7 +209,7 @@ static void try_kill_monitor(pid_t pid, char *devname, int sock)
rv = kill(pid, SIGUSR1);
if (rv < 0)
break;
- usleep(200000);
+ sleep_for(0, MSEC_TO_NSEC(200), true);
}
}