mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 15:32:35 +00:00
Port to Openindiana
This commit is contained in:
parent
81c4892599
commit
f0c3b1f387
7 changed files with 99 additions and 11 deletions
3
CHANGES
3
CHANGES
|
@ -124,6 +124,9 @@ porting:
|
|||
including <linux/errqueue.h> and a weakness in the conditional code.
|
||||
Thanks to Michel Normand for reporting this issue.
|
||||
|
||||
Changes for Openindiana: define _XPG4_2, __EXTENSIONS__,
|
||||
_POSIX_PTHREAD_SEMANTICS; and minor changes
|
||||
|
||||
doc:
|
||||
In the man page the PTY example was badly formatted. Thanks to
|
||||
J.F.Sebastian for sending a patch.
|
||||
|
|
|
@ -344,6 +344,15 @@
|
|||
/* Define if your termios.h likes _SVID3 defined */
|
||||
#undef _SVID3
|
||||
|
||||
/* Define if your sys/socket.h likes _XPG4_2 defined */
|
||||
#undef _XPG4_2
|
||||
|
||||
/* Define if your ctime_r() choices need _POSIX_PTHREAD_SEMANTICS */
|
||||
#undef _POSIX_PTHREAD_SEMANTICS
|
||||
|
||||
/* Define if you need __EXTENSIONS__ */
|
||||
#undef __EXTENSIONS__
|
||||
|
||||
/* Define if you have struct timespec (e.g. for nanosleep) */
|
||||
#undef HAVE_STRUCT_TIMESPEC
|
||||
|
||||
|
|
64
configure.in
64
configure.in
|
@ -1026,6 +1026,69 @@ if test $ac_cv_svid3 = yes; then
|
|||
fi
|
||||
AC_MSG_RESULT($ac_cv_svid3)
|
||||
|
||||
|
||||
# Openindiana needs _XPG4_2 for CMSG stuff
|
||||
AC_MSG_CHECKING(if _XPG4_2 is helpful)
|
||||
AC_CACHE_VAL(ac_cv_xpg4_2,
|
||||
[AC_TRY_LINK([#include <sys/socket.h>],
|
||||
[int i=CMSG_DATA(0)],
|
||||
[ac_cv_xpg4_2=no],
|
||||
[AC_TRY_LINK([#define _XPG4_2 1
|
||||
#include <sys/socket.h>],
|
||||
[int i=CMSG_DATA(0)],
|
||||
[ac_cv_xpg4_2=yes],
|
||||
[ac_cv_xpg4_2=no]
|
||||
)]
|
||||
)])
|
||||
if test $ac_cv_xpg4_2 = yes; then
|
||||
AC_DEFINE(_XPG4_2)
|
||||
fi
|
||||
AC_MSG_RESULT($ac_cv_xpg4_2)
|
||||
|
||||
# When on Openindiana _XPG4_2 is defined (see above)
|
||||
# we also need to define __EXTENSIONS__ for basic stuff.
|
||||
# Note that <sys/procset.h> is important on Openindiana
|
||||
# but does not exist on Linux
|
||||
if test "$ac_cv_xpg4_2" = yes; then
|
||||
AC_MSG_CHECKING(if __EXTENSIONS__ is helpful)
|
||||
AC_CACHE_VAL(ac_cv___extensions__,
|
||||
[AC_TRY_COMPILE([#include <sys/procset.h>],
|
||||
[procset_t *s=0;],
|
||||
[ac_cv___extensions__=no],
|
||||
[AC_TRY_COMPILE([#define __EXTENSIONS__ 1
|
||||
#include <sys/procset.h>],
|
||||
[procset_t *s=0;],
|
||||
[ac_cv___extensions__=yes],
|
||||
[ac_cv___extensions__=no]
|
||||
)]
|
||||
)])
|
||||
if test $ac_cv___extensions__ = yes; then
|
||||
AC_DEFINE(__EXTENSIONS__)
|
||||
fi
|
||||
AC_MSG_RESULT($ac_cv___extensions__)
|
||||
fi
|
||||
|
||||
# When on Openindiana __EXTENSIONS__ is defined (see above)
|
||||
# _POSIX_PTHREAD_SEMANTICS must be defined for standard ctime_r()
|
||||
if test "$ac_cv___extensions__" = yes; then
|
||||
AC_MSG_CHECKING(if _POSIX_PTHREAD_SEMANTICS is helpful)
|
||||
AC_CACHE_VAL(ac_cv__posix_pthread_semantics,
|
||||
[AC_TRY_COMPILE([#include <time.h>],
|
||||
[char *s = ctime_r(0,0);],
|
||||
[ac_cv__posix_pthread_semantics=no],
|
||||
[AC_TRY_COMPILE([#define _POSIX_PTHREAD_SEMANTICS 1
|
||||
#include <time.h>],
|
||||
[char *s = ctime_r(0,0);],
|
||||
[ac_cv__posix_pthread_semantics=yes],
|
||||
[ac_cv__posix_pthread_semantics=no]
|
||||
)]
|
||||
)])
|
||||
if test $ac_cv__posix_pthread_semantics = yes; then
|
||||
AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
|
||||
fi
|
||||
AC_MSG_RESULT($ac_cv__posix_pthread_semantics)
|
||||
fi
|
||||
|
||||
|
||||
# struct timespec
|
||||
AC_MSG_CHECKING(for struct timespec)
|
||||
|
@ -1929,4 +1992,5 @@ else
|
|||
AC_DEFINE(BUILD_DATE, [__DATE__" "__TIME__])
|
||||
fi
|
||||
|
||||
cp -p confdefs.h save-confdefs.h
|
||||
AC_OUTPUT(Makefile)
|
||||
|
|
12
error.c
12
error.c
|
@ -250,7 +250,11 @@ void msg(int level, const char *format, ...) {
|
|||
diag_dgram.exitcode = diagopts.exitstatus;
|
||||
vsnprintf_r(diag_dgram.text, sizeof(diag_dgram.text), format, ap);
|
||||
if (diag_in_handler && !diag_immediate_msg) {
|
||||
send(diag_sock_send, &diag_dgram, sizeof(diag_dgram)-TEXTLEN + strlen(diag_dgram.text)+1, MSG_DONTWAIT|MSG_NOSIGNAL);
|
||||
send(diag_sock_send, &diag_dgram, sizeof(diag_dgram)-TEXTLEN + strlen(diag_dgram.text)+1, MSG_DONTWAIT
|
||||
#ifdef MSG_NOSIGNAL
|
||||
|MSG_NOSIGNAL
|
||||
#endif
|
||||
);
|
||||
diag_msg_avail = 1;
|
||||
va_end(ap);
|
||||
return;
|
||||
|
@ -411,7 +415,11 @@ void diag_exit(int status) {
|
|||
if (diag_in_handler && !diag_immediate_exit) {
|
||||
diag_dgram.op = DIAG_OP_EXIT;
|
||||
diag_dgram.exitcode = status;
|
||||
send(diag_sock_send, &diag_dgram, sizeof(diag_dgram)-TEXTLEN, MSG_DONTWAIT|MSG_NOSIGNAL);
|
||||
send(diag_sock_send, &diag_dgram, sizeof(diag_dgram)-TEXTLEN, MSG_DONTWAIT
|
||||
#ifdef MSG_NOSIGNAL
|
||||
|MSG_NOSIGNAL
|
||||
#endif
|
||||
);
|
||||
return;
|
||||
}
|
||||
_diag_exit(status);
|
||||
|
|
16
test.sh
16
test.sh
|
@ -3768,7 +3768,9 @@ da="test$N $(date) $RANDOM"
|
|||
CMD="$TRACE $SOCAT -u $opts - open:$ff,append,o-trunc"
|
||||
printf "test $F_n $TEST... " $N
|
||||
rm -f $ff; $ECHO "prefix-\c" >$ff
|
||||
if ! echo "$da" |$CMD >$tf 2>"$te" ||
|
||||
echo "$da" |$CMD >$tf 2>"$te"
|
||||
rc0=$?
|
||||
if ! [ $rc0 = 0 ] ||
|
||||
! echo "$da" |diff - $ff >"$tdiff"; then
|
||||
$PRINTF "$FAILED: $TRACE $SOCAT:\n"
|
||||
echo "$CMD"
|
||||
|
@ -9805,21 +9807,21 @@ if [ "$rc1" -ne 0 ]; then
|
|||
numCANT=$((numCANT+1))
|
||||
elif ! grep "ancillary message: $SCM_TYPE: $SCM_NAME=" ${te}0 >/dev/null; then
|
||||
$PRINTF "$FAILED\n"
|
||||
echo "variable $SCM_TYPE: $SCM_NAME not set"
|
||||
echo "$CMD0 &"
|
||||
echo "$CMD1"
|
||||
grep " $LEVELS " "${te}0"
|
||||
grep " $LEVELS " "${te}1"
|
||||
echo "variable $SCM_TYPE: $SCM_NAME not set"
|
||||
numFAIL=$((numFAIL+1))
|
||||
listFAIL="$listFAIL $N"
|
||||
elif ! grep "ancillary message: $SCM_TYPE: $SCM_NAME=$SCM_VALUE" ${te}0 >/dev/null; then
|
||||
$PRINTF "$FAILED\n"
|
||||
badval="$(grep "ancillary message: $SCM_TYPE: $SCM_NAME" ${te}0 |sed 's/.*=//g')"
|
||||
echo "variable $SCM_TYPE: $SCM_NAME has value \"$badval\" instead of pattern \"$SCM_VALUE\"" >&2
|
||||
echo "$CMD0 &"
|
||||
echo "$CMD1"
|
||||
grep " $LEVELS " "${te}0"
|
||||
grep " $LEVELS " "${te}1"
|
||||
badval="$(grep "ancillary message: $SCM_TYPE: $SCM_NAME" ${te}0 |sed 's/.*=//g')"
|
||||
echo "variable $SCM_TYPE: $SCM_NAME has value \"$badval\" instead of pattern \"$SCM_VALUE\""
|
||||
numFAIL=$((numFAIL+1))
|
||||
listFAIL="$listFAIL $N"
|
||||
else
|
||||
|
@ -12085,16 +12087,16 @@ sleep 1
|
|||
kill $pid0 2>/dev/null; wait
|
||||
if [ ! -f "$t0rc" ]; then
|
||||
$PRINTF "$FAILED\n"
|
||||
echo "no return code of CMD0 stored" >&2
|
||||
echo "$CMD0 &"
|
||||
cat "${te}0"
|
||||
echo "did not terminate with error"
|
||||
numFAIL=$((numFAIL+1))
|
||||
listFAIL="$listFAIL $N"
|
||||
elif ! echo 1 |diff - "$t0rc"; then
|
||||
elif ! echo 1 |diff - "$t0rc" >"$tdiff"; then
|
||||
$PRINTF "$FAILED\n"
|
||||
echo "CMD0 exited with $(cat $t0rc), expected 1"
|
||||
echo "$CMD0 &"
|
||||
cat "${te}0"
|
||||
echo "expected return code 1"
|
||||
numFAIL=$((numFAIL+1))
|
||||
listFAIL="$listFAIL $N"
|
||||
else
|
||||
|
|
|
@ -328,7 +328,9 @@ int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, sockl
|
|||
while (maxchildren) {
|
||||
if (num_child < maxchildren) break;
|
||||
Notice("maxchildren are active, waiting");
|
||||
while (!Sleep(UINT_MAX)) ; /* any signal lets us continue */
|
||||
/* UINT_MAX would even be nicer, but Openindiana works only
|
||||
with 31 bits */
|
||||
while (!Sleep(INT_MAX)) ; /* any signal lets us continue */
|
||||
}
|
||||
Info("still listening");
|
||||
} else {
|
||||
|
|
2
xio.h
2
xio.h
|
@ -205,8 +205,8 @@ typedef struct single {
|
|||
struct {
|
||||
bool tight;
|
||||
} un;
|
||||
} socket;
|
||||
#endif /* WITH_UNIX */
|
||||
} socket;
|
||||
#endif /* _WITH_SOCKET */
|
||||
struct {
|
||||
pid_t pid; /* child PID, with EXEC: */
|
||||
|
|
Loading…
Reference in a new issue