On Thu, Oct 24, 2013 at 04:10:40PM +0400, Stanislav Kholmanskikh wrote: > For this purpose we use sysconf() as it is the > preferred platform neutral interface for getting this > sort of information. > > Based on Dave Chinner proposal. > > Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@xxxxxxxxxx> > --- .... > + if (oflag) { > + long ncpus; > + > +#if defined(_SC_NPROCESSORS_ONLN) > + /* Linux */ > + ncpus = sysconf(_SC_NPROCESSORS_ONLN); > +#elif defined(_SC_NPROC_ONLN) > + /* IRIX */ > + ncpus = sysconf(_SC_NPROC_ONLN); > +#else > + ncpus = 1; > +#endif > + if (ncpus == -1) > + ncpus = 1; That can be simplified, and there's probably not much point in listing the OS's that the different calls are for. if (oflag) { long ncpus = -1; #if defined(_SC_NPROCESSORS_ONLN) ncpus = sysconf(_SC_NPROCESSORS_ONLN); #elif defined(_SC_NPROC_ONLN) ncpus = sysconf(_SC_NPROC_ONLN); #endif if (ncpus == -1) ncpus = 1; .... Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs