mirror of
https://git.proxmox.com/git/wasi-libc
synced 2025-10-04 09:00:56 +00:00

We've already started removing this; this just removes all remaining ones under the libc-bottom-half directory. These markers were originally intended to help track upstream changes, however in practice they created a lot of clutter and weren't that helpful. And now, upstream cloudlibc is no longer active.
30 lines
668 B
C
30 lines
668 B
C
// Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/
|
|
//
|
|
// SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
#include <common/errno.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <assert.h>
|
|
#include <wasi/api.h>
|
|
#include <errno.h>
|
|
|
|
static_assert(SHUT_RD == __WASI_SDFLAGS_RD, "Value mismatch");
|
|
static_assert(SHUT_WR == __WASI_SDFLAGS_WR, "Value mismatch");
|
|
|
|
int shutdown(int socket, int how) {
|
|
// Validate shutdown flags.
|
|
if (how != SHUT_RD && how != SHUT_WR && how != SHUT_RDWR) {
|
|
errno = EINVAL;
|
|
return -1;
|
|
}
|
|
|
|
__wasi_errno_t error = __wasi_sock_shutdown(socket, how);
|
|
if (error != 0) {
|
|
errno = errno_fixup_socket(socket, error);
|
|
return -1;
|
|
}
|
|
return error;
|
|
}
|