0015-sysctl-only-on-glibc.patch 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. --- a/newfs_hfs.tproj/makehfs.c
  2. +++ b/newfs_hfs.tproj/makehfs.c
  3. @@ -37,7 +37,9 @@
  4. #endif
  5. #include <sys/errno.h>
  6. #include <sys/stat.h>
  7. +#ifdef __GLIBC__
  8. #include <sys/sysctl.h>
  9. +#endif
  10. #if !LINUX
  11. #include <sys/vmmeter.h>
  12. #endif
  13. @@ -2039,6 +2041,7 @@ getencodinghint(unsigned char *name)
  14. if (getvfsbyname("hfs", &vfc) < 0)
  15. goto error;
  16. +#ifdef __GLIBC__
  17. mib[0] = CTL_VFS;
  18. mib[1] = vfc.vfc_typenum;
  19. mib[2] = HFS_ENCODINGHINT;
  20. @@ -2046,6 +2049,7 @@ getencodinghint(unsigned char *name)
  21. if (sysctl(mib, 3, &hint, &buflen, name, strlen((char *)name) + 1) < 0)
  22. goto error;
  23. return (hint);
  24. +#endif
  25. error:
  26. hint = GetDefaultEncoding();
  27. return (0);
  28. @@ -2062,7 +2066,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
  29. clock_t uptime;
  30. size_t datalen;
  31. double sysloadavg[3];
  32. -#if !LINUX
  33. +#if !LINUX && defined(__GLIBC__)
  34. int sysdata;
  35. int mib[2];
  36. char sysctlstring[128];
  37. @@ -2080,7 +2084,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
  38. SHA1_Update(&context, &uptime, sizeof(uptime));
  39. /* The kernel's boot time: */
  40. -#if !LINUX
  41. +#if !LINUX && defined(__GLIBC__)
  42. mib[0] = CTL_KERN;
  43. mib[1] = KERN_BOOTTIME;
  44. datalen = sizeof(sysdata);
  45. @@ -2088,7 +2092,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
  46. SHA1_Update(&context, &sysdata, datalen);
  47. #endif
  48. /* The system's host id: */
  49. -#if !LINUX
  50. +#if !LINUX && defined(__GLIBC__)
  51. mib[0] = CTL_KERN;
  52. mib[1] = KERN_HOSTID;
  53. datalen = sizeof(sysdata);
  54. @@ -2096,7 +2100,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
  55. SHA1_Update(&context, &sysdata, datalen);
  56. #endif
  57. /* The system's host name: */
  58. -#if !LINUX
  59. +#if !LINUX && defined(__GLIBC__)
  60. mib[0] = CTL_KERN;
  61. mib[1] = KERN_HOSTNAME;
  62. datalen = sizeof(sysctlstring);
  63. @@ -2104,7 +2108,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
  64. SHA1_Update(&context, sysctlstring, datalen);
  65. #endif
  66. /* The running kernel's OS release string: */
  67. -#if !LINUX
  68. +#if !LINUX && defined(__GLIBC__)
  69. mib[0] = CTL_KERN;
  70. mib[1] = KERN_OSRELEASE;
  71. datalen = sizeof(sysctlstring);
  72. @@ -2112,7 +2116,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
  73. SHA1_Update(&context, sysctlstring, datalen);
  74. #endif
  75. /* The running kernel's version string: */
  76. -#if !LINUX
  77. +#if !LINUX && defined(__GLIBC__)
  78. mib[0] = CTL_KERN;
  79. mib[1] = KERN_VERSION;
  80. datalen = sizeof(sysctlstring);
  81. @@ -2127,7 +2131,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
  82. #endif
  83. /* The system's VM statistics: */
  84. -#if !LINUX
  85. +#if !LINUX && defined(__GLIBC__)
  86. mib[0] = CTL_VM;
  87. mib[1] = VM_METER;
  88. datalen = sizeof(sysvmtotal);