Re: [hackers] [sbase][PATCH] Move setsid to ubase

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Tue, 29 Mar 2016 23:10:05 +0200

On Tue, Mar 29, 2016 at 08:41:00PM +0200, Mattias Andr??e wrote:
> Signed-off-by: Mattias Andr??e <maandree_AT_kth.se>
> ---
> Makefile | 1 -
> setsid.1 | 17 -----------------
> setsid.c | 40 ----------------------------------------
> 3 files changed, 58 deletions(-)
> delete mode 100644 setsid.1
> delete mode 100644 setsid.c
>
> diff --git a/Makefile b/Makefile
> index 6b2bfdf..9944048 100644
> --- a/Makefile
> +++ b/Makefile
> _AT_@ -141,7 +141,6 @@ BIN =\
> rmdir\
> sed\
> seq\
> - setsid\
> sha1sum\
> sha224sum\
> sha256sum\
> diff --git a/setsid.1 b/setsid.1
> deleted file mode 100644
> index d43bcfc..0000000
> --- a/setsid.1
> +++ /dev/null
> _AT_@ -1,17 +0,0 @@
> -.Dd 2015-10-08
> -.Dt SETSID 1
> -.Os sbase
> -.Sh NAME
> -.Nm setsid
> -.Nd run a command in a new session
> -.Sh SYNOPSIS
> -.Nm
> -.Ar cmd
> -.Op Ar arg ...
> -.Sh DESCRIPTION
> -.Nm
> -runs
> -.Ar cmd
> -in a new session.
> -.Sh SEE ALSO
> -.Xr setsid 2
> diff --git a/setsid.c b/setsid.c
> deleted file mode 100644
> index 4c885a4..0000000
> --- a/setsid.c
> +++ /dev/null
> _AT_@ -1,40 +0,0 @@
> -/* See LICENSE file for copyright and license details. */
> -#include <errno.h>
> -#include <unistd.h>
> -
> -#include "util.h"
> -
> -static void
> -usage(void)
> -{
> - eprintf("usage: %s cmd [arg ...]\n", argv0);
> -}
> -
> -int
> -main(int argc, char *argv[])
> -{
> - int savederrno;
> -
> - argv0 = argv[0], argc--, argv++;
> -
> - if (!argc)
> - usage();
> -
> - if (getpgrp() == getpid()) {
> - switch (fork()) {
> - case -1:
> - eprintf("fork:");
> - case 0:
> - break;
> - default:
> - return 0;
> - }
> - }
> - if (setsid() < 0)
> - eprintf("setsid:");
> - execvp(argv[0], argv);
> - savederrno = errno;
> - weprintf("execvp %s:", argv[0]);
> -
> - _exit(126 + (savederrno == ENOENT));
> -}
> --
> 2.7.4
>
>

setsid is POSIX and it is portable so I don't see why it should be in ubase (Linux-specific tools).

Can you explain your intention?

Kind regards,
Hiltjo
Received on Tue Mar 29 2016 - 23:10:05 CEST

This archive was generated by hypermail 2.3.0 : Tue Mar 29 2016 - 23:12:15 CEST