This is an archive of the discontinued LLVM Phabricator instance.

[libc] Add a simple implementation of the posix_spawn function.
ClosedPublic

Authored by sivachandra on Oct 12 2022, 12:33 AM.

Details

Summary

The implementation currently ignores all spawn attributes. Support for
them will be added in future changes.

A simple allocator for integration tests has been added so that the
integration test for posix_spawn can use the
posix_spawn_file_actions_add* functions.

Diff Detail

Event Timeline

sivachandra created this revision.Oct 12 2022, 12:33 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptOct 12 2022, 12:33 AM
sivachandra requested review of this revision.Oct 12 2022, 12:33 AM
michaelrj added inline comments.Oct 12 2022, 10:19 AM
libc/src/spawn/linux/posix_spawn.cpp
24–32

this feels like it might be better as a shared utility given that it's mostly the same as unistd/linux/fork.cpp (and same for the others below)

Add a TODO about using a separate and small stack after forking.

libc/src/spawn/linux/posix_spawn.cpp
24–32

I have considered that but what I have here is only temporary. We will have to change at least fork. I have added a TODO to fork to reflect how it is to be changed.

This revision is now accepted and ready to land.Oct 13 2022, 9:34 AM

Fix a typo and add a missing include.

This revision was landed with ongoing or failed builds.Oct 13 2022, 11:48 AM
This revision was automatically updated to reflect the committed changes.