Re: [PATCH 2/9] PM: suspend_block: Add driver to access suspendblockers from user-space

From: Pavel Machek
Date: Sat Apr 24 2010 - 01:39:25 EST


On Fri 2010-04-23 21:53:34, tytso@xxxxxxx wrote:
> On Fri, Apr 23, 2010 at 10:43:49AM +0200, Pavel Machek wrote:
> > > +To create a suspend_blocker from user-space, open the suspend_blocker device:
> > > + fd = open("/dev/suspend_blocker", O_RDWR | O_CLOEXEC);
> > > +then call:
> > > + ioctl(fd, SUSPEND_BLOCKER_IOCTL_INIT(strlen(name)), name);
> >
> >
> > This seems like very wrong idea -- it uses different ioctl number for
> > each length AFAICT.
>
> Yep, and there's nothing wrong with that IMHO. It's a clever use of
> the _IOC encoding scheme.

I'm not sure if "clever" is right word. So what if strlen is in 2GB
range, will macros still work correctly?

Will it be easy for strace to display such ioctls?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/