Change to "kludge option processing" in /bin/ps

From: Garance A Drosihn (drosih_at_rpi.edu)
Date: 05/24/04

  • Next message: Harti Brandt: "Re: Network Stack Locking"
    Date: Sun, 23 May 2004 22:58:23 -0400
    To: arch@FreeBSD.ORG
    
    

    After staring at the kludge-option processing in `ps' for awhile, I
    found enough edge-cases where it simply did not work "right" (for my
    definition of "right", at keast...), so I rewrote it. As part of that,
    I also removed the ancient "BACKWARD_COMPATIBILITY" compile-time
    option, where:
          ps -options arg1 arg2
    (with no '-' on "arg1" and "arg2") was treated as:
         ps -options -N arg1 -M arg2

    I did this because I have often been puzzled/annoyed when I type:
         ps 12
    to get process 12, and then realize I wanted it shown in a
    different format so I type:
         ps -u 12
    and I get a completely different list of processes, or I type:
         ps 12 34
    and I only see process 12, or I type
         ps 12 34 56
    and get the error message:
         ps: 56: No such file or directory
    This BACKWARD_COMPATIBILITY is not documented in the usage()
    or the man page, so I'd like to replace it.

    So, I changed `ps' to check for any additional arguments after
    processing all '-'-options, and if those start with a digit then
    `ps' will try to use the entire argument as a pid or pidlist.
    If an extra argument does not start with a digit, then `ps' just
    prints an error and exits.

    I want to do more testing on this before committing, but I thought
    that all this was enough of a change that I should also give people
    a chance to scream before I commit it. Also, I'm not sure if I
    might have clobbered some subtle aspect of the kludge processing.

    If anyone wants to try the update, it is available at:

    http://people.freebsd.org/~gad/ps-kludge.diff

    [disclaimer: at the moment it's only had about 15 minutes of
    testing, but I *think* this is about the way I want it to work]

    Assuming there aren't any major objections to these ideas, I plan
    to do some more testing on this and commit it next weekend.

    -- 
    Garance Alistair Drosehn            =   gad@gilead.netel.rpi.edu
    Senior Systems Programmer           or  gad@freebsd.org
    Rensselaer Polytechnic Institute    or  drosih@rpi.edu
    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
    

  • Next message: Harti Brandt: "Re: Network Stack Locking"