Re: [systemd-devel] Get rid of /etc/fstab

2013-02-04 Thread Lennart Poettering
On Sat, 02.02.13 15:24, Sébastien Luttringer (se...@seblu.net) wrote:

 Hello,
 
 Looking forward to mount custom partitions I decided to use unit.mount
 files to define my new fs. Everything works perfectly, so I tried to
 do the same with all my mounted filesystems and removing /etc/fstab.

I am not sure it is worth getting rid of fstab. I mean, that file is
  
very simple and sufficiently powerful for many cases. It is exposed in  
  
glibc's setmntent() API and widely understood by programs, including
  
udisks. 
  

  
.mount units are more powerful than fstab but actually not as easy to   
  
write as fstab. 
  

  
So, /etc/fstab and /etc/crypttab I believe are really things that are   
  
going to stay, and we don't really see any point in deprecating or  
  
moving them out of focus. That said, systemd should work fine if they   
  
are non-existant, and there might be many setups where not including an 
  
fstab might be a really good idea, for example those where it is
  
desirable to use root= on the kernel command line as only place where   
  
the root file system is defined (probably particularly useful on
  
embedded and virtualized setups). 

 But unfortunatly, creating a -.mount file in
 /etc/systemd/system/local-fs.target.wants not work as I expected. I
 guess it's because generated file /run/systemd/generator/-.mount take
 precedence.

Hmm, -.mount is a special case as the root fs is mounted via the
kernel's root= command line parameter rather than this unit
file. Defining -.mount manually currently doesn't really do anything
useful. Also, if you want to make changes to the mount options of the
root directory, then /etc/fstab is really the only option, as that's the
only place where systemd-remount-fs will look.

 Is there any way of removing old fstab to full unit configuration?

Only if don't have any special mount options to apply to the root fs.

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] Get rid of /etc/fstab

2013-02-04 Thread Reindl Harald


Am 04.02.2013 10:18, schrieb Lennart Poettering:
 On Sat, 02.02.13 15:24, Sébastien Luttringer (se...@seblu.net) wrote:
 
 Hello,

 Looking forward to mount custom partitions I decided to use unit.mount
 files to define my new fs. Everything works perfectly, so I tried to
 do the same with all my mounted filesystems and removing /etc/fstab.
 
 I am not sure it is worth getting rid of fstab. I mean, that file is  
 
 very simple and sufficiently powerful for many cases. It is exposed in
 
 glibc's setmntent() API and widely understood by programs, including  
 
 udisks.

it is not - it doe not eat babies, it is well known over
decades, it is referenced in thousands if docs and if it
ain't broken don't fix it!



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


Re: [systemd-devel] [bug] (char*)NULL should be used in variadic functions

2013-02-04 Thread Michał Bartoszkiewicz
On Mon, Feb 4, 2013 at 11:15 AM, Lennart Poettering
lenn...@poettering.net wrote:
 We actually care about readability of the sources and non-Linux systems
 are out-of-focus for us. Can you tell me which Linux system has
 sizeof(void*) != sizeof(char*)? Otherwise, I only see this as pointless
 excercise of making our sources less readable...

 Or am I missing something here?

I believe it is legal (but glibc doesn't seem to do it) to define NULL
simply as 0, so sizeof NULL == sizeof(int), which can be different
from sizeof(void*).

--
Michał Bartoszkiewicz mbartoszkiew...@gmail.com
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] core: reuse the same /tmp and /var/tmp

2013-02-04 Thread Colin Guthrie
[and the crowd goes wild!]

Thanks for this work. I've also had a few bug reports about this one.

'Twas brillig, and Michal Sekletar at 02/02/13 09:10 did gyre and gimble:
 thank you very much for the review, it is very appreciated. I've sent
 out the patch to get a feedback on a general approach, since there are
 no objections to it, I will hack up the rest, inaccessible dirs, man
 page etc...

As a small bit of bikeshedding/feature creep: would it be possible to
name the directories with a little bit of context in them? e.g. it would
be great if they could be called systemd-myunit-service-XX.

There may be valid reasons for not doing this, but when debugging things
and poking about as root user it might add a little bit of clarity when
several such folders exist (of course slight obfuscation here may be
deliberate)

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] changing the mount --make-shared / default

2013-02-04 Thread Tom Gundersen
On Feb 4, 2013 10:31 AM, Lennart Poettering lenn...@poettering.net
wrote:

 On Fri, 01.02.13 12:50, Jake Edge (j...@lwn.net) wrote:

  [ OK, let's try this again ... since I'm impatient about it sitting in
  the moderator queue, I went ahead and joined up ]
 
  Hi Lennart (and the rest of the systemd gang),
 
  I was quite surprised by some behavior that I found today in Fedora 18,
  which I think comes from systemd.  I was trying to play with mount
  namespaces and was rather surprised to find that they didn't work as
  expected. After some googling, I realized that Fedora makes / a shared
  mount by default.  That appears to come from:
 
 
http://cgit.freedesktop.org/systemd/systemd/commit/?id=b3ac5f8cb98757416d8660023d6564a7c411f0a0
 
  where you say:
 
  Setups which prefer the default of private should undo this change
  via invoking mount --make-private / or a similar command after boot.
 
  I am not sure that I want the default to be private, but if I did,
  what is the proper, systemd-ish way to do so?

 Drop a unit file like this one to /etc/systemd/system/make-shared.service:

 [Unit]
 Description=I like my hierarchies private
 DefaultDependencies=no
 Conflicts=shutdown.target
 Before=local-fs-pre.target shutdown.target

 [Service]
 Type=oneshot
 RemainAfterExit=yes
 ExecStart=/bin/mount --make-rprivate /

 And then pull this into the early boot:

 # mkdir -p /etc/systemd/system/local-fs.target.wants/
 # ln -s ../make-shared.service
/etc/systemd/system/local-fs.target.wants/

 I didn't test this, but it should do the job, nicely.

 Explanations:

 As this is an early boot process we need to disable the default
 ordering/requirement dependencies systemd adds to services via
 DefaultDependencies=no. Then, we order ourselves before
 local-fs-pre.target, which has the benefit that we can be sure that
 further mounted fs will inherit the flag nicely and
 race-freely. local-fs-pre.target is ordered after all local mounts.

*before*?

 We also order ourselves relative to shutdown.target, which ensures this
 unit is stopped at shutdown. This is just to make things nice, and
 actually has very little effect, as the unit doesn't do anything anyway
 when stopped.

 We use Type=oneshot since the specified command should be executed at
 boot and be waited for before boot progresses (adhering to the ordering
 dependencies expressed in [Unit]).

 We use RemainAfterExit=yes so that the unit stays around after it is
 started, so that we can easily check after boot if it got properly
 started during boot.

 Finally, the ln -s line makes sure the unit is activated as part of
 local-fs.target, which is where all local file system units tend to be
 pulled in.

 Hope this makes sense!

 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 mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] changing the mount --make-shared / default

2013-02-04 Thread Tom Gundersen
On Feb 4, 2013 1:36 PM, Tom Gundersen t...@jklm.no wrote:


 On Feb 4, 2013 10:31 AM, Lennart Poettering lenn...@poettering.net
wrote:
 
  On Fri, 01.02.13 12:50, Jake Edge (j...@lwn.net) wrote:
 
   [ OK, let's try this again ... since I'm impatient about it sitting in
   the moderator queue, I went ahead and joined up ]
  
   Hi Lennart (and the rest of the systemd gang),
  
   I was quite surprised by some behavior that I found today in Fedora
18,
   which I think comes from systemd.  I was trying to play with mount
   namespaces and was rather surprised to find that they didn't work as
   expected. After some googling, I realized that Fedora makes / a shared
   mount by default.  That appears to come from:
  
  
http://cgit.freedesktop.org/systemd/systemd/commit/?id=b3ac5f8cb98757416d8660023d6564a7c411f0a0
  
   where you say:
  
   Setups which prefer the default of private should undo this change
   via invoking mount --make-private / or a similar command after boot.
  
   I am not sure that I want the default to be private, but if I did,
   what is the proper, systemd-ish way to do so?
 
  Drop a unit file like this one to
/etc/systemd/system/make-shared.service:
 
  [Unit]
  Description=I like my hierarchies private
  DefaultDependencies=no
  Conflicts=shutdown.target
  Before=local-fs-pre.target shutdown.target
 
  [Service]
  Type=oneshot
  RemainAfterExit=yes
  ExecStart=/bin/mount --make-rprivate /
 
  And then pull this into the early boot:
 
  # mkdir -p /etc/systemd/system/local-fs.target.wants/
  # ln -s ../make-shared.service
/etc/systemd/system/local-fs.target.wants/
 
  I didn't test this, but it should do the job, nicely.
 
  Explanations:
 
  As this is an early boot process we need to disable the default
  ordering/requirement dependencies systemd adds to services via
  DefaultDependencies=no. Then, we order ourselves before
  local-fs-pre.target, which has the benefit that we can be sure that
  further mounted fs will inherit the flag nicely and
  race-freely. local-fs-pre.target is ordered after all local mounts.

 *before*?

Meh, scratch that, Lennart already corrected it.

  We also order ourselves relative to shutdown.target, which ensures this
  unit is stopped at shutdown. This is just to make things nice, and
  actually has very little effect, as the unit doesn't do anything anyway
  when stopped.
 
  We use Type=oneshot since the specified command should be executed at
  boot and be waited for before boot progresses (adhering to the ordering
  dependencies expressed in [Unit]).
 
  We use RemainAfterExit=yes so that the unit stays around after it is
  started, so that we can easily check after boot if it got properly
  started during boot.
 
  Finally, the ln -s line makes sure the unit is activated as part of
  local-fs.target, which is where all local file system units tend to be
  pulled in.
 
  Hope this makes sense!
 
  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 mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] Correctly parse commented multiline variables

2013-02-04 Thread Michal Vyskocil
 Hi,
 can you check if it works with the following test case?
 For me it doesn't, and I think there must be a bug.
 
 Zbyszek

Hi Zbigniew,

sorry for a responding on my initial email, but for some reason your
response[1] did not appear in my mailbox. Anyway your test have raised
an interesting problem - the load_env_file does not parse a variable
definition like shell* do. It considers everything behind quotes as a
variable content and continuation character does not matter.

FOO=this

is
#commented

multiline
variable

will be properly recognized by shell, but not by systemd. On the other
hand, it will accept definitions like FOO=one two, which has a different
meaning in a shell, so must be quoted. Therefor we shall define
systemd's behavior and of course how much close systemd should mimic
shell.

I'd say systemd can ignore quoting and be a bit stricter than a
shell, so accepts only lines ends on \\\n as a continuation and in
this mode accept #comments to be a part of a definition

FOO=this \
is \
#commented \
multiline \
variable

The question is what to do with a definitions ends on a \, followed by
comment

FOO=this \
#is commented

will result in this #is commented, but this is probably not what
people will expect and it behaves differently than a shell. We might
have a rule definition can't end on a comment, even this sounds a bit
nasty to me.

This is probably the reason, where shell syntax make it clear
FOO=this \
#is commented

*I've no idea if there are any differences in variable definitions, but
I use dash as the reference one. So just s/shell/dash/

[1] 
http://lists.freedesktop.org/archives/systemd-devel/2013-February/008566.html

Regards
Michal Vyskocil

On Fri, Feb 01, 2013 at 02:47:24PM +0100, Michal Vyskocil wrote:
 Buffer c must be freeed when code detects a comment or empty string after
 a strip. Otherwise no other variable definitions will be loaded.
[snip]


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


[systemd-devel] [PATCH 1/2] core: keep mountinfo .mounts until late shutdown

2013-02-04 Thread Umut Tezduyar
.mount units coming from /proc/self/mountinfo file are
unmounted after local-fs.target is reached during shutdown.

Problem: .mount units popping up in mountinfo file are
added to systemd without any dependency. For that reason,
they are the first one to be unmounted during shutdown.
Whichever program mounted the file system deserves a
chance to also unmount it. This patch ensures that
/proc/self/mountinfo units will be unmounted after
local-fs.target during shutdown (if they haven't been
unmounted already)
---
 src/core/mount.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/core/mount.c b/src/core/mount.c
