+int
+fill_pseminfo(struct psemnode *pnode, struct psem_info * info)
+{
+ struct pseminfo *pinfo;
+ struct vinfo_stat *sb;
+
+ PSEM_SUBSYS_LOCK();
+ if ((pinfo = pnode->pinfo) == PSEMINFO_NULL){
+ PSEM_SUBSYS_UNLOCK();
+ return(EINVAL);
+ }
+
+#if 0
+ if ((pinfo->psem_flags & PSEM_ALLOCATED) != PSEM_ALLOCATED) {
+ PSEM_SUBSYS_UNLOCK();
+ return(EINVAL);
+ }
+#endif
+
+ sb = &info->psem_stat;
+ bzero(sb, sizeof(struct vinfo_stat));
+
+ sb->vst_mode = pinfo->psem_mode;
+ sb->vst_uid = pinfo->psem_uid;
+ sb->vst_gid = pinfo->psem_gid;
+ sb->vst_size = pinfo->psem_usecount;
+ bcopy(&pinfo->psem_name[0], &info->psem_name[0], PSEMNAMLEN+1);
+
+ PSEM_SUBSYS_UNLOCK();
+ return(0);
+}
+
+#if CONFIG_MACF
+void
+psem_label_associate(struct fileproc *fp, struct vnode *vp, vfs_context_t ctx)
+{
+ struct psemnode *pnode;
+ struct pseminfo *psem;
+
+ PSEM_SUBSYS_LOCK();
+ pnode = (struct psemnode *)fp->f_fglob->fg_data;
+ if (pnode != NULL) {
+ psem = pnode->pinfo;
+ if (psem != NULL)
+ mac_posixsem_vnode_label_associate(
+ vfs_context_ucred(ctx), psem, psem->psem_label,
+ vp, vp->v_label);
+ }
+ PSEM_SUBSYS_UNLOCK();
+}
+#endif
+