From: Yoran Heling <info@yorhel.nl>
To: musl@lists.openwall.com
Subject: Bug with fcntl() on mipsel
Date: Wed, 8 Aug 2012 14:46:20 +0200 [thread overview]
Message-ID: <CADL1CPh9f+RyJRppk0xTGcpNOJ1k-T4h-cjCZndA77EgUocqOg@mail.gmail.com> (raw)
Hi,
I've been playing around a bit with the mips support in the new 0.9.3
release, but stumbled upon something that looks like a bug. This is on
debian-mipsel 6.0.5 running within qemu. The problem is with the
fcntl64() call, visible in the strace output below. It looks like
anything after the first argument is garbage.
Yoran.
$ cat test.c
#include <fcntl.h>
#include <unistd.h>
#include <assert.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
int main() {
int fd = open("some_random_file", O_RDWR|O_CREAT, 0600);
assert(fd > 0);
struct flock lck;
lck.l_type = F_WRLCK;
lck.l_whence = SEEK_SET;
lck.l_start = 0;
lck.l_len = 0;
int r = fcntl(fd, F_SETLK, &lck);
printf("fcntl() = %d, errno = %d, strerror = %s\n", r, errno,
strerror(errno));
}
$ musl-gcc -static -D_FILE_OFFSET_BITS=64 test.c -o test-musl
$ gcc -D_FILE_OFFSET_BITS=64 test.c -o test-native
$ strace ./test-musl
execve("./test-musl", ["./test-musl"], [/* 14 vars */]) = 0
open("some_random_file", O_RDWR|O_CREAT|O_LARGEFILE, 0600) = 3
fcntl64(3, 0xd /* F_??? */, 0x7f901390) = -1 EINVAL (Invalid argument)
ioctl(1, TIOCNXCL, 0x7f900ea0) = -1 ENOTTY (Inappropriate
ioctl for device)
writev(1, [{"fcntl() = -1, errno = 22, strerr"..., 53}, {"\n", 1}],
2fcntl() = -1, errno = 22, strerror = Invalid argument
) = 54
exit_group(54) = ?
stdout: fcntl() = -1, errno = 22, strerror = Invalid argument
$ strace ./test-native
execve("./test-native", ["./test-native"], [/* 14 vars */]) = 0
[...snip some ld.so loading and memory stuff..]
open("some_random_file", O_RDWR|O_CREAT|O_LARGEFILE, 0600) = 3
fcntl64(3, F_SETLK64, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0},
0x7fb74398) = 0
fstat64(1, {st_mode=S_IFREG|0644, st_size=1942, ...}) = 0
old_mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0x2ac5e000
write(1, "fcntl() = 0, errno = 0, strerror"..., 43fcntl() = 0, errno =
0, strerror = Success
) = 43
exit_group(43) = ?
stdout: fcntl() = 0, errno = 0, strerror = Success
next reply other threads:[~2012-08-08 12:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-08 12:46 Yoran Heling [this message]
2012-08-08 12:51 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADL1CPh9f+RyJRppk0xTGcpNOJ1k-T4h-cjCZndA77EgUocqOg@mail.gmail.com \
--to=info@yorhel.nl \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).