Browse Source
This patch adds the missing features to the C library included in the Trusted Firmware to build PolarSSL: - strcasecmp() function - exit() function - sscanf()* function - time.h header file (and its dependencies) * NOTE: the sscanf() function is not a real implementation. It just returns the number of expected arguments by counting the number of '%' characters present in the formar string. This return value is good enough for PolarSSL because during the certificate parsing only the return value is checked. The certificate validity period is ignored. Change-Id: I43bb3742f26f0bd458272fccc3d72a7f2176ab3dpull/249/head
Juan Castillo
10 years ago
committed by
Dan Handley
16 changed files with 1249 additions and 0 deletions
@ -0,0 +1,52 @@ |
|||
/*-
|
|||
* Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org> |
|||
* All rights reserved. |
|||
* |
|||
* 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. |
|||
* |
|||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. |
|||
* |
|||
* $FreeBSD$ |
|||
*/ |
|||
|
|||
#ifndef _INTTYPES_H_ |
|||
#define _INTTYPES_H_ |
|||
|
|||
#include <machine/_inttypes.h> |
|||
#include <sys/stdint.h> |
|||
|
|||
typedef struct { |
|||
intmax_t quot; /* Quotient. */ |
|||
intmax_t rem; /* Remainder. */ |
|||
} imaxdiv_t; |
|||
|
|||
__BEGIN_DECLS |
|||
#ifdef _XLOCALE_H_ |
|||
#include <xlocale/_inttypes.h> |
|||
#endif |
|||
intmax_t imaxabs(intmax_t) __pure2; |
|||
imaxdiv_t imaxdiv(intmax_t, intmax_t) __pure2; |
|||
|
|||
intmax_t strtoimax(const char *__restrict, char **__restrict, int); |
|||
uintmax_t strtoumax(const char *__restrict, char **__restrict, int); |
|||
|
|||
__END_DECLS |
|||
|
|||
#endif /* !_INTTYPES_H_ */ |
@ -0,0 +1,39 @@ |
|||
/*
|
|||
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. |
|||
* |
|||
* Redistribution and use in source and binary forms, with or without |
|||
* modification, are permitted provided that the following conditions are met: |
|||
* |
|||
* Redistributions of source code must retain the above copyright notice, this |
|||
* list of conditions and the following disclaimer. |
|||
* |
|||
* 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. |
|||
* |
|||
* Neither the name of ARM 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 HOLDER 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. |
|||
*/ |
|||
|
|||
#ifndef _MACHINE_INTTYPES_H_ |
|||
#define _MACHINE_INTTYPES_H_ |
|||
|
|||
/*
|
|||
* Trusted Firmware does not depend on any definitions in this file. Content |
|||
* will be added as needed. |
|||
*/ |
|||
|
|||
#endif /* !_MACHINE_INTTYPES_H_ */ |
@ -0,0 +1,313 @@ |
|||
/*-
|
|||
* Copyright (c) 1990, 1993 |
|||
* The Regents of the University of California. All rights reserved. |
|||
* |
|||
* 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. Neither the name of the University 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 REGENTS 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 REGENTS 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. |
|||
* |
|||
* @(#)stdlib.h 8.5 (Berkeley) 5/19/95 |
|||
* $FreeBSD$ |
|||
*/ |
|||
|
|||
#ifndef _STDLIB_H_ |
|||
#define _STDLIB_H_ |
|||
|
|||
#include <sys/cdefs.h> |
|||
#include <sys/_null.h> |
|||
#include <sys/_types.h> |
|||
|
|||
#if __BSD_VISIBLE |
|||
#ifndef _RUNE_T_DECLARED |
|||
typedef __rune_t rune_t; |
|||
#define _RUNE_T_DECLARED |
|||
#endif |
|||
#endif |
|||
|
|||
#ifndef _SIZE_T_DECLARED |
|||
typedef __size_t size_t; |
|||
#define _SIZE_T_DECLARED |
|||
#endif |
|||
|
|||
typedef struct { |
|||
int quot; /* quotient */ |
|||
int rem; /* remainder */ |
|||
} div_t; |
|||
|
|||
typedef struct { |
|||
long quot; |
|||
long rem; |
|||
} ldiv_t; |
|||
|
|||
#define EXIT_FAILURE 1 |
|||
#define EXIT_SUCCESS 0 |
|||
|
|||
#define RAND_MAX 0x7ffffffd |
|||
|
|||
__BEGIN_DECLS |
|||
#ifdef _XLOCALE_H_ |
|||
#include <xlocale/_stdlib.h> |
|||
#endif |
|||
extern int __mb_cur_max; |
|||
extern int ___mb_cur_max(void); |
|||
#define MB_CUR_MAX (___mb_cur_max()) |
|||
|
|||
_Noreturn void abort(void); |
|||
int abs(int) __pure2; |
|||
int atexit(void (*)(void)); |
|||
double atof(const char *); |
|||
int atoi(const char *); |
|||
long atol(const char *); |
|||
void *bsearch(const void *, const void *, size_t, |
|||
size_t, int (*)(const void *, const void *)); |
|||
void *calloc(size_t, size_t) __malloc_like; |
|||
div_t div(int, int) __pure2; |
|||
_Noreturn void exit(int); |
|||
void free(void *); |
|||
char *getenv(const char *); |
|||
long labs(long) __pure2; |
|||
ldiv_t ldiv(long, long) __pure2; |
|||
void *malloc(size_t) __malloc_like; |
|||
int mblen(const char *, size_t); |
|||
void qsort(void *, size_t, size_t, |
|||
int (*)(const void *, const void *)); |
|||
int rand(void); |
|||
void *realloc(void *, size_t); |
|||
void srand(unsigned); |
|||
double strtod(const char *__restrict, char **__restrict); |
|||
float strtof(const char *__restrict, char **__restrict); |
|||
long strtol(const char *__restrict, char **__restrict, int); |
|||
long double |
|||
strtold(const char *__restrict, char **__restrict); |
|||
unsigned long |
|||
strtoul(const char *__restrict, char **__restrict, int); |
|||
int system(const char *); |
|||
|
|||
/*
|
|||
* Functions added in C99 which we make conditionally available in the |
|||
* BSD^C89 namespace if the compiler supports `long long'. |
|||
* The #if test is more complicated than it ought to be because |
|||
* __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long' |
|||
* is not supported in the compilation environment (which therefore means |
|||
* that it can't really be ISO C99). |
|||
* |
|||
* (The only other extension made by C99 in thie header is _Exit().) |
|||
*/ |
|||
#if __ISO_C_VISIBLE >= 1999 |
|||
#ifdef __LONG_LONG_SUPPORTED |
|||
/* LONGLONG */ |
|||
typedef struct { |
|||
long long quot; |
|||
long long rem; |
|||
} lldiv_t; |
|||
|
|||
/* LONGLONG */ |
|||
long long |
|||
atoll(const char *); |
|||
/* LONGLONG */ |
|||
long long |
|||
llabs(long long) __pure2; |
|||
/* LONGLONG */ |
|||
lldiv_t lldiv(long long, long long) __pure2; |
|||
/* LONGLONG */ |
|||
long long |
|||
strtoll(const char *__restrict, char **__restrict, int); |
|||
/* LONGLONG */ |
|||
unsigned long long |
|||
strtoull(const char *__restrict, char **__restrict, int); |
|||
#endif /* __LONG_LONG_SUPPORTED */ |
|||
|
|||
_Noreturn void _Exit(int); |
|||
#endif /* __ISO_C_VISIBLE >= 1999 */ |
|||
|
|||
/*
|
|||
* If we're in a mode greater than C99, expose C11 functions. |
|||
*/ |
|||
#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L |
|||
void *aligned_alloc(size_t, size_t) __malloc_like; |
|||
int at_quick_exit(void (*)(void)); |
|||
_Noreturn void |
|||
quick_exit(int); |
|||
#endif /* __ISO_C_VISIBLE >= 2011 */ |
|||
/*
|
|||
* Extensions made by POSIX relative to C. |
|||
*/ |
|||
#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE |
|||
char *realpath(const char *__restrict, char *__restrict); |
|||
#endif |
|||
#if __POSIX_VISIBLE >= 199506 |
|||
int rand_r(unsigned *); /* (TSF) */ |
|||
#endif |
|||
#if __POSIX_VISIBLE >= 200112 |
|||
int posix_memalign(void **, size_t, size_t); /* (ADV) */ |
|||
int setenv(const char *, const char *, int); |
|||
int unsetenv(const char *); |
|||
#endif |
|||
|
|||
#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE |
|||
int getsubopt(char **, char *const *, char **); |
|||
#ifndef _MKDTEMP_DECLARED |
|||
char *mkdtemp(char *); |
|||
#define _MKDTEMP_DECLARED |
|||
#endif |
|||
#ifndef _MKSTEMP_DECLARED |
|||
int mkstemp(char *); |
|||
#define _MKSTEMP_DECLARED |
|||
#endif |
|||
#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */ |
|||
|
|||
/*
|
|||
* The only changes to the XSI namespace in revision 6 were the deletion |
|||
* of the ttyslot() and valloc() functions, which FreeBSD never declared |
|||
* in this header. For revision 7, ecvt(), fcvt(), and gcvt(), which |
|||
* FreeBSD also does not have, and mktemp(), are to be deleted. |
|||
*/ |
|||
#if __XSI_VISIBLE |
|||
/* XXX XSI requires pollution from <sys/wait.h> here. We'd rather not. */ |
|||
long a64l(const char *); |
|||
double drand48(void); |
|||
/* char *ecvt(double, int, int * __restrict, int * __restrict); */ |
|||
double erand48(unsigned short[3]); |
|||
/* char *fcvt(double, int, int * __restrict, int * __restrict); */ |
|||
/* char *gcvt(double, int, int * __restrict, int * __restrict); */ |
|||
int grantpt(int); |
|||
char *initstate(unsigned long /* XSI requires u_int */, char *, long); |
|||
long jrand48(unsigned short[3]); |
|||
char *l64a(long); |
|||
void lcong48(unsigned short[7]); |
|||
long lrand48(void); |
|||
#if !defined(_MKTEMP_DECLARED) && (__BSD_VISIBLE || __XSI_VISIBLE <= 600) |
|||
char *mktemp(char *); |
|||
#define _MKTEMP_DECLARED |
|||
#endif |
|||
long mrand48(void); |
|||
long nrand48(unsigned short[3]); |
|||
int posix_openpt(int); |
|||
char *ptsname(int); |
|||
int putenv(char *); |
|||
long random(void); |
|||
unsigned short |
|||
*seed48(unsigned short[3]); |
|||
#ifndef _SETKEY_DECLARED |
|||
int setkey(const char *); |
|||
#define _SETKEY_DECLARED |
|||
#endif |
|||
char *setstate(/* const */ char *); |
|||
void srand48(long); |
|||
void srandom(unsigned long); |
|||
int unlockpt(int); |
|||
#endif /* __XSI_VISIBLE */ |
|||
|
|||
#if __BSD_VISIBLE |
|||
extern const char *malloc_conf; |
|||
extern void (*malloc_message)(void *, const char *); |
|||
|
|||
/*
|
|||
* The alloca() function can't be implemented in C, and on some |
|||
* platforms it can't be implemented at all as a callable function. |
|||
* The GNU C compiler provides a built-in alloca() which we can use; |
|||
* in all other cases, provide a prototype, mainly to pacify various |
|||
* incarnations of lint. On platforms where alloca() is not in libc, |
|||
* programs which use it will fail to link when compiled with non-GNU |
|||
* compilers. |
|||
*/ |
|||
#if __GNUC__ >= 2 || defined(__INTEL_COMPILER) |
|||
#undef alloca /* some GNU bits try to get cute and define this on their own */ |
|||
#define alloca(sz) __builtin_alloca(sz) |
|||
#elif defined(lint) |
|||
void *alloca(size_t); |
|||
#endif |
|||
|
|||
void abort2(const char *, int, void **) __dead2; |
|||
__uint32_t |
|||
arc4random(void); |
|||
void arc4random_addrandom(unsigned char *, int); |
|||
void arc4random_buf(void *, size_t); |
|||
void arc4random_stir(void); |
|||
__uint32_t |
|||
arc4random_uniform(__uint32_t); |
|||
#ifdef __BLOCKS__ |
|||
int atexit_b(void (^)(void)); |
|||
void *bsearch_b(const void *, const void *, size_t, |
|||
size_t, int (^)(const void *, const void *)); |
|||
#endif |
|||
char *getbsize(int *, long *); |
|||
/* getcap(3) functions */ |
|||
char *cgetcap(char *, const char *, int); |
|||
int cgetclose(void); |
|||
int cgetent(char **, char **, const char *); |
|||
int cgetfirst(char **, char **); |
|||
int cgetmatch(const char *, const char *); |
|||
int cgetnext(char **, char **); |
|||
int cgetnum(char *, const char *, long *); |
|||
int cgetset(const char *); |
|||
int cgetstr(char *, const char *, char **); |
|||
int cgetustr(char *, const char *, char **); |
|||
|
|||
int daemon(int, int); |
|||
char *devname(__dev_t, __mode_t); |
|||
char *devname_r(__dev_t, __mode_t, char *, int); |
|||
char *fdevname(int); |
|||
char *fdevname_r(int, char *, int); |
|||
int getloadavg(double [], int); |
|||
const char * |
|||
getprogname(void); |
|||
|
|||
int heapsort(void *, size_t, size_t, int (*)(const void *, const void *)); |
|||
#ifdef __BLOCKS__ |
|||
int heapsort_b(void *, size_t, size_t, int (^)(const void *, const void *)); |
|||
void qsort_b(void *, size_t, size_t, |
|||
int (^)(const void *, const void *)); |
|||
#endif |
|||
int l64a_r(long, char *, int); |
|||
int mergesort(void *, size_t, size_t, int (*)(const void *, const void *)); |
|||
#ifdef __BLOCKS__ |
|||
int mergesort_b(void *, size_t, size_t, int (^)(const void *, const void *)); |
|||
#endif |
|||
int mkostemp(char *, int); |
|||
int mkostemps(char *, int, int); |
|||
void qsort_r(void *, size_t, size_t, void *, |
|||
int (*)(void *, const void *, const void *)); |
|||
int radixsort(const unsigned char **, int, const unsigned char *, |
|||
unsigned); |
|||
void *reallocf(void *, size_t); |
|||
int rpmatch(const char *); |
|||
void setprogname(const char *); |
|||
int sradixsort(const unsigned char **, int, const unsigned char *, |
|||
unsigned); |
|||
void sranddev(void); |
|||
void srandomdev(void); |
|||
long long |
|||
strtonum(const char *, long long, long long, const char **); |
|||
|
|||
/* Deprecated interfaces, to be removed in FreeBSD 6.0. */ |
|||
__int64_t |
|||
strtoq(const char *, char **, int); |
|||
__uint64_t |
|||
strtouq(const char *, char **, int); |
|||
|
|||
extern char *suboptarg; /* getsubopt(3) external variable */ |
|||
#endif /* __BSD_VISIBLE */ |
|||
__END_DECLS |
|||
|
|||
#endif /* !_STDLIB_H_ */ |
@ -0,0 +1,71 @@ |
|||
/*-
|
|||
* Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org> |
|||
* All rights reserved. |
|||
* |
|||
* 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. |
|||
* |
|||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. |
|||
* |
|||
* $FreeBSD$ |
|||
*/ |
|||
|
|||
#ifndef _STRINGS_H_ |
|||
#define _STRINGS_H_ |
|||
|
|||
#include <sys/cdefs.h> |
|||
#include <sys/_types.h> |
|||
|
|||
#ifndef _SIZE_T_DECLARED |
|||
typedef __size_t size_t; |
|||
#define _SIZE_T_DECLARED |
|||
#endif |
|||
|
|||
__BEGIN_DECLS |
|||
#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 |
|||
int bcmp(const void *, const void *, size_t) __pure; /* LEGACY */ |
|||
void bcopy(const void *, void *, size_t); /* LEGACY */ |
|||
void bzero(void *, size_t); /* LEGACY */ |
|||
#endif |
|||
#if __BSD_VISIBLE |
|||
void explicit_bzero(void *, size_t); |
|||
#endif |
|||
#if __XSI_VISIBLE |
|||
int ffs(int) __pure2; |
|||
#endif |
|||
#if __BSD_VISIBLE |
|||
int ffsl(long) __pure2; |
|||
int ffsll(long long) __pure2; |
|||
int fls(int) __pure2; |
|||
int flsl(long) __pure2; |
|||
int flsll(long long) __pure2; |
|||
#endif |
|||
#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 |
|||
char *index(const char *, int) __pure; /* LEGACY */ |
|||
char *rindex(const char *, int) __pure; /* LEGACY */ |
|||
#endif |
|||
int strcasecmp(const char *, const char *) __pure; |
|||
int strncasecmp(const char *, const char *, size_t) __pure; |
|||
|
|||
#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) |
|||
#include <xlocale/_strings.h> |
|||
#endif |
|||
__END_DECLS |
|||
|
|||
#endif /* _STRINGS_H_ */ |
@ -0,0 +1,49 @@ |
|||
/*-
|
|||
* Copyright (c) 1982, 1986, 1993 |
|||
* The Regents of the University of California. All rights reserved. |
|||
* |
|||
* 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. |
|||
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. |
|||
* |
|||
* @(#)time.h 8.5 (Berkeley) 5/4/95 |
|||
* from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp |
|||
* $FreeBSD$ |
|||
*/ |
|||
|
|||
#ifndef _SYS__TIMESPEC_H_ |
|||
#define _SYS__TIMESPEC_H_ |
|||
|
|||
#include <sys/_types.h> |
|||
|
|||
#ifndef _TIME_T_DECLARED |
|||
typedef __time_t time_t; |
|||
#define _TIME_T_DECLARED |
|||
#endif |
|||
|
|||
struct timespec { |
|||
time_t tv_sec; /* seconds */ |
|||
long tv_nsec; /* and nanoseconds */ |
|||
}; |
|||
|
|||
#endif /* !_SYS__TIMESPEC_H_ */ |
@ -0,0 +1,63 @@ |
|||
/*-
|
|||
* Copyright (c) 1982, 1986, 1993 |
|||
* The Regents of the University of California. All rights reserved. |
|||
* |
|||
* 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. |
|||
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. |
|||
* |
|||
* @(#)time.h 8.5 (Berkeley) 5/4/95 |
|||
* from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp |
|||
* $FreeBSD$ |
|||
*/ |
|||
|
|||
#ifndef _SYS_TIMESPEC_H_ |
|||
#define _SYS_TIMESPEC_H_ |
|||
|
|||
#include <sys/cdefs.h> |
|||
#include <sys/_timespec.h> |
|||
|
|||
#if __BSD_VISIBLE |
|||
#define TIMEVAL_TO_TIMESPEC(tv, ts) \ |
|||
do { \ |
|||
(ts)->tv_sec = (tv)->tv_sec; \ |
|||
(ts)->tv_nsec = (tv)->tv_usec * 1000; \ |
|||
} while (0) |
|||
#define TIMESPEC_TO_TIMEVAL(tv, ts) \ |
|||
do { \ |
|||
(tv)->tv_sec = (ts)->tv_sec; \ |
|||
(tv)->tv_usec = (ts)->tv_nsec / 1000; \ |
|||
} while (0) |
|||
|
|||
#endif /* __BSD_VISIBLE */ |
|||
|
|||
/*
|
|||
* Structure defined by POSIX.1b to be like a itimerval, but with |
|||
* timespecs. Used in the timer_*() system calls. |
|||
*/ |
|||
struct itimerspec { |
|||
struct timespec it_interval; |
|||
struct timespec it_value; |
|||
}; |
|||
|
|||
#endif /* _SYS_TIMESPEC_H_ */ |
@ -0,0 +1,245 @@ |
|||
/*-
|
|||
* Copyright (c) 1982, 1986, 1991, 1993, 1994 |
|||
* The Regents of the University of California. All rights reserved. |
|||
* (c) UNIX System Laboratories, Inc. |
|||
* All or some portions of this file are derived from material licensed |
|||
* to the University of California by American Telephone and Telegraph |
|||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with |
|||
* the permission of UNIX System Laboratories, Inc. |
|||
* |
|||
* 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. |
|||
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. |
|||
* |
|||
* @(#)types.h 8.6 (Berkeley) 2/19/95 |
|||
* $FreeBSD$ |
|||
*/ |
|||
|
|||
#ifndef _SYS_TYPES_H_ |
|||
#define _SYS_TYPES_H_ |
|||
|
|||
#include <sys/cdefs.h> |
|||
|
|||
/* Machine type dependent parameters. */ |
|||
#include <sys/_types.h> |
|||
|
|||
#if __BSD_VISIBLE |
|||
typedef unsigned char u_char; |
|||
typedef unsigned short u_short; |
|||
typedef unsigned int u_int; |
|||
typedef unsigned long u_long; |
|||
#ifndef _KERNEL |
|||
typedef unsigned short ushort; /* Sys V compatibility */ |
|||
typedef unsigned int uint; /* Sys V compatibility */ |
|||
#endif |
|||
#endif |
|||
|
|||
/*
|
|||
* XXX POSIX sized integrals that should appear only in <sys/stdint.h>. |
|||
*/ |
|||
#include <sys/_stdint.h> |
|||
|
|||
typedef __uint8_t u_int8_t; /* unsigned integrals (deprecated) */ |
|||
typedef __uint16_t u_int16_t; |
|||
typedef __uint32_t u_int32_t; |
|||
typedef __uint64_t u_int64_t; |
|||
|
|||
typedef __uint64_t u_quad_t; /* quads (deprecated) */ |
|||
typedef __int64_t quad_t; |
|||
typedef quad_t *qaddr_t; |
|||
|
|||
typedef char *caddr_t; /* core address */ |
|||
typedef const char *c_caddr_t; /* core address, pointer to const */ |
|||
|
|||
#ifndef _BLKSIZE_T_DECLARED |
|||
typedef __blksize_t blksize_t; |
|||
#define _BLKSIZE_T_DECLARED |
|||
#endif |
|||
|
|||
typedef __cpuwhich_t cpuwhich_t; |
|||
typedef __cpulevel_t cpulevel_t; |
|||
typedef __cpusetid_t cpusetid_t; |
|||
|
|||
#ifndef _BLKCNT_T_DECLARED |
|||
typedef __blkcnt_t blkcnt_t; |
|||
#define _BLKCNT_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _CLOCK_T_DECLARED |
|||
typedef __clock_t clock_t; |
|||
#define _CLOCK_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _CLOCKID_T_DECLARED |
|||
typedef __clockid_t clockid_t; |
|||
#define _CLOCKID_T_DECLARED |
|||
#endif |
|||
|
|||
typedef __critical_t critical_t; /* Critical section value */ |
|||
typedef __int64_t daddr_t; /* disk address */ |
|||
|
|||
#ifndef _DEV_T_DECLARED |
|||
typedef __dev_t dev_t; /* device number or struct cdev */ |
|||
#define _DEV_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _FFLAGS_T_DECLARED |
|||
typedef __fflags_t fflags_t; /* file flags */ |
|||
#define _FFLAGS_T_DECLARED |
|||
#endif |
|||
|
|||
typedef __fixpt_t fixpt_t; /* fixed point number */ |
|||
|
|||
#ifndef _FSBLKCNT_T_DECLARED /* for statvfs() */ |
|||
typedef __fsblkcnt_t fsblkcnt_t; |
|||
typedef __fsfilcnt_t fsfilcnt_t; |
|||
#define _FSBLKCNT_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _GID_T_DECLARED |
|||
typedef __gid_t gid_t; /* group id */ |
|||
#define _GID_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _IN_ADDR_T_DECLARED |
|||
typedef __uint32_t in_addr_t; /* base type for internet address */ |
|||
#define _IN_ADDR_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _IN_PORT_T_DECLARED |
|||
typedef __uint16_t in_port_t; |
|||
#define _IN_PORT_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _ID_T_DECLARED |
|||
typedef __id_t id_t; /* can hold a uid_t or pid_t */ |
|||
#define _ID_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _INO_T_DECLARED |
|||
typedef __ino_t ino_t; /* inode number */ |
|||
#define _INO_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _KEY_T_DECLARED |
|||
typedef __key_t key_t; /* IPC key (for Sys V IPC) */ |
|||
#define _KEY_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _LWPID_T_DECLARED |
|||
typedef __lwpid_t lwpid_t; /* Thread ID (a.k.a. LWP) */ |
|||
#define _LWPID_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _MODE_T_DECLARED |
|||
typedef __mode_t mode_t; /* permissions */ |
|||
#define _MODE_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _ACCMODE_T_DECLARED |
|||
typedef __accmode_t accmode_t; /* access permissions */ |
|||
#define _ACCMODE_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _NLINK_T_DECLARED |
|||
typedef __nlink_t nlink_t; /* link count */ |
|||
#define _NLINK_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _OFF_T_DECLARED |
|||
typedef __off_t off_t; /* file offset */ |
|||
#define _OFF_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _PID_T_DECLARED |
|||
typedef __pid_t pid_t; /* process id */ |
|||
#define _PID_T_DECLARED |
|||
#endif |
|||
|
|||
typedef __register_t register_t; |
|||
|
|||
#ifndef _RLIM_T_DECLARED |
|||
typedef __rlim_t rlim_t; /* resource limit */ |
|||
#define _RLIM_T_DECLARED |
|||
#endif |
|||
|
|||
typedef __int64_t sbintime_t; |
|||
|
|||
typedef __segsz_t segsz_t; /* segment size (in pages) */ |
|||
|
|||
#ifndef _SIZE_T_DECLARED |
|||
typedef __size_t size_t; |
|||
#define _SIZE_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _SSIZE_T_DECLARED |
|||
typedef __ssize_t ssize_t; |
|||
#define _SSIZE_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _SUSECONDS_T_DECLARED |
|||
typedef __suseconds_t suseconds_t; /* microseconds (signed) */ |
|||
#define _SUSECONDS_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _TIME_T_DECLARED |
|||
typedef __time_t time_t; |
|||
#define _TIME_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _TIMER_T_DECLARED |
|||
typedef __timer_t timer_t; |
|||
#define _TIMER_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _MQD_T_DECLARED |
|||
typedef __mqd_t mqd_t; |
|||
#define _MQD_T_DECLARED |
|||
#endif |
|||
|
|||
typedef __u_register_t u_register_t; |
|||
|
|||
#ifndef _UID_T_DECLARED |
|||
typedef __uid_t uid_t; /* user id */ |
|||
#define _UID_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _USECONDS_T_DECLARED |
|||
typedef __useconds_t useconds_t; /* microseconds (unsigned) */ |
|||
#define _USECONDS_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _CAP_RIGHTS_T_DECLARED |
|||
#define _CAP_RIGHTS_T_DECLARED |
|||
struct cap_rights; |
|||
|
|||
typedef struct cap_rights cap_rights_t; |
|||
#endif |
|||
|
|||
typedef __vm_offset_t vm_offset_t; |
|||
typedef __vm_ooffset_t vm_ooffset_t; |
|||
typedef __vm_paddr_t vm_paddr_t; |
|||
typedef __vm_pindex_t vm_pindex_t; |
|||
typedef __vm_size_t vm_size_t; |
|||
|
|||
#endif /* !_SYS_TYPES_H_ */ |
@ -0,0 +1,204 @@ |
|||
/*
|
|||
* Copyright (c) 1989, 1993 |
|||
* The Regents of the University of California. All rights reserved. |
|||
* (c) UNIX System Laboratories, Inc. |
|||
* All or some portions of this file are derived from material licensed |
|||
* to the University of California by American Telephone and Telegraph |
|||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with |
|||
* the permission of UNIX System Laboratories, Inc. |
|||
* |
|||
* 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. Neither the name of the University 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 REGENTS 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 REGENTS 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. |
|||
* |
|||
* @(#)time.h 8.3 (Berkeley) 1/21/94 |
|||
*/ |
|||
|
|||
/*
|
|||
* $FreeBSD$ |
|||
*/ |
|||
|
|||
#ifndef _TIME_H_ |
|||
#define _TIME_H_ |
|||
|
|||
#include <sys/cdefs.h> |
|||
#include <sys/_null.h> |
|||
#include <sys/_types.h> |
|||
|
|||
#if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE |
|||
/*
|
|||
* Frequency of the clock ticks reported by times(). Deprecated - use |
|||
* sysconf(_SC_CLK_TCK) instead. (Removed in 1003.1-2001.) |
|||
*/ |
|||
#define CLK_TCK 128 |
|||
#endif |
|||
|
|||
/* Frequency of the clock ticks reported by clock(). */ |
|||
#define CLOCKS_PER_SEC 128 |
|||
|
|||
#ifndef _CLOCK_T_DECLARED |
|||
typedef __clock_t clock_t; |
|||
#define _CLOCK_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _TIME_T_DECLARED |
|||
typedef __time_t time_t; |
|||
#define _TIME_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _SIZE_T_DECLARED |
|||
typedef __size_t size_t; |
|||
#define _SIZE_T_DECLARED |
|||
#endif |
|||
|
|||
#if __POSIX_VISIBLE >= 199309 |
|||
/*
|
|||
* New in POSIX 1003.1b-1993. |
|||
*/ |
|||
#ifndef _CLOCKID_T_DECLARED |
|||
typedef __clockid_t clockid_t; |
|||
#define _CLOCKID_T_DECLARED |
|||
#endif |
|||
|
|||
#ifndef _TIMER_T_DECLARED |
|||
typedef __timer_t timer_t; |
|||
#define _TIMER_T_DECLARED |
|||
#endif |
|||
|
|||
#include <sys/timespec.h> |
|||
#endif /* __POSIX_VISIBLE >= 199309 */ |
|||
|
|||
#if __POSIX_VISIBLE >= 200112 |
|||
#ifndef _PID_T_DECLARED |
|||
typedef __pid_t pid_t; |
|||
#define _PID_T_DECLARED |
|||
#endif |
|||
#endif |
|||
|
|||
/* These macros are also in sys/time.h. */ |
|||
#if !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 |
|||
#define CLOCK_REALTIME 0 |
|||
#ifdef __BSD_VISIBLE |
|||
#define CLOCK_VIRTUAL 1 |
|||
#define CLOCK_PROF 2 |
|||
#endif |
|||
#define CLOCK_MONOTONIC 4 |
|||
#define CLOCK_UPTIME 5 /* FreeBSD-specific. */ |
|||
#define CLOCK_UPTIME_PRECISE 7 /* FreeBSD-specific. */ |
|||
#define CLOCK_UPTIME_FAST 8 /* FreeBSD-specific. */ |
|||
#define CLOCK_REALTIME_PRECISE 9 /* FreeBSD-specific. */ |
|||
#define CLOCK_REALTIME_FAST 10 /* FreeBSD-specific. */ |
|||
#define CLOCK_MONOTONIC_PRECISE 11 /* FreeBSD-specific. */ |
|||
#define CLOCK_MONOTONIC_FAST 12 /* FreeBSD-specific. */ |
|||
#define CLOCK_SECOND 13 /* FreeBSD-specific. */ |
|||
#define CLOCK_THREAD_CPUTIME_ID 14 |
|||
#define CLOCK_PROCESS_CPUTIME_ID 15 |
|||
#endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 */ |
|||
|
|||
#if !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112 |
|||
#if __BSD_VISIBLE |
|||
#define TIMER_RELTIME 0x0 /* relative timer */ |
|||
#endif |
|||
#define TIMER_ABSTIME 0x1 /* absolute timer */ |
|||
#endif /* !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112 */ |
|||
|
|||
struct tm { |
|||
int tm_sec; /* seconds after the minute [0-60] */ |
|||
int tm_min; /* minutes after the hour [0-59] */ |
|||
int tm_hour; /* hours since midnight [0-23] */ |
|||
int tm_mday; /* day of the month [1-31] */ |
|||
int tm_mon; /* months since January [0-11] */ |
|||
int tm_year; /* years since 1900 */ |
|||
int tm_wday; /* days since Sunday [0-6] */ |
|||
int tm_yday; /* days since January 1 [0-365] */ |
|||
int tm_isdst; /* Daylight Savings Time flag */ |
|||
long tm_gmtoff; /* offset from UTC in seconds */ |
|||
char *tm_zone; /* timezone abbreviation */ |
|||
}; |
|||
|
|||
#if __POSIX_VISIBLE |
|||
extern char *tzname[]; |
|||
#endif |
|||
|
|||
__BEGIN_DECLS |
|||
char *asctime(const struct tm *); |
|||
clock_t clock(void); |
|||
char *ctime(const time_t *); |
|||
double difftime(time_t, time_t); |
|||
/* XXX missing: getdate() */ |
|||
struct tm *gmtime(const time_t *); |
|||
struct tm *localtime(const time_t *); |
|||
time_t mktime(struct tm *); |
|||
size_t strftime(char *__restrict, size_t, const char *__restrict, |
|||
const struct tm *__restrict); |
|||
time_t time(time_t *); |
|||
#if __POSIX_VISIBLE >= 200112 |
|||
struct sigevent; |
|||
int timer_create(clockid_t, struct sigevent *__restrict, timer_t *__restrict); |
|||
int timer_delete(timer_t); |
|||
int timer_gettime(timer_t, struct itimerspec *); |
|||
int timer_getoverrun(timer_t); |
|||
int timer_settime(timer_t, int, const struct itimerspec *__restrict, |
|||
struct itimerspec *__restrict); |
|||
#endif |
|||
#if __POSIX_VISIBLE |
|||
void tzset(void); |
|||
#endif |
|||
|
|||
#if __POSIX_VISIBLE >= 199309 |
|||
int clock_getres(clockid_t, struct timespec *); |
|||
int clock_gettime(clockid_t, struct timespec *); |
|||
int clock_settime(clockid_t, const struct timespec *); |
|||
/* XXX missing: clock_nanosleep() */ |
|||
int nanosleep(const struct timespec *, struct timespec *); |
|||
#endif /* __POSIX_VISIBLE >= 199309 */ |
|||
|
|||
#if __POSIX_VISIBLE >= 200112 |
|||
int clock_getcpuclockid(pid_t, clockid_t *); |
|||
#endif |
|||
|
|||
#if __POSIX_VISIBLE >= 199506 |
|||
char *asctime_r(const struct tm *, char *); |
|||
char *ctime_r(const time_t *, char *); |
|||
struct tm *gmtime_r(const time_t *, struct tm *); |
|||
struct tm *localtime_r(const time_t *, struct tm *); |
|||
#endif |
|||
|
|||
#if __XSI_VISIBLE |
|||
char *strptime(const char *__restrict, const char *__restrict, |
|||
struct tm *__restrict); |
|||
#endif |
|||
|
|||
#if __BSD_VISIBLE |
|||
char *timezone(int, int); /* XXX XSI conflict */ |
|||
void tzsetwall(void); |
|||
time_t timelocal(struct tm * const); |
|||
time_t timegm(struct tm * const); |
|||
#endif /* __BSD_VISIBLE */ |
|||
|
|||
#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) |
|||
#include <xlocale/_time.h> |
|||
#endif |
|||
__END_DECLS |
|||
|
|||
#endif /* !_TIME_H_ */ |
@ -0,0 +1,48 @@ |
|||
/*-
|
|||
* Copyright (c) 2011, 2012 The FreeBSD Foundation |
|||
* All rights reserved. |
|||
* |
|||
* 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. |
|||
* |
|||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. |
|||
* |
|||
* $FreeBSD$ |
|||
*/ |
|||
|
|||
#ifndef _LOCALE_T_DEFINED |
|||
#define _LOCALE_T_DEFINED |
|||
typedef struct _xlocale *locale_t; |
|||
#endif |
|||
|
|||
/*
|
|||
* This file is included from both strings.h and xlocale.h. We need to expose |
|||
* the declarations unconditionally if we are included from xlocale.h, but only |
|||
* if we are in POSIX2008 mode if included from string.h. |
|||
*/ |
|||
|
|||
#ifndef _XLOCALE_STRINGS1_H |
|||
#define _XLOCALE_STRINGS1_H |
|||
|
|||
/*
|
|||
* POSIX2008 functions |
|||
*/ |
|||
int strcasecmp_l(const char *, const char *, locale_t); |
|||
int strncasecmp_l(const char *, const char *, size_t, locale_t); |
|||
#endif /* _XLOCALE_STRINGS1_H */ |
@ -0,0 +1,58 @@ |
|||
/*-
|
|||
* Copyright (c) 2011, 2012 The FreeBSD Foundation |
|||
* All rights reserved. |
|||
* |
|||
* This software was developed by David Chisnall under sponsorship from |
|||
* the FreeBSD Foundation. |
|||
* |
|||
* 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. |
|||
* |
|||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. |
|||
* |
|||
* $FreeBSD$ |
|||
*/ |
|||
|
|||
#ifndef _LOCALE_T_DEFINED |
|||
#define _LOCALE_T_DEFINED |
|||
typedef struct _xlocale *locale_t; |
|||
#endif |
|||
|
|||
/*
|
|||
* This file is included from both locale.h and xlocale.h. We need to expose |
|||
* the declarations unconditionally if we are included from xlocale.h, but only |
|||
* if we are in POSIX2008 mode if included from locale.h. |
|||
*/ |
|||
#ifndef _XLOCALE_LOCALE1_H |
|||
#define _XLOCALE_LOCALE1_H |
|||
|
|||
size_t strftime_l(char *__restrict, size_t, const char *__restrict, |
|||
const struct tm *__restrict, locale_t) __strftimelike(3, 0); |
|||
|
|||
#endif /* _XLOCALE_LOCALE1_H */ |
|||
|
|||
#ifdef _XLOCALE_H_ |
|||
#ifndef _XLOCALE_LOCALE2_H |
|||
#define _XLOCALE_LOCALE2_H |
|||
|
|||
char *strptime_l(const char *__restrict, const char *__restrict, |
|||
struct tm *__restrict, locale_t); |
|||
|
|||
#endif /* _XLOCALE_LOCALE2_H */ |
|||
#endif /* _XLOCALE_H_ */ |
@ -0,0 +1,37 @@ |
|||
/*
|
|||
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. |
|||
* |
|||
* Redistribution and use in source and binary forms, with or without |
|||
* modification, are permitted provided that the following conditions are met: |
|||
* |
|||
* Redistributions of source code must retain the above copyright notice, this |
|||
* list of conditions and the following disclaimer. |
|||
* |
|||
* 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. |
|||
* |
|||
* Neither the name of ARM 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 HOLDER 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 <debug.h> |
|||
|
|||
void exit(int v) |
|||
{ |
|||
ERROR("EXIT\n"); |
|||
panic(); |
|||
} |
@ -0,0 +1,50 @@ |
|||
/*
|
|||
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. |
|||
* |
|||
* Redistribution and use in source and binary forms, with or without |
|||
* modification, are permitted provided that the following conditions are met: |
|||
* |
|||
* Redistributions of source code must retain the above copyright notice, this |
|||
* list of conditions and the following disclaimer. |
|||
* |
|||
* 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. |
|||
* |
|||
* Neither the name of ARM 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 HOLDER 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/cdefs.h> |
|||
|
|||
/*
|
|||
* TODO: This is not a real implementation of the sscanf() function. It just |
|||
* returns the number of expected arguments based on the number of '%' found |
|||
* in the format string. |
|||
*/ |
|||
int |
|||
sscanf(const char *__restrict str, char const *__restrict fmt, ...) |
|||
{ |
|||
int ret = 0; |
|||
|
|||
while (*fmt != '\0') { |
|||
if (*fmt++ == '%') { |
|||
ret++; |
|||
} |
|||
} |
|||
|
|||
return ret; |
|||
} |
Loading…
Reference in new issue