Re: [systemd-devel] [PATCH] cryptsetup: support discards (TRIM)

2012-05-21 Thread Lennart Poettering
On Sat, 19.05.12 09:05, Matthew Monaco (m...@0x01b.net) wrote:

 From: Matthew Monaco matthew.mon...@0x01b.net

Thanks! Applied!

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] journalctl: fix built-in usage output

2012-05-21 Thread Lennart Poettering
On Fri, 18.05.12 21:58, Daniel Mack (zon...@gmail.com) wrote:

 This brings journalctl's built-in usage output in sync with the man page.
 There are no commands to pass, and the help screen should not confuse
 users.

Thanks! Applied!

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] sd-pam: Drop uid so parent signal arrives at child.

2012-05-21 Thread Lennart Poettering
On Thu, 17.05.12 12:17, Auke Kok (auke-jan.h@intel.com) wrote:

 The PAM helper thread needs to capture the death signal from the
 parent, but is prohibited from doing so since when the child dies
 as normal user, the kernel won't allow it to send a TERM to the
 PAM helper thread which is running as root.
 
 This causes the PAM threads to never exit, accumulating after
 user sessions exit.
 
 There is however really no need to keep the PAM threads running as
 root, so, we can just setresuid() to the same user as defined in the
 unit file for the parent thread (User=). This makes the TERM signal
 arrive as normal. In case setresuid() fails, we ignore the error, so
 we at least fall back to the current behaviour.

Applied. In the long run we probably should reshuffle all of this so
that the pam stuff is moved outside of the systemd binary and is
implemented via an explicit wrapper tool. The fact that the pam thingy
currently is a child of the main process is kinda neat, but probably not
the best choice after all.

We shouldn't leave long running children of PID 1 around that have not
exec()'ed to another binary, since they might cause unnecessary
pagefaults in PID 1. hence the idea of splitting this into its own
binary.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] RFC : PATCH: initial implementation of system wide rlimit

2012-05-21 Thread Frederic Crozat
Le mardi 03 avril 2012 à 15:44 +0200, Frederic Crozat a écrit :
 Le lundi 02 avril 2012 à 22:59 +0200, Lennart Poettering a écrit :
  On Fri, 30.03.12 17:20, Frederic Crozat (fcro...@suse.com) wrote:
  
   From 5008080dda662208278c159213adbd5211496043 Mon Sep 17 00:00:00 2001
   From: Frederic Crozat fcro...@suse.com
   Date: Thu, 29 Mar 2012 17:53:41 +0200
   Subject: [PATCH 1/2] macro: add newdup macro, equivalent of new + memdup 
   but
type-safe
   
   ---
src/macro.h |1 +
1 files changed, 1 insertions(+), 0 deletions(-)
   
   diff --git a/src/macro.h b/src/macro.h
   index 19f259e..a85e72d 100644
   --- a/src/macro.h
   +++ b/src/macro.h
   @@ -137,6 +137,7 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) {

#define memzero(x,l) (memset((x), 0, (l)))
#define zero(x) (memzero((x), sizeof(x)))
   +#define newdup(x,l) ( (x= new(typeof(*l),1)) ? 
   memcpy((x),(l),sizeof(*l)) : NULL)
  
  Hmm, I was more thinking of a definition much closer to new() and
  new0(), without typeof, but with allowing allocation of an array
  
  #define newdup(t, p, n) ((t*)memdup(p,sizeof(t)*(n)))
 
 New version attached, based on your comments.

Rebased version, including a fix to newdup macro which went to git some
weeks ago.

-- 
Frederic Crozat fcro...@suse.com
SUSE
From 5944312f891658446edea08e6907dff05daebdec Mon Sep 17 00:00:00 2001
From: Frederic Crozat fcro...@suse.com
Date: Mon, 21 May 2012 16:53:18 +0200
Subject: [PATCH 1/2] util: fix typo in newdup

---
 src/shared/util.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/shared/util.h b/src/shared/util.h
index 3dce047..33a7e7c 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -103,7 +103,7 @@ bool streq_ptr(const char *a, const char *b);
 
 #define newa(t, n) ((t*) alloca(sizeof(t)*(n)))
 
-#define newdup(t, p, n) ((t*) memdup(p, sizeof(t)*(n))
+#define newdup(t, p, n) ((t*) memdup(p, sizeof(t)*(n)))
 
 #define malloc0(n) (calloc((n), 1))
 
