This is an archive of the discontinued LLVM Phabricator instance.

[libc] Add a minimal implementation of the POSIX fork function.
ClosedPublic

Authored by sivachandra on Oct 3 2022, 11:54 PM.

Details

Summary

A very simple and minimal implementation of fork is added. Future
changes will add more functionality to satisfy POSIX and Linux
requirements.

An implementation of wait and a few support macros in sys/wait.h
have also been added to help with testing the fork function.

Diff Detail

Event Timeline

sivachandra created this revision.Oct 3 2022, 11:54 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptOct 3 2022, 11:54 PM
sivachandra requested review of this revision.Oct 3 2022, 11:54 PM
lntue added inline comments.Oct 4 2022, 6:52 AM
libc/include/llvm-libc-macros/linux/sys-wait-macros.h
14

((status) & 0x7F) instead.

libc/src/unistd/linux/fork.cpp
25

SYS_fork?

Fix typos and other copy-paste errors.

sivachandra marked 2 inline comments as done.Oct 4 2022, 9:22 AM
This revision is now accepted and ready to land.Oct 4 2022, 9:48 AM
lntue accepted this revision.Oct 4 2022, 10:34 AM