Mercurial > emacs
comparison src/process.c @ 7220:a33eb16cab9d
(Fopen_network_stream): Retry the connect if EADDRINUSE. Ignore EISCONN.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 30 Apr 1994 06:05:51 +0000 |
parents | 3f4fc9d682b4 |
children | c9598edda1a2 |
comparison
equal
deleted
inserted
replaced
7219:61202823bbb9 | 7220:a33eb16cab9d |
---|---|
1480 int s, outch, inch; | 1480 int s, outch, inch; |
1481 char errstring[80]; | 1481 char errstring[80]; |
1482 int port; | 1482 int port; |
1483 struct hostent host_info_fixed; | 1483 struct hostent host_info_fixed; |
1484 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 1484 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
1485 int retry = 0; | |
1485 | 1486 |
1486 GCPRO4 (name, buffer, host, service); | 1487 GCPRO4 (name, buffer, host, service); |
1487 CHECK_STRING (name, 0); | 1488 CHECK_STRING (name, 0); |
1488 CHECK_STRING (host, 0); | 1489 CHECK_STRING (host, 0); |
1489 if (XTYPE(service) == Lisp_Int) | 1490 if (XTYPE(service) == Lisp_Int) |
1539 to quit if polling is turned off. */ | 1540 to quit if polling is turned off. */ |
1540 if (interrupt_input) | 1541 if (interrupt_input) |
1541 unrequest_sigio (); | 1542 unrequest_sigio (); |
1542 | 1543 |
1543 loop: | 1544 loop: |
1544 if (connect (s, (struct sockaddr *) &address, sizeof address) == -1) | 1545 if (connect (s, (struct sockaddr *) &address, sizeof address) == -1 |
1546 && errno != EISCONN) | |
1545 { | 1547 { |
1546 int xerrno = errno; | 1548 int xerrno = errno; |
1549 | |
1547 if (errno == EINTR) | 1550 if (errno == EINTR) |
1548 goto loop; | 1551 goto loop; |
1552 if (errno == EADDRINUSE && retry < 20) | |
1553 { | |
1554 retry++; | |
1555 goto loop; | |
1556 } | |
1557 | |
1549 close (s); | 1558 close (s); |
1550 | 1559 |
1551 if (interrupt_input) | 1560 if (interrupt_input) |
1552 request_sigio (); | 1561 request_sigio (); |
1553 | 1562 |
2460 This is used for various commands in shell mode. | 2469 This is used for various commands in shell mode. |
2461 If NOMSG is zero, insert signal-announcements into process's buffers | 2470 If NOMSG is zero, insert signal-announcements into process's buffers |
2462 right away. | 2471 right away. |
2463 | 2472 |
2464 If we can, we try to signal PROCESS by sending control characters | 2473 If we can, we try to signal PROCESS by sending control characters |
2465 down the pipe. This allows us to signal inferiors who have changed | 2474 down the pty. This allows us to signal inferiors who have changed |
2466 their uid, for which killpg would return an EPERM error. */ | 2475 their uid, for which killpg would return an EPERM error. */ |
2467 | 2476 |
2468 static void | 2477 static void |
2469 process_send_signal (process, signo, current_group, nomsg) | 2478 process_send_signal (process, signo, current_group, nomsg) |
2470 Lisp_Object process; | 2479 Lisp_Object process; |
2672 } | 2681 } |
2673 | 2682 |
2674 DEFUN ("interrupt-process", Finterrupt_process, Sinterrupt_process, 0, 2, 0, | 2683 DEFUN ("interrupt-process", Finterrupt_process, Sinterrupt_process, 0, 2, 0, |
2675 "Interrupt process PROCESS. May be process or name of one.\n\ | 2684 "Interrupt process PROCESS. May be process or name of one.\n\ |
2676 PROCESS may be a process, a buffer, or the name of a process or buffer.\n\ | 2685 PROCESS may be a process, a buffer, or the name of a process or buffer.\n\ |
2677 Nil or no arg means current buffer's process.\n\ | 2686 nil or no arg means current buffer's process.\n\ |
2678 Second arg CURRENT-GROUP non-nil means send signal to\n\ | 2687 Second arg CURRENT-GROUP non-nil means send signal to\n\ |
2679 the current process-group of the process's controlling terminal\n\ | 2688 the current process-group of the process's controlling terminal\n\ |
2680 rather than to the process's own process group.\n\ | 2689 rather than to the process's own process group.\n\ |
2681 If the process is a shell, this means interrupt current subjob\n\ | 2690 If the process is a shell, this means interrupt current subjob\n\ |
2682 rather than the shell.") | 2691 rather than the shell.") |
3186 | 3195 |
3187 delete_exited_processes = 1; | 3196 delete_exited_processes = 1; |
3188 | 3197 |
3189 DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type, | 3198 DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type, |
3190 "Control type of device used to communicate with subprocesses.\n\ | 3199 "Control type of device used to communicate with subprocesses.\n\ |
3191 Values are nil to use a pipe, and t or 'pty for a pty. Note that if\n\ | 3200 Values are nil to use a pipe, or t or `pty' to use a pty.\n\ |
3192 pty's are not available, this variable will be ignored. The value takes\n\ | 3201 The value has no effect if the system has no ptys or if all ptys are busy:\n\ |
3193 effect when `start-process' is called."); | 3202 then a pipe is used in any case.\n\ |
3203 The value takes effect when `start-process' is called."); | |
3194 Vprocess_connection_type = Qt; | 3204 Vprocess_connection_type = Qt; |
3195 | 3205 |
3196 defsubr (&Sprocessp); | 3206 defsubr (&Sprocessp); |
3197 defsubr (&Sget_process); | 3207 defsubr (&Sget_process); |
3198 defsubr (&Sget_buffer_process); | 3208 defsubr (&Sget_buffer_process); |