🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.next.sysadmin
3 messages
3 total messages Started by Paul Woods Wed, 12 Aug 1992 15:48
HOSTID fun
#674
Author: Paul Woods
Date: Wed, 12 Aug 1992 15:48
43 lines
1430 bytes
According to the man page on "hostid", the hostid can be changed.  so why when  
I try to change it, it tells me that it does not want to let me.  Is it truly  
possible to change it?  I thought that it was. 


Thanks,

Paul-

 Here is the Man and the response I get from the command:

------------------------

noproblem> man hostid

HOSTID(1)           UNIX Programmer's Manual            HOSTID(1)

NAME
     hostid - set or print identifier of current host system

SYNOPSIS
     hostid [ identifier ]

DESCRIPTION
     The hostid command prints the identifier of the current host
     in hexadecimal.  This numeric value is expected to be unique
     across all hosts and is commonly set to the host's Internet
     address.

SEE ALSO
     gethostid(2)

noproblem> hostid 0x100fbf0
sethostid: Invalid argument
noproblem> 

--



____________________________________
	Paul R. Woods
     University of Chicago
Re: HOSTID fun
#677
Author: Paul Woods
Date: Wed, 12 Aug 1992 16:08
6 lines
614 bytes
The above question was a stupid one.  Please pretend like I never posted it !!

Thanks,


Paul-
Re: HOSTID fun
#695
Author: Eric P. Scott
Date: Thu, 13 Aug 1992 00:41
65 lines
2327 bytes
In article <1992Aug12.154841.26732@midway.uchicago.edu>
	eer1@midway.uchicago.edu (Paul Woods) writes:
>According to the man page on "hostid", the hostid can be changed.  so why when
>I try to change it, it tells me that it does not want to let me.  Is it truly
>possible to change it?  I thought that it was.

In article <1992Aug12.160802.27393@midway.uchicago.edu>
	eer1@midway.uchicago.edu (Paul Woods) writes:
>The above question was a stupid one.

No, it's a good question, but it's come up before (last November).

Here's a slightly edited version:

NeXT didn't remove sethostid() from the kernel--they merely
munged its dispatch vector in the version of sdmach they
distribute to customers.

Every UNIX system call is assigned a number;
sethostid() is #143 <syscall.h>

These numbers are used to index into the "sysent" array.
Each element is an 8-byte structure:  <sys/systm.h>

struct sysent
{
	short	sy_narg;		/* total number of arguments */
	short	sy_parallel;		/* can execute in parallel */
	int	(*sy_call)();		/* handler */
} sysent[];

This is what NeXT ships in 2.x:

sysent[143] = { 0, 1, errsys }
  errsys always fails with EINVAL

This is what it's supposed to be:

sysent[143] = { 1, 1, sethostid }
  this is the code that's supposed to be executed

This can be corrected by binary-patching 3 bytes in the kernel:

[This is for 2.1 ONLY!!!]
% cmp -l sdmach xxmach
579602   0   1
579607 240 217
579608 214 206
^^^^^^ ^^^^^^^
decimal  octal

Once you make this change, sethostid() will work the way it's
supposed to, and the hostid(1) command will work as documented.

|Note that the addresses differ in different kernel versions;
|e.g., for 2.2 it looks like this:
|
|% cmp -l sdmach xxmach
|593462   0   1
|593467 236 215
|593468 100  72

[Any of the 3.0 prerelease sites care to comment?]

					-=EPS=-
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