#include <db.h>int lock_vec(DB_LOCKTAB *lt, u_int32_t locker, u_int32_t flags, DB_LOCKREQ list[], int nlist, DB_LOCKREQ **elistp);
The lock_vec function atomically obtains and releases one or more locks from the lock table. The lock_vec function is intended to support acquisition or trading of multiple locks under one lock table semaphore, as is needed for lock coupling or in multigranularity locking for lock escalation.
The locker argument specified to lock_vec is an unsigned 32-bit integer quantity. It represents the entity requesting or releasing the lock.
The flags value must be set to 0 or the following value:
The list array provided to lock_vec is typedef'd as DB_LOCKREQ. A DB_LOCKREQ structure has at least the following fields, which must be initialized before calling lock_vec:
The nlist argument specifies the number of elements in the list array.
If any of the requested locks cannot be acquired, or any of the locks to be released cannot be released, the operations before the failing operation are guaranteed to have completed successfully, and lock_vec returns a non-zero value. In addition, if elistp is not NULL, it is set to point to the DB_LOCKREQ entry that was being processed when the error occurred.
In the case of an error, lock_vec may return one of the following values:
Otherwise, the lock_vec function returns the value of errno on failure, and 0 on success.
The lock_vec function may fail and return errno for any of the errors specified for the following Berkeley DB and C library functions: abort(3), fcntl(3), fflush(3), fprintf(3), fsync(3), getpid(3), isprint(3), lock_detect, lseek(3), memcpy(3), memset(3), mmap(3), munmap(3), printf(3), pstat_getdynamic(3), shmat(3), shmdt(3), strerror(3), sysconf(3), vfprintf(3), vsnprintf(3), and write(3).
In addition, the lock_vec function may fail and return errno for the following conditions: