Skip to content

Commit f7eb81a

Browse files
author
Isaac Dunham
committed
Fix link error on Linux/musl.
get_nprocs() is a GNU convenience function equivalent to POSIX2008 sysconf(_SC_NPROCESSORS_ONLN); the latter should be available in unistd.h on any current *nix. (OS X supports this call since 10.5, and FreeBSD currently supports it. But this commit does not change FreeBSD or OS X versions.)
1 parent edc3298 commit f7eb81a

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

CONTRIBUTORS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,8 @@ In chronological order:
114114
* carlkl <https://github.com/carlkl>
115115
* [2013-12-13] Fixed LAPACKE building bug on Windows
116116

117+
* Isaac Dunham <https://github.com/idunham>
118+
* [2014-08-03] Fixed link error on Linux/musl
119+
117120
* [Your name or handle] <[email or website]>
118121
* [Date] [Brief summary of your changes]

driver/others/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ void gotoblas_set_affinity2(int threads) {};
865865

866866
void gotoblas_affinity_reschedule(void) {};
867867

868-
int get_num_procs(void) { return get_nprocs(); }
868+
int get_num_procs(void) { return sysconf(_SC_NPROCESSORS_ONLN); }
869869

870870
int get_num_nodes(void) { return 1; }
871871

driver/others/memory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ int get_num_procs(void);
162162
#else
163163
int get_num_procs(void) {
164164
static int nums = 0;
165-
if (!nums) nums = get_nprocs();
165+
if (!nums) nums = sysconf(_SC_NPROCESSORS_ONLN);
166166
return nums;
167167
}
168168
#endif

0 commit comments

Comments
 (0)