+2019-08-08 Martin Liska <mliska@suse.cz>
+
+ PR bootstrap/91352
+ * gcc.c (driver::detect_jobserver): Use is_valid_fd.
+ * lto-wrapper.c (jobserver_active_p): Likewise.
+
2019-08-08 Martin Liska <mliska@suse.cz>
* cgraphclones.c (set_new_clone_decl_and_node_flags): Drop
= (sscanf (n + strlen (needle), "%d,%d", &rfd, &wfd) == 2
&& rfd > 0
&& wfd > 0
- && fcntl (rfd, F_GETFD) >= 0
- && fcntl (wfd, F_GETFD) >= 0);
+ && is_valid_fd (rfd)
+ && is_valid_fd (wfd));
/* Drop the jobserver if it's not working now. */
if (!jobserver)
return (sscanf (n + strlen (needle), "%d,%d", &rfd, &wfd) == 2
&& rfd > 0
&& wfd > 0
- && fcntl (rfd, F_GETFD) >= 0
- && fcntl (wfd, F_GETFD) >= 0);
+ && is_valid_fd (rfd)
+ && is_valid_fd (wfd));
}
/* Execute gcc. ARGC is the number of arguments. ARGV contains the arguments. */
+2019-08-08 Martin Liska <mliska@suse.cz>
+
+ PR bootstrap/91352
+ * libiberty.h (is_valid_fd): New function.
+
2019-07-18 Eduard-Mihai Burtescu <eddyb@lyken.rs>
* demangle.h (rust_is_mangled): Move to libiberty/rust-demangle.h.
extern char *lrealpath (const char *);
+/* Return true when FD file descriptor exists. */
+
+extern int is_valid_fd (int fd);
+
/* Concatenate an arbitrary number of strings. You must pass NULL as
the last argument of this function, to terminate the list of
strings. Allocates memory using xmalloc. */
+2019-08-08 Martin Liska <mliska@suse.cz>
+
+ PR bootstrap/91352
+ * lrealpath.c (is_valid_fd): New function.
+
2019-07-24 Martin Liska <mliska@suse.cz>
PR lto/91228
#ifdef HAVE_STRING_H
#include <string.h>
#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
/* On GNU libc systems the declaration is only visible with _GNU_SOURCE. */
#if defined(HAVE_CANONICALIZE_FILE_NAME) \
/* This system is a lost cause, just duplicate the filename. */
return strdup (filename);
}
+
+/* Return true when FD file descriptor exists. */
+
+int
+is_valid_fd (int fd)
+{
+#if defined(_WIN32)
+ HANDLE h = (HANDLE) _get_osfhandle (fd);
+ return h != (HANDLE) -1;
+#else
+ return fcntl (fd, F_GETFD) >= 0;
+#endif
+}