Pavel Machek wrote: > > + * Please use this wrapper function which will be updated in the future to > > read > > + * @tsk->comm in a consistent way. > > + */ > > +static inline int commcmp(const struct task_struct *tsk, const char *comm) > > +{ > > + return strcmp(tsk->comm, comm); > > +} > > Is this useful to something? Printing command name is > useful. Comparing it...? >
(a) Using tsk->comm for reducing duplicated printk() messages. if (strcmp(p->comm, last_comm)) { printk("hello\n"); strcpy(last_comm, p->comm); } (b) Using tsk->pid for reducing duplicated printk() messages. if (p->pid != last_pid) { printk("hello\n"); last_pid = p->pid; } (c) Using printk_ratelimit() for reducing printk() flooding. printk_ratelimit("hello\n"); (d) Using plain printk(). printk("hello\n"); (e) Other purposes. (e.g. drivers/target/iscsi/iscsi_target_tq.c ) if (!strncmp(current->comm, ISCSI_RX_THREAD_NAME, strlen(ISCSI_RX_THREAD_NAME))) thread_called = ISCSI_RX_THREAD; else if (!strncmp(current->comm, ISCSI_TX_THREAD_NAME, strlen(ISCSI_TX_THREAD_NAME))) thread_called = ISCSI_TX_THREAD; commcmp() and commcpy() are for wrappring (a). Though (a) should consider changing to (b) or (c). (e) should be rewritten not to depend on current->comm . -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/