]>
git.proxmox.com Git - wasi-libc.git/blob - libc-bottom-half/cloudlibc/src/libc/sys/socket/shutdown.c
1 // Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/
3 // SPDX-License-Identifier: BSD-2-Clause
5 #include <common/errno.h>
7 #include <sys/socket.h>
13 #ifdef __wasilibc_unmodified_upstream // generated constant names
14 static_assert(SHUT_RD
== __WASI_SHUT_RD
, "Value mismatch");
15 static_assert(SHUT_WR
== __WASI_SHUT_WR
, "Value mismatch");
17 static_assert(SHUT_RD
== __WASI_SDFLAGS_RD
, "Value mismatch");
18 static_assert(SHUT_WR
== __WASI_SDFLAGS_WR
, "Value mismatch");
21 int shutdown(int socket
, int how
) {
22 // Validate shutdown flags.
23 if (how
!= SHUT_RD
&& how
!= SHUT_WR
&& how
!= SHUT_RDWR
) {
28 __wasi_errno_t error
= __wasi_sock_shutdown(socket
, how
);
30 errno
= errno_fixup_socket(socket
, error
);