[SCore-users-jp] Re: [SCore-users] Developing with PM
Masao Uebayashi
uebayasi @ pultek.co.jp
2002年 10月 23日 (水) 17:20:26 JST
Hello,
I'm another one who's trying to port PM2.
> > Call pmGetFd() function to obtain file descriptors to select.
>
> The question was more like how to attach an fd to a context, but I see
> that pmCreateAttachFd is the only one which can output a fd...
As far as I read the code, an fd is accosiated with a context by the
device number of the device file opened by a process. System calls
like poll() can identify which context the fd (or `struct file' in the
kernel) directs to only by knowing the fd's device number.
For example,
myri_pm_poll @ SCore/pm2/arch/myrinet/driver/linux/pm_myrinet.c looks
like
static unsigned int
myri_pm_poll(struct file *file, poll_table * wait)
{
kdev_t dev = file->f_dentry->d_inode->i_rdev; /* Device number */
struct myri_softc *sc = &myri_sc[PM_UNIT(dev)]; /* Which softc? */
struct myri_ctx *cp = &sc->context[PM_CTX(dev)]; /* Which context? */
poll_wait(file, &cp->selwait, wait);
if (cp->intr_pend) {
cp->intr_pend = 0;
return POLLIN;
}
return 0;
}
> > Read the source code :-)
This seems to me not a very good (good for users) reply in terms of
promotion, doesn't it? :-)
Regards,
Masao
_______________________________________________
SCore-users mailing list
SCore-users @ pccluster.org
http://www.pccluster.org/mailman/listinfo/score-users
SCore-users-jp メーリングリストの案内