/*------------------------------------------------------------------------- Read and set the homenode and the node_policy used for node affine scheduling. (c) Erich Focht $Id:$ $Revision:$ $Log:$ -------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include static char VersionString[] = "$Revision:$"; void usage(char *exe) { printf("Usage: %s [-n] [-N node] [-p] [-P policy] [pid]\n", exe); printf(" -n : get preferred node for process pid\n"); printf(" -N : set preferred node for process pid\n"); printf(" -p : get scheduler node_policy for process pid\n"); printf(" -P : set scheduler node_policy for process pid\n"); printf(" pid : process ID of targetted process (default: parent)\n"); printf("\n%s\n\n",VersionString); } #define MAXPIDS 256 int main(int argc,char *argv[]) { int ierr=0, pid[MAXPIDS], policy, numpids=0, i; int result; extern char *optarg; extern int optind; int c; int getpol=0, getnod=0, setnod=0, setpol=0, help=0, node; // set PID to parent process ID of current process, this is what we // usually mean to change pid[numpids++]=getppid(); // parse options while (( c = getopt(argc, argv, "nN:pP:h")) != EOF ) { switch( c ) { case 'n': /* get task->node value */ getnod=1; break; case 'N': /* set task->node value */ setnod=1; sscanf(optarg,"%d",&node); break; case 'p': /* get task->node_policy value */ getpol=1; break; case 'P': /* set task->node_policy value */ setpol=1; sscanf(optarg,"%d",&policy); break; case 'h': help=1; break; default: printf("Unknown option %s\n",optarg); } } if (optind