Date: Mon, 7 Aug 2000 10:32:45 -0400 (EDT) From: Marc Evans <marc@destek.net> To: Marcel Moolenaar <marcel@cup.hp.com> Cc: freebsd-emulation@FreeBSD.ORG Subject: Re: WebTrends on FreeBSD 4.1 (Linux Emulation) Message-ID: <Pine.BSF.4.21.0008071026590.12525-200000@ns2.destek.net> In-Reply-To: <3988B438.F4ADB5F7@cup.hp.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
Hello -
I have embarked on implementing the missing syscall. I believe that I have
code that is 95% complete. I am however not finding obvious information to
place into the siginfo_t structure to return to the caller. Can anyone
provide me with any pointers to code that I might reference, or anything
that could help me with this last aspect?
Also, any other general comments on this code is also appreciated.
Thanks - Marc
On Wed, 2 Aug 2000, Marcel Moolenaar wrote:
> Marc Evans wrote:
> >
> > /kernel: linux: syscall rt_sigtimedwait is obsoleted or not implemented
> >
> > I have done some searches on the prior e-mail on the lists and I am not
> > finding any discussion about 1) Is there a good workaround? 2) What was
> > the basis of decision resulting in some syscalls not being implemented?
>
> 1) Implementing the syscall is the best "workaround" :-)
> 2) This is not so much a decision. So far nothing depended
> on the syscall. Implementation of syscalls is primarily
> based on available time and how often Linux binaries
> fail because it isnt implemented.
>
> > I am considering trying to implement the function, but if there is already
> > a good workaround then please let me know. Also, if there is good reason
> > not to bother trying to implement this, I would really appreciate
> > knowing...
>
> I think that implementing the syscall is the best approach.
>
> --
> Marcel Moolenaar
> mail: marcel@cup.hp.com / marcel@FreeBSD.org
> tel: (408) 447-4222
>
[-- Attachment #2 --]
static int
linux_do_sigtimedwait(struct proc *p, linux_sigset_t *mask,
siginfo_t *ptr, struct timeval *tv, size_t sigsetsize)
{
sigset_t oset, bset;
int ret, sig, timo;
/* Validate the arguments passed in */
if (sigsetsize != sizeof(linux_sigset_t))
return(-EINVAL);
if (tv && (tv->tv_usec >= 1000000000L || tv->tv_usec < 0 ||
tv->tv_sec < 0 || itimerfix(tv)))
return(-EINVAL);
/* If there is a signal queued, immediately communicate that back. */
linux_to_bsd_sigset(mask,&bset);
SIGSETEQ(oset,p->p_siglist);
SIGSETEQ(p->p_siglist,bset);
timo = tv->tv_sec > 24 * 60 * 60 ? 24 * 60 * 60 * hz : tvtohz(tv);
ret = tsleep(&selwait, PSOCK | PCATCH, "sigtimedwait", timo);
sig = CURSIG(p);
SIGSETEQ(p->p_siglist,oset);
if (sig) {
ret = sig;
if (ptr) {
memset(ptr,0,sizeof(*ptr));
ptr->si_signo = sig;
/* These really need to be accurately filled in for proper
* behavior of the application(s). I am having trouble
* figuring out where to extract the information though...
* ptr->si_errno = 0;
* ptr->si_code = 0;
* ptr->si_pid = 0;
* ptr->si_uid = 0;
*/
}
#ifdef DEBUG
printf("Linux-emul(%ld): signal received (%d)\n",(long)p->p_pid,sig);
#endif
} else {
if (ret == EWOULDBLOCK)
ret = -EINTR;
else
ret = -ret;
#ifdef DEBUG
printf("Linux-emul(%ld): no signal (%d)\n",(long)p->p_pid,ret);
#endif
}
return(ret);
}
int
linux_rt_sigtimedwait(struct proc *p, struct linux_rt_sigtimedwait_args *args)
{
int error;
linux_sigset_t mask;
struct timeval ts;
#ifdef DEBUG
printf("Linux-emul(%ld): rt_sigtimedwait(%p, %p, %p, %d)\n",
(long)p->p_pid, args->mask, args->ptr, args->timeout, args->sigsetsize);
#endif
if (args->sigsetsize != sizeof(linux_sigset_t))
return(-EINVAL);
if ((error = copyin(args->mask, &mask, sizeof(mask))))
return(-error);
if (args->timeout) {
if ((error = copyin(args->timeout, &ts, sizeof(ts))))
return(-error);
#ifdef DEBUG
printf("Linux-emul(%ld): incoming timeout (%ld/%ld)\n",
(long)p->p_pid, ts.tv_sec, ts.tv_usec);
#endif
if (itimerfix(&ts)) {
/* The timeout was invalid. Convert it to something
* valid that will act as it does under Linux.
*/
ts.tv_sec += ts.tv_usec / 1000000;
ts.tv_usec %= 1000000;
if (ts.tv_usec < 0) {
ts.tv_sec -= 1;
ts.tv_usec += 1000000;
}
if (ts.tv_sec < 0)
timevalclear(&ts);
#ifdef DEBUG
printf("Linux-emul(%ld): converted timeout (%ld/%ld)\n",
(long)p->p_pid, ts.tv_sec, ts.tv_usec);
#endif
}
}
error = linux_do_sigtimedwait(p,&mask,args->ptr,
args->timeout ? &ts : NULL,
args->sigsetsize);
#ifdef DEBUG
printf("Linux-emul(%ld): returning (%d)\n",(long)p->p_pid,error);
#endif
return error;
}
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0008071026590.12525-200000>
