Bug 74520
| Summary: | when compiling programs to use quotactl no compile possible because of conflicting structs in quota.h headers | ||
|---|---|---|---|
| Product: | [Retired] Red Hat Linux | Reporter: | John Wiggins <wiggins1> |
| Component: | glibc-kernheaders | Assignee: | Jakub Jelinek <jakub> |
| Status: | CLOSED NOTABUG | QA Contact: | Brian Brock <bbrock> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.3 | CC: | jpdalbec, thoron |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | i386 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2004-10-07 13:23:33 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
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. |
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.