Re: [PATCH 1/3] Add internal APIs for dealing with time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 29, 2011 at 04:21:45PM +0000, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> The logging APIs need to be able to generate formatted timestamps
> using only async signal safe functions. This rules out using
> gmtime/localtime/malloc/gettimeday(!) and much more.
> 
> Introduce a new internal API which is async signal safe.
> 
>   virTimeMillisNowRaw replacement for gettimeofday. Uses clock_gettime
>                       where available, otherwise falls back to the unsafe
>                       gettimeofday
> 
>   virTimeFieldsNowRaw  replacements for gmtime(), convert a timestamp
>   virTimeFieldsThenRaw into a broken out set of fields. No localtime()
>                        replacement is provided, because converting to
>                        local time is not practical with only async signal
>                        safe APIs.
> 
>   virTimeStringNowRaw  replacements for strftime() which print a timestamp
>   virTimeStringThenRaw into a string, using a pre-determined format, with
>                        a fixed size buffer (VIR_TIME_STRING_BUFLEN)
> 
> For each of these there is also a version without the Raw postfix
> which raises a full libvirt error. These versions are not async
> signal safe

  ACK, I didn't spot anything :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]