DosSetRelMaxFH: Difference between revisions
Appearance
Created page with "==Description== Adjusts the maximum number of file handles for the calling process. ==Syntax== <PRE> #define INCL_DOSFILEMGR #include <os2.h> PLONG pcbReqCount; /* Add..." |
mNo edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Adjusts the maximum number of file handles for the calling process. | Adjusts the maximum number of file handles for the calling process. | ||
==Syntax== | ==Syntax== | ||
DosSetRelMaxFH(pcbReqCount, pcbCurMaxFH) | |||
==Parameters== | ==Parameters== | ||
; | ;pcbReqCount (PLONG) - input: Address of the number to be added to the maximum number of file handles for the calling process. | ||
:If pcbReqCount is positive, the maximum number of file handles is increased. If pcbReqCount is negative, the maximum number of file handles is decreased. | |||
If pcbReqCount is positive, the maximum number of file handles is increased. If pcbReqCount is negative, the maximum number of file handles is decreased. | :The system treats a decrease in the maximum number of file handles as an advisory request that may or may not be granted; the system may track and defer such a request. | ||
;pcbCurMaxFH (PULONG) - output: Address of the variable to receive the new total number of allocated file handles. | |||
The system treats a decrease in the maximum number of file handles as an advisory request that may or may not be granted; the system may track and defer such a request. | |||
; pcbCurMaxFH (PULONG) - output : Address of the variable to receive the new total number of allocated file handles. | |||
==Return Code== | ==Return Code== | ||
;ulrc (APIRET) - returns:DosSetRelMaxFH returns one of the following values: | |||
*0 NO_ERROR | |||
DosSetRelMaxFH returns one of the following values: | |||
* 0 | |||
==Remarks== | ==Remarks== | ||
All file handles that are currently open are preserved. The system may defer or disregard a request to decrease the maximum number of file handles for the current process. The return code is set to NO_ERROR even if the system defers or disregards a request for a decrease. | All file handles that are currently open are preserved. The system may defer or disregard a request to decrease the maximum number of file handles for the current process. The return code is set to NO_ERROR even if the system defers or disregards a request for a decrease. | ||
You should examine the value of pcbCurMaxFH to determine the result of DosSetRelMaxFH. | You should examine the value of pcbCurMaxFH to determine the result of DosSetRelMaxFH. | ||
==Example Code== | ==Example Code== | ||
This example shows how to define and adjust the maximum number of file handles. | This example shows how to define and adjust the maximum number of file handles. | ||
<PRE> | <PRE> | ||
#define INCL_DOSFILEMGR /* File Manager values */ | #define INCL_DOSFILEMGR /* File Manager values */ | ||
#define INCL_DOSERRORS /* DOS Error values */ | #define INCL_DOSERRORS /* DOS Error values */ | ||
Line 81: | Line 63: | ||
return NO_ERROR; | return NO_ERROR; | ||
} | } | ||
</PRE> | |||
==Related Functions== | ==Related Functions== | ||
* [[ | * [[DosDupHandle]] | ||
* [[ | * [[DosOpen]] | ||
* [[ | * [[DosSetMaxFH]] | ||
[[Category: | [[Category:Dos]] |
Latest revision as of 21:52, 29 November 2019
Adjusts the maximum number of file handles for the calling process.
Syntax
DosSetRelMaxFH(pcbReqCount, pcbCurMaxFH)
Parameters
- pcbReqCount (PLONG) - input
- Address of the number to be added to the maximum number of file handles for the calling process.
- If pcbReqCount is positive, the maximum number of file handles is increased. If pcbReqCount is negative, the maximum number of file handles is decreased.
- The system treats a decrease in the maximum number of file handles as an advisory request that may or may not be granted; the system may track and defer such a request.
- pcbCurMaxFH (PULONG) - output
- Address of the variable to receive the new total number of allocated file handles.
Return Code
- ulrc (APIRET) - returns
- DosSetRelMaxFH returns one of the following values:
- 0 NO_ERROR
Remarks
All file handles that are currently open are preserved. The system may defer or disregard a request to decrease the maximum number of file handles for the current process. The return code is set to NO_ERROR even if the system defers or disregards a request for a decrease.
You should examine the value of pcbCurMaxFH to determine the result of DosSetRelMaxFH.
Example Code
This example shows how to define and adjust the maximum number of file handles.
#define INCL_DOSFILEMGR /* File Manager values */ #define INCL_DOSERRORS /* DOS Error values */ #include <os2.h> #include <stdio.h> int main(VOID){ ULONG CurMaxFH = 0; /* Current count of handles */ LONG ReqCount = 0; /* Number to adjust file handles */ APIRET rc = NO_ERROR; /* Return code */ rc = DosSetRelMaxFH(&ReqCount, /* Using 0 here will return the */ &CurMaxFH); /* current number of file handles */ if (rc != NO_ERROR) { printf("DosSetRelMaxFH error: return code = %u\n", rc); return 1; } else { printf("Maximum number of file handles is %u.\n", CurMaxFH); } rc = DosSetMaxFH(110L); /* Set maximum file handles to 110 */ if (rc != NO_ERROR) { printf("DosSetMaxFH error: return code = %u\n", rc); return 1; } ReqCount = -5L; /* Want 5 less file handles */ rc = DosSetRelMaxFH(&ReqCount,&CurMaxFH); /* Change handle maximum */ if (rc != NO_ERROR) { printf("DosSetRelMaxFH error: return code = %u\n", rc); return 1; } else { printf("Maximum number of file handles is now %u.\n", CurMaxFH); } return NO_ERROR; }