Mercurial > hg > xemacs-beta
comparison src/process.c @ 251:677f6a0ee643 r20-5b24
Import from CVS: tag r20-5b24
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:19:59 +0200 |
parents | 52952cbfc5b5 |
children | 157b30c96d03 |
comparison
equal
deleted
inserted
replaced
250:f385a461c9aa | 251:677f6a0ee643 |
---|---|
617 #ifdef PTY_OPEN | 617 #ifdef PTY_OPEN |
618 PTY_OPEN; | 618 PTY_OPEN; |
619 #else /* no PTY_OPEN */ | 619 #else /* no PTY_OPEN */ |
620 #ifdef IRIS | 620 #ifdef IRIS |
621 /* Unusual IRIS code */ | 621 /* Unusual IRIS code */ |
622 *ptyv = open ("/dev/ptc", O_RDWR | O_NDELAY, 0); | 622 *ptyv = open ("/dev/ptc", O_RDWR | O_NDELAY | OPEN_BINARY, 0); |
623 if (fd < 0) | 623 if (fd < 0) |
624 return -1; | 624 return -1; |
625 if (fstat (fd, &stb) < 0) | 625 if (fstat (fd, &stb) < 0) |
626 return -1; | 626 return -1; |
627 #else /* not IRIS */ | 627 #else /* not IRIS */ |
632 return -1; | 632 return -1; |
633 } | 633 } |
634 else | 634 else |
635 failed_count = 0; | 635 failed_count = 0; |
636 #ifdef O_NONBLOCK | 636 #ifdef O_NONBLOCK |
637 fd = open (pty_name, O_RDWR | O_NONBLOCK, 0); | 637 fd = open (pty_name, O_RDWR | O_NONBLOCK | OPEN_BINARY, 0); |
638 #else | 638 #else |
639 fd = open (pty_name, O_RDWR | O_NDELAY, 0); | 639 fd = open (pty_name, O_RDWR | O_NDELAY | OPEN_BINARY, 0); |
640 #endif | 640 #endif |
641 #endif /* not IRIS */ | 641 #endif /* not IRIS */ |
642 #endif /* no PTY_OPEN */ | 642 #endif /* no PTY_OPEN */ |
643 | 643 |
644 if (fd >= 0) | 644 if (fd >= 0) |
827 if (inchannel >= 0) | 827 if (inchannel >= 0) |
828 { | 828 { |
829 /* You're "supposed" to now open the slave in the child. | 829 /* You're "supposed" to now open the slave in the child. |
830 On some systems, we can open it here; this allows for | 830 On some systems, we can open it here; this allows for |
831 better error checking. */ | 831 better error checking. */ |
832 #ifndef USG | 832 #if !defined(USG) |
833 /* On USG systems it does not work to open the pty's tty here | 833 /* On USG systems it does not work to open the pty's tty here |
834 and then close and reopen it in the child. */ | 834 and then close and reopen it in the child. */ |
835 #ifdef O_NOCTTY | 835 #ifdef O_NOCTTY |
836 /* Don't let this terminal become our controlling terminal | 836 /* Don't let this terminal become our controlling terminal |
837 (in case we don't have one). */ | 837 (in case we don't have one). */ |
838 forkout = forkin = open (pty_name, O_RDWR | O_NOCTTY, 0); | 838 forkout = forkin = open (pty_name, O_RDWR | O_NOCTTY | OPEN_BINARY, 0); |
839 #else | 839 #else |
840 forkout = forkin = open (pty_name, O_RDWR, 0); | 840 forkout = forkin = open (pty_name, O_RDWR | OPEN_BINARY, 0); |
841 #endif | 841 #endif |
842 if (forkin < 0) | 842 if (forkin < 0) |
843 goto io_failure; | 843 goto io_failure; |
844 #endif /* not USG */ | 844 #endif /* not USG */ |
845 p->pty_flag = pty_flag = 1; | 845 p->pty_flag = pty_flag = 1; |
868 p->exit_code = 0; | 868 p->exit_code = 0; |
869 | 869 |
870 { | 870 { |
871 /* child_setup must clobber environ on systems with true vfork. | 871 /* child_setup must clobber environ on systems with true vfork. |
872 Protect it from permanent change. */ | 872 Protect it from permanent change. */ |
873 char **save_environ = environ; | 873 /* char **save_environ = environ;*/ |
874 | 874 |
875 #ifdef EMACS_BTL | 875 #ifdef EMACS_BTL |
876 /* when performance monitoring is on, turn it off before the vfork(), | 876 /* when performance monitoring is on, turn it off before the vfork(), |
877 as the child has no handler for the signal -- when back in the | 877 as the child has no handler for the signal -- when back in the |
878 parent process, turn it back on if it was really on when you "turned | 878 parent process, turn it back on if it was really on when you "turned |
936 This makes the pty the controlling terminal of the | 936 This makes the pty the controlling terminal of the |
937 subprocess. */ | 937 subprocess. */ |
938 /* I wonder if close (open (pty_name, ...)) would work? */ | 938 /* I wonder if close (open (pty_name, ...)) would work? */ |
939 if (xforkin >= 0) | 939 if (xforkin >= 0) |
940 close (xforkin); | 940 close (xforkin); |
941 xforkout = xforkin = open (pty_name, O_RDWR, 0); | 941 xforkout = xforkin = open (pty_name, O_RDWR | OPEN_BINARY, 0); |
942 if (xforkin < 0) | 942 if (xforkin < 0) |
943 { | 943 { |
944 write (1, "Couldn't open the pty terminal ", 31); | 944 write (1, "Couldn't open the pty terminal ", 31); |
945 write (1, pty_name, strlen (pty_name)); | 945 write (1, pty_name, strlen (pty_name)); |
946 write (1, "\n", 1); | 946 write (1, "\n", 1); |
1022 #ifdef EMACS_BTL | 1022 #ifdef EMACS_BTL |
1023 else if (logging_on) | 1023 else if (logging_on) |
1024 cadillac_start_logging (); /* #### rename me */ | 1024 cadillac_start_logging (); /* #### rename me */ |
1025 #endif | 1025 #endif |
1026 | 1026 |
1027 environ = save_environ; | 1027 /* environ = save_environ;*/ |
1028 } | 1028 } |
1029 | 1029 |
1030 if (pid < 0) | 1030 if (pid < 0) |
1031 { | 1031 { |
1032 close_descriptor_pair (forkin, forkout); | 1032 close_descriptor_pair (forkin, forkout); |
1275 | 1275 |
1276 while (1) | 1276 while (1) |
1277 { | 1277 { |
1278 #ifdef TRY_AGAIN | 1278 #ifdef TRY_AGAIN |
1279 if (count++ > 10) break; | 1279 if (count++ > 10) break; |
1280 h_errno = 0; | 1280 #ifndef BROKEN_CYGWIN |
1281 h_errno = 0; | |
1282 #endif | |
1281 #endif | 1283 #endif |
1282 /* Some systems can't handle SIGIO/SIGALARM in gethostbyname. */ | 1284 /* Some systems can't handle SIGIO/SIGALARM in gethostbyname. */ |
1283 slow_down_interrupts (); | 1285 slow_down_interrupts (); |
1284 host_info_ptr = gethostbyname ((char *) XSTRING_DATA (host)); | 1286 host_info_ptr = gethostbyname ((char *) XSTRING_DATA (host)); |
1285 speed_up_interrupts (); | 1287 speed_up_interrupts (); |
3046 #endif | 3048 #endif |
3047 } | 3049 } |
3048 else | 3050 else |
3049 { | 3051 { |
3050 close (XPROCESS (proc)->outfd); | 3052 close (XPROCESS (proc)->outfd); |
3051 XPROCESS (proc)->outfd = open (NULL_DEVICE, O_WRONLY, 0); | 3053 XPROCESS (proc)->outfd = open (NULL_DEVICE, O_WRONLY | OPEN_BINARY, 0); |
3052 } | 3054 } |
3053 | 3055 |
3054 return process; | 3056 return process; |
3055 } | 3057 } |
3056 | 3058 |