feat: ports - git port
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* <netdb.h> for the MontaukOS git port.
|
||||
*
|
||||
* The port builds NO_IPV6=1, so git resolves names through gethostbyname()
|
||||
* and getservbyname() rather than getaddrinfo(). Both fail here: MontaukOS
|
||||
* resolves DNS inside the kernel network stack, and no userspace resolver
|
||||
* interface is exposed. `git clone git://host/repo` therefore reports that it
|
||||
* cannot look up the host. getaddrinfo() is still declared because
|
||||
* git-compat-util.h references the types unconditionally.
|
||||
*
|
||||
* Implementations in montauk-compat.c.
|
||||
*/
|
||||
#ifndef _MONTAUK_GIT_NETDB_H_
|
||||
#define _MONTAUK_GIT_NETDB_H_
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
struct hostent {
|
||||
char *h_name;
|
||||
char **h_aliases;
|
||||
int h_addrtype;
|
||||
int h_length;
|
||||
char **h_addr_list;
|
||||
};
|
||||
|
||||
#define h_addr h_addr_list[0]
|
||||
|
||||
struct servent {
|
||||
char *s_name;
|
||||
char **s_aliases;
|
||||
int s_port;
|
||||
char *s_proto;
|
||||
};
|
||||
|
||||
struct addrinfo {
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
socklen_t ai_addrlen;
|
||||
struct sockaddr *ai_addr;
|
||||
char *ai_canonname;
|
||||
struct addrinfo *ai_next;
|
||||
};
|
||||
|
||||
#define AI_PASSIVE 0x0001
|
||||
#define AI_CANONNAME 0x0002
|
||||
#define AI_NUMERICHOST 0x0004
|
||||
#define AI_NUMERICSERV 0x0400
|
||||
|
||||
#define NI_MAXHOST 1025
|
||||
#define NI_MAXSERV 32
|
||||
#define NI_NUMERICHOST 1
|
||||
#define NI_NUMERICSERV 2
|
||||
#define NI_NAMEREQD 8
|
||||
|
||||
#define EAI_NONAME -2
|
||||
#define EAI_AGAIN -3
|
||||
#define EAI_FAIL -4
|
||||
#define EAI_FAMILY -6
|
||||
#define EAI_SYSTEM -11
|
||||
|
||||
#define HOST_NOT_FOUND 1
|
||||
#define TRY_AGAIN 2
|
||||
#define NO_RECOVERY 3
|
||||
#define NO_DATA 4
|
||||
|
||||
extern int h_errno;
|
||||
|
||||
struct hostent *gethostbyname(const char *name);
|
||||
struct servent *getservbyname(const char *name, const char *proto);
|
||||
|
||||
int getaddrinfo(const char *node, const char *service,
|
||||
const struct addrinfo *hints, struct addrinfo **res);
|
||||
void freeaddrinfo(struct addrinfo *res);
|
||||
int getnameinfo(const struct sockaddr *sa, socklen_t salen,
|
||||
char *host, socklen_t hostlen,
|
||||
char *serv, socklen_t servlen, int flags);
|
||||
const char *gai_strerror(int errcode);
|
||||
|
||||
#endif /* _MONTAUK_GIT_NETDB_H_ */
|
||||
Reference in New Issue
Block a user