summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2006-06-14 13:09:46 +0000
committerRoger Leigh <rleigh@debian.org>2006-06-14 13:09:46 +0000
commitfc8c2c2b2e3c7a4bf6e7a64f370583bdfd66bc48 (patch)
tree6b4f67d84fac1db8473092defb8ce55812a5bb16
parent4c6321982d1dc00b5ebd9e8874a48b8cb401efc8 (diff)
downloadschroot-fc8c2c2b2e3c7a4bf6e7a64f370583bdfd66bc48.tar.gz
* schroot/sbuild-personality.cc
(personality): On Linux, default to initialising with the current process' personality, otherwise initialise to "undefined". (get_name): New method. Return the current personality. * schroot/sbuild-personality.h: Document constructors fully, and add a get method to get the personality type.
-rw-r--r--ChangeLog10
-rw-r--r--schroot/sbuild-personality.cc14
-rw-r--r--schroot/sbuild-personality.h20
3 files changed, 41 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 5c5c748e..80523708 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2006-06-14 Roger Leigh <rleigh@whinlatter.ukfsn.org>
+
+ * schroot/sbuild-personality.cc
+ (personality): On Linux, default to initialising with the current
+ process' personality, otherwise initialise to "undefined".
+ (get_name): New method. Return the current personality.
+
+ * schroot/sbuild-personality.h: Document constructors fully, and
+ add a get method to get the personality type.
+
2006-06-14 Roger Leigh <rleigh@debian.org>
* debian/changelog: dchroot doesn't need to Replace schroot.
diff --git a/schroot/sbuild-personality.cc b/schroot/sbuild-personality.cc
index 231b1a68..5b984115 100644
--- a/schroot/sbuild-personality.cc
+++ b/schroot/sbuild-personality.cc
@@ -76,7 +76,13 @@ sbuild::personality::personalities(initial_personalities,
initial_personalities + (sizeof(initial_personalities) / sizeof(initial_personalities[0])));
sbuild::personality::personality ():
- persona(0xffffffff)
+ persona(
+#ifdef __linux__
+ ::personality(0xffffffff)
+#else
+ 0xffffffff
+#endif
+ )
{
}
@@ -126,6 +132,12 @@ sbuild::personality::get_name () const
return find_personality(this->persona);
}
+sbuild::personality::type
+sbuild::personality::get () const
+{
+ return this->persona;
+}
+
void
sbuild::personality::set () const
{
diff --git a/schroot/sbuild-personality.h b/schroot/sbuild-personality.h
index e0bef5a7..68ce12b7 100644
--- a/schroot/sbuild-personality.h
+++ b/schroot/sbuild-personality.h
@@ -47,16 +47,24 @@ namespace sbuild
/// Exception type.
typedef runtime_error_custom<personality> error;
- /// The constructor.
+ /**
+ * The constructor. On Linux systems, this is initialised with
+ * the current process' personality. On non-Linux systems, it is
+ * initialised as "undefined".
+ */
personality ();
/**
* The constructor.
+ *
+ * @param persona the persona to set.
*/
personality (type persona);
/**
* The constructor.
+ *
+ * @param persona the persona to set.
*/
personality (std::string const& persona);
@@ -71,7 +79,15 @@ namespace sbuild
std::string const& get_name () const;
/**
- * Set personality. This sets the personality (if valid) using
+ * Get the personality.
+ *
+ * @returns the personality.
+ */
+ type
+ get () const;
+
+ /**
+ * Set the process personality. This sets the personality (if valid) using
* the personality(2) system call. If setting the personality
* fails, an error is thown.
*/