[systemd-devel] [PATCH] util: preserve get_process_capeff behavior

Shawn Landden shawnlandden at gmail.com
Sat Sep 21 13:22:58 PDT 2013


On Thu, Sep 19, 2013 at 2:40 PM, Zbigniew Jędrzejewski-Szmek <
zbyszek at in.waw.pl> wrote:

> On Thu, Sep 19, 2013 at 10:28:40AM -0700, Shawn Landden wrote:
> > We can't optimize the strcspn(t, WHITESPACE); to a strchr(t, '\n') - t;
> > because of the " kB" that meminfo and a few other places have, that we
> want
> > to drop.
> >
> > get_status_field() has to be run every time we log a message, and I am
> > starting to not like this function at all. I think we should go back to
> > having it hand-rolled in get_process_capeff(), at least for that one in
> the
> > hot-path.
> Hi Shawn,
>
> I think there's value in having one function to parse /proc/self/status.
> I pushed some tests and a simple fix to avoid backtracking.

It wasn't backtracking more than it has already gone forward. I even had an
assert for this, anyways, the current version is correct.

> Anyway, this
> parsing might be going away, once we start using the equivalent of
> SCM_CREDENTIALS
> for capabilities,

That requires a kernel patch, meanwhile we will have compatibility code for
old kernels...I think my optimized version still makes sense, although
something like SCM_CREDIENTIALS would certainly be more optimized.

> so I don't think it makes sense to optimize it at this point.
>
> Zbyszek
>



-- 

---
Shawn Landden
+1 360 389 3001 (SMS preferred)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20130921/676bbe0d/attachment.html>


More information about the systemd-devel mailing list