Bug 382034 - Testcases build fixes for musl

This commit is contained in:
Paul Floyd 2023-01-27 08:42:06 +01:00
parent dee222c6e8
commit f7e4bb4af2
4 changed files with 18 additions and 2 deletions

1
NEWS
View File

@ -78,6 +78,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
170510 Don't warn about ioctl of size 0 without direction hint
241072 List tools in --help output
327548 false positive while destroying mutex
382034 Testcases build fixes for musl
351857 confusing error message about valid command line option
392331 Spurious lock not held error from inside pthread_cond_timedwait
400793 pthread_rwlock_timedwrlock false positive

View File

@ -12,6 +12,10 @@
#include <sys/types.h>
#include <sys/mman.h>
#ifndef __THROW
#define __THROW
#endif
// Since we use vki_unistd.h, we can't include <unistd.h>. So we have to
// declare this ourselves.
extern long int syscall (long int __sysno, ...) __THROW;

View File

@ -11,6 +11,10 @@
#include <sys/types.h>
#include <sys/mman.h>
#ifndef __THROW
#define __THROW
#endif
// Since we use vki_unistd.h, we can't include <unistd.h>. So we have to
// declare this ourselves.
extern long int syscall (long int __sysno, ...) __THROW;

View File

@ -2,6 +2,8 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "../../../config.h"
/* Stuff from Wine. */
@ -52,14 +54,19 @@ inline static unsigned int wine_ldt_get_limit( const LDT_ENTRY *ent )
/* our copy of the ldt */
LDT_ENTRY ldt_copy[8192];
#if defined(MUSL_LIBC)
#define MODIFY_LDT(func, ptr, bytecount) syscall(SYS_modify_ldt, (func), (ptr), (bytecount) );
#else
#define MODIFY_LDT(func, ptr, bytecount) __modify_ldt((func), (ptr), (bytecount) );
/* System call to set LDT entry. */
//extern int __modify_ldt (int, struct modify_ldt_ldt_s *, size_t);
extern int __modify_ldt (int, void *, size_t);
#endif
void print_ldt ( void )
{
int res;
res = __modify_ldt( 0, ldt_copy, 8192*sizeof(LDT_ENTRY) );
res = MODIFY_LDT( 0, ldt_copy, 8192*sizeof(LDT_ENTRY) );
printf("got %d bytes\n", res );
perror("error is");
}
@ -102,7 +109,7 @@ void set_ldt1 ( void* base )
ldt_entry.read_exec_only = 0;
ldt_entry.limit_in_pages = 0;
ldt_entry.seg_not_present = 0;
stat = __modify_ldt (1, &ldt_entry, sizeof (ldt_entry));
stat = MODIFY_LDT (1, &ldt_entry, sizeof (ldt_entry));
printf("stat = %d\n", stat);
}