Re: Re: [CFR] reflect resolv.conf update to running application

From: Sergey Babkin (babkin_at_verizon.net)
Date: 08/23/05

  • Next message: John-Mark Gurney: "Re: New library: libpidfile."
    Date: Tue, 23 Aug 2005 11:56:37 -0500 (CDT)
    To: Dan Nelson <dnelson@allantgroup.com>, Peter Jeremy <PeterJeremy@optushome.com.au>
    
    

    >In the last episode (Aug 23), Peter Jeremy said:
    >> On Mon, 2005-Aug-22 13:18:46 -0700, Matthew Reimer wrote:
    >> >How about just stat'ing resolv.conf if more than X seconds has
    >> >passed since the last stat, rather than for every lookup?
    >>
    >> That reduces the number of stat() calls but doesn't resolve the
    >> possibility of reading a half-written resolv.conf.
    >
    >Easy enough to only reread the file if stat tells you it's more than 2
    >seconds old.

    Won't reliably help: the file might change after you've done stat. The real solution would be to :

    * do stat, see that the file has changed
    * read the file into an intermediate buffer
    * wait 1 or 2 seconds
    * do stat again, if the time has not
    changed since the first stat then the
    contents of your buffer is valid and
    yu can use it

    -SB
    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"


  • Next message: John-Mark Gurney: "Re: New library: libpidfile."

    Relevant Pages

    • Re: Compiler Produces Incorrect Code
      ... > PIRP Irp; ... > PVOID Buffer, TempInputBuffer, TempOutputBuffer; ... > RtlCopyMemory(TempInputBuffer, InputBuffer, InputBufferLength); ... > stat = IoCallDriver; ...
      (microsoft.public.development.device.drivers)
    • Re: Weird problem with special characters in filename
      ... > filenames it gets from an internal readdir() as if they were ... When I call stat() with the filename ... that is in the struture that is returned by readdir, statfails with ... it treated the buffer as a C string. ...
      (comp.os.linux.misc)
    • Re: Compiler Produces Incorrect Code
      ... PIRP Irp; ... PVOID Buffer, TempInputBuffer, TempOutputBuffer; ... NTSTATUS stat; ... RtlCopyMemory(TempInputBuffer, InputBuffer, InputBufferLength); ...
      (microsoft.public.development.device.drivers)