Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You may find it useful to explore the <code>i3status</code> program source code: <a href="http://code.stapelberg.de/git/i3status/tree/src/print_disk_info.c" rel="nofollow noreferrer">http://code.stapelberg.de/git/i3status/tree/src/print_disk_info.c</a></p> <p>To answer your other questions:</p> <blockquote> <p>But as this each command spawn a new process , is this not possible to run the commands in the same process from which it is invoked?</p> </blockquote> <p>No; entire 'commands' are self-contained programs that must run in their own process.</p> <p>Depending upon how often you wish to execute your programs, <code>fork();exec()</code> is not so bad. There's no hard limits beyond which it would be better to gather data yourself vs executing a helper program. Once a minute, you're probably fine executing the commands. Once a second, you're probably better off gathering the data yourself. I'm not sure where the dividing line is.</p> <blockquote> <p>And at the same time as I need to run this command from a linux daemon, as my daemon should not hold any terminal. Will it effect my daemon behavior?</p> </blockquote> <p>If the command calls <code>setsid(2)</code>, then <code>open(2)</code> on a terminal without including <code>O_NOCTTY</code>, that terminal <a href="http://www.win.tue.nl/~aeb/linux/lk/lk-10.html" rel="nofollow noreferrer">might</a> become the controlling terminal for that process. But that wouldn't influence your program, because your program already disowned the terminal when becoming a daemon, and as the child process is a session leader, it cannot change your process's controlling terminal.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload