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. MPEG4 playback issue?

We have a clent that has videos online that stream... we are taking
the same videos an converting them to MPEG4 for mobile playback....
thhey work for fine for most of the phones that we tested except the
Andiod Phone?

Does anyone have any solutions... the test allowed audio playback but
the video was black?

Greg
Developer
--~--~---------~--~----~------------~-------~--~----~

2. Using Picasa Web Albums Data API in Android

Try this snippet.
If its wat u need go ahead..
otherwise post back with wat u require apart from this.
Intent temp = new Intent(Intent.ACTION_SEND);
  temp.setType("image/jpeg");
  temp.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
  temp.putExtra(Intent.EXTRA_STREAM, imageURI);
  temp.setComponent(new ComponentName(
  "com.google.android.apps.uploader",
  "com.google.android.apps.uploader.picasa.PicasaUploadActivity"));
  startActivityForResult(temp, 0);
since i did this long time ago, i sont remember the exact permissions
required...
<uses-permission android:name="android.permission.GET_ACCOUNTS"></
uses-permission>
<uses-permission
android:name="com.google.android.googleapps.permission.GOOGLE_AUTH"></uses-permission>
but its either both or one of the above...









-- 
Regards,
Sujay
Samuel Goldwyn<http://www.brainyquote.com/quotes/authors/s/samuel_goldwyn.html>
- "I'm willing to admit that I may not always be right, but I am never
wrong."

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

3. Lifecycle control of a surfaceviews surface

4. android SDK 1.5 where do i find the sqlite db file in my system

5. How can the permission exception happens?

6. Application spontaneous resets G1

7. Android emulator can't get correct resulotion when viewed http://picasaweb.google.com/m/viewer?source=androidclient