442
|
1 /* Utility routines for XEmacs on Windows 9x, NT and Cygwin.
|
|
2 Copyright (C) 2000 Ben Wing.
|
|
3
|
|
4 This file is part of XEmacs.
|
|
5
|
|
6 XEmacs is free software; you can redistribute it and/or modify it
|
|
7 under the terms of the GNU General Public License as published by the
|
|
8 Free Software Foundation; either version 2, or (at your option) any
|
|
9 later version.
|
|
10
|
|
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with XEmacs; see the file COPYING. If not, write to the Free
|
|
18 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
19 02111-1307, USA. */
|
|
20
|
|
21 #include <config.h>
|
|
22 #include "lisp.h"
|
|
23
|
|
24 #include "buffer.h"
|
611
|
25
|
|
26 #include "syssignal.h"
|
|
27 #include "systime.h"
|
442
|
28 #include "syswindows.h"
|
|
29
|
|
30 typedef BOOL (WINAPI *pfSwitchToThread_t) (VOID);
|
|
31 pfSwitchToThread_t xSwitchToThread;
|
|
32
|
|
33 typedef HKL (WINAPI *pfGetKeyboardLayout_t) (DWORD);
|
|
34 pfGetKeyboardLayout_t xGetKeyboardLayout;
|
|
35 typedef BOOL (WINAPI *pfSetMenuDefaultItem_t) (HMENU, UINT, UINT);
|
|
36 pfSetMenuDefaultItem_t xSetMenuDefaultItem;
|
|
37 typedef BOOL (WINAPI *pfInsertMenuItemA_t)
|
|
38 (HMENU, UINT, BOOL, LPCMENUITEMINFOA);
|
|
39 pfInsertMenuItemA_t xInsertMenuItemA;
|
|
40 typedef BOOL (WINAPI *pfInsertMenuItemW_t)
|
|
41 (HMENU, UINT, BOOL, LPCMENUITEMINFOW);
|
|
42 pfInsertMenuItemW_t xInsertMenuItemW;
|
|
43 typedef HANDLE (WINAPI *pfLoadImageA_t)
|
|
44 (HINSTANCE, LPCSTR, UINT, int, int, UINT);
|
|
45 pfLoadImageA_t xLoadImageA;
|
|
46 typedef HANDLE (WINAPI *pfLoadImageW_t)
|
|
47 (HINSTANCE, LPCWSTR, UINT, int, int, UINT);
|
|
48 pfLoadImageW_t xLoadImageW;
|
|
49 typedef ATOM (WINAPI *pfRegisterClassExA_t) (CONST WNDCLASSEXA *);
|
|
50 pfRegisterClassExA_t xRegisterClassExA;
|
|
51 typedef ATOM (WINAPI *pfRegisterClassExW_t) (CONST WNDCLASSEXW *);
|
|
52 pfRegisterClassExW_t xRegisterClassExW;
|
|
53
|
|
54 typedef int (WINAPI *pfEnumFontFamiliesExA_t)
|
|
55 (HDC, LPLOGFONTA, FONTENUMPROCA, LPARAM, DWORD);
|
|
56 pfEnumFontFamiliesExA_t xEnumFontFamiliesExA;
|
|
57 typedef int (WINAPI *pfEnumFontFamiliesExW_t)
|
|
58 (HDC, LPLOGFONTW, FONTENUMPROCW, LPARAM, DWORD);
|
|
59 pfEnumFontFamiliesExW_t xEnumFontFamiliesExW;
|
|
60
|
|
61 typedef DWORD (WINAPI *pfSHGetFileInfoA_t)
|
|
62 (LPCSTR, DWORD, SHFILEINFOA FAR *, UINT, UINT);
|
|
63 pfSHGetFileInfoA_t xSHGetFileInfoA;
|
|
64 typedef DWORD (WINAPI *pfSHGetFileInfoW_t)
|
|
65 (LPCWSTR, DWORD, SHFILEINFOW FAR *, UINT, UINT);
|
|
66 pfSHGetFileInfoW_t xSHGetFileInfoW;
|
|
67
|
531
|
68 typedef NET_API_STATUS (NET_API_FUNCTION *pfNetUserEnum_t)
|
|
69 (
|
|
70 IN LPCWSTR servername OPTIONAL,
|
|
71 IN DWORD level,
|
|
72 IN DWORD filter,
|
|
73 OUT LPBYTE *bufptr,
|
|
74 IN DWORD prefmaxlen,
|
|
75 OUT LPDWORD entriesread,
|
|
76 OUT LPDWORD totalentries,
|
|
77 IN OUT LPDWORD resume_handle OPTIONAL
|
|
78 );
|
|
79 pfNetUserEnum_t xNetUserEnum;
|
|
80
|
|
81 typedef NET_API_STATUS (NET_API_FUNCTION *pfNetApiBufferFree_t)
|
|
82 (
|
|
83 IN LPVOID Buffer
|
|
84 );
|
|
85 pfNetApiBufferFree_t xNetApiBufferFree;
|
|
86
|
442
|
87 Lisp_Object
|
|
88 tstr_to_local_file_format (Extbyte *pathout)
|
|
89 {
|
665
|
90 Intbyte *ttlff;
|
442
|
91 Lisp_Object in;
|
|
92
|
|
93 EXTERNAL_TO_C_STRING (pathout, ttlff, Qmswindows_tstr);
|
|
94 WIN32_TO_LOCAL_FILE_FORMAT (ttlff, in);
|
|
95
|
|
96 return in;
|
|
97 }
|
|
98
|
|
99 static void
|
|
100 init_potentially_nonexistent_functions (void)
|
|
101 {
|
|
102 HMODULE h_kernel = GetModuleHandle ("kernel32");
|
|
103 HMODULE h_user = GetModuleHandle ("user32");
|
|
104 HMODULE h_gdi = GetModuleHandle ("gdi32");
|
|
105 HMODULE h_shell = GetModuleHandle ("shell32");
|
531
|
106 /* the following does not seem to get mapped in automatically */
|
|
107 HMODULE h_netapi = LoadLibrary ("netapi32.dll");
|
442
|
108
|
|
109 if (h_kernel)
|
|
110 {
|
|
111 xSwitchToThread =
|
|
112 (pfSwitchToThread_t) GetProcAddress (h_kernel, "SwitchToThread");
|
|
113 }
|
|
114
|
|
115 if (h_user)
|
|
116 {
|
|
117 xGetKeyboardLayout =
|
|
118 (pfGetKeyboardLayout_t) GetProcAddress (h_user, "GetKeyboardLayout");
|
|
119 xSetMenuDefaultItem =
|
|
120 (pfSetMenuDefaultItem_t) GetProcAddress (h_user, "SetMenuDefaultItem");
|
|
121 xInsertMenuItemA =
|
|
122 (pfInsertMenuItemA_t) GetProcAddress (h_user, "InsertMenuItemA");
|
|
123 xInsertMenuItemW =
|
|
124 (pfInsertMenuItemW_t) GetProcAddress (h_user, "InsertMenuItemW");
|
|
125 xLoadImageA =
|
|
126 (pfLoadImageA_t) GetProcAddress (h_user, "LoadImageA");
|
|
127 xLoadImageW =
|
|
128 (pfLoadImageW_t) GetProcAddress (h_user, "LoadImageW");
|
|
129 xRegisterClassExA =
|
|
130 (pfRegisterClassExA_t) GetProcAddress (h_user, "RegisterClassExA");
|
|
131 xRegisterClassExW =
|
|
132 (pfRegisterClassExW_t) GetProcAddress (h_user, "RegisterClassExW");
|
|
133 }
|
|
134
|
|
135 if (h_gdi)
|
|
136 {
|
|
137 xEnumFontFamiliesExA =
|
|
138 (pfEnumFontFamiliesExA_t) GetProcAddress (h_gdi, "EnumFontFamiliesExA");
|
|
139 xEnumFontFamiliesExW =
|
|
140 (pfEnumFontFamiliesExW_t) GetProcAddress (h_gdi, "EnumFontFamiliesExW");
|
|
141 }
|
|
142
|
|
143 if (h_shell)
|
|
144 {
|
|
145 xSHGetFileInfoA =
|
|
146 (pfSHGetFileInfoA_t) GetProcAddress (h_shell, "SHGetFileInfoA");
|
|
147 xSHGetFileInfoW =
|
|
148 (pfSHGetFileInfoW_t) GetProcAddress (h_shell, "SHGetFileInfoW");
|
|
149 }
|
531
|
150
|
|
151 if (h_netapi)
|
|
152 {
|
|
153 xNetUserEnum =
|
|
154 (pfNetUserEnum_t) GetProcAddress (h_netapi, "NetUserEnum");
|
|
155 xNetApiBufferFree =
|
|
156 (pfNetApiBufferFree_t) GetProcAddress (h_netapi, "NetApiBufferFree");
|
|
157 }
|
442
|
158 }
|
|
159
|
|
160 DEFUN ("mswindows-shell-execute", Fmswindows_shell_execute, 2, 4, 0, /*
|
|
161 Get Windows to perform OPERATION on DOCUMENT.
|
|
162 This is a wrapper around the ShellExecute system function, which
|
|
163 invokes the application registered to handle OPERATION for DOCUMENT.
|
|
164 OPERATION is typically \"open\", \"print\" or \"explore\" (but can be
|
|
165 nil for the default action), and DOCUMENT is typically the name of a
|
|
166 document file or URL, but can also be a program executable to run or
|
|
167 a directory to open in the Windows Explorer.
|
|
168
|
|
169 If DOCUMENT is a program executable, PARAMETERS can be a string
|
|
170 containing command line parameters, but otherwise should be nil.
|
|
171
|
|
172 SHOW-FLAG can be used to control whether the invoked application is hidden
|
|
173 or minimized. If SHOW-FLAG is nil, the application is displayed normally,
|
|
174 otherwise it is an integer representing a ShowWindow flag:
|
|
175
|
|
176 0 - start hidden
|
|
177 1 - start normally
|
|
178 3 - start maximized
|
|
179 6 - start minimized
|
|
180 */
|
|
181 (operation, document, parameters, show_flag))
|
|
182 {
|
|
183 /* Encode filename and current directory. */
|
|
184 Lisp_Object current_dir = Ffile_name_directory (document);
|
|
185 char* path = NULL;
|
673
|
186 #ifdef CYGWIN
|
|
187 char* fname1, *fname2;
|
|
188 int pos, sz;
|
|
189 #endif
|
442
|
190 char* doc = NULL;
|
|
191 int ret;
|
|
192 struct gcpro gcpro1, gcpro2;
|
|
193
|
|
194 CHECK_STRING (document);
|
|
195
|
|
196 if (NILP (current_dir))
|
|
197 current_dir = current_buffer->directory;
|
|
198
|
|
199 GCPRO2 (current_dir, document);
|
|
200
|
|
201 /* Use mule and cygwin-safe APIs top get at file data. */
|
|
202 if (STRINGP (current_dir))
|
|
203 {
|
673
|
204 LOCAL_TO_WIN32_FILE_FORMAT (current_dir, path);
|
442
|
205 }
|
|
206
|
|
207 if (STRINGP (document))
|
|
208 {
|
673
|
209 doc = XSTRING_DATA (document);
|
442
|
210 #ifdef CYGWIN
|
673
|
211 if ((fname1 = strchr (doc, ':')) != NULL
|
|
212 && *++fname1 == '/' && *++fname1 == '/')
|
|
213 {
|
|
214 fname1++;
|
|
215 pos = fname1 - doc;
|
|
216 if (!(isalpha (fname1[0]) && (IS_DEVICE_SEP (fname1[1]))))
|
|
217 {
|
|
218 sz = cygwin_posix_to_win32_path_list_buf_size (fname1);
|
|
219 fname2 = alloca (sz + pos);
|
|
220 strncpy (fname2, doc, pos);
|
|
221 doc = fname2;
|
|
222 fname2 += pos;
|
|
223 cygwin_posix_to_win32_path_list (fname1, fname2);
|
|
224 }
|
|
225 }
|
|
226 else {
|
|
227 LOCAL_TO_WIN32_FILE_FORMAT (document, doc);
|
|
228 }
|
442
|
229 #endif
|
|
230 }
|
|
231
|
|
232 UNGCPRO;
|
|
233
|
|
234 ret = (int) ShellExecute (NULL,
|
|
235 (STRINGP (operation) ?
|
593
|
236 /* !!#### more mule bogosity */
|
|
237 (char *) XSTRING_DATA (operation) : NULL),
|
442
|
238 doc,
|
|
239 (STRINGP (parameters) ?
|
593
|
240 /* !!#### more mule bogosity */
|
|
241 (char *) XSTRING_DATA (parameters) : NULL),
|
442
|
242 path,
|
|
243 (INTP (show_flag) ?
|
|
244 XINT (show_flag) : SW_SHOWDEFAULT));
|
|
245
|
|
246 if (ret > 32)
|
|
247 return Qt;
|
|
248
|
|
249 if (ret == ERROR_FILE_NOT_FOUND)
|
563
|
250 signal_error (Qfile_error, "file not found", document);
|
442
|
251 else if (ret == ERROR_PATH_NOT_FOUND)
|
563
|
252 signal_error (Qfile_error, "path not found", current_dir);
|
442
|
253 else if (ret == ERROR_BAD_FORMAT)
|
563
|
254 signal_error (Qfile_error, "bad executable format", document);
|
442
|
255 else
|
563
|
256 signal_error (Qinternal_error, "internal error", Qunbound);
|
442
|
257
|
|
258 return Qnil;
|
|
259 }
|
|
260
|
673
|
261 #ifdef CYGWIN
|
|
262 DEFUN ("mswindows-cygwin-to-win32-path", Fmswindows_cygwin_to_win32_path, 1, 1, 0, /*
|
|
263 Get the cygwin environment to convert the Unix PATH to win32 format.
|
|
264 No expansion is performed, all conversion is done by the cygwin runtime.
|
|
265 */
|
|
266 (path))
|
|
267 {
|
|
268 Extbyte* f;
|
|
269 Intbyte* p;
|
|
270 CHECK_STRING (path);
|
|
271
|
|
272 /* There appears to be a bug in the cygwin conversion routines in
|
|
273 that they are not idempotent. */
|
|
274 p = XSTRING_DATA (path);
|
|
275 if (isalpha (p[0]) && (IS_DEVICE_SEP (p[1])))
|
|
276 return path;
|
|
277
|
|
278 /* Use mule and cygwin-safe APIs top get at file data. */
|
|
279 LOCAL_TO_WIN32_FILE_FORMAT (path, f);
|
|
280 return build_ext_string (f, Qnative);
|
|
281 }
|
|
282 #endif
|
|
283
|
613
|
284 #if defined (WIN32_NATIVE) || defined (CYGWIN_BROKEN_SIGNALS)
|
|
285
|
|
286 /* setitimer() does not exist on native MS Windows, and appears broken
|
|
287 on Cygwin (random lockups when BROKEN_SIGIO is defined), so we
|
|
288 emulate in both cases by using multimedia timers. Furthermore,
|
|
289 the lockups still occur on Cygwin even when we do nothing but
|
|
290 use the standard signalling mechanism -- so we have to emulate
|
|
291 that, too. (But only for timeouts -- we have to use the standard
|
|
292 mechanism for SIGCHLD. Yuck.)
|
|
293 */
|
|
294
|
|
295
|
|
296 /*--------------------------------------------------------------------*/
|
|
297 /* Signal support */
|
|
298 /*--------------------------------------------------------------------*/
|
|
299
|
|
300 #define sigmask(nsig) (1U << nsig)
|
|
301
|
|
302 /* We can support as many signals as fit into word */
|
|
303 #define SIG_MAX 32
|
|
304
|
|
305 /* Signal handlers. Initial value = 0 = SIG_DFL */
|
|
306 static mswindows_sighandler signal_handlers[SIG_MAX] = {0};
|
|
307
|
|
308 /* Signal block mask: bit set to 1 means blocked */
|
|
309 unsigned signal_block_mask = 0;
|
|
310
|
|
311 /* Signal pending mask: bit set to 1 means sig is pending */
|
|
312 unsigned signal_pending_mask = 0;
|
|
313
|
|
314 mswindows_sighandler
|
|
315 mswindows_sigset (int nsig, mswindows_sighandler handler)
|
|
316 {
|
|
317 /* We delegate some signals to the system function */
|
|
318 if (nsig == SIGFPE || nsig == SIGABRT || nsig == SIGINT)
|
|
319 return signal (nsig, handler);
|
|
320
|
|
321 if (nsig < 0 || nsig > SIG_MAX)
|
|
322 {
|
|
323 errno = EINVAL;
|
|
324 return NULL;
|
|
325 }
|
|
326
|
|
327 /* Store handler ptr */
|
|
328 {
|
|
329 mswindows_sighandler old_handler = signal_handlers[nsig];
|
|
330 signal_handlers[nsig] = handler;
|
|
331 return old_handler;
|
|
332 }
|
|
333 }
|
|
334
|
|
335 int
|
|
336 mswindows_sighold (int nsig)
|
|
337 {
|
|
338 if (nsig < 0 || nsig > SIG_MAX)
|
|
339 return errno = EINVAL;
|
|
340
|
|
341 signal_block_mask |= sigmask (nsig);
|
|
342 return 0;
|
|
343 }
|
|
344
|
|
345 int
|
|
346 mswindows_sigrelse (int nsig)
|
|
347 {
|
|
348 if (nsig < 0 || nsig > SIG_MAX)
|
|
349 return errno = EINVAL;
|
|
350
|
|
351 signal_block_mask &= ~sigmask (nsig);
|
|
352
|
|
353 if (signal_pending_mask & sigmask (nsig))
|
|
354 mswindows_raise (nsig);
|
|
355
|
|
356 return 0;
|
|
357 }
|
|
358
|
|
359 int
|
|
360 mswindows_sigpause (int nsig)
|
|
361 {
|
|
362 /* This is currently not called, because the only call to sigpause
|
|
363 inside XEmacs is with SIGCHLD parameter. Just in case, we put an
|
|
364 assert here, so anyone adds a call to sigpause will be surprised
|
|
365 (or surprise someone else...) */
|
|
366 assert (0);
|
|
367 return 0;
|
|
368 }
|
|
369
|
|
370 int
|
|
371 mswindows_raise (int nsig)
|
|
372 {
|
|
373 /* We delegate some raises to the system routine */
|
|
374 if (nsig == SIGFPE || nsig == SIGABRT || nsig == SIGINT)
|
|
375 return raise (nsig);
|
|
376
|
|
377 if (nsig < 0 || nsig > SIG_MAX)
|
|
378 return errno = EINVAL;
|
|
379
|
|
380 /* If the signal is blocked, remember to issue later */
|
|
381 if (signal_block_mask & sigmask (nsig))
|
|
382 {
|
|
383 signal_pending_mask |= sigmask (nsig);
|
|
384 return 0;
|
|
385 }
|
|
386
|
|
387 if (signal_handlers[nsig] == SIG_IGN)
|
|
388 return 0;
|
|
389
|
|
390 if (signal_handlers[nsig] != SIG_DFL)
|
|
391 {
|
|
392 (*signal_handlers[nsig]) (nsig);
|
|
393 return 0;
|
|
394 }
|
|
395
|
|
396 /* Default signal actions */
|
|
397 if (nsig == SIGALRM || nsig == SIGPROF)
|
|
398 exit (3);
|
|
399
|
|
400 /* Other signals are ignored by default */
|
|
401 return 0;
|
|
402 }
|
|
403
|
611
|
404
|
|
405 /*--------------------------------------------------------------------*/
|
|
406 /* Async timers */
|
|
407 /*--------------------------------------------------------------------*/
|
|
408
|
|
409 /* We emulate two timers, one for SIGALRM, another for SIGPROF.
|
|
410
|
|
411 itimerproc() function has an implementation limitation: it does
|
|
412 not allow to set *both* interval and period. If an attempt is
|
|
413 made to set both, and then they are unequal, the function
|
|
414 asserts.
|
|
415
|
|
416 Minimum timer resolution on Win32 systems varies, and is greater
|
|
417 than or equal than 1 ms. The resolution is always wrapped not to
|
|
418 attempt to get below the system defined limit.
|
|
419 */
|
|
420
|
|
421 /* Timer precision, denominator of one fraction: for 100 ms
|
|
422 interval, request 10 ms precision
|
|
423 */
|
|
424 const int setitimer_helper_timer_prec = 10;
|
|
425
|
|
426 /* Last itimervals, as set by calls to setitimer */
|
|
427 static struct itimerval it_alarm;
|
|
428 static struct itimerval it_prof;
|
|
429
|
|
430 /* Timer IDs as returned by MM */
|
|
431 MMRESULT tid_alarm = 0;
|
|
432 MMRESULT tid_prof = 0;
|
|
433
|
|
434 static void CALLBACK
|
|
435 setitimer_helper_proc (UINT uID, UINT uMsg, DWORD dwUser,
|
|
436 DWORD dw1, DWORD dw2)
|
|
437 {
|
|
438 /* Just raise the signal indicated by the dwUser parameter */
|
|
439 mswindows_raise (dwUser);
|
|
440 }
|
|
441
|
|
442 /* Divide time in ms specified by IT by DENOM. Return 1 ms
|
|
443 if division results in zero */
|
|
444 static UINT
|
|
445 setitimer_helper_period (const struct itimerval* it, UINT denom)
|
|
446 {
|
|
447 static TIMECAPS time_caps;
|
|
448
|
|
449 UINT res;
|
|
450 const struct timeval* tv =
|
|
451 (it->it_value.tv_sec == 0 && it->it_value.tv_usec == 0)
|
|
452 ? &it->it_interval : &it->it_value;
|
|
453
|
|
454 /* Zero means stop timer */
|
|
455 if (tv->tv_sec == 0 && tv->tv_usec == 0)
|
|
456 return 0;
|
|
457
|
|
458 /* Convert to ms and divide by denom */
|
|
459 res = (tv->tv_sec * 1000 + (tv->tv_usec + 500) / 1000) / denom;
|
|
460
|
|
461 /* Converge to minimum timer resolution */
|
|
462 if (time_caps.wPeriodMin == 0)
|
|
463 timeGetDevCaps (&time_caps, sizeof(time_caps));
|
|
464
|
|
465 if (res < time_caps.wPeriodMin)
|
|
466 res = time_caps.wPeriodMin;
|
|
467
|
|
468 return res;
|
|
469 }
|
|
470
|
|
471 static int
|
|
472 setitimer_helper (const struct itimerval* itnew,
|
|
473 struct itimerval* itold, struct itimerval* itcurrent,
|
|
474 MMRESULT* tid, DWORD sigkind)
|
|
475 {
|
|
476 UINT delay, resolution, event_type;
|
|
477
|
|
478 /* First stop the old timer */
|
|
479 if (*tid)
|
|
480 {
|
|
481 timeKillEvent (*tid);
|
|
482 timeEndPeriod (setitimer_helper_period (itcurrent,
|
|
483 setitimer_helper_timer_prec));
|
|
484 *tid = 0;
|
|
485 }
|
|
486
|
|
487 /* Return old itimerval if requested */
|
|
488 if (itold)
|
|
489 *itold = *itcurrent;
|
|
490
|
|
491 *itcurrent = *itnew;
|
|
492
|
|
493 /* Determine if to start new timer */
|
|
494 delay = setitimer_helper_period (itnew, 1);
|
|
495 if (delay)
|
|
496 {
|
|
497 resolution = setitimer_helper_period (itnew,
|
|
498 setitimer_helper_timer_prec);
|
|
499 event_type = (itnew->it_value.tv_sec == 0 &&
|
|
500 itnew->it_value.tv_usec == 0)
|
|
501 ? TIME_ONESHOT : TIME_PERIODIC;
|
|
502 timeBeginPeriod (resolution);
|
|
503 *tid = timeSetEvent (delay, resolution, setitimer_helper_proc, sigkind,
|
|
504 event_type);
|
|
505 }
|
|
506
|
|
507 return !delay || *tid;
|
|
508 }
|
|
509
|
|
510 int
|
|
511 mswindows_setitimer (int kind, const struct itimerval *itnew,
|
|
512 struct itimerval *itold)
|
|
513 {
|
|
514 /* In this version, both interval and value are allowed
|
|
515 only if they are equal. */
|
|
516 assert ((itnew->it_value.tv_sec == 0 && itnew->it_value.tv_usec == 0)
|
|
517 || (itnew->it_interval.tv_sec == 0 &&
|
|
518 itnew->it_interval.tv_usec == 0)
|
|
519 || (itnew->it_value.tv_sec == itnew->it_interval.tv_sec &&
|
|
520 itnew->it_value.tv_usec == itnew->it_interval.tv_usec));
|
|
521
|
|
522 if (kind == ITIMER_REAL)
|
|
523 return setitimer_helper (itnew, itold, &it_alarm, &tid_alarm, SIGALRM);
|
|
524 else if (kind == ITIMER_PROF)
|
|
525 return setitimer_helper (itnew, itold, &it_prof, &tid_prof, SIGPROF);
|
|
526 else
|
|
527 return errno = EINVAL;
|
|
528 }
|
|
529
|
613
|
530 #endif /* defined (WIN32_NATIVE) || defined (CYGWIN_BROKEN_SIGNALS) */
|
|
531
|
611
|
532
|
442
|
533 void
|
|
534 syms_of_win32 (void)
|
|
535 {
|
|
536 DEFSUBR (Fmswindows_shell_execute);
|
673
|
537 #ifdef CYGWIN
|
|
538 DEFSUBR (Fmswindows_cygwin_to_win32_path);
|
|
539 #endif
|
442
|
540 }
|
|
541
|
|
542 void
|
|
543 init_win32 (void)
|
|
544 {
|
|
545 init_potentially_nonexistent_functions ();
|
|
546 }
|