Mercurial > emacs
comparison src/process.c @ 44314:f76a1425eb34
(DATAGRAM_CONN_P, list_processes_1)
(Fprocess_datagram_address, Fset_process_datagram_address)
(Fset_network_process_options, server_accept_connection):
Fix some int/Lisp_Object confusions (thank you union types).
| author | Stefan Monnier <monnier@iro.umontreal.ca> |
|---|---|
| date | Mon, 01 Apr 2002 19:49:47 +0000 |
| parents | 09f1bd069147 |
| children | 65c0edf0d53c |
comparison
equal
deleted
inserted
replaced
| 44313:d50a0256aa1b | 44314:f76a1425eb34 |
|---|---|
| 305 struct sockaddr_and_len { | 305 struct sockaddr_and_len { |
| 306 struct sockaddr *sa; | 306 struct sockaddr *sa; |
| 307 int len; | 307 int len; |
| 308 } datagram_address[MAXDESC]; | 308 } datagram_address[MAXDESC]; |
| 309 #define DATAGRAM_CHAN_P(chan) (datagram_address[chan].sa != 0) | 309 #define DATAGRAM_CHAN_P(chan) (datagram_address[chan].sa != 0) |
| 310 #define DATAGRAM_CONN_P(proc) (PROCESSP (proc) && datagram_address[XPROCESS (proc)->infd].sa != 0) | 310 #define DATAGRAM_CONN_P(proc) (PROCESSP (proc) && datagram_address[XINT (XPROCESS (proc)->infd)].sa != 0) |
| 311 #else | 311 #else |
| 312 #define DATAGRAM_CHAN_P(chan) (0) | 312 #define DATAGRAM_CHAN_P(chan) (0) |
| 313 #define DATAGRAM_CONN_P(proc) (0) | 313 #define DATAGRAM_CONN_P(proc) (0) |
| 314 #endif | 314 #endif |
| 315 | 315 |
| 1198 { | 1198 { |
| 1199 Lisp_Object port = Fplist_get (p->childp, QCservice); | 1199 Lisp_Object port = Fplist_get (p->childp, QCservice); |
| 1200 if (INTEGERP (port)) | 1200 if (INTEGERP (port)) |
| 1201 port = Fnumber_to_string (port); | 1201 port = Fnumber_to_string (port); |
| 1202 sprintf (tembuf, "(network %s server on %s)\n", | 1202 sprintf (tembuf, "(network %s server on %s)\n", |
| 1203 (DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"), | 1203 (DATAGRAM_CHAN_P (XINT (p->infd)) ? "datagram" : "stream"), |
| 1204 XSTRING (port)->data); | 1204 XSTRING (port)->data); |
| 1205 insert_string (tembuf); | 1205 insert_string (tembuf); |
| 1206 } | 1206 } |
| 1207 else if (NETCONN1_P (p)) | 1207 else if (NETCONN1_P (p)) |
| 1208 { | 1208 { |
| 1214 host = Fplist_get (p->childp, QCservice); | 1214 host = Fplist_get (p->childp, QCservice); |
| 1215 if (INTEGERP (host)) | 1215 if (INTEGERP (host)) |
| 1216 host = Fnumber_to_string (host); | 1216 host = Fnumber_to_string (host); |
| 1217 } | 1217 } |
| 1218 sprintf (tembuf, "(network %s connection to %s)\n", | 1218 sprintf (tembuf, "(network %s connection to %s)\n", |
| 1219 (DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"), | 1219 (DATAGRAM_CHAN_P (XINT (p->infd)) ? "datagram" : "stream"), |
| 1220 XSTRING (host)->data); | 1220 XSTRING (host)->data); |
| 1221 insert_string (tembuf); | 1221 insert_string (tembuf); |
| 1222 } | 1222 } |
| 1223 else | 1223 else |
| 1224 { | 1224 { |
| 2117 CHECK_PROCESS (process); | 2117 CHECK_PROCESS (process); |
| 2118 | 2118 |
| 2119 if (!DATAGRAM_CONN_P (process)) | 2119 if (!DATAGRAM_CONN_P (process)) |
| 2120 return Qnil; | 2120 return Qnil; |
| 2121 | 2121 |
| 2122 channel = XPROCESS (process)->infd; | 2122 channel = XINT (XPROCESS (process)->infd); |
| 2123 return conv_sockaddr_to_lisp (datagram_address[channel].sa, | 2123 return conv_sockaddr_to_lisp (datagram_address[channel].sa, |
| 2124 datagram_address[channel].len); | 2124 datagram_address[channel].len); |
| 2125 } | 2125 } |
| 2126 | 2126 |
| 2127 DEFUN ("set-process-datagram-address", Fset_process_datagram_address, Sset_process_datagram_address, | 2127 DEFUN ("set-process-datagram-address", Fset_process_datagram_address, Sset_process_datagram_address, |
| 2137 CHECK_PROCESS (process); | 2137 CHECK_PROCESS (process); |
| 2138 | 2138 |
| 2139 if (!DATAGRAM_CONN_P (process)) | 2139 if (!DATAGRAM_CONN_P (process)) |
| 2140 return Qnil; | 2140 return Qnil; |
| 2141 | 2141 |
| 2142 channel = XPROCESS (process)->infd; | 2142 channel = XINT (XPROCESS (process)->infd); |
| 2143 | 2143 |
| 2144 len = get_lisp_to_sockaddr_size (address, &family); | 2144 len = get_lisp_to_sockaddr_size (address, &family); |
| 2145 if (datagram_address[channel].len != len) | 2145 if (datagram_address[channel].len != len) |
| 2146 return Qnil; | 2146 return Qnil; |
| 2147 conv_lisp_to_sockaddr (family, address, datagram_address[channel].sa, len); | 2147 conv_lisp_to_sockaddr (family, address, datagram_address[channel].sa, len); |
| 2372 Lisp_Object process; | 2372 Lisp_Object process; |
| 2373 Lisp_Object opts; | 2373 Lisp_Object opts; |
| 2374 | 2374 |
| 2375 process = args[0]; | 2375 process = args[0]; |
| 2376 CHECK_PROCESS (process); | 2376 CHECK_PROCESS (process); |
| 2377 if (nargs > 1 && XPROCESS (process)->infd >= 0) | 2377 if (nargs > 1 && XINT (XPROCESS (process)->infd) >= 0) |
| 2378 { | 2378 { |
| 2379 opts = Flist (nargs, args); | 2379 opts = Flist (nargs, args); |
| 2380 set_socket_options (XPROCESS (process)->infd, opts, 0); | 2380 set_socket_options (XINT (XPROCESS (process)->infd), opts, 0); |
| 2381 } | 2381 } |
| 2382 return process; | 2382 return process; |
| 2383 } | 2383 } |
| 2384 | 2384 |
| 2385 /* A version of request_sigio suitable for a record_unwind_protect. */ | 2385 /* A version of request_sigio suitable for a record_unwind_protect. */ |
| 3526 call3 (ps->log, server, proc, | 3526 call3 (ps->log, server, proc, |
| 3527 concat3 (build_string ("accept from "), | 3527 concat3 (build_string ("accept from "), |
| 3528 (STRINGP (host) ? host : build_string ("-")), | 3528 (STRINGP (host) ? host : build_string ("-")), |
| 3529 build_string ("\n"))); | 3529 build_string ("\n"))); |
| 3530 | 3530 |
| 3531 if (p->sentinel) | 3531 if (!NILP (p->sentinel)) |
| 3532 exec_sentinel (proc, | 3532 exec_sentinel (proc, |
| 3533 concat3 (build_string ("open from "), | 3533 concat3 (build_string ("open from "), |
| 3534 (STRINGP (host) ? host : build_string ("-")), | 3534 (STRINGP (host) ? host : build_string ("-")), |
| 3535 build_string ("\n"))); | 3535 build_string ("\n"))); |
| 3536 } | 3536 } |
