lkml.org 
[lkml]   [2006]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCH] sched.h: increment TASK_COMM_LEN to 20 bytes
    >
    >We do occasionally hit task_struct.comm[] truncation, when people use
    >"too-long-a-name%d" for their kernel thread names. But we seem to manage.
    >

    Maybe this one can help?

    Have kthread_create() print a warning message if the command name is
    going to be truncated, for ease of development.

    diff --fast -dpru linux-2.6.17~/kernel/kthread.c linux-2.6.17+/kernel/kthread.c
    --- linux-2.6.17~/kernel/kthread.c 2006-06-06 02:57:02.000000000 +0200
    +++ linux-2.6.17+/kernel/kthread.c 2006-07-01 11:08:57.687698000 +0200
    @@ -147,8 +147,11 @@ struct task_struct *kthread_create(int (
    if (!IS_ERR(create.result)) {
    va_list args;
    va_start(args, namefmt);
    - vsnprintf(create.result->comm, sizeof(create.result->comm),
    - namefmt, args);
    + if(vsnprintf(create.result->comm, sizeof(create.result->comm),
    + namefmt, args) != strlen(create.result->comm))
    + printk(KERN_WARNING "kthread_create: command name of "
    + "pid %d truncated to \"%s\"\n", create.result->pid,
    + create.result->comm);
    va_end(args);
    }

    #<<eof>>

    Jan Engelhardt
    --
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-07-03 14:10    [W:0.021 / U:1.472 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site