bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

llseek() return value is different for ia32 and ppc.


From: R Sreelatha
Subject: llseek() return value is different for ia32 and ppc.
Date: Mon, 4 Feb 2002 10:33:01 +0530

Hello,
     The return value of the llseek() library call is different on ia32 and
powerpc architectures.
In the case of ia32 , the return value is the resulting offset value after
repositioning the offset of the file descriptor.
Whereas in the case of powerpc, upon successful completion, llseek returns
0.
On executing the below program( testcase.c)  on ia32 we get a return value
of 8000, whereas on powerpc the return value is 0.
I would like to know why is the behavior of llseek() different for ia32 and
powerpc architectures? Is this a bug in glibc ?

In the case of ia32, I see that in
/glibc-2.2.4/sysdeps/unix/sysv/linux/llseek.c file a wrapper (
INLINE_SYSCALL) is used which returns the "result" on success. Otherwise,
the return value of the system call _llseek() is inturn returned by the
llseek() library call.


/*testcase.c*/
/*******************************************************************************************/
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#define BUFSIZ 100
main()
{
    int fildes = 0;
    int ret = 0;

    if ((fildes = open("./tmpfile", O_RDWR | O_CREAT, 0644)) == -1)
        perror("open() failed");

  if ((ret = llseek(fildes, (loff_t)(80 * BUFSIZ), SEEK_SET)) == -1)
        perror("llseek() failed");

    printf("ret from llseek = %ld\n", ret);

}

/*******************************************************************************************/

thanks,
Sreelatha





reply via email to

[Prev in Thread] Current Thread [Next in Thread]