From nobody@FreeBSD.org  Sun Apr  1 00:14:46 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 0D8C9106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  1 Apr 2012 00:14:46 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id ECA7D8FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  1 Apr 2012 00:14:45 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q310EjFu031238
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 1 Apr 2012 00:14:45 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q310EjgF031237;
	Sun, 1 Apr 2012 00:14:45 GMT
	(envelope-from nobody)
Message-Id: <201204010014.q310EjgF031237@red.freebsd.org>
Date: Sun, 1 Apr 2012 00:14:45 GMT
From: Gary Palmer <freebsd-gnats@in-addr.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Mismatch in ifdefs can cause problems for /sys/kern/sysv_shm.c
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         166548
>Category:       kern
>Synopsis:       [build] [patch] Mismatch in ifdefs can cause problems for /sys/kern/sysv_shm.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    eadler
>State:          analyzed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 01 00:20:12 UTC 2012
>Closed-Date:    
>Last-Modified:  Tue Oct 16 23:10:36 UTC 2012
>Originator:     Gary Palmer
>Release:        FreeBSD 8.3-RC2
>Organization:
>Environment:
>Description:
While upgrading an old 7.x kern config file to 8.x I stumbled across a problem
where if you leave COMPAT_43 in your config file without one of COMPAT_FREEBSD4
through COMPAT_FREEBSD7 the compile breaks.  The problem comes from
/sys/sys/ipc.h where ipc_perm_old is only defined if one of 

#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
    defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)

is true.  However in /sys/kern/sysv_shm.c the code has

#if defined(__i386__) && (defined(COMPAT_FREEBSD4) || defined(COMPAT_43))
struct oshmid_ds {
        struct  ipc_perm_old shm_perm;  /* operation perms */


So if you put COMPAT_43 in your config file and leave out one of the
COMPAT_FREEBSD options ipc_perm_old isn't defined.  It seems that COMPAT_43
should probably be added to the ifdef conditionals in /sys/sys/ipc.h
>How-To-Repeat:
Remove

options         COMPAT_FREEBSD4
options         COMPAT_FREEBSD5
options         COMPAT_FREEBSD6
options         COMPAT_FREEBSD7

from a kernel config file on i386 but leave 

options         COMPAT_43

in
>Fix:
Untested, but I suspect modifying the code at line 72 of /sys/sys/ipc.h would fix it.  Something like:

#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
    defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) ||
    defined(COMPAT_43)



>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->eadler 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Tue Jun 19 06:53:32 UTC 2012 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=166548 
State-Changed-From-To: open->analyzed 
State-Changed-By: eadler 
State-Changed-When: Tue Oct 16 23:10:35 UTC 2012 
State-Changed-Why:  
awaiting approval or review prior to commit (no action needed from 
submitter) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=166548 
>Unformatted:
