Lisp_Object buffer, name, program, proc, current_dir, tem;
register unsigned char **new_argv;
ptrdiff_t i;
- ptrdiff_t count = SPECPDL_INDEX ();
+ dynwind_begin ();
buffer = args[1];
if (!NILP (buffer))
else
create_pty (proc);
- return unbind_to (count, proc);
+ dynwind_end ();
+ return proc;
}
/* This function is the unwind_protect form for Fstart_process. If
name = port;
CHECK_STRING (name);
proc = make_process (name);
- specpdl_count = SPECPDL_INDEX ();
- record_unwind_protect (remove_process, proc);
+ dynwind_begin ();
+ record_unwind_protect_1 (remove_process, proc, false);
p = XPROCESS (proc);
fd = serial_open (port);
Fserial_process_configure (nargs, args);
- specpdl_ptr = specpdl + specpdl_count;
+ dynwind_end ();
UNGCPRO;
return proc;
int xerrno = 0;
int s = -1, outch, inch;
struct gcpro gcpro1;
- ptrdiff_t count = SPECPDL_INDEX ();
- ptrdiff_t count1;
Lisp_Object colon_address; /* Either QClocal or QCremote. */
Lisp_Object tem;
Lisp_Object name, buffer, host, service, address;
if (nargs == 0)
return Qnil;
+ dynwind_begin ();
+
/* Save arguments for process-contact and clone-process. */
contact = Flist (nargs, args);
GCPRO1 (contact);
open_socket:
/* Do this in case we never enter the for-loop below. */
- count1 = SPECPDL_INDEX ();
+ dynwind_begin ();
s = -1;
for (lres = res; lres; lres = lres->ai_next)
#endif
/* Make us close S if quit. */
- record_unwind_protect_int (close_file_unwind, s);
+ record_unwind_protect_int_1 (close_file_unwind, s, false);
/* Parse network options in the arg list.
We simply ignore anything which isn't a known option (including other keywords).
immediate_quit = 0;
- /* Discard the unwind protect closing S. */
- specpdl_ptr = specpdl + count1;
+ dynwind_end ();
+ dynwind_begin ();
emacs_close (s);
s = -1;
the normal blocking calls to open-network-stream handles this error
better. */
if (is_non_blocking_client)
+ {
+ dynwind_end ();
+ dynwind_end ();
return Qnil;
+ }
report_file_errno ((is_server
? "make server process failed"
p->infd = inch;
p->outfd = outch;
- /* Discard the unwind protect for closing S, if any. */
- specpdl_ptr = specpdl + count1;
-
- /* Unwind bind_polling_period and request_sigio. */
- unbind_to (count, Qnil);
+ dynwind_end ();
+ dynwind_end ();
if (is_server && socktype != SOCK_DGRAM)
pset_status (p, Qlisten);
void *buf = NULL;
ptrdiff_t buf_size = 512;
int s;
- Lisp_Object res;
+ Lisp_Object res = Qnil;
ptrdiff_t count;
s = socket (AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (s < 0)
return Qnil;
- count = SPECPDL_INDEX ();
+ dynwind_begin ();
record_unwind_protect_int (close_file_unwind, s);
do
{
emacs_close (s);
xfree (buf);
+ dynwind_end ();
return Qnil;
}
}
while (ifconf.ifc_len == buf_size);
- res = unbind_to (count, Qnil);
+ dynwind_end ();
ifreq = ifconf.ifc_req;
while ((char *) ifreq < (char *) ifconf.ifc_req + ifconf.ifc_len)
{
s = socket (AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (s < 0)
return Qnil;
- count = SPECPDL_INDEX ();
+ dynwind_begin ();
record_unwind_protect_int (close_file_unwind, s);
elt = Qnil;
#endif
res = Fcons (elt, res);
- return unbind_to (count, any ? res : Qnil);
+ Lisp_Object tem0 = any ? res : Qnil;
+ dynwind_end ();
+ return tem0;
}
#endif /* !SIOCGIFADDR && !SIOCGIFHWADDR && !SIOCGIFFLAGS */
#endif /* defined (HAVE_NET_IF_H) */
return;
}
- count = SPECPDL_INDEX ();
- record_unwind_protect_int (close_file_unwind, s);
+ dynwind_begin ();
+ record_unwind_protect_int_1 (close_file_unwind, s, false);
connect_counter++;
pset_command (p, Qnil);
p->pid = 0;
- /* Discard the unwind protect for closing S. */
- specpdl_ptr = specpdl + count;
+ dynwind_end ();
p->open_fd[SUBPROCESS_STDIN] = s;
p->infd = s;
Lisp_Object proc;
struct timespec timeout, end_time;
int got_some_input = -1;
- ptrdiff_t count = SPECPDL_INDEX ();
+ dynwind_begin ();
FD_ZERO (&Available);
FD_ZERO (&Writeok);
#endif
#if defined (HAVE_NS)
- nfds = ns_select
+# define SELECT ns_select
#elif defined (HAVE_GLIB)
- nfds = xg_select
+# define SELECT xg_select
#else
- nfds = pselect
+# define SELECT pselect
#endif
+ nfds = SELECT
(max (max_process_desc, max_input_desc) + 1,
&Available,
(check_write ? &Writeok : 0),
NULL, &timeout, NULL);
+#undef SELECT
#ifdef HAVE_GNUTLS
/* GnuTLS buffers data internally. In lowat mode it leaves
} /* End for each file descriptor. */
} /* End while exit conditions not met. */
- unbind_to (count, Qnil);
+ dynwind_end ();
/* If calling from keyboard input, do not quit
since we want to return C-g as an input character.
struct coding_system *coding = proc_decode_coding_system[channel];
int carryover = p->decoding_carryover;
int readmax = 4096;
- ptrdiff_t count = SPECPDL_INDEX ();
+ dynwind_begin ();
Lisp_Object odeactivate;
chars = alloca (carryover + readmax);
(including the one in proc_buffered_char[channel]). */
if (nbytes <= 0)
{
- if (nbytes < 0 || coding->mode & CODING_MODE_LAST_BLOCK)
- return nbytes;
+ if (nbytes < 0 || coding->mode & CODING_MODE_LAST_BLOCK) {
+ dynwind_end ();
+ return nbytes;
+ }
coding->mode |= CODING_MODE_LAST_BLOCK;
}
/* Handling the process output should not deactivate the mark. */
Vdeactivate_mark = odeactivate;
- unbind_to (count, Qnil);
+ dynwind_end ();
return nbytes;
}
{
Lisp_Object sentinel, odeactivate;
struct Lisp_Process *p = XPROCESS (proc);
- ptrdiff_t count = SPECPDL_INDEX ();
+ dynwind_begin ();
bool outer_running_asynch_code = running_asynch_code;
int waiting = waiting_for_user_input_p;
- if (inhibit_sentinels)
+ if (inhibit_sentinels) {
+ dynwind_end ();
return;
+ }
/* No need to gcpro these, because all we do with them later
is test them for EQness, and none of them should be a string. */
if (waiting_for_user_input_p == -1)
record_asynch_buffer_change ();
- unbind_to (count, Qnil);
+ dynwind_end ();
}
/* Report all recent events of a change in process status
/* Turn off periodic alarms (in case they are in use)
and then turn off any other atimers,
because the select emulator uses alarms. */
- stop_polling ();
turn_on_atimers (0);
while (1)
break;
}
- start_polling ();
+ turn_on_atimers (1);
return -1;
}
void
syms_of_process (void)
{
+#include "process.x"
+
#ifdef subprocesses
DEFSYM (Qprocessp, "processp");
The variable takes effect when `start-process' is called. */);
Vprocess_adaptive_read_buffering = Qt;
#endif
-
- defsubr (&Sprocessp);
- defsubr (&Sget_process);
- defsubr (&Sdelete_process);
- defsubr (&Sprocess_status);
- defsubr (&Sprocess_exit_status);
- defsubr (&Sprocess_id);
- defsubr (&Sprocess_name);
- defsubr (&Sprocess_tty_name);
- defsubr (&Sprocess_command);
- defsubr (&Sset_process_buffer);
- defsubr (&Sprocess_buffer);
- defsubr (&Sprocess_mark);
- defsubr (&Sset_process_filter);
- defsubr (&Sprocess_filter);
- defsubr (&Sset_process_sentinel);
- defsubr (&Sprocess_sentinel);
- defsubr (&Sset_process_window_size);
- defsubr (&Sset_process_inherit_coding_system_flag);
- defsubr (&Sset_process_query_on_exit_flag);
- defsubr (&Sprocess_query_on_exit_flag);
- defsubr (&Sprocess_contact);
- defsubr (&Sprocess_plist);
- defsubr (&Sset_process_plist);
- defsubr (&Sprocess_list);
- defsubr (&Sstart_process);
- defsubr (&Sserial_process_configure);
- defsubr (&Smake_serial_process);
- defsubr (&Sset_network_process_option);
- defsubr (&Smake_network_process);
- defsubr (&Sformat_network_address);
- defsubr (&Snetwork_interface_list);
- defsubr (&Snetwork_interface_info);
-#ifdef DATAGRAM_SOCKETS
- defsubr (&Sprocess_datagram_address);
- defsubr (&Sset_process_datagram_address);
-#endif
- defsubr (&Saccept_process_output);
- defsubr (&Sprocess_send_region);
- defsubr (&Sprocess_send_string);
- defsubr (&Sinterrupt_process);
- defsubr (&Skill_process);
- defsubr (&Squit_process);
- defsubr (&Sstop_process);
- defsubr (&Scontinue_process);
- defsubr (&Sprocess_running_child_p);
- defsubr (&Sprocess_send_eof);
- defsubr (&Ssignal_process);
- defsubr (&Swaiting_for_user_input_p);
- defsubr (&Sprocess_type);
- defsubr (&Sinternal_default_process_sentinel);
- defsubr (&Sinternal_default_process_filter);
- defsubr (&Sset_process_coding_system);
- defsubr (&Sprocess_coding_system);
- defsubr (&Sset_process_filter_multibyte);
- defsubr (&Sprocess_filter_multibyte_p);
-
#endif /* subprocesses */
-
- defsubr (&Sget_buffer_process);
- defsubr (&Sprocess_inherit_coding_system_flag);
- defsubr (&Slist_system_processes);
- defsubr (&Sprocess_attributes);
}