2020-01-18 09:38:21 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
|
2020-04-05 01:16:45 +04:30
|
|
|
#include <AK/StringView.h>
|
2021-09-12 11:29:28 +00:00
|
|
|
#include <Kernel/API/POSIX/errno.h>
|
2021-01-25 16:07:10 +01:00
|
|
|
#include <Kernel/Debug.h>
|
2021-09-07 13:39:11 +02:00
|
|
|
#include <Kernel/FileSystem/OpenFileDescription.h>
|
2019-04-02 19:54:38 +02:00
|
|
|
#include <Kernel/Net/IPv4Socket.h>
|
2019-06-07 11:43:58 +02:00
|
|
|
#include <Kernel/Net/LocalSocket.h>
|
2021-06-04 07:43:16 +03:00
|
|
|
#include <Kernel/Net/NetworkingManagement.h>
|
2019-06-07 11:43:58 +02:00
|
|
|
#include <Kernel/Net/Socket.h>
|
2019-02-14 17:18:35 +01:00
|
|
|
#include <Kernel/Process.h>
|
2019-06-07 11:43:58 +02:00
|
|
|
#include <Kernel/UnixTypes.h>
|
2019-02-14 14:17:38 +01:00
|
|
|
|
2020-02-16 01:27:42 +01:00
|
|
|
namespace Kernel {
|
|
|
|
|
|
2022-08-19 20:53:40 +02:00
|
|
|
ErrorOr<NonnullLockRefPtr<Socket>> Socket::create(int domain, int type, int protocol)
|
2019-02-14 14:17:38 +01:00
|
|
|
{
|
|
|
|
|
switch (domain) {
|
2021-09-07 14:55:44 +02:00
|
|
|
case AF_LOCAL:
|
|
|
|
|
return TRY(LocalSocket::try_create(type & SOCK_TYPE_MASK));
|
2019-03-12 15:51:42 +01:00
|
|
|
case AF_INET:
|
|
|
|
|
return IPv4Socket::create(type & SOCK_TYPE_MASK, protocol);
|
2019-02-14 14:17:38 +01:00
|
|
|
default:
|
2021-01-20 23:11:17 +01:00
|
|
|
return EAFNOSUPPORT;
|
2019-02-14 14:17:38 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Socket::Socket(int domain, int type, int protocol)
|
2019-05-02 03:28:20 +02:00
|
|
|
: m_domain(domain)
|
2019-02-14 14:17:38 +01:00
|
|
|
, m_type(type)
|
|
|
|
|
, m_protocol(protocol)
|
|
|
|
|
{
|
2021-08-29 01:30:05 +02:00
|
|
|
set_origin(Process::current());
|
2019-02-14 14:17:38 +01:00
|
|
|
}
|
|
|
|
|
|
2022-03-16 13:15:15 -06:00
|
|
|
Socket::~Socket() = default;
|
2019-02-14 14:17:38 +01:00
|
|
|
|
2019-08-10 13:17:00 +10:00
|
|
|
void Socket::set_setup_state(SetupState new_setup_state)
|
|
|
|
|
{
|
2021-02-07 15:33:24 +03:30
|
|
|
dbgln_if(SOCKET_DEBUG, "Socket({}) setup state moving from {} to {}", this, to_string(m_setup_state), to_string(new_setup_state));
|
2019-08-10 13:17:00 +10:00
|
|
|
m_setup_state = new_setup_state;
|
2020-11-29 16:05:27 -07:00
|
|
|
evaluate_block_conditions();
|
2019-08-10 13:17:00 +10:00
|
|
|
}
|
|
|
|
|
|
2022-08-19 20:53:40 +02:00
|
|
|
LockRefPtr<Socket> Socket::accept()
|
2019-02-14 15:17:30 +01:00
|
|
|
{
|
2021-08-29 13:10:55 +02:00
|
|
|
MutexLocker locker(mutex());
|
2019-02-14 15:17:30 +01:00
|
|
|
if (m_pending.is_empty())
|
|
|
|
|
return nullptr;
|
2021-02-07 15:33:24 +03:30
|
|
|
dbgln_if(SOCKET_DEBUG, "Socket({}) de-queueing connection", this);
|
2019-02-14 15:17:30 +01:00
|
|
|
auto client = m_pending.take_first();
|
2021-02-23 20:42:32 +01:00
|
|
|
VERIFY(!client->is_connected());
|
2021-08-19 22:45:07 +03:00
|
|
|
auto& process = Process::current();
|
2021-08-29 01:30:05 +02:00
|
|
|
client->set_acceptor(process);
|
2019-02-14 17:18:35 +01:00
|
|
|
client->m_connected = true;
|
2021-08-29 02:04:30 +02:00
|
|
|
client->set_role(Role::Accepted);
|
2020-11-29 16:05:27 -07:00
|
|
|
if (!m_pending.is_empty())
|
|
|
|
|
evaluate_block_conditions();
|
2019-02-14 15:17:30 +01:00
|
|
|
return client;
|
|
|
|
|
}
|
2019-02-14 17:18:35 +01:00
|
|
|
|
2022-08-19 20:53:40 +02:00
|
|
|
ErrorOr<void> Socket::queue_connection_from(NonnullLockRefPtr<Socket> peer)
|
2019-02-14 17:18:35 +01:00
|
|
|
{
|
2021-02-07 15:33:24 +03:30
|
|
|
dbgln_if(SOCKET_DEBUG, "Socket({}) queueing connection", this);
|
2021-08-29 13:10:55 +02:00
|
|
|
MutexLocker locker(mutex());
|
2019-03-06 22:14:31 +01:00
|
|
|
if (m_pending.size() >= m_backlog)
|
2021-08-01 11:27:23 -04:00
|
|
|
return set_so_error(ECONNREFUSED);
|
2022-04-09 22:26:25 +03:00
|
|
|
SOCKET_TRY(m_pending.try_append(move(peer)));
|
2020-11-29 16:05:27 -07:00
|
|
|
evaluate_block_conditions();
|
2021-11-08 00:51:39 +01:00
|
|
|
return {};
|
2019-02-14 17:18:35 +01:00
|
|
|
}
|
2019-03-13 13:13:23 +01:00
|
|
|
|
2022-04-01 20:58:27 +03:00
|
|
|
ErrorOr<void> Socket::setsockopt(int level, int option, Userspace<void const*> user_value, socklen_t user_value_size)
|
2019-03-13 13:13:23 +01:00
|
|
|
{
|
2021-12-28 15:16:57 +01:00
|
|
|
MutexLocker locker(mutex());
|
|
|
|
|
|
2021-02-13 01:29:28 +01:00
|
|
|
if (level != SOL_SOCKET)
|
|
|
|
|
return ENOPROTOOPT;
|
2021-02-23 20:42:32 +01:00
|
|
|
VERIFY(level == SOL_SOCKET);
|
2019-03-13 13:13:23 +01:00
|
|
|
switch (option) {
|
|
|
|
|
case SO_SNDTIMEO:
|
2020-07-31 00:26:33 +02:00
|
|
|
if (user_value_size != sizeof(timeval))
|
2021-01-20 23:11:17 +01:00
|
|
|
return EINVAL;
|
2021-09-06 22:22:14 +02:00
|
|
|
m_send_timeout = TRY(copy_time_from_user(static_ptr_cast<timeval const*>(user_value)));
|
2021-11-08 00:51:39 +01:00
|
|
|
return {};
|
2019-03-13 13:13:23 +01:00
|
|
|
case SO_RCVTIMEO:
|
2020-07-31 00:26:33 +02:00
|
|
|
if (user_value_size != sizeof(timeval))
|
2021-01-20 23:11:17 +01:00
|
|
|
return EINVAL;
|
2021-09-06 22:22:14 +02:00
|
|
|
m_receive_timeout = TRY(copy_time_from_user(static_ptr_cast<timeval const*>(user_value)));
|
2021-11-08 00:51:39 +01:00
|
|
|
return {};
|
2020-04-05 01:16:45 +04:30
|
|
|
case SO_BINDTODEVICE: {
|
2020-07-31 00:26:33 +02:00
|
|
|
if (user_value_size != IFNAMSIZ)
|
2021-01-20 23:11:17 +01:00
|
|
|
return EINVAL;
|
2022-04-01 20:58:27 +03:00
|
|
|
auto user_string = static_ptr_cast<char const*>(user_value);
|
2021-09-07 14:55:44 +02:00
|
|
|
auto ifname = TRY(try_copy_kstring_from_user(user_string, user_value_size));
|
|
|
|
|
auto device = NetworkingManagement::the().lookup_by_name(ifname->view());
|
2020-04-05 01:16:45 +04:30
|
|
|
if (!device)
|
2021-01-20 23:11:17 +01:00
|
|
|
return ENODEV;
|
2021-09-15 23:55:14 -07:00
|
|
|
m_bound_interface = move(device);
|
2021-11-08 00:51:39 +01:00
|
|
|
return {};
|
2020-04-05 01:16:45 +04:30
|
|
|
}
|
2021-12-02 00:48:09 +02:00
|
|
|
case SO_DEBUG:
|
|
|
|
|
// NOTE: This is supposed to toggle collection of debugging information on/off, we don't have any right now, so this is a no-op.
|
|
|
|
|
return {};
|
2020-04-05 18:10:19 +02:00
|
|
|
case SO_KEEPALIVE:
|
|
|
|
|
// FIXME: Obviously, this is not a real keepalive.
|
2021-11-08 00:51:39 +01:00
|
|
|
return {};
|
2020-09-16 12:32:45 -04:00
|
|
|
case SO_TIMESTAMP:
|
|
|
|
|
if (user_value_size != sizeof(int))
|
2021-01-20 23:11:17 +01:00
|
|
|
return EINVAL;
|
2021-12-17 09:12:20 +01:00
|
|
|
m_timestamp = TRY(copy_typed_from_user(static_ptr_cast<int const*>(user_value)));
|
|
|
|
|
if (m_timestamp != 0 && (domain() != AF_INET || type() == SOCK_STREAM)) {
|
2020-09-16 12:32:45 -04:00
|
|
|
// FIXME: Support SO_TIMESTAMP for more protocols?
|
|
|
|
|
m_timestamp = 0;
|
2021-01-20 23:11:17 +01:00
|
|
|
return ENOTSUP;
|
2020-09-16 12:32:45 -04:00
|
|
|
}
|
2021-11-08 00:51:39 +01:00
|
|
|
return {};
|
2021-12-02 01:01:02 +02:00
|
|
|
case SO_DONTROUTE: {
|
2021-12-17 09:12:20 +01:00
|
|
|
if (user_value_size != sizeof(int))
|
2021-12-02 01:01:02 +02:00
|
|
|
return EINVAL;
|
2021-12-17 09:12:20 +01:00
|
|
|
m_routing_disabled = TRY(copy_typed_from_user(static_ptr_cast<int const*>(user_value))) != 0;
|
2021-12-02 01:01:02 +02:00
|
|
|
return {};
|
|
|
|
|
}
|
2022-07-28 02:07:34 +02:00
|
|
|
case SO_REUSEADDR:
|
|
|
|
|
dbgln("FIXME: SO_REUSEADDR requested, but not implemented.");
|
|
|
|
|
return {};
|
2019-03-13 13:13:23 +01:00
|
|
|
default:
|
2021-01-10 15:43:09 +01:00
|
|
|
dbgln("setsockopt({}) at SOL_SOCKET not implemented.", option);
|
2021-01-20 23:11:17 +01:00
|
|
|
return ENOPROTOOPT;
|
2019-03-13 13:13:23 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-08 00:51:39 +01:00
|
|
|
ErrorOr<void> Socket::getsockopt(OpenFileDescription&, int level, int option, Userspace<void*> value, Userspace<socklen_t*> value_size)
|
2019-03-13 13:13:23 +01:00
|
|
|
{
|
2021-12-28 15:16:57 +01:00
|
|
|
MutexLocker locker(mutex());
|
|
|
|
|
|
2020-08-07 02:29:05 -07:00
|
|
|
socklen_t size;
|
2021-09-05 17:38:37 +02:00
|
|
|
TRY(copy_from_user(&size, value_size.unsafe_userspace_ptr()));
|
2020-08-07 02:29:05 -07:00
|
|
|
|
2020-09-09 07:41:57 +01:00
|
|
|
// FIXME: Add TCP_NODELAY, IPPROTO_TCP and IPPROTO_IP (used in OpenSSH)
|
|
|
|
|
if (level != SOL_SOCKET) {
|
|
|
|
|
// Not sure if this is the correct error code, but it's only temporary until other levels are implemented.
|
2021-01-20 23:11:17 +01:00
|
|
|
return ENOPROTOOPT;
|
2020-09-09 07:41:57 +01:00
|
|
|
}
|
|
|
|
|
|
2019-03-13 13:13:23 +01:00
|
|
|
switch (option) {
|
|
|
|
|
case SO_SNDTIMEO:
|
2020-08-07 02:29:05 -07:00
|
|
|
if (size < sizeof(timeval))
|
2021-01-20 23:11:17 +01:00
|
|
|
return EINVAL;
|
2021-02-28 02:48:45 +01:00
|
|
|
{
|
|
|
|
|
timeval tv = m_send_timeout.to_timeval();
|
2021-09-05 17:38:37 +02:00
|
|
|
TRY(copy_to_user(static_ptr_cast<timeval*>(value), &tv));
|
2021-02-28 02:48:45 +01:00
|
|
|
}
|
2020-08-07 02:29:05 -07:00
|
|
|
size = sizeof(timeval);
|
2021-09-05 17:38:37 +02:00
|
|
|
return copy_to_user(value_size, &size);
|
2019-03-13 13:13:23 +01:00
|
|
|
case SO_RCVTIMEO:
|
2020-08-07 02:29:05 -07:00
|
|
|
if (size < sizeof(timeval))
|
2021-01-20 23:11:17 +01:00
|
|
|
return EINVAL;
|
2021-02-28 02:48:45 +01:00
|
|
|
{
|
2021-12-17 00:05:03 +01:00
|
|
|
timeval tv = m_receive_timeout.to_timeval();
|
2021-09-05 17:38:37 +02:00
|
|
|
TRY(copy_to_user(static_ptr_cast<timeval*>(value), &tv));
|
2021-02-28 02:48:45 +01:00
|
|
|
}
|
2020-08-07 02:29:05 -07:00
|
|
|
size = sizeof(timeval);
|
2021-09-05 17:38:37 +02:00
|
|
|
return copy_to_user(value_size, &size);
|
2020-08-07 02:29:05 -07:00
|
|
|
case SO_ERROR: {
|
|
|
|
|
if (size < sizeof(int))
|
2021-01-20 23:11:17 +01:00
|
|
|
return EINVAL;
|
2021-11-08 00:51:39 +01:00
|
|
|
int errno;
|
|
|
|
|
if (so_error().is_error())
|
|
|
|
|
errno = so_error().error().code();
|
|
|
|
|
else
|
|
|
|
|
errno = 0;
|
2021-09-05 17:38:37 +02:00
|
|
|
TRY(copy_to_user(static_ptr_cast<int*>(value), &errno));
|
2020-08-07 02:29:05 -07:00
|
|
|
size = sizeof(int);
|
2021-09-05 17:38:37 +02:00
|
|
|
TRY(copy_to_user(value_size, &size));
|
2021-11-08 00:51:39 +01:00
|
|
|
clear_so_error();
|
|
|
|
|
return {};
|
2020-08-07 02:29:05 -07:00
|
|
|
}
|
2020-04-05 01:16:45 +04:30
|
|
|
case SO_BINDTODEVICE:
|
2020-08-07 02:29:05 -07:00
|
|
|
if (size < IFNAMSIZ)
|
2021-01-20 23:11:17 +01:00
|
|
|
return EINVAL;
|
2020-04-05 01:16:45 +04:30
|
|
|
if (m_bound_interface) {
|
2021-09-27 17:49:56 -07:00
|
|
|
auto name = m_bound_interface->name();
|
2020-04-05 01:16:45 +04:30
|
|
|
auto length = name.length() + 1;
|
2021-09-27 17:49:56 -07:00
|
|
|
auto characters = name.characters_without_null_termination();
|
|
|
|
|
TRY(copy_to_user(static_ptr_cast<char*>(value), characters, length));
|
2020-08-07 02:29:05 -07:00
|
|
|
size = length;
|
2021-09-05 17:38:37 +02:00
|
|
|
return copy_to_user(value_size, &size);
|
2020-04-05 01:16:45 +04:30
|
|
|
} else {
|
2020-08-07 02:29:05 -07:00
|
|
|
size = 0;
|
2021-09-05 17:38:37 +02:00
|
|
|
TRY(copy_to_user(value_size, &size));
|
|
|
|
|
// FIXME: This return value looks suspicious.
|
2021-01-20 23:11:17 +01:00
|
|
|
return EFAULT;
|
2020-04-05 01:16:45 +04:30
|
|
|
}
|
2020-09-16 12:32:45 -04:00
|
|
|
case SO_TIMESTAMP:
|
|
|
|
|
if (size < sizeof(int))
|
2021-01-20 23:11:17 +01:00
|
|
|
return EINVAL;
|
2021-09-05 17:38:37 +02:00
|
|
|
TRY(copy_to_user(static_ptr_cast<int*>(value), &m_timestamp));
|
2020-09-16 12:32:45 -04:00
|
|
|
size = sizeof(int);
|
2021-09-05 17:38:37 +02:00
|
|
|
return copy_to_user(value_size, &size);
|
2021-09-30 10:38:24 +08:00
|
|
|
case SO_TYPE:
|
|
|
|
|
if (size < sizeof(int))
|
|
|
|
|
return EINVAL;
|
|
|
|
|
TRY(copy_to_user(static_ptr_cast<int*>(value), &m_type));
|
|
|
|
|
size = sizeof(int);
|
|
|
|
|
return copy_to_user(value_size, &size);
|
2021-12-02 00:48:09 +02:00
|
|
|
case SO_DEBUG:
|
|
|
|
|
// NOTE: This is supposed to toggle collection of debugging information on/off, we don't have any right now, so we just claim it's always off.
|
|
|
|
|
if (size < sizeof(int))
|
|
|
|
|
return EINVAL;
|
|
|
|
|
TRY(memset_user(value.unsafe_userspace_ptr(), 0, sizeof(int)));
|
|
|
|
|
size = sizeof(int);
|
|
|
|
|
return copy_to_user(value_size, &size);
|
2021-12-02 00:52:12 +02:00
|
|
|
case SO_ACCEPTCONN: {
|
|
|
|
|
int accepting_connections = (m_role == Role::Listener) ? 1 : 0;
|
|
|
|
|
if (size < sizeof(accepting_connections))
|
|
|
|
|
return EINVAL;
|
|
|
|
|
TRY(copy_to_user(static_ptr_cast<int*>(value), &accepting_connections));
|
|
|
|
|
size = sizeof(accepting_connections);
|
|
|
|
|
return copy_to_user(value_size, &size);
|
|
|
|
|
}
|
2021-12-02 01:01:02 +02:00
|
|
|
case SO_DONTROUTE: {
|
|
|
|
|
int routing_disabled = m_routing_disabled ? 1 : 0;
|
|
|
|
|
if (size < sizeof(routing_disabled))
|
|
|
|
|
return EINVAL;
|
|
|
|
|
TRY(copy_to_user(static_ptr_cast<int*>(value), &routing_disabled));
|
|
|
|
|
size = sizeof(routing_disabled);
|
|
|
|
|
return copy_to_user(value_size, &size);
|
|
|
|
|
}
|
2019-03-13 13:13:23 +01:00
|
|
|
default:
|
2022-01-17 22:11:54 -08:00
|
|
|
dbgln("getsockopt({}) at SOL_SOCKET not implemented.", option);
|
2021-01-20 23:11:17 +01:00
|
|
|
return ENOPROTOOPT;
|
2019-03-13 13:13:23 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-08 00:51:39 +01:00
|
|
|
ErrorOr<size_t> Socket::read(OpenFileDescription& description, u64, UserOrKernelBuffer& buffer, size_t size)
|
2019-08-05 10:03:19 +02:00
|
|
|
{
|
2020-02-08 00:52:33 +01:00
|
|
|
if (is_shut_down_for_reading())
|
|
|
|
|
return 0;
|
2021-02-28 02:48:45 +01:00
|
|
|
Time t {};
|
2022-08-21 16:45:42 +02:00
|
|
|
return recvfrom(description, buffer, size, 0, {}, 0, t, description.is_blocking());
|
2019-08-05 10:03:19 +02:00
|
|
|
}
|
|
|
|
|
|
2022-04-01 20:58:27 +03:00
|
|
|
ErrorOr<size_t> Socket::write(OpenFileDescription& description, u64, UserOrKernelBuffer const& data, size_t size)
|
2019-08-05 10:03:19 +02:00
|
|
|
{
|
2020-02-08 00:52:33 +01:00
|
|
|
if (is_shut_down_for_writing())
|
2021-08-01 11:27:23 -04:00
|
|
|
return set_so_error(EPIPE);
|
2020-08-17 23:49:35 -07:00
|
|
|
return sendto(description, data, size, 0, {}, 0);
|
2019-08-05 10:03:19 +02:00
|
|
|
}
|
2020-02-08 00:52:33 +01:00
|
|
|
|
2021-11-08 00:51:39 +01:00
|
|
|
ErrorOr<void> Socket::shutdown(int how)
|
2020-02-08 00:52:33 +01:00
|
|
|
{
|
2021-08-29 13:10:55 +02:00
|
|
|
MutexLocker locker(mutex());
|
2020-02-08 00:52:33 +01:00
|
|
|
if (type() == SOCK_STREAM && !is_connected())
|
2021-08-01 11:27:23 -04:00
|
|
|
return set_so_error(ENOTCONN);
|
2020-02-08 15:52:32 +01:00
|
|
|
if (m_role == Role::Listener)
|
2021-08-01 11:27:23 -04:00
|
|
|
return set_so_error(ENOTCONN);
|
2022-07-09 22:29:50 +03:00
|
|
|
if (!m_shut_down_for_writing && (how == SHUT_WR || how == SHUT_RDWR)) {
|
2020-02-08 15:52:32 +01:00
|
|
|
shut_down_for_writing();
|
2022-07-09 22:29:50 +03:00
|
|
|
m_shut_down_for_writing = true;
|
|
|
|
|
}
|
|
|
|
|
if (!m_shut_down_for_reading && (how == SHUT_RD || how == SHUT_RDWR)) {
|
2020-02-08 15:52:32 +01:00
|
|
|
shut_down_for_reading();
|
2022-07-09 22:29:50 +03:00
|
|
|
m_shut_down_for_reading = true;
|
|
|
|
|
}
|
2021-11-08 00:51:39 +01:00
|
|
|
return {};
|
2020-02-08 00:52:33 +01:00
|
|
|
}
|
2020-02-16 01:27:42 +01:00
|
|
|
|
2021-12-17 11:22:27 +01:00
|
|
|
ErrorOr<struct stat> Socket::stat() const
|
2020-09-06 18:31:51 +02:00
|
|
|
{
|
2021-12-17 11:22:27 +01:00
|
|
|
struct stat st = {};
|
2020-09-06 18:31:51 +02:00
|
|
|
st.st_mode = S_IFSOCK;
|
2021-12-17 11:22:27 +01:00
|
|
|
return st;
|
2020-09-06 18:31:51 +02:00
|
|
|
}
|
|
|
|
|
|
2020-12-13 19:15:42 +01:00
|
|
|
void Socket::set_connected(bool connected)
|
|
|
|
|
{
|
2021-08-29 13:10:55 +02:00
|
|
|
MutexLocker locker(mutex());
|
2020-12-13 19:15:42 +01:00
|
|
|
if (m_connected == connected)
|
|
|
|
|
return;
|
|
|
|
|
m_connected = connected;
|
|
|
|
|
evaluate_block_conditions();
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-29 01:30:05 +02:00
|
|
|
void Socket::set_origin(Process const& process)
|
|
|
|
|
{
|
2022-08-21 12:40:19 +01:00
|
|
|
auto credentials = process.credentials();
|
|
|
|
|
m_origin = { process.pid().value(), credentials->uid().value(), credentials->gid().value() };
|
2021-08-29 01:30:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Socket::set_acceptor(Process const& process)
|
|
|
|
|
{
|
2022-08-21 12:40:19 +01:00
|
|
|
auto credentials = process.credentials();
|
|
|
|
|
m_acceptor = { process.pid().value(), credentials->uid().value(), credentials->gid().value() };
|
2021-08-29 01:30:05 +02:00
|
|
|
}
|
|
|
|
|
|
2020-02-16 01:27:42 +01:00
|
|
|
}
|