Article View: comp.sys.next.sysadmin
Article #695Re: HOSTID fun
From: Eric P. Scott
Date: Thu, 13 Aug 1992 00:41
Date: Thu, 13 Aug 1992 00:41
65 lines
2327 bytes
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=-
Technical Details
Message-ID:
<1992Aug13.004125.6072@csus.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!decwrl!csus.edu!newsReferences:
<1992Aug12.154841.26732@midway.uchicago.edu> <1992Aug12.160802.27393@midway.uchicago.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.sysadmin Path: arc1-ca.pugleaf.net!sparky!uunet!decwrl!csus.edu!news From: eps@futon.SFSU.EDU (Eric P. Scott) Subject: Re: HOSTID fun Message-ID: <1992Aug13.004125.6072@csus.edu> Sender: news@csus.edu Reply-To: eps@cs.sfsu.edu Organization: San Francisco State University References: <1992Aug12.154841.26732@midway.uchicago.edu> <1992Aug12.160802.27393@midway.uchicago.edu> Date: Thu, 13 Aug 1992 00:41:25 GMT Lines: 65