- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- C expert needed
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 07:34 AM
02-20-2002 07:34 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 07:50 AM
02-20-2002 07:50 AM
Re: C expert needed
first i wanted to say that i m not an c expert
and i tried to compile the c program and i m getting all the time /usr/ccs/bin/ld: aa: Not a valid object file (invalid system id) .
but i wanted to tell you that i saw the same error with the command ipcs .
and over there the error was that a file was missing from the /stand .
RESOLUTION
A file in /stand is probably missing, most likely vmunix. Check
/stand to make sure everything that should be there is present.
Also verify permissions on the /stand directory and the files in it.
At least these files should be in /stand:
-rw-r--r-- 1 root sys 19 Jul 9 1999 bootconf
drwxr-xr-x 2 root root 1024 Jan 16 2001 build
-rw-r--r-- 1 root root 1568 Aug 23 2000 ioconfig
-r--r--r-- 1 root sys 82 May 19 1999 kernrel
drwxr-xr-x 2 root root 8192 May 19 1999 lost+found
-rw------- 1 root root 12 Nov 19 11:17 rootconf
-rw-rw-r-- 1 root sys 543 Jan 16 2001 system
-rwxr-xr-x 1 root sys 10065744 Jan 16 2001 vmunix
i will also check the primission .
now i will try to find a c expert that will help me with the c program
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 07:52 AM
02-20-2002 07:52 AM
Re: C expert needed
Do you have :-
/usr/include/nlist.h
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 07:53 AM
02-20-2002 07:53 AM
Re: C expert needed
Thanks for the reply Eran but /stand/vmunix is definitely there and the permissions are fine. Im running it as root so no permission problems and the box is recently rebuilt nice and clean and all my other nifty scripts and C programs run aok.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 07:54 AM
02-20-2002 07:54 AM
Re: C expert needed
thanks, yes its there. All include files are there or it wouldnt compile. It compiles clean with.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 07:56 AM
02-20-2002 07:56 AM
Re: C expert needed
Not sure whether this helps or not, but this says to check the existence of files in /stand directory and the permissions:
http://us-support3.external.hp.com/cki/bin/doc.pl/sid=841cb8280d787ca834/screen=ckiDisplayDocument?docId=200000058669640
HTH,
Shiju
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 08:05 AM
02-20-2002 08:05 AM
Re: C expert needed
Can you check the source, I'm getting an error on line 77, the printf on line 76 is not complete:
...
printf("HW page size is %d bytes\n",
printf("TLB is %s\n",unified_tlb?"unified":"separate");
...
unless my session's not working correctly?
Thx, Robin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 08:40 AM
02-20-2002 08:40 AM
Re: C expert needed
kernel="/stand/vmunix";
if (nlist(kernel, namelist) < 0)
{
kernel = "/hp-ux";
if (nlist(kernel, namelist) < 0)
cleanup("nlist");
}
The error message comes from the "cleanup" routine. Which is called after both(!) calls of nlist failed!
Since the basic routine causing the error is "nlist", I checked out "man nlist".
It is a systemcall, receiving an array with the names you like to extract, but
Once the nlist function has been called, the variable names are augmented with symbol information.
requires the object file to have symbol information. This is rarely the case for a compiled kernel. "nlist" has no qualification why it fails, so there ar only few reasons:
- file does not exist or is not accessible (easy to check)
- file is no object file (unlikely, because your system is runnning)
- file does not contain a symbol table
I think this program requires the kernel to be compiled with debug option to provide the symbol table. Now I just surfed SAM a bit, but found no options how to turn on kernel debugging or compile a kernel with symbol tables.
Do not know if this really helps....
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 08:56 AM
02-20-2002 08:56 AM
Re: C expert needed
found something else:
/stand/build/config.mk
contains the makefile for the kernel.
Browse for DOSDEBUG and read through the comment section in this area. May be the originator of this Program is able to give you more info how to build your kernel for this.
# Debug kernels (-DOSDEBUG) produce symbolic stack traces as a debugging
# aid. Non-debug kernels produce purely numeric stack traces. They're
# not as convenient, but the memory overhead (~300KB) of storing the
# names of every kernel function is too high for the production kernel.
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 09:07 AM
02-20-2002 09:07 AM
Re: C expert needed
Its taken me an hour to login to the itrc again!"$%%^&*. Talk about annoying. Heres a tail of the cache.c program so you can see the last few lines;
printf("\nOne cache line is %d bytes\n",
cache_tlb_parms.ic_conf.blocksize*16);
printf("Cache lines per chunk: %d\n",
cache_tlb_parms.ic_conf.lines_per_chunk );
printf("HW page size is %d bytes\n",
cache_tlb_parms.it_conf.page_size?4096:2048);
}
Tried attaching the file as a txt file also - been trying for half an hour - keeps hanging!"$%^&*@#
Volker - thanks for the info. Will look into it.
Cheers,
Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 09:23 AM
02-20-2002 09:23 AM
Re: C expert needed
I just added completed line 76 like this
76 printf("HW page size is %d bytes\n", 0);
and habe been able to compile and run the program without problem on 11.00 32-bit.
So my symbol theory is wrong :-(
May be you are running a 64-Bit version ?
Which may require the use of the "nlist64"-systemcall according to the mentioned man-page.
Volker
PS: Would be nice to complete line 76 with the correct value to get the HW page size reported.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 09:35 AM
02-20-2002 09:35 AM
Re: C expert needed
I get the same error wether on 10.20, 11/32 or 11/64. But I see youre point about nlist64, I will change this for an 11/64bit system and retry.
So you got it to run aok ? what was the output ??
Cheers,
Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 09:40 AM
02-20-2002 09:40 AM
Re: C expert needed
/**************************************************************************
This program prints size and organization of TLB and cache
Can be compiled without any specific options.
Can be run by a user that has read access to /dev/mem.
Author: Georges Aureau
Modified by Bernd Bausch
**************************************************************************/
#include
#include
#include
#include
#include
struct nlist namelist[] = {
{"cache_tlb_parms"},
{"cpu_has_hw_tlb_assist"},
{0}
};
cleanup(msg) { perror(msg); exit(1); }
main()
{
int hwtlb;
int unified_cache,unified_tlb;
char *kernel;
int core;
struct pdc_cache_rtn_block cache_tlb_parms;
kernel="/stand/build/vmunix_test";
if (nlist(kernel, namelist) < 0)
{
kernel = "/hp-ux";
if (nlist(kernel, namelist) < 0)
cleanup("nlist");
}
if ((core = open("/dev/mem", O_RDONLY)) < 0) cleanup("open kmem");
if (lseek(core, namelist[1].n_value, 0) < 0)
cleanup("lseek");
if (read(core, &hwtlb, sizeof(hwtlb)) < 0)
cleanup("read");
if (lseek(core, namelist[0].n_value, 0) < 0)
cleanup("lseek");
if (read(core, &cache_tlb_parms, sizeof(struct pdc_cache_rtn_block)) <
0)
cleanup("read");
unified_cache = cache_tlb_parms.ic_conf.f_sel;
unified_tlb = cache_tlb_parms.it_conf.p_sel;
printf( "\n" );
printf("%sHW TLB walker%s\n",hwtlb?"":"NO ",hwtlb?" present":"" );
printf("TLB is %s\n",unified_tlb?"unified":"separate");
if ( unified_tlb )
printf("TLB size is %d entries\n", cache_tlb_parms.it_size);
else
{
printf("I TLB size is %d entries\n", cache_tlb_parms.it_size);
printf("D TLB size is %d entries\n", cache_tlb_parms.dt_size);
}
printf("\nCache is %s\n",unified_cache?"unified":"separate");
if ( unified_cache )
printf("cache size is %d bytes (room for %d pages)\n",
cache_tlb_parms.ic_size,cache_tlb_parms.ic_size/4096);
else
{
printf("I cache size is %d bytes (room for %d pages)\n",
cache_tlb_parms.ic_size,cache_tlb_parms.ic_size/4096);
printf("D cache size is %d bytes (room for %d pages)\n",
cache_tlb_parms.dc_size,cache_tlb_parms.dc_size/4096);
}
printf("\nOne cache line is %d bytes\n",
cache_tlb_parms.ic_conf.blocksize*16);
printf("Cache lines per chunk: %d\n",
cache_tlb_parms.ic_conf.lines_per_chunk );
printf("HW page size is %d bytes\n",
cache_tlb_parms.it_conf.page_size?4096:2048);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 09:41 AM
02-20-2002 09:41 AM
Re: C expert needed
# a.out
HW TLB walker present
TLB is unified
TLB size is 64 entries
Cache is separate
I cache size is 131072 bytes (room for 32 pages)
D cache size is 131072 bytes (room for 32 pages)
One cache line is 32 bytes
Cache lines per chunk: 1
HW page size is 0 bytes
TLB is unified
TLB size is 64 entries
Cache is separate
I cache size is 131072 bytes (room for 32 pages)
D cache size is 131072 bytes (room for 32 pages)
One cache line is 32 bytes
Cache lines per chunk: 1
HW page size is 4096 bytes
#
-----------------
With the first "HW page size" line is the one i padded with zero. Does it have the same value as the one in the last line ?
... Now that I see the output, it looks like there was something clipped double in your post. Could you retry an attachment version ?
Volker
BTW: this box is not patched very up to date (could be an early 2001 bundle)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 09:47 AM
02-20-2002 09:47 AM
Re: C expert needed
you modified the kernel file parameter !
# cc proc1.c
# a.out
HW TLB walker present
TLB is unified
TLB size is 64 entries
Cache is separate
I cache size is 131072 bytes (room for 32 pages)
D cache size is 131072 bytes (room for 32 pages)
One cache line is 32 bytes
Cache lines per chunk: 1
HW page size is 4096 bytes
#
but only after I rechanged
kernel="/stand/vmunix";
not "/stand/build/vmunix_test"
Cheers
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 09:48 AM
02-20-2002 09:48 AM
Re: C expert needed
Cant send as an attachment - it simply hangs! been trying all afternoon. Maybe in the morning when its quieter.
What compile options did you use if any ?
What hardware are you running it on ?
Thanks,
Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 09:50 AM
02-20-2002 09:50 AM
Re: C expert needed
oops, only modified it to vmunix_test in the 2nd pasting because I was trying to build the kernel with debug on and point the cache program to the newly built test kernel !
I can compile aok but cant get to run on anything, C, D, K, N !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 10:00 AM
02-20-2002 10:00 AM
Re: C expert needed
Try this:
cc +DD64 tstprog.c -lelf
for 32bit OS's try
cc +DD32 tstprog.c -lelf
of course I found it here:
http://www.geocities.com/ujjwal/3264interop.html
and this seems to work:
#include
#include
#include
#include
main(argc, argv)
int argc;
char **argv;
{
struct nlist64 nl[2]; /* pointer to the list */
char nm[32]; /* name of the symbol */
/* check the command line argument */
if ( argc != 3 ) {
fprintf(stderr,"Usage: %s executable_file_name symbol_name\n");
exit(1);
}
/* Initialize the list pointer */
memset ( nl, 0, sizeof(nl) );
/* set the symbol name */
sprintf(nm,"%s\0",argv[2]);
/* set the pointer to the symbol */
nl[0].n_name = nm;
/* extract the value */
if ( -1 == nlist64(argv[1], nl) ) {
perror("nlist() failed");
exit(2);
}
/* print the data associated with the field */
printf("name %s\n",nl[0].n_name);
printf("qual %s\n",nl[0].n_qual);
printf("type %u\n",nl[0].n_type);
printf("scope %u\n",nl[0].n_scope);
printf("info %u\n",nl[0].n_info);
printf("value %lu\n",nl[0].n_value);
exit(0);
}
runs like this:
# ./nlst /stand/vmunix cpu_has_hw_tlb_assist
name cpu_has_hw_tlb_assist
qual
type 1
scope 0
info 41
value 78252672
#
and is compiled using this:
cc +DD64 -onlst test.c -lelf
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 10:01 AM
02-20-2002 10:01 AM
Re: C expert needed
I have an old E45
what about this ?
# ls -lrt /dev/*mem*
crw-r----- 1 bin sys 3 0x000001 May 18 1995 /dev/kmem
crw-r----- 1 bin sys 3 0x000000 May 18 1995 /dev/mem
crw-r--r-- 1 root sys 27 0x000000 Jan 17 2001 /dev/dmem
#
# ls -l /stand/vmunix
-rwxr-xr-x 1 root sys 12959956 Oct 21 1999 /stand/vmunix
#
# file /stand/vmunix
/stand/vmunix: PA-RISC1.1 executable -not stripped
.... May be the box is really not well patched, as the last kernel-build was in 1999 ... :-)
I guess this is where my C-expertiese ends.... Sorry
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 10:07 AM
02-20-2002 10:07 AM
SolutionThe problem with your program is that it is looking for the kernel at both /stand/vmunix and at /hp-ux, which causes the first error.
Change your original program by replacing calls or structs to nlist64 (leave the include as is). Then remove the if hp-ux crap.
and the output should be as follows (and the compile options I used):
# cc +DD64 -onlst tst.c -lelf
# ./nlst
NO HW TLB walker
TLB is unified
TLB size is 160 entries
Cache is separate
I cache size is 524288 bytes (room for 128 pages)
D cache size is 1048576 bytes (room for 256 pages)
One cache line is 64 bytes
Cache lines per chunk: 1
HW page size is 12 bytes
TLB is unified
TLB size is 160 entries
Cache is separate
I cache size is 524288 bytes (room for 128 pages)
D cache size is 1048576 bytes (room for 256 pages)
One cache line is 64 bytes
Cache lines per chunk: 1
HW page size is 4096 bytes
LIVE FREE or die (a lonely programmer)
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2002 10:17 AM
02-20-2002 10:17 AM
Re: C expert needed
Here's the "modified" program:
#include
#include
#include
#include
#include
struct nlist64 namelist[] = {
{"cache_tlb_parms"},
{"cpu_has_hw_tlb_assist"},
{0}
};
cleanup(msg) { perror(msg); exit(1); }
main()
{
int hwtlb;
int unified_cache,unified_tlb;
char *kernel;
int core;
struct pdc_cache_rtn_block cache_tlb_parms;
kernel="/stand/vmunix";
if (nlist64(kernel, namelist) < 0)
{
//kernel = "/hp-ux";
//if (nlist(kernel, namelist) < 0)
cleanup("nlist");
}
if ((core = open("/dev/mem", O_RDONLY)) < 0) cleanup("open kmem");
if (lseek(core, namelist[1].n_value, 0) < 0)
cleanup("lseek");
if (read(core, &hwtlb, sizeof(hwtlb)) < 0)
cleanup("read");
if (lseek(core, namelist[0].n_value, 0) < 0)
cleanup("lseek");
if (read(core, &cache_tlb_parms, sizeof(struct pdc_cache_rtn_block)) <
0)
cleanup("read");
unified_cache = cache_tlb_parms.ic_conf.f_sel;
unified_tlb = cache_tlb_parms.it_conf.p_sel;
printf( "\n" );
printf("%sHW TLB walker%s\n",hwtlb?"":"NO ",hwtlb?" present":"" );
printf("TLB is %s\n",unified_tlb?"unified":"separate");
if ( unified_tlb )
printf("TLB size is %d entries\n", cache_tlb_parms.it_size);
else
{
printf("I TLB size is %d entries\n", cache_tlb_parms.it_size);
printf("D TLB size is %d entries\n", cache_tlb_parms.dt_size);
}
printf("\nCache is %s\n",unified_cache?"unified":"separate");
if ( unified_cache )
printf("cache size is %d bytes (room for %d pages)\n",
cache_tlb_parms.ic_size,cache_tlb_parms.ic_size/4096);
else
{
printf("I cache size is %d bytes (room for %d pages)\n",
cache_tlb_parms.ic_size,cache_tlb_parms.ic_size/4096);
printf("D cache size is %d bytes (room for %d pages)\n",
cache_tlb_parms.dc_size,cache_tlb_parms.dc_size/4096);
}
printf("\nOne cache line is %d bytes\n",
cache_tlb_parms.ic_conf.blocksize*16);
printf("Cache lines per chunk: %d\n",
cache_tlb_parms.ic_conf.lines_per_chunk );
printf("HW page size is %d bytes\n",12);
//
//
// I put a 12 here (above), because the code is missing something
//
//
//
printf("TLB is %s\n",unified_tlb?"unified":"separate");
if ( unified_tlb )
printf("TLB size is %d entries\n", cache_tlb_parms.it_size);
else
{
printf("I TLB size is %d entries\n", cache_tlb_parms.it_size);
printf("D TLB size is %d entries\n", cache_tlb_parms.dt_size);
}
printf("\nCache is %s\n",unified_cache?"unified":"separate");
if ( unified_cache )
printf("cache size is %d bytes (room for %d pages)\n",
cache_tlb_parms.ic_size,cache_tlb_parms.ic_size/4096);
else
{
printf("I cache size is %d bytes (room for %d pages)\n",
cache_tlb_parms.ic_size,cache_tlb_parms.ic_size/4096);
printf("D cache size is %d bytes (room for %d pages)\n",
cache_tlb_parms.dc_size,cache_tlb_parms.dc_size/4096);
}
printf("\nOne cache line is %d bytes\n",
cache_tlb_parms.ic_conf.blocksize*16);
printf("Cache lines per chunk: %d\n",
cache_tlb_parms.ic_conf.lines_per_chunk );
printf("HW page size is %d bytes\n",
cache_tlb_parms.it_conf.page_size?4096:2048);
}
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2002 12:18 AM
02-21-2002 12:18 AM