BPX4SRL (setrlimit) example

The following code sets the resource limits for the calling process based on the input resource value and the resource limits set in the input rlimit structure. The resource value is set to RLIMIT_CPU. The resource limits are set to RLIM_INFINITY. For the callable service, see setrlimit (BPX1SRL, BPX4SRL) — Set resource limits. For the data structure, see BPXYRLIM — Map the rlimit, rusage, and timeval structures. AMODE 31 callers use BPX1SRL (setrlimit) example.
                                              
         MVC   RESOURCE,=A(RLIMIT_CPU)    Value of resource             
         XC    RLIM_CUR_HW,RLIM_CUR_HW    Current limit highword (Zero) 
         XC    RLIM_MAX_HW,RLIM_MAX_HW    Maximum limit highword (Zero) 
         MVC   RLIM_CUR,=A(RLIM_INFINITY) Current limit                 
         MVC   RLIM_MAX,=A(RLIM_INFINITY) Maximum limit                 
         SPACE ,                                                        
         CALL  BPX4SRL,              Set resource limits               +
               (RESOURCE,            Input: resource                   +
               RLIMIT,               Structure, mapped by BPXYRLIM     +
               RETVAL,               Return value: 0 or -1             +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               MF=(E,PLIST)          ---------------------------------- 
         L     R15,RETVAL            Load return value                  
         C     R15,=F'-1'            Test for -1 return                 
         BE    PSEUDO                Branch on error