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

* commit 'c76ba85e166fa98baf44102894471c483f134c17':
  Fix <sys/select.h> for LP64, clean up <time.h>.
This commit is contained in:
Elliott Hughes 2013-11-05 14:24:21 -08:00 committed by Android Git Automerger
commit fdbbcc2fab
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 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#ifndef _SYS_SELECT_H_ #ifndef _SYS_SELECT_H_
#define _SYS_SELECT_H_ #define _SYS_SELECT_H_
@ -36,35 +37,35 @@
__BEGIN_DECLS __BEGIN_DECLS
#define __FD_SETSIZE 1024 #define FD_SETSIZE 1024
#define __NFDBITS (8 * sizeof(unsigned long)) #define NFDBITS (8 * sizeof(unsigned long))
#define __FDSET_LONGS (__FD_SETSIZE/__NFDBITS) #define __FDSET_LONGS (FD_SETSIZE/NFDBITS)
typedef struct { typedef struct {
unsigned long fds_bits[__FDSET_LONGS]; unsigned long fds_bits[__FDSET_LONGS];
} fd_set; } fd_set;
#define __FDELT(fd) ((fd) / __NFDBITS) #define __FDELT(fd) ((fd) / NFDBITS)
#define __FDMASK(fd) (1UL << ((fd) % __NFDBITS)) #define __FDMASK(fd) (1UL << ((fd) % NFDBITS))
#define __FDS_BITS(set) (((fd_set*)(set))->fds_bits) #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) #if defined(__BIONIC_FORTIFY)
extern void __FD_CLR_chk(int, fd_set*, size_t); extern void __FD_CLR_chk(int, fd_set*, size_t);
extern void __FD_SET_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); extern int __FD_ISSET_chk(int, fd_set*, size_t);
#define __FD_CLR(fd, set) __FD_CLR_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_SET(fd, set) __FD_SET_chk(fd, set, __bos(set))
#define __FD_ISSET(fd, set) __FD_ISSET_chk(fd, set, __bos(set)) #define FD_ISSET(fd, set) __FD_ISSET_chk(fd, set, __bos(set))
#else #else
#define __FD_CLR(fd, set) (__FDS_BITS(set)[__FDELT(fd)] &= ~__FDMASK(fd)) #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_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_ISSET(fd, set) ((__FDS_BITS(set)[__FDELT(fd)] & __FDMASK(fd)) != 0)
#endif /* defined(__BIONIC_FORTIFY) */ #endif /* defined(__BIONIC_FORTIFY) */
extern int select(int, fd_set*, fd_set*, fd_set*, struct timeval*); 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, extern int pselect(int, fd_set*, fd_set*, fd_set*, const struct timespec*, const sigset_t*);
const struct timespec * timeout, const sigset_t* sigmask);
__END_DECLS __END_DECLS

View File

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

View File

@ -16,59 +16,60 @@
*** ***
**************************************************************************** ****************************************************************************
****************************************************************************/ ****************************************************************************/
#ifndef _LINUX_TIME_H #ifndef _UAPI_LINUX_TIME_H
#define _LINUX_TIME_H #define _UAPI_LINUX_TIME_H
#include <linux/types.h> #include <linux/types.h>
#ifndef _STRUCT_TIMESPEC #ifndef _STRUCT_TIMESPEC
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define _STRUCT_TIMESPEC #define _STRUCT_TIMESPEC
struct timespec { struct timespec {
time_t tv_sec; __kernel_time_t tv_sec;
long tv_nsec; long tv_nsec;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
}; };
#endif #endif
struct timeval { struct timeval {
time_t tv_sec; __kernel_time_t tv_sec;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
suseconds_t tv_usec; __kernel_suseconds_t tv_usec;
}; };
struct timezone { struct timezone {
int tz_minuteswest; int tz_minuteswest;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
int tz_dsttime; 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_REAL 0
#define ITIMER_VIRTUAL 1 #define ITIMER_VIRTUAL 1
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ITIMER_PROF 2 #define ITIMER_PROF 2
struct itimerspec { struct itimerspec {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct timespec it_interval; struct timespec it_interval;
struct timespec it_value; struct timespec it_value;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
}; };
struct itimerval { struct itimerval {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct timeval it_interval; struct timeval it_interval;
struct timeval it_value; struct timeval it_value;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
}; };
#define CLOCK_REALTIME 0 #define CLOCK_REALTIME 0
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define CLOCK_MONOTONIC 1 #define CLOCK_MONOTONIC 1
#define CLOCK_PROCESS_CPUTIME_ID 2 #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_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 #define CLOCK_SGI_CYCLE 10
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define CLOCK_TAI 11
#define MAX_CLOCKS 16 #define MAX_CLOCKS 16
#define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC) #define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC)
#define CLOCKS_MONO CLOCK_MONOTONIC #define CLOCKS_MONO CLOCK_MONOTONIC
#define TIMER_ABSTIME 0x01
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define TIMER_ABSTIME 0x01
#endif #endif