[PATCH] server: Use syscall(2) instead of inline assembly on Mac OS, too.

Charles Davis cdavis at mymail.mines.edu
Sun Oct 9 14:52:15 CDT 2011


On Oct 9, 2011, at 1:42 PM, David Laight wrote:

> On Sat, Oct 08, 2011 at 07:48:40PM +0200, Alexandre Julliard wrote:
>> Charles Davis <cdavis at mymail.mines.edu> writes:
>> 
>>> @@ -268,9 +256,9 @@ int send_thread_signal( struct thread *thread, int sig )
>>>         if (!mach_port_extract_right( process_port, thread->unix_tid,
>>>                                       MACH_MSG_TYPE_COPY_SEND, &port, &type ))
>>>         {
>>> -            if ((ret = pthread_kill_syscall( port, sig )) < 0)
>>> +            if ((ret = syscall( SYS___pthread_kill, port, sig )) != 0)
>>>             {
>>> -                errno = -ret;
>>> +                errno = ret;
>> 
>> syscall is supposed to take care of errno.
> 
> I'm also not at all sure of the portability of using syscall() in
> application code.
> 
> What happens when you try to run the above on anything other than Linux?
> (Eg aone of the BSDs)
That's just it. None of that code is portable. It was designed specifically to work on Darwin (Mac OS X/iOS). (It was even worse before. It used x86 assembly to make the syscall, so it would only work on an Intel Mac--and only in 32-bit mode at that. So if anything, this is making it *more* portable.) It doesn't get compiled anywhere else anyway. For this particular file, the only other system I would be worried about is the HURD (the only other OS I know of that's based on Mach), which hardly anyone uses in practice anyway.

Also, if you'll look at Wine's development history, you'll notice similar patches by Maarten Lankhorst and, yes, by AJ himself, for Linux.

Chip




More information about the wine-devel mailing list