[#4673] pwrite64 has fake error info on blackfin
Submitted By: Mingquan Pan
Open Date
2008-11-26 21:45:35 Close Date
2008-12-02 03:39:57
Priority:
Medium Assignee:
Nobody
Status:
Closed Fixed In Release:
N/A
Found In Release:
N/A Release:
Category:
N/A Board:
N/A
Processor:
N/A Silicon Revision:
Is this bug repeatable?:
Yes Resolution:
Fixed
Uboot version or rev.:
Toolchain version or rev.:
Nov 11
App binary format:
N/A
Summary: pwrite64 has fake error info on blackfin
Details:
pwrite64 has fake error info on blackfin, and while this case is running on host, it is passed.
test@my-local-machine:~/checkouts/testsuites.1007/ltp/ltp-full-20071031/testcases/kernel/syscalls/pwrite64> bfin-uclinux-gcc -Wall -D__uClinux__ -Dlinux -mstack-check-l1 -DUCLINUX -I../../include -g -Wall -I../../../../include -Wall -Wl,-elf2flt="-s 32768" -static pwrite6401.c -L../../../../lib -lltp -o pwrite6401
pwrite6401.c: In function 'main':
pwrite6401.c:128: warning: implicit declaration of function 'pwrite64'
test@my-local-machine:~/checkouts/testsuites.1007/ltp/ltp-full-20071031/testcases/kernel/syscalls/pwrite64>
test@my-local-machine:~/checkouts/testsuites.1007/ltp/ltp-full-20071031/testcases/kernel/syscalls/pwrite64> rcp pwrite6401 root@10.100.4.50:/
On target:
root:/> ./pwrite6401
pwrite6401 1 FAIL : pwrite64() at offset 0 failed, errno=27 : File too large
root:/>
And make the same case using gcc:
test@my-local-machine:~/checkouts/testsuites.1007/ltp/ltp-full-20071031/testcases/kernel/syscalls/pwrite64> cd ../../../../lib/
test@my-local-machine:~/checkouts/testsuites.1007/ltp/ltp-full-20071031/lib>
test@my-local-machine:~/checkouts/testsuites.1007/ltp/ltp-full-20071031/lib> make clean;make
rm -f libltp.a dataascii.o databin.o datapid.o file_lock.o forker.o get_high_address.o open_flags.o parse_opts.o pattern.o random_range.o rmobj.o search_path.o self_exec.o string_to_tokens.o str_to_bytes.o tlibio.o tst_cwd_has_free.o tst_is_cwd_tmpfs.o tst_kvercmp.o tst_res.o tst_sig.o tst_tmpdir.o write_log.o
cc -I../include -Wall -c -o dataascii.o dataascii.c
cc -I../include -Wall -c -o databin.o databin.c
cc -I../include -Wall -c -o datapid.o datapid.c
cc -I../include -Wall -c -o file_lock.o file_lock.c
cc -I../include -Wall -c -o forker.o forker.c
cc -I../include -Wall -c -o get_high_address.o get_high_address.c
cc -I../include -Wall -c -o open_flags.o open_flags.c
cc -I../include -Wall -c -o parse_opts.o parse_opts.c
cc -I../include -Wall -c -o pattern.o pattern.c
cc -I../include -Wall -c -o random_range.o random_range.c
cc -I../include -Wall -c -o rmobj.o rmobj.c
cc -I../include -Wall -c -o search_path.o search_path.c
cc -I../include -Wall -c -o self_exec.o self_exec.c
cc -I../include -Wall -c -o string_to_tokens.o string_to_tokens.c
cc -I../include -Wall -c -o str_to_bytes.o str_to_bytes.c
cc -I../include -Wall -c -o tlibio.o tlibio.c
cc -I../include -Wall -c -o tst_cwd_has_free.o tst_cwd_has_free.c
cc -I../include -Wall -c -o tst_is_cwd_tmpfs.o tst_is_cwd_tmpfs.c
cc -I../include -Wall -c -o tst_kvercmp.o tst_kvercmp.c
cc -I../include -Wall -c -o tst_res.o tst_res.c
cc -I../include -Wall -c -o tst_sig.o tst_sig.c
cc -I../include -Wall -c -o tst_tmpdir.o tst_tmpdir.c
cc -I../include -Wall -c -o write_log.o write_log.c
ar -cr libltp.a dataascii.o databin.o datapid.o file_lock.o forker.o get_high_address.o open_flags.o parse_opts.o pattern.o random_range.o rmobj.o search_path.o self_exec.o string_to_tokens.o str_to_bytes.o tlibio.o tst_cwd_has_free.o tst_is_cwd_tmpfs.o tst_kvercmp.o tst_res.o tst_sig.o tst_tmpdir.o write_log.o
test@my-local-machine:~/checkouts/testsuites.1007/ltp/ltp-full-20071031/lib> cd -
/home/test/checkouts/testsuites.1007/ltp/ltp-full-20071031/testcases/kernel/syscalls/pwrite64
test@my-local-machine:~/checkouts/testsuites.1007/ltp/ltp-full-20071031/testcases/kernel/syscalls/pwrite64> gcc -I../../include -I../../../../include -static pwrite6401.c -L../../../../lib -lltp -o pwrite6401
test@my-local-machine:~/checkouts/testsuites.1007/ltp/ltp-full-20071031/testcases/kernel/syscalls/pwrite64>
test@my-local-machine:~/checkouts/testsuites.1007/ltp/ltp-full-20071031/testcases/kernel/syscalls/pwrite64> ./pwrite6401
pwrite6401 1 PASS : Functionality of pwrite64() successful
test@my-local-machine:~/checkouts/testsuites.1007/ltp/ltp-full-20071031/testcases/kernel/syscalls/pwrite64>
Follow-ups
--- Mingquan Pan 2008-11-28 03:28:54
Jie told me to add #define _LARGEFILE64_SOURCE 1 on the top of the source c
code.
And it works. But it is strange that in the
/opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime/usr/include/features.h,
it already defines:
# ifdef __UCLIBC_HAS_LFS__
# undef _LARGEFILE64_SOURCE
# define _LARGEFILE64_SOURCE 1
# endif /* __UCLIBC_HAS_LFS__ */
And we had alread enabled larget file support in uclibc.
It should include this macro already, but it isn't found actually.
--- Mike Frysinger 2008-11-28 04:11:15
that isnt how LFS works. uClibc itself having LFS doesnt affect the end
programs. you need to actually enable LFS flags if you want LFS functionality
in a specific application.
where are you getting pwrite64 ? i see no such subdir in current LTP cvs.
--- Mingquan Pan 2008-11-30 22:25:38
Yeah, I am trying to put in the pwrite64 cases into ltp based on pwrite cases.
The way to fix it is to add _GNU_SOURCE define so that it can find uclibc
definition and work out:
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif
--- Mike Frysinger 2008-11-30 23:08:45
so is it working now ?
--- Mingquan Pan 2008-12-02 03:39:57
It is found later in ltp that it use -D_FILE_OFFSET_BITS=64 on make command to
enable the pwrite64 syscall. It is more general and works too. So use this
definition and would fix in test case. Close.
Files
Changes
Commits
Dependencies
Duplicates
Associations
Tags
File Name File Type File Size Posted By
pwrite6401.c text/x-csrc 10444 Mingquan Pan