return (write (pi->ctl_fd, &arg, sizeof (arg)) == sizeof (arg));
}
-#if (defined(__i386__) || defined(__x86_64__)) && defined (sun)
-
-#include <sys/sysi86.h>
-
-/* The KEY is actually the value of the lower 16 bits of the GS
- register for the LWP that we're interested in. Returns the
- matching ssh struct (LDT entry). */
-
-static struct ssd *
-proc_get_LDT_entry (procinfo *pi, int key) /* ARI: editCase function */
-{
- static struct ssd *ldt_entry = NULL;
- char pathname[MAX_PROC_NAME_SIZE];
-
- /* Allocate space for one LDT entry.
- This alloc must persist, because we return a pointer to it. */
- if (ldt_entry == NULL)
- ldt_entry = XNEW (struct ssd);
-
- /* Open the file descriptor for the LDT table. */
- xsnprintf (pathname, sizeof (pathname), "/proc/%d/ldt", pi->pid);
- scoped_fd fd (open_with_retry (pathname, O_RDONLY));
- if (fd.get () < 0)
- {
- proc_warn (pi, "proc_get_LDT_entry (open)", __LINE__);
- return NULL;
- }
-
- /* Now 'read' thru the table, find a match and return it. */
- while (read (fd.get (), ldt_entry, sizeof (struct ssd))
- == sizeof (struct ssd))
- {
- if (ldt_entry->sel == 0
- && ldt_entry->bo == 0
- && ldt_entry->acc1 == 0
- && ldt_entry->acc2 == 0)
- break; /* end of table */
- /* If key matches, return this entry. */
- if (ldt_entry->sel == key)
- return ldt_entry;
- }
- /* Loop ended, match not found. */
- return NULL;
-}
-
-/* Returns the pointer to the LDT entry of PTID. */
-
-struct ssd *
-procfs_find_LDT_entry (ptid_t ptid) /* ARI: editCase function */
-{
- gdb_gregset_t *gregs;
- int key;
- procinfo *pi;
-
- /* Find procinfo for the lwp. */
- pi = find_procinfo (ptid.pid (), ptid.lwp ());
- if (pi == NULL)
- {
- warning (_("procfs_find_LDT_entry: could not find procinfo for %d:%ld."),
- ptid.pid (), ptid.lwp ());
- return NULL;
- }
- /* get its general registers. */
- gregs = proc_get_gregs (pi);
- if (gregs == NULL)
- {
- warning (_("procfs_find_LDT_entry: could not read gregs for %d:%ld."),
- ptid.pid (), ptid.lwp ());
- return NULL;
- }
- /* Now extract the GS register's lower 16 bits. */
- key = (*gregs)[GS] & 0xffff;
-
- /* Find the matching entry and return it. */
- return proc_get_LDT_entry (pi, key);
-}
-
-#endif
-
/* =============== END, non-thread part of /proc "MODULE" =============== */
/* =================== Thread "MODULE" =================== */