[tlbuild] More on xz

Jukka Salmi j+tex-live at 2009.salmi.ch
Sat Aug 29 09:57:56 CEST 2009

Richard Koch --> tlbuild (2009-08-28 21:38:34 -0700):
> Folks,
> Looking at the error messages when compiling xz on OS X 10.4, I find
> that the file /src/common/physmem.h has a call to sysctl with six
> arguments, and the file /src/common/cpucores.h has a call to sysctl
> with only five arguments. In the log, there is an error in the
> second case complaining of a missing argument. If I add an extra
> NULL to the call in the second file, the entire xz project compiles
> fine. Does someone on the list know enough about sysctl to figure
> out the correct fix?

It seems that the sysctl(3) in question is missing its second argument.
The attached patch should fix this (I'll send it upstream as well).

Regards, Jukka

> (These calls are inside "#elif defined ..." sections, so they
> probably aren't active for many architectures. I think that's why xz
> compiles on some systems and not others.)
> Dick Koch
> koch at math.uoregon.edu

This email fills a much-needed gap in the archives.
-------------- next part --------------
diff --git a/src/common/cpucores.h b/src/common/cpucores.h
index 704d8a2..811537a 100644
--- a/src/common/cpucores.h
+++ b/src/common/cpucores.h
@@ -40,7 +40,7 @@ cpucores(void)
 	int name[2] = { CTL_HW, HW_NCPU };
 	int cpus;
 	size_t cpus_size = sizeof(cpus);
-	if (!sysctl(name, &cpus, &cpus_size, NULL, NULL)
+	if (!sysctl(name, 2, &cpus, &cpus_size, NULL, NULL)
 			&& cpus_size == sizeof(cpus) && cpus > 0)
 		ret = (uint32_t)(cpus);

More information about the tlbuild mailing list