🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Jerry Carlin Mon, 13 Jan 1986 22:58
ttyname(bug)
#254
Author: Jerry Carlin
Date: Mon, 13 Jan 1986 22:58
27 lines
1924 bytes
On the 3B2 (and maybe other computers), ttyname(3C) has a bug. When 
you 'shutdown' the system from other than the console, /dev/syscon is 
linked to the /dev/tty from which you are running shutdown. 

ttyname() will return /dev/syscon after the system is rebooted if 
'syscon' is before the tty in /dev. This is a problem since 
ttyslot(3C) uses the name returned by ttyname() to find the utmp 
entry.  There will be no utmp entry for /dev/syscon and ttyslot() will 
return -1 (not 0 as the manual incorrectly states). 

Since getlogin(3C) uses ttyslot() (which uses ttyname()), it will 
erroneously return NULL (process not attached to a terminal). This is 
a classic "for want of a nail the shoe was lost; for want of a shoe 
the horse was lost...". 

If you are just looking for the login name, cuserid(3C) works fine as 
it does not go thru this process. Alternatively, one could either 
diddle /etc/rc to relink /dev/syscon or you could 'rm' and 'mknod' as 
necessary to force syscon to come after all the regular tty's in /dev. 
Or, for those with source, change ttyname.c to check for multiple 
links and take some sane action (like checking if any of them are in
utmp) if such a condition is found. 

-- 
voice= 415 823-2441
uucp={ihnp4,dual,qantel}!ptsfa!jmc
Re: ttyname(bug)
#271
Author: jsdy
Date: Mon, 27 Jan 1986 22:48
45 lines
2506 bytes
The problem, as stated, was that shutdown's
	ln /dev/________ /dev/syscon
put syscon earlier in /dev than the tty that was being linked.

To fix this permanently, you must make sure that there are no
empty slots in /dev before all the tty names.  Here are two ways
to do this.

To do either, you must first have an idea how many empty slots
there are and where they are.  If you say 'od -c /dev', you will
get output that looks something like:

0000000  \9 \0  . \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
0000020  \2 \0  .  . \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
0000040  \0 \0  r  p  2  0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
0000060   d \2  c  o  n  s  o  l  e \0 \0 \0 \0 \0 \0 \0
0000100   c \2  t  t  y  0  0 \0 \0 \0 \0 \0 \0 \0 \0 \0
	...

The slots that have "\0 \0" in the first two columns are your empty
slots.  One example is "rp20" above.  This gives you how many and
where.

One thing you could do is to create new device or regular files to
fill these empty slots.  You could (if you trust yourself) remove
device files that are at the end of /dev and re-mknod them, so that
they will re-appear at the beginning.  Or you could just 'tee x y z
<RET><CTL-D>'.  This creates empty regular files.

Or, if you don't want to create useless files in /dev, but are not
sure you want to remove device files (after all, even _I_ make
mistakes!  [;-)]), you can change the links.  Since (presumably)
they already have the names you want them to have, you'll have to
make an extra link or two as intermediates:
	ln ttyz8 x	# right slot, wrong name
	ln x y		# wrong slot, wrong name
	rm ttyz8 x
	ln y ttyz8	# right slot, right name
	rm y

Of course, you will want to do both of these techniques single-user
so that you can remove /dev/syscon  b e f o r e  you do any of this.
-- 

	Joe Yao		hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP}
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads