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. Checkin service problem.

Hi,all:

Does anyone know android how to realize the "checkin" service next step?
Now, android only have a "FallbackCheckinService.cpp", it is a empty
structure, not include actual checkin realization.

-- 
Best Regards,
shentong


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

2. Question about calendar

I have just acquired a Android developer phone and I am based in
India. Here is what I see. If I enter an event on Google Calendar on
web then the reminder about the event comes 3 Hrs 30 Minutes before it
should happen. If the same event I enter on the phone then the
reminder is at the correct time.

The time zone on both (google calendar as well as phone) is set to IST
i.e. GMT+05:30. This looks like a too simple to be a bug. Has anybody
seen something similar?

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

3. How can I buy Android Dev Phone 1 鈩?in Ukraine?

4. UIQ now well out of the picture...

5. What happens to the database when app is "upgraded"

6. how to update apk's Jad file in run time

7. Is there anyway to rebuild the opencore shared library without rebuilding the whole source tree?