Lines Matching defs:lock
42 /* Internal function to map the userspace locks to the kernel lock types */
47 // If the user sets both a read and write lock, higher preference is
48 // given to the write lock.
62 /* Internal function to perform the actual lock/unlock operations */
77 ALOGE("%s: the lock has not been created,"
82 genlock_lock lock;
83 lock.op = lockType;
84 lock.flags = flags;
85 lock.timeout = timeout;
86 lock.fd = hnd->genlockHandle;
89 if (ioctl(hnd->genlockPrivFd, GENLOCK_IOC_DREADLOCK, &lock)) {
100 if (ioctl(hnd->genlockPrivFd, GENLOCK_IOC_LOCK, &lock)) {
129 * Create a genlock lock. The genlock lock file descriptor and the lock
154 // Create a new lock
155 genlock_lock lock;
159 close_genlock_fd_and_handle(fd, lock.fd);
163 // Export the lock for other processes to be able to use it.
165 if (ioctl(fd, GENLOCK_IOC_EXPORT, &lock)) {
168 close_genlock_fd_and_handle(fd, lock.fd);
173 // Store the lock params in the handle.
175 hnd->genlockHandle = lock.fd;
185 * Release a genlock lock associated with the handle.
202 ALOGE("%s: the lock is invalid", __FUNCTION__);
215 * Attach a lock to the buffer handle passed via an IPC.
239 // Attach the local handle to an existing lock
240 genlock_lock lock;
241 lock.fd = hnd->genlockHandle;
242 if (ioctl(fd, GENLOCK_IOC_ATTACH, &lock)) {
245 close_genlock_fd_and_handle(fd, lock.fd);
257 * Lock the buffer specified by the buffer handle. The lock held by the buffer
258 * is specified by the lockType. This function will block if a write lock is
264 * @param: type of lock to be acquired by the buffer.
282 ALOGW("%s: trying to lock a buffer with timeout = 0", __FUNCTION__);
284 // Call the private function to perform the lock operation specified.
309 * Blocks the calling process until the lock held on the handle is unlocked.
325 ALOGE("%s: the lock is invalid", __FUNCTION__);
332 genlock_lock lock;
333 lock.fd = hnd->genlockHandle;
334 lock.timeout = timeout;
335 if (ioctl(hnd->genlockPrivFd, GENLOCK_IOC_WAIT, &lock)) {
346 * Convert a write lock that we own to a read lock
357 ALOGW("%s: trying to lock a buffer with timeout = 0", __FUNCTION__);
359 // Call the private function to perform the lock operation specified.