libc: Fix constness of some socket functions

This commit is contained in:
apio 2023-08-11 18:00:15 +02:00
parent 5ea73197ad
commit ec3c1132d2
Signed by: apio
GPG Key ID: B8A7D06E42258954
2 changed files with 4 additions and 4 deletions

View File

@ -14,10 +14,10 @@ extern "C"
int socket(int domain, int type, int protocol); int socket(int domain, int type, int protocol);
/* Bind a socket to an address. */ /* Bind a socket to an address. */
int bind(int sockfd, struct sockaddr* addr, socklen_t addrlen); int bind(int sockfd, const struct sockaddr* addr, socklen_t addrlen);
/* Connect a socket to a remote address. */ /* Connect a socket to a remote address. */
int connect(int sockfd, struct sockaddr* addr, socklen_t addrlen); int connect(int sockfd, const struct sockaddr* addr, socklen_t addrlen);
/* Start listening on a socket. */ /* Start listening on a socket. */
int listen(int sockfd, int backlog); int listen(int sockfd, int backlog);

View File

@ -11,13 +11,13 @@ extern "C"
__errno_return(rc, int); __errno_return(rc, int);
} }
int bind(int sockfd, struct sockaddr* addr, socklen_t addrlen) int bind(int sockfd, const struct sockaddr* addr, socklen_t addrlen)
{ {
long rc = syscall(SYS_bind, sockfd, addr, addrlen); long rc = syscall(SYS_bind, sockfd, addr, addrlen);
__errno_return(rc, int); __errno_return(rc, int);
} }
int connect(int sockfd, struct sockaddr* addr, socklen_t addrlen) int connect(int sockfd, const struct sockaddr* addr, socklen_t addrlen)
{ {
long rc = syscall(SYS_connect, sockfd, addr, addrlen); long rc = syscall(SYS_connect, sockfd, addr, addrlen);
__errno_return(rc, int); __errno_return(rc, int);