FC5 system() call

T. Horsnell tsh at mrc-lmb.cam.ac.uk
Fri Sep 22 15:16:42 UTC 2006


>Morning all,
>
>Using FC3 life is good.  I compile up my code on FC5 with gcc-4.1.1 and
>all of a sudden the system() call is broken.
>
>The code:
>
>int num_proc = system("cat /proc/cpuinfo | grep -c processor >> /dev/null 2>&!");

Even assuming you mean 

int num_proc = system("cat /proc/cpuinfo | grep -c processor >> /dev/null 2>&1");

I dont see how this will give you the # of cpus.

num-proc will only contain the status of the system call, not the result
of the grep, wont it?

Terry.


>
>On every FC3 machine we've run on, this works fine and returns 1, 2 or
>4.
>
>Likewise on every FC5 machine we've ever run on, it returns -1, nothing
>else.  The man page for system() hasn't changed and I can't find any
>other information about it.
>
>Any ideas?
>
>:b!
>
>Brian D. McGrew { brian at visionpro.com || brian at doubledimension.com }
>--
>> This is a test.  This is only a test!
>  Had this been an actual emergency, you would have been
>  told to cancel this test and seek professional assistance!
>
>
>-- 
>fedora-list mailing list
>fedora-list at redhat.com
>To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
>




More information about the fedora-list mailing list