#include <sys/file.h>
#include <sys/stat.h>
#include <setjmp.h>
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
#include <unistd.h>
#include <fcntl.h>
+#include "lisp.h"
+
/* Only MS-DOS does not define `subprocesses'. */
#ifdef subprocesses
#endif /* subprocesses */
-#include "lisp.h"
#include "systime.h"
#include "systty.h"
if (VECTORP (address)) /* AF_INET or AF_INET6 */
{
register struct Lisp_Vector *p = XVECTOR (address);
+ EMACS_UINT size = p->header.size;
Lisp_Object args[10];
int nargs, i;
- if (p->size == 4 || (p->size == 5 && !NILP (omit_port)))
+ if (size == 4 || (size == 5 && !NILP (omit_port)))
{
args[0] = build_string ("%d.%d.%d.%d");
nargs = 4;
}
- else if (p->size == 5)
+ else if (size == 5)
{
args[0] = build_string ("%d.%d.%d.%d:%d");
nargs = 5;
}
- else if (p->size == 8 || (p->size == 9 && !NILP (omit_port)))
+ else if (size == 8 || (size == 9 && !NILP (omit_port)))
{
args[0] = build_string ("%x:%x:%x:%x:%x:%x:%x:%x");
nargs = 8;
}
- else if (p->size == 9)
+ else if (size == 9)
{
args[0] = build_string ("[%x:%x:%x:%x:%x:%x:%x:%x]:%d");
nargs = 9;
{
if (EQ (coding_systems, Qt))
{
- args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof args2);
+ args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2);
args2[0] = Qstart_process;
for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
GCPRO2 (proc, current_dir);
if (VECTORP (address))
{
p = XVECTOR (address);
- if (p->size == 5)
+ if (p->header.size == 5)
{
*familyp = AF_INET;
return sizeof (struct sockaddr_in);
}
#ifdef AF_INET6
- else if (p->size == 9)
+ else if (p->header.size == 9)
{
*familyp = AF_INET6;
return sizeof (struct sockaddr_in6);
struct sockaddr *sa;
*familyp = XINT (XCAR (address));
p = XVECTOR (XCDR (address));
- return p->size + sizeof (sa->sa_family);
+ return p->header.size + sizeof (sa->sa_family);
}
return 0;
}
flags -= fp->flag_bit;
}
}
- for (fnum = 0; flags && fnum < 32; fnum++)
+ for (fnum = 0; flags && fnum < 32; flags >>= 1, fnum++)
{
- if (flags & (1 << fnum))
+ if (flags & 1)
{
elt = Fcons (make_number (fnum), elt);
}
impossible to step through wait_reading_process_output. */
#ifndef select
-static INLINE int
+static inline int
select_wrapper (int n, fd_set *rfd, fd_set *wfd, fd_set *xfd, struct timeval *tmo)
{
return select (n, rfd, wfd, xfd, tmo);
&Available,
(check_write ? &Writeok : (SELECT_TYPE *)0),
(SELECT_TYPE *)0, &timeout);
+
+#ifdef HAVE_GNUTLS
+ /* GnuTLS buffers data internally. In lowat mode it leaves
+ some data in the TCP buffers so that select works, but
+ with custom pull/push functions we need to check if some
+ data is available in the buffers manually. */
+ if (nfds == 0 &&
+ wait_proc && wait_proc->gnutls_p /* Check for valid process. */
+ /* Do we have pending data? */
+ && emacs_gnutls_record_check_pending (wait_proc->gnutls_state) > 0)
+ {
+ nfds = 1;
+ /* Set to Available. */
+ FD_SET (wait_proc->infd, &Available);
+ }
+#endif
}
xerrno = errno;
}
#ifdef HAVE_GNUTLS
if (XPROCESS (proc)->gnutls_p)
- nbytes = emacs_gnutls_read (channel, XPROCESS (proc),
+ nbytes = emacs_gnutls_read (XPROCESS (proc),
chars + carryover + buffered,
readmax - buffered);
else
{
#ifdef HAVE_GNUTLS
if (XPROCESS (proc)->gnutls_p)
- written = emacs_gnutls_write (outfd,
- XPROCESS (proc),
- buf, this);
+ written = emacs_gnutls_write (XPROCESS (proc),
+ buf, this);
else
#endif
written = emacs_write (outfd, buf, this);