changed system-calls to avoid namespace pollution
This commit is contained in:
parent
0ab62357ce
commit
37c64c6e36
4 changed files with 13 additions and 12 deletions
|
@ -34,7 +34,7 @@ struct rusage {
|
||||||
long ru_nivcsw; /* involuntary context switches */
|
long ru_nivcsw; /* involuntary context switches */
|
||||||
};
|
};
|
||||||
|
|
||||||
void getrusage(int who, struct rusage *rusage);
|
void _getrusage(int who, struct rusage *rusage);
|
||||||
|
|
||||||
#elif defined(_POSIX_SOURCE) || defined(__USG)
|
#elif defined(_POSIX_SOURCE) || defined(__USG)
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ struct tms {
|
||||||
time_t tms_cstime; /* system time, children */
|
time_t tms_cstime; /* system time, children */
|
||||||
};
|
};
|
||||||
|
|
||||||
long times(struct tms *buffer);
|
long _times(struct tms *buffer);
|
||||||
|
|
||||||
#else /* Version 7 UNIX */
|
#else /* Version 7 UNIX */
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ struct tbuffer {
|
||||||
long child_system_time;
|
long child_system_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
long times(struct tbuffer *buffer);
|
long _times(struct tbuffer *buffer);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -66,20 +66,20 @@ clock(void)
|
||||||
#if defined(__BSD4_2)
|
#if defined(__BSD4_2)
|
||||||
struct rusage rusage;
|
struct rusage rusage;
|
||||||
|
|
||||||
getrusage(RUSAGE_SELF, &rusage);
|
_getrusage(RUSAGE_SELF, &rusage);
|
||||||
|
|
||||||
return (((unsigned long)rusage.ru_utime.tv_sec * CLOCKS_PER_SEC)
|
return (((unsigned long)rusage.ru_utime.tv_sec * CLOCKS_PER_SEC)
|
||||||
+ rusage.ru_utime.tv_usec);
|
+ rusage.ru_utime.tv_usec);
|
||||||
#elif defined(_POSIX_SOURCE) || defined(__USG)
|
#elif defined(_POSIX_SOURCE) || defined(__USG)
|
||||||
struct tms tms;
|
struct tms tms;
|
||||||
|
|
||||||
times(&tms);
|
_times(&tms);
|
||||||
/* Assume that time_t can be converted to clock_t for Sys5 */
|
/* Assume that time_t can be converted to clock_t for Sys5 */
|
||||||
return tms.tms_utime;
|
return tms.tms_utime;
|
||||||
#else
|
#else
|
||||||
struct tbuffer tbuffer;
|
struct tbuffer tbuffer;
|
||||||
|
|
||||||
times(&tbuffer);
|
_times(&tbuffer);
|
||||||
return tbuffer.proc_user_time;
|
return tbuffer.proc_user_time;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
double
|
double
|
||||||
difftime(time_t time1, time_t time0)
|
difftime(time_t time1, time_t time0)
|
||||||
{
|
{
|
||||||
|
/* be careful: time_t is unsigned */
|
||||||
if (time0 > time1)
|
if (time0 > time1)
|
||||||
return - (double) (time0 - time1);
|
return - (double) (time0 - time1);
|
||||||
else return (double) (time1 - time0);
|
else return (double) (time1 - time0);
|
||||||
|
|
|
@ -20,7 +20,7 @@ struct timezone {
|
||||||
int tz_dsttime; /* type of dst correction */
|
int tz_dsttime; /* type of dst correction */
|
||||||
};
|
};
|
||||||
|
|
||||||
int gettimeofday(struct timeval *tp, struct timezone *tzp);
|
int _gettimeofday(struct timeval *tp, struct timezone *tzp);
|
||||||
|
|
||||||
#elif !defined(_POSIX_SOURCE) && !defined(__USG)
|
#elif !defined(_POSIX_SOURCE) && !defined(__USG)
|
||||||
#if !defined(_MINIX) /* MINIX has no ftime() */
|
#if !defined(_MINIX) /* MINIX has no ftime() */
|
||||||
|
@ -30,7 +30,7 @@ struct timeb {
|
||||||
short timezone;
|
short timezone;
|
||||||
short dstflag;
|
short dstflag;
|
||||||
};
|
};
|
||||||
void ftime(struct timeb *bp);
|
void _ftime(struct timeb *bp);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ _tzset(void)
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
struct timezone tz;
|
struct timezone tz;
|
||||||
|
|
||||||
gettimeofday(&tv, &tz);
|
_gettimeofday(&tv, &tz);
|
||||||
_daylight = tz.tz_dsttime;
|
_daylight = tz.tz_dsttime;
|
||||||
_timezone = tz.tz_minuteswest * 60;
|
_timezone = tz.tz_minuteswest * 60;
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ _tzset(void)
|
||||||
#if !defined(_MINIX) /* MINIX has no ftime() */
|
#if !defined(_MINIX) /* MINIX has no ftime() */
|
||||||
struct timeb time;
|
struct timeb time;
|
||||||
|
|
||||||
ftime(&time);
|
_ftime(&time);
|
||||||
_timezone = time.timezone * 60L;
|
_timezone = time.timezone * 60L;
|
||||||
_daylight = time.dstflag;
|
_daylight = time.dstflag;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,14 +19,14 @@ struct timezone {
|
||||||
int tz_dsttime; /* type of dst correction */
|
int tz_dsttime; /* type of dst correction */
|
||||||
};
|
};
|
||||||
|
|
||||||
int gettimeofday(struct timeval *tp, struct timezone *tzp);
|
int _gettimeofday(struct timeval *tp, struct timezone *tzp);
|
||||||
|
|
||||||
time_t
|
time_t
|
||||||
time(time_t *timer)
|
time(time_t *timer)
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
struct timezone tz;
|
struct timezone tz;
|
||||||
gettimeofday(&tv, &tz);
|
_gettimeofday(&tv, &tz);
|
||||||
|
|
||||||
if (timer) *timer = tv.tv_sec;
|
if (timer) *timer = tv.tv_sec;
|
||||||
return tv.tv_sec;
|
return tv.tv_sec;
|
||||||
|
|
Loading…
Reference in a new issue