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