<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>To confirm the point that you can not intercept the open called
by fopen by using LD_PRELOAD, I have written a simple test case.
Note that the runtime linker never looks for open(). Only fopen()<br>
</p>
<p><font face="Courier New, Courier, monospace"><b>$ cat a.c</b><br>
#include <unistd.h><br>
#include <stdlib.h><br>
#include <fcntl.h><br>
#include <stdio.h><br>
<br>
int<br>
main(int argc, char ** argv ){<br>
FILE *f = fopen("a", "r" ) ;<br>
fprintf(stderr,"f=%p\n",f);<br>
fclose(f);<br>
}<br>
<b>$ file a</b><br>
a: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.32,
BuildID[sha1]=dfe043b4ec8cf19d5fd3fab524d7c72ed1453574, not
stripped<br>
<b>$ cat a.csh</b><br>
#!/bin/csh<br>
<font color="#ff0000">setenv LD_DEBUG all</font><br>
./a >&! a.cpr<br>
<b>$ ./a.csh</b><br>
<b>$ grep -i open a.cpr</b><br>
120584: symbol=fopen; lookup in file=./a [0]<br>
120584: symbol=fopen; lookup in file=/lib64/libc.so.6
[0]<br>
120584: binding file ./a [0] to /lib64/libc.so.6 [0]:
normal symbol `fopen' [GLIBC_2.2.5]<br>
<b>$</b></font><br>
</p>
<br>
<div class="moz-cite-prefix">On 6/10/2016 7:29 AM, Ashley Pittman
wrote:<br>
</div>
<blockquote cite="mid:575AB28E.7090404@pittman.co.uk" type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<div class="moz-cite-prefix">On 22/05/16 02:56, John Bauer wrote:<br>
</div>
<blockquote
cite="mid:9ebe9f4c-d5a2-4c93-4f00-49029850cbbe@iodoctors.com"
type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<p>Oleg</p>
<p>I can intercept the fopen(), but that does me no good as I
can't set the O_LOV_DELAY_CREATE bit. What I can not
intercept is the open() downstream of fopen(). If one
examines the symbols in libc you will see there are no
unsatisfied externals relating to open, which means there is
nothing for the runtime linker to find concerning open's. I
will have a look at the Lustre 1.8 source, but I seriously
doubt that the open beneath fopen() was intercepted with
LD_PRELOAD. I would love to find a way to do that. I could
throw away a lot of code. Thanks, John<br>
</p>
</blockquote>
<br>
Could you not intercept fopen() and implement it with calls to
open() and fdopen() yourself which would give you full control
over what you're looking for here?<br>
<br>
Ashley.<br>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
I/O Doctors, LLC
507-766-0378
<a class="moz-txt-link-abbreviated" href="mailto:bauerj@iodoctors.com">bauerj@iodoctors.com</a></pre>
</body>
</html>