Mercurial > emacs
comparison src/sysdep.c @ 109159:3e9fdeb960d1
* coding.c, sysdep.c: Convert some more functions to standard C.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Wed, 07 Jul 2010 11:38:03 +0200 |
parents | cd13b432f239 |
children | 750db9f3e6d8 |
comparison
equal
deleted
inserted
replaced
109158:6175ebc3b6ce | 109159:3e9fdeb960d1 |
---|---|
180 | 180 |
181 /* Return the current working directory. Returns NULL on errors. | 181 /* Return the current working directory. Returns NULL on errors. |
182 Any other returned value must be freed with free. This is used | 182 Any other returned value must be freed with free. This is used |
183 only when get_current_dir_name is not defined on the system. */ | 183 only when get_current_dir_name is not defined on the system. */ |
184 char* | 184 char* |
185 get_current_dir_name () | 185 get_current_dir_name (void) |
186 { | 186 { |
187 char *buf; | 187 char *buf; |
188 char *pwd; | 188 char *pwd; |
189 struct stat dotstat, pwdstat; | 189 struct stat dotstat, pwdstat; |
190 /* If PWD is accurate, use it instead of calling getwd. PWD is | 190 /* If PWD is accurate, use it instead of calling getwd. PWD is |
361 /* Ok to do nothing if this feature does not exist */ | 361 /* Ok to do nothing if this feature does not exist */ |
362 } | 362 } |
363 | 363 |
364 #ifndef subprocesses | 364 #ifndef subprocesses |
365 | 365 |
366 wait_without_blocking () | 366 void |
367 wait_without_blocking (void) | |
367 { | 368 { |
368 croak ("wait_without_blocking"); | 369 croak ("wait_without_blocking"); |
369 synch_process_alive = 0; | 370 synch_process_alive = 0; |
370 } | 371 } |
371 | 372 |
798 interrupts_deferred = 0; | 799 interrupts_deferred = 0; |
799 } | 800 } |
800 | 801 |
801 void | 802 void |
802 unrequest_sigio (void) | 803 unrequest_sigio (void) |
803 { | 804 { |
804 if (noninteractive) | 805 if (noninteractive) |
805 return; | 806 return; |
806 | 807 |
807 #if 0 /* XXX What's wrong with blocking SIGIO under X? */ | 808 #if 0 /* XXX What's wrong with blocking SIGIO under X? */ |
808 if (x_display_list) | 809 if (x_display_list) |
818 | 819 |
819 #else /* no FASYNC */ | 820 #else /* no FASYNC */ |
820 #ifndef MSDOS | 821 #ifndef MSDOS |
821 | 822 |
822 void | 823 void |
823 request_sigio () | 824 request_sigio (void) |
824 { | 825 { |
825 if (noninteractive || read_socket_hook) | 826 if (noninteractive || read_socket_hook) |
826 return; | 827 return; |
827 | 828 |
828 croak ("request_sigio"); | 829 croak ("request_sigio"); |
829 } | 830 } |
830 | 831 |
831 void | 832 void |
832 unrequest_sigio () | 833 unrequest_sigio (void) |
833 { | 834 { |
834 if (noninteractive || read_socket_hook) | 835 if (noninteractive || read_socket_hook) |
835 return; | 836 return; |
836 | 837 |
837 croak ("unrequest_sigio"); | 838 croak ("unrequest_sigio"); |
1017 if (noninteractive) | 1018 if (noninteractive) |
1018 return; | 1019 return; |
1019 | 1020 |
1020 if (!tty_out->output) | 1021 if (!tty_out->output) |
1021 return; /* The tty is suspended. */ | 1022 return; /* The tty is suspended. */ |
1022 | 1023 |
1023 if (! tty_out->old_tty) | 1024 if (! tty_out->old_tty) |
1024 tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); | 1025 tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); |
1025 | 1026 |
1026 EMACS_GET_TTY (fileno (tty_out->input), tty_out->old_tty); | 1027 EMACS_GET_TTY (fileno (tty_out->input), tty_out->old_tty); |
1027 | 1028 |
1028 tty = *tty_out->old_tty; | 1029 tty = *tty_out->old_tty; |
1029 | 1030 |
1030 #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) | 1031 #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) |
1078 devices other than our controlling terminal; therefore, | 1079 devices other than our controlling terminal; therefore, |
1079 we must handle C-g as normal input. Unfortunately, this | 1080 we must handle C-g as normal input. Unfortunately, this |
1080 means that the interrupt and quit feature must be | 1081 means that the interrupt and quit feature must be |
1081 disabled on secondary ttys, or we would not even see the | 1082 disabled on secondary ttys, or we would not even see the |
1082 keypress. | 1083 keypress. |
1083 | 1084 |
1084 Note that even though emacsclient could have special code | 1085 Note that even though emacsclient could have special code |
1085 to pass SIGINT to Emacs, we should _not_ enable | 1086 to pass SIGINT to Emacs, we should _not_ enable |
1086 interrupt/quit keys for emacsclient frames. This means | 1087 interrupt/quit keys for emacsclient frames. This means |
1087 that we can't break out of loops in C code from a | 1088 that we can't break out of loops in C code from a |
1088 secondary tty frame, but we can always decide what | 1089 secondary tty frame, but we can always decide what |
1096 tty.main.c_cc[VTIME] = 0; /* no matter how long that takes. */ | 1097 tty.main.c_cc[VTIME] = 0; /* no matter how long that takes. */ |
1097 #ifdef VSWTCH | 1098 #ifdef VSWTCH |
1098 tty.main.c_cc[VSWTCH] = CDISABLE; /* Turn off shell layering use | 1099 tty.main.c_cc[VSWTCH] = CDISABLE; /* Turn off shell layering use |
1099 of C-z */ | 1100 of C-z */ |
1100 #endif /* VSWTCH */ | 1101 #endif /* VSWTCH */ |
1101 | 1102 |
1102 #if defined (__mips__) || defined (HAVE_TCATTR) | 1103 #if defined (__mips__) || defined (HAVE_TCATTR) |
1103 #ifdef VSUSP | 1104 #ifdef VSUSP |
1104 tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off mips handling of C-z. */ | 1105 tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off mips handling of C-z. */ |
1105 #endif /* VSUSP */ | 1106 #endif /* VSUSP */ |
1106 #ifdef V_DSUSP | 1107 #ifdef V_DSUSP |
1187 if (tty_out->flow_control) | 1188 if (tty_out->flow_control) |
1188 { | 1189 { |
1189 tty.tchars.t_startc = '\021'; | 1190 tty.tchars.t_startc = '\021'; |
1190 tty.tchars.t_stopc = '\023'; | 1191 tty.tchars.t_stopc = '\023'; |
1191 } | 1192 } |
1192 | 1193 |
1193 tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | tty_out->old_tty.lmode; | 1194 tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | tty_out->old_tty.lmode; |
1194 | 1195 |
1195 #endif /* HAVE_TCHARS */ | 1196 #endif /* HAVE_TCHARS */ |
1196 #endif /* not HAVE_TERMIO */ | 1197 #endif /* not HAVE_TERMIO */ |
1197 | 1198 |
1198 #ifdef HAVE_LTCHARS | 1199 #ifdef HAVE_LTCHARS |
1199 tty.ltchars = new_ltchars; | 1200 tty.ltchars = new_ltchars; |
1409 if (!tty_out->term_initted) | 1410 if (!tty_out->term_initted) |
1410 return; | 1411 return; |
1411 | 1412 |
1412 if (!tty_out->output) | 1413 if (!tty_out->output) |
1413 return; /* The tty is suspended. */ | 1414 return; /* The tty is suspended. */ |
1414 | 1415 |
1415 /* Go to and clear the last line of the terminal. */ | 1416 /* Go to and clear the last line of the terminal. */ |
1416 | 1417 |
1417 cmgoto (tty_out, FrameRows (tty_out) - 1, 0); | 1418 cmgoto (tty_out, FrameRows (tty_out) - 1, 0); |
1418 | 1419 |
1419 /* Code adapted from tty_clear_end_of_line. */ | 1420 /* Code adapted from tty_clear_end_of_line. */ |
1420 if (tty_out->TS_clr_line) | 1421 if (tty_out->TS_clr_line) |
1421 { | 1422 { |
1422 emacs_tputs (tty_out, tty_out->TS_clr_line, 1, cmputc); | 1423 emacs_tputs (tty_out, tty_out->TS_clr_line, 1, cmputc); |
1423 } | 1424 } |
1424 else | 1425 else |
1425 { /* have to do it the hard way */ | 1426 { /* have to do it the hard way */ |
1426 int i; | 1427 int i; |
1427 tty_turn_off_insert (tty_out); | 1428 tty_turn_off_insert (tty_out); |
1428 | 1429 |
1429 for (i = curX (tty_out); i < FrameCols (tty_out) - 1; i++) | 1430 for (i = curX (tty_out); i < FrameCols (tty_out) - 1; i++) |
1430 { | 1431 { |
1431 fputc (' ', tty_out->output); | 1432 fputc (' ', tty_out->output); |
1432 } | 1433 } |
1433 } | 1434 } |
1434 | 1435 |
1435 cmgoto (tty_out, FrameRows (tty_out) - 1, 0); | 1436 cmgoto (tty_out, FrameRows (tty_out) - 1, 0); |
1436 fflush (tty_out->output); | 1437 fflush (tty_out->output); |
1437 | 1438 |
1438 if (tty_out->terminal->reset_terminal_modes_hook) | 1439 if (tty_out->terminal->reset_terminal_modes_hook) |
1439 tty_out->terminal->reset_terminal_modes_hook (tty_out->terminal); | 1440 tty_out->terminal->reset_terminal_modes_hook (tty_out->terminal); |
1440 | 1441 |
1441 #ifdef BSD_SYSTEM | 1442 #ifdef BSD_SYSTEM |
1442 /* Avoid possible loss of output when changing terminal modes. */ | 1443 /* Avoid possible loss of output when changing terminal modes. */ |
1643 #ifdef HAVE_GETADDRINFO | 1644 #ifdef HAVE_GETADDRINFO |
1644 struct addrinfo *res; | 1645 struct addrinfo *res; |
1645 struct addrinfo hints; | 1646 struct addrinfo hints; |
1646 int ret; | 1647 int ret; |
1647 | 1648 |
1648 memset (&hints, 0, sizeof(hints)); | 1649 memset (&hints, 0, sizeof (hints)); |
1649 hints.ai_socktype = SOCK_STREAM; | 1650 hints.ai_socktype = SOCK_STREAM; |
1650 hints.ai_flags = AI_CANONNAME; | 1651 hints.ai_flags = AI_CANONNAME; |
1651 | 1652 |
1652 for (count = 0;; count++) | 1653 for (count = 0;; count++) |
1653 { | 1654 { |
1755 /* Nonzero if the alarm signal should throw back to read_input_waiting. | 1756 /* Nonzero if the alarm signal should throw back to read_input_waiting. |
1756 The read_socket_hook function sets this to 1 while it is waiting. */ | 1757 The read_socket_hook function sets this to 1 while it is waiting. */ |
1757 | 1758 |
1758 int read_alarm_should_throw; | 1759 int read_alarm_should_throw; |
1759 | 1760 |
1760 SIGTYPE | 1761 void |
1761 select_alarm () | 1762 select_alarm (int ignore) |
1762 { | 1763 { |
1763 select_alarmed = 1; | 1764 select_alarmed = 1; |
1764 signal (SIGALRM, SIG_IGN); | 1765 signal (SIGALRM, SIG_IGN); |
1765 SIGNAL_THREAD_CHECK (SIGALRM); | 1766 SIGNAL_THREAD_CHECK (SIGALRM); |
1766 if (read_alarm_should_throw) | 1767 if (read_alarm_should_throw) |
1768 } | 1769 } |
1769 | 1770 |
1770 #ifndef WINDOWSNT | 1771 #ifndef WINDOWSNT |
1771 /* Only rfds are checked. */ | 1772 /* Only rfds are checked. */ |
1772 int | 1773 int |
1773 sys_select (nfds, rfds, wfds, efds, timeout) | 1774 sys_select (int nfds, |
1774 int nfds; | 1775 SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, |
1775 SELECT_TYPE *rfds, *wfds, *efds; | 1776 EMACS_TIME *timeout) |
1776 EMACS_TIME *timeout; | |
1777 { | 1777 { |
1778 /* XXX This needs to be updated for multi-tty support. Is there | 1778 /* XXX This needs to be updated for multi-tty support. Is there |
1779 anybody who needs to emulate select these days? */ | 1779 anybody who needs to emulate select these days? */ |
1780 int ravail = 0; | 1780 int ravail = 0; |
1781 SELECT_TYPE orfds; | 1781 SELECT_TYPE orfds; |
1782 int timeoutval; | 1782 int timeoutval; |
1783 int *local_timeout; | 1783 int *local_timeout; |
1784 extern int proc_buffered_char[]; | 1784 extern int proc_buffered_char[]; |
1905 | 1905 |
1906 /* Read keyboard input into the standard buffer, | 1906 /* Read keyboard input into the standard buffer, |
1907 waiting for at least one character. */ | 1907 waiting for at least one character. */ |
1908 | 1908 |
1909 void | 1909 void |
1910 read_input_waiting () | 1910 read_input_waiting (void) |
1911 { | 1911 { |
1912 /* XXX This needs to be updated for multi-tty support. Is there | 1912 /* XXX This needs to be updated for multi-tty support. Is there |
1913 anybody who needs to emulate select these days? */ | 1913 anybody who needs to emulate select these days? */ |
1914 int nread, i; | 1914 int nread, i; |
1915 extern int quit_char; | 1915 extern int quit_char; |
2419 #endif | 2419 #endif |
2420 | 2420 |
2421 #ifndef HAVE_GETWD | 2421 #ifndef HAVE_GETWD |
2422 | 2422 |
2423 char * | 2423 char * |
2424 getwd (pathname) | 2424 getwd (char *pathname) |
2425 char *pathname; | |
2426 { | 2425 { |
2427 char *npath, *spath; | 2426 char *npath, *spath; |
2428 extern char *getcwd (); | 2427 extern char *getcwd (char *, size_t); |
2429 | 2428 |
2430 BLOCK_INPUT; /* getcwd uses malloc */ | 2429 BLOCK_INPUT; /* getcwd uses malloc */ |
2431 spath = npath = getcwd ((char *) 0, MAXPATHLEN); | 2430 spath = npath = getcwd ((char *) 0, MAXPATHLEN); |
2432 if (spath == 0) | 2431 if (spath == 0) |
2433 { | 2432 { |
2452 * that files be of same type (regular->regular, dir->dir, etc). | 2451 * that files be of same type (regular->regular, dir->dir, etc). |
2453 */ | 2452 */ |
2454 | 2453 |
2455 #ifndef HAVE_RENAME | 2454 #ifndef HAVE_RENAME |
2456 | 2455 |
2457 rename (from, to) | 2456 int |
2458 const char *from; | 2457 rename (const char *from, const char *to) |
2459 const char *to; | |
2460 { | 2458 { |
2461 if (access (from, 0) == 0) | 2459 if (access (from, 0) == 0) |
2462 { | 2460 { |
2463 unlink (to); | 2461 unlink (to); |
2464 if (link (from, to) == 0) | 2462 if (link (from, to) == 0) |
2474 #if defined(HPUX) && !defined(HAVE_PERROR) | 2472 #if defined(HPUX) && !defined(HAVE_PERROR) |
2475 | 2473 |
2476 /* HPUX curses library references perror, but as far as we know | 2474 /* HPUX curses library references perror, but as far as we know |
2477 it won't be called. Anyway this definition will do for now. */ | 2475 it won't be called. Anyway this definition will do for now. */ |
2478 | 2476 |
2479 perror () | 2477 void |
2478 perror (void) | |
2480 { | 2479 { |
2481 } | 2480 } |
2482 #endif /* HPUX and not HAVE_PERROR */ | 2481 #endif /* HPUX and not HAVE_PERROR */ |
2483 | 2482 |
2484 #ifndef HAVE_DUP2 | 2483 #ifndef HAVE_DUP2 |
2487 * Emulate BSD dup2. First close newd if it already exists. | 2486 * Emulate BSD dup2. First close newd if it already exists. |
2488 * Then, attempt to dup oldd. If not successful, call dup2 recursively | 2487 * Then, attempt to dup oldd. If not successful, call dup2 recursively |
2489 * until we are, then close the unsuccessful ones. | 2488 * until we are, then close the unsuccessful ones. |
2490 */ | 2489 */ |
2491 | 2490 |
2492 dup2 (oldd, newd) | 2491 int |
2493 int oldd; | 2492 dup2 (int oldd, int newd) |
2494 int newd; | |
2495 { | 2493 { |
2496 register int fd, ret; | 2494 register int fd, ret; |
2497 | 2495 |
2498 emacs_close (newd); | 2496 emacs_close (newd); |
2499 | 2497 |
2523 #ifndef HAVE_GETTIMEOFDAY | 2521 #ifndef HAVE_GETTIMEOFDAY |
2524 #ifdef HAVE_TIMEVAL | 2522 #ifdef HAVE_TIMEVAL |
2525 | 2523 |
2526 /* ARGSUSED */ | 2524 /* ARGSUSED */ |
2527 int | 2525 int |
2528 gettimeofday (tp, tzp) | 2526 gettimeofday (struct timeval *tp, struct timezone *tzp) |
2529 struct timeval *tp; | 2527 { |
2530 struct timezone *tzp; | 2528 extern long time (long); |
2531 { | |
2532 extern long time (); | |
2533 | 2529 |
2534 tp->tv_sec = time ((long *)0); | 2530 tp->tv_sec = time ((long *)0); |
2535 tp->tv_usec = 0; | 2531 tp->tv_usec = 0; |
2536 if (tzp != 0) | 2532 if (tzp != 0) |
2537 tzp->tz_minuteswest = -1; | 2533 tzp->tz_minuteswest = -1; |
2614 | 2610 |
2615 /* | 2611 /* |
2616 * Make a directory. | 2612 * Make a directory. |
2617 */ | 2613 */ |
2618 int | 2614 int |
2619 mkdir (dpath, dmode) | 2615 mkdir (char *dpath, int dmode) |
2620 char *dpath; | |
2621 int dmode; | |
2622 { | 2616 { |
2623 int cpid, status, fd; | 2617 int cpid, status, fd; |
2624 struct stat statbuf; | 2618 struct stat statbuf; |
2625 | 2619 |
2626 if (stat (dpath, &statbuf) == 0) | 2620 if (stat (dpath, &statbuf) == 0) |
2674 } | 2668 } |
2675 #endif /* not HAVE_MKDIR */ | 2669 #endif /* not HAVE_MKDIR */ |
2676 | 2670 |
2677 #ifndef HAVE_RMDIR | 2671 #ifndef HAVE_RMDIR |
2678 int | 2672 int |
2679 rmdir (dpath) | 2673 rmdir (char *dpath) |
2680 char *dpath; | |
2681 { | 2674 { |
2682 int cpid, status, fd; | 2675 int cpid, status, fd; |
2683 struct stat statbuf; | 2676 struct stat statbuf; |
2684 | 2677 |
2685 if (stat (dpath, &statbuf) != 0) | 2678 if (stat (dpath, &statbuf) != 0) |
2722 #endif /* !HAVE_RMDIR */ | 2715 #endif /* !HAVE_RMDIR */ |
2723 | 2716 |
2724 | 2717 |
2725 #ifndef HAVE_STRSIGNAL | 2718 #ifndef HAVE_STRSIGNAL |
2726 char * | 2719 char * |
2727 strsignal (code) | 2720 strsignal (int code) |
2728 int code; | |
2729 { | 2721 { |
2730 char *signame = 0; | 2722 char *signame = 0; |
2731 | 2723 |
2732 if (0 <= code && code < NSIG) | 2724 if (0 <= code && code < NSIG) |
2733 { | 2725 { |
2739 } | 2731 } |
2740 #endif /* HAVE_STRSIGNAL */ | 2732 #endif /* HAVE_STRSIGNAL */ |
2741 | 2733 |
2742 #ifdef HAVE_TERMIOS | 2734 #ifdef HAVE_TERMIOS |
2743 /* For make-serial-process */ | 2735 /* For make-serial-process */ |
2744 int serial_open (char *port) | 2736 int |
2737 serial_open (char *port) | |
2745 { | 2738 { |
2746 int fd = -1; | 2739 int fd = -1; |
2747 | 2740 |
2748 fd = emacs_open ((char*) port, | 2741 fd = emacs_open ((char*) port, |
2749 O_RDWR | 2742 O_RDWR |
2772 #ifdef HAVE_TERMIOS | 2765 #ifdef HAVE_TERMIOS |
2773 | 2766 |
2774 #if !defined (HAVE_CFMAKERAW) | 2767 #if !defined (HAVE_CFMAKERAW) |
2775 /* Workaround for targets which are missing cfmakeraw. */ | 2768 /* Workaround for targets which are missing cfmakeraw. */ |
2776 /* Pasted from man page. */ | 2769 /* Pasted from man page. */ |
2777 static void cfmakeraw (struct termios *termios_p) | 2770 static void |
2771 cfmakeraw (struct termios *termios_p) | |
2778 { | 2772 { |
2779 termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); | 2773 termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); |
2780 termios_p->c_oflag &= ~OPOST; | 2774 termios_p->c_oflag &= ~OPOST; |
2781 termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); | 2775 termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); |
2782 termios_p->c_cflag &= ~(CSIZE|PARENB); | 2776 termios_p->c_cflag &= ~(CSIZE|PARENB); |
2784 } | 2778 } |
2785 #endif /* !defined (HAVE_CFMAKERAW */ | 2779 #endif /* !defined (HAVE_CFMAKERAW */ |
2786 | 2780 |
2787 #if !defined (HAVE_CFSETSPEED) | 2781 #if !defined (HAVE_CFSETSPEED) |
2788 /* Workaround for targets which are missing cfsetspeed. */ | 2782 /* Workaround for targets which are missing cfsetspeed. */ |
2789 static int cfsetspeed (struct termios *termios_p, speed_t vitesse) | 2783 static int |
2784 cfsetspeed (struct termios *termios_p, speed_t vitesse) | |
2790 { | 2785 { |
2791 return (cfsetispeed (termios_p, vitesse) | 2786 return (cfsetispeed (termios_p, vitesse) |
2792 + cfsetospeed (termios_p, vitesse)); | 2787 + cfsetospeed (termios_p, vitesse)); |
2793 } | 2788 } |
2794 #endif | 2789 #endif |
2795 | 2790 |
2796 /* For serial-process-configure */ | 2791 /* For serial-process-configure */ |
2797 void | 2792 void |
2798 serial_configure (struct Lisp_Process *p, | 2793 serial_configure (struct Lisp_Process *p, |
2799 Lisp_Object contact) | 2794 Lisp_Object contact) |
2800 { | 2795 { |
2801 Lisp_Object childp2 = Qnil; | 2796 Lisp_Object childp2 = Qnil; |
2802 Lisp_Object tem = Qnil; | 2797 Lisp_Object tem = Qnil; |
2803 struct termios attr; | 2798 struct termios attr; |
2804 int err = -1; | 2799 int err = -1; |
2837 if (NILP (tem)) | 2832 if (NILP (tem)) |
2838 tem = make_number (8); | 2833 tem = make_number (8); |
2839 CHECK_NUMBER (tem); | 2834 CHECK_NUMBER (tem); |
2840 if (XINT (tem) != 7 && XINT (tem) != 8) | 2835 if (XINT (tem) != 7 && XINT (tem) != 8) |
2841 error (":bytesize must be nil (8), 7, or 8"); | 2836 error (":bytesize must be nil (8), 7, or 8"); |
2842 summary[0] = XINT(tem) + '0'; | 2837 summary[0] = XINT (tem) + '0'; |
2843 #if defined (CSIZE) && defined (CS7) && defined (CS8) | 2838 #if defined (CSIZE) && defined (CS7) && defined (CS8) |
2844 attr.c_cflag &= ~CSIZE; | 2839 attr.c_cflag &= ~CSIZE; |
2845 attr.c_cflag |= ((XINT (tem) == 7) ? CS7 : CS8); | 2840 attr.c_cflag |= ((XINT (tem) == 7) ? CS7 : CS8); |
2846 #else | 2841 #else |
2847 /* Don't error on bytesize 8, which should be set by cfmakeraw. */ | 2842 /* Don't error on bytesize 8, which should be set by cfmakeraw. */ |
2995 /* The WINDOWSNT implementation is in w32.c. | 2990 /* The WINDOWSNT implementation is in w32.c. |
2996 The MSDOS implementation is in dosfns.c. */ | 2991 The MSDOS implementation is in dosfns.c. */ |
2997 #elif !defined (WINDOWSNT) && !defined (MSDOS) | 2992 #elif !defined (WINDOWSNT) && !defined (MSDOS) |
2998 | 2993 |
2999 Lisp_Object | 2994 Lisp_Object |
3000 list_system_processes () | 2995 list_system_processes (void) |
3001 { | 2996 { |
3002 return Qnil; | 2997 return Qnil; |
3003 } | 2998 } |
3004 | 2999 |
3005 #endif /* !defined (WINDOWSNT) */ | 3000 #endif /* !defined (WINDOWSNT) */ |
3194 | 3189 |
3195 strcpy (fn, procfn); | 3190 strcpy (fn, procfn); |
3196 procfn_end = fn + strlen (fn); | 3191 procfn_end = fn + strlen (fn); |
3197 strcpy (procfn_end, "/stat"); | 3192 strcpy (procfn_end, "/stat"); |
3198 fd = emacs_open (fn, O_RDONLY, 0); | 3193 fd = emacs_open (fn, O_RDONLY, 0); |
3199 if (fd >= 0 && (nread = emacs_read (fd, procbuf, sizeof(procbuf) - 1)) > 0) | 3194 if (fd >= 0 && (nread = emacs_read (fd, procbuf, sizeof (procbuf) - 1)) > 0) |
3200 { | 3195 { |
3201 procbuf[nread] = '\0'; | 3196 procbuf[nread] = '\0'; |
3202 p = procbuf; | 3197 p = procbuf; |
3203 | 3198 |
3204 p = strchr (p, '('); | 3199 p = strchr (p, '('); |
3455 strcpy (fn, procfn); | 3450 strcpy (fn, procfn); |
3456 procfn_end = fn + strlen (fn); | 3451 procfn_end = fn + strlen (fn); |
3457 strcpy (procfn_end, "/psinfo"); | 3452 strcpy (procfn_end, "/psinfo"); |
3458 fd = emacs_open (fn, O_RDONLY, 0); | 3453 fd = emacs_open (fn, O_RDONLY, 0); |
3459 if (fd >= 0 | 3454 if (fd >= 0 |
3460 && (nread = read (fd, (char*)&pinfo, sizeof(struct psinfo)) > 0)) | 3455 && (nread = read (fd, (char*)&pinfo, sizeof (struct psinfo)) > 0)) |
3461 { | 3456 { |
3462 attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (pinfo.pr_ppid)), attrs); | 3457 attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (pinfo.pr_ppid)), attrs); |
3463 attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (pinfo.pr_pgid)), attrs); | 3458 attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (pinfo.pr_pgid)), attrs); |
3464 attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (pinfo.pr_sid)), attrs); | 3459 attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (pinfo.pr_sid)), attrs); |
3465 | 3460 |