Subject: patch for SGE: using tty over qrsh
To: None <pkgsrc-users@NetBSD.org>
From: Emmanuel Dreyfus <manu@netbsd.org>
List: pkgsrc-users
Date: 05/03/2007 14:51:09
--FCuugMFkClbJLl1L
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi
with pkgsrc/parallel/sge's qrsh, it seems impossible to launch a job
that uses a terminal. The attached patch seems to fix that problem at mine.
Any comment? Should it be committed in pkgsrc? Should it be propagated
upstream?
--
Emmanuel Dreyfus
manu@netbsd.org
--FCuugMFkClbJLl1L
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="sge.patch"
--- source/clients/qrsh/qrsh_starter.c.orig 2005-08-03 18:17:33.000000000 +0200
+++ source/clients/qrsh/qrsh_starter.c 2007-05-03 16:08:27.000000000 +0200
@@ -30,9 +30,9 @@
************************************************************************/
/*___INFO__MARK_END__*/
#include <stdio.h>
#include <stdarg.h>
-#if defined(LINUX)
+#if defined(LINUX) || defined(__NetBSD__)
#include <termios.h>
#endif
#include <sys/types.h>
@@ -607,20 +607,23 @@
if(child_pid) {
/* parent */
int status;
-#if defined(LINUX)
+#if defined(LINUX) || defined(__NetBSD__)
int ttyfd;
#endif
signal(SIGINT, forward_signal);
signal(SIGQUIT, forward_signal);
signal(SIGTERM, forward_signal);
/* preserve pseudo terminal */
-#if defined(LINUX)
+#if defined(LINUX) || defined(__NetBSD__)
ttyfd = open("/dev/tty", O_RDWR);
if (ttyfd != -1) {
+#if defined(__NetBSD__)
+ setpgid(child_pid, child_pid);
+#endif
tcsetpgrp(ttyfd, child_pid);
close(ttyfd);
}
#endif
--FCuugMFkClbJLl1L--