From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,6cca3aae6c6ac04a X-Google-Attributes: gidfee84,public From: Bernd Kardatzki Subject: Re: increasing maximum number of open files in DU4.0E Date: 1999/02/17 Message-ID: <7aemek$5v9$1@newsserv.zdv.uni-tuebingen.de>#1/1 X-Deja-AN: 445340968 Sender: Bernd Kardatzki References: <7acnbp$377@cantine.wu-wien.ac.at> Organization: ZDV Uni-Tuebingen User-Agent: tin/pre-1.4-980226 (UNIX) (Linux/2.0.34 (i686)) Newsgroups: comp.unix.osf.osf1 Gottfried Rudorfer wrote: : i tried to increase the maximum number of open files per process : under du 4.0e without success. : i get the error message when the system boots. : sysconfigtab: attribute open-max-hard in subsystem proc value/size must be <= 40 : 96 : it does not work as described in the du4.0e documentation. : any hints are welcome. solved it here recently with the program below. see also: http://www.unix.digital.com/faqs/publications/base_doc/DOCUMENTATION/V40D_HTML/AQTLMCTE/DOCU_002.HTM#ext-file-descript /* $Source$ * $Author$ $Date$ * $Locker$ * $Revision$ * File : "/home/karda/src/misc/setfd64k.c" * Creation : "Tue Jan 12 13:37:25 1999 karda" * LastEdit : "Thu Jan 14 16:24:02 1999 karda" * OS : "berkeley-unix" * Copyright: Bernd Kardatzki, Universitaet Tuebingen, Neuroradiologie * Sektion fuer Experimentelle Kernspinresonanz * 72076 Tuebingen, Hoppe-Seylerstr.3 * Email : bdkardat@med.uni-tuebingen.de * Tel./Fax : (07071) 2980535 / 294371 * * Synopsis : Change the maximum number of open file descriptors that the * process can have to the highest possible value * and exec() a child process which inherits this property * [DIGITAL UNIX SPECIAL] * * Status : done ;) * * todo: * */ #define NEW_RLIM_CURR 64*1024 #define NEW_RLIM_MAX 64*1024 #include #include #include #include #include #include int main(int argc, char **argv){ int n; int flag = 1; int fd_newmax; struct rlimit rlp; char **newArgv; getrlimit(RLIMIT_NOFILE,&rlp); printf("active RLIMIT_NOFILE: current=%d,max=%d\n", rlp.rlim_cur,rlp.rlim_max); getsysinfo(GSI_FD_NEWMAX,&fd_newmax,sizeof(fd_newmax),0,0,0); if(fd_newmax==0) /* Set utask bit to enable 64K file descriptors support */ if(setsysinfo(SSI_FD_NEWMAX, NULL, 0, 0, flag)) perror(); if( (rlp.rlim_cur < NEW_RLIM_CURR ) || (rlp.rlim_max < NEW_RLIM_MAX) ){ /* Change the values for this process and all of its childs */ rlp.rlim_cur = NEW_RLIM_CURR; rlp.rlim_max = NEW_RLIM_MAX; setrlimit(RLIMIT_NOFILE,&rlp); getrlimit(RLIMIT_NOFILE,&rlp); if((rlp.rlim_cur != NEW_RLIM_CURR ) || (rlp.rlim_max != NEW_RLIM_MAX) ) fprintf(stderr,"ERROR, COULD NOT SET RLIMIT_NOFILE VALUES TO" " current=%d,max=%d.\n" "\tActive values are: current=%d,max=%d\n(%s)\n", NEW_RLIM_CURR,NEW_RLIM_MAX,rlp.rlim_cur,rlp.rlim_max,strerror(errno)); else printf("changed RLIMIT_NOFILE: current=%d,max=%d\n", rlp.rlim_cur,rlp.rlim_max); } if(argc>1){ newArgv=(char **)malloc(argc * sizeof(char*)); for(n=1; n