pwrite failed on emulator and HTC G1, errno is -EFBIG

by ZhangJieJing » Wed, 05 Aug 2009 18:07:35 GMT


Sponsored Links
 Hi, all:

Does anyone have pwirte failed on android?
I've write a small test program, to test pwrite behavior on android emulator
and HTC G1,

but it's cann't call twice correctly.  the return errno is EFBIG, but i only
write 1024 B to a file.

I cann't figure out why  this happens, please help me. thank you...

this is my test program:


#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>

static void
usage(const char *s)
{
    fprintf(stderr, "USAGE: %s SECONDS\n", s);
    exit(-1);
}

int main(int argc, char *argv[])
{

        int fd;
        char buf[8777];
        ssize_t  total_in = 0;
        ssize_t  max_write = 0x2 << 20; /* 2 * * M */

        if (argc > 2)
                usage("test_p filepath");

        fd = open(argv[1], O_RDWR | O_CREAT, 0666);
        if (fd < 0) {
                perror(" open error");
                exit(-1);
        }
        ssize_t ret = 0;

        do {
                ret = pwrite(fd, (void*)buf, 1024, total_in);
                printf("Pwirte: ret: %d errnos:%d \n", ret, errno);
                if (ret > 0) total_in += ret;
        } while ((ret >0 && total_in < max_write) || errno == EINTR);

        close(fd);
        printf(" finish: total_write : %d K", total_in >> 10);

        return 0;
}



On the emulator and HTC G1 both have same out come:
I've test it at every file system on the emulator and G1.

the Log :

# ./test_p /sqlite_stmt_journals/aaa
Pwirte: ret: 1024 errnos:0
Pwirte: ret: -1 errnos:27
 finish: total_write : 1 K#
#

# ./test_p /cache/sss
Pwirte: ret: -1 errnos:27
 finish: total_write : 0 K#


The df command :
# df
/dev: 49484K total, 0K used, 49484K available (block size 4096)
/sqlite_stmt_journals: 4096K total, 12K used, 4084K available (block size
4096)
/system: 69120K total, 68436K used, 684K available (block size 4096)
/data: 76544K total, 39424K used, 37120K available (block size 4096)
/cache: 69120K total, 20884K used, 48236K available (block size 4096)
/sdcard: 991488K total, 918256K used, 73232K available (block size 16384)


---
Best regards,
Zhang Jiejing

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. animated gif over all other elements on the desktop screen.

HI

Is it possible, i want to set an animated gif over all other elements
on the desktop screen.
If it possible how can i do this this ......

thanks a lot in advance...
--~--~---------~--~----~------------~-------~--~----~

2. UEvent in linux kernel

Hi all

Recently I've encountered that the UEvent cannot be received by
OnEvent from Java layer after upgrading the AT CMD server (atcmdsrv).
And that result in the BatteryService is out of function.

Since I thought UEvent is a standard framework in Linux kernel, so I
have no clue why this problem can be happened.

Can anyone tell me waht may be the reason??

BR
John

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. Helping for UEvent for Battery Service

4. About the NeighboringCellInfo information

5. Calling all Sydney/Australia Android Developers

6. is there any browser that could be used on Android?

7. Strange Proxy setting and INTERNET problem Emulator