On Thu, Apr 14, 2005 at 01:25:32PM -0500, Nathan Lynch wrote: > 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). On my system echo is not exiting with 1. Here's the output I get: Fri Apr 15 12:20:23 PDT 2005 Detected CPU's: 0 1 2 3 4 5 6 7 Offlining CPU 0 = 0 Return Code = 0 Offlining CPU 1 = 0 Return Code = 0 Offlining CPU 2 = 0 Return Code = 0 Offlining CPU 3 = 0 Return Code = 0 Offlining CPU 4 = 0 Return Code = 0 Offlining CPU 5 = 0 Return Code = 0 Offlining CPU 6 = 0 Return Code = 0 Offlining CPU 7 = 1 Return Code = 0 Onlining CPU 0 = 1 Return Code = 0 Onlining CPU 1 = 1 Return Code = 0 Onlining CPU 2 = 1 Return Code = 0 Onlining CPU 3 = 1 Return Code = 0 Onlining CPU 4 = 1 Return Code = 0 Onlining CPU 5 = 1 Return Code = 0 Onlining CPU 6 = 1 Return Code = 0 Onlining CPU 7 = 1 Return Code = 0 You can see that the last CPU cannot be offlined in "Offlining CPU 7 = 1". The = value is the value of online after performing the echo. This is on a OpenServer 720. Is this behavior going to be archiecture specific? Mark