Christian Hesse <l...@eworm.de> on Mon, 2014/10/13 23:56: > Christian Hesse <l...@eworm.de> on Mon, 2014/10/13 20:22: > > Daurnimator <q...@daurnimator.com> on Mon, 2014/10/13 01:27: > > > Hi All, > > > > > > I was trying to write a program that tailed the journal, but found that > > > sd_journal_seek_tail() didn't work as expected. > > > That is: that it would seek to the last/most recent thing in the > > > journal, and I could tail things from there. > > > > > > I whipped up a quick demonstration program, that shows that messages I > > > 'next' through, are before the 'cutoff': > > > > > > [code and output] > > > > > > Is this behaviour expected? I'm using systemd 216. > > > > I do see a similar problem in my code [0]. I do call sd_journal_previous() > > after sd_journal_seek_tail(), but I still do see some older message come > > up. > > > > sd_journal_next() is the first I call in while loop. Perhaps even this is > > a problem? > > > > [0] > > https://github.com/eworm-de/journal-notify/blob/master/journal-notify.c > > Looks like I was right. For any reason sd_journal_next() can jump to old > journal entries (even if sd_journal_previous() has been called before). That > happens before sd_journal_wait() is called the first time. > > Sadly I do not know how to reproduce. It happens very seldom and I could not > find the culprit so far.
Actually the problem happens before. I have an old entry selected after calling sd_journal_previous(). Mhh, does adding matches (sd_journal_add_match(), sd_journal_add_conjunction() and sd_journal_add_disjunction()) have an effect to sd_journal_seek_tail() and sd_journal_previous()? Looks like the problem goes away if I seek to tail first, then add my matches. -- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Chris get my mail address: */=0;b=c[a++];) putchar(b-1/(/* gcc -o sig sig.c && ./sig */b/42*2-3)*42);}
signature.asc
Description: PGP signature
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel