These functions are alpha specifc, rename them to be clear.
Let's also rename the header file from tv32-compat.h to
alpha-tv32-compat.h. This is to avoid conflicts with the one we will
introduce later.
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
overflow, they write { INT32_MAX, TV_USEC_MAX } to the output. */
static inline struct timeval
-valid_timeval32_to_timeval (const struct timeval32 tv)
+alpha_valid_timeval32_to_timeval (const struct timeval32 tv)
{
return (struct timeval) { tv.tv_sec, tv.tv_usec };
}
static inline struct timeval32
-valid_timeval_to_timeval32 (const struct timeval tv64)
+alpha_valid_timeval_to_timeval32 (const struct timeval tv64)
{
if (__glibc_unlikely (tv64.tv_sec > (time_t) INT32_MAX))
return (struct timeval32) { INT32_MAX, TV_USEC_MAX};
}
static inline struct timespec
-valid_timeval32_to_timespec (const struct timeval32 tv)
+alpha_valid_timeval32_to_timespec (const struct timeval32 tv)
{
return (struct timespec) { tv.tv_sec, tv.tv_usec * 1000 };
}
static inline struct timeval32
-valid_timespec_to_timeval32 (const struct timespec ts)
+alpha_valid_timespec_to_timeval32 (const struct timespec ts)
{
return (struct timeval32) { (time_t) ts.tv_sec, ts.tv_nsec / 1000 };
}
static inline void
-rusage64_to_rusage32 (struct rusage32 *restrict r32,
+alpha_rusage64_to_rusage32 (struct rusage32 *restrict r32,
const struct rusage *restrict r64)
{
/* Make sure the entire output structure is cleared, including
padding and reserved fields. */
memset (r32, 0, sizeof *r32);
- r32->ru_utime = valid_timeval_to_timeval32 (r64->ru_utime);
- r32->ru_stime = valid_timeval_to_timeval32 (r64->ru_stime);
+ r32->ru_utime = alpha_valid_timeval_to_timeval32 (r64->ru_utime);
+ r32->ru_stime = alpha_valid_timeval_to_timeval32 (r64->ru_stime);
r32->ru_maxrss = r64->ru_maxrss;
r32->ru_ixrss = r64->ru_ixrss;
r32->ru_idrss = r64->ru_idrss;
r32->ru_nivcsw = r64->ru_nivcsw;
}
-#endif /* tv32-compat.h */
+#endif /* alpha-tv32-compat.h */
#include <sys/time.h>
#include <sys/timex.h>
-#include <tv32-compat.h>
+#include <alpha-tv32-compat.h>
struct timex32 {
unsigned int modes; /* mode selector */
attribute_compat_text_section
__adjtime_tv32 (const struct timeval32 *itv, struct timeval32 *otv)
{
- struct timeval itv64 = valid_timeval32_to_timeval (*itv);
+ struct timeval itv64 = alpha_valid_timeval32_to_timeval (*itv);
struct timeval otv64;
if (__adjtime (&itv64, &otv64) == -1)
return -1;
- *otv = valid_timeval_to_timeval32 (otv64);
+ *otv = alpha_valid_timeval_to_timeval32 (otv64);
return 0;
}
tx64.calcnt = tx->calcnt;
tx64.errcnt = tx->errcnt;
tx64.stbcnt = tx->stbcnt;
- tx64.time = valid_timeval32_to_timeval (tx->time);
+ tx64.time = alpha_valid_timeval32_to_timeval (tx->time);
int status = __adjtimex (&tx64);
if (status < 0)
tx->calcnt = tx64.calcnt;
tx->errcnt = tx64.errcnt;
tx->stbcnt = tx64.stbcnt;
- tx->time = valid_timeval_to_timeval32 (tx64.time);
+ tx->time = alpha_valid_timeval_to_timeval32 (tx64.time);
return status;
}
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
#include <sys/time.h>
-#include <tv32-compat.h>
+#include <alpha-tv32-compat.h>
int
attribute_compat_text_section
/* Write all fields of 'curr_value' regardless of overflow. */
curr_value->it_interval
- = valid_timeval_to_timeval32 (curr_value_64.it_interval);
+ = alpha_valid_timeval_to_timeval32 (curr_value_64.it_interval);
curr_value->it_value
- = valid_timeval_to_timeval32 (curr_value_64.it_value);
+ = alpha_valid_timeval_to_timeval32 (curr_value_64.it_value);
return 0;
}
#include <sys/time.h>
#include <sys/resource.h>
-#include <tv32-compat.h>
+#include <alpha-tv32-compat.h>
int
__getrusage_tv32 (int who, struct rusage32 *usage32)
if (__getrusage (who, &usage64) == -1)
return -1;
- rusage64_to_rusage32 (usage32, &usage64);
+ alpha_rusage64_to_rusage32 (usage32, &usage64);
return 0;
}
#include <string.h>
#include <time.h>
#include <sys/time.h>
-#include <tv32-compat.h>
+#include <alpha-tv32-compat.h>
/* Get the current time of day and timezone information putting it
into *TV and *TZ. */
struct timespec ts;
__clock_gettime (CLOCK_REALTIME, &ts);
- *tv32 = valid_timespec_to_timeval32 (ts);
+ *tv32 = alpha_valid_timespec_to_timeval32 (ts);
return 0;
}
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
#include <sys/time.h>
-#include <tv32-compat.h>
+#include <alpha-tv32-compat.h>
int
attribute_compat_text_section
{
struct itimerval new_value_64;
new_value_64.it_interval
- = valid_timeval32_to_timeval (new_value->it_interval);
+ = alpha_valid_timeval32_to_timeval (new_value->it_interval);
new_value_64.it_value
- = valid_timeval32_to_timeval (new_value->it_value);
+ = alpha_valid_timeval32_to_timeval (new_value->it_value);
if (old_value == NULL)
return __setitimer (which, &new_value_64, NULL);
/* Write all fields of 'old_value' regardless of overflow. */
old_value->it_interval
- = valid_timeval_to_timeval32 (old_value_64.it_interval);
+ = alpha_valid_timeval_to_timeval32 (old_value_64.it_interval);
old_value->it_value
- = valid_timeval_to_timeval32 (old_value_64.it_value);
+ = alpha_valid_timeval_to_timeval32 (old_value_64.it_value);
return 0;
}
#include <sys/time.h>
#include <time.h>
#include <errno.h>
-#include <tv32-compat.h>
+#include <alpha-tv32-compat.h>
/* Set the current time of day and timezone information.
This call is restricted to the super-user. */
return __settimezone (tz);
}
- struct timespec ts = valid_timeval32_to_timespec (*tv32);
+ struct timespec ts = alpha_valid_timeval32_to_timespec (*tv32);
return __clock_settime (CLOCK_REALTIME, &ts);
}
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
#include <sys/time.h>
-#include <tv32-compat.h>
+#include <alpha-tv32-compat.h>
int
attribute_compat_text_section
__utimes_tv32 (const char *filename, const struct timeval32 times32[2])
{
struct timeval times[2];
- times[0] = valid_timeval32_to_timeval (times32[0]);
- times[1] = valid_timeval32_to_timeval (times32[1]);
+ times[0] = alpha_valid_timeval32_to_timeval (times32[0]);
+ times[1] = alpha_valid_timeval32_to_timeval (times32[1]);
return __utimes (filename, times);
}
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>
-#include <tv32-compat.h>
+#include <alpha-tv32-compat.h>
pid_t
attribute_compat_text_section
pid_t child = __wait4 (pid, status, options, &usage64);
if (child >= 0 && usage32 != NULL)
- rusage64_to_rusage32 (usage32, &usage64);
+ alpha_rusage64_to_rusage32 (usage32, &usage64);
return child;
}