Annotation of os2sdk/demos/examples/setmaxfh/setmaxfh.c, revision 1.1.1.1

1.1       root        1: /***   SetMaxFH  
                      2:  *
                      3:  *     This call sets the maximum number of file handles that may be 
                      4:  *     opened at one time.  The only indicator you have that the
                      5:  *     call succeeded is the return code.  There is no call which will
                      6:  *     check the current maximum so you either use the system default
                      7:  *     or set your own.  There is also no call to tell you how many of
                      8:  *     the handles are currently available.  The only way to check 
                      9:  *     is to use them all up.
                     10:  *
                     11:  *     The system default may be increased by using the DOSSETMAXFH
                     12:  *     call.  It may NOT be decreased.
                     13:  *
                     14:  *     This function does NOT work in Family API mode.
                     15:  *
                     16:  *     This program increases the file handle limit to 30, or whatever
                     17:  *     is specified as the first parameter to main(). You can experiment
                     18:  *     with values less than 20 which should fail because you can't
                     19:  *     decrease the limit, and really big values which should fail due
                     20:  *     to system resource limits.
                     21:  *
                     22:  *     Copyright (C) Microsoft Corp. 1986
                     23:  */
                     24: 
                     25: #include "doscalls.h"
                     26: 
                     27: main(argc, argv)
                     28: int argc;
                     29: char *argv[];
                     30: {
                     31:        int max_files;
                     32:        int rc;
                     33: 
                     34:        if(argc == 2)
                     35:                max_files = atoi(argv[1]);
                     36:        else
                     37:                max_files = 30;
                     38: 
                     39:        rc = DOSSETMAXFH(max_files);
                     40: 
                     41:        if(rc == 0)
                     42:                printf("DOSSETMAXFH(%d) succeeded.\n", max_files);
                     43:        else
                     44:                printf("DOSSETMAXFH(%d) failed, error = %d\n", max_files, rc);
                     45: }

unix.superglobalmegacorp.com

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