EPERM upon kill(2) of "empty" group

At least on

$ uname -r -v -m
25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:55 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T8103 arm64

running the Posix program test.c

#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
int main() {
    pid_t ch = fork();
    if (ch == -1) {
        perror("fork");
        return EXIT_FAILURE;
    }
    if (ch == 0) {
        return EXIT_SUCCESS;
    }
    if (setpgid(ch, ch) == -1) {
        perror("setpgid");
        return EXIT_FAILURE;
    }
    siginfo_t stat;
    if (waitid(P_PID, ch, &stat, WEXITED | WNOWAIT) == -1) {
        perror("waitid");
        return EXIT_FAILURE;
    }
    if (kill(-ch, SIGKILL) == -1) {
        perror("kill");
        return EXIT_FAILURE;
    }
    return EXIT_SUCCESS;
}

as

$ clang test.c
$ ./a.out 
kill: Operation not permitted

fails with EPERM even though the lifetime of the process group has not yet ended (due to the WNOWAIT).

Answered by DTS Engineer in 875745022

It looks like your goal here is to file a bug. If so, DevForums isn’t the right place for that. See Bug Reporting: How and Why? for lots of info about Apple’s bug reporting process.

If you do file a bug, please post the bug number here, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

It looks like your goal here is to file a bug. If so, DevForums isn’t the right place for that. See Bug Reporting: How and Why? for lots of info about Apple’s bug reporting process.

If you do file a bug, please post the bug number here, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

thanks; filed <https://feedbackassistant.apple.com/feedback/21938996> "EPERM upon kill(2) of 'empty' group" now

EPERM upon kill(2) of "empty" group
 
 
Q