Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758190Ab0DWQnw (ORCPT ); Fri, 23 Apr 2010 12:43:52 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:49950 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1758052Ab0DWQns (ORCPT ); Fri, 23 Apr 2010 12:43:48 -0400 Date: Fri, 23 Apr 2010 12:43:46 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Pavel Machek cc: Arve Hj??nnev??g , Len Brown , , , Jesse Barnes , Magnus Damm , Subject: Re: [linux-pm] [PATCH 2/9] PM: suspend_block: Add driver to access suspend blockers from user-space In-Reply-To: <20100423084349.GC1573@ucw.cz> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1303 Lines: 39 On Fri, 23 Apr 2010, Pavel Machek wrote: > Hi! > > > Add a misc device, "suspend_blocker", that allows user-space processes > > to block auto suspend. The device has ioctls to create a suspend_blocker, > > and to block and unblock suspend. To delete the suspend_blocker, close > > the device. > > > > Signed-off-by: Arve Hj??nnev??g > > > --- a/Documentation/power/suspend-blockers.txt > > +++ b/Documentation/power/suspend-blockers.txt > > @@ -95,3 +95,20 @@ if (list_empty(&state->pending_work)) > > else > > suspend_block(&state->suspend_blocker); > > > > +User-space API > > +============== > > + > > +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. How about specifying the name by an ordinary write() call instead of by an ioctl()? Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/