Hi, Andy!



On Wed, Jan 27, 2010 at 10:33 AM, Andrew Hanushevsky <[log in to unmask]> wrote:
Hi Artem,

Actually, the preload library provides support for the basic stdio functions (e.g., fopen()). So, basic programs should work.

Hm.. I made a little program that just reads few bytes from a file, then writes this to another file, so it uses only fopen,fread,fwrite,fclose. It works fine on the local fs, but seg faults on the xrootd VMP in fread.

FILE *fp;
float d[1];
fp = fopen(fname, "r");
fread( d, sizeof( float ), 1, fp );    

 (gdb) backtrace
#0  0x00000036a8e68880 in fileno_unlocked () from /lib64/libc.so.6
#1  0x00002b0fc94509d7 in XrdPosix_Fread (ptr=0x7fff7e8b89f0, size=4, nitems=1, stream=0x0) at XrdPosix.cc:465
#2  0x00002b0fc945c7c5 in fread (ptr=0x7fff7e8b89f0, size=4, nitems=1, stream=0x0) at XrdPosixPreload.cc:205
#3  0x00000000004006c9 in main ()

So, seems like fread is cought by the preload library, but something doesn't work out. Any ideas?

Full support is not provided because, frankly, the stdio package is not ideal for programming high performance applications. For instance, many platform restrict the number of open files to 256 when you use stdio; which is very limiting.

To what extent is support provided?
 
I know stdio is much like editors (you love what ou first get to know) but I would discourage using the fxxx() functions in general.

Well, some apps are just written that way...

cheers
Artem.