-- 
1.7.7


From f175a58a4a183a0d34cb13b77290425eb3f3c9b0 Mon Sep 17 00:00:00 2001
From: Frederic Crozat fcro...@suse.com
Date: Wed, 21 Mar 2012 18:03:40 +0100
Subject: [PATCH 2/2] allow system wide limits for services

---
 src/core/main.c|   28 
 src/core/manager.c |7 +++
 src/core/manager.h |2 ++
 src/core/service.c |8 
 4 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/src/core/main.c b/src/core/main.c
index 8c25819..5e37b47 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -85,6 +85,7 @@ static ExecOutput arg_default_std_output = EXEC_OUTPUT_JOURNAL;
 static ExecOutput arg_default_std_error = EXEC_OUTPUT_INHERIT;
 static usec_t arg_runtime_watchdog = 0;
 static usec_t arg_shutdown_watchdog = 10 * USEC_PER_MINUTE;
+static struct rlimit *default_rlimit[RLIMIT_NLIMITS] = {};
 
 static FILE* serialization = NULL;
 
@@ -665,6 +666,22 @@ static int parse_config_file(void) {
 { Manager, JoinControllers,   config_parse_join_controllers, 0, arg_join_controllers },
 { Manager, RuntimeWatchdogSec,config_parse_usec, 0, arg_runtime_watchdog},
 { Manager, ShutdownWatchdogSec,   config_parse_usec, 0, arg_shutdown_watchdog   },
+{ Manager, LimitCPU,  config_parse_limit,0, default_rlimit[RLIMIT_CPU]},
+{ Manager, LimitFSIZE,config_parse_limit,0, default_rlimit[RLIMIT_FSIZE]},
+{ Manager, LimitDATA, config_parse_limit,0, default_rlimit[RLIMIT_DATA]},
+{ Manager, LimitSTACK,config_parse_limit,0, default_rlimit[RLIMIT_STACK]},
+{ Manager, LimitCORE, config_parse_limit,0, default_rlimit[RLIMIT_CORE]},
+{ Manager, LimitRSS,  config_parse_limit,0, default_rlimit[RLIMIT_RSS]},
+{ Manager, LimitNOFILE,   config_parse_limit,0, default_rlimit[RLIMIT_NOFILE]},
+{ Manager, LimitAS,   config_parse_limit,0, default_rlimit[RLIMIT_AS]},
+{ Manager, LimitNPROC,config_parse_limit,0, default_rlimit[RLIMIT_NPROC]},
+{ Manager, LimitMEMLOCK,  config_parse_limit,0, default_rlimit[RLIMIT_MEMLOCK]},
+{ Manager, LimitLOCKS,config_parse_limit,0, default_rlimit[RLIMIT_LOCKS]},
+{ Manager, LimitSIGPENDING,   config_parse_limit,0, default_rlimit[RLIMIT_SIGPENDING]},
+{ Manager, LimitMSGQUEUE, config_parse_limit,0, default_rlimit[RLIMIT_MSGQUEUE]},
+{ Manager, LimitNICE, config_parse_limit,0, default_rlimit[RLIMIT_NICE]},
+{ Manager, LimitRTPRIO,   config_parse_limit,0, default_rlimit[RLIMIT_RTPRIO]},
+{ Manager, LimitRTTIME, 

[systemd-devel] Patch: fix typo in newdup

2012-05-21 Thread Frederic Crozat

-- 
Frederic Crozat fcro...@suse.com
SUSE
From 5944312f891658446edea08e6907dff05daebdec Mon Sep 17 00:00:00 2001
From: Frederic Crozat fcro...@suse.com
Date: Mon, 21 May 2012 16:53:18 +0200
Subject: [PATCH] util: fix typo in newdup

---
 src/shared/util.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/shared/util.h b/src/shared/util.h
index 3dce047..33a7e7c 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -103,7 +103,7 @@ bool streq_ptr(const char *a, const char *b);
 
 #define newa(t, n) ((t*) alloca(sizeof(t)*(n)))
 
-#define newdup(t, p, n) ((t*) memdup(p, sizeof(t)*(n))
+#define newdup(t, p, n) ((t*) memdup(p, sizeof(t)*(n)))
 
 #define malloc0(n) (calloc((n), 1))
 
-- 
1.7.7

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] delta: Support filtering what type of deltas to show

2012-05-21 Thread Lennart Poettering
On Wed, 16.05.12 18:38, Gergely Nagy (alger...@balabit.hu) wrote:

 Not everyone is interested in every kind of deltas (and some might
 even be interested knowing which files do not have overrides), so this
 here is an implementation of a --type=LIST... option for
 systemd-delta, that makes it possible to filter what subset of deltas
 we want.
 
 The available modifiers are masked, equivalent, redirected, overriden,
 and unchanged - they should be self explanatory, and the man page
 explains them in a little more detail anyway.
 
 As a side effect, in case of overriden files, the diff output was made
 optional.
 
 By default, everything is shown (with a diff, if appropriate) except
 for completely unchanged files.

For the sake of keeping the archives up-to-date. This is merged since a while. 
Thanks!

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] delta: Support filtering what type of deltas to show

