Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion core/libs/prx/libSceNet/Export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2130,14 +2130,14 @@ int64_t APS5_VABI sceNetRecvmsg(int s, NetMsghdr* msg, int flags) {
}

int APS5_VABI sceNetShutdown(int s, int how) {
if (how < 0 || how > 2) return fail(NET_EINVAL);
Sock socket;
{
std::lock_guard lk(g_mutex);
auto it = g_socks.find(s);
if (it == g_socks.end()) return fail(NET_EBADF);
socket = it->second;
}
if (how < 0 || how > 2) return fail(NET_EINVAL);
if (::shutdown(socket.native->value, how) != 0) {
const int error = native_error();
#if defined(_WIN32) || defined(__APPLE__)
Expand Down
1 change: 1 addition & 0 deletions core/libs/tests/GuestNetSocketState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ static void CheckStateErrors(int family) {
Require(sceNetSocketClose(closed) == 0);
for (const int how : {-1, 3}) RequireError(sceNetShutdown(stream, how), 22);
RequireError(sceNetShutdown(closed, 1), 9);
for (const int how : {-1, 3}) RequireError(sceNetShutdown(closed, how), 9);
RequireError(sceNetListen(closed, 1), 9);
RequireError(sceNetListen(datagram, 1), 45);
RequireError(sceNetAccept(closed, nullptr, nullptr), 9);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# libSceNet

## add Functional

- [sceNetShutdown](../../../core/libs/prx/libSceNet/Export.cpp) (libSceNet) - unmeasured on a console: an unknown descriptor fails with `EBADF` before an invalid `how` is refused with `EINVAL`, as FreeBSD 11.4's [`kern_shutdown`](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/sys/kern/uipc_syscalls.c#L1354-L1370) looks the descriptor up before [`soshutdown`](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/sys/kern/uipc_socket.c#L2343-L2349) checks `how`, and as libkernel's `shutdown` does.
Loading