Hi,
Slightly puzzling phenomenon writing via RFIO into RAL CASTOR.
Trivial code fragment 'A' below works as expected (i.e. produces a
large junk file in CASTOR); code fragment 'B', using the unwrapped
open()/write() calls, always produces a zero-length file. An RFIO
client-side trace indicates that the same transactions are happening
in both cases.
Any ideas? Have I misunderstood the CASTOR API?
Cheers,
Dave
'A':
if(NULL==(f=rfio_fopen(CASTOR_BASEDIR "/testfile_0_t", "w"))){
rfio_perror("c_wr: rfio_open");
exit(1);
}
for(i=0;i<bs;i++){
*(buf+i)=i;
}
for(i=0;i<nblk;i++){
if(1!=rfio_fwrite(buf, bs, 1, f)){
rfio_perror("c_wr: rfio_write");
exit(1);
}
printf("%d\n",bs);
fflush(stdout);
}
printf("\n");
if(0!=rfio_fclose(f)){
rfio_perror("c_wr: rfio_close");
exit(1);
}
'B':
if(0>(fd=rfio_open(CASTOR_BASEDIR "/testfile_0_c", O_RDWR|O_CREAT,
0777))){
rfio_perror("c_wr: rfio_open");
exit(1);
}
for(i=0;i<bs;i++){
*(buf+i)=i;
}
for(i=0;i<nblk;i++){
if(bs!=rfio_write(fd, buf, bs)){
rfio_perror("c_wr: rfio_write");
exit(1);
}
printf("%d\n",bs);
fflush(stdout);
}
printf("\n");
if(0!=rfio_close(fd)){
rfio_perror("c_wr: rfio_close");
exit(1);
}
|