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

Commit12ac252

Browse files
committed
Fix failure-to-read-man-page in commit899bd78.
posix_fallocate() is not quite a drop-in replacement for fallocate(),because it is defined to return the error code as its function result,not in "errno". I (tgl) missed this because RHEL6's version seemsto set errno as well. That is not the case on more modern Linuxen,though, as per buildfarm results.Aside from fixing the return-convention confusion, remove the testfor ENOSYS; we expect that glibc will mask that for posix_fallocate,though it does not for fallocate. Keep the test for EINTR, becausePOSIX specifies that as a possible result, and buildfarm resultssuggest that it can happen in practice.Back-patch to 9.4, like the previous commit.Thomas MunroDiscussion:https://postgr.es/m/1002664500.12301802.1471008223422.JavaMail.yahoo@mail.yahoo.com
1 parent1750612 commit12ac252

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

‎src/backend/storage/ipc/dsm_impl.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -425,17 +425,14 @@ dsm_impl_posix_resize(int fd, off_t size)
425425
do
426426
{
427427
rc=posix_fallocate(fd,0,size);
428-
}while (rc==-1&&errno==EINTR);
428+
}while (rc==EINTR);
429429

430-
if (rc!=0&&errno==ENOSYS)
431-
{
432-
/*
433-
* Kernel too old (< 2.6.23). Rather than fail, just trust that
434-
* we won't hit the problem (it typically doesn't show up without
435-
* many-GB-sized requests, anyway).
436-
*/
437-
rc=0;
438-
}
430+
/*
431+
* The caller expects errno to be set, but posix_fallocate() doesn't
432+
* set it. Instead it returns error numbers directly. So set errno,
433+
* even though we'll also return rc to indicate success or failure.
434+
*/
435+
errno=rc;
439436
}
440437
#endif/* HAVE_POSIX_FALLOCATE && __linux__ */
441438

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp