-/* $OpenBSD: kern_sysctl.c,v 1.434 2024/08/06 12:36:54 mvs Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.435 2024/08/08 10:25:00 mvs Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
return (sysctl_rdstruct(oldp, oldlenp, newp,
&mbs, sizeof(mbs)));
}
+ case KERN_MSGBUFSIZE:
+ case KERN_CONSBUFSIZE: {
+ struct msgbuf *mp;
+ mp = (name[0] == KERN_MSGBUFSIZE) ? msgbufp : consbufp;
+ /*
+ * deal with cases where the message buffer has
+ * become corrupted.
+ */
+ if (!mp || mp->msg_magic != MSG_MAGIC)
+ return (ENXIO);
+ return (sysctl_rdint(oldp, oldlenp, newp, mp->msg_bufs));
+ }
case KERN_OSREV:
case KERN_NFILES:
case KERN_TTYCOUNT:
error = sysctl_int(oldp, oldlenp, newp, newlen, &inthostid);
hostid = inthostid;
return (error);
- case KERN_MSGBUFSIZE:
- case KERN_CONSBUFSIZE: {
- struct msgbuf *mp;
- mp = (name[0] == KERN_MSGBUFSIZE) ? msgbufp : consbufp;
- /*
- * deal with cases where the message buffer has
- * become corrupted.
- */
- if (!mp || mp->msg_magic != MSG_MAGIC)
- return (ENXIO);
- return (sysctl_rdint(oldp, oldlenp, newp, mp->msg_bufs));
- }
case KERN_CONSBUF:
if ((error = suser(p)))
return (error);
case KERN_MSGBUF: {
struct msgbuf *mp;
mp = (name[0] == KERN_MSGBUF) ? msgbufp : consbufp;
- /* see note above */
+ /*
+ * deal with cases where the message buffer has
+ * become corrupted.
+ */
if (!mp || mp->msg_magic != MSG_MAGIC)
return (ENXIO);
return (sysctl_rdstruct(oldp, oldlenp, newp, mp,