Re: [systemd-devel] [PATCH] login: Don't stop a running user manager from garbage-collecting the user.

2013-12-15 Thread Thomas Bächler
Am 12.12.2013 15:38, schrieb Lennart Poettering:
> On Wed, 11.12.13 19:56, Thomas Bächler (tho...@archlinux.org) wrote:
> 
>> With the current logic, a user will never be garbage-collected, since its
>> manager will always be around. Change the logic such that a user is
>> garbage-collected when it has no sessions and linger is disabled.
>> ---
>>  src/login/logind-user.c | 12 
>>  1 file changed, 12 deletions(-)
>>
>> diff --git a/src/login/logind-user.c b/src/login/logind-user.c
>> index 6ba8d98..42a7524 100644
>> --- a/src/login/logind-user.c
>> +++ b/src/login/logind-user.c
>> @@ -612,18 +612,6 @@ bool user_check_gc(User *u, bool drop_not_started) {
>>  if (user_check_linger_file(u) > 0)
>>  return true;
>>  
>> -if (u->slice_job && manager_job_is_active(u->manager, u->slice_job))
>> -return true;
>> -
>> -if (u->service_job && manager_job_is_active(u->manager,
>> -u->service_job))
>> -return true;
> 
> Hmm, we probably should stay around as long as the jobs are still
> active. 
> 
>> -
>> -if (u->slice && manager_unit_is_active(u->manager, u->slice) != 0)
>> -return true;
>> -
>> -if (u->service && manager_unit_is_active(u->manager, u->service) != 
>> 0)
>> -return true;
>> -
> 
> THis part should indeed go, yo are right.
> 
> Can you check whether things work correctly for you if you only remove
> the latter two parts, but leave the former two in? I'lll merge the patch then.

Okay, I tested a bit further: I added 'ExecStartPre=/usr/bin/sleep 10'
to user@.service and tested with both versions of the patch. My version
indeed causes problems, but the race condition I suspected does not
occur: the user manager is started and immediately stopped in case I log
out while the service is still starting up.

Sending v2 in a minute.




signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCHv2] login: Don't stop a running user manager from garbage-collecting the user.

2013-12-15 Thread Thomas Bächler
With the current logic, a user will never be garbage-collected, since its
manager will always be around. Change the logic such that a user is
garbage-collected when it has no sessions and linger is disabled.
---
 src/login/logind-user.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index 6ba8d98..441e086 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -618,12 +618,6 @@ bool user_check_gc(User *u, bool drop_not_started) {
 if (u->service_job && manager_job_is_active(u->manager, 
u->service_job))
 return true;
 
-if (u->slice && manager_unit_is_active(u->manager, u->slice) != 0)
-return true;
-
-if (u->service && manager_unit_is_active(u->manager, u->service) != 0)
-return true;
-
 return false;
 }
 
-- 
1.8.5.1

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


Re: [systemd-devel] Why doe I not see the logging with -u

2013-12-15 Thread Cecil Westerhof

On 12/15/2013 04:57 AM, Zbigniew Jędrzejewski-Szmek wrote:

On Sun, Dec 15, 2013 at 01:08:29AM +0100, Cecil Westerhof wrote:

And for good measure, the output from
SYSTEMD_LOG_LEVEL=debug journalctl -u h2 2>&1 >/dev/null|grep 'Journal filter'


That gives nothing. Even when I remove >/dev/null

So you have some old systemd version (<= 204). What version is it exactly?


systemd 195
suse
+PAM +LIBWRAP +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ

My system needs to be upgraded from openSUSE 12.3 to 13.1. I'll do the 
same on a 13.1 virtual machine. If I do not have it there: problem solved.

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


Re: [systemd-devel] [PATCH v2 7/8] add ppm2bgrx utility

2013-12-15 Thread Kay Sievers
On Tue, Dec 10, 2013 at 10:23 AM, Joonas Lahtinen
 wrote:
> Add utility to convert 8-bit PPM files into UEFI GOP supported BGRX
> files to be used as splash screens.

Why not use bmp (or anything similar simple) that is can be edited and
saved by common tools? It's pretty easy to read that, tianocore uses
it itself. Should be a lot easier than inventing a new format nobody
knows about and needing new tools to write them.

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


Re: [systemd-devel] [PATCH v2 6/8] add GOP mode setting and splash drawing support

2013-12-15 Thread Kay Sievers
On Tue, Dec 10, 2013 at 10:23 AM, Joonas Lahtinen
 wrote:
> Add support for two new configuration directives gfxmode and splash
> which respectively allow setting the screen graphics mode and drawing
> splash image during gummiboot execution. See README.gop for more
> details.

> +   gfxmode 1920x1080

What the reason for that? It looks wrong to require the resolution to
be specified, we need to be able to move disks around between systes
and there are also still systems with external monitors. :)

Almost all hardware sets up the native resolution and we should just
query that instead of writing it to disk. What's different on the
machines you work with?

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


[systemd-devel] Is it possible to start other service units by a service unit which was killed

2013-12-15 Thread Tony Seo
Hello.

I send this mail to know whether systemd have options to solve this problem
without socket activation.