2012-05-21 Thread Lennart Poettering
On Wed, 16.05.12 22:57, Nis Martensen (nis.marten...@web.de) wrote:

 Am 16.05.2012 18:38, schrieb Gergely Nagy:
  The available modifiers are masked, equivalent, redirected, overriden,
  and unchanged - they should be self explanatory, and the man page
  explains them in a little more detail anyway.
 
 You may want to add another d to override the spell checker, though.
 Follow-up patch attached.

Rebased and merged! Thanks a lot!

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Have custom agetty behaviour even after upgadres

2012-05-21 Thread Lennart Poettering
On Wed, 16.05.12 12:07, Colin Guthrie (gm...@colin.guthr.ie) wrote:

 I thought that the actual end point of the symlink was not all that
 important...
 
 e.g. if I have:
 
 /usr/lib/systemd/system/getty@.service
 /etc/lib/systemd/system/getty@.service
 /etc/lib/systemd/system/multi-user.target.wants/getty@tty1.service -
 /usr/lib/systemd/system/getty@.service
 
 I thought that the unit file /etc/lib/systemd/system/getty@.service was
 still the one used. i.e. the symlink is merely indicative of whether the
 service is enabled or not, and the actual physical file that it points
 to is not relevant.

This is not correct. The destination is important. The algorithm works
like this: we traverse the chain of symlinks and add all their names as
alias names to the unit and load the final unit file as source and use
its name as main name of the unit file.

(OK, it's a bit more complicated, since when there is a non-instaniated
unit name in one of the symlink/filenames we implicitly instantiate it
as necessary)

 i.e. The .wants symlink only really states I'm enabled as an instance
 of getty@.service and then the normal inheritance rules of
 getty@.service resolution apply *after* that, i.e. getty@.service in
 /etc/... overrides the one in /lib/...

When looking for a unit file we first look for the instance, and follow
the symlinks there, and if that was not sucessful we look for the
template doing the same.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] Corrected do_switch_root

2012-05-21 Thread Lennart Poettering
On Wed, 16.05.12 14:22, har...@redhat.com (har...@redhat.com) wrote:

 From: Harald Hoyer har...@redhat.com
 
 do_switch_root now mount moves /dev, /proc, /sys, /run and
 removes the old root recursively.

All applied. Thanks!

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] RFC : PATCH: initial implementation of system wide rlimit

2012-05-21 Thread Frederic Crozat
Le lundi 21 mai 2012 à 18:04 +0200, Frederic Crozat a écrit :
 Le mardi 03 avril 2012 à 15:44 +0200, Frederic Crozat a écrit :
  Le lundi 02 avril 2012 à 22:59 +0200, Lennart Poettering a écrit :
   On Fri, 30.03.12 17:20, Frederic Crozat (fcro...@suse.com) wrote:
   
From 5008080dda662208278c159213adbd5211496043 Mon Sep 17 00:00:00 2001
From: Frederic Crozat fcro...@suse.com
Date: Thu, 29 Mar 2012 17:53:41 +0200
Subject: [PATCH 1/2] macro: add newdup macro, equivalent of new + 
memdup but
 type-safe

---
 src/macro.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/macro.h b/src/macro.h
