Files
mtkports/www-client/netsurf/compat/sys/socket.h
T

43 lines
1.3 KiB
C

/*
* Minimal <sys/socket.h> for the MontaukOS NetSurf port.
*
* NetSurf includes this via utils/inet.h. MontaukOS has no BSD socket layer
* (the kernel exposes sockets as IPC handles through montauk::socket), so this
* supplies only the few declarations NetSurf's non-curl paths actually touch:
* the address families and socklen_t. Nothing here opens a socket.
*/
#ifndef _MONTAUK_COMPAT_SYS_SOCKET_H_
#define _MONTAUK_COMPAT_SYS_SOCKET_H_
#include <stdint.h>
#include <stddef.h>
#define AF_UNSPEC 0
#define AF_INET 2
#define AF_INET6 10
typedef uint32_t socklen_t;
#define SOCK_STREAM 1
#define SOCK_DGRAM 2
/*
* socket() exists only so desktop/gui_factory.c compiles: it installs
* gui_default_socket_open() into the fetch table, and that default is reached
* only by a fetcher that opens sockets -- i.e. curl, which is not built here.
*
* It deliberately FAILS rather than pretending. MontaukOS sockets are IPC
* handles obtained through montauk::socket() and are not interchangeable with
* BSD descriptors, so any caller reaching this wants the real fetcher instead.
* fetch_montauk will provide its own socket_open in the fetch table.
*/
static inline int socket(int domain, int type, int protocol)
{
(void) domain;
(void) type;
(void) protocol;
return -1;
}
#endif