pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

patch for SGE: using tty over qrsh



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@localhost
--- 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


Home | Main Index | Thread Index | Old Index