This is an archive of the discontinued LLVM Phabricator instance.

[libc] add headers sys/auxv sys/prctl and sys/time
ClosedPublic

Authored by michaelrj on Oct 11 2022, 4:56 PM.

Details

Summary

These headers are uncommonly used, and from extensions, but some basic
support is needed. Macros have been added where available.

Diff Detail

Event Timeline

michaelrj created this revision.Oct 11 2022, 4:56 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptOct 11 2022, 4:56 PM
michaelrj requested review of this revision.Oct 11 2022, 4:56 PM
lntue added inline comments.Oct 11 2022, 5:06 PM
libc/include/CMakeLists.txt
266

Why is this commented out?

sivachandra added inline comments.Oct 11 2022, 10:50 PM
libc/include/llvm-libc-macros/linux/sys-time-macros.h
16

We don't have the type struct timeval defined. So, why do we need these macros?

libc/include/sys/prctl.h.def
20

Remove this commented out include.

michaelrj marked 3 inline comments as done.

remove commented out code

libc/include/llvm-libc-macros/linux/sys-time-macros.h
16

struct timeval is defined in libc/include/llvm-libc-types/struct_timeval.h.

sivachandra added inline comments.Oct 12 2022, 10:13 AM
libc/include/llvm-libc-macros/linux/sys-time-macros.h
16

Sorry, what I mean is that sys/time.h is not defining the type. So, either we remove these macros, or add the definition of struct timeval in sys/time.h (by updating the spec and .td file appropriatley.)

michaelrj marked an inline comment as done.

include struct timeval in sys/time.h

sivachandra accepted this revision.Oct 12 2022, 12:16 PM
sivachandra added inline comments.
libc/include/llvm-libc-macros/linux/sys-time-macros.h
56

What problem is this complication solving?

This revision is now accepted and ready to land.Oct 12 2022, 12:16 PM
michaelrj updated this revision to Diff 467244.Oct 12 2022, 1:11 PM
michaelrj marked an inline comment as done.

address comment and simplify before landing.

michaelrj added inline comments.Oct 12 2022, 1:19 PM
libc/include/llvm-libc-macros/linux/sys-time-macros.h
56

I misread the man page and thought that the simpler implementation didn't work in certain circumstances. I've fixed it now.

This revision was automatically updated to reflect the committed changes.