what I have experienced situation is like:
If I have A.service, B.service and C.service, I'd like to set [service]  in
A.service to make others started when A.service is exited(fail, exit .. are
not important)
A.service--
[service]
ExecStart=/bin/program
Restart=always
-->?(I don't know that some options to start B.service and C.service)


So, I have checked some options in [service] manual, but I have not
detected some options to start other units when A.service was killed.
I really want to know that systemd have methods or options to solve my
problem without socket activation.

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


Re: [systemd-devel] Is it possible to start other service units by a service unit which was killed

2013-12-15 Thread Andrey Borzenkov
В Mon, 16 Dec 2013 02:26:02 +0900
Tony Seo  пишет:

> Hello.
> 
> I send this mail to know whether systemd have options to solve this problem
> without socket activation.
> 
> what I have experienced situation is like:
> If I have A.service, B.service and C.service, I'd like to set [service]  in
> A.service to make others started when A.service is exited(fail, exit .. are
> not important)

For fail - see OnFailure (man systemd.unit). For clean exit I guess the
only way is to call systemctl directly. 

Why would you want to do it in case of normal exit? May be there are
other ways to achieve your goal?

> A.service--
> [service]
> ExecStart=/bin/program
> Restart=always
> -->?(I don't know that some options to start B.service and C.service)
> 
> 
> So, I have checked some options in [service] manual, but I have not
> detected some options to start other units when A.service was killed.
> I really want to know that systemd have methods or options to solve my
> problem without socket activation.
> 
> Thanks

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


Re: [systemd-devel] Is it possible to start other service units by a service unit which was killed

2013-12-15 Thread Tomasz Torcz
On Mon, Dec 16, 2013 at 02:26:02AM +0900, Tony Seo wrote:
> Hello.
> 
> I send this mail to know whether systemd have options to solve this problem
> without socket activation.
> 
> what I have experienced situation is like:
> If I have A.service, B.service and C.service, I'd like to set [service]  in
> A.service to make others started when A.service is exited(fail, exit .. are
> not important)

  Tha would be OnFailure= (described in man systemd.unit).

-- 
Tomasz Torcz   RIP is irrevelant. Spoofing is futile.
xmpp: zdzich...@chrome.pl Your routes will be aggreggated. -- Alex Yuriev

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


[systemd-devel] [PATCH] __thread --> thread_local for C11 compat

2013-12-15 Thread Shawn Landden
also make thread_local available w/o including 
---
 src/libsystemd-bus/sd-bus.c | 4 ++--
 src/libsystemd-bus/sd-event.c   | 2 +-
 src/libsystemd-id128/sd-id128.c | 8 
 src/login/logind-inhibit.c  | 2 +-
 src/shared/capability.c | 4 ++--
 src/shared/cgroup-util.c| 2 +-
 src/shared/macro.h  | 8 
 src/shared/util.c   | 6 +++---
 src/shared/virt.c   | 8 
 9 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index 4eaceef..64cd663 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -2815,13 +2815,13 @@ static int bus_default(int (*bus_open)(sd_bus **), 
sd_bus **default_bus, sd_bus
 }
 
 _public_ int sd_bus_default_system(sd_bus **ret) {
-static __thread sd_bus *default_system_bus = NULL;
+static thread_local sd_bus *default_system_bus = NULL;
 
 return bus_default(sd_bus_open_system, &default_system_bus, ret);
 }
 
 _public_ int sd_bus_default_user(sd_bus **ret) {
-static __thread sd_bus *default_user_bus = NULL;
+static thread_local sd_bus *default_user_bus = NULL;
 
 return bus_default(sd_bus_open_user, &default_user_bus, ret);
 }
diff --git a/src/libsystemd-bus/sd-event.c b/src/libsystemd-bus/sd-event.c
index 06c84d7..727528b 100644
--- a/src/libsystemd-bus/sd-event.c
+++ b/src/libsystemd-bus/sd-event.c
@@ -2116,7 +2116,7 @@ _public_ int sd_event_get_now_monotonic(sd_event *e, 
uint64_t *usec) {
 
 _public_ int sd_event_default(sd_event **ret) {
 
-static __thread sd_event *default_event = NULL;
+static thread_local sd_event *default_event = NULL;
 sd_event *e;
 int r;
 
diff --git a/src/libsystemd-id128/sd-id128.c b/src/libsystemd-id128/sd-id128.c
index 07d2415..9ee40ab 100644
--- a/src/libsystemd-id128/sd-id128.c
+++ b/src/libsystemd-id128/sd-id128.c
@@ -104,8 +104,8 @@ static sd_id128_t make_v4_uuid(sd_id128_t id) {
 }
 
 _public_ int sd_id128_get_machine(sd_id128_t *ret) {
-static __thread sd_id128_t saved_machine_id;
-static __thread bool saved_machine_id_valid = false;
+static thread_local sd_id128_t saved_machine_id;
+static thread_local bool saved_machine_id_valid = false;
 _cleanup_close_ int fd = -1;
 char buf[33];
 ssize_t k;
@@ -153,8 +153,8 @@ _public_ int sd_id128_get_machine(sd_id128_t *ret) {
 }
 
 _public_ int sd_id128_get_boot(sd_id128_t *ret) {
-static __thread sd_id128_t saved_boot_id;
-static __thread bool saved_boot_id_valid = false;
+static thread_local sd_id128_t saved_boot_id;
+static thread_local bool saved_boot_id_valid = false;
 _cleanup_close_ int fd = -1;
 char buf[36];
 ssize_t k;
diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c
index ec6a722..042586d 100644
--- a/src/login/logind-inhibit.c
+++ b/src/login/logind-inhibit.c
@@ -413,7 +413,7 @@ bool manager_is_inhibited(
 }
 
 const char *inhibit_what_to_string(InhibitWhat w) {
-static __thread char buffer[97];
+static thread_local char buffer[97];
 char *p;
 
 if (w < 0 || w >= _INHIBIT_WHAT_MAX)
diff --git a/src/shared/capability.c b/src/shared/capability.c
index 3219520..f34f6ba 100644
--- a/src/shared/capability.c
+++ b/src/shared/capability.c
@@ -55,8 +55,8 @@ int have_effective_cap(int value) {
 }
 
 unsigned long cap_last_cap(void) {
-static __thread unsigned long saved;
-static __thread bool valid = false;
+static thread_local unsigned long saved;
+static thread_local bool valid = false;
 unsigned long p;
 
 if (valid)
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index 2c2ffc5..309f65d 100644
--- a/src/shared/cgroup-util.c
+++ b/src/shared/cgroup-util.c
@@ -480,7 +480,7 @@ static int join_path(const char *controller, const char 
*path, const char *suffi
 
 int cg_get_path(const char *controller, const char *path, const char *suffix, 
char **fs) {
 const char *p;
-static __thread bool good = false;
+static thread_local bool good = false;
 
 assert(fs);
 
diff --git a/src/shared/macro.h b/src/shared/macro.h
index fd3762e..903e8ee 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -27,6 +27,14 @@
 #include 
 #include 
 
+#if __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_THREADS__)
+#else
+#  define _Thread_local __thread
+#endif
+
+/* make thread_local available w/o including  */
+#define thread_local _Thread_local
+
 #define _printf_(a,b) __attribute__ ((format (printf, a, b)))
 #define _alloc_(...) __attribute__ ((alloc_size(__VA_ARGS__)))
 #define _sentinel_ __attribute__ ((sentinel))
diff --git a/src/shared/util.c b/src/shared/util.c
index 7c73074..0ce6f70 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -86,7 +86,7 @@ static volatile unsigned cached_columns = 0;
 static volatile uns

[systemd-devel] [PATCH] __thread --> thread_local for C11 compat

2013-12-15 Thread Shawn Landden
also make thread_local available w/o including 
---
 src/libsystemd-bus/sd-bus.c |  4 ++--
 src/libsystemd-bus/sd-event.c   |  2 +-
 src/libsystemd-id128/sd-id128.c |  8 
 src/login/logind-inhibit.c  |  2 +-
 src/shared/capability.c |  4 ++--
 src/shared/cgroup-util.c|  2 +-
 src/shared/macro.h  | 10 ++
 src/shared/util.c   |  6 +++---
 src/shared/virt.c   |  8 
 9 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index 4eaceef..64cd663 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -2815,13 +2815,13 @@ static int bus_default(int (*bus_open)(sd_bus **), 
sd_bus **default_bus, sd_bus
 }
 
 _public_ int sd_bus_default_system(sd_bus **ret) {
-static __thread sd_bus *default_system_bus = NULL;
+static thread_local sd_bus *default_system_bus = NULL;
 
 return bus_default(sd_bus_open_system, &default_system_bus, ret);
 }
 
 _public_ int sd_bus_default_user(sd_bus **ret) {
-static __thread sd_bus *default_user_bus = NULL;
+static thread_local sd_bus *default_user_bus = NULL;
 
 return bus_default(sd_bus_open_user, &default_user_bus, ret);
 }
diff --git a/src/libsystemd-bus/sd-event.c b/src/libsystemd-bus/sd-event.c
index 06c84d7..727528b 100644
--- a/src/libsystemd-bus/sd-event.c
+++ b/src/libsystemd-bus/sd-event.c
@@ -2116,7 +2116,7 @@ _public_ int sd_event_get_now_monotonic(sd_event *e, 
uint64_t *usec) {
 
 _public_ int sd_event_default(sd_event **ret) {
 
-static __thread sd_event *default_event = NULL;
+static thread_local sd_event *default_event = NULL;
 sd_event *e;
 int r;
 
diff --git a/src/libsystemd-id128/sd-id128.c b/src/libsystemd-id128/sd-id128.c
index 07d2415..9ee40ab 100644
--- a/src/libsystemd-id128/sd-id128.c
+++ b/src/libsystemd-id128/sd-id128.c
@@ -104,8 +104,8 @@ static sd_id128_t make_v4_uuid(sd_id128_t id) {
 }
 
 _public_ int sd_id128_get_machine(sd_id128_t *ret) {
-static __thread sd_id128_t saved_machine_id;
-static __thread bool saved_machine_id_valid = false;
+static thread_local sd_id128_t saved_machine_id;
+static thread_local bool saved_machine_id_valid = false;
 _cleanup_close_ int fd = -1;
 char buf[33];
 ssize_t k;
@@ -153,8 +153,8 @@ _public_ int sd_id128_get_machine(sd_id128_t *ret) {
 }
 
 _public_ int sd_id128_get_boot(sd_id128_t *ret) {
-static __thread sd_id128_t saved_boot_id;
-static __thread bool saved_boot_id_valid = false;
+static thread_local sd_id128_t saved_boot_id;
+static thread_local bool saved_boot_id_valid = false;
 _cleanup_close_ int fd = -1;
 char buf[36];
 ssize_t k;
diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c
index ec6a722..042586d 100644
--- a/src/login/logind-inhibit.c
+++ b/src/login/logind-inhibit.c
@@ -413,7 +413,7 @@ bool manager_is_inhibited(
 }
 
 const char *inhibit_what_to_string(InhibitWhat w) {
-static __thread char buffer[97];
+static thread_local char buffer[97];
 char *p;
 
 if (w < 0 || w >= _INHIBIT_WHAT_MAX)
diff --git a/src/shared/capability.c b/src/shared/capability.c
index 3219520..f34f6ba 100644
--- a/src/shared/capability.c
+++ b/src/shared/capability.c
@@ -55,8 +55,8 @@ int have_effective_cap(int value) {
 }
 
 unsigned long cap_last_cap(void) {
-static __thread unsigned long saved;
-static __thread bool valid = false;
+static thread_local unsigned long saved;
+static thread_local bool valid = false;
 unsigned long p;
 
 if (valid)
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index 2c2ffc5..309f65d 100644
--- a/src/shared/cgroup-util.c
+++ b/src/shared/cgroup-util.c
@@ -480,7 +480,7 @@ static int join_path(const char *controller, const char 
*path, const char *suffi
 
 int cg_get_path(const char *controller, const char *path, const char *suffix, 
char **fs) {
 const char *p;
-static __thread bool good = false;
+static thread_local bool good = false;
 
 assert(fs);
 
diff --git a/src/shared/macro.h b/src/shared/macro.h
index fd3762e..c0597fa 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -27,6 +27,16 @@
 #include 
 #include 
 
+#if __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_THREADS__)
+#else
+#  define _Thread_local __thread
+#endif
+
+/* make thread_local available w/o including  */
+#ifndef thread_local
+# define thread_local _Thread_local
+#endif
+
 #define _printf_(a,b) __attribute__ ((format (printf, a, b)))
 #define _alloc_(...) __attribute__ ((alloc_size(__VA_ARGS__)))
 #define _sentinel_ __attribute__ ((sentinel))
diff --git a/src/shared/util.c b/src/shared/util.c
index 7c73074..0ce6f70 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -86,7 +86,7 @@ static volatile unsigne

Re: [systemd-devel] [PATCH] __thread --> thread_local for C11 compat

2013-12-15 Thread Lennart Poettering
On Sun, 15.12.13 13:19, Shawn Landden (sh...@churchofgit.com) wrote:

> also make thread_local available w/o including 

Hmm, that looks a bit too early, no? Does gcc even support this? glibc
doesn't support threads.h afaics... I couldn't find anything in
particular regarding C11 TLS support in gcc with google, any link you
can recommend? Apparently C++11 support is somewhat more existant, but
C11 support regarding threads appears to be very limited?

My glibc certainly doesn't ship thread.h. Given that gcc __thread and C11
thread_local appear to have different semantics regarding initialization
I am also a bit afraid of just defining one to the other already at this
point in time... 

> ---
>  src/libsystemd-bus/sd-bus.c |  4 ++--
>  src/libsystemd-bus/sd-event.c   |  2 +-
>  src/libsystemd-id128/sd-id128.c |  8 
>  src/login/logind-inhibit.c  |  2 +-
>  src/shared/capability.c |  4 ++--
>  src/shared/cgroup-util.c|  2 +-
>  src/shared/macro.h  | 10 ++
>  src/shared/util.c   |  6 +++---
>  src/shared/virt.c   |  8 
>  9 files changed, 28 insertions(+), 18 deletions(-)
> 
> diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
> index 4eaceef..64cd663 100644
> --- a/src/libsystemd-bus/sd-bus.c
> +++ b/src/libsystemd-bus/sd-bus.c
> @@ -2815,13 +2815,13 @@ static int bus_default(int (*bus_open)(sd_bus **), 
> sd_bus **default_bus, sd_bus
>  }
>  
>  _public_ int sd_bus_default_system(sd_bus **ret) {
> -static __thread sd_bus *default_system_bus = NULL;
> +static thread_local sd_bus *default_system_bus = NULL;
>  
>  return bus_default(sd_bus_open_system, &default_system_bus, ret);
>  }
>  
>  _public_ int sd_bus_default_user(sd_bus **ret) {
> -static __thread sd_bus *default_user_bus = NULL;
> +static thread_local sd_bus *default_user_bus = NULL;
>  
>  return bus_default(sd_bus_open_user, &default_user_bus, ret);
>  }
> diff --git a/src/libsystemd-bus/sd-event.c b/src/libsystemd-bus/sd-event.c
> index 06c84d7..727528b 100644
> --- a/src/libsystemd-bus/sd-event.c
> +++ b/src/libsystemd-bus/sd-event.c
> @@ -2116,7 +2116,7 @@ _public_ int sd_event_get_now_monotonic(sd_event *e, 
> uint64_t *usec) {
>  
>  _public_ int sd_event_default(sd_event **ret) {
>  
> -static __thread sd_event *default_event = NULL;
> +static thread_local sd_event *default_event = NULL;
>  sd_event *e;
>  int r;
>  
> diff --git a/src/libsystemd-id128/sd-id128.c b/src/libsystemd-id128/sd-id128.c
> index 07d2415..9ee40ab 100644
> --- a/src/libsystemd-id128/sd-id128.c
> +++ b/src/libsystemd-id128/sd-id128.c
> @@ -104,8 +104,8 @@ static sd_id128_t make_v4_uuid(sd_id128_t id) {
>  }
>  
>  _public_ int sd_id128_get_machine(sd_id128_t *ret) {
> -static __thread sd_id128_t saved_machine_id;
> -static __thread bool saved_machine_id_valid = false;
> +static thread_local sd_id128_t saved_machine_id;
> +static thread_local bool saved_machine_id_valid = false;
>  _cleanup_close_ int fd = -1;
>  char buf[33];
>  ssize_t k;
> @@ -153,8 +153,8 @@ _public_ int sd_id128_get_machine(sd_id128_t *ret) {
>  }
>  
>  _public_ int sd_id128_get_boot(sd_id128_t *ret) {
> -static __thread sd_id128_t saved_boot_id;
> -static __thread bool saved_boot_id_valid = false;
> +static thread_local sd_id128_t saved_boot_id;
> +static thread_local bool saved_boot_id_valid = false;
>  _cleanup_close_ int fd = -1;
>  char buf[36];
>  ssize_t k;
> diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c
> index ec6a722..042586d 100644
> --- a/src/login/logind-inhibit.c
> +++ b/src/login/logind-inhibit.c
> @@ -413,7 +413,7 @@ bool manager_is_inhibited(
>  }
>  
>  const char *inhibit_what_to_string(InhibitWhat w) {
> -static __thread char buffer[97];
> +static thread_local char buffer[97];
>  char *p;
>  
>  if (w < 0 || w >= _INHIBIT_WHAT_MAX)
> diff --git a/src/shared/capability.c b/src/shared/capability.c
> index 3219520..f34f6ba 100644
> --- a/src/shared/capability.c
> +++ b/src/shared/capability.c
> @@ -55,8 +55,8 @@ int have_effective_cap(int value) {
>  }
>  
>  unsigned long cap_last_cap(void) {
> -static __thread unsigned long saved;
> -static __thread bool valid = false;
> +static thread_local unsigned long saved;
> +static thread_local bool valid = false;
>  unsigned long p;
>  
>  if (valid)
> diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
> index 2c2ffc5..309f65d 100644
> --- a/src/shared/cgroup-util.c
> +++ b/src/shared/cgroup-util.c
> @@ -480,7 +480,7 @@ static int join_path(const char *controller, const char 
> *path, const char *suffi
>  
>  int cg_get_path(const char *controller, const char *path, const char 
> *suffix, char **fs) {
>  const char *p;
> - 

Re: [systemd-devel] Fwd: [Pkg-systemd-maintainers] Bug#732157: Want SIGSTOP-style daemon/service readiness notification

2013-12-15 Thread Lennart Poettering
On Sat, 14.12.13 14:19, Shawn Landden (sh...@churchofgit.com) wrote:

> It would be nice if systemd could implement the service supervisor
> side of the service readiness protocol that upstart calls "expect
> stop":
> 
> The service doesn't fork, and when considers itself ready it raises
> SIGSTOP.  The supervisor can observe this via the usual mechanisms,
> being the service's parent, and when it occurs it sends the service
> CONT and starts whatever was waiting for readiness.

Oh, no. That Upstart SIGSTOP hackery is completely broken. SIGSTOP is
poperty of the admin, the init system cannot just take possession of
that and turn it into something that it really isn't. The admin must be
able to freeze processes when he wants to, and the init system should
not interfere with that and immediately undo it, nor should it get
confused if the admin uses it independently of the init system. Thus,
SIGSTOP is really nothing the init system should touch, ever.

It's similar to Upstart's ptrace hackery: an init system should not take
away functionality that belongs to the admin, and by using ptrace
Upstart makes it unavailable to the admin because there can be only one
tracer per process at a time. On an Upstart system where this is used
you cannot gdb or strace (!!!) the initialization phase of those daemons
anymore.

This is really not how we should do it: the admin must be capable of
tracing and pausing the boot process, and an init system should not make
that impossible. 

> The sd_notify(3) protocol is just about tolerable, and it is good that
> it's documented, but it is quite unattractive for a daemon author:
> Either they have to add a build- and runtime- dependency on a
> systemd-specific library, or they have to reimplement a fairly tedious
> piece of socket code.

Well, to make this more palatable we actually made the code available
under MIT license (i.e. much less restrictions than the otherwise GPL2+
sources of systemd), and made it embeddable so that people can just drop
sd-daemon.c + sd-daemon.h into their sources and forget about
it. sd-daemon.c/sd-daemon.h nowadays even compiles fine on Solaris and
other OSes in order to make this as little cumbersome as possible.

Developers hence have the choice to either link to dynamically, or to
embedd it, if they don't want the dependency. Or alternatively, they can
just reimplement sd_notify(), which is intentionally designed to be as
trivial as it gets. i.e. you just send one datagram containing text to the
socket mentioned in $NOTIFY_SOCKET, that's all. 

Finally, on purpose we actually kept this so simple and left all
systemd-specific identifiers out of the protocols (i.e. it's called
$NOTIFY_SOCKET not $SYSTEMD_SOCKET or so), so that other folks can
implement it too without having to "leak" the name "systemd" into their
sources, in particular to make this easy for Upstart... (they were never
interested though, but at least we can say we tried).

> For a daemon author, raise(SIGSTOP) is lovely and simple.

For an admin raise(SIGSTOP) is just bad. Let's not forget that
developers better write programs that don't make the admin's/user's life
hard... They usually curse at us anyway, but let's not make the most
obvious mistakes by making it impossible to pause processes or tracing
the boot-up phase...

ennart

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


Re: [systemd-devel] [RFC] [PATCH 0/3] journal: Add deferred log processing to reduce synchonous IO overhead

2013-12-15 Thread David Timothy Strauss
On Sat, Dec 14, 2013 at 8:12 AM, Zbigniew Jędrzejewski-Szmek
 wrote:
> Are you sure that the sysctl is set early enough, before the listening
> socket is created?

Perhaps this is why your suggestion [1] for the journal bootup issue
didn't help.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=71483#c10
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] Add more _printf_'s for format-nonliterals

2013-12-15 Thread Lennart Poettering
On Sat, 14.12.13 13:32, Thomas H.P. Andersen (pho...@gmail.com) wrote:

> +_printf_(3,0)
>  int bus_error_setfv(sd_bus_error *e, const char *name, const char
>  *format, va_list ap) {

This one should be on the prototype, and not on the actual function
declaration, right? (Because it is non-static unlike the others) I mean,
otherwise it's not useful to detect incorrect calls, right?

(Fixed this in git)

Lennart

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


Re: [systemd-devel] [PATCH v2 1/8] add source format modeline

2013-12-15 Thread Kay Sievers
On Tue, Dec 10, 2013 at 10:22 AM, Joonas Lahtinen
 wrote:
> For easier editing, add source format modeline similar to other files.

Applied.

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


Re: [systemd-devel] [PATCH v2 2/8] Makefile.am: be consistent defining sources

2013-12-15 Thread Kay Sievers
On Tue, Dec 10, 2013 at 10:22 AM, Joonas Lahtinen
 wrote:
> Be consistent with other source file definitions.

Applied.

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


Re: [systemd-devel] [PATCH v2 4/8] make file_read callable outside compilation unit

2013-12-15 Thread Kay Sievers
On Tue, Dec 10, 2013 at 10:23 AM, Joonas Lahtinen
 wrote:
> Make file_read usable from other compilation units allowing reuse
> of code when splitting functionality to multiple files.

Applied.

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


Re: [systemd-devel] [PATCH v2 3/8] add atoi function

2013-12-15 Thread Kay Sievers
On Tue, Dec 10, 2013 at 10:23 AM, Joonas Lahtinen
 wrote:
> Add generic purpose number parsing function to be used by modeline
> parsing.

I did not merge the modeline handling, so this is currently not needed.

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


Re: [systemd-devel] [PATCH v2 5/8] make console_text_mode into more generic function

2013-12-15 Thread Kay Sievers
On Tue, Dec 10, 2013 at 10:23 AM, Joonas Lahtinen
 wrote:
> Convert console_text_mode function into console_mode function
> which is able to switch back and forth between graphics and text
> mode.

Applied.

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


Re: [systemd-devel] [PATCH v2 6/8] add GOP mode setting and splash drawing support

2013-12-15 Thread Kay Sievers
On Sun, Dec 15, 2013 at 2:54 PM, Kay Sievers  wrote:
> On Tue, Dec 10, 2013 at 10:23 AM, Joonas Lahtinen
>  wrote:
>> Add support for two new configuration directives gfxmode and splash
>> which respectively allow setting the screen graphics mode and drawing
>> splash image during gummiboot execution. See README.gop for more
>> details.
>
>> +   gfxmode 1920x1080
>
> What the reason for that? It looks wrong to require the resolution to
> be specified, we need to be able to move disks around between systes
> and there are also still systems with external monitors. :)
>
> Almost all hardware sets up the native resolution and we should just
> query that instead of writing it to disk. What's different on the
> machines you work with?

I've implemented very basic BMP support and commited it.

There is currently no support for modelines, and unless there is a
good reason, we should not do that. The firmware is expected to init
the native resolution which we should not touch.

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


Re: [systemd-devel] [PATCH] __thread --> thread_local for C11 compat

2013-12-15 Thread Shawn Landden
On Sun, Dec 15, 2013 at 1:56 PM, Lennart Poettering
 wrote:
> On Sun, 15.12.13 13:19, Shawn Landden (sh...@churchofgit.com) wrote:
>
>> also make thread_local available w/o including 
>
> Hmm, that looks a bit too early, no? Does gcc even support this? glibc
gcc-4.9 supports _Thread_local
http://gcc.gnu.org/gcc-4.9/changes.html

switching -std=gnu99 to -std=gnu11 in Makefile I can compile
systemd w/o the clause that defines _Thread_local as __thread
and all tests pass.

Perhaps we should add
|| (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)
to the check
> doesn't support threads.h afaics... I couldn't find anything in
> particular regarding C11 TLS support in gcc with google, any link you
> can recommend? Apparently C++11 support is somewhat more existant, but
> C11 support regarding threads appears to be very limited?
>
> My glibc certainly doesn't ship thread.h. Given that gcc __thread and C11
from C11 page 376:

3 The macros are
thread_local
which expands to _Thread_local;

this part of threads.h is pretty simple
> thread_local appear to have different semantics regarding initialization
> I am also a bit afraid of just defining one to the other already at this
> point in time...
>
>> ---
>>  src/libsystemd-bus/sd-bus.c |  4 ++--
>>  src/libsystemd-bus/sd-event.c   |  2 +-
>>  src/libsystemd-id128/sd-id128.c |  8 
>>  src/login/logind-inhibit.c  |  2 +-
>>  src/shared/capability.c |  4 ++--
>>  src/shared/cgroup-util.c|  2 +-
>>  src/shared/macro.h  | 10 ++
>>  src/shared/util.c   |  6 +++---
>>  src/shared/virt.c   |  8 
>>  9 files changed, 28 insertions(+), 18 deletions(-)
>>
>> diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
>> index 4eaceef..64cd663 100644
>> --- a/src/libsystemd-bus/sd-bus.c
>> +++ b/src/libsystemd-bus/sd-bus.c
>> @@ -2815,13 +2815,13 @@ static int bus_default(int (*bus_open)(sd_bus **), 
>> sd_bus **default_bus, sd_bus
>>  }
>>
>>  _public_ int sd_bus_default_system(sd_bus **ret) {
>> -static __thread sd_bus *default_system_bus = NULL;
>> +static thread_local sd_bus *default_system_bus = NULL;
>>
>>  return bus_default(sd_bus_open_system, &default_system_bus, ret);
>>  }
>>
>>  _public_ int sd_bus_default_user(sd_bus **ret) {
>> -static __thread sd_bus *default_user_bus = NULL;
>> +static thread_local sd_bus *default_user_bus = NULL;
>>
>>  return bus_default(sd_bus_open_user, &default_user_bus, ret);
>>  }
>> diff --git a/src/libsystemd-bus/sd-event.c b/src/libsystemd-bus/sd-event.c
>> index 06c84d7..727528b 100644
>> --- a/src/libsystemd-bus/sd-event.c
>> +++ b/src/libsystemd-bus/sd-event.c
>> @@ -2116,7 +2116,7 @@ _public_ int sd_event_get_now_monotonic(sd_event *e, 
>> uint64_t *usec) {
>>
>>  _public_ int sd_event_default(sd_event **ret) {
>>
>> -static __thread sd_event *default_event = NULL;
>> +static thread_local sd_event *default_event = NULL;
>>  sd_event *e;
>>  int r;
>>
>> diff --git a/src/libsystemd-id128/sd-id128.c 
>> b/src/libsystemd-id128/sd-id128.c
>> index 07d2415..9ee40ab 100644
>> --- a/src/libsystemd-id128/sd-id128.c
>> +++ b/src/libsystemd-id128/sd-id128.c
>> @@ -104,8 +104,8 @@ static sd_id128_t make_v4_uuid(sd_id128_t id) {
>>  }
>>
>>  _public_ int sd_id128_get_machine(sd_id128_t *ret) {
>> -static __thread sd_id128_t saved_machine_id;
>> -static __thread bool saved_machine_id_valid = false;
>> +static thread_local sd_id128_t saved_machine_id;
>> +static thread_local bool saved_machine_id_valid = false;
>>  _cleanup_close_ int fd = -1;
>>  char buf[33];
>>  ssize_t k;
>> @@ -153,8 +153,8 @@ _public_ int sd_id128_get_machine(sd_id128_t *ret) {
>>  }
>>
>>  _public_ int sd_id128_get_boot(sd_id128_t *ret) {
>> -static __thread sd_id128_t saved_boot_id;
>> -static __thread bool saved_boot_id_valid = false;
>> +static thread_local sd_id128_t saved_boot_id;
>> +static thread_local bool saved_boot_id_valid = false;
>>  _cleanup_close_ int fd = -1;
>>  char buf[36];
>>  ssize_t k;
>> diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c
>> index ec6a722..042586d 100644
>> --- a/src/login/logind-inhibit.c
>> +++ b/src/login/logind-inhibit.c
>> @@ -413,7 +413,7 @@ bool manager_is_inhibited(
>>  }
>>
>>  const char *inhibit_what_to_string(InhibitWhat w) {
>> -static __thread char buffer[97];
>> +static thread_local char buffer[97];
>>  char *p;
>>
>>  if (w < 0 || w >= _INHIBIT_WHAT_MAX)
>> diff --git a/src/shared/capability.c b/src/shared/capability.c
>> index 3219520..f34f6ba 100644
>> --- a/src/shared/capability.c
>> +++ b/src/shared/capability.c
>> @@ -55,8 +55,8 @@ int have_effective_cap(int value) {
>>  }
>>
>>  unsigned long cap_last_cap(void) {
>> -static __thread unsigned long saved;
>> -static __thread bool

Re: [systemd-devel] [PATCH v2 7/8] add ppm2bgrx utility

2013-12-15 Thread Kay Sievers
On Sun, Dec 15, 2013 at 2:51 PM, Kay Sievers  wrote:
> On Tue, Dec 10, 2013 at 10:23 AM, Joonas Lahtinen
>  wrote:
>> Add utility to convert 8-bit PPM files into UEFI GOP supported BGRX
>> files to be used as splash screens.
>
> Why not use bmp (or anything similar simple) that is can be edited and
> saved by common tools? It's pretty easy to read that, tianocore uses
> it itself. Should be a lot easier than inventing a new format nobody
> knows about and needing new tools to write them.

We support basic BMP file reading now. So GIMP can just edit the files
and the desktop can show them.

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


Re: [systemd-devel] [PATCH] Add more _printf_'s for format-nonliterals

2013-12-15 Thread Zbigniew Jędrzejewski-Szmek
On Sun, Dec 15, 2013 at 11:49:55PM +0100, Lennart Poettering wrote:
> On Sat, 14.12.13 13:32, Thomas H.P. Andersen (pho...@gmail.com) wrote:
> 
> > +_printf_(3,0)
> >  int bus_error_setfv(sd_bus_error *e, const char *name, const char
> >  *format, va_list ap) {
> 
> This one should be on the prototype, and not on the actual function
> declaration, right? (Because it is non-static unlike the others) I mean,
> otherwise it's not useful to detect incorrect calls, right?
Ooops, I looked them over but I missed that.

> (Fixed this in git)

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


Re: [systemd-devel] [PATCH 8/8] data: add gummiboot splash image file

2013-12-15 Thread Kay Sievers
On Tue, Dec 10, 2013 at 8:51 AM, Joonas Lahtinen
 wrote:
> Add gummiboot branded splash screen image, which is basically the
> website logo put inside white circle on black background (to match
> default screen color on most UEFI) shrinked down to 256x256 size.

I left that out, we do not really want to ship artwork. The splash
should identify the product/distribution, but not the boot loader. :)

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


Re: [systemd-devel] [PATCH] __thread --> thread_local for C11 compat

2013-12-15 Thread Lennart Poettering
On Sun, 15.12.13 14:56, Shawn Landden (sh...@churchofgit.com) wrote:

> On Sun, Dec 15, 2013 at 1:56 PM, Lennart Poettering
>  wrote:
> > On Sun, 15.12.13 13:19, Shawn Landden (sh...@churchofgit.com) wrote:
> >
> >> also make thread_local available w/o including 
> >
> > Hmm, that looks a bit too early, no? Does gcc even support this? glibc
> gcc-4.9 supports _Thread_local
> http://gcc.gnu.org/gcc-4.9/changes.html

Ah, nice. I figure that should be good enough then. (That said, my
Fedora 20 doesn't have gcc 4.9 yet, so I can't test this...)

> switching -std=gnu99 to -std=gnu11 in Makefile I can compile
> systemd w/o the clause that defines _Thread_local as __thread
> and all tests pass.
> 
> Perhaps we should add
> || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)
> to the check

Hmm, checks for gcc versions are really only the last resorts. If there
are feature test macros, we should use those, and should they break we
an still resort to version checks.

> >> +#if __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_THREADS__)
> >> +#else
> >> +#  define _Thread_local __thread

I don't really like the "inverted" if thing with nothing on the true
branch and only a false branch I must say.

Also, should we really take the deviation of filling in the c
low-levelism "_Thread_local" here? I think I'd prefer this:

#ifndef thread_local
#if __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_THREADS__)
#define thread_local _Thread_local
#else
#define thread_local __thread
#endif

With that in place we stay away from defining our own low-level
_Thread_local, instead we only define the high-level thread_local, and
do so either to the C11 language feature or the gcc extension...

If that looks OK (and is tested!) I'd be happy to merge such a patch.

Lennart

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


Re: [systemd-devel] Why doe I not see the logging with -u

2013-12-15 Thread Lennart Poettering
On Sat, 14.12.13 09:22, Cecil Westerhof (cecil.wester...@snow.nl) wrote:

> I made a first setup to make a service for the H2 database. I made
> the folowing service file:
> [Unit]
> Description=H2 Database
> 
> [Service]
> Type=simple
> ExecStart=/usr/bin/java -cp
> /home/cecil/java/h2/bin/h2-1.3.174.jar org.h2.tools.Console -tool
> -tcp
> Restart=always
> User=cecil

Note that "journal -u" only shows you the journal files that have been
split off for the calling user. How this splitting up takes place is
configured via SplitMode= in journald.conf. The default of this value is
"login", which means only data generated from login sessions are split
out, but not data that is just generated from a non-zero UID. A login
session is here defined by whether we went though the PAM session hooks
or not. The PAM session hooks have the effect that pam_limits and
suchlike are applied too, which is usually what you want when you run
some service as real user (i.e. where "real" user means not just as a
system user like "httpd" or "mysql", but as somebody who actually logs
in via ssh from time to time). Now, by just using User=cecil you simply
change user IDs, but you do not open a full PAM session. To get a full
PAM session define PAMName= for a service.

Lennart

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


Re: [systemd-devel] Why doe I not see the logging with -u

2013-12-15 Thread Lennart Poettering
On Mon, 16.12.13 00:41, Lennart Poettering (lenn...@poettering.net) wrote:

> On Sat, 14.12.13 09:22, Cecil Westerhof (cecil.wester...@snow.nl) wrote:
> 
> > I made a first setup to make a service for the H2 database. I made
> > the folowing service file:
> > [Unit]
> > Description=H2 Database
> > 
> > [Service]
> > Type=simple
> > ExecStart=/usr/bin/java -cp
> > /home/cecil/java/h2/bin/h2-1.3.174.jar org.h2.tools.Console -tool
> > -tcp
> > Restart=always
> > User=cecil
> 
> Note that "journal -u" only shows you the journal files that have been
> split off for the calling user. How this splitting up takes place is
> configured via SplitMode= in journald.conf. The default of this value is
> "login", which means only data generated from login sessions are split
> out, but not data that is just generated from a non-zero UID. A login
> session is here defined by whether we went though the PAM session hooks
> or not. The PAM session hooks have the effect that pam_limits and
> suchlike are applied too, which is usually what you want when you run
> some service as real user (i.e. where "real" user means not just as a
> system user like "httpd" or "mysql", but as somebody who actually logs
> in via ssh from time to time). Now, by just using User=cecil you simply
> change user IDs, but you do not open a full PAM session. To get a full
> PAM session define PAMName= for a service.

Oh, sorry, ignore all I wrote above. It's irrelevant for your case. As
Zbigniew just pointed out to me "-u" is short for --unit= not for --user
as I somehow mistakenly assummed...

Sorry for the confusion,

Lennart

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


Re: [systemd-devel] [PATCH] __thread --> thread_local for C11 compat

2013-12-15 Thread Shawn Landden
On Sun, Dec 15, 2013 at 3:16 PM, Lennart Poettering
 wrote:
> On Sun, 15.12.13 14:56, Shawn Landden (sh...@churchofgit.com) wrote:
>
>> On Sun, Dec 15, 2013 at 1:56 PM, Lennart Poettering
>>  wrote:
>> > On Sun, 15.12.13 13:19, Shawn Landden (sh...@churchofgit.com) wrote:
>> >
>> >> also make thread_local available w/o including 
>> >
>> > Hmm, that looks a bit too early, no? Does gcc even support this? glibc
>> gcc-4.9 supports _Thread_local
>> http://gcc.gnu.org/gcc-4.9/changes.html
>
> Ah, nice. I figure that should be good enough then. (That said, my
> Fedora 20 doesn't have gcc 4.9 yet, so I can't test this...)
debian has gcc-snapshot in sid
>
>> switching -std=gnu99 to -std=gnu11 in Makefile I can compile
>> systemd w/o the clause that defines _Thread_local as __thread
>> and all tests pass.
>>
>> Perhaps we should add
>> || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)
>> to the check
>
> Hmm, checks for gcc versions are really only the last resorts. If there
> are feature test macros, we should use those, and should they break we
> an still resort to version checks.
>
>> >> +#if __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_THREADS__)
>> >> +#else
>> >> +#  define _Thread_local __thread
>
> I don't really like the "inverted" if thing with nothing on the true
> branch and only a false branch I must say.
>
> Also, should we really take the deviation of filling in the c
> low-levelism "_Thread_local" here? I think I'd prefer this:
agreed
>
> #ifndef thread_local
> #if __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_THREADS__)
> #define thread_local _Thread_local
> #else
> #define thread_local __thread
> #endif
>
> With that in place we stay away from defining our own low-level
> _Thread_local, instead we only define the high-level thread_local, and
> do so either to the C11 language feature or the gcc extension...
>
> If that looks OK (and is tested!) I'd be happy to merge such a patch.
>
to actually use this we would have to add this patch:

diff --git a/configure.ac b/configure.ac
index f85e86e..5ead127 100644
--- a/configure.ac
+++ b/configure.ac
@@ -113,6 +113,7 @@ AS_IF([test "x$enable_address_sanitizer" = "xyes"], [
   ])

 CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
+-std=gnu11 \
 -pipe \
 -Wall \
 -Wextra \
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] __thread --> thread_local for C11 compat

2013-12-15 Thread Shawn Landden
Also make thread_local available w/o including .
(as the latter hasn't been implemented, but this part is trivial)
---
 src/libsystemd-bus/sd-bus.c |  4 ++--
 src/libsystemd-bus/sd-event.c   |  2 +-
 src/libsystemd-id128/sd-id128.c |  8 
 src/login/logind-inhibit.c  |  2 +-
 src/shared/capability.c |  4 ++--
 src/shared/cgroup-util.c|  2 +-
 src/shared/macro.h  | 11 +++
 src/shared/util.c   |  6 +++---
 src/shared/virt.c   |  8 
 9 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index 4eaceef..64cd663 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -2815,13 +2815,13 @@ static int bus_default(int (*bus_open)(sd_bus **), 
sd_bus **default_bus, sd_bus
 }
 
 _public_ int sd_bus_default_system(sd_bus **ret) {
-static __thread sd_bus *default_system_bus = NULL;
+static thread_local sd_bus *default_system_bus = NULL;
 
 return bus_default(sd_bus_open_system, &default_system_bus, ret);
 }
 
 _public_ int sd_bus_default_user(sd_bus **ret) {
-static __thread sd_bus *default_user_bus = NULL;
+static thread_local sd_bus *default_user_bus = NULL;
 
 return bus_default(sd_bus_open_user, &default_user_bus, ret);
 }
diff --git a/src/libsystemd-bus/sd-event.c b/src/libsystemd-bus/sd-event.c
index 06c84d7..727528b 100644
--- a/src/libsystemd-bus/sd-event.c
+++ b/src/libsystemd-bus/sd-event.c
@@ -2116,7 +2116,7 @@ _public_ int sd_event_get_now_monotonic(sd_event *e, 
uint64_t *usec) {
 
 _public_ int sd_event_default(sd_event **ret) {
 
-static __thread sd_event *default_event = NULL;
+static thread_local sd_event *default_event = NULL;
 sd_event *e;
 int r;
 
diff --git a/src/libsystemd-id128/sd-id128.c b/src/libsystemd-id128/sd-id128.c
index 07d2415..9ee40ab 100644
--- a/src/libsystemd-id128/sd-id128.c
+++ b/src/libsystemd-id128/sd-id128.c
@@ -104,8 +104,8 @@ static sd_id128_t make_v4_uuid(sd_id128_t id) {
 }
 
 _public_ int sd_id128_get_machine(sd_id128_t *ret) {
-static __thread sd_id128_t saved_machine_id;
-static __thread bool saved_machine_id_valid = false;
+static thread_local sd_id128_t saved_machine_id;
+static thread_local bool saved_machine_id_valid = false;
 _cleanup_close_ int fd = -1;
 char buf[33];
 ssize_t k;
@@ -153,8 +153,8 @@ _public_ int sd_id128_get_machine(sd_id128_t *ret) {
 }
 
 _public_ int sd_id128_get_boot(sd_id128_t *ret) {
-static __thread sd_id128_t saved_boot_id;
-static __thread bool saved_boot_id_valid = false;
+static thread_local sd_id128_t saved_boot_id;
+static thread_local bool saved_boot_id_valid = false;
 _cleanup_close_ int fd = -1;
 char buf[36];
 ssize_t k;
diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c
index ec6a722..042586d 100644
--- a/src/login/logind-inhibit.c
+++ b/src/login/logind-inhibit.c
@@ -413,7 +413,7 @@ bool manager_is_inhibited(
 }
 
 const char *inhibit_what_to_string(InhibitWhat w) {
-static __thread char buffer[97];
+static thread_local char buffer[97];
 char *p;
 
 if (w < 0 || w >= _INHIBIT_WHAT_MAX)
diff --git a/src/shared/capability.c b/src/shared/capability.c
index 3219520..f34f6ba 100644
--- a/src/shared/capability.c
+++ b/src/shared/capability.c
@@ -55,8 +55,8 @@ int have_effective_cap(int value) {
 }
 
 unsigned long cap_last_cap(void) {
-static __thread unsigned long saved;
-static __thread bool valid = false;
+static thread_local unsigned long saved;
+static thread_local bool valid = false;
 unsigned long p;
 
 if (valid)
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index 2c2ffc5..309f65d 100644
--- a/src/shared/cgroup-util.c
+++ b/src/shared/cgroup-util.c
@@ -480,7 +480,7 @@ static int join_path(const char *controller, const char 
*path, const char *suffi
 
 int cg_get_path(const char *controller, const char *path, const char *suffix, 
char **fs) {
 const char *p;
-static __thread bool good = false;
+static thread_local bool good = false;
 
 assert(fs);
 
diff --git a/src/shared/macro.h b/src/shared/macro.h
index fd3762e..362d62b 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -27,6 +27,17 @@
 #include 
 #include 
 
+#ifndef thread_local
+/* don't break on glibc < 2.16 that doesn't define __STDC_NO_THREADS__
+ * see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53769 */
+# if __STDC_VERSION__ >= 201112L && !(defined(__STDC_NO_THREADS__) || \
+  (defined(__GNU_LIBRARY__) && __GLIBC__ 
== 2 && __GLIBC_MINOR__ < 16))
+#  define thread_local _Thread_local
+# else
+#  define thread_local __thread
+# endif
+#endif
+
 #define _printf_(a,b) __attribute__ ((format (printf, a, b)))
 #def

[systemd-devel] [PATCH 1/2] util: no need for in_initrd() cache to be thread-local

2013-12-15 Thread Shawn Landden
the process only has one working directory, and a race is
harmless
---
 src/shared/util.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/shared/util.c b/src/shared/util.c
index b5ffaa1..7c73074 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -2737,9 +2737,9 @@ int rm_rf_children_dangerous(int fd, bool only_dirs, bool 
honour_sticky, struct
 
 _pure_ static int is_temporary_fs(struct statfs *s) {
 assert(s);
-return
-F_TYPE_EQUAL(s->f_type, TMPFS_MAGIC) ||
-F_TYPE_EQUAL(s->f_type, RAMFS_MAGIC);
+
+return F_TYPE_EQUAL(s->f_type, TMPFS_MAGIC) ||
+   F_TYPE_EQUAL(s->f_type, RAMFS_MAGIC);
 }
 
 int rm_rf_children(int fd, bool only_dirs, bool honour_sticky, struct stat 
*root_dev) {
@@ -5155,7 +5155,7 @@ bool is_valid_documentation_url(const char *url) {
 }
 
 bool in_initrd(void) {
-static __thread int saved = -1;
+static int saved = -1;
 struct statfs s;
 
 if (saved >= 0)
-- 
1.8.5.1

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


Re: [systemd-devel] getty : how to run getty on every ttyX

2013-12-15 Thread Gao feng
On 12/14/2013 12:20 AM, Lennart Poettering wrote:
> On Fri, 13.12.13 16:15, Lennart Poettering (lenn...@poettering.net) wrote:
> 
>>> We had discussed this back at Linux Plumbers last year, and at the time
>>> you had suggested that rather than create /dev/ttyN symlinks we should
>>> instead do something like  /dev/containerttyN instead, and set a
>>> 'container_tty' variable containing a list of all those device names
>>> so that systemd can discover them sensibly. We never got around to
>>> doing this from the libvirt side, and AFAIK systemd hasn't done anything
>>> on its side either. So is this still a suitable way forward ?
>>
>> Yeah, I am pretty sure that's what we should do. I figure I should hack
>> that up. I'll work on it now.
> 
> Committed. "systemd-getty-generator" will now look for $container_ttys
> set as an environment variable for PID 1. If that is set it will split
> the string up on whitespaces and start a getty on all ptys
> referenced. Note that this only supports ptys, not any other ttys. 
> 
> Example:
> 
> "container_ttys=pts/5 pts/8 pts/15"
> 
> when pass to PID 1 will spawn three additional gettys on ptys 5, 8 and
> 15.
> 
> Note that this *really* only supports ptys, not any other kinds of ttys,
> sinc for those we require propery device enumeration and notification
> and we don't have those in containers... I still chose to name this
> $container_ttys rather than $container_ptys, so that maybe one day we
> can extend it should devices like this ever get virtualized.
> 
> This will be in systemd 209.
> 

So quickly! thanks you guys!


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


Re: [systemd-devel] Fwd: [Pkg-systemd-maintainers] Bug#732157: Want SIGSTOP-style daemon/service readiness notification

2013-12-15 Thread Andrey Borzenkov
В Sun, 15 Dec 2013 23:23:54 +0100
Lennart Poettering  пишет:

> 
> This is really not how we should do it: the admin must be capable of
> tracing and pausing the boot process, and an init system should not make
> that impossible. 
>

What happens currently when service gets SIGSTOP? Does systemd ignore
it? Will it reflect this information in service state? Actually, what
state service *is* in this case (it obviously is not running but is not
failed either ...)?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] prioq: avoid to swap item index

2013-12-15 Thread Chengwei Yang
the swap() operation of prioq which in fact only swap item's data but
keep idx untouched. However, current implement does first swap the idx
and then swap back again.
---
 src/shared/prioq.c |   10 --
 1 file changed, 10 deletions(-)

diff --git a/src/shared/prioq.c b/src/shared/prioq.c
index 8af4c51..ef99c47 100644
--- a/src/shared/prioq.c
+++ b/src/shared/prioq.c
@@ -68,7 +68,6 @@ int prioq_ensure_allocated(Prioq **q, compare_func_t 
compare_func) {
 
 static void swap(Prioq *q, unsigned j, unsigned k) {
 void *saved_data;
-unsigned *saved_idx;
 
 assert(q);
 assert(j < q->n_items);
@@ -78,17 +77,8 @@ static void swap(Prioq *q, unsigned j, unsigned k) {
 assert(!q->items[k].idx || *(q->items[k].idx) == k);
 
 saved_data = q->items[j].data;
-saved_idx = q->items[j].idx;
 q->items[j].data = q->items[k].data;
-q->items[j].idx = q->items[k].idx;
 q->items[k].data = saved_data;
-q->items[k].idx = saved_idx;
-
-if (q->items[j].idx)
-*q->items[j].idx = j;
-
-if (q->items[k].idx)
-*q->items[k].idx = k;
 }
 
 static unsigned shuffle_up(Prioq *q, unsigned idx) {
-- 
1.7.9.5

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


Re: [systemd-devel] [PATCH] prioq: avoid to swap item index

2013-12-15 Thread Lennart Poettering
On Mon, 16.12.13 11:03, Chengwei Yang (chengwei.y...@intel.com) wrote:

> the swap() operation of prioq which in fact only swap item's data but
> keep idx untouched. However, current implement does first swap the idx
> and then swap back again.

Sorry, I do understand? Can you elaborate, please? Is this supposed to
be a bug fix or an optimization?

> ---
>  src/shared/prioq.c |   10 --
>  1 file changed, 10 deletions(-)
> 
> diff --git a/src/shared/prioq.c b/src/shared/prioq.c
> index 8af4c51..ef99c47 100644
> --- a/src/shared/prioq.c
> +++ b/src/shared/prioq.c
> @@ -68,7 +68,6 @@ int prioq_ensure_allocated(Prioq **q, compare_func_t 
> compare_func) {
>  
>  static void swap(Prioq *q, unsigned j, unsigned k) {
>  void *saved_data;
> -unsigned *saved_idx;
>  
>  assert(q);
>  assert(j < q->n_items);
> @@ -78,17 +77,8 @@ static void swap(Prioq *q, unsigned j, unsigned k) {
>  assert(!q->items[k].idx || *(q->items[k].idx) == k);
>  
>  saved_data = q->items[j].data;
> -saved_idx = q->items[j].idx;
>  q->items[j].data = q->items[k].data;
> -q->items[j].idx = q->items[k].idx;
>  q->items[k].data = saved_data;
> -q->items[k].idx = saved_idx;
> -
> -if (q->items[j].idx)
> -*q->items[j].idx = j;
> -
> -if (q->items[k].idx)
> -*q->items[k].idx = k;
>  }
>  
>  static unsigned shuffle_up(Prioq *q, unsigned idx) {


Lennart

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


Re: [systemd-devel] [PATCH] prioq: avoid to swap item index

2013-12-15 Thread Lennart Poettering
On Mon, 16.12.13 04:48, Lennart Poettering (lenn...@poettering.net) wrote:

> 
> On Mon, 16.12.13 11:03, Chengwei Yang (chengwei.y...@intel.com) wrote:
> 
> > the swap() operation of prioq which in fact only swap item's data but
> > keep idx untouched. However, current implement does first swap the idx
> > and then swap back again.
> 
> Sorry, I do understand? Can you elaborate, please? Is this supposed to
 wanted to say: I do *not* understand...
> be a bug fix or an optimization?
> 
> > ---
> >  src/shared/prioq.c |   10 --
> >  1 file changed, 10 deletions(-)
> > 
> > diff --git a/src/shared/prioq.c b/src/shared/prioq.c
> > index 8af4c51..ef99c47 100644
> > --- a/src/shared/prioq.c
> > +++ b/src/shared/prioq.c
> > @@ -68,7 +68,6 @@ int prioq_ensure_allocated(Prioq **q, compare_func_t 
> > compare_func) {
> >  
> >  static void swap(Prioq *q, unsigned j, unsigned k) {
> >  void *saved_data;
> > -unsigned *saved_idx;
> >  
> >  assert(q);
> >  assert(j < q->n_items);
> > @@ -78,17 +77,8 @@ static void swap(Prioq *q, unsigned j, unsigned k) {
> >  assert(!q->items[k].idx || *(q->items[k].idx) == k);
> >  
> >  saved_data = q->items[j].data;
> > -saved_idx = q->items[j].idx;
> >  q->items[j].data = q->items[k].data;
> > -q->items[j].idx = q->items[k].idx;
> >  q->items[k].data = saved_data;
> > -q->items[k].idx = saved_idx;
> > -
> > -if (q->items[j].idx)
> > -*q->items[j].idx = j;
> > -
> > -if (q->items[k].idx)
> > -*q->items[k].idx = k;
> >  }
> >  
> >  static unsigned shuffle_up(Prioq *q, unsigned idx) {
> 
> 
> Lennart
> 


Lennart

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


Re: [systemd-devel] Fwd: [Pkg-systemd-maintainers] Bug#732157: Want SIGSTOP-style daemon/service readiness notification

2013-12-15 Thread Lennart Poettering
On Mon, 16.12.13 06:55, Andrey Borzenkov (arvidj...@gmail.com) wrote:

> В Sun, 15 Dec 2013 23:23:54 +0100
> Lennart Poettering  пишет:
> 
> > 
> > This is really not how we should do it: the admin must be capable of
> > tracing and pausing the boot process, and an init system should not make
> > that impossible. 
> >
> 
> What happens currently when service gets SIGSTOP? Does systemd ignore
> it? 

We never ask for SIGSTOP notifications, and we hence don't get them at all.

> Will it reflect this information in service state? 

No. It really doesn't care much. I am not sure reflecting this
information in the service state would really be such a good idea, as
the service concept mostly tries to reflect state that applies to all
processes of a service, except when it comese to lifecycle
decisions. Now, whether a process is stopped or not is really something
that is specific to a single process, not a service, so it probably
shouldn't be reflected in the entirety of the service.

That said, I am not against adding something to the way we display
"systemctl status" where we show explicitly for each process we list
whether it is stopped or not. (maybe just by showing unicode stop sign
or so next to stopped processes). But sofar nobody asked fr this...

Not that we when we kill a service the hard way then we will send a
SIGCONT to it, so that we can fulfill the request even if the process is
currently stopped. (Because it won't react to SIGTERM as long as it is paused.)

> Actually, what
> state service *is* in this case (it obviously is not running but is not
> failed either ...)?

Well, we don't care about whether a process is stopped or not, hence
from our perspective whether it is paused or not is indistuingishable,
it's just a process like any other, except maybe that it might not
respond anymore (which we might notice eventually if watchdog support is
enabled for it...)

Lennart

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


Re: [systemd-devel] [PATCH] prioq: avoid to swap item index

2013-12-15 Thread Yang Chengwei
On Mon, Dec 16, 2013 at 04:57:39AM +0100, Lennart Poettering wrote:
> On Mon, 16.12.13 04:48, Lennart Poettering (lenn...@poettering.net) wrote:
> 
> > 
> > On Mon, 16.12.13 11:03, Chengwei Yang (chengwei.y...@intel.com) wrote:
> > 
> > > the swap() operation of prioq which in fact only swap item's data but
> > > keep idx untouched. However, current implement does first swap the idx
> > > and then swap back again.
> > 
> > Sorry, I do understand? Can you elaborate, please? Is this supposed to
>  wanted to say: I do *not* understand...

It's an optimization.

A condition of the queue is just like the assert says

assert(!q->items[j].idx || *(q->items[j].idx) == j);
assert(!q->items[k].idx || *(q->items[k].idx) == k);

This is true before and after swap. So in fact no need to swap idx and
then swap back again. Just do not touch idx, then item[j].idx is always
0 or j, so as item[k].

The deleted code does

1. first swap the idx regardless it's 0 or not

2. then, if idx isn't 0, swap back.

So this patch is a optimization for the case where item.idx isn't 0,
which avoid to swap idx and swap idx back.

I'm not sure this is clear enough. In simple, the fact is *before* and
*after* we need make sure item[j].idx == j or item[j].idx == 0, so why we
change it during swap? Because if it changed during swap, we need then
assign item[j].idx = j before the swap finish. So the simple way is keep
it untouched.

--
Thanks,
Chengwei

> > be a bug fix or an optimization?
> > 
> > > ---
> > >  src/shared/prioq.c |   10 --
> > >  1 file changed, 10 deletions(-)
> > > 
> > > diff --git a/src/shared/prioq.c b/src/shared/prioq.c
> > > index 8af4c51..ef99c47 100644
> > > --- a/src/shared/prioq.c
> > > +++ b/src/shared/prioq.c
> > > @@ -68,7 +68,6 @@ int prioq_ensure_allocated(Prioq **q, compare_func_t 
> > > compare_func) {
> > >  
> > >  static void swap(Prioq *q, unsigned j, unsigned k) {
> > >  void *saved_data;
> > > -unsigned *saved_idx;
> > >  
> > >  assert(q);
> > >  assert(j < q->n_items);
> > > @@ -78,17 +77,8 @@ static void swap(Prioq *q, unsigned j, unsigned k) {
> > >  assert(!q->items[k].idx || *(q->items[k].idx) == k);
> > >  
> > >  saved_data = q->items[j].data;
> > > -saved_idx = q->items[j].idx;
> > >  q->items[j].data = q->items[k].data;
> > > -q->items[j].idx = q->items[k].idx;
> > >  q->items[k].data = saved_data;
> > > -q->items[k].idx = saved_idx;
> > > -
> > > -if (q->items[j].idx)
> > > -*q->items[j].idx = j;
> > > -
> > > -if (q->items[k].idx)
> > > -*q->items[k].idx = k;
> > >  }
> > >  
> > >  static unsigned shuffle_up(Prioq *q, unsigned idx) {
> > 
> > 
> > Lennart
> > 
> 
> 
> Lennart
> 
> -- 
> Lennart Poettering, Red Hat


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


Re: [systemd-devel] journal: How to limit the file size of runtime system.journal

2013-12-15 Thread WANG Chao
On 12/13/13 at 02:18pm, Zbigniew Jędrzejewski-Szmek wrote:
> On Fri, Dec 13, 2013 at 01:49:51PM +0800, WANG Chao wrote:
> > On 12/13/13 at 06:42am, Zbigniew Jędrzejewski-Szmek wrote:
> > > On Fri, Dec 13, 2013 at 01:33:17PM +0800, WANG Chao wrote:
> > > > Hi,
> > > > 
> > > > In kdump environment, memory resource is quite limited. I find that the
> > > > runtime journal file (/run/log/journal/$id/system.journal) is 4 MB and I
> > > > think that is too much for a initramfs context.
> > > > 
> > > > After tuning both RuntimeMaxUse=1% or RuntimeMaxFileSiz=100K, I find
> > > > system.journal is still 4 MB in size. So here comes my questions:
> > > > 
> > > > 1. Did miss use of these two config options? Because regarding the
> > > > journald.conf(5), it seems I was totally doing it right.
> > > 4MB is the minimum. Those settings are ignored if you set anything
> > > lower.
> > 
> > Is there any particular reason? I think thresold for runtime journal
> > size can lower much because in initramfs it's not supposed to have much
> > logs.
> First, there are some data strcutures which are allocated when the file
> is created, and if the file was very small, relatively more space would
> wasted. Second, repeated fields are not stored, just referenced, so things
> become more efficient when the file is not too small. But neither is
> fundamental reason, and with some tweaking the journal could be made
> to work much smaller files.

I understand. These are really good points when logs are relatively
large, ie. the journal is stored on a real disk.

However when it's in initramfs context, journal is stored in tmpfs which
is using the real memory resource as it's backend. 4 MB seems a little
bit overkill especially when memory is quite limited case, like kdump.
To be more specific, I think 512 KB or 1 MB is a fairly large enough
nubmer when journal is stored to a volatile backend.

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


Re: [systemd-devel] journal: How to limit the file size of runtime system.journal

2013-12-15 Thread Holger Winkelmann [TP]
Hi,

> > > Is there any particular reason? I think thresold for runtime journal
> > > size can lower much because in initramfs it's not supposed to have much
> > > logs.
> > First, there are some data strcutures which are allocated when the file
> > is created, and if the file was very small, relatively more space would
> > wasted. Second, repeated fields are not stored, just referenced, so things
> > become more efficient when the file is not too small. But neither is
> > fundamental reason, and with some tweaking the journal could be made
> > to work much smaller files.
> 
> I understand. These are really good points when logs are relatively
> large, ie. the journal is stored on a real disk.
> 
> However when it's in initramfs context, journal is stored in tmpfs which
> is using the real memory resource as it's backend. 4 MB seems a little
> bit overkill especially when memory is quite limited case, like kdump.
> To be more specific, I think 512 KB or 1 MB is a fairly large enough
> nubmer when journal is stored to a volatile backend.

We totally agree that a minimum size must be below 1MB either on flash or
ramfs for embedded devices. otherwise you end up with two solutions for smaller
and bigger devices. Is there any reference about the overhead if you use smaller
file size? Is there technical limitation for a minimum size?

Thanks,
Holger
 
> Thanks
> WANG Chao
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 

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