This repository was archived by the owner on Apr 13, 2019. It is now read-only.
Commit 6b6f93c
Michael Clark
linux-uxer/riscv - fix stat on riscv32 linux-user
riscv32 linux ABI is unique in that it has a 64-bit stat
structure on 32-bit vs seperate stat and stat64 syscalls.
Test program:
#include <stdlib.h>
int
main (void)
{
int fd = open ("tmp.file", O_CREAT|O_RDWR, S_IRWXU);
if (fd == -1) {
perror ("open failed");
exit (1);
}
struct stat buf;
int result = fstat (fd, &buf);
if (result == -1) {
perror ("fstat failed");
exit (1);
}
printf ("S_ISREG (buf.st_mode) = %d\n", S_ISREG (buf.st_mode));
return 0;
}
Expected results:
$ riscv32-unknown-linux-gnu-gcc -O2 stat.c -o stat
$ qemu-riscv32 stat
S_ISREG (buf.st_mode) = 1
Signed-off-by: Michael Clark <[email protected]>1 parent 2b5e1a7 commit 6b6f93c
1 file changed
+26
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1873 | 1873 | | |
1874 | 1874 | | |
1875 | 1875 | | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
1876 | 1901 | | |
1877 | | - | |
| 1902 | + | |
1878 | 1903 | | |
1879 | 1904 | | |
1880 | 1905 | | |
| |||
1901 | 1926 | | |
1902 | 1927 | | |
1903 | 1928 | | |
1904 | | - | |
1905 | 1929 | | |
1906 | 1930 | | |
1907 | 1931 | | |
| |||
1925 | 1949 | | |
1926 | 1950 | | |
1927 | 1951 | | |
1928 | | - | |
1929 | 1952 | | |
1930 | 1953 | | |
1931 | 1954 | | |
| |||
0 commit comments