LibC: Fix sockaddr_un implementation

This commit is contained in:
Bananymous 2024-02-07 02:13:21 +02:00
parent 41cad88d6e
commit 454bee3f02
3 changed files with 10 additions and 4 deletions

View File

@ -16,6 +16,12 @@ __BEGIN_DECLS
#include <bits/types/sa_family_t.h>
typedef long socklen_t;
#if !defined(FILENAME_MAX)
#define FILENAME_MAX 256
#elif FILENAME_MAX != 256
#error "invalid FILENAME_MAX"
#endif
struct sockaddr
{
sa_family_t sa_family; /* Address family. */
@ -24,8 +30,8 @@ struct sockaddr
struct sockaddr_storage
{
// FIXME
sa_family_t ss_family;
char ss_storage[FILENAME_MAX];
};
struct msghdr

View File

@ -11,8 +11,8 @@ __BEGIN_DECLS
struct sockaddr_un
{
sa_family_t sun_family; /* Address family. */
char sun_path[]; /* Socket pathname. */
sa_family_t sun_family; /* Address family. */
char sun_path[FILENAME_MAX]; /* Socket pathname. */
};
__END_DECLS

View File

@ -22,7 +22,7 @@ int listen(int socket, int backlog)
return syscall(SYS_LISTEN, socket, backlog);
}
ssize_t revc(int socket, void* __restrict buffer, size_t length, int flags)
ssize_t recv(int socket, void* __restrict buffer, size_t length, int flags)
{
return recvfrom(socket, buffer, length, flags, nullptr, nullptr);
}