pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/libpciaccess libpciaccess: don't require root...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/371095a10f2a
branches:  trunk
changeset: 324678:371095a10f2a
user:      maya <maya%pkgsrc.org@localhost>
date:      Fri Oct 26 10:18:58 2018 +0000

description:
libpciaccess: don't require root on netbsd to list devices.
(is it ever needed)

work with more than pci0. from base.

bump PKGREVISION

diffstat:

 sysutils/libpciaccess/Makefile                        |   3 +-
 sysutils/libpciaccess/distinfo                        |   3 +-
 sysutils/libpciaccess/patches/patch-src_netbsd__pci.c |  67 +++++++++++++++++++
 3 files changed, 71 insertions(+), 2 deletions(-)

diffs (97 lines):

diff -r 56288b8afe66 -r 371095a10f2a sysutils/libpciaccess/Makefile
--- a/sysutils/libpciaccess/Makefile    Fri Oct 26 10:18:49 2018 +0000
+++ b/sysutils/libpciaccess/Makefile    Fri Oct 26 10:18:58 2018 +0000
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.29 2017/11/01 18:22:20 wiz Exp $
+# $NetBSD: Makefile,v 1.30 2018/10/26 10:18:58 maya Exp $
 
 DISTNAME=      libpciaccess-0.14
+PKGREVISION=   1
 CATEGORIES=    sysutils x11
 MASTER_SITES=  ${MASTER_SITE_XORG:=lib/}
 EXTRACT_SUFX=  .tar.bz2
diff -r 56288b8afe66 -r 371095a10f2a sysutils/libpciaccess/distinfo
--- a/sysutils/libpciaccess/distinfo    Fri Oct 26 10:18:49 2018 +0000
+++ b/sysutils/libpciaccess/distinfo    Fri Oct 26 10:18:58 2018 +0000
@@ -1,8 +1,9 @@
-$NetBSD: distinfo,v 1.35 2017/11/01 18:22:20 wiz Exp $
+$NetBSD: distinfo,v 1.36 2018/10/26 10:18:58 maya Exp $
 
 SHA1 (libpciaccess-0.14.tar.bz2) = f70a958bf4e744cb4ee93be64e9bc52ac05cdaeb
 RMD160 (libpciaccess-0.14.tar.bz2) = d095e06591cc38a2eac8cb81aa4813a42267146e
 SHA512 (libpciaccess-0.14.tar.bz2) = bf40214dfd22f2a223f7c948566e6eaa4bfed60116e71b3eb19f6fe7ab2c4546649eb0416c06d5983e476ea5e27de036936646eb5f800ea97763b6d1f1976f4b
 Size (libpciaccess-0.14.tar.bz2) = 361375 bytes
 SHA1 (patch-src_common__interface.c) = cac11689864531fa4721e09374ead730bd1691a6
+SHA1 (patch-src_netbsd__pci.c) = 6f7ac3a3cad128756aed8e823af57e8737157d1b
 SHA1 (patch-src_solx__devfs.c) = 18bfd9899da30061199232ae2ebc5ead8d4d7a47
diff -r 56288b8afe66 -r 371095a10f2a sysutils/libpciaccess/patches/patch-src_netbsd__pci.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/libpciaccess/patches/patch-src_netbsd__pci.c     Fri Oct 26 10:18:58 2018 +0000
@@ -0,0 +1,67 @@
+$NetBSD: patch-src_netbsd__pci.c,v 1.1 2018/10/26 10:18:58 maya Exp $
+
+Don't require root access.
+support more than pci0 - from netbase base
+
+--- src/netbsd_pci.c.orig      2017-10-23 15:48:29.000000000 +0000
++++ src/netbsd_pci.c
+@@ -848,9 +848,11 @@ pci_device_netbsd_has_kernel_driver(stru
+ {
+ #ifdef PCI_IOC_DRVNAME
+       /*
+-       * NetBSD PCI_IOC_DRVNAME appears at the same time as pci_drvname(3)
++       * NetBSD PCI_IOC_DRVNAME appears at the same time as pci_drvname(3),
++       * same as the better onbus version.
+        */
+       char drvname[16];
++      int i;
+ 
+       if (dev->bus >= nbuses)
+               return 0;
+@@ -858,10 +860,22 @@ pci_device_netbsd_has_kernel_driver(stru
+       /*
+        * vga(4) should be considered "not bound".
+        */
+-      if (pci_drvname(buses[dev->bus].fd, dev->dev, dev->func,
+-                      drvname, sizeof drvname) == 0 &&
+-          strncmp(drvname, "vga", 3) != 0)
+-              return 1;
++      for (i = 0; i < nbuses; i++) {
++              if (buses[i].num == dev->bus) {
++                      int rv;
++
++#ifdef PCI_IOC_DRVNAMEONBUS
++                      rv = pci_drvnameonbus(buses[i].fd, dev->bus,
++                          dev->dev, dev->func, drvname, sizeof drvname);
++#else
++                      rv = pci_drvname(buses[i].fd,
++                          dev->dev, dev->func, drvname, sizeof drvname);
++#endif
++                      if (rv == 0 && strncmp(drvname, "vga", 3) != 0)
++                              return 1;
++                      return 0;
++              }
++      }
+ #endif
+       return 0;
+ }
+@@ -910,6 +924,9 @@ pci_system_netbsd_create(void)
+       nbuses = 0;
+       snprintf(netbsd_devname, 32, "/dev/pci%d", nbuses);
+       pcifd = open(netbsd_devname, O_RDWR | O_CLOEXEC);
++      if (pcifd == -1)
++              pcifd = open(netbsd_devname, O_RDONLY | O_CLOEXEC);
++
+       while (pcifd > 0) {
+               ioctl(pcifd, PCI_IOC_BUSINFO, &businfo);
+               buses[nbuses].fd = pcifd;
+@@ -932,6 +949,9 @@ pci_system_netbsd_create(void)
+               }
+               snprintf(netbsd_devname, 32, "/dev/pci%d", nbuses);
+               pcifd = open(netbsd_devname, O_RDWR);
++              if (pcifd == -1)
++                      pcifd = open(netbsd_devname, O_RDONLY | O_CLOEXEC);
++
+       }
+ 
+       pci_sys->num_devices = ndevs;



Home | Main Index | Thread Index | Old Index