Remove MAC_DEBUG + MPRINTF debugging from System V IPC. This no longer

appears to be serving a useful purpose, as it was used during initial
development of MAC support for System V IPC.

MFC after:	1 month
Obtained from:	TrustedBSD Project
Suggested by:	Christopher dot Vance at SPARTA dot com
This commit is contained in:
Robert Watson 2006-09-20 13:40:00 +00:00
parent 738f14d4b1
commit f50c4fd817
3 changed files with 16 additions and 73 deletions

View File

@ -81,11 +81,6 @@ static int sysvmsg_modload(struct module *, int, void *);
#else
#define DPRINTF(a)
#endif
#ifdef MAC_DEBUG
#define MPRINTF(a) printf a
#else
#define MPRINTF(a)
#endif
static void msg_freehdr(struct msg *msghdr);
@ -445,10 +440,8 @@ kern_msgctl(td, msqid, cmd, msqbuf)
}
#ifdef MAC
error = mac_check_sysv_msqctl(td->td_ucred, msqkptr, cmd);
if (error != 0) {
MPRINTF(("mac_check_sysv_msqctl returned %d\n", error));
if (error != 0)
goto done2;
}
#endif
error = 0;
@ -475,11 +468,8 @@ kern_msgctl(td, msqid, cmd, msqbuf)
for (msghdr = msqkptr->u.msg_first; msghdr != NULL;
msghdr = msghdr->msg_next) {
error = mac_check_sysv_msgrmid(td->td_ucred, msghdr);
if (error != 0) {
MPRINTF(("mac_check_sysv_msgrmid returned %d\n",
error));
if (error != 0)
goto done2;
}
}
#endif
@ -608,11 +598,8 @@ msgget(td, uap)
}
#ifdef MAC
error = mac_check_sysv_msqget(cred, msqkptr);
if (error != 0) {
MPRINTF(("mac_check_sysv_msqget returned %d\n",
error));
if (error != 0)
goto done2;
}
#endif
goto found;
}
@ -733,10 +720,8 @@ msgsnd(td, uap)
#ifdef MAC
error = mac_check_sysv_msqsnd(td->td_ucred, msqkptr);
if (error != 0) {
MPRINTF(("mac_check_sysv_msqsnd returned %d\n", error));
if (error != 0)
goto done2;
}
#endif
segs_needed = (msgsz + msginfo.msgssz - 1) / msginfo.msgssz;
@ -978,7 +963,6 @@ msgsnd(td, uap)
*/
error = mac_check_sysv_msgmsq(td->td_ucred, msghdr, msqkptr);
if (error != 0) {
MPRINTF(("mac_check_sysv_msqmsq returned %d\n", error));
msg_freehdr(msghdr);
wakeup(msqkptr);
goto done2;
@ -1072,10 +1056,8 @@ msgrcv(td, uap)
#ifdef MAC
error = mac_check_sysv_msqrcv(td->td_ucred, msqkptr);
if (error != 0) {
MPRINTF(("mac_check_sysv_msqrcv returned %d\n", error));
if (error != 0)
goto done2;
}
#endif
msghdr = NULL;
@ -1094,11 +1076,8 @@ msgrcv(td, uap)
#ifdef MAC
error = mac_check_sysv_msgrcv(td->td_ucred,
msghdr);
if (error != 0) {
MPRINTF(("mac_check_sysv_msgrcv "
"returned %d\n", error));
if (error != 0)
goto done2;
}
#endif
if (msqkptr->u.msg_first == msqkptr->u.msg_last) {
msqkptr->u.msg_first = NULL;
@ -1142,12 +1121,8 @@ msgrcv(td, uap)
#ifdef MAC
error = mac_check_sysv_msgrcv(
td->td_ucred, msghdr);
if (error != 0) {
MPRINTF(("mac_check_sysv_"
"msgrcv returned %d\n",
error));
if (error != 0)
goto done2;
}
#endif
*prev = msghdr->msg_next;
if (msghdr == msqkptr->u.msg_last) {

View File

@ -68,11 +68,6 @@ static MALLOC_DEFINE(M_SEM, "sem", "SVID compatible semaphores");
#else
#define DPRINTF(a)
#endif
#ifdef MAC_DEBUG
#define MPRINTF(a) printf a
#else
#define MPRINTF(a)
#endif
static void seminit(void);
static int sysvsem_modload(struct module *, int, void *);
@ -650,11 +645,8 @@ kern_semctl(struct thread *td, int semid, int semnum, int cmd,
goto done2;
#ifdef MAC
error = mac_check_sysv_semctl(cred, semakptr, cmd);
if (error != 0) {
MPRINTF(("mac_check_sysv_semctl returned %d\n",
error));
if (error != 0)
goto done2;
}
#endif
bcopy(&semakptr->u, arg->buf, sizeof(struct semid_ds));
*rval = IXSEQ_TO_IPCID(semid, semakptr->u.sem_perm);
@ -671,10 +663,8 @@ kern_semctl(struct thread *td, int semid, int semnum, int cmd,
mtx_lock(sema_mtxp);
#ifdef MAC
error = mac_check_sysv_semctl(cred, semakptr, cmd);
if (error != 0) {
MPRINTF(("mac_check_sysv_semctl returned %d\n", error));
if (error != 0)
goto done2;
}
#endif
error = 0;
@ -926,11 +916,8 @@ semget(td, uap)
}
#ifdef MAC
error = mac_check_sysv_semget(cred, &sema[semid]);
if (error != 0) {
MPRINTF(("mac_check_sysv_semget returned %d\n",
error));
if (error != 0)
goto done2;
}
#endif
goto found;
}
@ -1090,10 +1077,8 @@ semop(td, uap)
}
#ifdef MAC
error = mac_check_sysv_semop(td->td_ucred, semakptr, j);
if (error != 0) {
MPRINTF(("mac_check_sysv_semop returned %d\n", error));
if (error != 0)
goto done2;
}
#endif
/*

View File

@ -94,12 +94,6 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_page.h>
#include <vm/vm_pager.h>
#ifdef MAC_DEBUG
#define MPRINTF(a) printf a
#else
#define MPRINTF(a)
#endif
static MALLOC_DEFINE(M_SHM, "shm", "SVID compatible shared memory segments");
#if defined(__i386__) && (defined(COMPAT_FREEBSD4) || defined(COMPAT_43))
@ -332,10 +326,8 @@ shmdt(td, uap)
#ifdef MAC
shmsegptr = &shmsegs[IPCID_TO_IX(shmmap_s->shmid)];
error = mac_check_sysv_shmdt(td->td_ucred, shmsegptr);
if (error != 0) {
MPRINTF(("mac_check_sysv_shmdt returned %d\n", error));
if (error != 0)
goto done2;
}
#endif
error = shm_delete_mapping(p->p_vmspace, shmmap_s);
done2:
@ -393,10 +385,8 @@ kern_shmat(td, shmid, shmaddr, shmflg)
goto done2;
#ifdef MAC
error = mac_check_sysv_shmat(td->td_ucred, shmseg, shmflg);
if (error != 0) {
MPRINTF(("mac_check_sysv_shmat returned %d\n", error));
if (error != 0)
goto done2;
}
#endif
for (i = 0; i < shminfo.shmseg; i++) {
if (shmmap_s->shmid == -1)
@ -514,11 +504,8 @@ oshmctl(td, uap)
goto done2;
#ifdef MAC
error = mac_check_sysv_shmctl(td->td_ucred, shmseg, uap->cmd);
if (error != 0) {
MPRINTF(("mac_check_sysv_shmctl returned %d\n",
error));
if (error != 0)
goto done2;
}
#endif
outbuf.shm_perm = shmseg->u.shm_perm;
outbuf.shm_segsz = shmseg->u.shm_segsz;
@ -604,10 +591,8 @@ kern_shmctl(td, shmid, cmd, buf, bufsz)
}
#ifdef MAC
error = mac_check_sysv_shmctl(td->td_ucred, shmseg, cmd);
if (error != 0) {
MPRINTF(("mac_check_sysv_shmctl returned %d\n", error));
if (error != 0)
goto done2;
}
#endif
switch (cmd) {
case SHM_STAT:
@ -733,10 +718,8 @@ shmget_existing(td, uap, mode, segnum)
return (EEXIST);
#ifdef MAC
error = mac_check_sysv_shmget(td->td_ucred, shmseg, uap->shmflg);
if (error != 0) {
MPRINTF(("mac_check_sysv_shmget returned %d\n", error));
if (error != 0)
return (error);
}
#endif
error = ipcperm(td, &shmseg->u.shm_perm, mode);
if (error)