This commit was generated by cvs2svn to compensate for changes in r1383,
[chise/xemacs-chise.git.1] / src / process-nt.c
index 0e3eb7d..f7ab6a5 100644 (file)
@@ -32,7 +32,6 @@ Boston, MA 02111-1307, USA.  */
 #include "procimpl.h"
 #include "sysdep.h"
 
-#include <windows.h>
 #ifndef __MINGW32__
 #include <shellapi.h>
 #else
@@ -65,7 +64,7 @@ struct nt_process_data
 /* This one breaks process abstraction. Prototype is in console-msw.h,
    used by select_process method in event-msw.c */
 HANDLE
-get_nt_process_handle (struct Lisp_Process *p)
+get_nt_process_handle (Lisp_Process *p)
 {
   return (NT_DATA (p)->h_process);
 }
@@ -169,7 +168,7 @@ run_in_other_process (HANDLE h_process,
                      LPVOID data, size_t data_size)
 {
   process_memory pm;
-  CONST size_t code_size = FRAGMENT_CODE_SIZE;
+  const size_t code_size = FRAGMENT_CODE_SIZE;
   /* Need at most 3 extra bytes of memory, for data alignment */
   size_t total_size = code_size + data_size + 3;
   LPVOID remote_data;
@@ -375,13 +374,13 @@ validate_signal_number (int signo)
  */
 
 static void
-nt_alloc_process_data (struct Lisp_Process *p)
+nt_alloc_process_data (Lisp_Process *p)
 {
   p->process_data = xnew_and_zero (struct nt_process_data);
 }
 
 static void
-nt_finalize_process_data (struct Lisp_Process *p, int for_disksave)
+nt_finalize_process_data (Lisp_Process *p, int for_disksave)
 {
   assert (!for_disksave);
   if (NT_DATA(p)->h_process)
@@ -418,7 +417,7 @@ signal_cannot_launch (Lisp_Object image_file, DWORD err)
 }
 
 static int
-nt_create_process (struct Lisp_Process *p,
+nt_create_process (Lisp_Process *p,
                   Lisp_Object *argv, int nargv,
                   Lisp_Object program, Lisp_Object cur_dir)
 {
@@ -582,7 +581,7 @@ nt_create_process (struct Lisp_Process *p,
     new_space++;
     
     /* Allocate space and copy variables into it */
-    penv = proc_env = alloca(new_space);
+    penv = proc_env = (char*) alloca(new_space);
     for (i = 0; i < new_length; i++)
       {
        strcpy(penv, env[i]);
@@ -658,9 +657,7 @@ nt_create_process (struct Lisp_Process *p,
        kick_status_notify ();
       }
 
-    /* Hack to support Windows 95 negative pids */
-    return ((int)pi.dwProcessId < 0
-           ? -(int)pi.dwProcessId : (int)pi.dwProcessId);
+    return ((int)pi.dwProcessId);
   }
 }
 
@@ -673,7 +670,7 @@ nt_create_process (struct Lisp_Process *p,
  */
 
 static void
-nt_update_status_if_terminated (struct Lisp_Process* p)
+nt_update_status_if_terminated (Lisp_Process* p)
 {
   DWORD exit_code;
 
@@ -719,7 +716,8 @@ nt_update_status_if_terminated (struct Lisp_Process* p)
 static void
 nt_send_process (Lisp_Object proc, struct lstream* lstream)
 {
-  struct Lisp_Process *p = XPROCESS (proc);
+  volatile Lisp_Object vol_proc = proc;
+  Lisp_Process *volatile p = XPROCESS (proc);
 
   /* use a reasonable-sized buffer (somewhere around the size of the
      stream buffer) so as to avoid inundating the stream with blocked
@@ -749,7 +747,7 @@ nt_send_process (Lisp_Object proc, struct lstream* lstream)
          p->core_dumped = 0;
          p->tick++;
          process_tick++;
-         deactivate_process (proc);
+         deactivate_process (*((Lisp_Object *) (&vol_proc)));
          error ("Broken pipe error sending to process %s; closed it",
                 XSTRING_DATA (p->name));
        }
@@ -787,7 +785,7 @@ static void
 nt_kill_child_process (Lisp_Object proc, int signo,
                       int current_group, int nomsg)
 {
-  struct Lisp_Process *p = XPROCESS (proc);
+  Lisp_Process *p = XPROCESS (proc);
 
   /* Enable child signals if necessary.  This may lose the first
      but it's better than nothing. */
@@ -890,6 +888,12 @@ get_internet_address (Lisp_Object host, struct sockaddr_in *address,
          /* Ok, got an answer */
          if (WSAGETASYNCERROR(msg.lParam) == NO_ERROR)
            success = 1;
+         else
+           {
+             warn_when_safe(Qstream, Qwarning,
+                            "cannot get IP address for host \"%s\"",
+                            XSTRING_DATA (host));
+           }
          goto done;
        }
       else if (msg.message == WM_TIMER && msg.wParam == SOCK_TIMER_ID)
@@ -980,7 +984,6 @@ nt_open_network_stream (Lisp_Object name, Lisp_Object host, Lisp_Object service,
   retval = connect (s, (struct sockaddr *) &address, sizeof (address));
   if (retval != NO_ERROR && WSAGetLastError() != WSAEWOULDBLOCK)
     goto connect_failed;
-
   /* Wait while connection is established */
   while (1)
     {
@@ -1023,6 +1026,18 @@ nt_open_network_stream (Lisp_Object name, Lisp_Object host, Lisp_Object service,
 
  connect_failed:  
   closesocket (s);
+  if (INTP (service)) {
+    warn_when_safe(Qstream, Qwarning,
+                  "failure to open network stream to host \"%s\" for service \"%d\"",
+                  XSTRING_DATA (host),
+                  (unsigned short) XINT (service));
+  }
+  else {
+    warn_when_safe(Qstream, Qwarning,
+                  "failure to open network stream to host \"%s\" for service \"%s\"",
+                  XSTRING_DATA (host),
+                  XSTRING_DATA (service));
+  }
   report_file_error ("connection failed", list2 (host, name));
 }