Re: [PATCH] protect migration/%d etc from sched_setaffinity

From: Andrew Morton (akpm@osdl.org)
Date: Thu Jul 31 2003 - 18:17:03 EST


Joe Korty <joe.korty@ccur.com> wrote:
>
> I'd like to be able to write shell scrips that operate on the set of
> /proc/[0-9]* without having to know which of the ever-changing list
> of processes need to be avoided and which not.

Like this?

#!/bin/sh

#
# can_set_affinity pid
#
can_set_affinity()
{
        if [ "$(cat /proc/$1/maps)" != "" ]
        then
                return 0
        fi
        if head -1 /proc/$1/status | egrep "events|migration"
        then
                return 1
        else
                return 0
        fi
}

if can_set_affinity $1
then
        echo can set affinity of pid $1
else
        echo cannot set affinity of pid $1
fi

-
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/



This archive was generated by hypermail 2b29 : Thu Jul 31 2003 - 22:00:52 EST