From: Bernd Kardatzki <krrka01@uhtest4.zdv.uni-tuebingen.de>
Subject: Re: increasing maximum number of open files in DU4.0E
Date: 1999/02/17 [thread overview]
Message-ID: <7aemek$5v9$1@newsserv.zdv.uni-tuebingen.de> (raw)
In-Reply-To: 7acnbp$377@cantine.wu-wien.ac.at
Gottfried Rudorfer <rudorfer@miss.wu-wien.ac.at> 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 <stdio.h>
#include <sys/sysinfo.h>
#include <machine/hal_sysinfo.h>
#include <sys/proc.h>
#include <sys/param.h>
#include <sys/resource.h>
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<argc; n++)
newArgv[n-1] = argv[n];
newArgv[argc-1] = NULL;
if(execvp(argv[1],newArgv) < 0 ){
fprintf(stderr,"%s: could not execute '%s' (%s).\n",
argv[0],argv[1],strerror(errno));
return -1;
}
}
return 0;
}
/* Local Variables: */
/* compile-command: "cc -o setfd64k -g setfd64k.c " */
/* End: */
-- Bernd Kardatzki _______________________________________________
\ University Hospital Tuebingen, Dept. of Neuroradiology \
\ Section for Experimental NMR of the CNS \
\ Hoppe-Seylerstr.3, D-72076 Tuebingen, Germany \
\ bdkardat@med.uni-tuebingen.de, xx49 (0)7071 2980535, fax:294371 \
prev parent reply other threads:[~1999-02-17 5:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-02-16 5:00 increasing maximum number of open files in DU4.0E Gottfried Rudorfer
1999-02-17 5:00 ` Bernd Kardatzki [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox