diff --git a/src/util/Makefile.Unix b/src/util/Makefile.Unix index 51c634167..536a28b3d 100644 --- a/src/util/Makefile.Unix +++ b/src/util/Makefile.Unix @@ -7,17 +7,20 @@ DEPLIBS = $(INSTALL_LIB)/libca.a $(INSTALL_LIB)/libCom.a SRCS.c = \ ../ca_test.c \ ../iocLogServer.c \ + ../chglimits.c \ ../startCArepeater.c OBJS = \ ca_test.o \ iocLogServer.o \ + chglimits.o \ startCArepeater.o PROD = \ ca_test \ iocLogServer \ + chglimits \ startCArepeater ifeq ($(T_A),solaris) diff --git a/src/util/chglimits.c b/src/util/chglimits.c new file mode 100644 index 000000000..c54f7fbba --- /dev/null +++ b/src/util/chglimits.c @@ -0,0 +1,154 @@ + +/* + * $Id$ + * + * Author: Jim Kowalkowski + * Date: 10/22/96 + * + * $Log$ + * +*/ + +#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