Hello,
this patch fixes two bugs on NetBSD:
- dtfile couldn't be closed, the process hung, a new one
couldn't be started.
- dtterm couldn't find a non-blocking pty.
Both problems were already solved on OpenBSD. I've just
adopted the OpenBSD solution to both, NetBSD and FreeBSD.
The usage of openpty() to find the next pseudo pty might
also be interesting for linux. I think it's much better
than to fiddle with text patterns.
--
Ulrich Wilkens
Email: m...@uwilkens.de
>From a6306a7d6a49d524037a55cdd7d5aa752d019caa Mon Sep 17 00:00:00 2001
From: Ulrich Wilkens <m...@uwilkens.de>
Date: Tue, 11 Mar 2014 19:24:35 +0100
Subject: [PATCH] Fix dtfile and dtterm on NetBSD
---
cde/lib/DtTerm/TermPrim/TermPrimGetPty-bsd.c | 10 ++++++++--
cde/programs/dtappbuilder/src/ab/Imakefile | 10 ++++++++--
cde/programs/dtappbuilder/src/abmf/Imakefile | 8 ++++++--
cde/programs/dtfile/Main.c | 10 +++++-----
cde/programs/dtterm/Imakefile | 8 ++++++--
cde/programs/ttsnoop/Imakefile | 8 ++++++--
6 files changed, 39 insertions(+), 15 deletions(-)
diff --git a/cde/lib/DtTerm/TermPrim/TermPrimGetPty-bsd.c
b/cde/lib/DtTerm/TermPrim/TermPrimGetPty-bsd.c
index 2fc1984..a512e23 100644
--- a/cde/lib/DtTerm/TermPrim/TermPrimGetPty-bsd.c
+++ b/cde/lib/DtTerm/TermPrim/TermPrimGetPty-bsd.c
@@ -35,10 +35,16 @@ static char rcs_id[] = "$XConsortium: TermPrimGetPty-bsd.c
/main/4 1996/11/21 19
#include <fcntl.h>
#include <termios.h>
-#if defined(OPENBSD_ARCHITECTURE)
+#if defined(CSRG_BASED)
#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#if defined(__FreeBSD__)
+#include <libutil.h>
+#else
#include <util.h>
#endif
+#endif
#include <sys/wait.h>
#include <ctype.h>
#include <errno.h>
@@ -172,7 +178,7 @@ static struct _pty_dirs {
{PTY_null, PTY_null, PTY_null, PTY_null, PTY_null, False},
};
-#if defined(ALPHA_ARCHITECTURE) || defined(OPENBSD_ARCHITECTURE)
+#if defined(ALPHA_ARCHITECTURE) || defined(CSRG_BASED)
/* Use openpty() to open Master/Slave pseudo-terminal pair */
/* Current version of openpty() uses non-STREAM device. BSD name space */
#define TTYNAMELEN 25
diff --git a/cde/programs/dtappbuilder/src/ab/Imakefile
b/cde/programs/dtappbuilder/src/ab/Imakefile
index 1339d87..6424880 100644
--- a/cde/programs/dtappbuilder/src/ab/Imakefile
+++ b/cde/programs/dtappbuilder/src/ab/Imakefile
@@ -249,6 +249,10 @@ SYS_LIBRARIES = -lm $(ICONVSYSLIB) $(DYNLIBSYSLIB)
$(REGEXSYSLIB)
WAITTARGET = .WAIT
#endif /* SunArchitecture */
+#ifdef BSDArchitecture
+UTILLIB = -lutil
+#endif /* BSDArchitecture */
+
PROGRAMS = dtbuilder
LINTLIBS = $(XINPUTLIB) $(DTHELPLIB) $(DTSVCLIB) $(XMLIB) $(XTOOLLIB) $(XLIB)
@@ -264,11 +268,13 @@ LINTLIBS = $(XINPUTLIB) $(DTHELPLIB) $(DTSVCLIB) $(XMLIB)
$(XTOOLLIB) $(XLIB)
DEPLIBS = ../libABil/libABil.a ../libABobjXm/libABobjXm.a \
../libABobj/libABobj.a ../libAButil/libAButil.a $(DEPDTWIDGETLIB) \
$(DEPDTTERMLIB) $(DEPDTHELPLIB) $(DEPDTSVCLIB) $(DEPTTLIB) \
- $(DEPUILLIB) $(DEPMRESOURCELIB) $(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB)
+ $(DEPUILLIB) $(DEPMRESOURCELIB) $(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB) \
+ $(DEPUTILLIB)
LOCAL_LIBRARIES = ../libABil/libABil.a ../libABobjXm/libABobjXm.a \
../libABobj/libABobj.a ../libAButil/libAButil.a \
$(DTWIDGETLIB) $(DTTERMLIB) $(DTHELPLIB) $(DTSVCLIB) \
- $(TTLIB) $(UILLIB) $(MRESOURCELIB) $(XMLIB) $(XTOOLLIB) $(XLIB)
+ $(TTLIB) $(UILLIB) $(MRESOURCELIB) $(XMLIB) $(XTOOLLIB) $(XLIB) \
+ $(UTILLIB)
$(OBJS): $(SOURCES.h)
diff --git a/cde/programs/dtappbuilder/src/abmf/Imakefile
b/cde/programs/dtappbuilder/src/abmf/Imakefile
index abb7571..b8f6883 100644
--- a/cde/programs/dtappbuilder/src/abmf/Imakefile
+++ b/cde/programs/dtappbuilder/src/abmf/Imakefile
@@ -109,6 +109,10 @@ CCOPTIONS = -qnoro
WAITTARGET = .WAIT
#endif /* SunArchitecture */
+#ifdef BSDArchitecture
+UTILLIB = -lutil
+#endif /* BSDArchitecture */
+
PROGRAMS = dtcodegen
LINTLIBS = $(XINPUTLIB) $(DTHELPLIB) $(DTSVCLIB) $(XMLIB) $(XTOOLLIB) $(XLIB)
@@ -125,11 +129,11 @@ DEPLIBS = ../libABil/libABil.a
../libABobjXm/libABobjXm.a \
../libABobj/libABobj.a ../libAButil/libAButil.a \
$(DEPDTTERMLIB) $(DEPDTHELPLIB) $(DEPDTWIDGETLIB) \
$(DEPDTSVCLIB) $(DEPTTLIB) $(DEPXMLIB) \
- $(DEPXTOOLLIB) $(DEPXLIB)
+ $(DEPXTOOLLIB) $(DEPXLIB) $(DEPUTILLIB)
LOCAL_LIBRARIES = ../libABil/libABil.a ../libABobjXm/libABobjXm.a \
../libABobj/libABobj.a ../libAButil/libAButil.a \
$(DTTERMLIB) $(DTHELPLIB) $(DTWIDGETLIB) \
- $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTOOLLIB) $(XLIB)
+ $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTOOLLIB) $(XLIB) $(UTILLIB)
ComplexProgramTarget(dtcodegen)
diff --git a/cde/programs/dtfile/Main.c b/cde/programs/dtfile/Main.c
index be996ba..c41ee3e 100644
--- a/cde/programs/dtfile/Main.c
+++ b/cde/programs/dtfile/Main.c
@@ -116,7 +116,7 @@
#include <sys/stat.h>
#include <signal.h>
-#if defined(__osf__) || defined(__OpenBSD__)
+#if defined(__osf__) || defined(CSRG_BASED)
#include <sys/wait.h>
#endif /* __osf__ */
@@ -975,7 +975,7 @@ XtActionsRec actionTable[] = {
extern XtInputId ProcessToolTalkInputId;
-#if defined(__osf__) || defined(__OpenBSD__)
+#if defined(__osf__) || defined(CSRG_BASED)
extern void sigchld_handler(int);
#endif /* __osf__ */
@@ -1019,7 +1019,7 @@ main(
Tt_pattern requests2Handle;
Tt_message msg;
Tt_status status;
-#if defined(__osf__) || defined(__OpenBSD__)
+#if defined(__osf__) || defined(CSRG_BASED)
struct sigaction sa, osa;
#endif /* __osf__ */
int session_flag = 0;
@@ -1031,7 +1031,7 @@ main(
(void) signal (SIGINT, (void (*)())Stop);
/* We don't want any zombie children, do we? */
-#if defined(__osf__) || defined(__OpenBSD__)
+#if defined(__osf__) || defined(CSRG_BASED)
sa.sa_handler = sigchld_handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
@@ -6292,7 +6292,7 @@ FinalizeToolTalkSession();
exit (1);
}
-#if defined(__osf__) || defined(__OpenBSD__)
+#if defined(__osf__) || defined(CSRG_BASED)
extern void
sigchld_handler(int signo) /* Do not use the arg signo at the moment */
{
diff --git a/cde/programs/dtterm/Imakefile b/cde/programs/dtterm/Imakefile
index 0b168a2..de00d2e 100644
--- a/cde/programs/dtterm/Imakefile
+++ b/cde/programs/dtterm/Imakefile
@@ -29,6 +29,10 @@ DEPHELPLIB = $(DEPDTHELPLIB) $(DEPDTSVCLIB) $(DEPTTLIB)
USE_XHPLIB = $(XHPLIB)
#endif /* HPArchitecture */
+#ifdef BSDArchitecture
+UTILLIB = -lutil
+#endif /* BSDArchitecture */
+
/* DEPLIBS contains the list of library depencies for a client.
* LOCAL_LIBRARIES contains the list of libraries on the link line.
* Generally, the dependency form of a library has DEP as a prefix.
@@ -39,9 +43,9 @@ USE_XHPLIB = $(XHPLIB)
* paths to the library.
*/
DEPLIBS = $(DEPDTTERMLIB) $(DEPARCHLIBS) $(DEPXINPUTLIB) $(DEPHELPLIB) \
- $(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXPLIB) $(DEPXLIB)
+ $(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXPLIB) $(DEPXLIB) $(DEPUTILLIB)
LOCAL_LIBRARIES = $(DTTERMLIB) $(USE_XHPLIB) $(XINPUTLIB) $(HELPLIB) \
- $(XMLIB) $(XTOOLLIB) $(XPLIB) $(XLIB)
+ $(XMLIB) $(XTOOLLIB) $(XPLIB) $(XLIB) $(UTILLIB)
SYS_LIBRARIES = DtClientSysLibs
INCLUDES = -I. -I$(DTTERMSRC)/TermPrim -I$(DTTERMSRC)/Term
-I$(DTTERMSRC)/TermView
diff --git a/cde/programs/ttsnoop/Imakefile b/cde/programs/ttsnoop/Imakefile
index ed23d0f..9d23914 100644
--- a/cde/programs/ttsnoop/Imakefile
+++ b/cde/programs/ttsnoop/Imakefile
@@ -1,11 +1,15 @@
XCOMM $XConsortium: Imakefile /main/18 1996/05/08 09:29:12 drk $
+#ifdef BSDArchitecture
+UTILLIB = -lutil
+#endif /* BSDArchitecture */
+
#define CplusplusSource YES
DEPEND_DEFINES = $(CXXDEPENDINCLUDES)
EXTRA_LOAD_FLAGS = ExtraLoadFlags $(UNSHARED_CXXLIB)
-DEPLIBS = $(DEPDTTERMLIB) DepDtClientLibs
-LOCAL_LIBRARIES = $(DTTERMLIB) DtClientLibs
+DEPLIBS = $(DEPDTTERMLIB) DepDtClientLibs $(DEPUTILLIB)
+LOCAL_LIBRARIES = $(DTTERMLIB) DtClientLibs $(UTILLIB)
SYS_LIBRARIES = DtClientSysLibs DtClientExtraLibs
--
1.7.11.5
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel