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

gh-112970: Detect and use closefrom() on platforms where it is available#112969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
Use :c:func:`!closefrom` on Linux where available (e.g. glibc-2.34), rather than only FreeBSD.
6 changes: 3 additions & 3 deletionsPython/fileutils.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2878,9 +2878,9 @@ _Py_GetLocaleconvNumeric(struct lconv *lc,
* non-opened fd in the middle.
* 2b. If fdwalk(3) isn't available, just do a plain close(2) loop.
*/
#ifdef__FreeBSD__
#ifdefHAVE_CLOSEFROM
# define USE_CLOSEFROM
#endif /*__FreeBSD__ */
#endif /*HAVE_CLOSEFROM */

#ifdef HAVE_FDWALK
# define USE_FDWALK
Expand DownExpand Up@@ -2922,7 +2922,7 @@ _Py_closerange(int first, int last)
#ifdef USE_CLOSEFROM
if (last >= sysconf(_SC_OPEN_MAX)) {
/* Any errors encountered while closing file descriptors are ignored */
closefrom(first);
(void)closefrom(first);
}
else
#endif /* USE_CLOSEFROM */
Expand Down
6 changes: 6 additions & 0 deletionsconfigure
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

2 changes: 1 addition & 1 deletionconfigure.ac
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4743,7 +4743,7 @@ fi

# checks for library functions
AC_CHECK_FUNCS([ \
accept4 alarm bind_textdomain_codeset chmod chown clock close_range confstr \
accept4 alarm bind_textdomain_codeset chmod chown clockclosefromclose_range confstr \
copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
Expand Down
3 changes: 3 additions & 0 deletionspyconfig.h.in
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -157,6 +157,9 @@
/* Define to 1 if you have the `clock_settime' function. */
#undef HAVE_CLOCK_SETTIME

/* Define to 1 if you have the `closefrom' function. */
#undef HAVE_CLOSEFROM

/* Define to 1 if you have the `close_range' function. */
#undef HAVE_CLOSE_RANGE

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp