environmental information
$ dpkg -l|grep libc6-dev
ii libc6-dev:mips64el 2.28.12-1+eagle mips64el GNU C Library: Development Libraries and Header Files
Error message
~ltp/testcases/kernel/syscalls/ustat$ make
In file included from ../../../../include/tst_test.h:14,
from ustat01.c:9:
/usr/include/mips64el-linux-gnuabi64/bits/ustat.h:24:8: error: redefinition of ‘struct statfs’
struct ustat
^~~~~
It shows that the struct ustat is repeatedly defined.
analysis
In the normal environment, the struct ustat structure is not defined. If you want to use this structure, you need to define it yourself. LTP also provides a custom struct ustat structure
where lapi/ustat. H is defined as follows:
//SPDX-License-Identifier: GPL-2.0-or-later
#ifndef LAPI_USTAT_H__
#define LAPI_USTAT_H__
#include "config.h"
#include <sys/types.h>
#ifdef HAVE_SYS_USTAT_H
# include <sys/ustat.h>
#elif HAVE_LINUX_TYPES_H
# include <linux/types.h>
struct ustat {
__kernel_daddr_t f_tfree;
ino_t f_tinode;
char f_fname[6];
char f_fpack[6];
};
#endif
#endif /* LAPI_USTAT_H__ */
The header file in the test code contains lapi/ustat. H, so the test code is OK.
#include "config.h"
#include "tst_test.h"
#if defined(HAVE_SYS_USTAT_H) || defined(HAVE_LINUX_TYPES_H)
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "lapi/syscalls.h"
#include "lapi/ustat.h"
According to the error message, it is displayed in… /… /… /…/include/TST_ Test. H: line 14 of 14.
...
14 #include <unistd.h>
...
Line 14 is the header file unistd. H, which is the file of libc6 dev package
file content:
...
/* Move FD's file position to OFFSET bytes from the
beginning of the file (if WHENCE is SEEK_SET),
the current position (if WHENCE is SEEK_CUR),
or the end of the file (if WHENCE is SEEK_END).
Return the new file position. */
#define llseek lseek
#define ustat statfs
#ifndef __USE_FILE_OFFSET64
extern __off_t lseek (int __fd, __off_t __offset, int __whence) __THROW;
#else
...
There are macro definitions
#define ustat statfs
Simply replacing statfs with ustat leads to the problem of repeatedly defining struct ustat.
Conclusion
After investigation, unistd. H belongs to libc6 dev. the version installed in the current environment is 2.28.12-1 + eagle. These two macros are not added to unistd. H in 2.28.10 and 2.28.14.
#define llseek lseek
#define ustat statfs
It is speculated that UOS may have modified the source code of glibc. The record of adding these two macros in unistd. H was not found in the public glibc.
Read More:
- Vtk8.2.0 (32bit + 64bit) compilation and installation test (win10 + vs2017 + Qt5)
- Python normality test: test whether the data obey the normal distribution
- import org.junit.Test And @ test error reporting — solutions
- Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test)
- Idea ignores compilation errors and runs in eclipse compilation mode
- caffe deep learning [three] compilation error: fatal error: hdf5.h: No such file or directory compilation terminated.
- Maven skip unit test- maven.test.skip And skipstests
- Analysis of compilation errors of “error conflicting types for function”
- Found item Attr/circleRadius more than one time
- Something‘s wrong–perhaps a missing \item. \begin{thebibliography}{1}
- Wamp Apache can’t run error report could not execute menu item
- Error lnk2038 occurred during PCL code compilation: detected “error” during PCL code compilation_ ITERATOR_ DEBUG_ Mismatch of level: value ‘0’ does not match value ‘2’ solution
- Solve the problem: Something’s wrong–perhaps a missing \item. \end{thebibliography}
- Install wampserver and prompt could not execute menu item internal error
- Please transfer a valid prop path to form item!
- Serverlet: How to Add, Delete, Modify and Query item code
- Error lnk2038: detected “0”_ ITERATOR_ DEBUG_ The reason and solution of the unmatched item of “level”
- Type error: sequence item 0: expected STR instance, int found
- There is an error when idea creates a child item parent tag
- Windows 10 startup item repair an operating system was’t found solution