am ffe06880: am f1258672: Merge "Fix <sys/select.h> for LP64, clean up <time.h>."

* commit 'ffe068808909c9825807dbaf8679b9f9efc2c690':
  Fix <sys/select.h> for LP64, clean up <time.h>.
This commit is contained in:
Elliott Hughes 2013-11-05 14:01:49 -08:00 committed by Android Git Automerger
commit c76ba85e16
3 changed files with 79 additions and 94 deletions

View File

@ -25,6 +25,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _SYS_SELECT_H_
#define _SYS_SELECT_H_
@ -36,35 +37,35 @@
__BEGIN_DECLS
#define __FD_SETSIZE 1024
#define __NFDBITS (8 * sizeof(unsigned long))
#define __FDSET_LONGS (__FD_SETSIZE/__NFDBITS)
#define FD_SETSIZE 1024
#define NFDBITS (8 * sizeof(unsigned long))
#define __FDSET_LONGS (FD_SETSIZE/NFDBITS)
typedef struct {
unsigned long fds_bits[__FDSET_LONGS];
} fd_set;
#define __FDELT(fd) ((fd) / __NFDBITS)
#define __FDMASK(fd) (1UL << ((fd) % __NFDBITS))
#define __FDELT(fd) ((fd) / NFDBITS)
#define __FDMASK(fd) (1UL << ((fd) % NFDBITS))
#define __FDS_BITS(set) (((fd_set*)(set))->fds_bits)
#define __FD_ZERO(set) (memset(set, 0, sizeof(*(fd_set*)(set))))
#define FD_ZERO(set) (memset(set, 0, sizeof(*(fd_set*)(set))))
#if defined(__BIONIC_FORTIFY)
extern void __FD_CLR_chk(int, fd_set*, size_t);
extern void __FD_SET_chk(int, fd_set*, size_t);
extern int __FD_ISSET_chk(int, fd_set*, size_t);
#define __FD_CLR(fd, set) __FD_CLR_chk(fd, set, __bos(set))
#define __FD_SET(fd, set) __FD_SET_chk(fd, set, __bos(set))
#define __FD_ISSET(fd, set) __FD_ISSET_chk(fd, set, __bos(set))
#define FD_CLR(fd, set) __FD_CLR_chk(fd, set, __bos(set))
#define FD_SET(fd, set) __FD_SET_chk(fd, set, __bos(set))
#define FD_ISSET(fd, set) __FD_ISSET_chk(fd, set, __bos(set))
#else
#define __FD_CLR(fd, set) (__FDS_BITS(set)[__FDELT(fd)] &= ~__FDMASK(fd))
#define __FD_SET(fd, set) (__FDS_BITS(set)[__FDELT(fd)] |= __FDMASK(fd))
#define __FD_ISSET(fd, set) ((__FDS_BITS(set)[__FDELT(fd)] & __FDMASK(fd)) != 0)
#define FD_CLR(fd, set) (__FDS_BITS(set)[__FDELT(fd)] &= ~__FDMASK(fd))
#define FD_SET(fd, set) (__FDS_BITS(set)[__FDELT(fd)] |= __FDMASK(fd))
#define FD_ISSET(fd, set) ((__FDS_BITS(set)[__FDELT(fd)] & __FDMASK(fd)) != 0)
#endif /* defined(__BIONIC_FORTIFY) */
extern int select(int, fd_set*, fd_set*, fd_set*, struct timeval*);
extern int pselect(int n, fd_set* read_fds, fd_set* write_fds, fd_set* err_fds,
const struct timespec * timeout, const sigset_t* sigmask);
extern int pselect(int, fd_set*, fd_set*, fd_set*, const struct timespec*, const sigset_t*);
__END_DECLS

View File

