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

Re: [tyndur-devel] [PATCH 6/6] libc: POSIX: Stub fuer gettimeofday()



Am Montag 05 Januar 2009 22:23:54 schrieb Kevin Wolf:
> + libc: POSIX: Stub fuer gettimeofday()
> ---
>  src/modules/include/sys/time.h |   10 ++++++++
>  src/modules/lib/posix/time.c   |   48
> ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+),
> 0 deletions(-)
>  create mode 100644 src/modules/lib/posix/time.c
>
> diff --git a/src/modules/include/sys/time.h
> b/src/modules/include/sys/time.h index f72098c..2a713b9 100644
> --- a/src/modules/include/sys/time.h
> +++ b/src/modules/include/sys/time.h
> @@ -40,5 +40,15 @@ struct timeval {
>      time_t      tv_sec;
>      suseconds_t tv_usec;
>  };
> +
> +struct timezone {
> +    int tz_minuteswest;
> +    int tz_dsttime;
> +};
> +
> +#ifndef CONFIG_LIBC_NO_STUBS
> +int gettimeofday(struct timeval *tv, struct timezone *tz);
> +#endif
> +
>  #endif //ifndef _SYS_TIME_H_
>
> diff --git a/src/modules/lib/posix/time.c b/src/modules/lib/posix/time.c
> new file mode 100644
> index 0000000..476aa8b
> --- /dev/null
> +++ b/src/modules/lib/posix/time.c
> @@ -0,0 +1,48 @@
> +/*
> + * Copyright (c) 2009 The tyndur Project. All rights reserved.
> + *
> + * This code is derived from software contributed to the tyndur Project
> + * by Kevin Wolf.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. All advertising materials mentioning features or use of this
> software + *    must display the following acknowledgement:
> + *     This product includes software developed by the tyndur Project
> + *     and its contributors.
> + * 4. Neither the name of the tyndur Project nor the names of its
> + *    contributors may be used to endorse or promote products derived
> + *    from this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
> PARTICULAR + * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
> HOLDERS OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +#include <sys/time.h>
> +
> +#ifndef CONFIG_LIBC_NO_STUBS
> +
> +int gettimeofday(struct timeval *tv, struct timezone *tz)
> +{
> +    tv->tv_sec = 0;
> +    tv->tv_usec = 0;
> +
> +    return 0;
> +}
> +
> +#endif

Als Stub natürlich absolut okay. Aber muss die Definition mit zweitem 
Parameter als timezone sein? Lt. manpage undefiniert, lt. glibc obsolet :/
Aber prinzipiell rein damit.

Attachment: signature.asc
Description: This is a digitally signed message part.