This is an archive of the discontinued LLVM Phabricator instance.

[libc] add sysconf with pagesize
ClosedPublic

Authored by michaelrj on Oct 6 2022, 3:17 PM.

Details

Summary

The sysconf function has many options, this patch adds the basic funtion
and the pagesize option. More options will be added in future patches.

Diff Detail

Event Timeline

michaelrj created this revision.Oct 6 2022, 3:17 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptOct 6 2022, 3:17 PM
michaelrj requested review of this revision.Oct 6 2022, 3:17 PM
sivachandra added inline comments.Oct 6 2022, 3:40 PM
libc/include/llvm-libc-macros/linux/unistd-macros.h
18

Should we equivalently define _SC_PAGE_SIZE also?

libc/spec/posix.td
512

Why did this get modified?

libc/src/unistd/linux/sysconf.cpp
23

Can we return here? Also, add a TODO here saying that we should ideally get the page size from the auxvector.

26

Can we set errno to EINVAL and return -1?

michaelrj updated this revision to Diff 465917.Oct 6 2022, 4:05 PM
michaelrj marked 4 inline comments as done.

cleanup and address comments

libc/spec/posix.td
512

I edited the wrong spec when setting up sysconf and apparently forgot to fix it.

sivachandra accepted this revision.Oct 10 2022, 11:33 AM

One nit inline.

libc/spec/posix.td
512

symlinkat returns an int value.

This revision is now accepted and ready to land.Oct 10 2022, 11:33 AM
michaelrj updated this revision to Diff 466632.Oct 10 2022, 2:51 PM
michaelrj marked an inline comment as done.

fix final comment before land

This revision was landed with ongoing or failed builds.Oct 10 2022, 2:52 PM
This revision was automatically updated to reflect the committed changes.