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.
See also bug #90939.
"man quotactl" says to include only <linux/quota.h>. Where do you see a need to include <sys/quota.h>?
Even though "man quatactl" says include only <linux/quota.h> it does not compile until I make the above change.
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.
You should avoid including both linux and glibc headers.