index 2aaf78c..29ce440 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1488,6 +1488,10 @@ static int mount_add_one(
 goto fail;
 }
 
+r = unit_add_two_dependencies_by_name(u, UNIT_BEFORE, 
UNIT_REQUIRED_BY, SPECIAL_LOCAL_FS_TARGET, NULL, true);
+if (r  0)
+goto fail;
+
 unit_add_to_load_queue(u);
 } else {
 delete = false;
-- 
1.7.2.5

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


[systemd-devel] [PATCH 2/2] core: do not overwrite existing units source

2013-02-04 Thread Umut Tezduyar
Only set source for freshly created .mounts coming from
mountinfo file.
---
 src/core/mount.c |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/core/mount.c b/src/core/mount.c
index 29ce440..8231059 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1440,7 +1440,7 @@ static int mount_add_one(
 int r;
 Unit *u;
 bool delete;
-char *e, *w = NULL, *o = NULL, *s = NULL, *f = NULL;
+char *e, *w = NULL, *o = NULL, *f = NULL;
 MountParameters *p;
 bool load_extras = false;
 
@@ -1488,6 +1488,12 @@ static int mount_add_one(
 goto fail;
 }
 
+u-source_path = strdup(/proc/self/mountinfo);
+if (!u-source_path) {
+r = -ENOMEM;
+goto fail;
+}
+
 r = unit_add_two_dependencies_by_name(u, UNIT_BEFORE, 
UNIT_REQUIRED_BY, SPECIAL_LOCAL_FS_TARGET, NULL, true);
 if (r  0)
 goto fail;
@@ -1517,7 +1523,6 @@ static int mount_add_one(
 
 if (!(w = strdup(what)) ||
 !(o = strdup(options)) ||
-!(s = strdup(/proc/self/mountinfo)) ||
 !(f = strdup(fstype))) {
 r = -ENOMEM;
 goto fail;
@@ -1531,8 +1536,6 @@ static int mount_add_one(
 }
 
 MOUNT(u)-from_proc_self_mountinfo = true;
-free(u-source_path);
-u-source_path = s;
 
 free(p-what);
 p-what = w;
@@ -1558,7 +1561,6 @@ static int mount_add_one(
 fail:
 free(w);
 free(o);
-free(s);
 free(f);
 
 if (delete  u)
-- 
1.7.2.5

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


Re: [systemd-devel] [PATCH 1/2] core: keep mountinfo .mounts until late shutdown

2013-02-04 Thread Umut Tezduyar
Downside of this patch is, mountinfo mounts stick around as inactive-dead
even when the file system they represent is unmounted.


On Mon, Feb 4, 2013 at 3:00 PM, Umut Tezduyar u...@tezduyar.com wrote:

 .mount units coming from /proc/self/mountinfo file are
 unmounted after local-fs.target is reached during shutdown.

 Problem: .mount units popping up in mountinfo file are
 added to systemd without any dependency. For that reason,
 they are the first one to be unmounted during shutdown.
 Whichever program mounted the file system deserves a
 chance to also unmount it. This patch ensures that
 /proc/self/mountinfo units will be unmounted after
 local-fs.target during shutdown (if they haven't been
 unmounted already)
 ---
  src/core/mount.c |4 
  1 files changed, 4 insertions(+), 0 deletions(-)

 diff --git a/src/core/mount.c b/src/core/mount.c
 index 2aaf78c..29ce440 100644
 --- a/src/core/mount.c
 +++ b/src/core/mount.c
 @@ -1488,6 +1488,10 @@ static int mount_add_one(
  goto fail;
  }

 +r = unit_add_two_dependencies_by_name(u, UNIT_BEFORE,
 UNIT_REQUIRED_BY, SPECIAL_LOCAL_FS_TARGET, NULL, true);
 +if (r  0)
 +goto fail;
 +
  unit_add_to_load_queue(u);
  } else {
  delete = false;
 --
 1.7.2.5


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


[systemd-devel] [PATCH 1/3] journal: log user units for coredumps and show them in systemctl status

2013-02-04 Thread Mirco Tischler
---
 src/journal/coredump.c |  9 ++---
 src/shared/logs-show.c | 18 +++---
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index c989be9..91528d3 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -144,11 +144,14 @@ int main(int argc, char* argv[]) {
 
 core_unit = strappend(COREDUMP_UNIT=, t);
 free(t);
-
-if (core_unit)
-IOVEC_SET_STRING(iovec[j++], core_unit);
+} else if (cg_pid_get_user_unit(pid, t) = 0) {
+core_unit = strappend(COREDUMP_USER_UNIT=, t);
+free(t);
 }
 
+if (core_unit)
+IOVEC_SET_STRING(iovec[j++], core_unit);
+
 /* OK, now we know it's not the journal, hence make use of
  * it */
 log_set_target(LOG_TARGET_JOURNAL_OR_KMSG);
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 034fde6..7dacccf 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -954,7 +954,7 @@ int show_journal_by_user_unit(
 uid_t uid,
 OutputFlags flags) {
 
-_cleanup_free_ char *m1 = NULL, *m2 = NULL, *m3 = NULL;
+_cleanup_free_ char *m1 = NULL, *m2 = NULL, *m3 = NULL, *m4 = NULL;
 sd_journal *j = NULL;
 int r;
 
@@ -972,7 +972,8 @@ int show_journal_by_user_unit(
 
 if (asprintf(m1, _SYSTEMD_USER_UNIT=%s, unit)  0 ||
 asprintf(m2, USER_UNIT=%s, unit)  0 ||
-asprintf(m3, _UID=%d, uid)  0) {
+asprintf(m3, COREDUMP_USER_UNIT=%s, unit)  0 ||
+asprintf(m4, _UID=%d, uid)  0) {
 r = -ENOMEM;
 goto finish;
 }
@@ -985,7 +986,7 @@ int show_journal_by_user_unit(
 r = sd_journal_add_match(j, m1, 0);
 if (r  0)
 goto finish;
-r = sd_journal_add_match(j, m3, 0);
+r = sd_journal_add_match(j, m4, 0);
 if (r  0)
 goto finish;
 
@@ -996,9 +997,20 @@ int show_journal_by_user_unit(
 r = sd_journal_add_match(j, m2, 0);
 if (r  0)
 goto finish;
+r = sd_journal_add_match(j, m4, 0);
+if (r  0)
+goto finish;
+
+/* Look for coredumps of the service */
+r = sd_journal_add_disjunction(j);
+if (r  0)
+goto finish;
 r = sd_journal_add_match(j, m3, 0);
 if (r  0)
 goto finish;
+r = sd_journal_add_match(j, m4, 0);
+if (r  0)
+goto finish;
 
 r = show_journal(f, j, mode, n_columns, not_before, how_many, flags);
 if (r  0)
-- 
1.8.1.2

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


[systemd-devel] [PATCH 3/3] coredump: make use of the cleanup macros

2013-02-04 Thread Mirco Tischler
---
 src/journal/coredump.c | 28 ++--
 1 file changed, 6 insertions(+), 22 deletions(-)

diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index 91528d3..4f79c45 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -32,6 +32,7 @@
 
 #include log.h
 #include util.h
+#include macro.h
 #include mkdir.h
 #include special.h
 #include cgroup-util.h
@@ -49,7 +50,7 @@ enum {
 };
 
 static int divert_coredump(void) {
-FILE *f;
+_cleanup_fclose_ FILE *f = NULL;
 int r;
 
 log_info(Detected coredump of the journal daemon itself, diverting 
coredump to /var/lib/systemd/coredump/.);
@@ -94,21 +95,20 @@ static int divert_coredump(void) {
 }
 
 finish:
-fclose(f);
 return r;
 }
 
 int main(int argc, char* argv[]) {
 int r, j = 0;
-char *p = NULL;
+_cleanup_free_ char *p = NULL;
 ssize_t n;
 pid_t pid;
 uid_t uid;
 gid_t gid;
 struct iovec iovec[14];
-char *core_pid = NULL, *core_uid = NULL, *core_gid = NULL, 
*core_signal = NULL,
+_cleanup_free_ char *core_pid = NULL, *core_uid = NULL, *core_gid = 
NULL, *core_signal = NULL,
 *core_timestamp = NULL, *core_comm = NULL, *core_exe = NULL, 
*core_unit = NULL,
-*core_session = NULL, *core_message = NULL, *core_cmdline = 
NULL, *t;
+*core_session = NULL, *core_message = NULL, *core_cmdline = 
NULL, *t = NULL;
 
 prctl(PR_SET_DUMPABLE, 0);
 
@@ -143,11 +143,8 @@ int main(int argc, char* argv[]) {
 }
 
 core_unit = strappend(COREDUMP_UNIT=, t);
-free(t);
-} else if (cg_pid_get_user_unit(pid, t) = 0) {
+} else if (cg_pid_get_user_unit(pid, t) = 0)
 core_unit = strappend(COREDUMP_USER_UNIT=, t);
-free(t);
-}
 
 if (core_unit)
 IOVEC_SET_STRING(iovec[j++], core_unit);
@@ -264,18 +261,5 @@ int main(int argc, char* argv[]) {
 log_error(Failed to send coredump: %s, strerror(-r));
 
 finish:
-free(p);
-free(core_pid);
-free(core_uid);
-free(core_gid);
-free(core_signal);
-free(core_timestamp);
-free(core_comm);
-free(core_exe);
-free(core_cmdline);
-free(core_unit);
-free(core_session);
-free(core_message);
-
 return r  0 ? EXIT_FAILURE : EXIT_SUCCESS;
 }
-- 
1.8.1.2

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


Re: [systemd-devel] lazy forwarding of ssh ports

2013-02-04 Thread Igor Bukanov
Thanks again! I have completely missed this new feature of ssh.

On 2/3/13, Mantas Mikulėnas graw...@gmail.com wrote:
 On Wed, Jan 30, 2013 at 12:52 AM, Igor Bukanov i...@mir2.org wrote:
 On 29 January 2013 00:25, Mantas Mikulėnas graw...@gmail.com wrote:
 systemd only handles accepting connections, but does not copy any
 data – ssh's stdin  stdout are attached directly to the socket.

 Right, how can I missed that socket-stdio bindings happens in kernel
 that know how to transfer packets efficiently...

 So the whole setup is not that bad. I just wish that I could avoid the
 nc command on the server and ssh had an option to connect to a socket
 directly without netcat involvement. But this has nothing to do with
 systemd.

 Apparently, ssh has an option -W host:port to do just that.

 --
 Mantas Mikulėnas

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


[systemd-devel] [PATCH 2/3] logs-show: show messages for all unit types in systemctl status

2013-02-04 Thread Mirco Tischler
I can't find a reason why we shouldn't try to output messages for other
unit types than .service, .socket, .mount and .swap as well. It's probably
a leftover from before we started logging UNIT= from inside PID 1.
---
 src/shared/logs-show.c | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 7dacccf..b909c24 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -886,12 +886,6 @@ int show_journal_by_unit(
 assert(mode  _OUTPUT_MODE_MAX);
 assert(unit);
 
-if (!endswith(unit, .service) 
-!endswith(unit, .socket) 
-!endswith(unit, .mount) 
-!endswith(unit, .swap))
-return 0;
-
 if (how_many = 0)
 return 0;
 
@@ -962,11 +956,6 @@ int show_journal_by_user_unit(
 assert(mode  _OUTPUT_MODE_MAX);
 assert(unit);
 
-if (!endswith(unit, .service) 
-!endswith(unit, .socket))
-
-return 0;
-
 if (how_many = 0)
 return 0;
 
-- 
1.8.1.2

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


[systemd-devel] [PATCH] systemd-analyze: rewrite in C.

2013-02-04 Thread Simon Peeters
Written by Peeters Simon peeters.si...@gmail.com. Makefile stuff
and cleaned up a bit by Auke Kok auke-jan.h@intel.com.
---
 Makefile.am|  21 +-
 src/analyze/systemd-analyze.c  | 575 +
 src/analyze/systemd-analyze.in | 328 ---
 3 files changed, 585 insertions(+), 339 deletions(-)
 create mode 100644 src/analyze/systemd-analyze.c
 delete mode 100755 src/analyze/systemd-analyze.in

diff --git a/Makefile.am b/Makefile.am
index 2631748..e31cbb2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -186,7 +186,8 @@ rootbin_PROGRAMS = \
systemd-ask-password \
systemd-tty-ask-password-agent \
systemd-tmpfiles \
-   systemd-machine-id-setup
+   systemd-machine-id-setup \
+   systemd-analyze
 
 bin_PROGRAMS = \
systemd-cgls \
@@ -221,14 +222,16 @@ systemgenerator_PROGRAMS = \
systemd-fstab-generator \
systemd-system-update-generator
 
-dist_bin_SCRIPTS = \
-   src/analyze/systemd-analyze
+systemd_analyze_SOURCES = \
+   src/analyze/systemd-analyze.c
 
-EXTRA_DIST += \
-   src/analyze/systemd-analyze.in
+systemd_analyze_CFLAGS = \
+   $(AM_CFLAGS) \
+   $(DBUS_CFLAGS)
 
-CLEANFILES += \
-   src/analyze/systemd-analyze
+systemd_analyze_LDADD = \
+   libsystemd-shared.la \
+   libsystemd-dbus.la
 
 dist_bashcompletion_DATA = \
shell-completion/systemd-bash-completion.sh
@@ -3837,10 +3840,6 @@ src/%.policy.in: src/%.policy.in.in Makefile
$(SED_PROCESS)
$(AM_V_GEN)chmod +x $@
 
-src/analyze/systemd-analyze: %: %.in Makefile
-   $(SED_PROCESS)
-   $(AM_V_GEN)chmod +x $@
-
 src/%.c: src/%.gperf
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(GPERF)  $  $@
diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c
new file mode 100644
index 000..8aaf238
--- /dev/null
+++ b/src/analyze/systemd-analyze.c
@@ -0,0 +1,575 @@
+#include stdio.h
+#include stdlib.h
+#include getopt.h
+#include locale.h
+
+#include install.h
+#include log.h
+#include dbus-common.h
+#include build.h
+#include util.h
+
+#define svg(...) printf(__VA_ARGS__)
+#define svg_bar(class, begin, end) \
+svg(  rect class=\%s\ x=\%.03f\ y=\%.03f\ width=\%.03f\ 
height=\%.03f\ /\n, \
+(class), \
+scale_x * (begin) * 0.01, scale_y * barcount, \
+scale_x * ((end) - (begin)) * 0.01, scale_y - 1.0)
+#define svg_text_nl(begin, format, ...) \
+svg(  text x=\%.03f\ y=\%.03f\format/text\n, \
+scale_x * (begin) * 0.01 + 5.0, \
+(scale_y * barcount++) + 14.0, ## __VA_ARGS__)
+#define svg_bar_text_nl(class, begin, end, text_format, ...) do { \
+svg_bar(class, begin, end); \
+svg_text_nl(begin, text_format, ## __VA_ARGS__); \
+}while (false)
+
+static UnitFileScope arg_scope = UNIT_FILE_SYSTEM;
+
+double scale_x = 100.0;
+double scale_y = 20.0;
+
+static int barcount = 0;
+
+struct boot_times {
+uint64_t firmware_time;
+uint64_t loader_time;
+uint64_t kernel_time;
+uint64_t kernel_done_time;
+uint64_t initrd_time;
+uint64_t userspace_time;
+uint64_t finish_time;
+};
+struct unit_times {
+char *name;
+uint64_t ixt;
+uint64_t iet;
+uint64_t axt;
+uint64_t aet;
+uint64_t time;
+};
+
+static uint64_t property_getu64(
+DBusConnection *bus,
+const char *dest,
+const char *path,
+const char *interface,
+const char *property)
+{
+int err = errno; //back up errno to prevent accidentally setting it.
+_cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
+DBusMessageIter iter, sub;
+uint64_t result = 0;
+
+errno = -bus_method_call_with_reply (bus, dest, path,
+org.freedesktop.DBus.Properties, Get,
+reply, NULL,
+DBUS_TYPE_STRING, interface,
+DBUS_TYPE_STRING, property,
+DBUS_TYPE_INVALID);
+if (errno)
+return 0;
+
+if (!dbus_message_iter_init(reply, iter) ||
+dbus_message_iter_get_arg_type(iter) != 
DBUS_TYPE_VARIANT)
+goto fail;
+
+dbus_message_iter_recurse(iter, sub);
+
+if (dbus_message_iter_get_arg_type(sub) != DBUS_TYPE_UINT64)
+goto fail;
+
+dbus_message_iter_get_basic(sub, result);
+
+errno = err;
+return result;
+fail:
+log_error(Failed to parse reply.);
+errno = EIO;
+return 0;
+}
+
+static int compare_unit_time(const void *a, const void *b)
+{
+const struct unit_times *u = a, *v = b;
+
+if (u-time  v-time)
+return -1;
+if (u-time  

[systemd-devel] [PATCH 1/2] Ignore IPv6 link-local addresses

2013-02-04 Thread Eelco Dolstra
Returning IPv6 link-local addresses is a bad idea, because they only
work if an application connects specifically over the corresponding
interface.  So you get errors like:

  $ curl -6 http://my-machine/
  curl: (7) Failed to connect to fe80::d6be:d9ff:fe1b:8477: Invalid argument

To prevent this, this patch filters out link-local addresses.  So if
you don't have a routable IPv6 address, nss-myhostname will fall back
to returning ::1.
---
 src/nss-myhostname/netlink.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/nss-myhostname/netlink.c b/src/nss-myhostname/netlink.c
index 53c3b50..621ca1d 100644
--- a/src/nss-myhostname/netlink.c
+++ b/src/nss-myhostname/netlink.c
@@ -155,6 +155,10 @@ int ifconf_acquire_addresses(struct address **_list, 
unsigned *_n_list) {
 ifaddrmsg-ifa_scope == RT_SCOPE_NOWHERE)
 continue;
 
+if (ifaddrmsg-ifa_family == AF_INET6 
+ifaddrmsg-ifa_scope == RT_SCOPE_LINK)
+continue;
+
 if (ifaddrmsg-ifa_flags  IFA_F_DEPRECATED)
 continue;
 
-- 
1.8.1

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


[systemd-devel] [PATCH 2/2] Fix a segfault in nscd when using nss-myhostname

2013-02-04 Thread Eelco Dolstra
Nscd expects that an NSS module's gethostbyname4_r function returns
its first result in the pre-allocated gaih_addrtuple denoted by **pat.
(See nscd/aicache.c in the Glibc sources.)  However, nss-myhostname
doesn't fill in **pat but allocates the first result in ‘buffer’, then
sets *pat.  So nscd crashes (e.g. when running ‘getent ahosts
my-machine’).

Hard to tell if this is a bug in nscd, since there doesn't seem to be
a proper API spec for gethostbyname4_r.  But in any case, this patch
fixes the crash by copying the first result to **pat.
---
 src/nss-myhostname/nss-myhostname.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/nss-myhostname/nss-myhostname.c 
b/src/nss-myhostname/nss-myhostname.c
index 834a806..b0fb832 100644
--- a/src/nss-myhostname/nss-myhostname.c
+++ b/src/nss-myhostname/nss-myhostname.c
@@ -176,7 +176,11 @@ enum nss_status _nss_myhostname_gethostbyname4_r(
 /* Verify the size matches */
 assert(idx == ms);
 
-*pat = r_tuple_prev;
+/* Nscd expects us to store the first record in **pat. */
+if (*pat)
+**pat = *r_tuple_prev;
+else
+*pat = r_tuple_prev;
 
 if (ttlp)
 *ttlp = 0;
-- 
1.8.1

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


Re: [systemd-devel] [PATCH 1/2] Ignore IPv6 link-local addresses

2013-02-04 Thread Mantas Mikulėnas
On Mon, Feb 4, 2013 at 4:56 PM, Eelco Dolstra
eelco.dols...@logicblox.com wrote:
 Returning IPv6 link-local addresses is a bad idea, because they only
 work if an application connects specifically over the corresponding
 interface.  So you get errors like:

   $ curl -6 http://my-machine/
   curl: (7) Failed to connect to fe80::d6be:d9ff:fe1b:8477: Invalid argument

nss-myhostname actually fills in the scopeid field, so returning
link-local addresses shouldn't cause such problems unless the program
itself handles returned addresses in an unusual way.

The actual problem seems to be elsewhere. I just tested with
getaddrinfo() in Python, and I'm seeing this:

py3.3  from socket import *
py3.3  from pprint import *
py3.3  pprint(getaddrinfo(gethostname(), ssh, AF_UNSPEC, SOCK_STREAM))
[(10, 1, 6, '', ('fe80::4a5d:60ff:fee8:658f%wlan0', 22, 0, 3)),
 (10, 1, 6, '', ('fe80::200:ff:fe51:83f2%vdetap', 22, 0, 4)),
 (10, 1, 6, '', ('fe80::200:ff:fe51:83f2%vmbr', 22, 0, 5)),
 (10, 1, 6, '', ('2001:470:1f0b:915:35eb:7f4c:a08a:2899%3', 22, 0, 3)),
 (10, 1, 6, '', ('2001:470:1f0b:915:4a5d:60ff:fee8:658f%3', 22, 0, 3)),
 (10, 1, 6, '', ('2001:470:736c:107::1%5', 22, 0, 5)),
 (2, 1, 6, '', ('192.168.1.183', 22)),
 (2, 1, 6, '', ('10.7.0.1', 22))]
py3.3  pprint(getaddrinfo(gethostname(), ssh, AF_INET6, SOCK_STREAM))
[(10, 1, 6, '', ('2001:470:1f0b:915:35eb:7f4c:a08a:2899', 22, 0, 0)),
 (10, 1, 6, '', ('2001:470:1f0b:915:4a5d:60ff:fee8:658f', 22, 0, 0)),
 (10, 1, 6, '', ('2001:470:736c:107::1', 22, 0, 0)),
 (10, 1, 6, '', ('fe80::4a5d:60ff:fee8:658f', 22, 0, 0)),
 (10, 1, 6, '', ('fe80::200:ff:fe51:83f2', 22, 0, 0)),
 (10, 1, 6, '', ('fe80::200:ff:fe51:83f2', 22, 0, 0))]

In other words, the scope ID is filled in correctly when I request
AF_UNSPEC, but it's empty for AF_INET6. I'm not sure which component
is broken here, but maybe it would be better to try to fix this,
instead of hurrying to ignore all link-local addresses? I'm not a dev
though.

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


Re: [systemd-devel] [PATCH 1/2] Ignore IPv6 link-local addresses

2013-02-04 Thread Zbigniew Jędrzejewski-Szmek
On Mon, Feb 04, 2013 at 03:56:25PM +0100, Eelco Dolstra wrote:
 Returning IPv6 link-local addresses is a bad idea, because they only
 work if an application connects specifically over the corresponding
 interface.
Isn't this a responsibility of the application to deal with that?

 So you get errors like:
 
   $ curl -6 http://my-machine/
   curl: (7) Failed to connect to fe80::d6be:d9ff:fe1b:8477: Invalid argument
$ hostnamectl set-hostname bupkis-tmp
$ curl -6v bupkis-tmp
* About to connect() to bupkis-tmp port 80 (#0)
*   Trying fe80::a60:6eff:fe00:6241...
* Connection refused
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host

So here everything is working as expected (I don't have an http server).

Zbyszek

 To prevent this, this patch filters out link-local addresses.  So if
 you don't have a routable IPv6 address, nss-myhostname will fall back
 to returning ::1.
 ---
  src/nss-myhostname/netlink.c | 4 
  1 file changed, 4 insertions(+)
 
 diff --git a/src/nss-myhostname/netlink.c b/src/nss-myhostname/netlink.c
 index 53c3b50..621ca1d 100644
 --- a/src/nss-myhostname/netlink.c
 +++ b/src/nss-myhostname/netlink.c
 @@ -155,6 +155,10 @@ int ifconf_acquire_addresses(struct address **_list, 
 unsigned *_n_list) {
  ifaddrmsg-ifa_scope == RT_SCOPE_NOWHERE)
  continue;
  
 +if (ifaddrmsg-ifa_family == AF_INET6 
 +ifaddrmsg-ifa_scope == RT_SCOPE_LINK)
 +continue;
 +
  if (ifaddrmsg-ifa_flags  IFA_F_DEPRECATED)
  continue;
  
 -- 
 1.8.1
 
 ___
 systemd-devel mailing list
 systemd-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/systemd-devel
 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 1/2] core: keep mountinfo .mounts until late shutdown

2013-02-04 Thread Frederic Crozat
Le lundi 04 février 2013 à 16:23 +0100, Zbigniew Jędrzejewski-Szmek a
écrit :
 Hi,
 
 On Mon, Feb 04, 2013 at 03:03:59PM +0100, Umut Tezduyar wrote:
  Downside of this patch is, mountinfo mounts stick around as inactive-dead
  even when the file system they represent is unmounted.
  
  
  On Mon, Feb 4, 2013 at 3:00 PM, Umut Tezduyar u...@tezduyar.com wrote:
  
   .mount units coming from /proc/self/mountinfo file are
   unmounted after local-fs.target is reached during shutdown.
  
   Problem: .mount units popping up in mountinfo file are
   added to systemd without any dependency. For that reason,
 Hm, what do you mean exactly by that? Mount units I see have dependencies
 on mount points higher in the hierarchy. E.g.
 Requires=systemd-journald.socket -.mount home.mount
 After=systemd-journald.socket -.mount home.mount
 Description=/home/zbyszek/debian-x32/home
 SourcePath=/proc/self/mountinfo
 
   they are the first one to be unmounted during shutdown.
 This seems correct. Usually they were mounted last, by an admin,
 and should be unmounted first.

There was a bug in v44 where some mount points mounted by initscripts
(for instance /var/lib/nfs/rpc_pipefs in nfs initscript) which was
unmounted before initscripts were stopped but it was fixed during the
rewrite done for fstab-generator (I've extracted it as
https://build.opensuse.org/package/view_file?expand=1file=fix-umount-order-at-shutdown.patchpackage=systemd.openSUSE_12.2_Updateproject=home%3Afcrozat%3Abranches%3AopenSUSE%3A12.2%3AUpdate
 )

-- 
Frederic Crozat fcro...@suse.com
SUSE

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


Re: [systemd-devel] [PATCH 1/2] Ignore IPv6 link-local addresses

2013-02-04 Thread Eelco Dolstra
Hi,

On 04/02/13 16:36, Mantas Mikulėnas wrote:

 In other words, the scope ID is filled in correctly when I request
 AF_UNSPEC, but it's empty for AF_INET6. 

Hm, interesting.  I see now that curl without -6 does connect correctly to the
link-local address, so the failure with -6 is probably caused by this.  There
was a Glibc bug about this:

  http://sourceware.org/bugzilla/show_bug.cgi?id=12714

However, even with Glibc 2.17 (which should have the patch provided there),
getaddrinfo() with AF_INET6 still returns a zero scopeid.

Will investigate further...

-- 
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 3/3] coredump: make use of the cleanup macros

2013-02-04 Thread Zbigniew Jędrzejewski-Szmek
On Mon, Feb 04, 2013 at 03:13:25PM +0100, Mirco Tischler wrote:
 ---
  src/journal/coredump.c | 28 ++--
  1 file changed, 6 insertions(+), 22 deletions(-)
 
 diff --git a/src/journal/coredump.c b/src/journal/coredump.c
 index 91528d3..4f79c45 100644
 --- a/src/journal/coredump.c
 +++ b/src/journal/coredump.c
 @@ -32,6 +32,7 @@
  
  #include log.h
  #include util.h
 +#include macro.h
  #include mkdir.h
  #include special.h
  #include cgroup-util.h
 @@ -49,7 +50,7 @@ enum {
  };
  
  static int divert_coredump(void) {
 -FILE *f;
 +_cleanup_fclose_ FILE *f = NULL;
  int r;
  
  log_info(Detected coredump of the journal daemon itself, diverting 
 coredump to /var/lib/systemd/coredump/.);
 @@ -94,21 +95,20 @@ static int divert_coredump(void) {
  }
  
  finish:
 -fclose(f);
  return r;
  }
  
Hi,
if you do that, than you can go one step further, and get rid of
finish label. We don't enforce a single point of return, and it
is easier to read 'return -errno' instead of 'r = -errno; ...; return r;'.

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


Re: [systemd-devel] python - reading the journal

2013-02-04 Thread Steven Hiscocks

On 04/02/13 05:13, David Strauss wrote:

I second the interest in committing this to the existing Python
support once polished.

On Sun, Feb 3, 2013 at 6:07 PM, Zbigniew Jędrzejewski-Szmek
zbys...@in.waw.pl wrote:

On Sun, Feb 03, 2013 at 09:18:28PM +, Steven Hiscocks wrote:

Hi,

I've been developing a python module for accessing the journal,
using the journal API. (https://github.com/kwirk/pyjournalctl)

Great! Have you thought about including it in the systemd repo,
once interface nad implementation is stabilized?


One issue I've had is with 'sd_journal_seek_monotonic_usec'. When
called, followed by call to 'sd_journal_next', I end up at the start
of the journal.
If I set a match for _BOOT_ID , before (or after) the call to
'sd_journal_seek_monotonic_usec' (with same _BOOT_ID), it then
behaves as I would expect and returns the closest log entry to the
monotonic time stamp.

I was wondering if this is this the intended behaviour, or is this a bug?

Looking at the docs, it seems OK. Without _BOOT_ID the behaviour
is unspecified.

Some comments about the API:

journal.add_match(PRIORITY, 5)

Why not journal.add_match(PRIORITY=5) ?

Likewise journal.add_matches({PRIORITY: 5, _PID: 1})
could be written as journal.add_matches(PRIORITY=5, _PID=1).
This would mirror the journal API which is part of the python-systemd
module.

Note: systemd.journal already has LOG_EMERG and friends (imported
from syslog), so there's no need to use plain numbers.

Your object-oriented approach, python 2/3 compatiblity, GIL releasing
support are great. I would definitely want to pull this into the
python-systemd.

Zbyszek






Thanks both for the positive feedback.

So if I understand correctly, a _BOOT_ID match must be in place for 
sd_journal_seek_monotonic_usec to function correctly?


It would be great for it too be included in the systemd repo! I'll look 
at making the suggested changes. I think that using keyword arguments 
will make add_matches redundant, so I'll probably drop that and just 
have the add_match method.


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


Re: [systemd-devel] [bug] (char*)NULL should be used in variadic functions

2013-02-04 Thread Lennart Poettering
On Mon, 04.02.13 11:37, Michał Bartoszkiewicz (mbartoszkiew...@gmail.com) wrote:

 
 On Mon, Feb 4, 2013 at 11:15 AM, Lennart Poettering
 lenn...@poettering.net wrote:
  We actually care about readability of the sources and non-Linux systems
  are out-of-focus for us. Can you tell me which Linux system has
  sizeof(void*) != sizeof(char*)? Otherwise, I only see this as pointless
  excercise of making our sources less readable...
 
  Or am I missing something here?
 
 I believe it is legal (but glibc doesn't seem to do it) to define NULL
 simply as 0, so sizeof NULL == sizeof(int), which can be different
 from sizeof(void*).

Be that as it may, for us only Linux is relevant, and that implies glibc
(or some other implementation of libc that implements the very same
interfaces.)

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] SSL for gatewayd

2013-02-04 Thread Colin Guthrie
'Twas brillig, and Zbigniew Jędrzejewski-Szmek at 16/01/13 20:55 did
gyre and gimble:
 On Wed, Jan 16, 2013 at 09:33:22PM +0100, Holger Winkelmann wrote:
 Can't speak from person experience, but my team has worked with the libevent 
 and
 libev libraries which contain http libraries as well.
 IIUC, libev uses libevent code for HTTP through a compatibility
 layer. libevent has only very basic functionality. E.g. I couldn't
 see a mention of POST requests anywhere. libmicrohttpd at least
 abstracts this to the point where I only have to provide a callback
 to consume buffers with data.
 
 Also, libevent/libev are about abstracting event loops. Since journald
 is linux only, this extra abstraction layer is not very useful.

Whist having next to zero experience of libevent, I happened to attend a
talk at FOSDEM which mentioned patches to support SSL which is used by
Facebook to power their HipHop PHP system (i.e. it bypasses apache and
just accepts connections directly).

See here for the patch details:
https://github.com/facebook/hiphop-php
and the patch in question:
https://github.com/facebook/hiphop-php/blob/master/src/third_party/libevent-1.4.14.fb-changes.diff

Looking over it now a little, I'm not actually sure it's related to SSL
after all, but rather a bit more about exposing the fd (thus perhaps
helping to integrate it a bit easier) and also some async stuff which is
also presumably a good thing.

Anyway, just thought I'd share in case it's useful.

Cheers

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH][V3] systemd-analyze: rewrite in C.

2013-02-04 Thread Simon Peeters
Written by Peeters Simon peeters.si...@gmail.com. Makefile stuff
and cleaned up a bit by Auke Kok auke-jan.h@intel.com.
---

Fixed some stuff and dit some more cleanup.

This should just cover the same usage as the old systemd-analyze, but we can
add more functionality afterwards (systemctl dot, other output formats,...)

This is the rebased version as asked by William.


 Makefile.am|  21 +-
 src/analyze/systemd-analyze.c  | 575 +
 src/analyze/systemd-analyze.in | 328 ---
 3 files changed, 585 insertions(+), 339 deletions(-)
 create mode 100644 src/analyze/systemd-analyze.c
 delete mode 100755 src/analyze/systemd-analyze.in

diff --git a/Makefile.am b/Makefile.am
index 88662c0..f3ab908 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -268,7 +268,8 @@ rootbin_PROGRAMS = \
systemd-ask-password \
systemd-tty-ask-password-agent \
systemd-tmpfiles \
-   systemd-machine-id-setup
+   systemd-machine-id-setup \
+   systemd-analyze
 
 bin_PROGRAMS = \
systemd-cgls \
@@ -299,14 +300,16 @@ systemgenerator_PROGRAMS = \
systemd-system-update-generator \
systemd-efi-boot-generator
 
-dist_bin_SCRIPTS = \
-   src/analyze/systemd-analyze
+systemd_analyze_SOURCES = \
+   src/analyze/systemd-analyze.c
 
-EXTRA_DIST += \
-   src/analyze/systemd-analyze.in
+systemd_analyze_CFLAGS = \
+   $(AM_CFLAGS) \
+   $(DBUS_CFLAGS)
 
-CLEANFILES += \
-   src/analyze/systemd-analyze
+systemd_analyze_LDADD = \
+   libsystemd-shared.la \
+   libsystemd-dbus.la
 
 dist_bashcompletion_DATA = \
shell-completion/systemd-bash-completion.sh
@@ -3855,10 +3858,6 @@ src/%.policy.in: src/%.policy.in.in Makefile
$(SED_PROCESS)
$(AM_V_GEN)chmod +x $@
 
-src/analyze/systemd-analyze: %: %.in Makefile
-   $(SED_PROCESS)
-   $(AM_V_GEN)chmod +x $@
-
 src/%.c: src/%.gperf
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GPERF)$(GPERF)  $  $@
diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c
new file mode 100644
index 000..8aaf238
--- /dev/null
+++ b/src/analyze/systemd-analyze.c
@@ -0,0 +1,575 @@
+#include stdio.h
+#include stdlib.h
+#include getopt.h
+#include locale.h
+
+#include install.h
+#include log.h
+#include dbus-common.h
+#include build.h
+#include util.h
+
+#define svg(...) printf(__VA_ARGS__)
+#define svg_bar(class, begin, end) \
+svg(  rect class=\%s\ x=\%.03f\ y=\%.03f\ width=\%.03f\ 
height=\%.03f\ /\n, \
+(class), \
+scale_x * (begin) * 0.01, scale_y * barcount, \
+scale_x * ((end) - (begin)) * 0.01, scale_y - 1.0)
+#define svg_text_nl(begin, format, ...) \
+svg(  text x=\%.03f\ y=\%.03f\format/text\n, \
+scale_x * (begin) * 0.01 + 5.0, \
+(scale_y * barcount++) + 14.0, ## __VA_ARGS__)
+#define svg_bar_text_nl(class, begin, end, text_format, ...) do { \
+svg_bar(class, begin, end); \
+svg_text_nl(begin, text_format, ## __VA_ARGS__); \
+}while (false)
+
+static UnitFileScope arg_scope = UNIT_FILE_SYSTEM;
+
+double scale_x = 100.0;
+double scale_y = 20.0;
+
+static int barcount = 0;
+
+struct boot_times {
+uint64_t firmware_time;
+uint64_t loader_time;
+uint64_t kernel_time;
+uint64_t kernel_done_time;
+uint64_t initrd_time;
+uint64_t userspace_time;
+uint64_t finish_time;
+};
+struct unit_times {
+char *name;
+uint64_t ixt;
+uint64_t iet;
+uint64_t axt;
+uint64_t aet;
+uint64_t time;
+};
+
+static uint64_t property_getu64(
+DBusConnection *bus,
+const char *dest,
+const char *path,
+const char *interface,
+const char *property)
+{
+int err = errno; //back up errno to prevent accidentally setting it.
+_cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
+DBusMessageIter iter, sub;
+uint64_t result = 0;
+
+errno = -bus_method_call_with_reply (bus, dest, path,
+org.freedesktop.DBus.Properties, Get,
+reply, NULL,
+DBUS_TYPE_STRING, interface,
+DBUS_TYPE_STRING, property,
+DBUS_TYPE_INVALID);
+if (errno)
+return 0;
+
+if (!dbus_message_iter_init(reply, iter) ||
+dbus_message_iter_get_arg_type(iter) != 
DBUS_TYPE_VARIANT)
+goto fail;
+
+dbus_message_iter_recurse(iter, sub);
+
+if (dbus_message_iter_get_arg_type(sub) != DBUS_TYPE_UINT64)
+goto fail;
+
+dbus_message_iter_get_basic(sub, result);
+
+errno = err;
+return result;
+fail:
+log_error(Failed to 

Re: [systemd-devel] systemd should not call KDSKBMODE on a VT with X

2013-02-04 Thread Lennart Poettering
On Sat, 02.02.13 14:17, Arthur Taylor (a...@ified.ca) wrote:

 Hello systemd developers
 
 TL;DR: On a VT which X is running, messing with KDSKBMODE on
 underneath X at best has no affect and at worst breaks keyboard input
 badly. In the short term, systemd should stop calling this ioctl
 because it has no benefit and makes no sense.

It sounds to me we indeed want to set K_UNICODE only if K_OFF (or
something else like it) is currently not set.

However, before we change this, there's one thing that makes me wonder:
what does X11 do on shutdown? Does it put the kbd back to K_UNICODE? Or
back to K_XLATE?

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] man: remove boot up runlevel support

2013-02-04 Thread Lennart Poettering
On Fri, 01.02.13 13:20, Umut Tezduyar (u...@tezduyar.com) wrote:

 As of 3cdebc217c42c8529086f2965319b6a48eaaeabe support for
 distro specific boot up runlevels has been dropped.

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][V3] systemd-analyze: rewrite in C.

2013-02-04 Thread Reindl Harald


Am 04.02.2013 22:33, schrieb Peeters Simon:
 2013/2/4 Lennart Poettering lenn...@poettering.net:
 On Mon, 04.02.13 21:32, Simon Peeters (peeters.si...@gmail.com) wrote:

 Written by Peeters Simon peeters.si...@gmail.com. Makefile stuff
 and cleaned up a bit by Auke Kok auke-jan.h@intel.com.
 ---

 Hmm, how does this relate to this work:

 https://bugzilla.freedesktop.org/show_bug.cgi?id=60112

has an invalid ssl-cert

The certificate is only valid for the following names:
bugs.freedesktop.org , freedesktop.org


why does admins nor users care about such basics?



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


Re: [systemd-devel] [PATCH][V3] systemd-analyze: rewrite in C.

2013-02-04 Thread Marc-Antoine Perennou
On 4 February 2013 22:33, Peeters Simon peeters.si...@gmail.com wrote:

 2013/2/4 Lennart Poettering lenn...@poettering.net:
  On Mon, 04.02.13 21:32, Simon Peeters (peeters.si...@gmail.com) wrote:
 
  Written by Peeters Simon peeters.si...@gmail.com. Makefile stuff
  and cleaned up a bit by Auke Kok auke-jan.h@intel.com.
  ---
 
  Hmm, how does this relate to this work:
 
  https://bugzilla.freedesktop.org/show_bug.cgi?id=60112

 hmm, did not yet see this.

  Can we merge both approaches?

 I will look at it further but my current toughts:
  - the bus_parse_unit_info functions seems a good idea.
  - his bus_get_uint64_property is slightly nicer than mine.
  - it still uses cairo to write the plot which i think is not so nice.
 (since it is overkill for writing svg)
  - it seems like a more literal translation in some places.
  - repeats some bugs that were in the original python version but
 fixed in my version.
  - it does not print bars for firmware and loader into the svg output.
  - it prints more informational text on the svg.
  - quiet unfortunate that these patches did not end up on the mailing list.
 (and apparently the poster did not see my patches on the list either)

 so I propose I try to merge the best of both patch-sets.

 any other comments with regards to this?



I indeed did not see your patches, unfortunately. I did not think about the
mailing list for that, my mistake.

It is indeed a quite literal translation for the most of it. I like better
your svg approach getting rid of cairo.

Feel free to merge both patch-sets and to yell at me if you need some help
to do so.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH][V3] systemd-analyze: rewrite in C.

2013-02-04 Thread Kok, Auke-jan H
On Mon, Feb 4, 2013 at 1:33 PM, Peeters Simon peeters.si...@gmail.com wrote:
 2013/2/4 Lennart Poettering lenn...@poettering.net:
 On Mon, 04.02.13 21:32, Simon Peeters (peeters.si...@gmail.com) wrote:

 Written by Peeters Simon peeters.si...@gmail.com. Makefile stuff
 and cleaned up a bit by Auke Kok auke-jan.h@intel.com.
 ---

 Hmm, how does this relate to this work:

 https://bugzilla.freedesktop.org/show_bug.cgi?id=60112

 hmm, did not yet see this.

 Can we merge both approaches?

 I will look at it further but my current toughts:
  - the bus_parse_unit_info functions seems a good idea.
  - his bus_get_uint64_property is slightly nicer than mine.
  - it still uses cairo to write the plot which i think is not so nice.
 (since it is overkill for writing svg)
  - it seems like a more literal translation in some places.
  - repeats some bugs that were in the original python version but
 fixed in my version.
  - it does not print bars for firmware and loader into the svg output.
  - it prints more informational text on the svg.
  - quiet unfortunate that these patches did not end up on the mailing list.
 (and apparently the poster did not see my patches on the list either)

 so I propose I try to merge the best of both patch-sets.

 any other comments with regards to this?

Simon, please comment on the bugzilla as well.

In general, I'm a bit hesitant to leave the cairo dependency in place
simply because it's not needed to do basic plotting.

The codeflow seems highly comparable - I think there's a lot of
overlap otherwise.

Let's make sure we incorporate the elements we can use from
Marc-Antoine - Marc-Antoine - it would be really helpful if you could
chime in on the list and support a joint effort.

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


Re: [systemd-devel] [PATCH][V3] systemd-analyze: rewrite in C.

2013-02-04 Thread Reindl Harald


Am 04.02.2013 22:47, schrieb Kok:
 On Mon, Feb 4, 2013 at 1:45 PM, Reindl Harald h.rei...@thelounge.net wrote:


 Am 04.02.2013 22:33, schrieb Peeters Simon:
 2013/2/4 Lennart Poettering lenn...@poettering.net:
 On Mon, 04.02.13 21:32, Simon Peeters (peeters.si...@gmail.com) wrote:

 Written by Peeters Simon peeters.si...@gmail.com. Makefile stuff
 and cleaned up a bit by Auke Kok auke-jan.h@intel.com.
 ---

 Hmm, how does this relate to this work:

 https://bugzilla.freedesktop.org/show_bug.cgi?id=60112

 has an invalid ssl-cert

 The certificate is only valid for the following names:
 bugs.freedesktop.org , freedesktop.org


 why does admins nor users care about such basics?
 
 ironically, posting a bug to bugzilla.freedesktop.org is the right way
 to get this fixed :^)

no - posting to https://bugs.freedesktop.org/ would not force
to blindly ignore SSL warings and train people to whatever, OK




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


Re: [systemd-devel] build failures in latest master from d848b9cbfa0ba72381363accce481600169df2eb

2013-02-04 Thread Zbigniew Jędrzejewski-Szmek
On Mon, Feb 04, 2013 at 01:54:56PM -0800, Kok, Auke-jan H wrote:
 On Thu, Jan 31, 2013 at 7:29 AM, Colin Walters walt...@verbum.org wrote:
  Ok, here's a first patch that helps my build:
 
 as of today I need this patch to make my compiles (source-based
 distro) actully succeed, otherwise `systemd-cat` fails to CCLD:
 
 /home/sofar/git/z/systemd/.libs/libudev.so: undefined reference to
 `sd_id128_get_machine'
 /home/sofar/git/z/systemd/.libs/libudev.so: undefined reference to
 `sd_id128_to_string'
 /home/sofar/git/z/systemd/.libs/libudev.so: undefined reference to
 `sd_id128_get_boot'
 collect2: ld returned 1 exit status
 
 this was a completely clean git checkout with no cruft left behind.
This is on arch, right? I'll try to have a look.

I don't see anything like that on clean v197-247-g4f19b1d. CCLD runs
without trouble [1], and the resulting binary doesn't use libudev.so [2].

Zbyszek

[1]
$ make V=1 systemd-cat
/bin/sh ./libtool  --tag=CC   --mode=link ccache gcc -std=gnu99 -pipe -Wall 
-Wextra -Wno-inline -Wundef -Wformat=2 -Wformat-security -Wformat-nonliteral 
-Wlogical-op -Wsign-compare -Wmissing-include-dirs -Wold-style-definition 
-Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal 
-Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls 
-Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align 
-Wstrict-aliasing=2 -Wwrite-strings -Wno-long-long -Wno-overlength-strings 
-Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result 
-Werror=overflow -ffast-math -fno-common -fdiagnostics-show-option 
-fno-strict-aliasing -fvisibility=hidden -ffunction-sections -fdata-sections 
-fstack-protector --param=ssp-buffer-size=4 -g -O0 -Wl,--as-needed 
-Wl,--gc-sections -Wl,-z,relro -Wl,-z,now  -o systemd-cat src/journal/cat.o 
libsystemd-shared.la libsystemd-journal-internal.la -ldl -lrt 
libtool: link: ccache gcc -std=gnu99 -pipe -Wall -Wextra -Wno-inline -Wundef 
-Wformat=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wsign-compare 
-Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self 
-Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes 
-Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn 
-Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing=2 -Wwrite-strings 
-Wno-long-long -Wno-overlength-strings -Wno-unused-parameter 
-Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -ffast-math 
-fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden 
-ffunction-sections -fdata-sections -fstack-protector --param=ssp-buffer-size=4 
-g -O0 -Wl,--as-needed -Wl,--gc-sections -Wl,-z -Wl,relro -Wl,-z -Wl,now -o 
.libs/systemd-cat src/journal/cat.o  ./.libs/libsystemd-shared.a 
./.libs/libsystemd-journal-internal.a -lcap /tmp/systemd/.libs/libudev.so 
/tmp/systemd/.libs/libsystemd
 -daemon.so -lselinux -lacl -llzma -lgcrypt -lgpg-error -ldl -lrt -Wl,-rpath 
-Wl,/var/tmp/inst1/usr/lib

[2]
$ ldd .libs/systemd-cat
  linux-vdso.so.1 =  (0x7fff087e8000)
  librt.so.1 = /lib64/librt.so.1 (0x00313c60)
  libc.so.6 = /lib64/libc.so.6 (0x00313ba0)
  /lib64/ld-linux-x86-64.so.2 (0x00313b20)
  libpthread.so.0 = /lib64/libpthread.so.0 (0x00313be0)
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] python - reading the journal

2013-02-04 Thread Steven Hiscocks

On 04/02/13 18:30, Steven Hiscocks wrote:

On 04/02/13 05:13, David Strauss wrote:

I second the interest in committing this to the existing Python
support once polished.

On Sun, Feb 3, 2013 at 6:07 PM, Zbigniew Jędrzejewski-Szmek
zbys...@in.waw.pl wrote:

On Sun, Feb 03, 2013 at 09:18:28PM +, Steven Hiscocks wrote:

Hi,

I've been developing a python module for accessing the journal,
using the journal API. (https://github.com/kwirk/pyjournalctl)

Great! Have you thought about including it in the systemd repo,
once interface nad implementation is stabilized?


One issue I've had is with 'sd_journal_seek_monotonic_usec'. When
called, followed by call to 'sd_journal_next', I end up at the start
of the journal.
If I set a match for _BOOT_ID , before (or after) the call to
'sd_journal_seek_monotonic_usec' (with same _BOOT_ID), it then
behaves as I would expect and returns the closest log entry to the
monotonic time stamp.

I was wondering if this is this the intended behaviour, or is this a
bug?

Looking at the docs, it seems OK. Without _BOOT_ID the behaviour
is unspecified.

Some comments about the API:

journal.add_match(PRIORITY, 5)

Why not journal.add_match(PRIORITY=5) ?

Likewise journal.add_matches({PRIORITY: 5, _PID: 1})
could be written as journal.add_matches(PRIORITY=5, _PID=1).
This would mirror the journal API which is part of the python-systemd
module.

Note: systemd.journal already has LOG_EMERG and friends (imported
from syslog), so there's no need to use plain numbers.

Your object-oriented approach, python 2/3 compatiblity, GIL releasing
support are great. I would definitely want to pull this into the
python-systemd.

Zbyszek






Thanks both for the positive feedback.

So if I understand correctly, a _BOOT_ID match must be in place for
sd_journal_seek_monotonic_usec to function correctly?

It would be great for it too be included in the systemd repo! I'll look
at making the suggested changes. I think that using keyword arguments
will make add_matches redundant, so I'll probably drop that and just
have the add_match method.



I've made the suggested changes and pushed it to github. Feedback 
welcomed :)


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


Re: [systemd-devel] Feature request: schedule jobs for last day of month

2013-02-04 Thread Lennart Poettering
On Thu, 31.01.13 00:07, Dave (d...@flex.com.au) wrote:

  Hi.  I'm not on the maillist, but I recently read that systemd was planning
 to introduce an integrated job scheduler, if it isn't done already.
 
  If so, then it would be very handy to introduce a way to run scheduled jobs
 at the end of the month.  It's something of a pet peeve I have with cron,
 that it can't natively do this.
 
  I can work around it, but it's not pretty, and I'd much prefer a native
 solution.  I thought I'd throw the suggestion here as a good idea for the
 new scheduler.

This definitely sounds useful. We should certainly extend our syntax to
support this, and the code for it wouldn't even be that difficult.

However: we'd first have to come up with a nice syntax for it. I'd
assume we probably want to allow not only the last day of the month, but
any day counted from the end of the month. It would appear natural to
use negative numbers for that, so that 5 is the fifth day, and -5
the day five days before the end of the month. However, the dash is
already used to separate the day from the month, so that would look a
little awkward.

Suggestions what we could do instead?

2012-02-:4 maybe?

2012-02-~4?

2012-02-^4?

2012-02-$4?

Other suggestions?

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] build failures in latest master from d848b9cbfa0ba72381363accce481600169df2eb

2013-02-04 Thread Kok, Auke-jan H
On Mon, Feb 4, 2013 at 2:14 PM, Zbigniew Jędrzejewski-Szmek
zbys...@in.waw.pl wrote:
 On Mon, Feb 04, 2013 at 01:54:56PM -0800, Kok, Auke-jan H wrote:
 On Thu, Jan 31, 2013 at 7:29 AM, Colin Walters walt...@verbum.org wrote:
  Ok, here's a first patch that helps my build:

 as of today I need this patch to make my compiles (source-based
 distro) actully succeed, otherwise `systemd-cat` fails to CCLD:

 /home/sofar/git/z/systemd/.libs/libudev.so: undefined reference to
 `sd_id128_get_machine'
 /home/sofar/git/z/systemd/.libs/libudev.so: undefined reference to
 `sd_id128_to_string'
 /home/sofar/git/z/systemd/.libs/libudev.so: undefined reference to
 `sd_id128_get_boot'
 collect2: ld returned 1 exit status

 this was a completely clean git checkout with no cruft left behind.
 This is on arch, right? I'll try to have a look.

nope, I've never used arch linux in my life, although it's probably
the same symptom as one would have on any of the source distro's.

 I don't see anything like that on clean v197-247-g4f19b1d. CCLD runs
 without trouble [1], and the resulting binary doesn't use libudev.so [2].

 Zbyszek

 [1]
 $ make V=1 systemd-cat
 /bin/sh ./libtool  --tag=CC   --mode=link ccache gcc -std=gnu99 -pipe -Wall 
 -Wextra -Wno-inline -Wundef -Wformat=2 -Wformat-security -Wformat-nonliteral 
 -Wlogical-op -Wsign-compare -Wmissing-include-dirs -Wold-style-definition 
 -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal 
 -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls 
 -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels 
 -Wcast-align -Wstrict-aliasing=2 -Wwrite-strings -Wno-long-long 
 -Wno-overlength-strings -Wno-unused-parameter -Wno-missing-field-initializers 
 -Wno-unused-result -Werror=overflow -ffast-math -fno-common 
 -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden 
 -ffunction-sections -fdata-sections -fstack-protector 
 --param=ssp-buffer-size=4 -g -O0 -Wl,--as-needed -Wl,--gc-sections 
 -Wl,-z,relro -Wl,-z,now  -o systemd-cat src/journal/cat.o 
 libsystemd-shared.la libsystemd-journal-internal.la -ldl -lrt
 libtool: link: ccache gcc -std=gnu99 -pipe -Wall -Wextra -Wno-inline -Wundef 
 -Wformat=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wsign-compare 
 -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self 
 -Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes 
 -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations 
 -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing=2 
 -Wwrite-strings -Wno-long-long -Wno-overlength-strings -Wno-unused-parameter 
 -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow 
 -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing 
 -fvisibility=hidden -ffunction-sections -fdata-sections -fstack-protector 
 --param=ssp-buffer-size=4 -g -O0 -Wl,--as-needed -Wl,--gc-sections -Wl,-z 
 -Wl,relro -Wl,-z -Wl,now -o .libs/systemd-cat src/journal/cat.o  
 ./.libs/libsystemd-shared.a ./.libs/libsystemd-journal-internal.a -lcap 
 /tmp/systemd/.libs/libudev.so /tmp/systemd/.libs/libsystemd-daemon.so 
 -lselinux -lacl -llzma -lgcrypt -lgpg-error -ldl -lrt -Wl,-rpath 
 -Wl,/var/tmp/inst1/usr/lib

 [2]
 $ ldd .libs/systemd-cat
   linux-vdso.so.1 =  (0x7fff087e8000)
   librt.so.1 = /lib64/librt.so.1 (0x00313c60)
   libc.so.6 = /lib64/libc.so.6 (0x00313ba0)
   /lib64/ld-linux-x86-64.so.2 (0x00313b20)
   libpthread.so.0 = /lib64/libpthread.so.0 (0x00313be0)

ok, somehow it's now throwing it for test-udev:

$ make V=1
make --no-print-directory all-recursive
Making all in .
/bin/sh ./libtool  --tag=CC   --mode=link gcc -std=gnu99 -pipe -Wall
-Wextra -Wno-inline -Wundef -Wformat=2 -Wformat-security
-Wformat-nonliteral -Wlogical-op -Wsign-compare -Wmissing-include-dirs
-Wold-style-definition -Wpointer-arith -Winit-self
-Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes
-Wstrict-prototypes -Wredundant-decls -Wmissing-declarations
-Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align
-Wstrict-aliasing=2 -Wwrite-strings -Wno-long-long
-Wno-overlength-strings -Wno-unused-parameter
-Wno-missing-field-initializers -Wno-unused-result -Werror=overflow
-ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing
-fvisibility=hidden -ffunction-sections -fdata-sections
-fstack-protector --param=ssp-buffer-size=4 -g -O2 -Wl,--as-needed
-Wl,--gc-sections -Wl,-z,relro -Wl,-z,now  -o test-libudev
src/test/test-libudev.o libsystemd-label.la libsystemd-shared.la
libudev.la -ldl -lrt
libtool: link: gcc -std=gnu99 -pipe -Wall -Wextra -Wno-inline -Wundef
-Wformat=2 -Wformat-security -Wformat-nonliteral -Wlogical-op
-Wsign-compare -Wmissing-include-dirs -Wold-style-definition
-Wpointer-arith -Winit-self -Wdeclaration-after-statement
-Wfloat-equal -Wmissing-prototypes -Wstrict-prototypes
-Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow
-Wendif-labels -Wcast-align 

Re: [systemd-devel] [PATCH][V3] systemd-analyze: rewrite in C.

2013-02-04 Thread William Giokas
On Mon, Feb 04, 2013 at 09:32:33PM +0100, Simon Peeters wrote:
 Written by Peeters Simon peeters.si...@gmail.com. Makefile stuff
 and cleaned up a bit by Auke Kok auke-jan.h@intel.com.
 ---
 
 Fixed some stuff and dit some more cleanup.
 
 This should just cover the same usage as the old systemd-analyze, but we can
 add more functionality afterwards (systemctl dot, other output formats,...)
 
 This is the rebased version as asked by William.
Thanks! It applied cleanly. Just a comment in the analyze_plot fucntion.
Previously I mentioned that really short boot times make plots that are
too small to really read anything, and I kept getting graphs that were
trunctated and short, basically telling me how long the kernel took to
get ready and maybe the initrd. I thought this was fixed seeing this
patch[1], but then I realized that width is not even used in the svg, it
re-calculates the width for some reason here[2]. Just changing that line
to `width,` and everything works as expected. (Otherwise the 800.0 width
or 1000.0 width isn't actually used in the svg)

-SNIP-
 +static int analyze_plot(DBusConnection *bus)
 +{
 +struct unit_times *times;
 +struct boot_times boot;
 +int n, m = 1;
 +double width;
 +
 +n = get_boot_times(bus, boot);
 +if (n)
 +return n;
 +
 +n = acquire_time_data(bus, times);
 +if (n=0)
 +return n;
 +
 +qsort(times, n, sizeof(struct unit_times), compare_unit_start);
 +
 +width = 80 + (scale_x * (boot.firmware_time + boot.finish_time) * 
 0.01);
[1]
 +if (width  800.0)
 +width = 800.0;
 +
 +if (boot.firmware_time  boot.loader_time)
 +m++;
 +if (boot.loader_time) {
 +m++;
 +if (width  1000.0)
 +width = 1000.0;
 +}
 +if (boot.initrd_time)
 +m++;
 +if (boot.kernel_time)
 +m++;
 +
 +for (int i=0; i  n; i++)
 +if (times[i].ixt = boot.userspace_time  times[i].ixt = 
 boot.finish_time)
 +m++;
 +
 +svg(?xml version=\1.0\ standalone=\no\?\n);
 +svg(!DOCTYPE svg PUBLIC \-//W3C//DTD SVG 1.1//EN\ );
 +svg(\http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\;\n);
 +
 +svg(svg width=\%.0fpx\ height=\%.0fpx\ version=\1.1\ ,
[2]
 +80.0 + (scale_x * (boot.firmware_time + 
 boot.finish_time) * 0.01),
 +150.0 + (m *scale_y));
 +svg(xmlns=\http://www.w3.org/2000/svg\;\n\n);
 +
 +/* write some basic info as a comment, including some help */
 +svg(!-- This file is a systemd-analyze SVG file. It is best 
 rendered in a   --\n
 +!-- browser such as Chrome/Chromium, firefox. Other 
 applications that   --\n
 +!-- render these files properly but much more slow are 
 ImageMagick, --\n
 +!-- gimp, inkscape, etc.. To display the files on your system, 
 just --\n
 +!-- point your browser to file:///var/log/ and click.  
  --\n\n
 +!-- this plot was generated by systemd-analyze version 
 %-16.16s --\n\n, VERSION);

Also, this could use a few fixes:
 * Chrome/Chromium, firefox - Chrome, Chromium or Firefox
 * much more slow - much slower
 * this plot was generated - This plot was generated
 * etc.. - etc.

-SNIP-

Thanks,
-- 
William Giokas | KaiSforza
GnuPG Key: 0xE99A7F0F
Fingerprint: F078 CFF2 45E8 1E72 6D5A  8653 CDF5 E7A5 E99A 7F0F


pgpIcMIEvqfiu.pgp
Description: PGP signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH][V3] systemd-analyze: rewrite in C.

2013-02-04 Thread Peeters Simon
2013/2/5 William Giokas 1007...@gmail.com:
 Thanks! It applied cleanly. Just a comment in the analyze_plot fucntion.
 Previously I mentioned that really short boot times make plots that are
 too small to really read anything, and I kept getting graphs that were
 trunctated and short, basically telling me how long the kernel took to
 get ready and maybe the initrd. I thought this was fixed seeing this
 patch[1], but then I realized that width is not even used in the svg, it
 re-calculates the width for some reason here[2]. Just changing that line
 to `width,` and everything works as expected. (Otherwise the 800.0 width
 or 1000.0 width isn't actually used in the svg)
thanks, i missed that when trying to fix your bug, will fix it in the
next iteration.

-SNIP-
 +/* write some basic info as a comment, including some help */
 +svg(!-- This file is a systemd-analyze SVG file. It is best 
 rendered in a   --\n
 +!-- browser such as Chrome/Chromium, firefox. Other 
 applications that   --\n
 +!-- render these files properly but much more slow are 
 ImageMagick, --\n
 +!-- gimp, inkscape, etc.. To display the files on your 
 system, just --\n
 +!-- point your browser to file:///var/log/ and click. 
   --\n\n
 +!-- this plot was generated by systemd-analyze version 
 %-16.16s --\n\n, VERSION);

 Also, this could use a few fixes:
  * Chrome/Chromium, firefox - Chrome, Chromium or Firefox
  * much more slow - much slower
  * this plot was generated - This plot was generated
  * etc.. - etc.
this should also be fixed in systemd-bootchart since this block is
mostly copied from there.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Feature request: schedule jobs for last day of month

2013-02-04 Thread Zbigniew Jędrzejewski-Szmek
On Mon, Feb 04, 2013 at 11:47:05PM +0100, Lennart Poettering wrote:
 On Thu, 31.01.13 00:07, Dave (d...@flex.com.au) wrote:
 
   Hi.  I'm not on the maillist, but I recently read that systemd was planning
  to introduce an integrated job scheduler, if it isn't done already.
  
   If so, then it would be very handy to introduce a way to run scheduled jobs
  at the end of the month.  It's something of a pet peeve I have with cron,
  that it can't natively do this.
  
   I can work around it, but it's not pretty, and I'd much prefer a native
  solution.  I thought I'd throw the suggestion here as a good idea for the
  new scheduler.
 
 This definitely sounds useful. We should certainly extend our syntax to
 support this, and the code for it wouldn't even be that difficult.
 
 However: we'd first have to come up with a nice syntax for it. I'd
 assume we probably want to allow not only the last day of the month, but
 any day counted from the end of the month. It would appear natural to
 use negative numbers for that, so that 5 is the fifth day, and -5
 the day five days before the end of the month. However, the dash is
 already used to separate the day from the month, so that would look a
 little awkward.
 
 Suggestions what we could do instead?
 
 2012-02-:4 maybe?
 
 2012-02-~4?
This one looks nice.

 2012-02-^4?
 
 2012-02-$4?
 
 Other suggestions?
 
 Lennart

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


Re: [systemd-devel] systemd should not call KDSKBMODE on a VT with X

2013-02-04 Thread Kay Sievers
On Sat, Feb 2, 2013 at 11:17 PM, Arthur Taylor a...@ified.ca wrote:

 KDSKBMODE is a virtual console ioctl which changes the current mode
 of the virtual console keyboard for that particular virtual terminal.
 That is, the virtual console keyboard mode, like the keymap, is a
 per-virtual terminal setting which is saved and restored when
 switching virtual terminals.

Are you really sure about this? The keymap seems to be global on my
box. Changing the keymap in any VT changes it for all VTs. VTs only
have a per-VT font here.

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


Re: [systemd-devel] [PATCH 3/3] coredump: make use of the cleanup macros

2013-02-04 Thread Mirco Tischler
2013/2/4 Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl

 On Mon, Feb 04, 2013 at 03:13:25PM +0100, Mirco Tischler wrote:
  ---
   src/journal/coredump.c | 28 ++--
   1 file changed, 6 insertions(+), 22 deletions(-)
 
  diff --git a/src/journal/coredump.c b/src/journal/coredump.c
  index 91528d3..4f79c45 100644
  --- a/src/journal/coredump.c
  +++ b/src/journal/coredump.c
  @@ -32,6 +32,7 @@
 
   #include log.h
   #include util.h
  +#include macro.h
   #include mkdir.h
   #include special.h
   #include cgroup-util.h
  @@ -49,7 +50,7 @@ enum {
   };
 
   static int divert_coredump(void) {
  -FILE *f;
  +_cleanup_fclose_ FILE *f = NULL;
   int r;
 
   log_info(Detected coredump of the journal daemon itself,
 diverting coredump to /var/lib/systemd/coredump/.);
  @@ -94,21 +95,20 @@ static int divert_coredump(void) {
   }
 
   finish:
  -fclose(f);
   return r;
   }
 
 Hi,
 if you do that, than you can go one step further, and get rid of
 finish label. We don't enforce a single point of return, and it
 is easier to read 'return -errno' instead of 'r = -errno; ...; return r;'.

 Zbyszek

Thanks for your comment; new patch following.
I tried the same for main() but return EXIT_FAILURE; all over the place
just looks ugly in my eyes.

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


[systemd-devel] [PATCH] coredump: make use of the cleanup macros

2013-02-04 Thread Mirco Tischler
---
 src/journal/coredump.c | 41 ++---
 1 file changed, 10 insertions(+), 31 deletions(-)

diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index 91528d3..021b4c6 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -32,6 +32,7 @@
 
 #include log.h
 #include util.h
+#include macro.h
 #include mkdir.h
 #include special.h
 #include cgroup-util.h
@@ -49,8 +50,7 @@ enum {
 };
 
 static int divert_coredump(void) {
-FILE *f;
-int r;
+_cleanup_fclose_ FILE *f = NULL;
 
 log_info(Detected coredump of the journal daemon itself, diverting 
coredump to /var/lib/systemd/coredump/.);
 
@@ -70,19 +70,16 @@ static int divert_coredump(void) {
 if (l = 0) {
 if (ferror(f)) {
 log_error(Failed to read coredump: %m);
-r = -errno;
-goto finish;
+return -errno;
 }
 
-r = 0;
 break;
 }
 
 q = fwrite(buffer, 1, l, f);
 if (q != l) {
 log_error(Failed to write coredump: %m);
-r = -errno;
-goto finish;
+return -errno;
 }
 }
 
@@ -90,25 +87,23 @@ static int divert_coredump(void) {
 
 if (ferror(f)) {
 log_error(Failed to write coredump: %m);
-r = -errno;
+return -errno;
 }
 
-finish:
-fclose(f);
-return r;
+return 0;
 }
 
 int main(int argc, char* argv[]) {
 int r, j = 0;
-char *p = NULL;
+_cleanup_free_ char *p = NULL;
 ssize_t n;
 pid_t pid;
 uid_t uid;
 gid_t gid;
 struct iovec iovec[14];
-char *core_pid = NULL, *core_uid = NULL, *core_gid = NULL, 
*core_signal = NULL,
+_cleanup_free_ char *core_pid = NULL, *core_uid = NULL, *core_gid = 
NULL, *core_signal = NULL,
 *core_timestamp = NULL, *core_comm = NULL, *core_exe = NULL, 
*core_unit = NULL,
-*core_session = NULL, *core_message = NULL, *core_cmdline = 
NULL, *t;
+*core_session = NULL, *core_message = NULL, *core_cmdline = 
NULL, *t = NULL;
 
 prctl(PR_SET_DUMPABLE, 0);
 
@@ -143,11 +138,8 @@ int main(int argc, char* argv[]) {
 }
 
 core_unit = strappend(COREDUMP_UNIT=, t);
-free(t);
-} else if (cg_pid_get_user_unit(pid, t) = 0) {
+} else if (cg_pid_get_user_unit(pid, t) = 0)
 core_unit = strappend(COREDUMP_USER_UNIT=, t);
-free(t);
-}
 
 if (core_unit)
 IOVEC_SET_STRING(iovec[j++], core_unit);
@@ -264,18 +256,5 @@ int main(int argc, char* argv[]) {
 log_error(Failed to send coredump: %s, strerror(-r));
 
 finish:
-free(p);
-free(core_pid);
-free(core_uid);
-free(core_gid);
-free(core_signal);
-free(core_timestamp);
-free(core_comm);
-free(core_exe);
-free(core_cmdline);
-free(core_unit);
-free(core_session);
-free(core_message);
-
 return r  0 ? EXIT_FAILURE : EXIT_SUCCESS;
 }
-- 
1.8.1.2

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


Re: [systemd-devel] Feature request: schedule jobs for last day of month

2013-02-04 Thread Larry Baker
On 4 Feb 2013, at 4:20 PM, Zbigniew Jędrzejewski-Szmek wrote:

 Suggestions what we could do instead?
 
 2012-02-:4 maybe?
 
 2012-02-~4?
 This one looks nice.

What about 2012-02~4 (leave off the -)?  Thus, - implies day (days from 
the start) of the month, ~ implies days from the end of the month.

Should both notations have the same 1 base?  That is, *-*-1 is the first 
day of the month.  Is *-*~1 the last day of the month?  Or, is ~ a delta, 
so that *-*~0 is the last day of the month?

Another solution is to have a delta notation: date-time+-delta-time.  
*-1-1-1:00 would mean 23:00 hours on 12/31 of every year.  Likewise, 6 pm 
the last day of each month would be *-*-1-6:00.

 2012-02-^4?
 
 2012-02-$4?
 
 Other suggestions?
 
 Lennart
 
 Zbyszek

Larry Baker
US Geological Survey
650-329-5608
ba...@usgs.gov

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


Re: [systemd-devel] [PATCH] Set StopWhenUnneeded=no, if unit started manually

2013-02-04 Thread Zbigniew Jędrzejewski-Szmek
On Sat, Feb 02, 2013 at 08:40:22PM +0200, Oleksii Shevchuk wrote:
 
 Current one:
  - If StopWhenUnneeded=yes and  RequiredBy=, WantedBy=, BoundBy= empty
Then stop unit.
 The side effect is:
  - If user starts unit, that not wanted by any started target, then unit
will be immediately stopped.
 The problems are:
  - The user can not be sure that the launch of a unit means that it will
be actually started
  - We already have RefuseManualStart=
 
 Patched one:
  - When unit starts, If RequiredBy=, WantedBy=, BoundBy= empty
  Then set StopWhenUnneeded=yes
 The side effect is:
  - User can be sure - the launch of the unit means that it will be
started
  - If unit started when WantedBy=/... unit running, the unit will be stopped
with the parent one
  - If unit started when WantedBy=/... are empty, then unit will not be
stopped even after such units started, unitil it will be actually
stopped.
Hi Oleksii,

thank you for providing this explanation, it provides the rationale
for the patch. Still, I don't know if this change is warranted.
Even without this patch, the unit would be started, and *then* stopped
immediately, so it's not true that the user doesn not know if will be
started. I mean that if someone doesn't want to have the semantics
provided by StopWhenUnneeded=true, maybe they should not set it.

Let's see what others think.

Zbyszek

 Path introduces next changes:
  - unit:
+ Replace stop_when_unneeded field in Unit structure to
  * stop_when_unneeded_unit-- for default value from unit file
  * stop_when_unneeded_runtime -- for runtime value setted up in
  unit_start
+ Decision logic moved to unit_unneeded function
+ Add logic to unit_start
  * When unit starts:
set stop_when_unneeded_runtime=stop_when_unneeded_unit
If unit_unneeded Then set stop_when_unneeded_runtime=no
+ Add unit_stop_when_unneeded_state function, to return actual
  StopWhenUnneeded= state with next logic:
  * For starting and started units return runtime state
  * For other states return default value from StopWhenUnneeded= unit
field
+ For unit_dump use default value from unit file
+ For serialization (daemon-reexec) use runtime value from unit state
  * stop-when-unneeded-runtime serialization field added
  - dbus interface:
+ Add bus_unit_append_stop_when_unneeded function, to return actual
  StopWhenUnneeded= state via unit_stop_when_unneeded_state and use
  it instead of direct u-stop_when_unneeded serialization
 ---
  src/core/dbus-unit.c  | 18 +-
  src/core/load-fragment-gperf.gperf.m4 |  2 +-
  src/core/unit.c   | 67 
 +++
  src/core/unit.h   |  5 ++-
  4 files changed, 75 insertions(+), 17 deletions(-)
 
 diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
 index d1de46a..91b6f4f 100644
 --- a/src/core/dbus-unit.c
 +++ b/src/core/dbus-unit.c
 @@ -202,6 +202,22 @@ static int bus_unit_append_can_stop(DBusMessageIter *i, 
 const char *property, vo
  return 0;
  }
  
 +static int bus_unit_append_stop_when_unneeded(DBusMessageIter *i, const char 
 *property, void *data) {
 +Unit *u = data;
 +dbus_bool_t b;
 +
 +assert(i);
 +assert(property);
 +assert(u);
 +
 +b = unit_stop_when_unneeded_state(u);
 +
 +if (!dbus_message_iter_append_basic(i, DBUS_TYPE_BOOLEAN, b))
 +return -ENOMEM;
 +
 +return 0;
 +}
 +
  static int bus_unit_append_can_reload(DBusMessageIter *i, const char 
 *property, void *data) {
  Unit *u = data;
  dbus_bool_t b;
 @@ -1236,7 +1252,7 @@ const BusProperty bus_unit_properties[] = {
  { CanReload,bus_unit_append_can_reload, b, 0 
 },
  { CanIsolate,   bus_unit_append_can_isolate,b, 0 
 },
  { Job,  bus_unit_append_job, (uo), 0 
 },
 -{ StopWhenUnneeded, bus_property_append_bool,   b, 
 offsetof(Unit, stop_when_unneeded) },
 +{ StopWhenUnneeded, bus_unit_append_stop_when_unneeded, b, 0 
 },
  { RefuseManualStart,bus_property_append_bool,   b, 
 offsetof(Unit, refuse_manual_start)},
  { RefuseManualStop, bus_property_append_bool,   b, 
 offsetof(Unit, refuse_manual_stop) },
  { AllowIsolate, bus_property_append_bool,   b, 
 offsetof(Unit, allow_isolate)  },
 diff --git a/src/core/load-fragment-gperf.gperf.m4 
 b/src/core/load-fragment-gperf.gperf.m4
 index 1783ad0..6fad6c9 100644
 --- a/src/core/load-fragment-gperf.gperf.m4
 +++ b/src/core/load-fragment-gperf.gperf.m4
 @@ -114,7 +114,7 @@ Unit.ReloadPropagatedFrom,   config_parse_unit_deps,  
UNIT_RELOAD
  

Re: [systemd-devel] Feature request: schedule jobs for last day of month

2013-02-04 Thread Dave
 In the year 2013, of the month of February, on the 4th day, Larry Baker wrote:
 What about 2012-02~4 (leave off the -)?  Thus, - implies day (days
 from the start) of the month, ~ implies days from the end of the month.

 Nice.  I like this one.  Simple, neat, and feels right.  The tilde is
significantly different, that I can tell at a glance it's not a standard
date format, yet similar enough that it feels like one.

 
 Should both notations have the same 1 base?  That is, *-*-1 is the
 first day of the month.  Is *-*~1 the last day of the month?  Or, is ~
 a delta, so that *-*~0 is the last day of the month?

 A delta makes sense from a mathematical perspective, but intuitively,
~1 leaps out at me as last-day-of-month, ~2 as second last day, etc.

 Cheers,
 dave.k

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


Re: [systemd-devel] [PATCH] core: reuse the same /tmp and /var/tmp

2013-02-04 Thread Zbigniew Jędrzejewski-Szmek
On Mon, Feb 04, 2013 at 11:58:30AM +, Colin Guthrie wrote:
 [and the crowd goes wild!]
 
 Thanks for this work. I've also had a few bug reports about this one.
 
 'Twas brillig, and Michal Sekletar at 02/02/13 09:10 did gyre and gimble:
  thank you very much for the review, it is very appreciated. I've sent
  out the patch to get a feedback on a general approach, since there are
  no objections to it, I will hack up the rest, inaccessible dirs, man
  page etc...
 
 As a small bit of bikeshedding/feature creep: would it be possible to
 name the directories with a little bit of context in them? e.g. it would
 be great if they could be called systemd-myunit-service-XX.
That would be useful. Probably better as a separate patch.

 There may be valid reasons for not doing this, but when debugging things
 and poking about as root user it might add a little bit of clarity when
 several such folders exist (of course slight obfuscation here may be
 deliberate)
For system units, obfuscation as a security measure is useless here:
the knowledge which units started is public, and units definitions too.
So the extra time required to iterate over directories is unimportant
for an attacker, but annoying for the administrator.
For user units, PrivateTmp doesn't work.

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


Re: [systemd-devel] Feature request: schedule jobs for last day of month

2013-02-04 Thread Frederick Grose
On Mon, Feb 4, 2013 at 8:42 PM, Dave d...@flex.com.au wrote:

  In the year 2013, of the month of February, on the 4th day, Larry Baker
 wrote:
  What about 2012-02~4 (leave off the -)?  Thus, - implies day (days
  from the start) of the month, ~ implies days from the end of the month.

  Nice.  I like this one.  Simple, neat, and feels right.  The tilde is
 significantly different, that I can tell at a glance it's not a standard
 date format, yet similar enough that it feels like one.


  Should both notations have the same 1 base?  That is, *-*-1 is the
  first day of the month.  Is *-*~1 the last day of the month?  Or, is
 ~
  a delta, so that *-*~0 is the last day of the month?

  A delta makes sense from a mathematical perspective, but intuitively,
 ~1 leaps out at me as last-day-of-month, ~2 as second last day, etc.


Like a Bash 0-based array offset: ${array[*]: -1}



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


Re: [systemd-devel] python - reading the journal

2013-02-04 Thread Zbigniew Jędrzejewski-Szmek
Hi,

On Mon, Feb 04, 2013 at 10:42:02PM +, Steven Hiscocks wrote:
 I've made the suggested changes and pushed it to github. Feedback
 welcomed :)
Thanks!

Some more thoughts on the API below. Some of those are probably
stupid, but I want to throw them out in the open, for your feedback.

SD_MESSAGE_* are string constants. Shouldn't they be int constants
like in C? The conversion both ways is pretty simple, but if the
constants were used outside of journal matches it would be nicer
to have them as ints. The downside would be that the user
would have to printf the int to use it in a match. But... see next
point.

It would be nice to expose the rest of sd-id128 API:
sd_id128_to_string(3), sd_id128_randomize(3),
sd_id128_get_machine(3). They would probably go in a separate module
(systemd.id128), since they are useful in writing journal entries too.

 journal.seek_monotonic(int(monotonic.total_seconds()*1E6), bootid)
Python interfaces usually use floating point numbers to mean
seconds. A double has ~16 significant numbers, so the accuracy should
be enough, so I believe the detail that this is microseconds should
be hidden.

It would be better to replace PyRun_String with normal C methods,
but that can be done later.

sd_journal_open_directory is not wrapped, but that can be added
later.

What about renaming Journalctl to Journal? It doesn't really control
anything :)

SD_JOURNAL_LOCAL_ONLY should probably be renamed to LOCAL_ONLY
(SD_JOURNAL_RUNTIME_ONLY, SYSTEM_ONLY likewise). Here namespaceing
will be provided by the module, so there's no need for the long name.

Second argument to .seek(), a documentation only change: it would be
nice to use io.SEEK_SET, io.SEEK_CUR, io.SEEK_END in the description.

Should .query_unique() return a set instead? This would make checking
if an field is present faster, and also underline the fact that those
are non-repeating entries.

Your module will be great for creating a test suite for journal. At the
same time it will also serve as a test suite for the module.

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


Re: [systemd-devel] build failures in latest master from d848b9cbfa0ba72381363accce481600169df2eb

2013-02-04 Thread Zbigniew Jędrzejewski-Szmek
On Thu, Jan 31, 2013 at 07:21:27PM -0500, Colin Walters wrote:
 Using -Wl,--gc-sections helps a lot, but still.  We could just put it in
 a private path like /usr/lib/systemd/libsystemd-shared.so.  
I have been wanting to do something like that for a long while.
I thought it would be much more complicated though, so I left it for later :)

 [a few minutes pass] Something like the attached patch.  But doing it
 against master I'm still running into apparent build race conditions
 where 'make' works, but 'make -j 8' falls over.
Hm, maybe some build-over automatic dependency? I tried a few different
build parallelization settings and it seems to work fine. Looking at the
rules, it should too.

Benchmark (./configure --sysconfdir=/etc --localstatedir=/var 
--with-sysvinit-path= --with-sysvrcnd-path= CFLAGS='-g -O0 
-Wp,-U_FORTIFY_SOURCE' --enable-gtk-doc  make  make install 
DESTDIR=/var/tmp/inst...):

$ du /var/tmp/inst? -cs
28084   /var/tmp/inst
16760   /var/tmp/inst-shared

Biggest changes:
/usr/lib: 19448 - 11868
/usr/bin: 5968 - 2224

So this seems like a big win. What are the downsides?

(One I see immediately: libudev links against libsystemd-shared,
people who only compile udev might not like that.)

Zbyszek

 From 33fdd8c52748208d34da8cb0b5db2dbcfc940fc0 Mon Sep 17 00:00:00 2001
 From: Colin Walters walt...@verbum.org
 Date: Thu, 31 Jan 2013 19:11:46 -0500
 Subject: [PATCH] build-sys: Make libsystemd-shared.so
 
 Previously it was a noinst libtool library, but the library has grown
 enough that it probably makes sense to share the copies in memory.
 Also, linking this way avoids the case of the dynamic - static -
 dynamic dependency chain of:
 libsystemd-journal.so - libsystemd-shared.la - libsystemd-daemon.so.
 
 Signed-off-by: Colin Walters walt...@verbum.org
 ---
  Makefile.am |8 ++--
  1 files changed, 6 insertions(+), 2 deletions(-)
 
 diff --git a/Makefile.am b/Makefile.am
 index 88662c0..f3e1d4c 100644
 --- a/Makefile.am
 +++ b/Makefile.am
 @@ -107,6 +107,8 @@ UNINSTALL_DATA_HOOKS =
  DISTCLEAN_LOCAL_HOOKS =
  pkginclude_HEADERS =
  noinst_LTLIBRARIES =
 +privlibdir = $(pkglibdir)
 +privlib_LTLIBRARIES =
  lib_LTLIBRARIES =
  include_HEADERS =
  pkgconfiglib_DATA =
 @@ -766,7 +768,7 @@ EXTRA_DIST += \
   make-directive-index.py
  
  # 
 --
 -noinst_LTLIBRARIES += \
 +privlib_LTLIBRARIES += \
   libsystemd-shared.la
  
  libsystemd_shared_la_SOURCES = \
 @@ -844,7 +846,9 @@ libsystemd_shared_la_SOURCES = \
   src/shared/calendarspec.h \
   src/shared/output-mode.h
  
 -libsystemd_shared_la_LIBADD = libsystemd-daemon.la
 +libsystemd_shared_la_CFLAGS = $(AM_CFLAGS) -fvisibility=default
 +
 +libsystemd_shared_la_LIBADD = libsystemd-daemon.la 
 libsystemd-id128-internal.la
  
  
 #---
  noinst_LTLIBRARIES += \
 -- 
 1.7.1
 

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