index 19f259e..a85e72d 100644
--- a/src/macro.h
+++ b/src/macro.h
@@ -137,6 +137,7 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) 
{
 
 #define memzero(x,l) (memset((x), 0, (l)))
 #define zero(x) (memzero((x), sizeof(x)))
+#define newdup(x,l) ( (x= new(typeof(*l),1)) ? 
memcpy((x),(l),sizeof(*l)) : NULL)
   
   Hmm, I was more thinking of a definition much closer to new() and
   new0(), without typeof, but with allowing allocation of an array
   
   #define newdup(t, p, n) ((t*)memdup(p,sizeof(t)*(n)))
  
  New version attached, based on your comments.
 
 Rebased version, including a fix to newdup macro which went to git some
 weeks ago.

New version, addressing various comments from irc discussion and with
documentation :)

-- 
Frederic Crozat fcro...@suse.com
SUSE
From d3b2761ed6a6d0410b9eff66e2e302df76736a25 Mon Sep 17 00:00:00 2001
From: Frederic Crozat fcro...@suse.com
Date: Wed, 21 Mar 2012 18:03:40 +0100
Subject: [PATCH] allow system wide limits for services

---
 man/systemd.conf.xml |   27 +++
 src/core/main.c  |   22 ++
 src/core/manager.c   |   25 +
 src/core/manager.h   |3 +++
 src/core/service.c   |8 
 5 files changed, 85 insertions(+), 0 deletions(-)

diff --git a/man/systemd.conf.xml b/man/systemd.conf.xml
index a110f24..7dfaa18 100644
--- a/man/systemd.conf.xml
+++ b/man/systemd.conf.xml
@@ -182,6 +182,33 @@
 effect if a hardware watchdog is not
 available./para/listitem
 /varlistentry
+
+varlistentry
+termvarnameDefaultLimitCPU=/varname/term
+termvarnameDefaultLimitFSIZE=/varname/term
+termvarnameDefaultLimitDATA=/varname/term
+termvarnameDefaultLimitSTACK=/varname/term
+termvarnameDefaultLimitCORE=/varname/term
+termvarnameDefaultLimitRSS=/varname/term
+termvarnameDefaultLimitNOFILE=/varname/term
+termvarnameDefaultLimitAS=/varname/term
+termvarnameDefaultLimitNPROC=/varname/term
+termvarnameDefaultLimitMEMLOCK=/varname/term
+termvarnameDefaultLimitLOCKS=/varname/term
+termvarnameDefaultLimitSIGPENDING=/varname/term
+termvarnameDefaultLimitMSGQUEUE=/varname/term
+termvarnameDefaultLimitNICE=/varname/term
+termvarnameDefaultLimitRTPRIO=/varname/term
+termvarnameDefaultLimitRTTIME=/varname/term
+listitemparaThese settings control
+various default resource limits for units. See
+citerefentryrefentrytitlesetrlimit/refentrytitlemanvolnum2/manvolnum/citerefentry
+for details. Use the string
+varnameinfinity/varname to
+configure no limit on a specific
+resource. They can be overriden in units files
+using corresponding Limit parameter./para/listitem
+/varlistentry
 /variablelist
 /refsect1
 
diff --git a/src/core/main.c b/src/core/main.c
index 8c25819..20c0f3c 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -85,6 +85,7 @@ static ExecOutput arg_default_std_output = EXEC_OUTPUT_JOURNAL;
 static ExecOutput arg_default_std_error = EXEC_OUTPUT_INHERIT;
 static usec_t arg_runtime_watchdog = 0;
 static usec_t arg_shutdown_watchdog = 10 * USEC_PER_MINUTE;
+static struct rlimit *arg_default_rlimit[RLIMIT_NLIMITS] = {};
 
 static FILE* serialization = NULL;
 
