Skip to contentSkip to conversation

exit from log_printf()

DISCUSSION Yauheni Kaliuta 2 participants 3 messages Apr 27, 2020 – Apr 29, 2020

lore
Share & tools
lore
#0 lore raw

Hi, Lucas!

I have a question about exit call from tools/log.c:log_printf()
(https://github.com/lucasdemarchi/kmod/blob/master/tools/log.c#L140)

What is the reasoning behind that?

At the first glance it looks a bit incorrect (pretty surprising to have exit in print()).

Discovered while trying to remove several modules when one of them cannod be removed:

$ modprobe -r libata pcspkr       
modprobe: FATAL: Module libata is in use.
$ lsmod | grep pcsp
pcspkr                 16384  0
Signature · 2 lines
WBR,
Yauheni Kaliuta
#1 lore raw
Quoted 10 lines · Yauheni Kaliuta

Hi, Lucas!

I have a question about exit call from tools/log.c:log_printf()
(https://github.com/lucasdemarchi/kmod/blob/master/tools/log.c#L140)

What is the reasoning behind that?

At the first glance it looks a bit incorrect (pretty surprising to have exit in print()).

If we log a critical error, there's nothing we can do except exit. Note that this is only
used by the binaries, not the library.

There's potential for abuse, but it's pretty common to have something with that behavior.

Lucas De Marchi

Quoted 15 lines

Discovered while trying to remove several modules when one of them cannod be removed:

$ modprobe -r libata pcspkr
modprobe: FATAL: Module libata is in use.
$ lsmod | grep pcsp
pcspkr                 16384  0

--
WBR,
Yauheni Kaliuta

Signature · 1 line
Lucas De Marchi
#2 lore raw

Hi, Lucas!

Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Lucas De Marchi
Quoted 6 lines · Yauheni Kaliuta

Hi, Lucas!

I have a question about exit call from tools/log.c:log_printf()
(https://github.com/lucasdemarchi/kmod/blob/master/tools/log.c#L140)

Quoted 8 lines
Quoted 4 lines

What is the reasoning behind that?

At the first glance it looks a bit incorrect (pretty surprising to have exit in print()).

If we log a critical error, there's nothing we can do except exit. Note that this is only used by the binaries, not the library.

So, it should not be fatal then, right? See the usecase below.

Quoted 24 lines

There's potential for abuse, but it's pretty common to have something with that behavior.

Lucas De Marchi

Quoted 15 lines

Discovered while trying to remove several modules when one of them cannod be removed:

$ modprobe -r libata pcspkr
modprobe: FATAL: Module libata is in use.
$ lsmod | grep pcsp
pcspkr                 16384  0

--
WBR,
Yauheni Kaliuta

Signature · 1 line
Lucas De Marchi
Signature · 2 lines
WBR,
Yauheni Kaliuta