|
125 | 125 | # define HAVE_PWRITEV_RUNTIME __builtin_available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *) |
126 | 126 | # define HAVE_MKFIFOAT_RUNTIME __builtin_available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *) |
127 | 127 | # define HAVE_MKNODAT_RUNTIME __builtin_available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *) |
| 128 | +# define HAVE_PTSNAME_R_RUNTIME __builtin_available(macOS 10.13.4, iOS 11.3, tvOS 11.3, watchOS 4.3, *) |
128 | 129 |
|
129 | 130 | # define HAVE_POSIX_SPAWN_SETSID_RUNTIME __builtin_available(macOS 10.15, *) |
130 | 131 |
|
|
206 | 207 | # define HAVE_MKNODAT_RUNTIME (mknodat != NULL) |
207 | 208 | # endif |
208 | 209 |
|
| 210 | +# ifdef HAVE_PTSNAME_R |
| 211 | +# define HAVE_PTSNAME_R_RUNTIME (ptsname_r != NULL) |
| 212 | +# endif |
| 213 | + |
209 | 214 | #endif |
210 | 215 |
|
211 | 216 | #ifdef HAVE_FUTIMESAT |
|
231 | 236 | # define HAVE_PWRITEV_RUNTIME 1 |
232 | 237 | # define HAVE_MKFIFOAT_RUNTIME 1 |
233 | 238 | # define HAVE_MKNODAT_RUNTIME 1 |
| 239 | +# define HAVE_PTSNAME_R_RUNTIME 1 |
234 | 240 | #endif |
235 | 241 |
|
236 | 242 |
|
@@ -8656,7 +8662,12 @@ os_ptsname_impl(PyObject *module, int fd) |
8656 | 8662 | int ret; |
8657 | 8663 | char name[MAXPATHLEN+1]; |
8658 | 8664 |
|
8659 | | - ret = ptsname_r(fd, name, sizeof(name)); |
| 8665 | + if (HAVE_PTSNAME_R_RUNTIME) { |
| 8666 | + ret = ptsname_r(fd, name, sizeof(name)); |
| 8667 | + } |
| 8668 | + else { |
| 8669 | + ret = -1; |
| 8670 | + } |
8660 | 8671 | if (ret != 0) { |
8661 | 8672 | errno = ret; |
8662 | 8673 | return posix_error(); |
@@ -17751,6 +17762,9 @@ PROBE(probe_futimens, HAVE_FUTIMENS_RUNTIME) |
17751 | 17762 | PROBE(probe_utimensat, HAVE_UTIMENSAT_RUNTIME) |
17752 | 17763 | #endif |
17753 | 17764 |
|
| 17765 | +#ifdef HAVE_PTSNAME_R |
| 17766 | +PROBE(probe_ptsname_r, HAVE_PTSNAME_R_RUNTIME) |
| 17767 | +#endif |
17754 | 17768 |
|
17755 | 17769 |
|
17756 | 17770 |
|
@@ -17891,6 +17905,10 @@ static const struct have_function { |
17891 | 17905 | { "HAVE_UTIMENSAT", probe_utimensat }, |
17892 | 17906 | #endif |
17893 | 17907 |
|
| 17908 | +#ifdef HAVE_PTSNAME_R |
| 17909 | + { "HAVE_PTSNAME_R", probe_ptsname_r }, |
| 17910 | +#endif |
| 17911 | + |
17894 | 17912 | #ifdef MS_WINDOWS |
17895 | 17913 | { "MS_WINDOWS", NULL }, |
17896 | 17914 | #endif |
|
0 commit comments