Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

ctGetFileUsers

Declaration

NINT ctGetFileUsers(pTEXT FileName, pctUSRINF pFileUserInfo, pLONG pNbrUsers);

Description

Get information about all users currently held on the specified file.

typedef struct ctusrinfo {

NINT taskid; /* connection number */

NINT ufilno; /* user file number */

TEXT usrnam[32]; /* user name */

} ctUSRINF, ctMEM * pctUSRINF;

FileName holds the name of the file whose list of users is to be returned.

pFileUserInfo points to an array of ctUSRINF user information structures allocated by the caller. On input, pNbrUsers points to the size of this array. A successful call to ctGetFileUsers() sets pNbrUsers to point to the number of ctUSRINF entries that were written to the pFileUserInfo array.

If the specified array size is too small to hold the list of all users who have the file open, *pNbrUsers is set to the number of array entries required, and ctGetFileUsers() returns error VBSZ_ERR (153, buffer too small).

Note: The user name is stored in the pFileUserInfo buffer as a null-terminated string and is not padded to the full length of the usrnam field. Each user name is followed by padding bytes if necessary to ensure that the next ctUSRINF structure in the buffer is aligned on a four-byte boundary. For example code showing how to find the address of the next ctUSRINF structure in the output buffer, see the function ictadmnListFileUsers() in ctadmn.c.

Only a user who is a member of the ADMIN group can call this function. If a user who is not a member of the ADMIN group calls this function, it returns error LADM_ERR (589, member of ADMIN group required).

Dumping large quantities of locks in a very active system could affect performance.

Return Values

Symbolic Constant

 

Explanation

NO_ERROR

0

No error

VBSZ_ERR

153

Buffer too small

LADM_ERR

589

Member of ADMIN group required

See FairCom DB Error Codes for a complete listing of valid error values.

See also

ctGetOpenFiles, ctGetFileLocks

TOCIndex