File:  [OS/2 SDKs] / os2sdk / demos / examples / setmaxfh / setmaxfh.c
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs
Thu Aug 9 12:26:14 2018 UTC (7 years, 9 months ago) by root
Branches: msft, MAIN
CVS tags: os2sdk-1988, HEAD
Microsoft OS/2 SDK 03-01-1988

/***	SetMaxFH
 *
 *	This call sets the maximum number of file handles that may be 
 *	opened at one time.  The only indicator you have that the
 *	call succeeded is the return code.  There is no call which will
 *	check the current maximum so you either use the system default
 *	or set your own.  There is also no call to tell you how many of
 *	the handles are currently available.  The only way to check 
 *	is to use them all up.
 *
 *	The system default may be increased by using the DosSetMaxFH
 *	call.  It may NOT be decreased.
 *
 *	This function does NOT work in Family API mode.
 *
 *	This program increases the file handle limit to 30, or whatever
 *	is specified as the first parameter to main(). You can experiment
 *	with values less than 20 which should fail because you can't
 *	decrease the limit, and really big values which should fail due
 *	to system resource limits.
 *
 *	Created by Microsoft Corp. 1986
 */


#include <os2def.h>
#include <bsedos.h>

main(argc, argv)
int argc;
char *argv[];
{
	USHORT max_files;
	int rc;

	if(argc == 2)
		max_files = atoi(argv[1]);
	else
		max_files = 30;

	rc = DosSetMaxFH(max_files);

	if(rc == 0)
		printf("DosSetMaxFH(%d) succeeded.\n", max_files);
	else
		printf("DosSetMaxFH(%d) failed, error = %d\n", max_files, rc);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.