Fix name compatible problem with POSIX standard. the sigval_ptr and

sigval_int really should be sival_ptr and sival_int.
Also sigev_notify_function accepts a union sigval value but not a
pointer.
This commit is contained in:
David Xu 2005-11-04 09:41:00 +00:00
parent 6383e2266c
commit 8f0371f19d
5 changed files with 12 additions and 12 deletions

View File

@ -47,7 +47,7 @@ struct thread_node {
struct timer {
union sigval value;
void (*function)(union sigval *, int);
void (*function)(union sigval, int);
int timerid;
long flags;
int gen;
@ -122,7 +122,7 @@ __timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid)
* Here we pass second parameter an overrun count, this is
* not required by POSIX.
*/
tmr->function = (void (*)(union sigval *, int))
tmr->function = (void (*)(union sigval, int))
evp->sigev_notify_function;
tmr->flags = 0;
tmr->timerid = -1;
@ -147,7 +147,7 @@ __timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid)
ev.sigev_notify = SIGEV_THREAD_ID;
ev.sigev_signo = SIGTIMER;
ev.sigev_notify_thread_id = (lwpid_t)tmr->tn->thread->tid;
ev.sigev_value.sigval_int = tmr->gen;
ev.sigev_value.sival_int = tmr->gen;
ret = __sys_timer_create(clockid, &ev, &tmr->timerid);
if (__predict_false(ret != 0 || register_timer(tmr) != 0)) {
ret = errno;
@ -355,11 +355,11 @@ service_loop(void *arg)
TIMERS_LOCK(curthread);
if (si.si_timerid >= 0 && si.si_timerid < timer_max &&
(tmr = timer_list[si.si_timerid]) != NULL &&
si.si_value.sigval_int == tmr->gen) {
si.si_value.sival_int == tmr->gen) {
tmr->flags |= WORKING;
TIMERS_UNLOCK(curthread);
tn->curtmr = tmr;
tmr->function(&tmr->value, si.si_overrun);
tmr->function(tmr->value, si.si_overrun);
tn->curtmr = NULL;
TIMERS_LOCK(curthread);
tmr->flags &= ~WORKING;

View File

@ -1785,7 +1785,7 @@ sigqueue(struct thread *td, struct sigqueue_args *uap)
ksi.ksi_code = SI_QUEUE;
ksi.ksi_pid = td->td_proc->p_pid;
ksi.ksi_uid = td->td_ucred->cr_ruid;
ksi.ksi_value.sigval_ptr = uap->value;
ksi.ksi_value.sival_ptr = uap->value;
error = tdsignal(p, NULL, ksi.ksi_signo, &ksi);
}
PROC_UNLOCK(p);

View File

@ -1028,7 +1028,7 @@ kern_timer_create(struct thread *td, clockid_t clock_id,
it->it_sigev.sigev_signo = SIGPROF;
break;
}
it->it_sigev.sigev_value.sigval_int = id;
it->it_sigev.sigev_value.sival_int = id;
}
if (it->it_sigev.sigev_notify == SIGEV_SIGNAL ||

View File

@ -1481,7 +1481,7 @@ _aio_aqueue(struct thread *td, struct aiocb *job, struct aio_liojob *lj,
if (aiocbe->uaiocb.aio_sigevent.sigev_notify == SIGEV_KEVENT) {
kev.ident = aiocbe->uaiocb.aio_sigevent.sigev_notify_kqueue;
kev.udata = aiocbe->uaiocb.aio_sigevent.sigev_value.sigval_ptr;
kev.udata = aiocbe->uaiocb.aio_sigevent.sigev_value.sival_ptr;
} else
goto no_kqueue;
if ((u_int)kev.ident >= fdp->fd_nfiles ||
@ -2117,7 +2117,7 @@ do_lio_listio(struct thread *td, struct lio_listio_args *uap, int oldsigev)
if (lj->lioj_signal.sigev_notify == SIGEV_KEVENT) {
/* Assume only new style KEVENT */
kev.ident = lj->lioj_signal.sigev_notify_kqueue;
kev.udata = lj->lioj_signal.sigev_value.sigval_ptr;
kev.udata = lj->lioj_signal.sigev_value.sival_ptr;
if ((u_int)kev.ident >= p->p_fd->fd_nfiles ||
(kq_fp = p->p_fd->fd_ofiles[kev.ident]) == NULL ||

View File

@ -150,8 +150,8 @@ typedef __sigset_t sigset_t;
#if __POSIX_VISIBLE >= 199309 || __XSI_VISIBLE >= 500
union sigval {
/* Members as suggested by Annex C of POSIX 1003.1b. */
int sigval_int;
void *sigval_ptr;
int sival_int;
void *sival_ptr;
};
#endif
@ -163,7 +163,7 @@ struct sigevent {
union {
__lwpid_t _threadid;
struct {
void (*_function)(union sigval *);
void (*_function)(union sigval);
void *_attribute; /* pthread_attr_t * */
} _sigev_thread;
} _sigev_un;