From 5c896e027a54f24873151da1692bc2b09ca72bd4 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Sun, 23 Jun 2024 19:56:50 +0200 Subject: [PATCH] Add ESOCKTNOSUPPORT. --- kernel/net/fs.cpp | 2 +- kernel/net/ip.cpp | 2 +- libc/include/errno.h | 1 + libc/string/strerror.c | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/net/fs.cpp b/kernel/net/fs.cpp index 413a432a..fcb703a6 100644 --- a/kernel/net/fs.cpp +++ b/kernel/net/fs.cpp @@ -679,7 +679,7 @@ Ref Socket(int type, int protocol) switch ( type ) { case SOCK_STREAM: return Ref(new StreamSocket(0, 0, 0600, manager)); - default: return errno = EPROTOTYPE, Ref(NULL); + default: return errno = ESOCKTNOSUPPORT, Ref(NULL); } } diff --git a/kernel/net/ip.cpp b/kernel/net/ip.cpp index d58e5f7e..02711e3f 100644 --- a/kernel/net/ip.cpp +++ b/kernel/net/ip.cpp @@ -445,7 +445,7 @@ Ref Socket(int type, int protocol) if ( protocol == 0 || protocol == IPPROTO_TCP ) return TCP::Socket(AF_INET); return errno = EPROTONOSUPPORT, Ref(NULL); - default: return errno = EPROTOTYPE, Ref(NULL); + default: return errno = ESOCKTNOSUPPORT, Ref(NULL); } } diff --git a/libc/include/errno.h b/libc/include/errno.h index 32f6587a..b26f5451 100644 --- a/libc/include/errno.h +++ b/libc/include/errno.h @@ -109,6 +109,7 @@ #define ENOMOUNT 99 #define ENOMEDIUM 100 #define EHOSTDOWN 101 +#define ESOCKTNOSUPPORT 102 #define EOPNOTSUPP ENOTSUP #define EWOULDBLOCK EAGAIN diff --git a/libc/string/strerror.c b/libc/string/strerror.c index b11edd5d..c060115e 100644 --- a/libc/string/strerror.c +++ b/libc/string/strerror.c @@ -111,6 +111,7 @@ char* strerror(int errnum) case ENOMOUNT: return "No such mountpoint"; case ENOMEDIUM: return "No medium found"; case EHOSTDOWN: return "Host is down"; + case ESOCKTNOSUPPORT: "Socket type is not supported"; default: return "Unknown error condition"; } }