Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.bugs.dist > #949323

Bug#924058: runit: replace obsolete usleep with nanosleep in sv.c

From Dmitry Bogatov <KAction@debian.org>
Newsgroups linux.debian.bugs.dist
Subject Bug#924058: runit: replace obsolete usleep with nanosleep in sv.c
Date 2019-03-10 20:20 +0100
Message-ID <xAc9k-6py-11@gated-at.bofh.it> (permalink)
References <xAc9k-6py-13@gated-at.bofh.it> <xAc9k-6py-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[2019-03-08 23:43] Jan <cloux@rote.ch>
> >From f7b8f943d1f7a8f26df8d81eeb0a2d5a69ee7e22 Mon Sep 17 00:00:00 2001
> From: Jan <cloux@rote.ch>
> Date: Wed, 6 Mar 2019 18:38:04 +0100
> Subject: [PATCH] fix: replace obsolete usleep with nanosleep
>
>  POSIX.1-2001 declares usleep obsolete,
>  POSIX.1-2008 removes the specification of usleep,
>  see https://linux.die.net/man/3/usleep

Looks good to me. Thank you. I will let this patch hang till release,
and will apply and upload after thaw. While change seems perfectly fine,
moving parts around freeze feels worriesome.

Gerrit, as you can see, there is some activity around runit, in
particular about C code. I consider releasing runit-2.1.2 with
all patches, accumulated in Debian package as runit-2.1.3 for
convenience of other distributions (Void, Gentoo). Do you object?
Would you like to do it yourself?

> ---
>  runit-2.1.2/src/sv.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/runit-2.1.2/src/sv.c b/runit-2.1.2/src/sv.c
> index 6cc2a8b..f97c5a2 100644
> --- a/runit-2.1.2/src/sv.c
> +++ b/runit-2.1.2/src/sv.c
> @@ -1,5 +1,6 @@
>  #include <sys/types.h>
>  #include <sys/stat.h>
> +#include <time.h>
>  #include <unistd.h>
>  #include "str.h"
>  #include "strerr.h"
> @@ -271,6 +272,7 @@ int control(char *a) {
>  int main(int argc, char **argv) {
>    unsigned int i, done;
>    char *x;
> +  const struct timespec sleeptime = {0, 420000000};
>  
>    progname =*argv;
>    for (i =str_len(*argv); i; --i) if ((*argv)[i -1] == '/') break;
> @@ -388,7 +390,7 @@ int main(int argc, char **argv) {
>            fatal("unable to change to original directory");
>        }
>        if (done) break;
> -      usleep(420000);
> +      nanosleep(&sleeptime, NULL);
>        taia_now(&tnow);
>      }
>    return(rc > 99 ? 99 : rc);
> -- 
> 2.20.1
>
-- 
        Note, that I send and fetch email in batch, once every 24 hours.
                 If matter is urgent, try https://t.me/kaction
                                                                             --

Back to linux.debian.bugs.dist | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Bug#924058: runit: replace obsolete usleep with nanosleep in sv.c Dmitry Bogatov <KAction@debian.org> - 2019-03-10 20:20 +0100
  Bug#924058: runit: replace obsolete usleep with nanosleep in sv.c Gerrit Pape <pape@dbnbgs.smarden.org> - 2019-03-11 15:10 +0100

csiph-web