Uncharacteristic behavior of system call cs
- From: "shankha" <shankhabanerjee@xxxxxxxxx>
- Date: 12 Dec 2006 21:38:35 -0800
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <errno.h>
void foo(void * handle,const char *ptr)
{
void * symptr;
if (NULL == (symptr = dlsym(handle, ptr)))
{
if ( 0 == errno)
fprintf(stderr, "symbol %s not found\n", ptr);
else
perror(dlerror());
}
else
{
printf("SYSTEM CALL : %s 0x%x\n", ptr, symptr);
printf(" THE ADDRESS TO WHICH WE JUMP TO
0x%x\n",*(int *)symptr);
printf(" TOC VALUE(r2)
0x%x\n\n",*(int *)((int)symptr + 4));
}
}
int main()
{
void * handle;
if ( NULL == (handle = dlopen("/unix",RTLD_NOW )))
{
perror(dlerror());
exit(1);
}
foo(handle,"cs");
foo(handle,"_getpid");
foo(handle,"mkdir");
foo(handle,"__unload");
foo(handle,"thread_waitlock_");
foo(handle,"skeytune");
foo(handle,"kfork");
if ( 0 != (dlclose(handle))) {
perror(dlerror());
exit(1);
}
return 0;
}
if you see the output on AIX 5.1 5.2 5.3 the value which we get for thr
field THE ADDRESS TO WHICH WE JUMP TO is same for all other system
calls except cs. If we do a dump -Tv -X64 /unix and grep for all the
system calls the Scn field shows .data but for cs it shows .text. Can
any one please explain this uncharacteristic behaviour of cs. I am not
sure wether cs is a system call or not.
.
- Follow-Ups:
- Re: Uncharacteristic behavior of system call cs
- From: Gary R. Hook
- Re: Uncharacteristic behavior of system call cs
- Prev by Date: Re: Problems with G++ - Undefined symbol: .
- Next by Date: xlf vs xlc
- Previous by thread: HMC Cut & Paste
- Next by thread: Re: Uncharacteristic behavior of system call cs
- Index(es):
Relevant Pages
|