aboutsummaryrefslogtreecommitdiffstats
path: root/src/sysdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sysdep.c')
-rw-r--r--src/sysdep.c103
1 files changed, 49 insertions, 54 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index 8e783bd7344..d32ba6d4de8 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -182,7 +182,7 @@ SIGMASKTYPE sigprocmask_set;
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. */
184char* 184char*
185get_current_dir_name () 185get_current_dir_name (void)
186{ 186{
187 char *buf; 187 char *buf;
188 char *pwd; 188 char *pwd;
@@ -363,7 +363,8 @@ set_exclusive_use (int fd)
363 363
364#ifndef subprocesses 364#ifndef subprocesses
365 365
366wait_without_blocking () 366void
367wait_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;
@@ -800,7 +801,7 @@ request_sigio (void)
800 801
801void 802void
802unrequest_sigio (void) 803unrequest_sigio (void)
803{ 804{
804 if (noninteractive) 805 if (noninteractive)
805 return; 806 return;
806 807
@@ -820,7 +821,7 @@ unrequest_sigio (void)
820#ifndef MSDOS 821#ifndef MSDOS
821 822
822void 823void
823request_sigio () 824request_sigio (void)
824{ 825{
825 if (noninteractive || read_socket_hook) 826 if (noninteractive || read_socket_hook)
826 return; 827 return;
@@ -829,7 +830,7 @@ request_sigio ()
829} 830}
830 831
831void 832void
832unrequest_sigio () 833unrequest_sigio (void)
833{ 834{
834 if (noninteractive || read_socket_hook) 835 if (noninteractive || read_socket_hook)
835 return; 836 return;
@@ -1019,10 +1020,10 @@ init_sys_modes (struct tty_display_info *tty_out)
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;
@@ -1080,7 +1081,7 @@ init_sys_modes (struct tty_display_info *tty_out)
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
@@ -1098,7 +1099,7 @@ init_sys_modes (struct tty_display_info *tty_out)
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. */
@@ -1189,9 +1190,9 @@ init_sys_modes (struct tty_display_info *tty_out)
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
@@ -1411,11 +1412,11 @@ reset_sys_modes (struct tty_display_info *tty_out)
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 {
@@ -1425,16 +1426,16 @@ reset_sys_modes (struct tty_display_info *tty_out)
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
@@ -1645,7 +1646,7 @@ init_system_name (void)
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
@@ -1757,8 +1758,8 @@ jmp_buf read_alarm_throw;
1757 1758
1758int read_alarm_should_throw; 1759int read_alarm_should_throw;
1759 1760
1760SIGTYPE 1761void
1761select_alarm () 1762select_alarm (int ignore)
1762{ 1763{
1763 select_alarmed = 1; 1764 select_alarmed = 1;
1764 signal (SIGALRM, SIG_IGN); 1765 signal (SIGALRM, SIG_IGN);
@@ -1770,13 +1771,12 @@ select_alarm ()
1770#ifndef WINDOWSNT 1771#ifndef WINDOWSNT
1771/* Only rfds are checked. */ 1772/* Only rfds are checked. */
1772int 1773int
1773sys_select (nfds, rfds, wfds, efds, timeout) 1774sys_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;
@@ -1907,7 +1907,7 @@ sys_select (nfds, rfds, wfds, efds, timeout)
1907 waiting for at least one character. */ 1907 waiting for at least one character. */
1908 1908
1909void 1909void
1910read_input_waiting () 1910read_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? */
@@ -2421,11 +2421,10 @@ emacs_write (int fildes, const char *buf, unsigned int nbyte)
2421#ifndef HAVE_GETWD 2421#ifndef HAVE_GETWD
2422 2422
2423char * 2423char *
2424getwd (pathname) 2424getwd (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);
@@ -2454,9 +2453,8 @@ getwd (pathname)
2454 2453
2455#ifndef HAVE_RENAME 2454#ifndef HAVE_RENAME
2456 2455
2457rename (from, to) 2456int
2458 const char *from; 2457rename (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 {
@@ -2476,7 +2474,8 @@ rename (from, to)
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
2479perror () 2477void
2478perror (void)
2480{ 2479{
2481} 2480}
2482#endif /* HPUX and not HAVE_PERROR */ 2481#endif /* HPUX and not HAVE_PERROR */
@@ -2489,9 +2488,8 @@ perror ()
2489 * until we are, then close the unsuccessful ones. 2488 * until we are, then close the unsuccessful ones.
2490 */ 2489 */
2491 2490
2492dup2 (oldd, newd) 2491int
2493 int oldd; 2492dup2 (int oldd, int newd)
2494 int newd;
2495{ 2493{
2496 register int fd, ret; 2494 register int fd, ret;
2497 2495
@@ -2525,11 +2523,9 @@ dup2 (oldd, newd)
2525 2523
2526/* ARGSUSED */ 2524/* ARGSUSED */
2527int 2525int
2528gettimeofday (tp, tzp) 2526gettimeofday (struct timeval *tp, struct timezone *tzp)
2529 struct timeval *tp;
2530 struct timezone *tzp;
2531{ 2527{
2532 extern long time (); 2528 extern long time (long);
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;
@@ -2616,9 +2612,7 @@ set_file_times (const char *filename, EMACS_TIME atime, EMACS_TIME mtime)
2616 * Make a directory. 2612 * Make a directory.
2617 */ 2613 */
2618int 2614int
2619mkdir (dpath, dmode) 2615mkdir (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;
@@ -2676,8 +2670,7 @@ mkdir (dpath, dmode)
2676 2670
2677#ifndef HAVE_RMDIR 2671#ifndef HAVE_RMDIR
2678int 2672int
2679rmdir (dpath) 2673rmdir (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;
@@ -2724,8 +2717,7 @@ rmdir (dpath)
2724 2717
2725#ifndef HAVE_STRSIGNAL 2718#ifndef HAVE_STRSIGNAL
2726char * 2719char *
2727strsignal (code) 2720strsignal (int code)
2728 int code;
2729{ 2721{
2730 char *signame = 0; 2722 char *signame = 0;
2731 2723
@@ -2741,7 +2733,8 @@ strsignal (code)
2741 2733
2742#ifdef HAVE_TERMIOS 2734#ifdef HAVE_TERMIOS
2743/* For make-serial-process */ 2735/* For make-serial-process */
2744int serial_open (char *port) 2736int
2737serial_open (char *port)
2745{ 2738{
2746 int fd = -1; 2739 int fd = -1;
2747 2740
@@ -2774,7 +2767,8 @@ int serial_open (char *port)
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. */
2777static void cfmakeraw (struct termios *termios_p) 2770static void
2771cfmakeraw (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;
@@ -2786,7 +2780,8 @@ static void cfmakeraw (struct termios *termios_p)
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. */
2789static int cfsetspeed (struct termios *termios_p, speed_t vitesse) 2783static int
2784cfsetspeed (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));
@@ -2796,7 +2791,7 @@ static int cfsetspeed (struct termios *termios_p, speed_t vitesse)
2796/* For serial-process-configure */ 2791/* For serial-process-configure */
2797void 2792void
2798serial_configure (struct Lisp_Process *p, 2793serial_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;
@@ -2839,7 +2834,7 @@ serial_configure (struct Lisp_Process *p,
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);
@@ -2997,7 +2992,7 @@ list_system_processes (void)
2997#elif !defined (WINDOWSNT) && !defined (MSDOS) 2992#elif !defined (WINDOWSNT) && !defined (MSDOS)
2998 2993
2999Lisp_Object 2994Lisp_Object
3000list_system_processes () 2995list_system_processes (void)
3001{ 2996{
3002 return Qnil; 2997 return Qnil;
3003} 2998}
@@ -3196,7 +3191,7 @@ system_process_attributes (Lisp_Object pid)
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;
@@ -3457,7 +3452,7 @@ system_process_attributes (Lisp_Object pid)
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);