Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1575789
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/2] tools/lib/api/fs: Add procfs int read/write helpers |
| Date | 2017-02-07 16:10 +0100 |
| Message-ID | <t8fz3-4vL-3@gated-at.bofh.it> (permalink) |
| References | (4 earlier) <t7QU1-4ZM-1@gated-at.bofh.it> <t82sa-4gx-27@gated-at.bofh.it> <t82sa-4gx-25@gated-at.bofh.it> <t834R-4uf-1@gated-at.bofh.it> <t8blM-1E3-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Em Tue, Feb 07, 2017 at 11:30:01AM +0100, Borislav Petkov escreveu:
> On Mon, Feb 06, 2017 at 10:43:56PM -0300, Arnaldo Carvalho de Melo wrote:
> > > int sysctl__read_int(const char *sysctl, int *value);
> >
> > Isn't sysctl__read_int() what you want?
>
> Right, so looking at this: don't you think that having both sysctl__*
> and procfs__* is a little redundant?
>
> The sysctl* things are doing the accesses over proc so shouldn't it all
> be procfs__* interfaces and no sysctl__* ones at all
>
> or
>
> at least the sysctl__* ones should call the procfs__* ones?
Well, I see this as: sysctls are implemented as files in procfs, but
could conceivably be implemented somewhere else, just like the events
file was implemented in debugfs but then was moved to a separate
filesystem type, tracefs.
So it being in procfs is an implementation detail, what I'm interested
are sysctls, and names for sysctls will be appended to wherever the
sysctl is made available in the file system.
For instance:
[root@jouet ~]# sysctl kernel.watchdog
kernel.watchdog = 1
[root@jouet ~]#
So the sysctl is "kernel.watchdog" and it is set to one.
So, I suggest you use:
if (sysctl__read_int("kernel/watchdog", &watchdog_value) == 0)
/* do whatever you want with it */
And forget that under the hood this is in something called "procfs".
:-)
- Arnaldo
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH] perf/stat: Add --disable-hwdt Borislav Petkov <bp@alien8.de> - 2017-02-06 13:20 +0100
Re: [RFC PATCH] perf/stat: Add --disable-hwdt Ingo Molnar <mingo@kernel.org> - 2017-02-06 13:30 +0100
Re: [RFC PATCH] perf/stat: Add --disable-hwdt Borislav Petkov <bp@alien8.de> - 2017-02-06 13:50 +0100
Re: [RFC PATCH] perf/stat: Add --disable-hwdt Borislav Petkov <bp@alien8.de> - 2017-02-06 13:50 +0100
Re: [RFC PATCH] perf/stat: Add --disable-hwdt Robert Richter <rric@kernel.org> - 2017-02-06 14:20 +0100
Re: [RFC PATCH] perf/stat: Add --disable-hwdt Borislav Petkov <bp@alien8.de> - 2017-02-06 14:30 +0100
Re: [RFC PATCH] perf/stat: Add --disable-hwdt Ingo Molnar <mingo@kernel.org> - 2017-02-07 08:30 +0100
Re: [RFC PATCH] perf/stat: Add --disable-hwdt Borislav Petkov <bp@alien8.de> - 2017-02-07 12:00 +0100
Re: [RFC PATCH] perf/stat: Add --disable-hwdt Borislav Petkov <bp@alien8.de> - 2017-02-07 16:10 +0100
Re: [RFC PATCH] perf/stat: Add --disable-hwdt Borislav Petkov <bp@alien8.de> - 2017-02-11 18:10 +0100
Re: [RFC PATCH] perf/stat: Add --disable-hwdt Ingo Molnar <mingo@kernel.org> - 2017-02-11 19:00 +0100
Re: [RFC PATCH] perf/stat: Add --disable-hwdt Borislav Petkov <bp@alien8.de> - 2017-02-11 19:40 +0100
Re: [RFC PATCH] perf/stat: Add --disable-hwdt Ingo Molnar <mingo@kernel.org> - 2017-02-11 21:50 +0100
Re: [RFC PATCH] perf/stat: Add --disable-hwdt Vince Weaver <vince@deater.net> - 2017-02-06 15:30 +0100
Re: [RFC PATCH] perf/stat: Add --disable-hwdt Borislav Petkov <bp@alien8.de> - 2017-02-06 18:10 +0100
Re: [RFC PATCH] perf/stat: Add --disable-hwdt Borislav Petkov <bp@alien8.de> - 2017-02-07 02:10 +0100
[PATCH 1/2] tools/lib/api/fs: Add procfs int read/write helpers Borislav Petkov <bp@alien8.de> - 2017-02-07 02:10 +0100
Re: [PATCH 1/2] tools/lib/api/fs: Add procfs int read/write helpers Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-07 02:50 +0100
Re: [PATCH 1/2] tools/lib/api/fs: Add procfs int read/write helpers Borislav Petkov <bp@alien8.de> - 2017-02-07 11:40 +0100
Re: [PATCH 1/2] tools/lib/api/fs: Add procfs int read/write helpers Borislav Petkov <bp@alien8.de> - 2017-02-07 16:10 +0100
Re: [PATCH 1/2] tools/lib/api/fs: Add procfs int read/write helpers Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-07 16:40 +0100
Re: [PATCH 1/2] tools/lib/api/fs: Add procfs int read/write helpers Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-07 16:10 +0100
[PATCH 2/2] perf stat: Disable HW watchdog around a perf stat session Borislav Petkov <bp@alien8.de> - 2017-02-07 02:20 +0100
Re: [PATCH 2/2] perf stat: Disable HW watchdog around a perf stat session Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-07 02:50 +0100
Re: [RFC PATCH] perf/stat: Add --disable-hwdt Ingo Molnar <mingo@kernel.org> - 2017-02-06 13:50 +0100
csiph-web