@@ -665,6 +666,22 @@ static int parse_config_file(void) {
 { Manager, JoinControllers,   config_parse_join_controllers, 0, arg_join_controllers },
 { Manager, RuntimeWatchdogSec,config_parse_usec, 0, arg_runtime_watchdog},
 { 

Re: [systemd-devel] logind: session management

2012-05-21 Thread Lennart Poettering
On Wed, 16.05.12 16:01, David Herrmann (dh.herrm...@googlemail.com) wrote:

 Hi

Heya,

 I am currently working on kmscon, a user-space VT replacement. In it's
 current state, it simply runs a console emulator on a VT but in the
 end we want it to fully replace CONFIG_VT. To make it multi-seat
 capable I used sd-login.h and it correctly assigns drm-connectors and
 input devices to all available seats. However, I have several
 questions regarding session management (see below).
 
 The idea is to have a single process run all the terminals for all
 available seats. We listen for new and going seats and correctly
 reassign available devices. The user can now use chvt to change
 between their xserver, wayland, kmscon or some other VT. That is, if
 kmscon is not active on seat0, we drop drmMaster (and other devices)
 for seat0 and reqacuire them only when the user switches to kmscon
 again. However, all seats are supposed to be independent in respect to
 VT management (we eventually want to drop it entirely)!
 
 1) Is there any documentation of the logind DBus API? When kmscon is
 started on a seat, the user can open multiple terminals (similar to
 tabbed windows in terminal emulators). 

No there isn't (yet).

There's only this document:

http://www.freedesktop.org/wiki/Software/systemd/writing-display-managers

which explains a couple of the signals, but is far from comprehensive.

 Should I register a session
 with logind for each terminal that is opened?

Nope, session registration should be done via PAM only. Other code than
pam_systemd should never invoke the session registration bus
functions. That's at least the theory so far.

 2) How does multi-seat handle VT switches? If two seats are active, I
 guess the xservers share a single VT (lets say vt-7). If one user
 performs a chvt 1, does that switch to vt-1 for all users? In other
 words, if one user switches to kmscon, then all users are switched to
 kmscon as kmscon and an xserver cannot technically run on the same VT,
 right?

Right now kernel VT switches are only available on seat0. The X servers
run on that seat have one VT each. seats running on other seats have no
VT assigned at all.

The shell command chvt only acts on seat0.

 3) The idea behind kmscon is to set CONFIG_VT=n (for several different
 reasons but mainly to avoid having UI code in the kernel). Does
 systemd provide a simple way to replace the VT-switching logic? My
 idea was using sd_login_monitor to watch for session changes. If it
 changes, I check with sd_session_is_active() whether my session is
 still active. If not, I stop using the drm, input, etc. devices and
 for instance an xserver can show up. If the user switches to kmscon
 again, I am notified via the sd_login_monitor and
 sd_session_is_active() will be true again and I can start showing up
 again. The interface for switching VTs/sessions would then be some
 kind of sd_activate_session dbus/library call.
 However, looking at logind sources it seems the active logic is
 tightly bound to VTs. I would start working on implementing this,
 however, I'd like to get some review on the idea before I spend too
 much time in it.

It shouldn't be too hard to beef this up in logind. So far indeed only
kernel VTs are supported. 

I expect that doing the VT switching fully async won't be too much fun.

If you implement VTs in userspace I'd avoid all the complexity of kernel
VTs with the preallocated VTs and fixed device mappings. 

Honstely I am not entirely sure how virtualized VTs should exactly
work. I have one suspicion though: if we do this we probably should do
this based on a Wayland system compositor. The wayland folks are
planning to have one anyway, and it should probable be the code that
does VT switching. Also, there's a good chance that a minimal wayland
compositor for systems without opengl is doable.

So I am not entirely sure what to suggest here: a) implement hooks
in logind specifically for kmscon to emulate VTs; b) do the same, but
for a plymouth compositor; c) allow this to be abstract and allow two
implementations.

I am generally not too much of a fan of keeping things too abstract, but
maybe in this case the iface could just be kept abstract by side-effect.

We could implement VT switching via D-Bus iface. i.e. if a certain bus
name exists we use its functionality to do VT switching instead of the
kernel interfaces. This bus interface would have to provide:

- Notification about VT switches
- Call to trigger a VT switch
- Call to allocate a VT
- Call to disallocate a VT

 4) Does systemd implement some internal timeouts for device
 reassignments? Imagine drm-card0 is assigned to seat5 and the user
 reassigns it to seat6. If the xserver starts directly up on seat6, it
 might not be able to get drmMaster for the card (xserver crashes in
 this case) because the process on seat5 did not release the drmMaster
 fast enough. The VT-switching logic uses roundtrips to acknowledge
 release/acquire, however, I cannot see 

Re: [systemd-devel] logind: session management

2012-05-21 Thread Lennart Poettering
On Sat, 19.05.12 14:55, David Herrmann (dh.herrm...@googlemail.com) wrote:

  1) Is there any documentation of the logind DBus API? When kmscon is
  started on a seat, the user can open multiple terminals (similar to
  tabbed windows in terminal emulators). Should I register a session
  with logind for each terminal that is opened?
 
 There seems to be no documentation. However, as far as I can see I
 should register a single session for kmscon regardless how many
 terminals the user opens. The whole kmscon application is then
 considered one session.

