Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / sysutils / libgtop / patches / patch-ad
blob6caecebb7d59793a57126991f184b7ab89205e9d
1 $NetBSD$
3 --- sysdeps/bsd/sysinfo.c.orig  2009-08-27 14:29:56.000000000 +0200
4 +++ sysdeps/bsd/sysinfo.c
5 @@ -36,6 +36,7 @@ static void
6  init_sysinfo (glibtop *server)
7  {
8         char *model;
9 +       char *brand;
10         guint64 ncpus = 1;
11         int mhz = 0;
12         size_t len;
13 @@ -51,6 +52,12 @@ init_sysinfo (glibtop *server)
14         sysctlbyname ("hw.model", NULL, &len, NULL, 0);
15         model = g_malloc (len);
16         sysctlbyname ("hw.model", model, &len, NULL, 0);
17 +       if (sysctlbyname ("machdep.cpu_brand", NULL, &len, NULL, 0) != -1) {
18 +               brand = g_malloc (len);
19 +               sysctlbyname ("machdep.cpu_brand", brand, &len, NULL, 0);
20 +       } else {
21 +               brand = model;
22 +       }
23         len = sizeof (mhz);
24         sysctlbyname ("hw.clockrate", &mhz, &len, NULL, 0);
26 @@ -73,6 +80,10 @@ init_sysinfo (glibtop *server)
27                 g_hash_table_insert (cpuinfo->values, "vendor_id",
28                                      g_strdup(model));
30 +               g_ptr_array_add (cpuinfo->labels, "model name");
31 +               g_hash_table_insert (cpuinfo->values, "model name",
32 +                                    g_strdup(brand));
34                 g_ptr_array_add (cpuinfo->labels, "cpu MHz");
35                 g_hash_table_insert (cpuinfo->values, "cpu MHz",
36                                      g_strdup_printf("%d", mhz));