Page MenuHomeFreeBSD

linux(4): Fixup wait4 handling pid equal 0 case.
AbandonedPublic

Authored by dchagin on Aug 16 2021, 3:47 PM.
Tags
None
Referenced Files
F132316079: D31561.id93771.diff
Wed, Oct 15, 8:03 PM
F132316077: D31561.id93831.diff
Wed, Oct 15, 8:03 PM
F132316076: D31561.id.diff
Wed, Oct 15, 8:03 PM
F132316073: D31561.id93757.diff
Wed, Oct 15, 8:03 PM
F132272519: D31561.diff
Wed, Oct 15, 9:45 AM
Unknown Object (File)
Wed, Oct 8, 11:06 PM
Unknown Object (File)
Sat, Oct 4, 11:19 PM
Unknown Object (File)
Sep 14 2025, 1:32 PM

Details

Reviewers
None
Group Reviewers
Linux Emulation
Summary

Pid equal 0 meaning wait for any child process whose process group identificator
is equal to that of the calling process.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 41100
Build 37989: arc lint + arc unit

Event Timeline

Special handling for -1 also needed

sys/compat/linux/linux_misc.c
1090

this should be pg_id no?

Special handling for -1 also needed

it handled by pid < 0, as pid == -1 before it

sys/compat/linux/linux_misc.c
1090

ah)) sure!

ah, #define WAIT_ANY (-1) /* any process */

This is what I'd have expected and it LGTM, but I'd defer to @markj or @kib for confirmation

In my copy of the FreeBSD source tree, linux_common_wait() has the following prototype

static int
linux_common_wait(struct thread *td, int pid, int *statusp,
    int options, struct __wrusage *wrup)

So I am not sure what is this about.

In D31561#712206, @kib wrote:

In my copy of the FreeBSD source tree, linux_common_wait() has the following prototype

static int
linux_common_wait(struct thread *td, int pid, int *statusp,
    int options, struct __wrusage *wrup)

So I am not sure what is this about.

ah, it depends on D31552

Do you mean that our native wait4(2) does not correctly handle pid == 0 case?

In D31561#718208, @kib wrote:

Do you mean that our native wait4(2) does not correctly handle pid == 0 case?

hmm, no,
seems it's my fault in the https://reviews.freebsd.org/D31552, and should be fixed there