z/OS UNIX System Services File System Interface Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


BPX1VLO, BPX4VLO (v_lockctl)

z/OS UNIX System Services File System Interface Reference
SA23-2285-00

The following code requests a read lock on the file with the input DEVNO and FID. The locker has been previously registered as LOCKERTOK, and the request is for client thread CTID. The byte-range to lock is from the start of the file to byte 10. For the callable service, see v_lockctl (BPX1VLO, BPX4VLO) — Lock a file. For the data structures, see BPXYOSS — Map operating system specific information, BPXYVLOK — Map the interface block for v_lockctl, and Mapping macros in z/OS UNIX System Services Programming: Assembler Callable Services Reference.
         MVC   OSSSTOR,OSS                 Initialize BPXYOSS area
         MVC   VLOKSTOR,VLOK               Initialize BPXYVLOK area
         XC    BRLK(BRLK#LENGTH),BRLK      Initialize BPXYBRLK
         MVI   L_TYPE,F_RDLCK              Lock type = read
         MVI   L_WHENCE,SEEK_SET           Whence = start of file
         MVC   L_LEN,=F'10'                Len = 10 bytes
         LA    R5,VLOKSTOR                 Address and
         USING VLOK,R5                     map BPXYVLOK area
         MVC   VLOKLOCKERTOK,LOCKERTOK     Move Locker Token to VLOK
         MVC   VLOKCLIENTTID,CTID          Move Thread ID to VLOK
         MVI   VLOKOBJCLASS,VLOK#HFS       Object Class = HFS
         MVC   VLOKOBJDEV,DEVNO            Move Device ID
         MVC   VLOKOBJFID,FID              Move File ID
         MVC   VLOKBRLK,BRLK               Move Lock info to VLOK
         DROP  R5
         SPACE ,
         CALL  BPX1VLO,              Create a link to a file           +
               (OSSSTOR,             Input/output: BPXYOSS             +
               =A(VLOK#LOCK),        Input: Command = Lock             +
               =A(VLOK#LENGTH),      Input: BPXYVLOK length            +
               VLOKSTOR,             Input/output: BPXYVLOK            +
               RETVAL,               Return value: 0 or -1             +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               VL,MF=(E,PLIST)       ----------------------------------

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014