if (pid != -1)
{
- int ret = gdb::handle_eintr (-1, ::waitpid, pid, &status, 0);
+ int ret = gdb::waitpid (pid, &status, 0);
if (ret == -1)
perror_with_name ("Cannot get status of shell command");
}
int
my_waitpid (int pid, int *status, int flags)
{
- return gdb::handle_eintr (-1, ::waitpid, pid, status, flags);
+ return gdb::waitpid (pid, status, flags);
}
int options = (target_options & TARGET_WNOHANG) ? WNOHANG : 0;
pid_t pid
- = gdb::handle_eintr (-1, ::waitpid, ptid.pid (), &status, options);
+ = gdb::waitpid (ptid.pid (), &status, options);
if (pid == -1)
perror_with_name (_("Child process unexpectedly missing"));
return -1;
int status;
- if (gdb::handle_eintr (-1, ::waitpid, pid, &status, 0) == -1)
+ if (gdb::waitpid (pid, &status, 0) == -1)
return -1;
mourn (process);
return 0;
static bool
elf_64_file_p (const char *file)
{
- int fd = gdb::handle_eintr (-1, ::open, file, O_RDONLY);
+ int fd = gdb::open (file, O_RDONLY);
if (fd < 0)
perror_with_name (("open"));
Elf64_Ehdr header;
- ssize_t ret = gdb::handle_eintr (-1, ::read, fd, &header, sizeof (header));
+ ssize_t ret = gdb::read (fd, &header, sizeof (header));
if (ret == -1)
perror_with_name (("read"));
- gdb::handle_eintr (-1, ::close, fd);
+ gdb::close (fd);
if (ret != sizeof (header))
error ("Cannot read ELF file header: %s", file);
#define GDBSUPPORT_EINTR_H
#include <cerrno>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
namespace gdb
{
return ret;
}
+inline pid_t
+waitpid (pid_t pid, int *wstatus, int options)
+{
+ return gdb::handle_eintr (-1, ::waitpid, pid, wstatus, options);
+}
+
+inline int
+open (const char *pathname, int flags)
+{
+ return gdb::handle_eintr (-1, ::open, pathname, flags);
+}
+
+inline int
+close (int fd)
+{
+ return gdb::handle_eintr (-1, ::close, fd);
+}
+
+inline ssize_t
+read (int fd, void *buf, size_t count)
+{
+ return gdb::handle_eintr (-1, ::read, fd, buf, count);
+}
+
} /* namespace gdb */
#endif /* GDBSUPPORT_EINTR_H */