Commit Graph

28 Commits

Author SHA1 Message Date
Dmitry Chagin
bafe3b8804 linsysfs: plug set-but-not-used vars.
MFC after:	2 weeks
2022-03-31 23:49:26 +03:00
Edward Tomasz Napierala
dc0119c281 linsysfs: create /sys/bus/ and /sys/subsystem/
This looks like a no-op, but it prevents udevadm(8) with failing
loudly, which in turn unbreaks installation of libfprint-2-2, which
in Focal is a dependency for make-4.2.1-1.2.

One might wonder why installing a build utility involves messing
with device handling...

Sponsored By:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29133
2021-03-11 15:50:51 +00:00
Mark Johnston
46888dedc9 Add emulation support for the Linux kcov(4) ioctl API.
This makes it possible to run an unmodified Linux syzkaller executor
against the Linuxulator, and have it gather code coverage information.

Sponsored by:	The FreeBSD Foundation
2020-09-04 00:12:28 +00:00
Edward Tomasz Napierala
8b99a63fd8 Make linprocfs(5) create /proc/bus/pci/devices/, and linsysfs(5)
create /sys/class/power_supply/.  This silences some warnings
from biology/linux-foldingathome.

Reported by:	0mp
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25557
2020-07-04 11:22:35 +00:00
Tijl Coosemans
55258ab0ff Create a "drm" subdirectory for drm devices in linsysfs. Recent versions of
linux libdrm check for the existence of this directory:

https://cgit.freedesktop.org/mesa/drm/commit/?id=f8392583418aef5e27bfed9989aeb601e20cc96d

MFC after:	2 weeks
2019-09-23 12:27:55 +00:00
Dmitry Chagin
52a9e429c8 Remove wrong copyright line. Discussed with Carlos Neira.
Reported by:	Rodney W. Grimes
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D13656
2019-05-07 05:08:13 +00:00
Dmitry Chagin
4e2f69f1cf Adds sys/class/net devices to linsysfs.
Only two interfaces are created eth0 and lo and they expose
the following properties:
address, addr_len, flags, ifindex, mty, tx_queue_len and type.

Initial patch developed by Carlos Neira in 2017 and finished by me.

PR:		223722
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D13656
2019-05-06 20:01:13 +00:00
Dmitry Chagin
03ddf624e6 Remove unneeded includes.
MFC after:	2 week
2019-05-02 09:00:36 +00:00
Edward Tomasz Napierala
12f3888a98 Add sys/devices/system/cpu/{possible,present} to linsysfs(5).
That makes Linux lscpu(1) work.

Reviewed by:	dchagin
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20131
2019-05-02 08:17:29 +00:00
Warner Losh
971b5f7632 Create PCI_MATCH and pci_match_device
Create a covenience function to match PCI device IDs. It's about 15
years overdue.

Differential Revision: https://reviews.freebsd.org/D15999
2018-07-07 15:25:11 +00:00
Ed Maste
bbc8294729 linsysfs: depend on linux_common module on arm64, as on amd64
Sponsored by:	Turing Robotic Industries
2018-06-18 13:26:45 +00:00
Jamie Gritton
0e5c6bd436 Make it easier for filesystems to count themselves as jail-enabled,
by doing most of the work in a new function prison_add_vfs in kern_jail.c
Now a jail-enabled filesystem need only mark itself with VFCF_JAIL, and
the rest is taken care of.  This includes adding a jail parameter like
allow.mount.foofs, and a sysctl like security.jail.mount_foofs_allowed.
Both of these used to be a static list of known filesystems, with
predefined permission bits.

Reviewed by:	kib
Differential Revision:	D14681
2018-05-04 20:54:27 +00:00
Pedro F. Giffuni
7f2d13d607 sys/compat: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-27 15:13:23 +00:00
Tijl Coosemans
03cea61b3a Add information needed by Linux libdrm 2.4.74 (shipped with CentOS 7.4).
Create a config file for PCI devices that exposes their configuration
space.  Only fields needed by libdrm are filled in (vendor, device,
revision, subvendor and subdevice).

Link /sys/class/drm/card%d/device to the PCI device directory.
2017-10-15 19:28:14 +00:00
Tijl Coosemans
df4c975275 Set DEVNAME to dri/card%d. This works with both in-tree drm and drm-next
and is also the value used on Linux.

