mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 23:42:34 +00:00
Port to Openindiana
This commit is contained in:
parent
1720c9aa10
commit
a0ded9f095
6 changed files with 95 additions and 8 deletions
3
CHANGES
3
CHANGES
|
@ -338,6 +338,9 @@ porting:
|
|||
|
||||
Use 'environ' variable only when provided by runtime
|
||||
|
||||
Changes for Openindiana: define _XPG4_2, __EXTENSIONS__,
|
||||
_POSIX_PTHREAD_SEMANTICS; and minor changes
|
||||
|
||||
new features:
|
||||
added option max-children that limits the number of concurrent child
|
||||
processes. Thanks to Sam Liddicott for providing the 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
|
||||
|
||||
|
|
63
configure.in
63
configure.in
|
@ -1043,6 +1043,69 @@ 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)
|
||||
AC_CACHE_VAL(sc_cv_struct_timespec,
|
||||
|
|
12
error.c
12
error.c
|
@ -247,7 +247,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) {
|
||||
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;
|
||||
|
@ -409,7 +413,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);
|
||||
|
|
10
test.sh
10
test.sh
|
@ -3760,7 +3760,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"
|
||||
|
@ -9965,21 +9967,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 \"$SCM_VALUE\""
|
||||
numFAIL=$((numFAIL+1))
|
||||
listFAIL="$listFAIL $N"
|
||||
else
|
||||
|
|
|
@ -336,7 +336,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 {
|
||||
|
|
Loading…
Reference in a new issue