@ -25,99 +25,82 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _TIME_H_
#define _TIME_H_
#include <sys/cdefs.h>
#include <sys/time.h>
/* For struct sigevent. */
#define __ARCH_SI_UID_T __kernel_uid32_t
#include <asm/siginfo.h>
#undef __ARCH_SI_UID_T
__BEGIN_DECLS
extern time_t time(time_t *);
extern int nanosleep(const struct timespec *, struct timespec *);
#define CLOCKS_PER_SEC 1000000
extern char *strtotimeval(const char *str, struct timeval *tv);
extern char* tzname[];
extern int daylight;
extern long int timezone;
struct tm {
int tm_sec; /* seconds */
int tm_min; /* minutes */
int tm_hour; /* hours */
int tm_mday; /* day of the month */
int tm_mon; /* month */
int tm_year; /* year */
int tm_wday; /* day of the week */
int tm_yday; /* day in the year */
int tm_isdst; /* daylight saving time */
long int tm_gmtoff; /* Seconds east of UTC. */
const char *tm_zone; /* Timezone abbreviation. */
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
long int tm_gmtoff;
const char* tm_zone;
};
/* defining TM_ZONE indicates that we have a "timezone abbreviation" field in
* struct tm, the value should be the field name
*/
#define TM_ZONE tm_zone
#define TM_ZONE tm_zone
extern char* asctime(const struct tm* a);
extern char* asctime_r(const struct tm* a, char* buf);
extern time_t time(time_t*);
extern int nanosleep(const struct timespec*, struct timespec*);
/* Return the difference between TIME1 and TIME0. */
extern double difftime (time_t __time1, time_t __time0);
extern time_t mktime (struct tm *a);
extern char* strtotimeval(const char*, struct timeval*);
extern struct tm* localtime(const time_t *t);
extern struct tm* localtime_r(const time_t *timep, struct tm *result);
extern char* asctime(const struct tm*);
extern char* asctime_r(const struct tm*, char*);
extern struct tm* gmtime(const time_t *timep);
extern struct tm* gmtime_r(const time_t *timep, struct tm *result);
extern double difftime(time_t, time_t);
extern time_t mktime(struct tm*);
extern char* strptime(const char *buf, const char *fmt, struct tm *tm);
extern size_t strftime(char *s, size_t max, const char *format, const struct tm *tm);
extern struct tm* localtime(const time_t*);
extern struct tm* localtime_r(const time_t*, struct tm*);
extern char *ctime(const time_t *timep);
extern char *ctime_r(const time_t *timep, char *buf);
extern struct tm* gmtime(const time_t*);
extern struct tm* gmtime_r(const time_t*, struct tm*);
extern void tzset(void);
extern char* strptime(const char*, const char*, struct tm*);
extern size_t strftime(char*, size_t, const char*, const struct tm*);
/* global includes */
extern char* tzname[];
extern int daylight;
extern long int timezone;
extern char* ctime(const time_t*);
extern char* ctime_r(const time_t*, char*);
#define CLOCKS_PER_SEC 1000000
extern void tzset(void);
extern clock_t clock(void);
extern clock_t clock(void);
/* BIONIC: extra linux clock goodies */
extern int clock_getres(int, struct timespec *);
extern int clock_gettime(int, struct timespec *);
extern int clock_getres(int, struct timespec*);
extern int clock_gettime(int, struct timespec*);
#define CLOCK_REALTIME 0
#define CLOCK_MONOTONIC 1
#define CLOCK_PROCESS_CPUTIME_ID 2
#define CLOCK_THREAD_CPUTIME_ID 3
#define CLOCK_MONOTONIC_RAW 4
#define CLOCK_REALTIME_COARSE 5
#define CLOCK_MONOTONIC_COARSE 6
#define CLOCK_BOOTTIME 7
#define CLOCK_REALTIME_ALARM 8
#define CLOCK_BOOTTIME_ALARM 9
extern int timer_create(int, struct sigevent*, timer_t*);
extern int timer_delete(timer_t);
extern int timer_settime(timer_t, int, const struct itimerspec*, struct itimerspec*);
extern int timer_gettime(timer_t, struct itimerspec*);
extern int timer_getoverrun(timer_t);
extern int timer_create(int, struct sigevent*, timer_t*);
extern int timer_delete(timer_t);
extern int timer_settime(timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue);
extern int timer_gettime(timer_t timerid, struct itimerspec *value);
extern int timer_getoverrun(timer_t timerid);
extern time_t timelocal(struct tm *tm);
extern time_t timegm(struct tm* tm);
extern time_t time2posix(time_t ti);
extern time_t posix2time(time_t ti);
extern time_t timelocal(struct tm*);
extern time_t timegm(struct tm*);
extern time_t time2posix(time_t);
extern time_t posix2time(time_t);
__END_DECLS

View File

@ -16,59 +16,60 @@
***
****************************************************************************
****************************************************************************/
#ifndef _LINUX_TIME_H
#define _LINUX_TIME_H
#ifndef _UAPI_LINUX_TIME_H
#define _UAPI_LINUX_TIME_H
#include <linux/types.h>
#ifndef _STRUCT_TIMESPEC
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define _STRUCT_TIMESPEC
struct timespec {
time_t tv_sec;
__kernel_time_t tv_sec;
long tv_nsec;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
#endif
struct timeval {
time_t tv_sec;
__kernel_time_t tv_sec;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
suseconds_t tv_usec;
__kernel_suseconds_t tv_usec;
};
struct timezone {
int tz_minuteswest;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
int tz_dsttime;
};
#define NFDBITS __NFDBITS
#define FD_SETSIZE __FD_SETSIZE
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FD_SET(fd,fdsetp) __FD_SET(fd,fdsetp)
#define FD_CLR(fd,fdsetp) __FD_CLR(fd,fdsetp)
#define FD_ISSET(fd,fdsetp) __FD_ISSET(fd,fdsetp)
#define FD_ZERO(fdsetp) __FD_ZERO(fdsetp)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ITIMER_REAL 0
#define ITIMER_VIRTUAL 1
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ITIMER_PROF 2
struct itimerspec {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct timespec it_interval;
struct timespec it_value;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
struct itimerval {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct timeval it_interval;
struct timeval it_value;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
#define CLOCK_REALTIME 0
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define CLOCK_MONOTONIC 1
#define CLOCK_PROCESS_CPUTIME_ID 2
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define CLOCK_THREAD_CPUTIME_ID 3
#define CLOCK_MONOTONIC_RAW 4
#define CLOCK_REALTIME_COARSE 5
#define CLOCK_MONOTONIC_COARSE 6
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define CLOCK_BOOTTIME 7
#define CLOCK_REALTIME_ALARM 8
#define CLOCK_BOOTTIME_ALARM 9
#define CLOCK_SGI_CYCLE 10
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define CLOCK_TAI 11
#define MAX_CLOCKS 16
#define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC)
#define CLOCKS_MONO CLOCK_MONOTONIC
#define TIMER_ABSTIME 0x01
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define TIMER_ABSTIME 0x01
#endif