int len;
} datagram_address[MAXDESC];
#define DATAGRAM_CHAN_P(chan) (datagram_address[chan].sa != 0)
-#define DATAGRAM_CONN_P(proc) (datagram_address[XPROCESS (proc)->infd].sa != 0)
+#define DATAGRAM_CONN_P(proc) (PROCESSP (proc) && datagram_address[XINT (XPROCESS (proc)->infd)].sa != 0)
#else
#define DATAGRAM_CHAN_P(chan) (0)
#define DATAGRAM_CONN_P(proc) (0)
if (INTEGERP (port))
port = Fnumber_to_string (port);
sprintf (tembuf, "(network %s server on %s)\n",
- (DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"),
+ (DATAGRAM_CHAN_P (XINT (p->infd)) ? "datagram" : "stream"),
XSTRING (port)->data);
insert_string (tembuf);
}
host = Fnumber_to_string (host);
}
sprintf (tembuf, "(network %s connection to %s)\n",
- (DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"),
+ (DATAGRAM_CHAN_P (XINT (p->infd)) ? "datagram" : "stream"),
XSTRING (host)->data);
insert_string (tembuf);
}
with any buffer.
Third arg is program file name. It is searched for in PATH.
Remaining arguments are strings to give program as arguments.
+
usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
(nargs, args)
int nargs;
if (!DATAGRAM_CONN_P (process))
return Qnil;
- channel = XPROCESS (process)->infd;
+ channel = XINT (XPROCESS (process)->infd);
return conv_sockaddr_to_lisp (datagram_address[channel].sa,
datagram_address[channel].len);
}
if (!DATAGRAM_CONN_P (process))
return Qnil;
- channel = XPROCESS (process)->infd;
+ channel = XINT (XPROCESS (process)->infd);
len = get_lisp_to_sockaddr_size (address, &family);
if (datagram_address[channel].len != len)
Fset_network_process_options, Sset_network_process_options,
1, MANY, 0,
doc: /* Set one or more options for network process PROCESS.
-Arguments are PROCESS &rest OPTIONS.
Each option is either a string "OPT=VALUE" or a cons (OPT . VALUE).
A boolean value is false if it either zero or nil, true otherwise.
linger=BOOL or TIMEOUT -- Send queued messages before closing.
oobinline=BOOL -- Place out-of-band data in receive data stream.
priority=INT -- Set protocol defined priority for sent packets.
-reuseaddr=BOOL -- Allow reusing a recently used address. */)
+reuseaddr=BOOL -- Allow reusing a recently used address.
+
+usage: (set-network-process-options PROCESS &rest OPTIONS) */)
(nargs, args)
int nargs;
Lisp_Object *args;
process = args[0];
CHECK_PROCESS (process);
- if (nargs > 1 && XPROCESS (process)->infd >= 0)
+ if (nargs > 1 && XINT (XPROCESS (process)->infd) >= 0)
{
opts = Flist (nargs, args);
- set_socket_options (XPROCESS (process)->infd, opts, 0);
+ set_socket_options (XINT (XPROCESS (process)->infd), opts, 0);
}
return process;
}
:coding CODING -- CODING is coding system for this process.
:options OPTIONS -- Set the specified options for the network process.
-See `set-process-options' for details.
+See `set-network-process-options' for details.
:nowait BOOL -- If BOOL is non-nil for a stream type client process,
return without waiting for the connection to complete; instead, the
(STRINGP (host) ? host : build_string ("-")),
build_string ("\n")));
- if (p->sentinel)
+ if (!NILP (p->sentinel))
exec_sentinel (proc,
concat3 (build_string ("open from "),
(STRINGP (host) ? host : build_string ("-")),
/* Report all recent events of a change in process status
(either run the sentinel or output a message).
- This is done while Emacs is waiting for keyboard input. */
+ This is usually done while Emacs is waiting for keyboard input
+ but can be done at other times. */
void
status_notify ()
init_process ()
{
register int i;
- Lisp_Object subfeatures;
#ifdef SIGCHLD
#ifndef CANNOT_DUMP
bzero (datagram_address, sizeof datagram_address);
#endif
+#ifdef HAVE_SOCKETS
+ {
+ Lisp_Object subfeatures = Qnil;
#define ADD_SUBFEATURE(key, val) \
subfeatures = Fcons (Fcons (key, Fcons (val, Qnil)), subfeatures)
- subfeatures = Qnil;
#ifdef NON_BLOCKING_CONNECT
- ADD_SUBFEATURE (QCnowait, Qt);
+ ADD_SUBFEATURE (QCnowait, Qt);
#endif
#ifdef DATAGRAM_SOCKETS
- ADD_SUBFEATURE (QCtype, Qdatagram);
+ ADD_SUBFEATURE (QCtype, Qdatagram);
#endif
#ifdef HAVE_LOCAL_SOCKETS
- ADD_SUBFEATURE (QCfamily, Qlocal);
+ ADD_SUBFEATURE (QCfamily, Qlocal);
#endif
#ifdef HAVE_GETSOCKNAME
- ADD_SUBFEATURE (QCservice, Qt);
+ ADD_SUBFEATURE (QCservice, Qt);
#endif
#ifndef TERM
- ADD_SUBFEATURE (QCserver, Qt);
+ ADD_SUBFEATURE (QCserver, Qt);
#endif
#ifdef SO_BINDTODEVICE
- ADD_SUBFEATURE (QCoptions, intern ("bindtodevice"));
+ ADD_SUBFEATURE (QCoptions, intern ("bindtodevice"));
#endif
#ifdef SO_BROADCAST
- ADD_SUBFEATURE (QCoptions, intern ("broadcast"));
+ ADD_SUBFEATURE (QCoptions, intern ("broadcast"));
#endif
#ifdef SO_DONTROUTE
- ADD_SUBFEATURE (QCoptions, intern ("dontroute"));
+ ADD_SUBFEATURE (QCoptions, intern ("dontroute"));
#endif
#ifdef SO_KEEPALIVE
- ADD_SUBFEATURE (QCoptions, intern ("keepalive"));
+ ADD_SUBFEATURE (QCoptions, intern ("keepalive"));
#endif
#ifdef SO_LINGER
- ADD_SUBFEATURE (QCoptions, intern ("linger"));
+ ADD_SUBFEATURE (QCoptions, intern ("linger"));
#endif
#ifdef SO_OOBINLINE
- ADD_SUBFEATURE (QCoptions, intern ("oobinline"));
+ ADD_SUBFEATURE (QCoptions, intern ("oobinline"));
#endif
#ifdef SO_PRIORITY
- ADD_SUBFEATURE (QCoptions, intern ("priority"));
+ ADD_SUBFEATURE (QCoptions, intern ("priority"));
#endif
#ifdef SO_REUSEADDR
- ADD_SUBFEATURE (QCoptions, intern ("reuseaddr"));
+ ADD_SUBFEATURE (QCoptions, intern ("reuseaddr"));
#endif
- Fprovide (intern ("make-network-process"), subfeatures);
+ Fprovide (intern ("make-network-process"), subfeatures);
+ }
+#endif /* HAVE_SOCKETS */
}
void