From: Daniel J Walsh <dwalsh@redhat.com>
To: James Antill <james.antill@redhat.com>
Cc: Stephen Smalley <sds@tycho.nsa.gov>,
Steve Grubb <sgrubb@redhat.com>, SE Linux <selinux@tycho.nsa.gov>
Subject: Re: Real simple cache that removes most of the lookups in mcstrans
Date: Wed, 17 May 2006 12:19:31 -0400 [thread overview]
Message-ID: <446B4D13.8080605@redhat.com> (raw)
In-Reply-To: <1147879972.3469.139.camel@code.and.org>
James Antill wrote:
> On Wed, 2006-05-17 at 06:45 -0400, Daniel J Walsh wrote:
>
>> Basically check if the previous lookup was the same context, if yes
>> return the same translation. Otherwise do the lookup.
>>
>
> Are we sure one is enough, lsof -Z does both s0 and s0-s0:c0.c255 and
> they are basically mixed (I appreciate it is much easier to code a cache
> of 1 than >1 though).
>
> Also:
>
> + } else {
> + free(prev_t2r_trans);
> + free(prev_t2r_raw);
> + if (trans_to_raw_context(trans, rawp))
> + *rawp = strdup(trans);
> + prev_t2r_trans=strdup(trans);
> + prev_t2r_raw=strdup(*rawp);
>
> ...this is bad when trans_to_raw_context, the first strdup() fails or
> the last strdup() fails.
>
>
Only reason strdup fails is ENOMEM. With ENOMEM you are almost
garanteed you are going to crash anyways. gstrdup does a exit when it
runs out of memory.
So we can messy up the code with a lot of checks that end up doing
little. Your choice.
>> Also included Russells patch for avcstat.
>>
>
> - printf("%10u %10u %10u %10u %10u %10u\n",
> + printf("%10Lu %10Lu %10Lu %10Lu %10Lu %10Lu\n",
>
> It's somewhat minor, but that should be %llu %Lu is a somewhat common
> extension. From man printf:
>
> ll (ell-ell). A following integer conversion corresponds to a long
> long int or unsigned long long int argument, or a following n
> conversion corresponds to a pointer to a long long int argument.
>
> L A following a, A, e, E, f, F, g, or G conversion corresponds to
> a long double argument. (C99 allows %LF, but SUSv2 does not.)
>
>
>
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
next prev parent reply other threads:[~2006-05-17 16:19 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-17 10:45 Real simple cache that removes most of the lookups in mcstrans Daniel J Walsh
2006-05-17 12:26 ` Steve Grubb
2006-05-17 13:52 ` Joshua Brindle
2006-05-17 15:03 ` Daniel J Walsh
2006-05-17 15:15 ` Joshua Brindle
2006-05-17 16:21 ` Daniel J Walsh
2006-05-17 17:09 ` Joshua Brindle
2006-05-17 17:30 ` Steve Grubb
2006-05-17 17:32 ` Joshua Brindle
2006-05-19 13:32 ` Russell Coker
2006-05-19 13:51 ` Joshua Brindle
2006-05-19 14:07 ` Stephen Smalley
2006-05-19 14:40 ` Russell Coker
2006-05-20 21:47 ` Joshua Brindle
2006-05-21 3:31 ` Russell Coker
2006-05-22 18:04 ` Stephen Smalley
2006-05-17 16:22 ` James Antill
[not found] ` <1147879972.3469.139.camel@code.and.org>
2006-05-17 16:19 ` Daniel J Walsh [this message]
2006-05-17 16:56 ` James Antill
2006-05-17 17:06 ` Stephen Smalley
2006-05-18 16:21 ` Daniel J Walsh
2006-05-17 18:22 ` Daniel J Walsh
2006-05-22 20:45 ` Stephen Smalley
2006-05-17 18:35 ` Resent with correct patch Daniel J Walsh
2006-05-17 18:44 ` Stephen Smalley
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=446B4D13.8080605@redhat.com \
--to=dwalsh@redhat.com \
--cc=james.antill@redhat.com \
--cc=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
--cc=sgrubb@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.