diff --git a/libc/include/sys/socket.h b/libc/include/sys/socket.h index 07f918dd..493a86e5 100644 --- a/libc/include/sys/socket.h +++ b/libc/include/sys/socket.h @@ -14,10 +14,10 @@ extern "C" int socket(int domain, int type, int protocol); /* 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. */ - 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. */ int listen(int sockfd, int backlog); diff --git a/libc/src/sys/socket.cpp b/libc/src/sys/socket.cpp index 1f8432a4..54e82516 100644 --- a/libc/src/sys/socket.cpp +++ b/libc/src/sys/socket.cpp @@ -11,13 +11,13 @@ extern "C" __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); __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); __errno_return(rc, int);