This is an archive of the discontinued LLVM Phabricator instance.

[libc] add socket function
ClosedPublic

Authored by michaelrj on May 1 2023, 4:29 PM.

Details

Summary

This patch adds the function "socket" from the header "sys/socket". It's
a simple syscall wrapper, and I plan on adding the related functions in
a followup patch.

Diff Detail

Event Timeline

michaelrj created this revision.May 1 2023, 4:29 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 1 2023, 4:29 PM
michaelrj requested review of this revision.May 1 2023, 4:29 PM

LGTM but I have left a few minor comments.

libc/include/llvm-libc-macros/linux/sys-socket-macros.h
26

Can add some documentation about the origin of these numbers?

libc/include/llvm-libc-types/struct_sockaddr.h
17

Same here - documentation for why 14.

libc/src/sys/socket/linux/socket.cpp
17

For SYS_SOCKET socketcall call number. ?

michaelrj marked 2 inline comments as done.May 2 2023, 3:39 PM
michaelrj added inline comments.
libc/include/llvm-libc-macros/linux/sys-socket-macros.h
26

The source is the same as the above numbers, so I figured it was covered by the comment at the top of the file.

michaelrj updated this revision to Diff 518889.May 2 2023, 3:40 PM

address comments and fix how types are set up.

sivachandra accepted this revision.May 2 2023, 4:30 PM
This revision is now accepted and ready to land.May 2 2023, 4:30 PM
michaelrj updated this revision to Diff 519156.May 3 2023, 10:33 AM

fix issues that came up in testing before landing

This revision was landed with ongoing or failed builds.May 3 2023, 11:01 AM
This revision was automatically updated to reflect the committed changes.