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
Unknown Object (File)
Thu, Jul 3, 11:48 PM
Unknown Object (File)
Mon, Jun 23, 5:42 PM
Unknown Object (File)
Wed, Jun 18, 6:48 PM
Unknown Object (File)
Mon, Jun 16, 4:28 PM
Unknown Object (File)
Sun, Jun 15, 9:16 AM
Unknown Object (File)
Sat, Jun 7, 11:22 PM
Unknown Object (File)
Fri, Jun 6, 7:22 AM
Unknown Object (File)
Jun 3 2025, 11:52 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 41065
Build 37954: arc lint + arc unit

Event Timeline

Special handling for -1 also needed

sys/compat/linux/linux_misc.c
1082

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
1082

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