/*************************************************************************\ * Copyright (c) 2002 The University of Chicago, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ /* * $Id$ * * Author: Jim Kowalkowski * Date: 10/22/96 * */ #include #include #include #include void print_error(char* prog); main(int argc, char** argv) { int uid=getuid(); int nval,fval,n=0,f=0,pos=1,opos; int uid_changed=0,sys_max; char** args; struct rlimit lim; if(argc<2 || strcmp(argv[1],"-?")==0 || strcmp(argv[1],"help")==0 || strcmp(argv[1],"-h")==0) { fprintf(stderr,"Usage: %s [-files value] [-nice value]",argv[0]); fprintf(stderr," program_to_run [program options]\n\n"); fprintf(stderr," -files : Change the maximum number of file "); fprintf(stderr,"descriptors the program can open.\n"); fprintf(stderr," -nice : Change the priority of the program "); fprintf(stderr,"up or down by this value\n\n"); fprintf(stderr,"The priority value range is [-20,20). The lower a\n"); fprintf(stderr,"program's nice value is, the higher priority it\n"); fprintf(stderr,"runs at. So -nice -20 results in the highest\n"); fprintf(stderr,"priority and -nice 19 results in the lowest.\n\n"); return 1; } do { opos=pos; if(strcmp(argv[pos],"-nice")==0) { n=1; if(sscanf(argv[++pos],"%d",&nval)!=1) { fprintf(stderr,"Improper -nice value entered\n"); return 1; } ++pos; } if(strcmp(argv[pos],"-files")==0) { f=1; if(sscanf(argv[++pos],"%d",&fval)!=1) { fprintf(stderr,"Improper -file value entered\n"); return 1; } ++pos; } } while(pos!=opos && pos