Page MenuHomeFreeBSD

Add posix_spawnattr_{get,set}procdescp_np(3)
ClosedPublic

Authored by kib on Sun, Jan 25, 7:20 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jan 26, 1:00 PM
Unknown Object (File)
Mon, Jan 26, 12:30 PM
Unknown Object (File)
Mon, Jan 26, 7:51 AM
Unknown Object (File)
Mon, Jan 26, 6:32 AM
Unknown Object (File)
Mon, Jan 26, 4:02 AM
Unknown Object (File)
Mon, Jan 26, 3:52 AM
Unknown Object (File)
Mon, Jan 26, 3:50 AM
Unknown Object (File)
Mon, Jan 26, 3:50 AM
Subscribers

Details

Summary

The function set the address where to store resulting procdesc, which also explcitly request posix_spawn() to use pdfork() (really pdrfork()) instead of fork, and create procdesc for the child.

Since it is needed, also add pdrfork_thread(3) on x86.

The documentation will come later after we agree on the API. I choose this since it allows to unify use of pdrfork, so consumers still use posix_spawn instead of some other function.

An illustration for use of the all new proposed API is there https://reviews.freebsd.org/P686. I used this program to debug the code.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Sun, Jan 25, 7:20 PM
kib retitled this revision from Add posix_spawnattr_{get,set}pdrfork_np(3) to Add posix_spawnattr_{get,set}procdescp_np(3).

Rename to spawnattr_setprocdescp_np. IMO pdrfork is the implementation detail there, new name is less cryptic and easier to remember.
Export pdrfork_thread(3) on x86.

Export pdrfork_thread on i386 for real

I didn't read the assembly code (I haven't had to write x86 assembly since University), but otherwise it looks good to me. And thanks for adding the P686 example, too.

lib/libc/gen/posix_spawn.c
56–57 ↗(On Diff #170418)

If I'm counting right, then you should reverse the order of these two fields to eliminate alignment padding.

This revision is now accepted and ready to land.Mon, Jan 26, 6:24 PM
kib marked an inline comment as done.Mon, Jan 26, 7:21 PM
kib added inline comments.
lib/libc/gen/posix_spawn.c
56–57 ↗(On Diff #170418)

I do not think it matters. This is an internal structure used without exposing in ABI, and we do not care about it layout. Eliminating padding is not needed.

This revision was automatically updated to reflect the committed changes.
kib marked an inline comment as done.