From: Michael Wallner Date: Tue, 5 Jan 2016 17:31:29 +0000 (+0100) Subject: flush X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=0d05258e368d32f04371734a45759ea9ac2f5a7a;p=m6w6%2Fext-psi flush --- diff --git a/config.m4 b/config.m4 index e0890da..bfa56e5 100644 --- a/config.m4 +++ b/config.m4 @@ -29,6 +29,7 @@ if test "$PHP_PSI" != no; then [sys_types.m4], [sys_uio.m4], [sys_utsname.m4], + [netdb.m4], [syslog.m4], [time.m4], [wchar.m4]], [ @@ -60,6 +61,7 @@ if test "$PHP_PSI" != no; then PSI_CHECK_SYS_STAT PSI_CHECK_SYS_UIO PSI_CHECK_SYS_UTSNAME + PSI_CHECK_NETDB PSI_CHECK_SYSLOG PSI_CHECK_WCHAR diff --git a/m4/netdb.m4 b/m4/netdb.m4 new file mode 100644 index 0000000..4043210 --- /dev/null +++ b/m4/netdb.m4 @@ -0,0 +1,94 @@ +AC_DEFUN(PSI_CHECK_NETDB, [ + AC_CHECK_HEADERS(netdb.h) + + PSI_STRUCT(struct hostent, [ + char *h_name, + char **h_aliases, + int h_addrtype, + int h_length, + char **h_addr_list] + ) + + PSI_STRUCT(struct netent, [ + char *n_name, + char **n_aliases, + int n_addrtype, + uint32_t n_net] + ) + + PSI_STRUCT(struct protoent, [ + char *p_name, + char **p_aliases, + int p_proto] + ) + + PSI_STRUCT(struct servent, [ + char *s_name, + char **s_aliases, + int s_port, + char *s_proto] + ) + + PSI_CONST(IPPORT_RESERVED, int) + + PSI_STRUCT(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] + ) + + PSI_CONST(AI_PASSIVE, int) + PSI_CONST(AI_CANONNAME, int) + PSI_CONST(AI_NUMERICHOST, int) + PSI_CONST(AI_NUMERICSERV, int) + PSI_CONST(AI_V4MAPPED, int) + PSI_CONST(AI_ALL, int) + PSI_CONST(AI_ADDRCONFIG, int) + + PSI_CONST(NI_NOFQDN, int) + PSI_CONST(NI_NUMERICHOST, int) + PSI_CONST(NI_NAMEREQD, int) + PSI_CONST(NI_NUMERICSERV, int) + PSI_CONST(NI_NUMERICSCOPE, int) + PSI_CONST(NI_DGRAM, int) + + PSI_CONST(EAI_AGAIN, int) + PSI_CONST(EAI_BADFLAGS, int) + PSI_CONST(EAI_FAIL, int) + PSI_CONST(EAI_FAMILY, int) + PSI_CONST(EAI_MEMORY, int) + PSI_CONST(EAI_NONAME, int) + PSI_CONST(EAI_SERVICE, int) + PSI_CONST(EAI_SOCKTYPE, int) + PSI_CONST(EAI_SYSTEM, int) + PSI_CONST(EAI_OVERFLOW, int) + + PSI_DECL(void endhostent, [(void)]) + PSI_DECL(void endnetent, [(void)]) + PSI_DECL(void endprotoent, [(void)]) + PSI_DECL(void endservent, [(void)]) + PSI_DECL(void freeaddrinfo, [(struct addrinfo *res)]) + PSI_DECL(char *gai_strerror, [(int errcode)]) + PSI_DECL(int getaddrinfo, [(char *node, char *service, struct addrinfo *hints, struct addrinfo **res)]) + PSI_DECL(struct hostent *gethostent, [(void)]) + PSI_DECL(int getnameinfo, [(struct sockaddr *sa, socklen_t salen, char *host, socklen_t host_len, char *serv, socklen_t servlen, int flags)]) + PSI_DECL(struct netent *getnetbyaddr, [(uint32_t net, int type)]) + PSI_DECL(struct netent *getnetbyname, [(char *name)]) + PSI_DECL(struct netent *getnetent, [(void)]) + PSI_DECL(struct protoent *getprotobyname, [(char *name)]) + PSI_DECL(struct protoent *getprotobynumber, [(int proto)]) + PSI_DECL(struct protoent *getprotoent, [(void)]) + PSI_DECL(struct servent *getservbyname, [(char *name, char *proto)]) + PSI_DECL(struct servent *getservbyport, [(int port, char *proto)]) + PSI_DECL(struct servent *getservent, [(void)]) + PSI_DECL(void sethostent, [(int stayopen)]) + PSI_DECL(void setnetent, [(int stayopen)]) + PSI_DECL(void setprotoent, [(int stayopen)]) + PSI_DECL(void setservent, [(int stayopen)]) + +]) \ No newline at end of file diff --git a/psi.d/netdb.psi b/psi.d/netdb.psi new file mode 100644 index 0000000..8186a7d --- /dev/null +++ b/psi.d/netdb.psi @@ -0,0 +1,38 @@ +function psi\endhostent() : void { + return void(endhostent); +} +function psi\endnetend() : void { + return void(endnetent); +} +function psi\endprotoent() : void { + return void(endprotoent); +} +function psi\endservent() : void { + return void(endservent); +} + +function psi\gai_strerror(int $errcode) : string { + let errcode = intval($errcode); + return to_string(gai_strerror); +} + +function psi\getaddrinfo(string $node, string $service, array $hints, object &$res = NULL) : int { + let node = strval($node); + let service = strval($service); + let hints = arrval($hints); + let res = &NULL; + return to_int(getaddrinfo); + set $res = to_array(*res, + to_int(ai_flags), + to_int(ai_family), + to_int(ai_socktype), + to_int(ai_protocol), + to_int(ai_addrlen), + to_array(ai_addr, + to_int(sa_family), + to_string(sa_data, ai_addrlen) + ), + to_string(ai_canonname) + // FIXME ai_next + ); +} \ No newline at end of file diff --git a/src/context.c b/src/context.c index a75368e..3d20920 100644 --- a/src/context.c +++ b/src/context.c @@ -356,6 +356,7 @@ static const char * const abi_ccs[] = { "default", /* \ */ "extern", /* > - all the same */ "cdecl", /* / */ + "mscdecl", "stdcall", "fastcall", };