+#if CONFIG_EMBEDDED
+int lf_getlockpid(struct vnode *vp, struct flock *fl)
+{
+ struct lockf *lf, *blk;
+
+ if (vp == 0)
+ return EINVAL;
+
+ fl->l_type = F_UNLCK;
+
+ lck_mtx_lock(&vp->v_lock);
+
+ for (lf = vp->v_lockf; lf; lf = lf->lf_next) {
+
+ if (lf->lf_flags & F_POSIX) {
+ if ((((struct proc *)lf->lf_id)->p_pid) == fl->l_pid) {
+ fl->l_type = lf->lf_type;
+ fl->l_whence = SEEK_SET;
+ fl->l_start = lf->lf_start;
+ if (lf->lf_end == -1)
+ fl->l_len = 0;
+ else
+ fl->l_len = lf->lf_end - lf->lf_start + 1;
+
+ break;
+ }
+ }
+
+ TAILQ_FOREACH(blk, &lf->lf_blkhd, lf_block) {
+ if (blk->lf_flags & F_POSIX) {
+ if ((((struct proc *)blk->lf_id)->p_pid) == fl->l_pid) {
+ fl->l_type = blk->lf_type;
+ fl->l_whence = SEEK_SET;
+ fl->l_start = blk->lf_start;
+ if (blk->lf_end == -1)
+ fl->l_len = 0;
+ else
+ fl->l_len = blk->lf_end - blk->lf_start + 1;
+
+ break;
+ }
+ }
+ }
+ }
+
+ lck_mtx_unlock(&vp->v_lock);
+ return (0);
+}
+#endif