Lines Matching refs:lockinfo
1512 smb_file_lock(char *lock_file, smb_lockinfo_t *lockinfo)
1516 (void) mutex_lock(&lockinfo->l_mtx);
1518 if (lockinfo->l_pid != 0 && lockinfo->l_pid != getpid()) {
1520 lockinfo->l_pid = 0;
1521 lockinfo->l_tid = 0;
1524 if (lockinfo->l_tid == 0) {
1525 if ((lockinfo->l_fildes = creat(lock_file, 0600)) == -1)
1527 lockinfo->l_flock.l_type = F_WRLCK;
1528 if (fcntl(lockinfo->l_fildes,
1529 F_SETLK, &lockinfo->l_flock) != -1) {
1530 lockinfo->l_pid = getpid();
1531 lockinfo->l_tid = thr_self();
1532 (void) mutex_unlock(&lockinfo->l_mtx);
1535 (void) close(lockinfo->l_fildes);
1536 lockinfo->l_fildes = -1;
1548 (void) mutex_unlock(&lockinfo->l_mtx);
1550 (void) mutex_lock(&lockinfo->l_mtx);
1552 (void) mutex_unlock(&lockinfo->l_mtx);
1561 smb_file_unlock(smb_lockinfo_t *lockinfo)
1563 (void) mutex_lock(&lockinfo->l_mtx);
1564 if (lockinfo->l_tid == thr_self() && lockinfo->l_fildes >= 0) {
1565 lockinfo->l_flock.l_type = F_UNLCK;
1566 (void) fcntl(lockinfo->l_fildes, F_SETLK, &lockinfo->l_flock);
1567 (void) close(lockinfo->l_fildes);
1568 lockinfo->l_fildes = -1;
1569 lockinfo->l_pid = 0;
1570 lockinfo->l_tid = 0;
1571 (void) mutex_unlock(&lockinfo->l_mtx);
1574 (void) mutex_unlock(&lockinfo->l_mtx);