diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..611ba79 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ + +all: nprocs + +nprocs: nprocs.c + $(CC) -o $@ $< + +clean: + -rm -f *.o *~ nprocs diff --git a/nprocs.c b/nprocs.c new file mode 100644 index 0000000..ad79141 --- /dev/null +++ b/nprocs.c @@ -0,0 +1,11 @@ + +#include +#include /* sysconf() */ + +int main(int argc, char * argv[]) +{ + int nprocs = sysconf(_SC_NPROCESSORS_CONF); + + printf("Number of processors: %d\n", nprocs); + return 0; +}