Cleanup redox patches

parent 5ab9c29f
Pipeline #2325 failed with stages
in 37 seconds
......@@ -1900,4 +1900,5 @@ sub vms_info {
ex_libs => add(sub { return vms_info(64)->{zlib} || (); }),
pointer_size => sub { return vms_info(64)->{pointer_size} },
},
);
......@@ -335,7 +335,8 @@ int opt_format(const char *s, unsigned long flags, int *result);
int opt_int(const char *arg, int *result);
int opt_ulong(const char *arg, unsigned long *result);
int opt_long(const char *arg, long *result);
#if 0
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && \
defined(INTMAX_MAX) && defined(UINTMAX_MAX)
int opt_imax(const char *arg, intmax_t *result);
int opt_umax(const char *arg, uintmax_t *result);
#else
......
......@@ -350,7 +350,8 @@ int opt_long(const char *value, long *result)
return 1;
}
#if 0
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && \
defined(INTMAX_MAX) && defined(UINTMAX_MAX)
/* Parse an intmax_t, put it into *result; return 0 on failure, else 1. */
int opt_imax(const char *value, intmax_t *result)
......
......@@ -15,7 +15,8 @@
#include "apps.h"
#if 0
#if defined(OPENSSL_SYS_UNIX) || defined(__APPLE__) || \
(defined(__VMS) && defined(__DECC) && __CTRL_VER >= 80300000)
# include <unistd.h>
# include <stdio.h>
# include <limits.h>
......
......@@ -1370,13 +1370,13 @@ int s_client_main(int argc, char **argv)
}
}
/*
#if !defined(__redox__)
if (socket_family == AF_UNIX && socket_type != SOCK_STREAM) {
BIO_printf(bio_err,
"Can't use unix sockets and datagrams together\n");
goto end;
}
*/
#endif
if (split_send_fragment > SSL3_RT_MAX_PLAIN_LENGTH) {
BIO_printf(bio_err, "Bad split send fragment size\n");
......
......@@ -746,14 +746,12 @@ int BIO_lookup(const char *host, const char *service,
# pragma pointer_size restore
#endif
#if 0
struct servent *se;
/* Apparently, on WIN64, s_proto and s_port have traded places... */
#ifdef _WIN64
struct servent se_fallback = { NULL, NULL, NULL, 0 };
#else
struct servent se_fallback = { NULL, NULL, 0, NULL };
#endif
#endif
if (!RUN_ONCE(&bio_lookup_init, do_bio_lookup_init)) {
......@@ -781,9 +779,14 @@ int BIO_lookup(const char *host, const char *service,
he = gethostbyname(host);
if (he == NULL) {
#if 0
#ifndef OPENSSL_SYS_WINDOWS
BIOerr(BIO_F_BIO_LOOKUP, ERR_R_SYS_LIB);
#if defined(__redox__)
ERR_add_error_data(1, strerror(h_errno));
#else
ERR_add_error_data(1, hstrerror(h_errno));
#endif
#else
SYSerr(SYS_F_GETHOSTBYNAME, WSAGetLastError());
#endif
ret = 0;
......@@ -791,16 +794,13 @@ int BIO_lookup(const char *host, const char *service,
}
}
long portnum;
if (service == NULL) {
//se_fallback.s_port = 0;
//se_fallback.s_proto = NULL;
//se = &se_fallback;
portnum = 0;
se_fallback.s_port = 0;
se_fallback.s_proto = NULL;
se = &se_fallback;
} else {
char *endp = NULL;
portnum = strtol(service, &endp, 10);
long portnum = strtol(service, &endp, 10);
/*
* Because struct servent is defined for 32-bit pointers only with
......@@ -824,19 +824,23 @@ int BIO_lookup(const char *host, const char *service,
break;
}
#if 0
if (endp != service && *endp == '\0'
&& portnum > 0 && portnum < 65536) {
//se_fallback.s_port = htons(portnum);
//se_fallback.s_proto = proto;
//se = &se_fallback;
se_fallback.s_port = htons(portnum);
se_fallback.s_proto = proto;
se = &se_fallback;
} else if (endp == service) {
//se = getservbyname(service, proto);
se = getservbyname(service, proto);
if (1) {
#if 0
if (se == NULL) {
#ifndef OPENSSL_SYS_WINDOWS
BIOerr(BIO_F_BIO_LOOKUP, ERR_R_SYS_LIB);
#if defined(__redox__)
ERR_add_error_data(1, strerror(h_errno));
#else
ERR_add_error_data(1, hstrerror(h_errno));
#endif
#else
SYSerr(SYS_F_GETSERVBYNAME, WSAGetLastError());
#endif
goto err;
......@@ -845,7 +849,6 @@ int BIO_lookup(const char *host, const char *service,
BIOerr(BIO_F_BIO_LOOKUP, BIO_R_MALFORMED_HOST_OR_SERVICE);
goto err;
}
#endif
}
*res = NULL;
......@@ -877,7 +880,7 @@ int BIO_lookup(const char *host, const char *service,
addrlistp--, addresses-- > 0; ) {
if (!addrinfo_wrap(he->h_addrtype, socktype,
*addrlistp, he->h_length,
htons(portnum), &tmp_bai))
se->s_port, &tmp_bai))
goto addrinfo_malloc_err;
tmp_bai->bai_next = *res;
*res = tmp_bai;
......
......@@ -92,8 +92,6 @@ int BIO_get_port(const char *str, unsigned short *port_ptr)
int BIO_sock_error(int sock)
{
return 0; // XXX
#if 0
int j = 0, i;
socklen_t size = sizeof(j);
......@@ -103,12 +101,15 @@ int BIO_sock_error(int sock)
* choke the compiler: if you do have a cast then you can either go for
* (char *) or (void *).
*/
#if defined(__redox__)
i = 0;
#else
i = getsockopt(sock, SOL_SOCKET, SO_ERROR, (void *)&j, &size);
#endif
if (i < 0)
return (get_last_socket_error());
else
return (j);
#endif
}
# if OPENSSL_API_COMPAT < 0x10100000L
......@@ -170,7 +171,7 @@ void bio_sock_cleanup_int(void)
# endif
}
# if 0
# if !defined(__redox__) && (!defined(OPENSSL_SYS_VMS) || __VMS_VER >= 70000000)
int BIO_socket_ioctl(int fd, long type, void *arg)
{
......@@ -318,7 +319,7 @@ int BIO_socket_nbio(int s, int mode)
l = mode;
ret = BIO_socket_ioctl(s, FIONBIO, &l);
# elif 1 // defined(F_GETFL) && defined(F_SETFL) && (defined(O_NONBLOCK) || defined(FNDELAY))
# elif defined(F_GETFL) && defined(F_SETFL) && (defined(O_NONBLOCK) || defined(FNDELAY))
/* make sure this call always pushes an error level; BIO_socket_ioctl() does so, so we do too. */
l = fcntl(s, F_GETFL, 0);
......
......@@ -86,7 +86,7 @@ int BIO_connect(int sock, const BIO_ADDR *addr, int options)
if (!BIO_socket_nbio(sock, (options & BIO_SOCK_NONBLOCK) != 0))
return 0;
/*
#if !defined(__redox__)
if (options & BIO_SOCK_KEEPALIVE) {
if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on)) != 0) {
SYSerr(SYS_F_SETSOCKOPT, get_last_socket_error());
......@@ -102,7 +102,7 @@ int BIO_connect(int sock, const BIO_ADDR *addr, int options)
return 0;
}
}
*/
#endif
if (connect(sock, BIO_ADDR_sockaddr(addr),
BIO_ADDR_sockaddr_size(addr)) == -1) {
......@@ -154,10 +154,6 @@ int BIO_connect(int sock, const BIO_ADDR *addr, int options)
*/
int BIO_listen(int sock, const BIO_ADDR *addr, int options)
{
char *msg = "listen() not implement on Redox yet\n";
write(2, msg, strlen(msg));
return 0;
#if 0
int on = 1;
int socktype;
socklen_t socktype_len = sizeof(socktype);
......@@ -177,6 +173,8 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
if (!BIO_socket_nbio(sock, (options & BIO_SOCK_NONBLOCK) != 0))
return 0;
#if !defined(__redox__)
# ifndef OPENSSL_SYS_WINDOWS
/* SO_REUSEADDR has different behavior on Windows than on
* other operating systems, don't set it there. */
......@@ -215,6 +213,8 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
}
# endif
#endif
if (bind(sock, BIO_ADDR_sockaddr(addr), BIO_ADDR_sockaddr_size(addr)) != 0) {
SYSerr(SYS_F_BIND, get_last_socket_error());
BIOerr(BIO_F_BIO_LISTEN, BIO_R_UNABLE_TO_BIND_SOCKET);
......@@ -228,7 +228,6 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
}
return 1;
# endif
}
/*-
......@@ -240,10 +239,6 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
*/
int BIO_accept_ex(int accept_sock, BIO_ADDR *addr_, int options)
{
char *msg = "accept() not implement on Redox yet\n";
write(2, msg, strlen(msg));
return INVALID_SOCKET;
/*
socklen_t len;
int accepted_sock;
BIO_ADDR locaddr;
......@@ -266,7 +261,6 @@ int BIO_accept_ex(int accept_sock, BIO_ADDR *addr_, int options)
}
return accepted_sock;
*/
}
/*-
......
......@@ -117,7 +117,7 @@ static void acpt_close_socket(BIO *bio)
c = (BIO_ACCEPT *)bio->ptr;
if (c->accept_sock != (int)INVALID_SOCKET) {
//shutdown(c->accept_sock, 2);
shutdown(c->accept_sock, 2);
closesocket(c->accept_sock);
c->accept_sock = (int)INVALID_SOCKET;
bio->num = (int)INVALID_SOCKET;
......
......@@ -260,8 +260,8 @@ static void conn_close_socket(BIO *bio)
c = (BIO_CONNECT *)bio->ptr;
if (bio->num != (int)INVALID_SOCKET) {
/* Only do a shutdown if things were established */
//if (c->state == BIO_CONN_S_OK)
//shutdown(bio->num, 2);
if (c->state == BIO_CONN_S_OK)
shutdown(bio->num, 2);
BIO_closesocket(bio->num);
bio->num = (int)INVALID_SOCKET;
}
......
......@@ -24,7 +24,7 @@
#include <string.h>
#if 0
#if !defined(__redox__) && (defined(OPENSSL_SYS_LINUX) || defined(OPENSSL_SYS_UNIX))
# define IMPLEMENTED
# include <stdlib.h>
# include <assert.h>
......
......@@ -40,7 +40,7 @@
* If unistd.h defines _POSIX_VERSION, we conclude that we are on a POSIX
* system and have sigaction and termios.
*/
# if 0
# if defined(_POSIX_VERSION)
# define SIGACTION
# if !defined(TERMIOS) && !defined(TERMIO) && !defined(SGTTY)
......@@ -99,7 +99,7 @@
#endif
#if 0
#ifdef TERMIOS
# include <termios.h>
# define TTY_STRUCT struct termios
# define TTY_FLAGS c_lflag
......@@ -123,7 +123,7 @@
# define TTY_set(tty,data) ioctl(tty,TIOCSETP,data)
#endif
#if 0
#if !defined(_LIBC) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS)
# include <sys/ioctl.h>
#endif
......@@ -165,7 +165,7 @@ static unsigned short channel = 0;
#elif defined(_WIN32) && !defined(_WIN32_WCE)
static DWORD tty_orig, tty_new;
#else
# if 0
# if !defined(OPENSSL_SYS_MSDOS) || defined(__DJGPP__)
static TTY_STRUCT tty_orig, tty_new;
# endif
#endif
......
......@@ -401,7 +401,7 @@ struct servent *PASCAL getservbyname(const char *, const char *);
# include <inet.h>
# else
# include <sys/socket.h>
# if 0
# ifndef NO_SYS_UN_H
# ifdef OPENSSL_SYS_VXWORKS
# include <streams/un.h>
# else
......@@ -416,7 +416,9 @@ struct servent *PASCAL getservbyname(const char *, const char *);
# endif
# include <netinet/in.h>
# include <arpa/inet.h>
//# include <netinet/tcp.h>
#if !defined(__redox__)
# include <netinet/tcp.h>
#endif
# endif
# ifdef OPENSSL_SYS_AIX
......@@ -428,7 +430,7 @@ struct servent *PASCAL getservbyname(const char *, const char *);
# endif
# ifndef VMS
//# include <sys/ioctl.h>
# include <sys/ioctl.h>
# else
/* ioctl is only in VMS > 7.0 and when socketshr is not used */
# if !defined(TCPIP_TYPE_SOCKETSHR) && defined(__VMS_VER) && (__VMS_VER > 70000000)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment