mailing list of musl libc
 help / color / mirror / code / Atom feed
* Bug with fcntl() on mipsel
@ 2012-08-08 12:46 Yoran Heling
  2012-08-08 12:51 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: Yoran Heling @ 2012-08-08 12:46 UTC (permalink / raw)
  To: musl

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bug with fcntl() on mipsel
  2012-08-08 12:46 Bug with fcntl() on mipsel Yoran Heling
@ 2012-08-08 12:51 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2012-08-08 12:51 UTC (permalink / raw)
  To: musl

On Wed, Aug 08, 2012 at 02:46:20PM +0200, Yoran Heling wrote:
> 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.

Thanks for the report. I'll check it out. The problem is almost
certainly incorrect macros in bits/fcntl.h, so if anybody wants to
look at it before I get a chance and find out what's wrong, you're
welcome to.

Rich


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-08 12:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-08 12:46 Bug with fcntl() on mipsel Yoran Heling
2012-08-08 12:51 ` Rich Felker

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).