Skip to content

Commit

Permalink
Merge pull request #1232 from no92/systemd-udev-4
Browse files Browse the repository at this point in the history
systemd-udevd on managarm: part 4, last steps
  • Loading branch information
no92 authored Jan 21, 2025
2 parents 2e4b37d + dfb63ba commit f04ac39
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
4 changes: 0 additions & 4 deletions sysdeps/managarm/generic/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1905,10 +1905,6 @@ int sys_stat(fsfd_target fsfdt, int fd, const char *path, int flags, struct stat
req.set_path(frg::string<MemoryAllocator>(getSysdepsAllocator(), path));
}

if (flags & ~(AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH)) {
return EINVAL;
}

if (!(flags & AT_EMPTY_PATH) && (!path || !strlen(path))) {
return ENOENT;
}
Expand Down
29 changes: 27 additions & 2 deletions sysdeps/managarm/generic/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,17 @@ sys_getsockopt(int fd, int layer, int number, void *__restrict buffer, socklen_t
<< frg::endlog;
*(int *)buffer = 1;
return 0;
} else if (layer == IPPROTO_TCP && number == TCP_MAXSEG) {
mlibc::infoLogger() << "\e[31mmlibc: getsockopt() call with IPPROTO_TCP and TCP_MAXSEG is "
"unimplemented\e[39m"
<< frg::endlog;
return 0;
} else if (layer == IPPROTO_TCP && number == TCP_CONGESTION) {
mlibc::infoLogger(
) << "\e[31mmlibc: getsockopt() call with IPPROTO_TCP and TCP_CONGESTION is "
"unimplemented\e[39m"
<< frg::endlog;
return 0;
} else if (std::find(
getsockopt_passthrough.begin(),
getsockopt_passthrough.end(),
Expand Down Expand Up @@ -396,19 +407,23 @@ sys_getsockopt(int fd, int layer, int number, void *__restrict buffer, socklen_t

namespace {

std::array<std::pair<int, int>, 5> setsockopt_readonly = {{
std::array<std::pair<int, int>, 6> setsockopt_readonly = {{
{SOL_SOCKET, SO_ACCEPTCONN},
{SOL_SOCKET, SO_DOMAIN},
{SOL_SOCKET, SO_ERROR},
{SOL_SOCKET, SO_PROTOCOL},
{SOL_SOCKET, SO_TYPE},
{SOL_IP, SO_PEERSEC},
}};

std::array<std::pair<int, int>, 6> setsockopt_passthrough = {{
std::array<std::pair<int, int>, 9> setsockopt_passthrough = {{
{SOL_PACKET, PACKET_AUXDATA},
{SOL_SOCKET, SO_LOCK_FILTER},
{SOL_SOCKET, SO_BINDTODEVICE},
{SOL_SOCKET, SO_TIMESTAMP},
{SOL_IP, IP_PKTINFO},
{SOL_IP, IP_RECVTTL},
{SOL_IP, IP_RETOPTS},
{SOL_NETLINK, NETLINK_ADD_MEMBERSHIP},
{SOL_NETLINK, NETLINK_PKTINFO},
}};
Expand Down Expand Up @@ -599,6 +614,11 @@ int sys_setsockopt(int fd, int layer, int number, const void *buffer, socklen_t
"unimplemented\e[39m"
<< frg::endlog;
return 0;
} else if (layer == IPPROTO_TCP && number == TCP_MAXSEG) {
mlibc::infoLogger() << "\e[31mmlibc: setsockopt() call with IPPROTO_TCP and TCP_NODELAY is "
"unimplemented\e[39m"
<< frg::endlog;
return 0;
} else if (layer == IPPROTO_TCP && number == TCP_KEEPIDLE) {
mlibc::infoLogger() << "\e[31mmlibc: setsockopt() call with IPPROTO_TCP and TCP_KEEPIDLE "
"is unimplemented\e[39m"
Expand Down Expand Up @@ -649,6 +669,11 @@ int sys_setsockopt(int fd, int layer, int number, const void *buffer, socklen_t
) << "\e[31mmlibc: setsockopt() call with SOL_SOCKET and SO_RCVTIMEO is unimplemented\e[39m"
<< frg::endlog;
return 0;
} else if (layer == SOL_IP && number == IP_RECVERR) {
mlibc::infoLogger(
) << "\e[31mmlibc: setsockopt() call with SOL_IP and IP_RECVERR is unimplemented\e[39m"
<< frg::endlog;
return 0;
} else {
mlibc::panicLogger() << "\e[31mmlibc: Unexpected setsockopt() call, layer: " << layer
<< " number: " << number << "\e[39m" << frg::endlog;
Expand Down

0 comments on commit f04ac39

Please sign in to comment.