Sortix patches
This commit is contained in:
parent
4677966d3f
commit
1e47b86f42
|
@ -35,8 +35,6 @@ mandir = @mandir@
|
||||||
includedir = @includedir@
|
includedir = @includedir@
|
||||||
oldincludedir = /usr/include
|
oldincludedir = /usr/include
|
||||||
|
|
||||||
DESTDIR =
|
|
||||||
|
|
||||||
pkgdatadir = $(datadir)/@PACKAGE@
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
pkglibdir = $(libdir)/@PACKAGE@
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
pkgincludedir = $(includedir)/@PACKAGE@
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
|
|
|
@ -205,6 +205,7 @@ int bind_to_af_unix(unsigned char *name)
|
||||||
#endif
|
#endif
|
||||||
EINTRLOOP(rs, bind(s_unix_fd, &s_unix.s, s_unix_l));
|
EINTRLOOP(rs, bind(s_unix_fd, &s_unix.s, s_unix_l));
|
||||||
if (rs) {
|
if (rs) {
|
||||||
|
attempt_connect:
|
||||||
/*debug("bind: %d, %s", errno, strerror(errno));*/
|
/*debug("bind: %d, %s", errno, strerror(errno));*/
|
||||||
if (af == PF_INET && errno == EADDRNOTAVAIL) {
|
if (af == PF_INET && errno == EADDRNOTAVAIL) {
|
||||||
/* do not try to connect if the user has not configured loopback interface */
|
/* do not try to connect if the user has not configured loopback interface */
|
||||||
|
@ -217,7 +218,7 @@ int bind_to_af_unix(unsigned char *name)
|
||||||
#if defined(SOL_SOCKET) && defined(SO_REUSEADDR)
|
#if defined(SOL_SOCKET) && defined(SO_REUSEADDR)
|
||||||
EINTRLOOP(rs, setsockopt(s_unix_fd, SOL_SOCKET, SO_REUSEADDR, (void *)&a1, sizeof a1));
|
EINTRLOOP(rs, setsockopt(s_unix_fd, SOL_SOCKET, SO_REUSEADDR, (void *)&a1, sizeof a1));
|
||||||
#endif
|
#endif
|
||||||
EINTRLOOP(rs, connect(s_unix_fd, &s_unix.s, s_unix_l));
|
rs = blocking_connect(s_unix_fd, &s_unix.s, s_unix_l);
|
||||||
if (rs) {
|
if (rs) {
|
||||||
retry:
|
retry:
|
||||||
/*debug("connect: %d, %s", errno, strerror(errno));*/
|
/*debug("connect: %d, %s", errno, strerror(errno));*/
|
||||||
|
@ -255,6 +256,7 @@ retry_unlink:
|
||||||
}
|
}
|
||||||
EINTRLOOP(rs, listen(s_unix_fd, 100));
|
EINTRLOOP(rs, listen(s_unix_fd, 100));
|
||||||
if (rs) {
|
if (rs) {
|
||||||
|
if (errno == EADDRINUSE) goto attempt_connect;
|
||||||
error("ERROR: listen failed: %d", errno);
|
error("ERROR: listen failed: %d", errno);
|
||||||
close_and_fail:
|
close_and_fail:
|
||||||
EINTRLOOP(rs, close(s_unix_fd));
|
EINTRLOOP(rs, close(s_unix_fd));
|
||||||
|
|
|
@ -118,7 +118,7 @@ libdir='${exec_prefix}/lib'
|
||||||
includedir='${prefix}/include'
|
includedir='${prefix}/include'
|
||||||
oldincludedir='/usr/include'
|
oldincludedir='/usr/include'
|
||||||
infodir='${prefix}/info'
|
infodir='${prefix}/info'
|
||||||
mandir='${prefix}/man'
|
mandir='${prefix}/share/man'
|
||||||
|
|
||||||
# Initialize some other variables.
|
# Initialize some other variables.
|
||||||
subdirs=
|
subdirs=
|
||||||
|
@ -235,7 +235,7 @@ Directory and file names:
|
||||||
--includedir=DIR C header files in DIR [PREFIX/include]
|
--includedir=DIR C header files in DIR [PREFIX/include]
|
||||||
--oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
|
--oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
|
||||||
--infodir=DIR info documentation in DIR [PREFIX/info]
|
--infodir=DIR info documentation in DIR [PREFIX/info]
|
||||||
--mandir=DIR man documentation in DIR [PREFIX/man]
|
--mandir=DIR man documentation in DIR [PREFIX/share/man]
|
||||||
--srcdir=DIR find the sources in DIR [configure dir or ..]
|
--srcdir=DIR find the sources in DIR [configure dir or ..]
|
||||||
--program-prefix=PREFIX prepend PREFIX to installed program names
|
--program-prefix=PREFIX prepend PREFIX to installed program names
|
||||||
--program-suffix=SUFFIX append SUFFIX to installed program names
|
--program-suffix=SUFFIX append SUFFIX to installed program names
|
||||||
|
|
|
@ -672,7 +672,7 @@ static void try_connect(struct connection *c)
|
||||||
#if defined(__aarch64__) && defined(__ILP32__)
|
#if defined(__aarch64__) && defined(__ILP32__)
|
||||||
errno = EINPROGRESS; /* arm64 ilp32 bug */
|
errno = EINPROGRESS; /* arm64 ilp32 bug */
|
||||||
#endif
|
#endif
|
||||||
EINTRLOOP(rs, connect(s, (struct sockaddr *)(void *)&sa, sizeof sa));
|
rs = connect(s, (struct sockaddr *)(void *)&sa, sizeof sa);
|
||||||
#ifdef SUPPORT_IPV6
|
#ifdef SUPPORT_IPV6
|
||||||
} else if (addr->af == AF_INET6) {
|
} else if (addr->af == AF_INET6) {
|
||||||
struct sockaddr_in6 sa;
|
struct sockaddr_in6 sa;
|
||||||
|
@ -686,14 +686,14 @@ static void try_connect(struct connection *c)
|
||||||
#if defined(__aarch64__) && defined(__ILP32__)
|
#if defined(__aarch64__) && defined(__ILP32__)
|
||||||
errno = EINPROGRESS; /* arm64 ilp32 bug */
|
errno = EINPROGRESS; /* arm64 ilp32 bug */
|
||||||
#endif
|
#endif
|
||||||
EINTRLOOP(rs, connect(s, (struct sockaddr *)(void *)&sa, sizeof sa));
|
rs = connect(s, (struct sockaddr *)(void *)&sa, sizeof sa);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
rs = -1;
|
rs = -1;
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
}
|
}
|
||||||
if (rs) {
|
if (rs) {
|
||||||
if (errno != EALREADY && errno != EINPROGRESS) {
|
if (errno != EALREADY && errno != EINPROGRESS && errno != EINTR) {
|
||||||
#ifdef BEOS
|
#ifdef BEOS
|
||||||
if (errno == EWOULDBLOCK) errno = ETIMEDOUT;
|
if (errno == EWOULDBLOCK) errno = ETIMEDOUT;
|
||||||
#endif
|
#endif
|
||||||
|
|
2
dns.c
2
dns.c
|
@ -773,7 +773,7 @@ int ipv6_full_access(void)
|
||||||
sin6.sin6_family = AF_INET6;
|
sin6.sin6_family = AF_INET6;
|
||||||
sin6.sin6_port = htons(1024);
|
sin6.sin6_port = htons(1024);
|
||||||
memcpy(&sin6.sin6_addr.s6_addr, "\052\001\004\060\000\015\000\000\002\314\236\377\376\044\176\032", 16);
|
memcpy(&sin6.sin6_addr.s6_addr, "\052\001\004\060\000\015\000\000\002\314\236\377\376\044\176\032", 16);
|
||||||
EINTRLOOP(c, connect(h, (struct sockaddr *)(void *)&sin6, sizeof sin6));
|
c = blocking_connect(h, (struct sockaddr *)(void *)&sin6, sizeof sin6);
|
||||||
EINTRLOOP(rs, close(h));
|
EINTRLOOP(rs, close(h));
|
||||||
if (!c) return 1;
|
if (!c) return 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
1
links.h
1
links.h
|
@ -1140,6 +1140,7 @@ extern int terminate_loop;
|
||||||
int can_write(int fd);
|
int can_write(int fd);
|
||||||
int can_read(int fd);
|
int can_read(int fd);
|
||||||
int can_read_timeout(int fd, int sec);
|
int can_read_timeout(int fd, int sec);
|
||||||
|
int blocking_connect(int fd, struct sockaddr *addr, socklen_t addrlen);
|
||||||
int close_std_handle(int);
|
int close_std_handle(int);
|
||||||
void restore_std_handle(int, int);
|
void restore_std_handle(int, int);
|
||||||
unsigned long select_info(int);
|
unsigned long select_info(int);
|
||||||
|
|
8
os_dep.c
8
os_dep.c
|
@ -3434,6 +3434,14 @@ int os_default_charset(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PATCH: Always use UTF-8 instead of language-specific terminal charsets
|
||||||
|
#elif defined(__sortix__)
|
||||||
|
|
||||||
|
int os_default_charset(void)
|
||||||
|
{
|
||||||
|
return utf8_table;
|
||||||
|
}
|
||||||
|
|
||||||
#elif !defined(DOS)
|
#elif !defined(DOS)
|
||||||
|
|
||||||
int os_default_charset(void)
|
int os_default_charset(void)
|
||||||
|
|
16
select.c
16
select.c
|
@ -125,6 +125,22 @@ int can_read(int fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// PATCH: Handle connect not being restartable
|
||||||
|
int blocking_connect(int fd, struct sockaddr *addr, socklen_t addrlen)
|
||||||
|
{
|
||||||
|
int connect_error;
|
||||||
|
socklen_t len = sizeof(connect_error);
|
||||||
|
|
||||||
|
if (!connect(fd, addr, addrlen)) return 0;
|
||||||
|
if (errno != EINTR) return -1;
|
||||||
|
|
||||||
|
can_do_io(fd, 1, -1); // Wait until connected/failed
|
||||||
|
getsockopt(fd, SOL_SOCKET, SO_ERROR, &connect_error, &len);
|
||||||
|
errno = connect_error;
|
||||||
|
return !connect_error ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int close_std_handle(int std)
|
int close_std_handle(int std)
|
||||||
{
|
{
|
||||||
#ifndef DOS
|
#ifndef DOS
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
tix.version=1
|
||||||
|
tix.class=srctix
|
||||||
|
pkg.name=links
|
||||||
|
pkg.build-libraries=libssl libz libevent? xz?
|
||||||
|
pkg.build-system=configure
|
||||||
|
pkg.location-independent=true
|
Loading…
Reference in New Issue