+Fri Aug 5 18:47:00 1994 Mark Eichin (eichin@cygnus.com)
+
+ * configure.in: test for sigprocmask and sigset_t to set POSIX_SIGNALS.
+ * krlogin.c, kcmd.c: use POSIX_SIGNALS.
+
Fri Aug 5 15:35:54 1994 Mark Eichin (eichin@cygnus.com)
* configure.in, logutil.c: check for NO_UT_PID, use it.
AC_FUNC_CHECK(getdtablesize,AC_DEFINE(HAVE_GETDTABLESIZE))
AC_FUNC_CHECK(initgroups,AC_DEFINE(HAVE_INITGROUPS))
AC_FUNC_CHECK(setpriority,AC_DEFINE(HAVE_SETPRIORITY))
+AC_FUNC_CHECK(sigprocmask,
+AC_COMPILE_CHECK([sigset_t],
+[#include <signal.h>],
+[sigset_t x],
+AC_DEFINE(POSIX_SIGNALS)))
AC_HAVE_HEADERS(sys/filio.h sys/sockio.h unistd.h sys/label.h ttyent.h sys/ptyvar.h lastlog.h)
AC_REPLACE_FUNCS(getdtablesize)
CHECK_DIRENT
#endif
#include <sys/file.h>
#include <sys/signal.h>
+#ifndef POSIX_SIGNALS
#ifndef sigmask
#define sigmask(m) (1 << ((m)-1))
#endif
+#endif /* POSIX_SIGNALS */
#include <sys/socket.h>
#include <sys/stat.h>
krb5_flags authopts;
{
int i, s, timo = 1, pid;
+#ifdef POSIX_SIGNALS
+ sigset_t oldmask, urgmask;
+#else
long oldmask;
+#endif
struct sockaddr_in sin, from, local_laddr;
krb5_creds *ret_cred = 0;
char c;
/* XXX we should free the old realm first */
krb5_princ_set_realm(ret_cred->server, &rdata);
}
+#ifdef POSIX_SIGNALS
+ sigemptyset(&urgmask);
+ sigaddset(&urgmask, SIGURG);
+ sigprocmask(SIG_BLOCK, &urgmask, &oldmask);
+#else
#ifdef sgi
oldmask = sigignore(sigmask(SIGURG));
#else
oldmask = sigblock(sigmask(SIGURG));
#endif
+#endif /* POSIX_SIGNALS */
for (;;) {
s = getport(&lport);
fprintf(stderr, "socket: All ports in use\n");
else
perror("kcmd: socket");
+#ifdef POSIX_SIGNALS
+ sigprocmask(SIG_SETMASK, &oldmask, (sigset_t*)0);
+#else
#ifndef sgi
sigsetmask(oldmask);
#endif
+#endif /* POSIX_SIGNALS */
if (tmpstr) krb5_xfree(tmpstr);
if (host_save) krb5_xfree(host_save);
krb5_free_creds(ret_cred);
}
#endif /* !(defined(ultrix) || defined(sun)) */
perror(hp->h_name);
+#ifdef POSIX_SIGNALS
+ sigprocmask(SIG_SETMASK, &oldmask, (sigset_t*)0);
+#else
#ifndef sgi
sigsetmask(oldmask);
#endif
+#endif /* POSIX_SIGNALS */
if (tmpstr) krb5_xfree(tmpstr);
if (host_save) krb5_xfree(host_save);
krb5_free_creds(ret_cred);
status = -1;
goto bad3;
}
+#ifdef POSIX_SIGNALS
+ sigprocmask(SIG_SETMASK, &oldmask, (sigset_t*)0);
+#else
#ifndef sgi
sigsetmask(oldmask);
#endif
+#endif /* POSIX_SIGNALS */
*sock = s;
if (tmpstr) krb5_xfree(tmpstr);
if (host_save) krb5_xfree(host_save);
(void) close(*fd2p);
bad:
(void) close(s);
+#ifdef POSIX_SIGNALS
+ sigprocmask(SIG_SETMASK, &oldmask, (sigset_t*)0);
+#else
#ifndef sgi
sigsetmask(oldmask);
#endif
+#endif /* POSIX_SIGNALS */
if (tmpstr) krb5_xfree(tmpstr);
if (host_save) krb5_xfree(host_save);
if (ret_cred)
extern int errno;
krb5_sigtype lostpeer();
int dosigwinch = 0;
+#ifndef POSIX_SIGNALS
#ifndef sigmask
-#define sigmask(m) (1 << ((m)-1))
+#define sigmask(m) (1 << ((m)-1))
#endif
+#endif /* POSIX_SIGNALS */
#ifdef NO_WINSIZE
struct winsize {
unsigned short ws_row, ws_col;
#endif
struct passwd *pwd;
struct servent *sp;
- int uid, options = 0, oldmask;
+ int uid, options = 0;
+#ifdef POSIX_SIGNALS
+ sigset_t *oldmask, omask, urgmask;
+#else
+ int oldmask;
+#endif
int on = 1;
#ifdef KERBEROS
char **orig_argv = argv;
(void) signal(SIGPIPE, lostpeer);
/* will use SIGUSR1 for window size hack, so hold it off */
+#ifdef POSIX_SIGNALS
+ sigemptyset(&urgmask);
+ sigaddset(&urgmask, SIGURG);
+ sigaddset(&urgmask, SIGUSR1);
+ oldmask = &omask;
+ sigprocmask(SIG_BLOCK, &urgmask, oldmask);
+#else
#ifdef sgi
oldmask = sigignore(sigmask(SIGURG) | sigmask(SIGUSR1));
#else
oldmask = sigblock(sigmask(SIGURG) | sigmask(SIGUSR1));
#endif
+#endif /* POSIX_SIGNALS */
if (debug_port)
sp->s_port = htons(debug_port);
#endif
doit(oldmask)
+#ifdef POSIX_SIGNALS
+ sigset_t *oldmask;
+#endif
{
#ifdef POSIX_TERMIOS
(void) tcgetattr(0, &deftty);
*/
(void) signal(SIGURG, copytochild);
(void) signal(SIGUSR1, writeroob);
+
+#ifdef POSIX_SIGNALS
+ sigprocmask(SIG_SETMASK, oldmask, (sigset_t*)0);
+#else
#ifndef sgi
(void) sigsetmask(oldmask);
#endif
+#endif /* POSIX_SIGNALS */
(void) signal(SIGCHLD, catchild);
writer();
prf("Closed connection.");
* reader: read from remote: line -> 1
*/
reader(oldmask)
+#ifdef POSIX_SIGNALS
+ sigset_t *oldmask;
+#else
int oldmask;
+#endif
{
-#if (defined(BSD) && BSD >= 43) || defined(ultrix)
+#if (defined(BSD) && BSD+0 >= 43) || defined(ultrix)
int pid = getpid();
#else
int pid = -getpid();
(void) fcntl(rem, F_SETOWN, pid);
#endif
(void) setjmp(rcvtop);
+#ifdef POSIX_SIGNALS
+ sigprocmask(SIG_SETMASK, oldmask, (sigset_t*)0);
+#else
#ifndef sgi
(void) sigsetmask(oldmask);
#endif
+#endif /* POSIX_SIGNALS */
for (;;) {
while ((remaining = rcvcnt - (bufp - rcvbuf)) > 0) {
rcvstate = WRITING;