The getty should register the session, not kmscon. (I assume that kmscon
does not actually do any authentication on its own, does it?)

  2) How does multi-seat handle VT switches? If two seats are active, I
  guess the xservers share a single VT (lets say vt-7). If one user
  performs a chvt 1, does that switch to vt-1 for all users? In other
  words, if one user switches to kmscon, then all users are switched to
  kmscon as kmscon and an xserver cannot technically run on the same VT,
  right?
 
 After seeing seat_can_multi_session() I can now see that only seat0 is
 considered multi_session capable (as it is registered as
 m-vtconsole). All other seats do not open VTs and do not care for VT
 switches. Hence, only one session can run on these seats.

Yes, this is the current implementation, but this is not exposed in the
bus API so that we can add multi-seat support for non-seat0 later on.

 Knowing that multi-session is not supported on seats != vtconsole, you
 probably don't have such an API. Therefore, I will have a deeper look
 into this and propose one so every seat can be multi-session capable
 (unless you explicitely reject such a feature).

Yes, this is definitely our intention.

 Switching between sessions can then be done via dbus calls instead of
 VT_ACTIVATE on /dev/ttyX.

This might be more complex than it appears at first, since you need to
avoid deadlocks when ksmcon calls into logind, and logind calls into
kmscon

  4) Does systemd implement some internal timeouts for device
  reassignments? Imagine drm-card0 is assigned to seat5 and the user
  reassigns it to seat6. If the xserver starts directly up on seat6, it
  might not be able to get drmMaster for the card (xserver crashes in
  this case) because the process on seat5 did not release the drmMaster
  fast enough. The VT-switching logic uses roundtrips to acknowledge
  release/acquire, however, I cannot see something like this for logind
  session/device switching.
 
 That problem still exists but is probably not triggered in real-world
 examples. Anyway, comments are still welcome.

It is a real-life problem I would say, and currently there is no nice
solution for this. It is not such a burning problem so far, since input
devices are multi-open, and hence the race never is visible, but this is
something that needs to be fixed properly eventually.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] journal: fix dereferenced pointer in journal_file_rotate()

2012-05-21 Thread Shawn Landden
If journal_file_open() failed, due to (e.g.) -ENOSPC on open()
new_file might still be NULL.

On error, leave pointer to the old JournalFile (now closed),
and require caller to check for error approiately.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=43020
Reported-by: Sjoerd Simons sjo...@luon.net
---
 src/journal/journal-file.c |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 5dd6e57..9f5f26e 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -1871,9 +1871,16 @@ int journal_file_rotate(JournalFile **f) {
 old_file-header-state = STATE_ARCHIVED;
 
 r = journal_file_open(old_file-path, old_file-flags, old_file-mode, 
old_file, new_file);
-journal_file_close(old_file);
+
+if (r  0) {
+r = -errno;
+goto finish;
+}
 
 *f = new_file;
+
+finish:
+journal_file_close(old_file);
 return r;
 }
 
-- 
1.7.9.5

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] cgtop: useful error messages when bootup fails

2012-05-21 Thread Shawn Landden
cgtop quits on startup if all the cgroup mounts it expects are not ready.
Provide user with some indication of why cgtop failed.
---
 src/cgtop/cgtop.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index ddb5709..381f399 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -341,14 +341,20 @@ static int refresh(Hashmap *a, Hashmap *b, unsigned 
iteration) {
 
 r = refresh_one(name=systemd, /, a, b, iteration, 0);
 if (r  0)
+if (r == -ENOENT)
+log_error(/sys/fs/cgroup/systemd not mounted: %s, 
strerror(-r));
 return r;
 
 r = refresh_one(cpuacct, /, a, b, iteration, 0);
 if (r  0)
+if (r == -ENOENT)
+log_error(/sys/fs/cgroup/cpu,cpuacct not mounted: %s, 
strerror(-r));
 return r;
 
 r = refresh_one(memory, /, a, b, iteration, 0);
 if (r  0)
+if (r == -ENOENT)
+log_error(/sys/fs/cgroup/memory not mounted: %s, 
strerror(-r));
 return r;
 
 return refresh_one(blkio, /, a, b, iteration, 0);
-- 
1.7.9.5

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel