component(developer/golang-123): Add Component
[oi-userland.git] / components / desktop / hexchat / patches / ctcp-version.patch
blob3451810920a7af3984d6a44342f4816bd6195159
1 --- hexchat-2.14.3/src/common/util.c 2019-12-21 07:43:47.702403000 +0000
2 +++ hexchat-2.14.3/src/common/util.c 2020-01-02 12:03:02.367758918 +0000
3 @@ -61,6 +61,10 @@
4 #endif
5 #endif
7 +#if defined (__SVR4) && defined (__sun)
8 +#include <kstat.h>
9 +#endif
11 char *
12 file_part (char *file)
14 @@ -360,7 +364,7 @@ strip_hidden_attribute (char *src, char
15 return len;
18 -#if defined (__linux__) || defined (__FreeBSD__) || defined (__APPLE__) || defined (__CYGWIN__)
19 +#if defined (__linux__) || defined (__FreeBSD__) || defined (__APPLE__) || defined (__CYGWIN__) || (defined (__SVR4) && defined (__sun))
21 static void
22 get_cpu_info (double *mhz, int *cpus)
23 @@ -450,6 +454,37 @@ get_cpu_info (double *mhz, int *cpus)
24 *mhz = (freq / 1000000);
26 #endif
27 +#if defined (__SVR4) && defined (__sun)
29 + kstat_t *ksp;
30 + kstat_ctl_t *kc;
31 + kstat_named_t *knp = NULL;
32 + int numcpu = 0;
33 + kc = kstat_open();
34 + if (kc == NULL) {
35 + fprintf (stderr, "get speed: kstat error %d\n", errno);
36 + return;
37 + }
39 + ksp = kstat_lookup(kc, "cpu_info", -1, NULL);
40 + for (; ksp != NULL; ksp = ksp->ks_next) {
41 + if (strcmp(ksp->ks_module, "cpu_info"))
42 + continue;
43 + numcpu++;
45 + kstat_read(kc, ksp, NULL);
47 + if (knp == NULL) {
48 + knp = kstat_data_lookup(ksp, "clock_MHz");
49 + }
50 + }
52 + *cpus = numcpu;
53 + if (knp) {
54 + *mhz = knp->value.i32;
55 + }
57 +#endif
60 #endif
61 @@ -495,7 +530,7 @@ get_sys_str (int with_cpu)
62 char *
63 get_sys_str (int with_cpu)
65 -#if defined (__linux__) || defined (__FreeBSD__) || defined (__APPLE__) || defined (__CYGWIN__)
66 +#if defined (__linux__) || defined (__FreeBSD__) || defined (__APPLE__) || defined (__CYGWIN__) || (defined (__SVR4) && defined (__sun))
67 double mhz;
68 #endif
69 int cpus = 1;
70 @@ -507,7 +542,7 @@ get_sys_str (int with_cpu)
72 uname (&un);
74 -#if defined (__linux__) || defined (__FreeBSD__) || defined (__APPLE__) || defined (__CYGWIN__)
75 +#if defined (__linux__) || defined (__FreeBSD__) || defined (__APPLE__) || defined (__CYGWIN__) || (defined (__SVR4) && defined (__sun))
76 get_cpu_info (&mhz, &cpus);
77 if (mhz && with_cpu)