<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Courier New";
        panose-1:2 7 3 9 2 2 5 2 4 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Courier;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:Calibri;
        color:windowtext;}
span.msoIns
        {mso-style-type:export-only;
        mso-style-name:"";
        text-decoration:underline;
        color:teal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">If I recall correctly from when we implemented liblustre, which hooked into userspace using LD_PRELOAD, we had to capture the __open() call instead of open() (or something similar) to ensure
 that glibc didn't bypass our LD_PRELOAD from inside of fopen().<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">You might consider downloading the source for glibc to see what it is doing in fopen().<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p>&nbsp;</o:p></span></p>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Calibri;color:black">Cheers, Andreas<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Calibri;color:black">--&nbsp;<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Calibri;color:black">Andreas Dilger<o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Calibri;color:black">Lustre Principal Architect<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Calibri;color:black">Intel High Performance Data Division</span><span style="font-size:11.0pt;font-family:Calibri"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p>&nbsp;</o:p></span></p>
<div>
<div>
<p class="MsoNormal">On 2016/06/10, 10:04, &quot;lustre-discuss on behalf of John Bauer&quot; &lt;<a href="mailto:lustre-discuss-bounces@lists.lustre.org">lustre-discuss-bounces@lists.lustre.org</a> on behalf of
<a href="mailto:bauerj@iodoctors.com">bauerj@iodoctors.com</a>&gt; wrote:<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<blockquote style="border:none;border-left:solid #B5C4DF 4.5pt;padding:0in 0in 0in 4.0pt;margin-left:3.75pt;margin-right:0in" id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE">
<div>
<div>
<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.&nbsp; Note that the runtime linker never looks for open().&nbsp; Only fopen()<o:p></o:p></p>
<p><b><span style="font-family:&quot;Courier New&quot;">$ cat a.c</span></b><span style="font-family:&quot;Courier New&quot;"><br>
#include &lt;unistd.h&gt;<br>
#include &lt;stdlib.h&gt;<br>
#include &lt;fcntl.h&gt;<br>
#include &lt;stdio.h&gt;<br>
<br>
int<br>
main(int argc, char ** argv ){<br>
&nbsp;&nbsp; FILE *f = fopen(&quot;a&quot;, &quot;r&quot; ) ;<br>
&nbsp;&nbsp; fprintf(stderr,&quot;f=%p\n&quot;,f);<br>
&nbsp;&nbsp; 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>
<span style="color:red">setenv LD_DEBUG all</span><br>
./a &gt;&amp;! a.cpr<br>
<b>$ ./a.csh</b><br>
<b>$ grep -i open a.cpr</b><br>
&nbsp;&nbsp;&nbsp; 120584:&nbsp;&nbsp;&nbsp;&nbsp; symbol=fopen;&nbsp; lookup in file=./a [0]<br>
&nbsp;&nbsp;&nbsp; 120584:&nbsp;&nbsp;&nbsp;&nbsp; symbol=fopen;&nbsp; lookup in file=/lib64/libc.so.6 [0]<br>
&nbsp;&nbsp;&nbsp; 120584:&nbsp;&nbsp;&nbsp;&nbsp; binding file ./a [0] to /lib64/libc.so.6 [0]: normal symbol `fopen' [GLIBC_2.2.5]<br>
<b>$</b></span><o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">On 6/10/2016 7:29 AM, Ashley Pittman wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On 22/05/16 02:56, John Bauer wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p>Oleg<o:p></o:p></p>
<p>I can intercept the fopen(), but that does me no good as I can't set the O_LOV_DELAY_CREATE bit.&nbsp; What I can not intercept is the open() downstream of fopen().&nbsp; 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.&nbsp; 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.&nbsp; I would love to find a way to do that.&nbsp;
 I could throw away a lot of code. Thanks,&nbsp; John<o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><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.<o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<pre>-- <o:p></o:p></pre>
<pre>I/O Doctors, LLC<o:p></o:p></pre>
<pre>507-766-0378<o:p></o:p></pre>
<pre><a href="mailto:bauerj@iodoctors.com">bauerj@iodoctors.com</a><o:p></o:p></pre>
</div>
</div>
</blockquote>
</div>
</body>
</html>