server: Use syscall(2) instead of inline assembly on Mac OS, too.
This commit is contained in:
parent
269fe5a4d4
commit
a51aaf898c
|
@ -29,6 +29,9 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#ifdef HAVE_SYS_SYSCALL_H
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "ntstatus.h"
|
#include "ntstatus.h"
|
||||||
#define WIN32_NO_STATUS
|
#define WIN32_NO_STATUS
|
||||||
|
@ -47,21 +50,6 @@
|
||||||
#include <mach/thread_act.h>
|
#include <mach/thread_act.h>
|
||||||
#include <servers/bootstrap.h>
|
#include <servers/bootstrap.h>
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__i386__)
|
|
||||||
extern int pthread_kill_syscall( mach_port_t, int );
|
|
||||||
__ASM_GLOBAL_FUNC( pthread_kill_syscall,
|
|
||||||
"movl $328,%eax\n\t" /* SYS___pthread_kill */
|
|
||||||
"int $0x80\n\t"
|
|
||||||
"jae 1f\n\t"
|
|
||||||
"negl %eax\n"
|
|
||||||
"1:\tret" )
|
|
||||||
#else
|
|
||||||
static inline int pthread_kill_syscall( mach_port_t, int )
|
|
||||||
{
|
|
||||||
return -ENOSYS;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static mach_port_t server_mach_port;
|
static mach_port_t server_mach_port;
|
||||||
|
|
||||||
void sigchld_callback(void)
|
void sigchld_callback(void)
|
||||||
|
@ -268,11 +256,7 @@ int send_thread_signal( struct thread *thread, int sig )
|
||||||
if (!mach_port_extract_right( process_port, thread->unix_tid,
|
if (!mach_port_extract_right( process_port, thread->unix_tid,
|
||||||
MACH_MSG_TYPE_COPY_SEND, &port, &type ))
|
MACH_MSG_TYPE_COPY_SEND, &port, &type ))
|
||||||
{
|
{
|
||||||
if ((ret = pthread_kill_syscall( port, sig )) < 0)
|
ret = syscall( SYS___pthread_kill, port, sig );
|
||||||
{
|
|
||||||
errno = -ret;
|
|
||||||
ret = -1;
|
|
||||||
}
|
|
||||||
mach_port_deallocate( mach_task_self(), port );
|
mach_port_deallocate( mach_task_self(), port );
|
||||||
}
|
}
|
||||||
else errno = ESRCH;
|
else errno = ESRCH;
|
||||||
|
|
Loading…
Reference in New Issue