Unix Programming - Re: How works sysinfo ?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2004 > Re: How works sysinfo ?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: How works sysinfo ?
Felipe Cerqueira (skylazart)

2004-01-23, 5:00 pm



On Thu, 19 Jun 2003, Jacques BEJA wrote:
quote:

> Hi,
>
> I have a software which I don't have the sources that requires
> information about the CPU. In fact the informations it needs is just
> like what provide the unix command 'uname -i'.
> I need to modify the information it obtains. Obviouly it doesn't use
> the uname command (renaming tu uname program, the software still
> works). I have done many searches over the Internet and it seems that
> my software is using the sysinfo function. Since I don't have the
> sources I can't reprogram the sysinfo function.



Try ltrace to see exactly whats happening.

To call other sysinfo without change the source code try LD_PRELOAD in
this way:

-- la.c --

int sysinfo(void *info)
{
return (-1);
}

-- la.c --

gcc -fPIC -shared -o la.so la.c
export LD_PRELOAD=/complete/path/to/la.so
../appl

Try aith ltrace again...
quote:

>
> To conclude if I want to modify the information the program obtain, I
> think I must go and modify the information at the source.
>
> Consequently my question is : where does sysinfo take information
> about CPU ?
>
> I would be very grateful if somebody could provide any kind of info.
>
> Jacques BEJA
>
> PS : If someone has an idea of a better group to post that request, I
> would be very thankful.
>


Felipe Cerqueira (skylazart)

2004-01-23, 5:14 pm



On Thu, 19 Jun 2003, Jacques BEJA wrote:
quote:

> Hi,
>
> I have a software which I don't have the sources that requires
> information about the CPU. In fact the informations it needs is just
> like what provide the unix command 'uname -i'.
> I need to modify the information it obtains. Obviouly it doesn't use
> the uname command (renaming tu uname program, the software still
> works). I have done many searches over the Internet and it seems that
> my software is using the sysinfo function. Since I don't have the
> sources I can't reprogram the sysinfo function.



Try ltrace to see exactly whats happening.

To call other sysinfo without change the source code try LD_PRELOAD in
this way:

-- la.c --

int sysinfo(void *info)
{
return (-1);
}

-- la.c --

gcc -fPIC -shared -o la.so la.c
export LD_PRELOAD=/complete/path/to/la.so
../appl

Try aith ltrace again...
quote:

>
> To conclude if I want to modify the information the program obtain, I
> think I must go and modify the information at the source.
>
> Consequently my question is : where does sysinfo take information
> about CPU ?
>
> I would be very grateful if somebody could provide any kind of info.
>
> Jacques BEJA
>
> PS : If someone has an idea of a better group to post that request, I
> would be very thankful.
>


Felipe Cerqueira (skylazart)

2004-01-23, 5:26 pm



On Thu, 19 Jun 2003, Jacques BEJA wrote:
quote:

> Hi,
>
> I have a software which I don't have the sources that requires
> information about the CPU. In fact the informations it needs is just
> like what provide the unix command 'uname -i'.
> I need to modify the information it obtains. Obviouly it doesn't use
> the uname command (renaming tu uname program, the software still
> works). I have done many searches over the Internet and it seems that
> my software is using the sysinfo function. Since I don't have the
> sources I can't reprogram the sysinfo function.



Try ltrace to see exactly whats happening.

To call other sysinfo without change the source code try LD_PRELOAD in
this way:

-- la.c --

int sysinfo(void *info)
{
return (-1);
}

-- la.c --

gcc -fPIC -shared -o la.so la.c
export LD_PRELOAD=/complete/path/to/la.so
../appl

Try aith ltrace again...
quote:

>
> To conclude if I want to modify the information the program obtain, I
> think I must go and modify the information at the source.
>
> Consequently my question is : where does sysinfo take information
> about CPU ?
>
> I would be very grateful if somebody could provide any kind of info.
>
> Jacques BEJA
>
> PS : If someone has an idea of a better group to post that request, I
> would be very thankful.
>


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com