4 * Copyright 1996 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "wine/port.h"
26 #include <sys/types.h>
27 #ifdef HAVE_SYS_MMAN_H
30 #ifdef HAVE_SYS_TIMES_H
31 #include <sys/times.h>
36 #include "wine/winbase16.h"
41 #include "wine/server.h"
42 #include "wine/debug.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(thread);
50 /***********************************************************************
51 * SetLastError (KERNEL.147)
52 * SetLastError (KERNEL32.@)
54 /* void WINAPI SetLastError( DWORD error ); */
55 __ASM_GLOBAL_FUNC( SetLastError,
56 "movl 4(%esp),%eax\n\t"
61 /***********************************************************************
62 * GetLastError (KERNEL.148)
63 * GetLastError (KERNEL32.@)
65 /* DWORD WINAPI GetLastError(void); */
66 __ASM_GLOBAL_FUNC( GetLastError, ".byte 0x64\n\tmovl 0x60,%eax\n\tret" );
68 /***********************************************************************
69 * GetCurrentProcessId (KERNEL.471)
70 * GetCurrentProcessId (KERNEL32.@)
72 /* DWORD WINAPI GetCurrentProcessId(void) */
73 __ASM_GLOBAL_FUNC( GetCurrentProcessId, ".byte 0x64\n\tmovl 0x20,%eax\n\tret" );
75 /***********************************************************************
76 * GetCurrentThreadId (KERNEL.462)
77 * GetCurrentThreadId (KERNEL32.@)
79 /* DWORD WINAPI GetCurrentThreadId(void) */
80 __ASM_GLOBAL_FUNC( GetCurrentThreadId, ".byte 0x64\n\tmovl 0x24,%eax\n\tret" );
84 /**********************************************************************
85 * SetLastError (KERNEL.147)
86 * SetLastError (KERNEL32.@)
88 * Sets the last-error code.
90 void WINAPI SetLastError( DWORD error ) /* [in] Per-thread error code */
92 NtCurrentTeb()->last_error = error;
95 /**********************************************************************
96 * GetLastError (KERNEL.148)
97 * GetLastError (KERNEL32.@)
99 * Returns last-error code.
101 DWORD WINAPI GetLastError(void)
103 return NtCurrentTeb()->last_error;
106 /***********************************************************************
107 * GetCurrentProcessId (KERNEL.471)
108 * GetCurrentProcessId (KERNEL32.@)
110 * Returns process identifier.
112 DWORD WINAPI GetCurrentProcessId(void)
114 return (DWORD)NtCurrentTeb()->ClientId.UniqueProcess;
117 /***********************************************************************
118 * GetCurrentThreadId (KERNEL.462)
119 * GetCurrentThreadId (KERNEL32.@)
121 * Returns thread identifier.
123 DWORD WINAPI GetCurrentThreadId(void)
125 return (DWORD)NtCurrentTeb()->ClientId.UniqueThread;
128 #endif /* __i386__ */