ntdll/tests: Create the server port before starting the client thread.
[wine/multimedia.git] / dlls / ntdll / misc.c
blobf72ea50fe2132ae886d42f6968841c7cff14737b
1 /*
2 * Helper functions for ntdll
4 * Copyright 2000 Juergen Schmied
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
23 #include <time.h>
24 #include <math.h>
25 #ifdef HAVE_SYS_UTSNAME_H
26 #include <sys/utsname.h>
27 #endif
29 #include "wine/library.h"
30 #include "wine/debug.h"
31 #include "ntdll_misc.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
35 #if defined(__GNUC__) && defined(__i386__)
36 #define DO_FPU(x,y) __asm__ __volatile__( x " %0;fwait" : "=m" (y) : )
37 #define POP_FPU(x) DO_FPU("fstpl",x)
38 #endif
40 LPCSTR debugstr_ObjectAttributes(const OBJECT_ATTRIBUTES *oa)
42 if (!oa) return "<null>";
43 return wine_dbg_sprintf( "{name=%s, attr=0x%08x, hRoot=%p, sd=%p}\n",
44 debugstr_us(oa->ObjectName), oa->Attributes,
45 oa->RootDirectory, oa->SecurityDescriptor );
48 LPCSTR debugstr_us( const UNICODE_STRING *us )
50 if (!us) return "<null>";
51 return debugstr_wn(us->Buffer, us->Length / sizeof(WCHAR));
54 /*********************************************************************
55 * _ftol (NTDLL.@)
57 * VERSION
58 * [GNUC && i386]
60 #if defined(__GNUC__) && defined(__i386__)
61 LONGLONG CDECL NTDLL__ftol(void)
63 /* don't just do DO_FPU("fistp",retval), because the rounding
64 * mode must also be set to "round towards zero"... */
65 double fl;
66 POP_FPU(fl);
67 return (LONGLONG)fl;
69 #endif /* defined(__GNUC__) && defined(__i386__) */
71 /*********************************************************************
72 * _ftol (NTDLL.@)
74 * FIXME
75 * Should be register function
76 * VERSION
77 * [!GNUC && i386]
79 #if !defined(__GNUC__) && defined(__i386__)
80 LONGLONG CDECL NTDLL__ftol(double fl)
82 FIXME("should be register function\n");
83 return (LONGLONG)fl;
85 #endif /* !defined(__GNUC__) && defined(__i386__) */
87 /*********************************************************************
88 * _ftol (NTDLL.@)
89 * VERSION
90 * [!i386]
92 #ifndef __i386__
93 LONG CDECL NTDLL__ftol(double fl)
95 return (LONG) fl;
97 #endif /* !defined(__i386__) */
99 /*********************************************************************
100 * _CIpow (NTDLL.@)
101 * VERSION
102 * [GNUC && i386]
104 #if defined(__GNUC__) && defined(__i386__)
105 double CDECL NTDLL__CIpow(void)
107 double x,y;
108 POP_FPU(y);
109 POP_FPU(x);
110 return pow(x,y);
112 #endif /* defined(__GNUC__) && defined(__i386__) */
115 /*********************************************************************
116 * _CIpow (NTDLL.@)
118 * FIXME
119 * Should be register function
121 * VERSION
122 * [!GNUC && i386]
124 #if !defined(__GNUC__) && defined(__i386__)
125 double CDECL NTDLL__CIpow(double x,double y)
127 FIXME("should be register function\n");
128 return pow(x,y);
130 #endif /* !defined(__GNUC__) && defined(__i386__) */
132 /*********************************************************************
133 * _CIpow (NTDLL.@)
134 * VERSION
135 * [!i386]
137 #ifndef __i386__
138 double CDECL NTDLL__CIpow(double x,double y)
140 return pow(x,y);
142 #endif /* !defined(__i386__) */
145 /*********************************************************************
146 * wine_get_version (NTDLL.@)
148 const char * CDECL NTDLL_wine_get_version(void)
150 return wine_get_version();
153 /*********************************************************************
154 * wine_get_build_id (NTDLL.@)
156 const char * CDECL NTDLL_wine_get_build_id(void)
158 return wine_get_build_id();
161 /*********************************************************************
162 * wine_get_host_version (NTDLL.@)
164 void CDECL NTDLL_wine_get_host_version( const char **sysname, const char **release )
166 #ifdef HAVE_SYS_UTSNAME_H
167 static struct utsname buf;
168 static int init_done;
170 if (!init_done)
172 uname( &buf );
173 init_done = 1;
175 if (sysname) *sysname = buf.sysname;
176 if (release) *release = buf.release;
177 #else
178 if (sysname) *sysname = "";
179 if (release) *release = "";
180 #endif
183 /*********************************************************************
184 * abs (NTDLL.@)
186 int CDECL NTDLL_abs( int i )
188 return abs( i );
191 /*********************************************************************
192 * labs (NTDLL.@)
194 LONG CDECL NTDLL_labs( LONG i )
196 return labs( i );
199 /*********************************************************************
200 * atan (NTDLL.@)
202 double CDECL NTDLL_atan( double d )
204 return atan( d );
207 /*********************************************************************
208 * ceil (NTDLL.@)
210 double CDECL NTDLL_ceil( double d )
212 return ceil( d );
215 /*********************************************************************
216 * cos (NTDLL.@)
218 double CDECL NTDLL_cos( double d )
220 return cos( d );
223 /*********************************************************************
224 * fabs (NTDLL.@)
226 double CDECL NTDLL_fabs( double d )
228 return fabs( d );
231 /*********************************************************************
232 * floor (NTDLL.@)
234 double CDECL NTDLL_floor( double d )
236 return floor( d );
239 /*********************************************************************
240 * log (NTDLL.@)
242 double CDECL NTDLL_log( double d )
244 return log( d );
247 /*********************************************************************
248 * pow (NTDLL.@)
250 double CDECL NTDLL_pow( double x, double y )
252 return pow( x, y );
255 /*********************************************************************
256 * sin (NTDLL.@)
258 double CDECL NTDLL_sin( double d )
260 return sin( d );
263 /*********************************************************************
264 * sqrt (NTDLL.@)
266 double CDECL NTDLL_sqrt( double d )
268 return sqrt( d );
271 /*********************************************************************
272 * tan (NTDLL.@)
274 double CDECL NTDLL_tan( double d )
276 return tan( d );