diff options
| author | Stefan Monnier | 2010-10-15 17:55:33 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2010-10-15 17:55:33 -0400 |
| commit | 0c747cb143fa227e78f350ac353d703f489209df (patch) | |
| tree | 5b434055c797bd75eaa1e3d9d0773e586d44daee /src/process.c | |
| parent | a01a7932080e8a6e7bc8472c58cefabcc2c37df3 (diff) | |
| parent | aa095b2db98ae149737f8de00ee733b1d257ed33 (diff) | |
| download | emacs-0c747cb143fa227e78f350ac353d703f489209df.tar.gz emacs-0c747cb143fa227e78f350ac353d703f489209df.zip | |
Merge from trunk
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/src/process.c b/src/process.c index a698e56fe39..e1515065957 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -31,7 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 31 | #ifdef HAVE_INTTYPES_H | 31 | #ifdef HAVE_INTTYPES_H |
| 32 | #include <inttypes.h> | 32 | #include <inttypes.h> |
| 33 | #endif | 33 | #endif |
| 34 | #include <stdlib.h> | ||
| 35 | 34 | ||
| 36 | #ifdef HAVE_UNISTD_H | 35 | #ifdef HAVE_UNISTD_H |
| 37 | #include <unistd.h> | 36 | #include <unistd.h> |
| @@ -68,10 +67,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 68 | #include <bsdtty.h> | 67 | #include <bsdtty.h> |
| 69 | #endif | 68 | #endif |
| 70 | 69 | ||
| 71 | #ifdef HAVE_SYS_WAIT | ||
| 72 | #include <sys/wait.h> | ||
| 73 | #endif | ||
| 74 | |||
| 75 | #ifdef HAVE_RES_INIT | 70 | #ifdef HAVE_RES_INIT |
| 76 | #include <netinet/in.h> | 71 | #include <netinet/in.h> |
| 77 | #include <arpa/nameser.h> | 72 | #include <arpa/nameser.h> |
| @@ -82,6 +77,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 82 | #include <util.h> | 77 | #include <util.h> |
| 83 | #endif | 78 | #endif |
| 84 | 79 | ||
| 80 | #ifdef HAVE_PTY_H | ||
| 81 | #include <pty.h> | ||
| 82 | #endif | ||
| 83 | |||
| 85 | #endif /* subprocesses */ | 84 | #endif /* subprocesses */ |
| 86 | 85 | ||
| 87 | #include "lisp.h" | 86 | #include "lisp.h" |
| @@ -115,6 +114,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 115 | #ifdef HAVE_NS | 114 | #ifdef HAVE_NS |
| 116 | #include "nsterm.h" | 115 | #include "nsterm.h" |
| 117 | #endif | 116 | #endif |
| 117 | |||
| 118 | extern int timers_run; | 118 | extern int timers_run; |
| 119 | 119 | ||
| 120 | Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid; | 120 | Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid; |
| @@ -171,13 +171,6 @@ extern Lisp_Object QCfilter; | |||
| 171 | /* Define first descriptor number available for subprocesses. */ | 171 | /* Define first descriptor number available for subprocesses. */ |
| 172 | #define FIRST_PROC_DESC 3 | 172 | #define FIRST_PROC_DESC 3 |
| 173 | 173 | ||
| 174 | /* Define SIGCHLD as an alias for SIGCLD. There are many conditionals | ||
| 175 | testing SIGCHLD. */ | ||
| 176 | |||
| 177 | #if !defined (SIGCHLD) && defined (SIGCLD) | ||
| 178 | #define SIGCHLD SIGCLD | ||
| 179 | #endif /* SIGCLD */ | ||
| 180 | |||
| 181 | extern const char *get_operating_system_release (void); | 174 | extern const char *get_operating_system_release (void); |
| 182 | 175 | ||
| 183 | /* From sysdep.c or w32.c */ | 176 | /* From sysdep.c or w32.c */ |
| @@ -356,14 +349,6 @@ struct sockaddr_and_len { | |||
| 356 | /* Maximum number of bytes to send to a pty without an eof. */ | 349 | /* Maximum number of bytes to send to a pty without an eof. */ |
| 357 | static int pty_max_bytes; | 350 | static int pty_max_bytes; |
| 358 | 351 | ||
| 359 | #ifdef HAVE_PTYS | ||
| 360 | #ifdef HAVE_PTY_H | ||
| 361 | #include <pty.h> | ||
| 362 | #endif | ||
| 363 | /* The file name of the pty opened by allocate_pty. */ | ||
| 364 | |||
| 365 | static char pty_name[24]; | ||
| 366 | #endif | ||
| 367 | 352 | ||
| 368 | 353 | ||
| 369 | struct fd_callback_data | 354 | struct fd_callback_data |
| @@ -563,6 +548,9 @@ status_message (struct Lisp_Process *p) | |||
| 563 | 548 | ||
| 564 | #ifdef HAVE_PTYS | 549 | #ifdef HAVE_PTYS |
| 565 | 550 | ||
| 551 | /* The file name of the pty opened by allocate_pty. */ | ||
| 552 | static char pty_name[24]; | ||
| 553 | |||
| 566 | /* Open an available pty, returning a file descriptor. | 554 | /* Open an available pty, returning a file descriptor. |
| 567 | Return -1 on failure. | 555 | Return -1 on failure. |
| 568 | The file name of the terminal corresponding to the pty | 556 | The file name of the terminal corresponding to the pty |
| @@ -1682,6 +1670,11 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) | |||
| 1682 | val = XCDR (Vdefault_process_coding_system); | 1670 | val = XCDR (Vdefault_process_coding_system); |
| 1683 | } | 1671 | } |
| 1684 | XPROCESS (proc)->encode_coding_system = val; | 1672 | XPROCESS (proc)->encode_coding_system = val; |
| 1673 | /* Note: At this momemnt, the above coding system may leave | ||
| 1674 | text-conversion or eol-conversion unspecified. They will be | ||
| 1675 | decided after we read output from the process and decode it by | ||
| 1676 | some coding system, or just before we actually send a text to | ||
| 1677 | the process. */ | ||
| 1685 | } | 1678 | } |
| 1686 | 1679 | ||
| 1687 | 1680 | ||
| @@ -1724,6 +1717,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) | |||
| 1724 | tem = Fsubstring (tem, make_number (2), Qnil); | 1717 | tem = Fsubstring (tem, make_number (2), Qnil); |
| 1725 | 1718 | ||
| 1726 | { | 1719 | { |
| 1720 | Lisp_Object arg_encoding = Qnil; | ||
| 1727 | struct gcpro gcpro1; | 1721 | struct gcpro gcpro1; |
| 1728 | GCPRO1 (tem); | 1722 | GCPRO1 (tem); |
| 1729 | 1723 | ||
| @@ -1741,9 +1735,14 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) | |||
| 1741 | tem = Fcons (args[i], tem); | 1735 | tem = Fcons (args[i], tem); |
| 1742 | CHECK_STRING (XCAR (tem)); | 1736 | CHECK_STRING (XCAR (tem)); |
| 1743 | if (STRING_MULTIBYTE (XCAR (tem))) | 1737 | if (STRING_MULTIBYTE (XCAR (tem))) |
| 1744 | XSETCAR (tem, | 1738 | { |
| 1745 | code_convert_string_norecord | 1739 | if (NILP (arg_encoding)) |
| 1746 | (XCAR (tem), XPROCESS (proc)->encode_coding_system, 1)); | 1740 | arg_encoding = (complement_process_encoding_system |
| 1741 | (XPROCESS (proc)->encode_coding_system)); | ||
| 1742 | XSETCAR (tem, | ||
| 1743 | code_convert_string_norecord | ||
| 1744 | (XCAR (tem), arg_encoding, 1)); | ||
| 1745 | } | ||
| 1747 | } | 1746 | } |
| 1748 | 1747 | ||
| 1749 | UNGCPRO; | 1748 | UNGCPRO; |
| @@ -1879,12 +1878,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1879 | } | 1878 | } |
| 1880 | #endif | 1879 | #endif |
| 1881 | 1880 | ||
| 1882 | #if 0 | ||
| 1883 | /* Replaced by close_process_descs */ | ||
| 1884 | set_exclusive_use (inchannel); | ||
| 1885 | set_exclusive_use (outchannel); | ||
| 1886 | #endif | ||
| 1887 | |||
| 1888 | #ifdef O_NONBLOCK | 1881 | #ifdef O_NONBLOCK |
| 1889 | fcntl (inchannel, F_SETFL, O_NONBLOCK); | 1882 | fcntl (inchannel, F_SETFL, O_NONBLOCK); |
| 1890 | fcntl (outchannel, F_SETFL, O_NONBLOCK); | 1883 | fcntl (outchannel, F_SETFL, O_NONBLOCK); |
| @@ -5547,12 +5540,21 @@ send_process (volatile Lisp_Object proc, const unsigned char *volatile buf, | |||
| 5547 | && !NILP (XBUFFER (object)->enable_multibyte_characters)) | 5540 | && !NILP (XBUFFER (object)->enable_multibyte_characters)) |
| 5548 | || EQ (object, Qt)) | 5541 | || EQ (object, Qt)) |
| 5549 | { | 5542 | { |
| 5543 | p->encode_coding_system | ||
| 5544 | = complement_process_encoding_system (p->encode_coding_system); | ||
| 5550 | if (!EQ (Vlast_coding_system_used, p->encode_coding_system)) | 5545 | if (!EQ (Vlast_coding_system_used, p->encode_coding_system)) |
| 5551 | /* The coding system for encoding was changed to raw-text | 5546 | { |
| 5552 | because we sent a unibyte text previously. Now we are | 5547 | /* The coding system for encoding was changed to raw-text |
| 5553 | sending a multibyte text, thus we must encode it by the | 5548 | because we sent a unibyte text previously. Now we are |
| 5554 | original coding system specified for the current process. */ | 5549 | sending a multibyte text, thus we must encode it by the |
| 5555 | setup_coding_system (p->encode_coding_system, coding); | 5550 | original coding system specified for the current process. |
| 5551 | |||
| 5552 | Another reason we comming here is that the coding system | ||
| 5553 | was just complemented and new one was returned by | ||
| 5554 | complement_process_encoding_system. */ | ||
| 5555 | setup_coding_system (p->encode_coding_system, coding); | ||
| 5556 | Vlast_coding_system_used = p->encode_coding_system; | ||
| 5557 | } | ||
| 5556 | coding->src_multibyte = 1; | 5558 | coding->src_multibyte = 1; |
| 5557 | } | 5559 | } |
| 5558 | else | 5560 | else |