comparison src/sysdep.c @ 359:8e84bee8ddd0 r21-1-9

Import from CVS: tag r21-1-9
author cvs
date Mon, 13 Aug 2007 10:57:55 +0200
parents 4711e16a8e49
children 7347b34c275b
comparison
equal deleted inserted replaced
358:fed6e0f6a03a 359:8e84bee8ddd0
349 we ignore it by default. */ 349 we ignore it by default. */
350 #elif defined (WINDOWSNT) 350 #elif defined (WINDOWSNT)
351 int ret = 0, status = 0; 351 int ret = 0, status = 0;
352 if (pHandle == NULL) 352 if (pHandle == NULL)
353 { 353 {
354 stderr_out ("wait_for_termination: pHandle == NULL, GetLastError () = %d, (int)pHandle = %d\n", GetLastError (), (int)pHandle); 354 warn_when_safe (Qprocess, Qerror, "Cannot wait for NULL process handle.");
355 return; 355 return;
356 } 356 }
357 do 357 do
358 { 358 {
359 QUIT; 359 QUIT;
360 ret = WaitForSingleObject(pHandle, 100); 360 ret = WaitForSingleObject(pHandle, 100);
361 } 361 }
362 while (ret == WAIT_TIMEOUT); 362 while (ret == WAIT_TIMEOUT);
363 if (ret == WAIT_FAILED) 363 if (ret == WAIT_FAILED)
364 { 364 {
365 stderr_out ("wait_for_termination.WaitForSingleObject returns %d (WAIT_FAILED) GetLastError () %d for (int)pHandle %d\n", ret, GetLastError (), (int)pHandle); 365 warn_when_safe (Qprocess, Qerror,
366 "WaitForSingleObject returns WAIT_FAILED for process handle %p.",
367 pHandle);
366 } 368 }
367 if (ret == WAIT_ABANDONED) 369 if (ret == WAIT_ABANDONED)
368 { 370 {
369 stderr_out ("wait_for_termination.WaitForSingleObject returns %d (WAIT_ABANDONED) GetLastError () %d for (int)pHandle %d\n", ret, GetLastError (), (int)pHandle); 371 warn_when_safe (Qprocess, Qerror,
372 "WaitForSingleObject returns WAIT_ABANDONED for process handle %p.",
373 pHandle);
370 } 374 }
371 if (ret == WAIT_OBJECT_0) 375 if (ret == WAIT_OBJECT_0)
372 { 376 {
373 ret = GetExitCodeProcess(pHandle, &status); 377 ret = GetExitCodeProcess(pHandle, &status);
374 if (ret) 378 if (ret)
378 } 382 }
379 else 383 else
380 { 384 {
381 /* GetExitCodeProcess() didn't return a valid exit status, 385 /* GetExitCodeProcess() didn't return a valid exit status,
382 nothing to do. APA */ 386 nothing to do. APA */
383 stderr_out ("wait_for_termination.GetExitCodeProcess status %d GetLastError () %d for (int)pHandle %d\n", status, GetLastError (), (int)pHandle); 387 warn_when_safe (Qprocess, Qerror,
388 "GetExitCodeProcess fails for process handle %p.",
389 pHandle);
384 } 390 }
385 } 391 }
386 if (pHandle != NULL && !CloseHandle(pHandle)) 392 if (pHandle != NULL && !CloseHandle(pHandle))
387 { 393 {
388 stderr_out ("wait_for_termination.CloseHandle GetLastError () %d for (int)pHandle %d\n", 394 warn_when_safe (Qprocess, Qerror,
389 GetLastError (), (int)pHandle); 395 "CloseHandle fails for process handle %p.", pHandle);
390 } 396 }
391 #elif defined (EMACS_BLOCK_SIGNAL) && !defined (BROKEN_WAIT_FOR_SIGNAL) && defined (SIGCHLD) 397 #elif defined (EMACS_BLOCK_SIGNAL) && !defined (BROKEN_WAIT_FOR_SIGNAL) && defined (SIGCHLD)
392 while (1) 398 while (1)
393 { 399 {
394 static int wait_debugging = 0; /* Set nonzero to make following 400 static int wait_debugging = 0; /* Set nonzero to make following
3079 PATHNAME_CONVERT_OUT (path); 3085 PATHNAME_CONVERT_OUT (path);
3080 /* #### currently we don't do conversions on the incoming data */ 3086 /* #### currently we don't do conversions on the incoming data */
3081 return readlink (path, buf, bufsiz); 3087 return readlink (path, buf, bufsiz);
3082 } 3088 }
3083 #endif /* ENCAPSULATE_READLINK */ 3089 #endif /* ENCAPSULATE_READLINK */
3090
3091
3092 #ifdef ENCAPSULATE_FSTAT
3093 int
3094 sys_fstat (int fd, struct stat *buf)
3095 {
3096 return fstat (fd, buf);
3097 }
3098 #endif /* ENCAPSULATE_FSTAT */
3084 3099
3085 3100
3086 #ifdef ENCAPSULATE_STAT 3101 #ifdef ENCAPSULATE_STAT
3087 int 3102 int
3088 sys_stat (CONST char *path, struct stat *buf) 3103 sys_stat (CONST char *path, struct stat *buf)