Tested by:	Greg V <greg@unrelenting.technology>
2017-10-15 19:21:15 +00:00
Ryan Libby
2e6418c0c5 linsysfs: quiet gcc -Wformat after r323692
Reviewed by:	cem
Sponsored by:	Dell EMC Isilon
2017-09-18 19:09:40 +00:00
Conrad Meyer
4d367f2501 linsysfs(5): Fix two unrelated issues
1. Swap the order of device_get_ivars with device_get_devclass and devclass
   name validation.  This bug was introduced in r323692.

2. Error check device_get_children and free the returned list.  This bug was
   introduced in the original linsysfs commit.

Reported by:	Oleg V. Nauman <oleg AT theweb.org.ua>, hselasky (1); hselasky (2)
Reviewed by:	hselasky
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12407
2017-09-18 17:14:13 +00:00
Conrad Meyer
2d347b2ef8 linsysfs(5): Add support for recent libdrm
Expose more information about PCI devices (and GPUs in particular) via
linsysfs to libdrm.

This allows unmodified modern 64-bit Linux libdrm to work, which allows
modern Linux Mesa to work.  The submitter reports that he tested the change
with an Ubuntu 16.04 chroot + amdgpu from graphics/drm-next-kmod.

PR:		222375
Submitted by:	Greg V <greg AT unrelenting.technology>
2017-09-17 23:40:16 +00:00
Dmitry Chagin
039aba0861 Glibc get_nprocs() and get_nprocs_conf() uses the sysfs cpu infrastructure
to get number of processors. Implement /sys/devices/system/cpu/.

MFC after:	1 month
2017-03-18 18:38:12 +00:00
Marcelo Araujo
f19e47d691 Add support to the jail framework to be able to mount linsysfs(5) and
linprocfs(5).

Differential Revision:	D2846
Submitted by:		Nikolai Lifanov <lifanov@mail.lifanov.com>
Reviewed by:		jamie
2015-07-19 08:52:35 +00:00
Dmitry Chagin
67d3974849 Introduce a new module linux_common.ko which is intended for the
following primary purposes:

1. Remove the dependency of linsysfs and linprocfs modules from linux.ko,
which will be architecture specific on amd64.

2. Incorporate into linux_common.ko general code for platforms on which
we'll support two Linuxulator modules (for both instruction set - 32 & 64 bit).

3. Move malloc(9) declaration to linux_common.ko, to enable getting memory
usage statistics properly.

Currently linux_common.ko incorporates a code from linux_mib.c and linux_util.c
and linprocfs, linsysfs and linux kernel modules depend on linux_common.ko.

Temporarily remove dtrace garbage from linux_mib.c and linux_util.c

Differential Revision:	https://reviews.freebsd.org/D1072
In collaboration with:	Vassilis Laganakos.

Reviewed by:	trasz
2015-05-24 15:51:18 +00:00
Gleb Smirnoff
eedc7fd9e8 Provide includes that are needed in these files, and before were read
in implicitly via if.h -> if_var.h pollution.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2013-10-26 18:18:50 +00:00
Martin Matuska
41c0675e6e Add procfs to jail-mountable filesystems.
Reviewed by:	jamie
MFC after:	1 week
2012-02-29 00:30:18 +00:00
Dag-Erling Smørgrav
36b0a37317 Remove no-op assignment.
Submitted by:	clang via arundel@
MFC after:	2 weeks
2010-11-15 23:14:14 +00:00
Dag-Erling Smørgrav
771709eb78 Add a pn_destroy field to pfs_node. This field points to a destructor
function which is called from pfs_destroy() before the node is reclaimed.

Modify pfs_create_{dir,file,link}() to accept a pointer to a destructor
function in addition to the usual attr / fill / vis pointers.

This breaks both the programming and binary interfaces between pseudofs
and its consumers.  It is believed that there are no pseudofs consumers
outside the source tree, so that the impact of this change is minimal.

Submitted by:	Aniruddha Bohra <bohra@cs.rutgers.edu>
2007-03-12 12:16:52 +00:00
Alexander Leidinger
5ac7315788 MFP4 (110957)
Use TAILQ_FOREACH_SAFE instead of the unsafe one where an item is removed
from the queue.

This prevents a panic on kldunload.

Submitted by:	rdivacky
Tested by:	bsam
2006-12-03 21:00:31 +00:00
Doug Ambrisko
0b1c233427 Remove the dependency on procfs since it isn't used.
Noticed by:	des
2006-05-11 15:27:58 +00:00
Doug Ambrisko
32397ce071 Add in linsysfs. A linux 2.6 like sys filesystem to pacify the Linux
LSI MegaRAID SAS utility.

Sponsored by:		IronPort Systems
Man page help from:	brueffer
2006-05-09 22:27:01 +00:00