Subject: Mismatched enums in include files
To: None <tech-kern@NetBSD.org>
From: D'Arcy J.M. Cain <darcy@NetBSD.org>
List: tech-kern
Date: 09/14/2003 08:00:58
In /usr/include/miscfs/kernfs/kernfs.h the kfstype enum looks like this:

typedef enum {
    Pkern,      /* the filesystem itself (.) */
    Proot,      /* the filesystem root (..) */
    Pnull,      /* none aplicable */
    Ptime,      /* boottime */
    Pint,       /* integer */
    Pstring,    /* string */
    Phostname,  /* hostname */
    Pavenrun,   /* loadavg */
    Pdevice,    /* device file (rootdev/rrootdev) */
    Pmsgbuf,    /* msgbuf */
    Pipsecsadir,    /* ipsec security association (top dir) */
    Pipsecspdir,    /* ipsec security policy (top dir) */
    Pipsecsa,   /* ipsec security association entry */
    Pipsecsp,   /* ipsec security policy entry */
} kfstype;

In /usr/include/miscfs/procfs/procfs.h the pfstype is this:

typedef enum {
    Proot,      /* the filesystem root */
    Pcurproc,   /* symbolic link for curproc */
    Pself,      /* like curproc, but this is the Linux name */
    Pproc,      /* a process-specific sub-directory */
    Pfile,      /* the executable file */
    Pmem,       /* the process's memory image */
    Pregs,      /* the process's register set */
    Pfpregs,    /* the process's FP register set */
    Pctl,       /* process control */
    Pstat,      /* process status (if -o linux) */
    Pstatus,    /* process status */
    Pnote,      /* process notifier */
    Pnotepg,    /* process group notifier */
    Pmap,       /* memory map */
    Pcmdline,   /* process command line args */
    Pmeminfo,   /* system memory info (if -o linux) */
    Pcpuinfo,   /* CPU info (if -o linux) */
    Pmaps,      /* memory map, Linux style (if -o linux) */
    Pfd,        /* a directory containing the processes open fd's */
    Puptime,    /* elapsed time since (if -o linux) */
#ifdef __HAVE_PROCFS_MACHDEP
    PROCFS_MACHDEP_NODE_TYPES
#endif
} pfstype;

As a result, if both files are included in a program (lsof is the one I am 
trying to compile)  "Proot" has conflicting definitions.  My experience with 
enums has been that you generally identify the value by prepending something 
to the elements.  For example, Proot can be KFS_root in one and PFS_root in 
the other.  Does this make sense to others?  How does anyone build lsof from 
the pkgsrc tree otherwise?

Note that this is with -current sources as of yesterday.

-- 
D'Arcy J.M. Cain <darcy@netbsd.org>
http://www.NetBSD.org/