Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to sys/socket_checked.h #2

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions include/sys/socket_checked.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//---------------------------------------------------------------------//
// Bounds-safe interfaces for functions in POSIX socket.h. //
// //
// Bounds-safe interfaces for functions in POSIX socket.h. // //
// //
/////////////////////////////////////////////////////////////////////////

Expand All @@ -25,16 +24,25 @@
#pragma CHECKED_SCOPE push
#pragma CHECKED_SCOPE on

#ifdef __APPLE__
// Seems not to be a thing for Mac
#define __THROW
#ifndef __CONST_SOCKADDR_ARG
#define __CONST_SOCKADDR_ARG const struct sockaddr *
#endif

#ifndef __SOCKADDR_ARG
#define __SOCKADDR_ARG struct sockaddr *__restrict
#endif


#ifdef __APPLE__
// Seems not to be a thing for Mac
#define __THROW
#endif


extern int socketpair (int __domain, int __type, int __protocol,
int __fds[2] : itype(int _Checked[2])) __THROW;

/*
extern int bind (
int __fd,
__CONST_SOCKADDR_ARG __addr : itype(_Ptr<const struct sockaddr>),
Expand Down Expand Up @@ -134,6 +142,7 @@ extern int accept4 (
int __flags);
#endif

*/
#pragma CHECKED_SCOPE pop

#endif // guard
Expand Down