* procfs.c (procfs_wait): Losing Unixware can't do poll on /proc

files.  Use PIOCWSTOP instead.
* corelow.c (add_to_thread_list):  Fix arg to match prototype.
This commit is contained in:
Stu Grossman 1993-10-17 01:02:57 +00:00
parent 952a820e43
commit 7c5d526e1f
3 changed files with 82 additions and 53 deletions

View File

@ -1,5 +1,9 @@
Sat Oct 16 15:27:10 1993 Stu Grossman (grossman at cygnus.com)
* procfs.c (procfs_wait): Losing Unixware can't do poll on /proc
files. Use PIOCWSTOP instead.
* corelow.c (add_to_thread_list): Fix arg to match prototype.
* procfs.c (procfs_set_sproc_trap): Don't use this if sproc
isn't available.
* (procfs_notice_signals): Fix prototype.

View File

@ -84,12 +84,13 @@ solib_add_stub (from_tty)
list of threads in a core file. */
static void
add_to_thread_list (abfd, asect, reg_sect)
add_to_thread_list (abfd, asect, reg_sect_arg)
bfd *abfd;
asection *asect;
asection *reg_sect;
PTR reg_sect_arg;
{
int thread_id;
asection *reg_sect = reg_sect_arg;
if (strncmp (bfd_section_name (abfd, asect), ".reg/", 5) != 0)
return;

View File

@ -483,6 +483,24 @@ find_procinfo (pid, okfail)
/*
LOCAL MACRO
current_procinfo -- convert inferior_pid to a struct procinfo
SYNOPSIS
static struct procinfo * current_procinfo;
DESCRIPTION
Looks up inferior_pid in the procinfo chain. Always returns a
struct procinfo *. If process can't be found, we error() out.
*/
#define current_procinfo find_procinfo (inferior_pid, 0)
/*
LOCAL FUNCTION
add_fd -- Add the fd to the poll/select list
@ -540,23 +558,68 @@ remove_fd (pi)
}
}
/*
#define LOSING_POLL unixware_sux
LOCAL MACRO
static struct procinfo *
wait_fd ()
{
struct procinfo *pi;
int num_fds;
int i;
current_procinfo -- convert inferior_pid to a struct procinfo
if (attach_flag)
set_sigint_trap (); /* Causes SIGINT to be passed on to the
attached process. */
SYNOPSIS
#ifndef LOSING_POLL
num_fds = poll (poll_list, num_poll_list, -1);
#else
pi = current_procinfo;
static struct procinfo * current_procinfo;
if (ioctl (pi->fd, PIOCWSTOP, &pi->prstatus) < 0)
{
print_sys_errmsg (pi->pathname, errno);
error ("PIOCWSTOP failed");
}
#endif
if (attach_flag)
clear_sigint_trap();
DESCRIPTION
Looks up inferior_pid in the procinfo chain. Always returns a
struct procinfo *. If process can't be found, we error() out.
*/
#ifndef LOSING_POLL
#define current_procinfo find_procinfo (inferior_pid, 0)
if (num_fds <= 0)
{
print_sys_errmsg ("poll failed\n", errno);
error ("Poll failed, returned %d", num_fds);
}
for (i = 0; i < num_poll_list && num_fds > 0; i++)
{
if ((poll_list[i].revents & (POLLPRI|POLLERR|POLLHUP|POLLNVAL)) == 0)
continue;
for (pi = procinfo_list; pi; pi = pi->next)
{
if (poll_list[i].fd == pi->fd)
{
if (ioctl (pi->fd, PIOCSTATUS, &pi->prstatus) < 0)
{
print_sys_errmsg (pi->pathname, errno);
error ("PIOCSTATUS failed");
}
num_fds--;
pi->had_event = 1;
break;
}
}
if (!pi)
error ("procfs_wait: Couldn't find procinfo for fd %d\n",
poll_list[i].fd);
}
#endif /* LOSING_POLL */
return pi;
}
/*
@ -2163,46 +2226,7 @@ procfs_wait (pid, statloc)
wait_again:
if (!pi)
{
int num_fds;
int i;
if (attach_flag)
set_sigint_trap(); /* Causes SIGINT to be passed on to the
attached process. */
num_fds = poll (poll_list, num_poll_list, -1);
if (attach_flag)
clear_sigint_trap();
if (num_fds <= 0)
{
print_sys_errmsg (pi->pathname, errno);
error ("poll failed, returned %d\n", num_fds);
}
for (i = 0; i < num_poll_list && num_fds > 0; i++)
{
if ((poll_list[i].revents & (POLLPRI|POLLERR|POLLHUP|POLLNVAL)) == 0)
continue;
for (pi = procinfo_list; pi; pi = pi->next)
{
if (poll_list[i].fd == pi->fd)
{
if (ioctl (pi->fd, PIOCSTATUS, &pi->prstatus) < 0)
checkerr++;
/* perror_with_name (pi->pathname);*/
num_fds--;
pi->had_event = 1;
break;
}
}
if (!pi)
error ("procfs_wait: Couldn't find procinfo for fd %d\n",
poll_list[i].fd);
}
}
pi = wait_fd ();
if (pid != -1)
for (pi = procinfo_list; pi; pi = pi->next)