schlake@nmt.edu (Schlake) (03/07/91)
Ok, here is a good question for any HPUX gurus out there. I was looking for information on sockets, so I did an 'nm /hp-ux' looking for the structures where relavent info is kept. Upon perusal of the file I saw this: ... ac_hlt | 1052480|extern|code |$CODE$ actest | 1052500|extern|code |$CODE$ $bozoword | 1421312|static|data |$DATA$ iodc_write_buffer | 1421376|extern|data |$DATA$ dump_iodc_buffer | 1052672|extern|entry |$CODE$ ... 1421376-1421312=64 (I checked for other variables in the area) Obviously not a 'word' word, so its gotta be a text string. I wrote a quick program to print out the value contained by $bozoword: #include <stdio.h> #include <sys/types.h> #include <nlist.h> int kmem; off_t off; struct nlist nl[] = { { "$bozoword" }, "" }; int main() { char bozoword[64]; register int i; if ((kmem = open ("/dev/kmem", 0)) == -1) { perror ("/dev/kmem"); exit (1); } if (nlist ("/hp-ux", nl) == -1) { fprintf (stderr, "nlist() failed\n"); exit (1); } off = nl[0].n_value; lseek(kmem, off, 0); read(kmem, &bozoword, sizeof(bozoword)); for(i=0;i<64;i++) { printf("/dev/kmem->$bozoword[%d] = 0x%x\n",i,(int)bozoword[i]); } } What I got was all NULL's (actually 0x0). What's up? We called our HP service Rep (about something else, not this) and mentioned it to him. He said write to it and see what happens. :) Anyone else out there got any better ideas? Schlake
jonb@hpcupt1.cup.hp.com (Jon Bayh) (03/12/91)
> From: schlake@nmt.edu (Schlake) > > $bozoword | 1421312|static|data |$DATA$ > iodc_write_buffer | 1421376|extern|data |$DATA$ > > 1421376-1421312=64 (I checked for other variables in the area) > > Obviously not a 'word' word, so its gotta be a text string. I wrote a > quick program to print out the value contained by $bozoword: Well, I hate to spoil a good mystery, but this question is obviously of such a critical nature that I feel obliged to comment on it. :-) The variable $bozoword actually is declared as a word in initialized data. The problem is that it is the last piece of data in the module that it is compiled into, and the next module allocates "iodc_write_buffer". For various I/O reasons, iodc_write_buffer is defined to be aligned on a 64-byte boundary. Because $bozoword didn't happen to end on a 64 byte boundary, padding of zeros are inserted between the two until the alignment is correct. $bozoword is an old, old variable in a section of code that really isn't of much interest to most customers. Jon Bayh, UKL jonb@hpda