Hey Roland! Aren't you supposed to cure your wrist? On Tue, Oct 10, 2006 at 02:29:12AM -0700, Roland McGrath wrote: > Thanks for the clarification. I committed a libc change that should work.
Confirmed that it works.
But may I ask why you didn't like the function to be the way Samuel and I
proposed:
#v+
int
__futimes (int fd, const struct timeval tvp[2])
{
error_t err;
time_value_t new_atime, new_mtime;
if (tvp == NULL)
/* Setting the number of microseconds to `-1' tells the
underlying filesystems to use the current time. */
new_atime.microseconds = new_mtime.microseconds = -1;
else
{
new_atime.seconds = tvp[0].tv_sec;
new_atime.microseconds = tvp[0].tv_usec;
new_mtime.seconds = tvp[1].tv_sec;
new_mtime.microseconds = tvp[1].tv_usec;
}
err = HURD_DPORT_USE (fd, __file_utimes (port, new_atime, new_mtime));
return err ? __hurd_dfail (fd, err) : 0;
}
#v-
Compared to yours:
#v+
int
__futimes (int fd, const struct timeval tvp[2])
{
union tv
{
struct timeval tv;
time_value_t tvt;
};
const union tv *u = (const union tv *) tvp;
union tv nulltv[2];
error_t err;
if (tvp == NULL)
{
/* Setting the number of microseconds to `-1' tells the
underlying filesystems to use the current time. */
nulltv[0].tvt.microseconds = nulltv[1].tvt.microseconds = -1;
u = nulltv;
}
err = HURD_DPORT_USE (fd, __file_utimes (port, u[0].tvt, u[1].tvt));
return err ? __hurd_dfail (fd, err) : 0;
#v-
... ours needs to copy the four values for `tvp != NULL', but avoids the
union and the cast you need in yours.
And by the way: why do we need both `struct timeval' and `struct
time_value'? Given that we nevertheless assume them to be equal in the
code, isn't there a way to get rid of Mach's `struct time_value'?
Regards,
Thomas
signature.asc
Description: Digital signature
_______________________________________________ Bug-hurd mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-hurd
