comparison src/process-nt.c @ 440:8de8e3f6228a r21-2-28

Import from CVS: tag r21-2-28
author cvs
date Mon, 13 Aug 2007 11:33:38 +0200
parents 080151679be2
children abe6d1db359e
comparison
equal deleted inserted replaced
439:357dd071b03c 440:8de8e3f6228a
30 #include "lstream.h" 30 #include "lstream.h"
31 #include "process.h" 31 #include "process.h"
32 #include "procimpl.h" 32 #include "procimpl.h"
33 #include "sysdep.h" 33 #include "sysdep.h"
34 34
35 #include <windows.h>
36 #ifndef __MINGW32__ 35 #ifndef __MINGW32__
37 #include <shellapi.h> 36 #include <shellapi.h>
38 #else 37 #else
39 #include <errno.h> 38 #include <errno.h>
40 #endif 39 #endif
63 /*-----------------------------------------------------------------------*/ 62 /*-----------------------------------------------------------------------*/
64 63
65 /* This one breaks process abstraction. Prototype is in console-msw.h, 64 /* This one breaks process abstraction. Prototype is in console-msw.h,
66 used by select_process method in event-msw.c */ 65 used by select_process method in event-msw.c */
67 HANDLE 66 HANDLE
68 get_nt_process_handle (struct Lisp_Process *p) 67 get_nt_process_handle (Lisp_Process *p)
69 { 68 {
70 return (NT_DATA (p)->h_process); 69 return (NT_DATA (p)->h_process);
71 } 70 }
72 71
73 /*-----------------------------------------------------------------------*/ 72 /*-----------------------------------------------------------------------*/
373 /* 372 /*
374 * Allocate and initialize Lisp_Process->process_data 373 * Allocate and initialize Lisp_Process->process_data
375 */ 374 */
376 375
377 static void 376 static void
378 nt_alloc_process_data (struct Lisp_Process *p) 377 nt_alloc_process_data (Lisp_Process *p)
379 { 378 {
380 p->process_data = xnew_and_zero (struct nt_process_data); 379 p->process_data = xnew_and_zero (struct nt_process_data);
381 } 380 }
382 381
383 static void 382 static void
384 nt_finalize_process_data (struct Lisp_Process *p, int for_disksave) 383 nt_finalize_process_data (Lisp_Process *p, int for_disksave)
385 { 384 {
386 assert (!for_disksave); 385 assert (!for_disksave);
387 if (NT_DATA(p)->h_process) 386 if (NT_DATA(p)->h_process)
388 CloseHandle (NT_DATA(p)->h_process); 387 CloseHandle (NT_DATA(p)->h_process);
389 } 388 }
416 mswindows_set_errno (err); 415 mswindows_set_errno (err);
417 signal_simple_error_2 ("Error starting", image_file, lisp_strerror (errno)); 416 signal_simple_error_2 ("Error starting", image_file, lisp_strerror (errno));
418 } 417 }
419 418
420 static int 419 static int
421 nt_create_process (struct Lisp_Process *p, 420 nt_create_process (Lisp_Process *p,
422 Lisp_Object *argv, int nargv, 421 Lisp_Object *argv, int nargv,
423 Lisp_Object program, Lisp_Object cur_dir) 422 Lisp_Object program, Lisp_Object cur_dir)
424 { 423 {
425 HANDLE hmyshove, hmyslurp, hprocin, hprocout, hprocerr; 424 HANDLE hmyshove, hmyslurp, hprocin, hprocout, hprocerr;
426 LPTSTR command_line; 425 LPTSTR command_line;
669 * 668 *
670 * The method is called only for real child processes. 669 * The method is called only for real child processes.
671 */ 670 */
672 671
673 static void 672 static void
674 nt_update_status_if_terminated (struct Lisp_Process* p) 673 nt_update_status_if_terminated (Lisp_Process* p)
675 { 674 {
676 DWORD exit_code; 675 DWORD exit_code;
677 676
678 if (NT_DATA(p)->need_enable_child_signals > 1) 677 if (NT_DATA(p)->need_enable_child_signals > 1)
679 { 678 {
716 715
717 static void 716 static void
718 nt_send_process (Lisp_Object proc, struct lstream* lstream) 717 nt_send_process (Lisp_Object proc, struct lstream* lstream)
719 { 718 {
720 volatile Lisp_Object vol_proc = proc; 719 volatile Lisp_Object vol_proc = proc;
721 struct Lisp_Process *volatile p = XPROCESS (proc); 720 Lisp_Process *volatile p = XPROCESS (proc);
722 721
723 /* use a reasonable-sized buffer (somewhere around the size of the 722 /* use a reasonable-sized buffer (somewhere around the size of the
724 stream buffer) so as to avoid inundating the stream with blocked 723 stream buffer) so as to avoid inundating the stream with blocked
725 data. */ 724 data. */
726 Bufbyte chunkbuf[128]; 725 Bufbyte chunkbuf[128];
784 783
785 static void 784 static void
786 nt_kill_child_process (Lisp_Object proc, int signo, 785 nt_kill_child_process (Lisp_Object proc, int signo,
787 int current_group, int nomsg) 786 int current_group, int nomsg)
788 { 787 {
789 struct Lisp_Process *p = XPROCESS (proc); 788 Lisp_Process *p = XPROCESS (proc);
790 789
791 /* Enable child signals if necessary. This may lose the first 790 /* Enable child signals if necessary. This may lose the first
792 but it's better than nothing. */ 791 but it's better than nothing. */
793 if (NT_DATA(p)->need_enable_child_signals > 0) 792 if (NT_DATA(p)->need_enable_child_signals > 0)
794 { 793 {