diff options
author | Jeremy Huddleston Sequoia <jeremyhu@apple.com> | 2022-12-11 15:27:41 -0800 |
---|---|---|
committer | Jeremy Huddleston Sequoia <jeremyhu@apple.com> | 2022-12-11 16:07:39 -0800 |
commit | 809774d4327a15605c7b353814fb50aec578a66e (patch) | |
tree | a4d1e899553d7346ee5d8f18fac77af7ddafef54 | |
parent | 19e90648da96078d7e36434f6003ca24fdbb29bd (diff) |
Remove some hacks that supported systems that existed before some of the engineers on my team were born
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-rw-r--r-- | src/tet3/dtet2lib/Makefile.am | 1 | ||||
-rw-r--r-- | src/tet3/dtet2lib/meson.build | 1 | ||||
-rw-r--r-- | src/tet3/dtet2lib/notty.c | 108 | ||||
-rw-r--r-- | src/tet3/inc/dtetlib.h | 1 | ||||
-rw-r--r-- | src/tet3/syncd/syncd.c | 2 | ||||
-rw-r--r-- | src/tet3/tccd/tccd.c | 2 | ||||
-rw-r--r-- | src/tet3/xresd/xresd.c | 2 |
7 files changed, 3 insertions, 114 deletions
diff --git a/src/tet3/dtet2lib/Makefile.am b/src/tet3/dtet2lib/Makefile.am index 6372b60c..8975ae57 100644 --- a/src/tet3/dtet2lib/Makefile.am +++ b/src/tet3/dtet2lib/Makefile.am @@ -39,7 +39,6 @@ libdtet2_la_SOURCES = \ mapsig.c \ mapstat.c \ mkdir.c \ - notty.c \ optarg.c \ prerror.c \ ptflags.c \ diff --git a/src/tet3/dtet2lib/meson.build b/src/tet3/dtet2lib/meson.build index 781dc0cb..473bd8da 100644 --- a/src/tet3/dtet2lib/meson.build +++ b/src/tet3/dtet2lib/meson.build @@ -58,7 +58,6 @@ files_libdtet2 = files( 'mapsig.c', 'mapstat.c', 'mkdir.c', - 'notty.c', 'optarg.c', 'prerror.c', 'ptflags.c', diff --git a/src/tet3/dtet2lib/notty.c b/src/tet3/dtet2lib/notty.c deleted file mode 100644 index 840c8fb4..00000000 --- a/src/tet3/dtet2lib/notty.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * SCCS: @(#)notty.c 1.9 (97/07/21) - * - * UniSoft Ltd., London, England - * - * (C) Copyright 1992 X/Open Company Limited - * - * All rights reserved. No part of this source code may be reproduced, - * stored in a retrieval system, or transmitted, in any form or by any - * means, electronic, mechanical, photocopying, recording or otherwise, - * except as stated in the end-user licence agreement, without the prior - * permission of the copyright owners. - * - * X/Open and the 'X' symbol are trademarks of X/Open Company Limited in - * the UK and other countries. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -/************************************************************************ - -SCCS: @(#)notty.c 1.9 97/07/21 TETware release 3.3 -NAME: notty.c -PRODUCT: TETware -AUTHOR: Andrew Dingwall, UniSoft Ltd. -DATE CREATED: April 1992 - -DESCRIPTION: - function to dissociate from control terminal and start a new process - group - -MODIFICATIONS: - Andrew Dingwall, UniSoft Ltd., January 1994 - added setsid() call to support POSIX-only systems - (mainly for the FIFO implementation) - - Aaron Plattner, April 2010 - Fixed warnings when compiled with GCC's -Wall option. - -************************************************************************/ - -#include <stdio.h> - -# ifdef _POSIX_SOURCE -# define HAS_SETSID -# endif /* _POSIX_SOURCE */ -# ifdef HAS_SETSID -# include <unistd.h> -# include <errno.h> -# else /* HAS_SETSID */ -# include <sys/ioctl.h> -# ifdef TIOCNOTTY -# include <fcntl.h> -# endif /* TIOCNOTTY */ -# endif /* HAS_SETSID */ - -#include "dtmac.h" -#include "error.h" -#include "dtetlib.h" - -/* -** tet_tiocnotty() - dissociate from control terminal -** and start a new process group -*/ - -void tet_tiocnotty() -{ - - -# ifdef HAS_SETSID - - /* easy - use setsid() to start a new session */ - setsid(); - -# else /* HAS_SETSID */ - - /* harder - must use setpgrp() and possibly TIOCNOTTY */ - -# ifdef TIOCNOTTY - int ttyfd; -# endif - -# if defined(SVR2) || defined(SVR3) || defined(SVR4) || defined(__hpux) || defined(_AIX) - setpgrp(); -# else - int pid = getpid(); - setpgrp(pid, pid); -# endif - - -# ifdef TIOCNOTTY - /* - ** this for BSD systems where setpgrp() does not change the - ** control terminal - */ - if ((ttyfd = open("/dev/tty", O_RDONLY | O_NDELAY)) >= 0) { - ioctl(ttyfd, TIOCNOTTY, 0); - close(ttyfd); - } -# endif /* TIOCNOTTY */ - -# endif /* HAS_SETSID */ - - -} - diff --git a/src/tet3/inc/dtetlib.h b/src/tet3/inc/dtetlib.h index c9876451..3294049f 100644 --- a/src/tet3/inc/dtetlib.h +++ b/src/tet3/inc/dtetlib.h @@ -104,7 +104,6 @@ extern char *tet_remvar PROTOLIST((char *, int)); extern int tet_remvar_sysid PROTOLIST((char *)); extern int tet_rmdir PROTOLIST((char *)); TET_IMPORT_FUNC(char *, tet_strstore, PROTOLIST((char *))); -extern void tet_tiocnotty PROTOLIST((void)); extern int tet_unmaperrno PROTOLIST((int)); extern int tet_unmapsignal PROTOLIST((int)); diff --git a/src/tet3/syncd/syncd.c b/src/tet3/syncd/syncd.c index 8411f118..9edf6dc5 100644 --- a/src/tet3/syncd/syncd.c +++ b/src/tet3/syncd/syncd.c @@ -126,7 +126,7 @@ void tet_ss_initdaemon() tet_si_forkdaemon(); /* detach from the control terminal */ - tet_tiocnotty(); + setsid(); } /* diff --git a/src/tet3/tccd/tccd.c b/src/tet3/tccd/tccd.c index df1d5ba4..5bd0eb01 100644 --- a/src/tet3/tccd/tccd.c +++ b/src/tet3/tccd/tccd.c @@ -311,7 +311,7 @@ void tet_ss_initdaemon() #endif /* detach from the control terminal (if any) */ - tet_tiocnotty(); + setsid(); /* make a log file entry */ ts_logstart(); diff --git a/src/tet3/xresd/xresd.c b/src/tet3/xresd/xresd.c index 0e74c143..ae1c6644 100644 --- a/src/tet3/xresd/xresd.c +++ b/src/tet3/xresd/xresd.c @@ -148,7 +148,7 @@ void tet_ss_initdaemon() tet_si_forkdaemon(); /* detach from the control terminal */ - tet_tiocnotty(); + setsid(); } /* |