From: ukai@kmc.kyoto-u.ac.jp (Ukai Fumitoshi)
Subject: Re: [386bsd(98)] Q. ps command and Nemacs shell-mode
Reply-To: ukai@kuamp.kyoto-u.ac.jp
Organization: Kyoto University Microcomputer Club, Kyoto, Japan
	<TATSUO.93Jan26123327@epsilon.myo.inst.keio.ac.jp>
Distribution: fj
Date: Wed, 27 Jan 1993 14:22:38 GMT


$@$&$+$$!w5~Bg%^%$%3%s%/%i%V$G$9!#(J

In article <TATSUO.93Jan26123327@epsilon.myo.inst.keio.ac.jp> 
	tatsuo@myo.inst.keio.ac.jp (Tatsuo SATOH) writes:

>>>>>> On 21 Jan 93 00:11:57 GMT, 
	saito@seg.kobe-u.ac.jp (Saito Yoshinori) said:
>	  $@@FF#$5$s(J> $@$=$N#1!'(J
>	  $@@FF#$5$s(J>   ps $@%3%^%s%I$G!$(JTTY $@$NMs$,%3%s%=!<%k$,(J ?? $@$H$J$j!$(Jcom0 $@$,(J co $@$H$J$k$N(J
>	  $@@FF#$5$s(J> $@$G$9$,!$$3$l$O(J$@2?=h$,0-$$$N$G$7$g$&$+!%(J

 $@$3$l$O$H$j$"$($:<!$N(J patch $@$GD>$k$h$&$G$9!#(J
# comp.unix.bsd $@$+$i$NE>:\$G$9(J$@!#(J

----------------------------------------------------------------
From: duplain@rtf.bt.co.uk (Andy Duplain)
Newsgroups: comp.unix.bsd
Subject: Patch to allow ps(1) to identify console-controlled processes
Date: 21 Dec 92 15:46:52 GMT
Organization: BT Customer Systems, Brighton, UK


	Hi, here is a hack to allow ps(1) to see processes that have the
	console as there controlling tty.  I don't understand why there
	is both a console and a PC console device, but basically all
	processes that are controlled from the console have the major device
	number of 12, while /dev/console has a major device number of 0.  An
	alternative solution _could_ be to add a filesystem node for the
	PC console device and then run dev_mkdb(8) again (having changed the
	definition of _PATH_CONSOLE from /dev/console to /dev/whatever).

	I don't have X running so these things may have been patched properly
	by someone else...

	Apply these patches at your own risk --  THEY CERTAINLY ARE A HACK!

*** ps.c.ORIG	Mon Dec 21 15:23:58 1992
--- ps.c	Mon Dec 21 15:33:45 1992
***************
*** 195,203 ****
  			struct stat stbuf;
  			char pathbuf[MAXPATHLEN];
  
! 			if (strcmp(optarg, "co") == 0)
! 				ttypath = _PATH_CONSOLE;
! 			else if (*optarg != '/')
  				(void) sprintf(ttypath = pathbuf, "%s%s",
  				    _PATH_TTY, optarg);
  			else
--- 195,204 ----
  			struct stat stbuf;
  			char pathbuf[MAXPATHLEN];
  
! 			if (strcmp(optarg, "co") == 0) {
! 				ttydev = 0x0c00;	/* HACK!!! */
! 				break;
! 			} else if (*optarg != '/')
  				(void) sprintf(ttypath = pathbuf, "%s%s",
  				    _PATH_TTY, optarg);
  			else
*** devname.c.ORIG	Mon Dec 21 15:09:00 1992
--- devname.c	Mon Dec 21 15:27:04 1992
***************
*** 54,59 ****
--- 54,65 ----
  	static int failure;
  	DBT data, key;
  
+ 	/* hack to allow processes with the PC console device as there
+ 	   controlling tty to be seen -- duplain@btcs.bt.co.uk */
+ 
+ 	if (major(dev) == 12)
+ 		return ("co");
+ 
  	if (!db && !failure &&
  	    !(db = hash_open(_PATH_DEVDB, O_RDONLY, 0, NULL))) {
  		(void)fprintf(stderr,


-- 
Andy Duplain, BT Customer Systems, Brighton, UK.           duplain@rtf.bt.co.uk
#define	DISCLAIMER      My views and opinions are my own, and not my company's
----------------------------------------------------------------

>	  $@@FF#$5$s(J> $@$=$N#2!'(J
>	  $@@FF#$5$s(J>   Nemacs $@$G(J shell $@%b!<%I$K$9$k$H!$(Jshell $@%P%C%U%!$K(J
>
>	  $@@FF#$5$s(J> 	Warning: no access to tty (Inappropriate ioctl for device).
>	  $@@FF#$5$s(J> 	Thus no job control in this shell.
>
>$@;d$N$H$3$m$bF1$8>I>u$G$9!#(J

 $@$3$A$i$NJ}(J$@$ONI$/J,$+$j$^$;$s!#(J

---
$@1-;tJ8IR(J
$@5~ETBg3XBg3X1!9)3X8&5f2J1~MQ%7%9%F%`2J3X@l96D9C+@n8&(J ukai@kuamp.kyoto-u.ac.jp
$@5~Bg%^%$%3%s%/%i%V(J                                     ukai@kmc.kyoto-u.ac.jp