121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes/*
221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * Copyright (C) 2017 The Android Open Source Project
321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * All rights reserved.
421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes *
521b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * Redistribution and use in source and binary forms, with or without
621b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * modification, are permitted provided that the following conditions
721b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * are met:
821b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes *  * Redistributions of source code must retain the above copyright
921b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes *    notice, this list of conditions and the following disclaimer.
1021b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes *  * Redistributions in binary form must reproduce the above copyright
1121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes *    notice, this list of conditions and the following disclaimer in
1221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes *    the documentation and/or other materials provided with the
1321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes *    distribution.
1421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes *
1521b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1621b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1721b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
1821b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1921b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2021b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
2221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
2321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
2521b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2621b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * SUCH DAMAGE.
2721b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes */
2821b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
2921b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#include <sys/time.h>
3021b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
3121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#include "header_checks.h"
3221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
3321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughesstatic void sys_time_h() {
3421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  TYPE(struct timeval);
3521b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  STRUCT_MEMBER(struct timeval, time_t, tv_sec);
3621b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  STRUCT_MEMBER(struct timeval, suseconds_t, tv_usec);
3721b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
3821b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  TYPE(struct itimerval);
3921b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  STRUCT_MEMBER(struct itimerval, struct timeval, it_interval);
4021b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  STRUCT_MEMBER(struct itimerval, struct timeval, it_value);
4121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
4221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  TYPE(time_t);
4321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  TYPE(suseconds_t);
4421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
4521b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  TYPE(fd_set);
4621b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
4721b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  MACRO(ITIMER_REAL);
4821b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  MACRO(ITIMER_VIRTUAL);
4921b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  MACRO(ITIMER_PROF);
5021b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
5121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#if !defined(FD_CLR)
5221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#error FD_CLR
5321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#endif
5421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#if !defined(FD_ISSET)
5521b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#error FD_ISSET
5621b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#endif
5721b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#if !defined(FD_SET)
5821b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#error FD_SET
5921b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#endif
6021b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#if !defined(FD_ZERO)
6121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#error FD_ZERO
6221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#endif
6321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  MACRO(FD_SETSIZE);
6421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
6521b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(getitimer, int (*f)(int, struct itimerval*));
6621b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#if defined(__BIONIC__)
6721b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(gettimeofday, int (*f)(struct timeval*, struct timezone*));
6821b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#else
6921b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(gettimeofday, int (*f)(struct timeval*, void*));
7021b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#endif
7121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(setitimer, int (*f)(int, const struct itimerval*, struct itimerval*));
7221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(select, int (*f)(int, fd_set*, fd_set*, fd_set*, struct timeval*));
7321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(utimes, int (*f)(const char*, const struct timeval[2]));
7421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes}
75