All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ron Kuris <rk@unify.com>
To: Ivan Gyurdiev <ivg2@cornell.edu>
Cc: Stephen Smalley <sds@tycho.nsa.gov>,
	selinux@tycho.nsa.gov, Joshua Brindle <jbrindle@tresys.com>
Subject: Re: Loading things into policy
Date: Wed, 19 Oct 2005 11:13:56 -0700	[thread overview]
Message-ID: <43568CE4.4030901@unify.com> (raw)
In-Reply-To: <43568C6E.5040106@cornell.edu>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ivan Gyurdiev wrote:

>>> add() - add a new thing, or fail if it exists (maybe add a
>>> configurable parameter saying whether we should fail, or only
>>> warn if it exists) modify() - add a new thing, or modify it if
>>> it exists
>>>
>>> In addition, I'm thinking of adding: set() - modify a thing,
>>> but don't add it if it doesn't exist (for booleans).
>>>
>>
>>
>> add() and set() as described above seem to be fundamental
>> primitives; modify() seems optional as it can be constructed by
>> the caller from the other two, i.e. if (add() < 0 && errno ==
>> EEXIST) { set(); }.
>>
>
> I plan to support those functions in all databases: Now, make add()
> take O(n) time, make set take O(n) time, and you're most likely
> taking twice as much time in modify() as you should be. Yes, I
> agree it's optional, but it's still useful to have... just like
> iterate() and list() can be implemented on top of each other
> (though iterate() over list() is a much worse idea than list() over
> iterate()).

Another interesting point is that your pseudo-code suffers from a race
condition: what if two processes try to add() at the same time?

Ron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDVozkVkC/44kdyuYRAmetAKDXOnQYpFQXEPe9INwWigoZ8D6uiACeLDQM
0A6ZMw89JEpm5l/h9DFATtU=
=yY0K
-----END PGP SIGNATURE-----



--
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.

  reply	other threads:[~2005-10-19 18:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-19  0:33 Loading things into policy Ivan Gyurdiev
2005-10-19  0:37 ` Ivan Gyurdiev
2005-10-19 13:45 ` Joshua Brindle
2005-10-19 16:31   ` Ivan Gyurdiev
2005-10-19 17:36     ` Stephen Smalley
2005-10-19 17:20 ` Stephen Smalley
2005-10-19 17:31   ` Stephen Smalley
2005-10-19 17:51   ` Stephen Smalley
2005-10-19 18:11   ` Ivan Gyurdiev
2005-10-19 18:13     ` Ron Kuris [this message]
2005-10-19 18:20       ` Stephen Smalley
2005-10-19 18:31       ` Ivan Gyurdiev
2005-10-19 18:28     ` Ivan Gyurdiev
2005-10-19 19:12       ` Ivan Gyurdiev

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=43568CE4.4030901@unify.com \
    --to=rk@unify.com \
    --cc=ivg2@cornell.edu \
    --cc=jbrindle@tresys.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /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.