On Thu, 2005-04-14 at 08:48 -0700, Mark Wong wrote: > On Tue, Feb 15, 2005 at 03:09:00PM -0600, Nathan Lynch wrote: > > > > 5) offlining the last running cpu in the system :) > > > > > > Just because I'm mostly ignorant, what's the correct behavior? For > > > example, the atttriute to offline goes away, is not changeable, etc. > > > Easy to test definitely. :) > > > > The write to /sys/devices/system/cpu/cpuX/online should return EBUSY. > > Hi Nathan, > > I just got around to trying this and I figure I'm doing it wrong. > Capturing the return ($?) from echo is either a 0 or 1, which makes > sense, so I figure I'm not capturing the correct thing to see if EBUSY > is returned. How do I do that? The echo shell builtin doesn't return the specific error code... /bin/echo gives more detail on stderr, but it also exits with return code 1 on any error. # /bin/echo 0 > /sys/devices/system/cpu/cpu5/online /bin/echo: write error: Device or resource busy So... not sure. Might be easiest to write a little C program which checks errno after doing the write(2). Nathan