lkml.org 
[lkml]   [1996]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subjecttool patch - ps
    I have made a quick and dirty patch to fix the output of "ps -lax". 
    I'll attach the patch. Not a kernel issue, unless Linus changes some
    of the new flags...

    Ulrich
    DESCRIPTION OF DEFECT
    Recent kernels use the new flag PF_USEDFPU (0x00100000) that breaks
    the three digit format used for "ps -l".

    FIX
    This patch fixes the format of "ps -lax" for Linux 2.0.
    The sulution chosen is to extend the length of the flags field to
    six digits. As an alternative, the new flags can be set to zero
    (commented).
    (This patch has been made against procps-0.99a from the German
    S.u.S.E. distribution; fuzz factors may apply.)

    AUTHOR
    Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de>

    Index: readproc.c
    ===================================================================
    RCS file: /tmp/REPOS/procps/proc/readproc.c,v
    retrieving revision 1.1
    retrieving revision 1.2
    diff -u -r1.1 -r1.2
    --- readproc.c 1996/05/21 18:08:36 1.1
    +++ readproc.c 1996/05/21 19:12:32 1.2
    @@ -92,6 +92,7 @@
    }
    if (linux_version_code < LINUX_VERSION(1,1,30) && P->tty != -1)
    P->tty = 4*0x100 + P->tty; /* when tty wasn't full devno */
    +/* P->flags &= 0x0fff; /* three digits */
    }

    void statm2proc(char* s, proc_t* P) {
    Index: ps.c
    ===================================================================
    RCS file: /tmp/REPOS/procps/ps.c,v
    retrieving revision 1.1
    retrieving revision 1.2
    diff -u -r1.1 -r1.2
    --- ps.c 1996/05/21 18:08:34 1.1
    +++ ps.c 1996/05/21 19:10:47 1.2
    @@ -54,7 +54,7 @@
    const char* header;
    } mode[] = {
    { show_short, 0 , "Up", " PID TTY STAT TIME COMMAND" },
    - { show_long, 'l', "Pp", " F UID PID PPID PRI NI SIZE RSS WCHAN STAT TTY TIME COMMAND" },
    + { show_long, 'l', "Pp", " F UID PID PPID PRI NI SIZE RSS WCHAN STAT TTY TIME COMMAND" },
    { show_user, 'u', "up", "USER PID %CPU %MEM SIZE RSS TTY STAT START TIME COMMAND" },
    { show_jobs, 'j', "gPp"," PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND" },
    { show_sig, 's', "p", " UID PID SIGNAL BLOCKED IGNORED CATCHED STAT TTY TIME COMMAND" },
    @@ -382,7 +382,7 @@
    sprintf(wchanb, "%-9x", p->wchan);
    else
    sprintf(wchanb, "%-9.9s", wchan(p->wchan));
    - sprintf(s, "%3x %5d %5d %5d %3d %2d %5d %5d %-10.10s %s %3s ",
    + sprintf(s, "%6x %5d %5d %5d %3d %3d %5d %5d %-10.10s %s %3s ",
    p->flags, p->uid, p->pid, p->ppid, p->priority, p->nice,
    p->vsize >> 10, p->rss * 4, wchanb, status2(p), p->ttyc);
    }
    \
     
     \ /
      Last update: 2005-03-22 13:37    [W:5.223 / U:0.000 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site