Re: Question about the IO::File->open method



Keith Thompson <kst-u@xxxxxxx> wrote:
> "Martin Jost" <Martin.Jost@xxxxxxxxxxx> writes:
>> Two methods to get at that come to mind:
>> 1. RTFS (if it isn't documented)
>> 2. Use trace, strace, truss (whatever it is called on Solaris) to
>> trace sample-programs.

> The latter won't help. A call to fopen() won't show up in truss
> output, since fopen() isn't a system call; fopen() works by invoking
> open(), which is a system call.

You can use -u to trace libraries.

Try 'truss -t open -u libc:*open ...' on it.

On my test program using fopen...
$ cat /tmp/open.c
#include <stdio.h>
main()
{
FILE *f;
f = fopen("/tmp/out", "r" );
}

$ truss -t open -u libc:*open ./open
open("/var/ld/ld.config", O_RDONLY) Err#2 ENOENT
open("/usr/lib/libc.so.1", O_RDONLY) = 3
open("/usr/lib/libdl.so.1", O_RDONLY) = 3
open("/usr/platform/SUNW,Ultra-30/lib/libc_psr.so.1", O_RDONLY) = 3
-> libc:fopen(0x106a0, 0x106b0, 0x10400, 0x300)
open("/tmp/out", O_RDONLY) = 3
<- libc:fopen() = 0xff3402b4

--
Darren Dunham ddunham@xxxxxxxx
Senior Technical Consultant TAOS http://www.taos.com/
Got some Dr Pepper? San Francisco, CA bay area
< This line left intentionally blank to confuse you. >

.



Relevant Pages

  • Re: /dev/random on linux, openssh 3.2.3p1
    ... A simple trace (truss, strace, ktrace, etc.) to see if SSH is reading ...
    (comp.security.ssh)
  • Re: /dev/random on linux, openssh 3.2.3p1
    ... A simple trace (truss, strace, ktrace, etc.) to see if SSH is reading ...
    (comp.security.ssh)
  • Re: How to trace system level call in AIX
    ... >not nearly as convenient for quick tracing of a single process as ... >>> Somthing like truss in solaris, ... >>> know the command used to trace system call in AIX? ...
    (Vuln-Dev)
  • SUMMARY: truss on 4.0G
    ... needs a separate license called SVE320, which is not included and has ... This license is also not included in campus ... Thus, to get truss you have to pay, if you already haven't. ... Trace works maybe a little less well than original truss (judging from ...
    (Tru64-UNIX-Managers)
  • Re: QT4 problem on Solaris 10
    ... >> I don't know how to use those tools to trace down. ... I did try ldd and truss. ... Prev by Date: ...
    (comp.unix.solaris)