<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Sometimes they do things like that for backlevel compatibility; so
    single threaded apps that rely on that global don't immediately
    break.<br>
    The question is: does ds_getaddrinfo _rely_ on that variable?<br>
    <br>
    I doubt it; but it's _possible_ you found an oversight!<br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 1/3/2016 10:57 AM, A. Jesse Jiryu
      Davis wrote:<br>
    </div>
    <blockquote
cite="mid:CAFRUCtafxr=wiZPEv3kFBAe7xtG2rgvpOSDpEnAoiUvm9Wku5w@mail.gmail.com"
      type="cite">
      <div dir="ltr">Thanks for the pointers, with your help I'm making
        progress. I think I found the source for Apple's getaddrinfo.
        <div><br>
        </div>
        <div>In Apple's Libinfo version 222.4.12, the man page says
          getaddrinfo isn't thread-safe:
          <div><br>
          </div>
          <div><a moz-do-not-send="true"
href="http://www.opensource.apple.com/source/Libinfo/Libinfo-222.4.12/lookup.subproj/getaddrinfo.3">http://www.opensource.apple.com/source/Libinfo/Libinfo-222.4.12/lookup.subproj/getaddrinfo.3</a><br>
          </div>
          <div><br>
          </div>
          <div>And here's its source:</div>
          <div><br>
          </div>
          <div><a moz-do-not-send="true"
href="http://www.opensource.apple.com/source/Libinfo/Libinfo-222.4.12/lookup.subproj/getaddrinfo.c">http://www.opensource.apple.com/source/Libinfo/Libinfo-222.4.12/lookup.subproj/getaddrinfo.c</a><br>
          </div>
          <div><br>
          </div>
          <div>Glancing at the source naïvely, I might see the data
            race: getaddrinfo calls gai_lookupd, which reads and writes
            the global static variable "gai_proc". I can't see what will
            go wrong as a result of the race, but it sure LOOKS bad. =)</div>
          <div><br>
          </div>
          <div>In the next release, version 278, the thread-safety
            warning is gone from the man page:</div>
        </div>
        <div><br>
        </div>
        <div><a moz-do-not-send="true"
href="http://www.opensource.apple.com/source/Libinfo/Libinfo-278/lookup.subproj/getaddrinfo.3">http://www.opensource.apple.com/source/Libinfo/Libinfo-278/lookup.subproj/getaddrinfo.3</a><br>
        </div>
        <div><br>
        </div>
        <div>And getaddrinfo is largely rewritten:</div>
        <div><br>
        </div>
        <div><a moz-do-not-send="true"
href="http://www.opensource.apple.com/source/Libinfo/Libinfo-278/lookup.subproj/getaddrinfo.c">http://www.opensource.apple.com/source/Libinfo/Libinfo-278/lookup.subproj/getaddrinfo.c</a><br>
        </div>
        <div><br>
        </div>
        <div>It calls a new function, "ds_getaddrinfo".
          But ds_getaddrinfo still accesses the global static variable
          "gai_proc"; I wonder why this is considered thread-safe now?</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Sun, Jan 3, 2016 at 12:14 AM,
          Siobhan Lynch <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:slynch2112@me.com" target="_blank">slynch2112@me.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div style="word-wrap:break-word">OK… try and look at the
              revision histories of these three files:
              <div><br>
              </div>
              <div>
                <div
                  style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> 
                     <b>#include</b> <b><sys/types.h></b></div>
                <div
                  style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">  
                    <b>#include</b> <b><sys/socket.h></b></div>
                <div
                  style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">  
                    <b>#include</b> <b><netdb.h></b></div>
                <div><br>
                </div>
                <div><br>
                </div>
                <div><b>-Trish</b></div>
                <div>
                  <div
style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
                    <div
style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><br>
                    </div>
                  </div>
                </div>
                <br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
talk mailing list
<a class="moz-txt-link-abbreviated" href="mailto:talk@lists.nycbug.org">talk@lists.nycbug.org</a>
<a class="moz-txt-link-freetext" href="http://lists.nycbug.org/mailman/listinfo/talk">http://lists.nycbug.org/mailman/listinfo/talk</a></pre>
    </blockquote>
    <br>
  </body>
</html>