Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 74520 - when compiling programs to use quotactl no compile possible because of conflicting structs in quota.h headers
when compiling programs to use quotactl no compile possible because of confli...
Product: Red Hat Linux
Classification: Retired
Component: glibc-kernheaders (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2002-09-25 18:21 EDT by John Wiggins
Modified: 2007-04-18 12:46 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-07 09:23:33 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description John Wiggins 2002-09-25 18:21:26 EDT
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:

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)

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

Actual Results:  /usr/include/linux/quota.h:194: redefinition of `struct 
/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
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 18:03:19 EDT
See also bug #90939.
Comment 2 John Dalbec 2003-07-10 09:45:31 EDT
"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 13:21:46 EDT
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 13:49:36 EDT
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
Comment 5 Jakub Jelinek 2004-10-07 09:23:33 EDT
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.