MCPcopy Create free account
hub / github.com/F-Stack/f-stack / audit_pipe_ioctl

Function audit_pipe_ioctl

freebsd/security/audit/audit_pipe.c:691–893  ·  view source on GitHub ↗

* Audit pipe ioctl() routine. Handle file descriptor and audit pipe layer * commands. */

Source from the content-addressed store, hash-verified

689 * commands.
690 */
691static int
692audit_pipe_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag,
693 struct thread *td)
694{
695 struct auditpipe_ioctl_preselect *aip;
696 struct audit_pipe *ap;
697 au_mask_t *maskp;
698 int error, mode;
699 au_id_t auid;
700
701 error = devfs_get_cdevpriv((void **)&ap);
702 if (error != 0)
703 return (error);
704
705 /*
706 * Audit pipe ioctls: first come standard device node ioctls, then
707 * manipulation of pipe settings, and finally, statistics query
708 * ioctls.
709 */
710 switch (cmd) {
711 case FIONBIO:
712 AUDIT_PIPE_LOCK(ap);
713 if (*(int *)data)
714 ap->ap_flags |= AUDIT_PIPE_NBIO;
715 else
716 ap->ap_flags &= ~AUDIT_PIPE_NBIO;
717 AUDIT_PIPE_UNLOCK(ap);
718 error = 0;
719 break;
720
721 case FIONREAD:
722 AUDIT_PIPE_LOCK(ap);
723 *(int *)data = ap->ap_qbyteslen - ap->ap_qoffset;
724 AUDIT_PIPE_UNLOCK(ap);
725 error = 0;
726 break;
727
728 case FIOASYNC:
729 AUDIT_PIPE_LOCK(ap);
730 if (*(int *)data)
731 ap->ap_flags |= AUDIT_PIPE_ASYNC;
732 else
733 ap->ap_flags &= ~AUDIT_PIPE_ASYNC;
734 AUDIT_PIPE_UNLOCK(ap);
735 error = 0;
736 break;
737
738 case FIOSETOWN:
739 error = fsetown(*(int *)data, &ap->ap_sigio);
740 break;
741
742 case FIOGETOWN:
743 *(int *)data = fgetown(&ap->ap_sigio);
744 error = 0;
745 break;
746
747 case AUDITPIPE_GET_QLEN:
748 *(u_int *)data = ap->ap_qlen;

Callers

nothing calls this directly

Calls 7

fsetownFunction · 0.85
fgetownFunction · 0.85
audit_pipe_preselect_getFunction · 0.85
audit_pipe_preselect_setFunction · 0.85
audit_pipe_flushFunction · 0.85

Tested by

no test coverage detected