Fix sys-queue.h conflict for good
Problem: Our file sys-queue.h is a copy of the BSD file, but there are
some additions and it's not entirely compatible. Because of that, there have
been conflicts with system headers on BSD systems. Some hacks have been
introduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,
f40d753718c72693c5f520f0d9899f6e50395e94,
96555a96d724016e13190b28cffa3bc929ac60dc and
3990d09adf4463eca200ad964cc55643c33feb50 but the fixes were fragile.
Solution: Avoid the conflict entirely by renaming the functions and the
file. Revert the previous hacks.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 4f04b98..10d4781 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1844,7 +1844,7 @@
/* Here is the structure in which status of each thread is captured. */
struct elf_thread_status {
- TAILQ_ENTRY(elf_thread_status) ets_link;
+ QTAILQ_ENTRY(elf_thread_status) ets_link;
struct target_elf_prstatus prstatus; /* NT_PRSTATUS */
#if 0
elf_fpregset_t fpu; /* NT_PRFPREG */
@@ -1860,7 +1860,7 @@
struct target_elf_prstatus *prstatus; /* NT_PRSTATUS */
struct target_elf_prpsinfo *psinfo; /* NT_PRPSINFO */
- TAILQ_HEAD(thread_list_head, elf_thread_status) thread_list;
+ QTAILQ_HEAD(thread_list_head, elf_thread_status) thread_list;
#if 0
/*
* Current version of ELF coredump doesn't support
@@ -1878,11 +1878,11 @@
abi_ulong vma_start; /* start vaddr of memory region */
abi_ulong vma_end; /* end vaddr of memory region */
abi_ulong vma_flags; /* protection etc. flags for the region */
- TAILQ_ENTRY(vm_area_struct) vma_link;
+ QTAILQ_ENTRY(vm_area_struct) vma_link;
};
struct mm_struct {
- TAILQ_HEAD(, vm_area_struct) mm_mmap;
+ QTAILQ_HEAD(, vm_area_struct) mm_mmap;
int mm_count; /* number of mappings */
};
@@ -1962,7 +1962,7 @@
return (NULL);
mm->mm_count = 0;
- TAILQ_INIT(&mm->mm_mmap);
+ QTAILQ_INIT(&mm->mm_mmap);
return (mm);
}
@@ -1972,7 +1972,7 @@
struct vm_area_struct *vma;
while ((vma = vma_first(mm)) != NULL) {
- TAILQ_REMOVE(&mm->mm_mmap, vma, vma_link);
+ QTAILQ_REMOVE(&mm->mm_mmap, vma, vma_link);
qemu_free(vma);
}
qemu_free(mm);
@@ -1990,7 +1990,7 @@
vma->vma_end = end;
vma->vma_flags = flags;
- TAILQ_INSERT_TAIL(&mm->mm_mmap, vma, vma_link);
+ QTAILQ_INSERT_TAIL(&mm->mm_mmap, vma, vma_link);
mm->mm_count++;
return (0);
@@ -1998,12 +1998,12 @@
static struct vm_area_struct *vma_first(const struct mm_struct *mm)
{
- return (TAILQ_FIRST(&mm->mm_mmap));
+ return (QTAILQ_FIRST(&mm->mm_mmap));
}
static struct vm_area_struct *vma_next(struct vm_area_struct *vma)
{
- return (TAILQ_NEXT(vma, vma_link));
+ return (QTAILQ_NEXT(vma, vma_link));
}
static int vma_get_mapping_count(const struct mm_struct *mm)
@@ -2328,7 +2328,7 @@
fill_note(&ets->notes[0], "CORE", NT_PRSTATUS, sizeof (ets->prstatus),
&ets->prstatus);
- TAILQ_INSERT_TAIL(&info->thread_list, ets, ets_link);
+ QTAILQ_INSERT_TAIL(&info->thread_list, ets, ets_link);
info->notes_size += note_size(&ets->notes[0]);
}
@@ -2343,7 +2343,7 @@
(void) memset(info, 0, sizeof (*info));
- TAILQ_INIT(&info->thread_list);
+ QTAILQ_INIT(&info->thread_list);
info->notes = qemu_mallocz(NUMNOTES * sizeof (struct memelfnote));
if (info->notes == NULL)
@@ -2389,9 +2389,9 @@
{
struct elf_thread_status *ets;
- while (!TAILQ_EMPTY(&info->thread_list)) {
- ets = TAILQ_FIRST(&info->thread_list);
- TAILQ_REMOVE(&info->thread_list, ets, ets_link);
+ while (!QTAILQ_EMPTY(&info->thread_list)) {
+ ets = QTAILQ_FIRST(&info->thread_list);
+ QTAILQ_REMOVE(&info->thread_list, ets, ets_link);
qemu_free(ets);
}