mirror of https://github.com/deadw00d/AROS.git
Freeze size of timerequest to 32-bit
64-bit time will have separate commands and separate timerequest structure. This matches how 64-bit was introduced in trackdisk commands (although there it was possible to use the same structure which is not possible in this case).
This commit is contained in:
parent
8c6cd7a55f
commit
369a6ab895
|
@ -39,10 +39,11 @@ struct EClockVal
|
|||
ULONG ev_lo;
|
||||
};
|
||||
|
||||
/* Request used with 32-bit commands */
|
||||
struct timerequest
|
||||
{
|
||||
struct IORequest tr_node;
|
||||
struct timeval tr_time;
|
||||
struct timeval32 tr_time;
|
||||
};
|
||||
|
||||
#endif /* DEVICES_TIMER_H */
|
||||
|
|
|
@ -49,6 +49,7 @@ int _pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const
|
|||
|
||||
if (abstime)
|
||||
{
|
||||
struct timeval tvabstime;
|
||||
// prepare MsgPort
|
||||
memset( &timermp, 0, sizeof( timermp ) );
|
||||
timermp.mp_Node.ln_Type = NT_MSGPORT;
|
||||
|
@ -82,15 +83,17 @@ int _pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const
|
|||
// prepare the device command and send it
|
||||
timerio.tr_node.io_Command = TR_ADDREQUEST;
|
||||
timerio.tr_node.io_Flags = 0;
|
||||
TIMESPEC_TO_TIMEVAL(&timerio.tr_time, abstime);
|
||||
TIMESPEC_TO_TIMEVAL(&tvabstime, abstime);
|
||||
if (!relative)
|
||||
{
|
||||
struct timeval starttime;
|
||||
// absolute time has to be converted to relative
|
||||
// GetSysTime can't be used due to the timezone offset in abstime
|
||||
gettimeofday(&starttime, NULL);
|
||||
timersub(&timerio.tr_time, &starttime, &timerio.tr_time);
|
||||
timersub(&tvabstime, &starttime, &tvabstime);
|
||||
}
|
||||
timerio.tr_time.tv_secs = tvabstime.tv_sec;
|
||||
timerio.tr_time.tv_micro = tvabstime.tv_usec;
|
||||
timermask = 1 << timermp.mp_SigBit;
|
||||
sigs |= timermask;
|
||||
SendIO((struct IORequest *)&timerio);
|
||||
|
|
|
@ -202,8 +202,8 @@ void wait_for_timer(struct timerequest *tr, struct timeval *tv )
|
|||
|
||||
tr->tr_node.io_Command = TR_ADDREQUEST; /* add a new timer request */
|
||||
|
||||
/* structure assignment */
|
||||
tr->tr_time = *tv;
|
||||
tr->tr_time.tv_secs = tv->tv_secs;
|
||||
tr->tr_time.tv_micro = tv->tv_micro;
|
||||
|
||||
/* post request to the timer -- will go to sleep till done */
|
||||
DoIO((struct IORequest *) tr );
|
||||
|
@ -239,8 +239,8 @@ if (tr == 0 )
|
|||
tr->tr_node.io_Command = TR_GETSYSTIME;
|
||||
DoIO((struct IORequest *) tr );
|
||||
|
||||
/* structure assignment */
|
||||
*tv = tr->tr_time;
|
||||
tv->tv_secs = tr->tr_time.tv_secs;
|
||||
tv->tv_micro = tr->tr_time.tv_micro;
|
||||
|
||||
delete_timer( tr );
|
||||
return( 0 );
|
||||
|
|
|
@ -275,7 +275,8 @@ static LONG pd_PRead(char * buffer, LONG *length, struct timeval *tv)
|
|||
pd->pd_TIOR.tr_node.io_Command = TR_ADDREQUEST;
|
||||
pd->pd_TIOR.tr_node.io_Flags = 0;
|
||||
pd->pd_TIOR.tr_node.io_Message.mn_Length = sizeof(pd->pd_TIOR);
|
||||
pd->pd_TIOR.tr_time = *tv;
|
||||
pd->pd_TIOR.tr_time.tv_secs = tv->tv_secs;
|
||||
pd->pd_TIOR.tr_time.tv_micro = tv->tv_micro;
|
||||
SendIO((struct IORequest *)&pd->pd_TIOR);
|
||||
|
||||
io->io_Command = CMD_READ;
|
||||
|
|
|
@ -755,7 +755,7 @@ catcher()
|
|||
pinger();
|
||||
|
||||
if (!npackets || ntransmitted < npackets) {
|
||||
timermsg->tr_time.tv_sec = interval;
|
||||
timermsg->tr_time.tv_secs = interval;
|
||||
SendIO((struct IORequest*)timermsg);
|
||||
} else {
|
||||
if (nreceived) {
|
||||
|
@ -764,7 +764,7 @@ catcher()
|
|||
waittime = 1;
|
||||
} else
|
||||
waittime = MAXWAIT;
|
||||
timermsg->tr_time.tv_sec = waittime;
|
||||
timermsg->tr_time.tv_secs = waittime;
|
||||
SendIO((struct IORequest*)timermsg);
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -62,7 +62,8 @@ struct timeoutRequest {
|
|||
static inline void
|
||||
sendTimeoutRequest(struct timeoutRequest *tr)
|
||||
{
|
||||
tr->timeout_request.tr_time = tr->timeout_timeval;
|
||||
tr->timeout_request.tr_time.tv_secs = tr->timeout_timeval.tv_sec;
|
||||
tr->timeout_request.tr_time.tv_micro = tr->timeout_timeval.tv_usec;
|
||||
SendIO((struct IORequest *)&(tr->timeout_request));
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,8 @@ D(bug("[AROSTCP](kern_synch.c) tsleep_send_timeout()\n"));
|
|||
/*
|
||||
* set the timeout
|
||||
*/
|
||||
p->tsleep_timer->tr_time = *time_out;
|
||||
p->tsleep_timer->tr_time.tv_secs = time_out->tv_sec;
|
||||
p->tsleep_timer->tr_time.tv_micro = time_out->tv_usec;
|
||||
/*
|
||||
* Enable signalling again
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue