|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: Nov 2000
Messaggi: 342
|
Sendfile [EINVAL]
Ciao a tutti,
stavo provando la sendfile confrontando i tempi di trasferiemtno di un file rispetto alla copia "normale" (prima copia in un buffer e poi nel file di destinazione) ma la sendfile mi ritorna EINVAL. Questo è il codice incrimnato: Codice:
int main (int argc, char* argv[]) { int read_fd; int write_fd; struct stat stat_buf; off_t offset = 0; /* Open the input file. */ read_fd = open (argv[1], O_RDONLY); /* Stat the input file to obtain its size. */ fstat (read_fd, &stat_buf); /* Open the ouput file for writing, with the same permissions as the source file. */ write_fd = open (argv[2], O_WRONLY | O_CREAT, stat_buf.st_mode); /* Blast the bytes from one file to the other. */ if (sendfile (write_fd, read_fd, &offset, stat_buf.st_size) < 0) { if (errno == EBADF) printf("EBADF\n"); if (errno == EAGAIN) printf("EAGAIN\n"); if (errno == EINVAL) printf("EINVAL\n"); if (errno == ENOMEM) printf("ENOMEM\n"); if (errno == EIO) printf("EIO\n"); if (errno == EFAULT) printf("EFAULT\n"); perror("ERROR"); } /* Close up. */ close (read_fd); close (write_fd); return 0; } Ciao Arpeda
__________________
Membro di HWU Scout Group || Quello che ieri era fantascienza oggi è realtà, quello che oggi è realtà domani sarà solo un ricordo ... Powered by Gentoo 1.4 on kernel 2.6.12.-gentoo-r4 |
![]() |
![]() |
![]() |
#2 | |
Senior Member
Iscritto dal: Apr 2000
Città: Roma
Messaggi: 15625
|
Quote:
Spostato in programmazione.
__________________
0: or %edi, %ecx; adc %eax, (%edx); popf; je 0b-22; pop %ebx; fadds 0x56(%ecx); lds 0x56(%ebx), %esp; mov %al, %al andeqs pc, r1, #147456; blpl 0xff8dd280; ldrgtb r4, [r6, #-472]; addgt r5, r8, r3, ror #12 |
|
![]() |
![]() |
![]() |
#3 |
Senior Member
Iscritto dal: Nov 2000
Messaggi: 342
|
Grazie della risposta, ma sai anche il perchè di questo cambiamento? esiste una chiamata per copiare un file nel 2.6 come faceva la sendfile?
Ciao Arpeda
__________________
Membro di HWU Scout Group || Quello che ieri era fantascienza oggi è realtà, quello che oggi è realtà domani sarà solo un ricordo ... Powered by Gentoo 1.4 on kernel 2.6.12.-gentoo-r4 |
![]() |
![]() |
![]() |
#4 |
Senior Member
Iscritto dal: Apr 2000
Città: Roma
Messaggi: 15625
|
Non sono sicuro, dicevo mi sembra. Può darsi che ci sia stato un cambiamento diverso, è passato tempo da quando l'ho letto.
Potresti provare su diversi tipi di file system?
__________________
0: or %edi, %ecx; adc %eax, (%edx); popf; je 0b-22; pop %ebx; fadds 0x56(%ecx); lds 0x56(%ebx), %esp; mov %al, %al andeqs pc, r1, #147456; blpl 0xff8dd280; ldrgtb r4, [r6, #-472]; addgt r5, r8, r3, ror #12 |
![]() |
![]() |
![]() |
#5 |
Senior Member
Iscritto dal: Apr 2000
Città: Roma
Messaggi: 15625
|
Mumble...potrebbe anche essere legato alla modifica introdotta nel kernel 2.5.26:
http://marc.theaimsgroup.com/?l=linu...6434527726&w=2 Prova su diversi file system, vediamo che succede.
__________________
0: or %edi, %ecx; adc %eax, (%edx); popf; je 0b-22; pop %ebx; fadds 0x56(%ecx); lds 0x56(%ebx), %esp; mov %al, %al andeqs pc, r1, #147456; blpl 0xff8dd280; ldrgtb r4, [r6, #-472]; addgt r5, r8, r3, ror #12 |
![]() |
![]() |
![]() |
#6 |
Senior Member
Iscritto dal: Nov 2000
Messaggi: 342
|
io l'ho provato su reiserfs, ora chiedo anche ad alcuni miei amici che hanno ext3 e vediamo che succede ... il kernel che ho usato è 2.6.5-gentoo-r1
Ciao Arpeda
__________________
Membro di HWU Scout Group || Quello che ieri era fantascienza oggi è realtà, quello che oggi è realtà domani sarà solo un ricordo ... Powered by Gentoo 1.4 on kernel 2.6.12.-gentoo-r4 |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 21:50.