Bug 74520 - when compiling programs to use quotactl no compile possible because of conflicting structs in quota.h headers
Summary: when compiling programs to use quotactl no compile possible because of confli...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc-kernheaders
Version: 7.3
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-09-25 22:21 UTC by John Wiggins
Modified: 2007-04-18 16:46 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-10-07 13:23:33 UTC
Embargoed:


Attachments (Terms of Use)

Description John Wiggins 2002-09-25 22:21:26 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)

Description of problem:
To compile a program that uses the quotactl function is not possible as 
<linux/quota.h> and <sys/quota.h> must be included but have a conflicting 
struct: dqstats

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. make a file as such: myquotaprogram.cpp

#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/quota.h>
#include <linux/quota.h>
// other headers as needed

int main(int argc, char* argv[], char *envp[])
{
   struct mem_dqblk info;
   long err = quotactl(QCMD(Q_GETQUOTA, USRQUOTA), "/dev/hda1", 500, (caddr_t)
&info);
}

2. try to compile this code and you get
gcc -c myquotaprogram.cpp -o theprogram.o
/usr/include/linux/quota.h:194: redefinition of `struct dqstats'
/usr/include/sys/quota.h:139: previous definition here
etc...

Actual Results:  /usr/include/linux/quota.h:194: redefinition of `struct 
dqstats'
/usr/include/sys/quota.h:139: previous definition here

Expected Results:  the program should compile

Additional info:

To stop this problem I commented out the dqstats struct in
/usr/include/sys/quota.h
as this is structure has one less member ( i.e. does not have the "version" 
member like <linux/quota.h> )

after this the program compiles and works as expected.

Comment 1 Petri T. Koistinen 2003-05-17 22:03:19 UTC
See also bug #90939.

Comment 2 John Dalbec 2003-07-10 13:45:31 UTC
"man quotactl" says to include only <linux/quota.h>.  Where do you see a need to
include <sys/quota.h>?

Comment 3 John Wiggins 2003-07-10 17:21:46 UTC
Even though "man quatactl" says include only <linux/quota.h> it does not compile
until I make the above change.

Comment 4 John Dalbec 2003-07-10 17:49:36 UTC
What I've done in a similar case is to include only <sys/quota.h> and then
redefine Q_GETQUOTA and any other stuff I need from <linux/quota.h> in the
source file.  This approach was especially useful when kernel 2.4.20 broke all
previous quotactl ABI's and I had to use definitions from
/usr/src/redhat/kernel-2.4.20/linux-2.4.20/include/linux/quota.h.

Comment 5 Jakub Jelinek 2004-10-07 13:23:33 UTC
You should avoid including both linux and glibc headers.


Note You need to log in before you can comment on or make changes to this bug.