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

1.1.1.2 ! root        1: /***   SetMaxFH
1.1       root        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:  *
1.1.1.2 ! root       11:  *     The system default may be increased by using the DosSetMaxFH
1.1       root       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:  *
1.1.1.2 ! root       22:  *     Created by Microsoft Corp. 1986
1.1       root       23:  */
                     24: 
1.1.1.2 ! root       25: 
        !            26: #include <os2def.h>
        !            27: #include <bsedos.h>
1.1       root       28: 
                     29: main(argc, argv)
                     30: int argc;
                     31: char *argv[];
                     32: {
1.1.1.2 ! root       33:        USHORT max_files;
1.1       root       34:        int rc;
                     35: 
                     36:        if(argc == 2)
                     37:                max_files = atoi(argv[1]);
                     38:        else
                     39:                max_files = 30;
                     40: 
1.1.1.2 ! root       41:        rc = DosSetMaxFH(max_files);
1.1       root       42: 
                     43:        if(rc == 0)
1.1.1.2 ! root       44:                printf("DosSetMaxFH(%d) succeeded.\n", max_files);
1.1       root       45:        else
1.1.1.2 ! root       46:                printf("DosSetMaxFH(%d) failed, error = %d\n", max_files, rc);
1.1       root       47: }

unix.superglobalmegacorp.com

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