Annotation of pkgsrc/sysutils/dmidecode/patches/patch-dmidecode.c, revision 1.2

1.2     ! triaxx      1: $NetBSD: patch-dmidecode.c,v 1.1 2018/10/23 10:16:12 jmcneill Exp $
1.1       jmcneill    2: 
1.2     ! triaxx      3: * Find SMBIOS table address on NetBSD ARM64.
        !             4: * Add missing header for FreeBSD.
1.1       jmcneill    5: 
1.2     ! triaxx      6: --- dmidecode.c.orig   2020-04-20 13:13:37.626217000 +0000
1.1       jmcneill    7: +++ dmidecode.c
1.2     ! triaxx      8: @@ -70,8 +70,15 @@
        !             9:  #ifdef __FreeBSD__
        !            10:  #include <errno.h>
1.1       jmcneill   11:  #include <kenv.h>
1.2     ! triaxx     12: +#include <sys/socket.h>
1.1       jmcneill   13:  #endif
                     14:  
                     15: +#ifdef __NetBSD__
                     16: +#include <sys/param.h>
                     17: +#include <sys/sysctl.h>
                     18: +#include <errno.h>
                     19: +#endif
                     20: +
                     21:  #include "version.h"
                     22:  #include "config.h"
                     23:  #include "types.h"
1.2     ! triaxx     24: @@ -5466,6 +5473,9 @@ static int address_from_efi(off_t *address)
1.1       jmcneill   25:        char linebuf[64];
                     26:  #elif defined(__FreeBSD__)
                     27:        char addrstr[KENV_MVALLEN + 1];
                     28: +#elif defined(__NetBSD__)
                     29: +      uint64_t addr;
                     30: +      size_t addrlen;
                     31:  #endif
                     32:        const char *eptype;
                     33:        int ret;
1.2     ! triaxx     34: @@ -5517,6 +5527,23 @@ static int address_from_efi(off_t *address)
        !            35:        }
        !            36:  
1.1       jmcneill   37:        *address = strtoull(addrstr, NULL, 0);
1.2     ! triaxx     38: +      eptype = "SMBIOS";
        !            39: +      ret = 0;
1.1       jmcneill   40: +#elif defined(__NetBSD__)
                     41: +      /*
                     42: +       * On NetBSD, SMBIOS anchor base address on non-x86 is exposed
                     43: +       * via sysctl.
                     44: +       */ 
                     45: +      addrlen = sizeof(addr);
                     46: +      ret = sysctlbyname("machdep.smbios", &addr, &addrlen, NULL, 0);
                     47: +      if (ret == -1)
                     48: +      {
                     49: +              if (errno != ENOENT)
                     50: +                      perror("sysctlbyname");
                     51: +              return EFI_NOT_FOUND;
                     52: +      }
                     53: +
                     54: +      *address = (off_t)addr;
1.2     ! triaxx     55:        eptype = "SMBIOS";
        !            56:        ret = 0;
1.1       jmcneill   57:  #else

CVSweb <webmaster@jp.NetBSD.org>