comparison src/process-unix.c @ 424:11054d720c21 r21-2-20

Import from CVS: tag r21-2-20
author cvs
date Mon, 13 Aug 2007 11:26:11 +0200
parents 697ef44129c6
children
comparison
equal deleted inserted replaced
423:28d9c139be4c 424:11054d720c21
210 are no pseudoterminals with names ending in 'f'. So we wait for 210 are no pseudoterminals with names ending in 'f'. So we wait for
211 three failures in a row before deciding that we've reached the 211 three failures in a row before deciding that we've reached the
212 end of the ptys. */ 212 end of the ptys. */
213 int failed_count = 0; 213 int failed_count = 0;
214 #endif 214 #endif
215 int fd;
216 #ifndef HAVE_GETPT
215 int i; 217 int i;
216 int fd;
217 int c; 218 int c;
219 #endif
218 220
219 #ifdef PTY_ITERATION 221 #ifdef PTY_ITERATION
220 PTY_ITERATION 222 PTY_ITERATION
221 #else 223 #else
222 for (c = FIRST_PTY_LETTER; c <= 'z'; c++) 224 for (c = FIRST_PTY_LETTER; c <= 'z'; c++)
259 #ifdef PTY_TTY_NAME_SPRINTF 261 #ifdef PTY_TTY_NAME_SPRINTF
260 PTY_TTY_NAME_SPRINTF 262 PTY_TTY_NAME_SPRINTF
261 #else 263 #else
262 sprintf (pty_name, "/dev/tty%c%x", c, i); 264 sprintf (pty_name, "/dev/tty%c%x", c, i);
263 #endif /* no PTY_TTY_NAME_SPRINTF */ 265 #endif /* no PTY_TTY_NAME_SPRINTF */
264 #ifndef UNIPLUS 266 #if !defined(UNIPLUS) && !defined(HAVE_GETPT)
265 if (access (pty_name, 6) != 0) 267 if (access (pty_name, 6) != 0)
266 { 268 {
267 close (fd); 269 close (fd);
268 #if !defined(IRIS) && !defined(__sgi) 270 #if !defined(IRIS) && !defined(__sgi)
269 continue; 271 continue;
382 if ((svc_info != 0) && (svc_info->s_port == port)) 384 if ((svc_info != 0) && (svc_info->s_port == port))
383 break; 385 break;
384 else 386 else
385 continue; 387 continue;
386 } 388 }
387 else if ((INTP (tail_port)) && (htons ((unsigned short) XINT (tail_port)) == port)) 389 else if (INTP (tail_port) && (htons ((unsigned short) XINT (tail_port)) == port))
388 break; 390 break;
389 } 391 }
390 392
391 if (!CONSP (tail)) 393 if (!CONSP (tail))
392 { 394 {
661 /* 663 /*
662 * Mark any Lisp objects in Lisp_Process->process_data 664 * Mark any Lisp objects in Lisp_Process->process_data
663 */ 665 */
664 666
665 static void 667 static void
666 unix_mark_process_data (struct Lisp_Process *proc, 668 unix_mark_process_data (struct Lisp_Process *proc)
667 void (*markobj) (Lisp_Object)) 669 {
668 { 670 mark_object (UNIX_DATA(proc)->tty_name);
669 markobj (UNIX_DATA(proc)->tty_name);
670 } 671 }
671 672
672 /* 673 /*
673 * Initialize XEmacs process implementation once 674 * Initialize XEmacs process implementation once
674 */ 675 */
1427 connection has no PID; you cannot signal it. All you can do is 1428 connection has no PID; you cannot signal it. All you can do is
1428 deactivate and close it via delete-process */ 1429 deactivate and close it via delete-process */
1429 1430
1430 static void 1431 static void
1431 unix_open_network_stream (Lisp_Object name, Lisp_Object host, Lisp_Object service, 1432 unix_open_network_stream (Lisp_Object name, Lisp_Object host, Lisp_Object service,
1432 Lisp_Object family, void** vinfd, void** voutfd) 1433 Lisp_Object protocol, void** vinfd, void** voutfd)
1433 { 1434 {
1434 struct sockaddr_in address; 1435 struct sockaddr_in address;
1435 int s, inch, outch; 1436 int inch;
1437 int outch;
1438 volatile int s;
1436 volatile int port; 1439 volatile int port;
1437 volatile int retry = 0; 1440 volatile int retry = 0;
1438 int retval; 1441 int retval;
1439 1442
1440 CHECK_STRING (host); 1443 CHECK_STRING (host);
1441 1444
1442 if (!EQ (family, Qtcpip)) 1445 if (!EQ (protocol, Qtcp) && !EQ (protocol, Qudp))
1443 error ("Unsupported protocol family \"%s\"", 1446 error ("Unsupported protocol \"%s\"",
1444 string_data (symbol_name (XSYMBOL (family)))); 1447 string_data (symbol_name (XSYMBOL (protocol))));
1445 1448
1446 if (INTP (service)) 1449 if (INTP (service))
1447 port = htons ((unsigned short) XINT (service)); 1450 port = htons ((unsigned short) XINT (service));
1448 else 1451 else
1449 { 1452 {
1450 struct servent *svc_info; 1453 struct servent *svc_info;
1451 CHECK_STRING (service); 1454 CHECK_STRING (service);
1452 svc_info = getservbyname ((char *) XSTRING_DATA (service), "tcp"); 1455
1456 if (EQ (protocol, Qtcp))
1457 svc_info = getservbyname ((char *) XSTRING_DATA (service), "tcp");
1458 else /* EQ (protocol, Qudp) */
1459 svc_info = getservbyname ((char *) XSTRING_DATA (service), "udp");
1460
1453 if (svc_info == 0) 1461 if (svc_info == 0)
1454 error ("Unknown service \"%s\"", XSTRING_DATA (service)); 1462 error ("Unknown service \"%s\"", XSTRING_DATA (service));
1455 port = svc_info->s_port; 1463 port = svc_info->s_port;
1456 } 1464 }
1457 1465
1458 get_internet_address (host, &address, ERROR_ME); 1466 get_internet_address (host, &address, ERROR_ME);
1459 address.sin_port = port; 1467 address.sin_port = port;
1460 1468
1461 s = socket (address.sin_family, SOCK_STREAM, 0); 1469 if (EQ (protocol, Qtcp))
1470 s = socket (address.sin_family, SOCK_STREAM, 0);
1471 else /* EQ (protocol, Qudp) */
1472 s = socket (address.sin_family, SOCK_DGRAM, 0);
1473
1462 if (s < 0) 1474 if (s < 0)
1463 report_file_error ("error creating socket", list1 (name)); 1475 report_file_error ("error creating socket", list1 (name));
1464 1476
1465 /* Turn off interrupts here -- see comments below. There used to 1477 /* Turn off interrupts here -- see comments below. There used to
1466 be code which called bind_polling_period() to slow the polling 1478 be code which called bind_polling_period() to slow the polling