Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitda2cbcb

Browse files
committed
[Issue#394] fio_close is now synchronous
1 parent13a1821 commitda2cbcb

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

‎src/utils/file.c

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,15 @@ fio_close(int fd)
607607
fio_fdset &= ~(1 <<hdr.handle);
608608

609609
IO_CHECK(fio_write_all(fio_stdout,&hdr,sizeof(hdr)),sizeof(hdr));
610-
/* Note, that file is closed without waiting for confirmation */
610+
611+
/* Wait for response */
612+
IO_CHECK(fio_read_all(fio_stdin,&hdr,sizeof(hdr)),sizeof(hdr));
613+
614+
if (hdr.arg!=0)
615+
{
616+
errno=hdr.arg;
617+
return-1;
618+
}
611619

612620
return0;
613621
}
@@ -617,6 +625,22 @@ fio_close(int fd)
617625
}
618626
}
619627

628+
/* Close remote file implementation */
629+
staticvoid
630+
fio_close_impl(intfd,intout)
631+
{
632+
fio_headerhdr;
633+
634+
hdr.cop=FIO_CLOSE;
635+
hdr.arg=0;
636+
637+
if (close(fd)!=0)
638+
hdr.arg=errno;
639+
640+
/* send header */
641+
IO_CHECK(fio_write_all(out,&hdr,sizeof(hdr)),sizeof(hdr));
642+
}
643+
620644
/* Truncate stdio file */
621645
int
622646
fio_ftruncate(FILE*f,off_tsize)
@@ -3000,7 +3024,7 @@ fio_communicate(int in, int out)
30003024
IO_CHECK(fio_write_all(out,&hdr,sizeof(hdr)),sizeof(hdr));
30013025
break;
30023026
caseFIO_CLOSE:/* Close file */
3003-
SYS_CHECK(close(fd[hdr.handle]));
3027+
fio_close_impl(fd[hdr.handle],out);
30043028
break;
30053029
caseFIO_WRITE:/* Write to the current position in file */
30063030
//IO_CHECK(fio_write_all(fd[hdr.handle], buf, hdr.size), hdr.size);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp