Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>each time a <code>print</code> is involved the string is inserted into a linked list</p> </blockquote> <p>I don't really know if you meant <code>print</code> or <code>printk</code>. But if you're talking about <code>printk()</code>, You would need to allocate memory and you are in trouble because <code>printk()</code> may be called in an atomic context. Which leaves you the option to use a circular buffer (and thus, you should be tolerent to drop some strings because you might not have enough memory to save all the strings).</p> <blockquote> <p>Every X seconds I need to process the list and perform some operations on the strings before printing them.</p> </blockquote> <p>In that case, I would not even do a kernel thread: I would do the processing in <code>print()</code> if not too costly.</p> <p>Otherwise, I would create a new system call:</p> <ul> <li><code>sys_get_strings()</code> or something, that would dump the whole linked list into userspace (and remove entries from the list when copied).</li> </ul> <p>This way the whole behavior is controlled by userspace. You could create a deamon that would call the syscall every X seconds. You could also do all the costly processing in userspace.</p> <p>You could also create a new device says <code>/dev/print-on-screen</code>:</p> <ul> <li><code>dev_open</code> would allocate the memory, and <code>print()</code> would no longer be a no-op, but feed the data in the device pre-allocated memory (in case <code>print()</code> would be used in atomic context and all).</li> <li><code>dev_release</code> would throw everything out</li> <li><code>dev_read</code> would get you the strings</li> <li><code>dev_write</code> could do something on your print-on-screen system</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

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