diff options
author | maya <maya@pkgsrc.org> | 2018-10-26 10:18:58 +0000 |
---|---|---|
committer | maya <maya@pkgsrc.org> | 2018-10-26 10:18:58 +0000 |
commit | 5b157ec2c140a5b179ef3f5c03c428845200aaa5 (patch) | |
tree | 98556c853fca15c3d651481268c9ddf577c7c001 /sysutils | |
parent | e7bc6b35ca97850e2d0ed2297ad1cd794648d6e4 (diff) | |
download | pkgsrc-5b157ec2c140a5b179ef3f5c03c428845200aaa5.tar.gz |
libpciaccess: don't require root on netbsd to list devices.
(is it ever needed)
work with more than pci0. from base.
bump PKGREVISION
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/libpciaccess/Makefile | 3 | ||||
-rw-r--r-- | sysutils/libpciaccess/distinfo | 3 | ||||
-rw-r--r-- | sysutils/libpciaccess/patches/patch-src_netbsd__pci.c | 67 |
3 files changed, 71 insertions, 2 deletions
diff --git a/sysutils/libpciaccess/Makefile b/sysutils/libpciaccess/Makefile index 4107bdfecc4..38e0e9fe603 100644 --- a/sysutils/libpciaccess/Makefile +++ b/sysutils/libpciaccess/Makefile @@ -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 --git a/sysutils/libpciaccess/distinfo b/sysutils/libpciaccess/distinfo index 09b6fc76563..857fbacd198 100644 --- a/sysutils/libpciaccess/distinfo +++ b/sysutils/libpciaccess/distinfo @@ -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 --git a/sysutils/libpciaccess/patches/patch-src_netbsd__pci.c b/sysutils/libpciaccess/patches/patch-src_netbsd__pci.c new file mode 100644 index 00000000000..48877068387 --- /dev/null +++ b/sysutils/libpciaccess/patches/patch-src_netbsd__pci.c @@ -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; |