[systemd-devel] FixMe need a coredump HOOK

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Sun Jun 8 06:41:21 PDT 2014


On Sun, Jun 08, 2014 at 08:49:10PM +0800, Leslie Zhai wrote:
> Hi Zbyszek,
> 
> Thanks for your reply :)
> 
> OK, it is enough to collect user space coredump info for bug
> reporter frontend :)

Hi,

if you do polling yourself, sd_journal_wait() is unnecessary and
harmful.

> 1. const char *field, the second parameter of sd_journal_get_data,
> is able to set filter to limit the entries, isn't it?
You need to use two "filters":
- first, you want to only look at journal entries which have
  MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1. You do this by
  using sd_journal_add_match().
- second, once you have an entry of this type, it will usually
  have a COREDUMP= field. You can use sd_journal_get_data() to extract
  it. You already have this part.

> 2. I simply init pollfd struct with fds[0].fd =
> sd_journal_get_fd(m_j) && fds[0].events = sd_journal_get_events(m_j)
> https://github.com/AOSC-Dev/FixMe/blob/master/test/test_systemd_journal.c#L22
> 
> But my systemd_journal testcase print out no such file or directory error
> COREDUMP=ELF
Even if you limit yourself to entries with MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1,
there's no guarantee that COREDUMP= field is attached to each of them.
You have to take this into account.

Zbyszek


More information about the systemd-devel mailing list