public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Colomar <alx.manpages@gmail.com>
To: Guy Shefy <guyshefyb@gmail.com>
Cc: linux-man@vger.kernel.org
Subject: Re: [PATCH] setpgid.2: ERRORS: add EPERM for nonexisting process group
Date: Sat, 25 Feb 2023 02:01:55 +0100	[thread overview]
Message-ID: <f2bb7650-d8b5-c9de-e079-aae536a44e98@gmail.com> (raw)
In-Reply-To: <Y/Oa/t5tPj0uTDNz@T14s-004530>


[-- Attachment #1.1: Type: text/plain, Size: 1376 bytes --]

Hi Guy,

On 2/20/23 17:08, Guy Shefy wrote:
>  From 961b64515b805caadb5a77e3592eb3e883c57e0d Mon Sep 17 00:00:00 2001
> From: Guy Shefy <guyshefyb@gmail.com>
> Date: Mon, 20 Feb 2023 17:54:40 +0200
> Subject: [PATCH] setpgid.2: ERRORS: add EPERM for nonexisting process group
> 
> found using test program:
> 
> #include <stdio.h>
> #include <sys/types.h>
> #include <unistd.h>
> 
> int main() {
> 	pid_t pid_a = fork();
> 	if (!pid_a) {
> 		// pid_a is not a valid process group
> 		sleep(1); // stay alive
> 		return 0;
> 	}
> 	if (!fork()) {
> 		setpgid(0, pid_a);
> 		perror("setpgid");
> 		return 0;
> 	}
> 	sleep(1); // stay alive
> 	return 0;
> }
> 
> Signed-off-by: Guy Shefy <guyshefyb@gmail.com>

Patch applied.  Thanks very much for the example program!

Alex

> ---
>   man2/setpgid.2 | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/man2/setpgid.2 b/man2/setpgid.2
> index 52c5bd5fc..0b0182eb9 100644
> --- a/man2/setpgid.2
> +++ b/man2/setpgid.2
> @@ -214,6 +214,11 @@ a session leader
>   .RB ( setpgid (),
>   .BR setpgrp ()).
>   .TP
> +.B EPERM
> +The target process group does not exists.
> +.RB ( setpgid (),
> +.BR setpgrp ()).
> +.TP
>   .B ESRCH
>   For
>   .BR getpgid ():

-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2023-02-25  1:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-20 15:50 [PATCH] setpgid.2: ERRORS: add EPERM for nonexisting process group Guy Shefy
2023-02-20 15:51 ` Alex Colomar
2023-02-20 16:01   ` Guy Shefy
2023-02-20 16:08     ` Guy Shefy
2023-02-25  1:01       ` Alex Colomar [this message]

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=f2bb7650-d8b5-c9de-e079-aae536a44e98@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=guyshefyb@gmail.com \
    --cc=linux-man@vger.kernel.org \
    /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