From: random832@fastmail.com (Random832)
Subject: [TUHS] Were all of you.. Hippies?
Date: Fri, 24 Mar 2017 09:55:23 -0400 [thread overview]
Message-ID: <1490363723.1727942.922198848.7E13EB12@webmail.messagingengine.com> (raw)
In-Reply-To: <75699103-DFF1-485E-A1C0-63D62F11A62C@tfeb.org>
On Fri, Mar 24, 2017, at 06:21, Tim Bradshaw wrote:
> And if, for instance, I have a regular need to enumerate various
> properties of the avatars of the PCI devices in the filesystem, I might
> decide to write a program which does that, rather than patching together
> some arcane mass of cat | sed |awk each time (if even the contents of the
> avatars isn't some awful binary blob, which I think it should not be but
> whether that's a Unixism or not I am not sure).
If you think parsing a binary blob can't be done in a shell script,
you're not trying hard enough. Relevant tools include dd [with the seek
and skip], od, head and tail [in byte count mode of course]. For
creating binary data, printf is sufficient.
If you think that parsing a binary blob *shouldn't* be done in a shell
script, and the suggestion is absolutely horrifying, you're of course
correct.
> (None of this is meant to imply that systems which have such commands
> have got this right -- I completely agree that they should present things
> in the filesystem -- just that they could have got it right and the
> command might still exist.)
List of files opened by lspci:
/sys/bus/pci/devices
/sys/bus/pci/devices/{each
subdirectory}/{resource,irq,vendor,device,class}
/sys/bus/pci/devices/{each subdirectory}/{config,label}
/sys/bus/pci/slots
/usr/share/misc/pci.ids{.gz,}
/etc/passwd and various other files that libc's "nsswitch" getpw* is to
blame for, to locate the home directory for the following
~/.pciids-cache
/etc/udev/udev.conf
{various directories}/hwdb.bin
Honestly I'm not sure how anyone can be aware of how extensive Linux's
/proc and /sys filesystems are and assume that tools like lspci etc are
doing anything but collating data found in them.
The content of all of those files [well, all the /proc ones that are
actually device avatars - i suspect hwdb.bin is not] is textual (often a
single hexadecimal constant), and it's therefore probably possible to
write it in sh and awk if you had to. But what's wrong with C?
next prev parent reply other threads:[~2017-03-24 13:55 UTC|newest]
Thread overview: 90+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-20 21:48 Steffen Nurpmeso
2017-03-20 22:10 ` Dave Horsfall
2017-03-20 22:32 ` Ron Natalie
2017-03-20 23:05 ` ron minnich
2017-03-21 2:51 ` Nick Downing
2017-03-21 20:28 ` Josh Good
2017-03-23 20:18 ` Michael Parson
2017-03-23 20:51 ` ron minnich
2017-03-24 0:18 ` Josh Good
2017-03-24 0:27 ` Larry McVoy
2017-03-24 1:03 ` ron minnich
2017-03-24 1:05 ` Larry McVoy
2017-03-24 2:33 ` Andrew Warkentin
2017-03-24 5:17 ` Random832
2017-03-24 5:37 ` Erik E. Fair
2017-03-24 13:33 ` Random832
[not found] ` <20170324034915.GA23802@mcvoy.com>
2017-03-25 0:41 ` Andrew Warkentin
2017-03-25 5:01 ` Random832
2017-03-25 12:48 ` Andrew Warkentin
2017-03-24 5:14 ` Random832
2017-03-24 6:06 ` ron minnich
2017-03-25 0:02 ` Dave Horsfall
2017-03-25 0:42 ` Toby Thain
2017-03-24 7:23 ` shawn wilson
2017-03-24 23:55 ` Josh Good
2017-03-25 3:55 ` ron minnich
2017-03-25 4:52 ` Steve Johnson
2017-03-25 13:48 ` Jason Stevens
2017-03-25 18:51 ` Clem Cole
2017-03-25 22:26 ` Josh Good
2017-03-26 2:52 ` Clem Cole
2017-03-24 10:21 ` Tim Bradshaw
2017-03-24 13:55 ` Random832 [this message]
2017-03-24 14:53 ` Tim Bradshaw
2017-03-24 2:33 ` Dan Cross
2017-03-24 3:53 ` Clem Cole
2017-03-24 7:15 ` shawn wilson
2017-03-24 7:37 ` Kurt H Maier
2017-03-24 8:06 ` shawn wilson
2017-03-24 15:22 ` Dan Cross
[not found] ` <CALMnNGj6jcM5E1jJtxSnhnyQPBV7Hn4B06=tm1vv0TfKV=Bs1A@mail.gmail.com>
2017-03-24 22:09 ` Dan Cross
2017-03-24 15:34 ` Chet Ramey
2017-03-24 15:30 ` Chet Ramey
2017-03-24 17:09 ` Kurt H Maier
2017-03-20 23:08 ` Dave Horsfall
2017-03-21 0:10 ` Dan Cross
2017-03-21 2:09 ` Dave Horsfall
2017-03-22 12:50 ` Tim Bradshaw
2017-03-22 15:27 ` Dave Horsfall
2017-03-20 22:17 Noel Chiappa
2017-03-21 12:19 ` Steffen Nurpmeso
2017-03-21 12:48 ` arnold
2017-03-21 13:29 ` Jason Stevens
2017-03-23 10:13 ` Steffen Nurpmeso
2017-03-23 12:08 ` Jason Stevens
2017-03-20 23:28 Doug McIlroy
[not found] ` <CAH_OBifeRyD__=TKTa=bMtFBMg9LsrCOyB+sSrO54Ezc-+zJbw@mail.gmail.com>
2017-03-21 1:24 ` shawn wilson
2017-03-21 16:20 ` Ron Natalie
2017-03-21 1:45 ` Derrik Walker v2.0
2017-03-22 17:49 Noel Chiappa
2017-03-22 22:35 ` Nick Downing
2017-03-23 8:56 ` shawn wilson
2017-03-23 13:13 ` Chet Ramey
2017-03-23 14:00 ` Tim Bradshaw
2017-03-23 16:22 Noel Chiappa
2017-03-23 23:40 ` Wesley Parish
2017-03-24 13:41 Noel Chiappa
2017-03-26 1:16 Noel Chiappa
2017-03-26 1:35 Noel Chiappa
2017-03-26 1:45 ` Kurt H Maier
[not found] ` <CAH1jEzb=ZzPMT6YWg9pbR4T=s_ckB4YFsBJnefj8AEatdBY_MQ@mail.gmail.com>
2017-03-26 4:46 ` Nick Downing
2017-03-26 2:49 ` ron minnich
2017-03-26 3:01 ` Andrew Warkentin
2017-03-26 3:11 Noel Chiappa
2017-03-26 3:17 ` Andrew Warkentin
2017-03-26 3:21 ` Kurt H Maier
2017-03-26 3:49 ` Dan Cross
2017-03-26 3:55 ` ron minnich
2017-03-26 16:26 ` Lyndon Nerenberg
2017-03-26 16:40 ` Larry McVoy
2017-03-26 18:35 ` Steve Simon
2017-03-26 20:05 ` Andy Kosela
2017-03-26 3:32 Noel Chiappa
2017-03-26 3:51 ` Dan Cross
2017-03-26 11:31 ` Ron Natalie
2017-03-26 22:06 ` Larry McVoy
2017-03-26 23:29 ` Wesley Parish
2017-03-27 4:20 ` Dave Horsfall
2017-03-26 4:31 ` Warner Losh
2017-03-27 3:36 Doug McIlroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1490363723.1727942.922198848.7E13EB12@webmail.messagingengine.com \
--to=random832@fastmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).