aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDan Nicolaescu2010-10-03 07:16:48 -0700
committerDan Nicolaescu2010-10-03 07:16:48 -0700
commit57507bf8b5e37c0d9355aaafbf5abb46998af392 (patch)
tree5a164dbc3c1bcf7d513f86bec35eec46e0206bb6 /src
parentdd5ecd6bb5778143554b5f82cd05bab3234bc5e8 (diff)
downloademacs-57507bf8b5e37c0d9355aaafbf5abb46998af392.tar.gz
emacs-57507bf8b5e37c0d9355aaafbf5abb46998af392.zip
Remove unused code.
* src/sysdep.c (select_alarm, sys_select, read_input_waiting): Remove select emulation, all systems support select. (set_exclusive_use): Remove, the only user is in an #if 0 block. * src/process.c (create_process): Remove #if 0 code.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/process.c7
-rw-r--r--src/sysdep.c249
3 files changed, 8 insertions, 254 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2e1864b270e..2ec9f2900f7 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,11 @@
12010-10-03 Dan Nicolaescu <dann@ics.uci.edu> 12010-10-03 Dan Nicolaescu <dann@ics.uci.edu>
2 2
3 Remove unused code.
4 * sysdep.c (select_alarm, sys_select, read_input_waiting): Remove
5 select emulation, all systems support select.
6 (set_exclusive_use): Remove, the only user is in an #if 0 block.
7 * process.c (create_process): Remove #if 0 code.
8
3 Remove unused arguments for unexec. 9 Remove unused arguments for unexec.
4 The third one is never used, and the last two are always passed as zero. 10 The third one is never used, and the last two are always passed as zero.
5 * emacs.c (unexec): Add declaration. 11 * emacs.c (unexec): Add declaration.
diff --git a/src/process.c b/src/process.c
index 435e0784455..d149537878c 100644
--- a/src/process.c
+++ b/src/process.c
@@ -118,6 +118,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
118#ifdef HAVE_NS 118#ifdef HAVE_NS
119#include "nsterm.h" 119#include "nsterm.h"
120#endif 120#endif
121
121extern int timers_run; 122extern int timers_run;
122 123
123Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid; 124Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid;
@@ -1870,12 +1871,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1870 } 1871 }
1871#endif 1872#endif
1872 1873
1873#if 0
1874 /* Replaced by close_process_descs */
1875 set_exclusive_use (inchannel);
1876 set_exclusive_use (outchannel);
1877#endif
1878
1879#ifdef O_NONBLOCK 1874#ifdef O_NONBLOCK
1880 fcntl (inchannel, F_SETFL, O_NONBLOCK); 1875 fcntl (inchannel, F_SETFL, O_NONBLOCK);
1881 fcntl (outchannel, F_SETFL, O_NONBLOCK); 1876 fcntl (outchannel, F_SETFL, O_NONBLOCK);
diff --git a/src/sysdep.c b/src/sysdep.c
index e7d35d46bf7..091b1b1e513 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -300,16 +300,6 @@ init_baud_rate (int fd)
300} 300}
301 301
302 302
303/*ARGSUSED*/
304void
305set_exclusive_use (int fd)
306{
307#ifdef FIOCLEX
308 ioctl (fd, FIOCLEX, 0);
309#endif
310 /* Ok to do nothing if this feature does not exist */
311}
312
313 303
314int wait_debugging; /* Set nonzero to make following function work under dbx 304int wait_debugging; /* Set nonzero to make following function work under dbx
315 (at least for bsd). */ 305 (at least for bsd). */
@@ -483,7 +473,7 @@ child_setup_tty (int out)
483 EMACS_SET_TTY (out, &s, 0); 473 EMACS_SET_TTY (out, &s, 0);
484#endif /* not WINDOWSNT */ 474#endif /* not WINDOWSNT */
485} 475}
486#endif /* MSDOS */ 476#endif /* not MSDOS */
487 477
488 478
489/* Record a signal code and the handler for it. */ 479/* Record a signal code and the handler for it. */
@@ -1486,242 +1476,6 @@ init_system_name (void)
1486 } 1476 }
1487} 1477}
1488 1478
1489#ifndef MSDOS
1490#if !defined (HAVE_SELECT)
1491
1492#include "sysselect.h"
1493#undef select
1494
1495#if defined (HAVE_X_WINDOWS) && !defined (HAVE_SELECT)
1496/* Cause explanatory error message at compile time,
1497 since the select emulation is not good enough for X. */
1498int *x = &x_windows_lose_if_no_select_system_call;
1499#endif
1500
1501/* Emulate as much as select as is possible under 4.1 and needed by Gnu Emacs
1502 * Only checks read descriptors.
1503 */
1504/* How long to wait between checking fds in select */
1505#define SELECT_PAUSE 1
1506int select_alarmed;
1507
1508/* For longjmp'ing back to read_input_waiting. */
1509
1510jmp_buf read_alarm_throw;
1511
1512/* Nonzero if the alarm signal should throw back to read_input_waiting.
1513 The read_socket_hook function sets this to 1 while it is waiting. */
1514
1515int read_alarm_should_throw;
1516
1517void
1518select_alarm (int ignore)
1519{
1520 select_alarmed = 1;
1521 signal (SIGALRM, SIG_IGN);
1522 SIGNAL_THREAD_CHECK (SIGALRM);
1523 if (read_alarm_should_throw)
1524 longjmp (read_alarm_throw, 1);
1525}
1526
1527#ifndef WINDOWSNT
1528/* Only rfds are checked. */
1529int
1530sys_select (int nfds,
1531 SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
1532 EMACS_TIME *timeout)
1533{
1534 /* XXX This needs to be updated for multi-tty support. Is there
1535 anybody who needs to emulate select these days? */
1536 int ravail = 0;
1537 SELECT_TYPE orfds;
1538 int timeoutval;
1539 int *local_timeout;
1540 extern int proc_buffered_char[];
1541 extern int process_tick, update_tick;
1542 unsigned char buf;
1543
1544#if defined (HAVE_SELECT) && defined (HAVE_X_WINDOWS)
1545 /* If we're using X, then the native select will work; we only need the
1546 emulation for non-X usage. */
1547 if (!NILP (Vinitial_window_system))
1548 return select (nfds, rfds, wfds, efds, timeout);
1549#endif
1550 timeoutval = timeout ? EMACS_SECS (*timeout) : 100000;
1551 local_timeout = &timeoutval;
1552 FD_ZERO (&orfds);
1553 if (rfds)
1554 {
1555 orfds = *rfds;
1556 FD_ZERO (rfds);
1557 }
1558 if (wfds)
1559 FD_ZERO (wfds);
1560 if (efds)
1561 FD_ZERO (efds);
1562
1563 /* If we are looking only for the terminal, with no timeout,
1564 just read it and wait -- that's more efficient. */
1565 if (*local_timeout == 100000 && process_tick == update_tick
1566 && FD_ISSET (0, &orfds))
1567 {
1568 int fd;
1569 for (fd = 1; fd < nfds; ++fd)
1570 if (FD_ISSET (fd, &orfds))
1571 goto hardway;
1572 if (! detect_input_pending ())
1573 read_input_waiting ();
1574 FD_SET (0, rfds);
1575 return 1;
1576 }
1577
1578 hardway:
1579 /* Once a second, till the timer expires, check all the flagged read
1580 * descriptors to see if any input is available. If there is some then
1581 * set the corresponding bit in the return copy of rfds.
1582 */
1583 while (1)
1584 {
1585 register int to_check, fd;
1586
1587 if (rfds)
1588 {
1589 for (to_check = nfds, fd = 0; --to_check >= 0; fd++)
1590 {
1591 if (FD_ISSET (fd, &orfds))
1592 {
1593 int avail = 0, status = 0;
1594
1595 if (fd == 0)
1596 avail = detect_input_pending (); /* Special keyboard handler */
1597 else
1598 {
1599#ifdef FIONREAD
1600 status = ioctl (fd, FIONREAD, &avail);
1601#else /* no FIONREAD */
1602 /* Hoping it will return -1 if nothing available
1603 or 0 if all 0 chars requested are read. */
1604 if (proc_buffered_char[fd] >= 0)
1605 avail = 1;
1606 else
1607 {
1608 avail = read (fd, &buf, 1);
1609 if (avail > 0)
1610 proc_buffered_char[fd] = buf;
1611 }
1612#endif /* no FIONREAD */
1613 }
1614 if (status >= 0 && avail > 0)
1615 {
1616 FD_SET (fd, rfds);
1617 ravail++;
1618 }
1619 }
1620 }
1621 }
1622 if (*local_timeout == 0 || ravail != 0 || process_tick != update_tick)
1623 break;
1624
1625 turn_on_atimers (0);
1626 signal (SIGALRM, select_alarm);
1627 select_alarmed = 0;
1628 alarm (SELECT_PAUSE);
1629
1630 /* Wait for a SIGALRM (or maybe a SIGTINT) */
1631 while (select_alarmed == 0 && *local_timeout != 0
1632 && process_tick == update_tick)
1633 {
1634 /* If we are interested in terminal input,
1635 wait by reading the terminal.
1636 That makes instant wakeup for terminal input at least. */
1637 if (FD_ISSET (0, &orfds))
1638 {
1639 read_input_waiting ();
1640 if (detect_input_pending ())
1641 select_alarmed = 1;
1642 }
1643 else
1644 pause ();
1645 }
1646 (*local_timeout) -= SELECT_PAUSE;
1647
1648 /* Reset the old alarm if there was one. */
1649 turn_on_atimers (1);
1650
1651 if (*local_timeout == 0) /* Stop on timer being cleared */
1652 break;
1653 }
1654 return ravail;
1655}
1656#endif /* not WINDOWSNT */
1657
1658/* Read keyboard input into the standard buffer,
1659 waiting for at least one character. */
1660
1661void
1662read_input_waiting (void)
1663{
1664 /* XXX This needs to be updated for multi-tty support. Is there
1665 anybody who needs to emulate select these days? */
1666 int nread, i;
1667
1668 if (read_socket_hook)
1669 {
1670 struct input_event hold_quit;
1671
1672 EVENT_INIT (hold_quit);
1673 hold_quit.kind = NO_EVENT;
1674
1675 read_alarm_should_throw = 0;
1676 if (! setjmp (read_alarm_throw))
1677 nread = (*read_socket_hook) (0, 1, &hold_quit);
1678 else
1679 nread = -1;
1680
1681 if (hold_quit.kind != NO_EVENT)
1682 kbd_buffer_store_event (&hold_quit);
1683 }
1684 else
1685 {
1686 struct input_event e;
1687 char buf[3];
1688 nread = read (fileno (stdin), buf, 1);
1689 EVENT_INIT (e);
1690
1691 /* Scan the chars for C-g and store them in kbd_buffer. */
1692 e.kind = ASCII_KEYSTROKE_EVENT;
1693 e.frame_or_window = selected_frame;
1694 e.modifiers = 0;
1695 for (i = 0; i < nread; i++)
1696 {
1697 /* Convert chars > 0177 to meta events if desired.
1698 We do this under the same conditions that read_avail_input does. */
1699 if (read_socket_hook == 0)
1700 {
1701 /* If the user says she has a meta key, then believe her. */
1702 if (meta_key == 1 && (buf[i] & 0x80))
1703 e.modifiers = meta_modifier;
1704 if (meta_key != 2)
1705 buf[i] &= ~0x80;
1706 }
1707
1708 XSETINT (e.code, buf[i]);
1709 kbd_buffer_store_event (&e);
1710 /* Don't look at input that follows a C-g too closely.
1711 This reduces lossage due to autorepeat on C-g. */
1712 if (buf[i] == quit_char)
1713 break;
1714 }
1715 }
1716}
1717
1718#if !defined (HAVE_SELECT)
1719#define select sys_select
1720#endif
1721
1722#endif /* not HAVE_SELECT */
1723#endif /* not MSDOS */
1724
1725/* POSIX signals support - DJB */ 1479/* POSIX signals support - DJB */
1726/* Anyone with POSIX signals should have ANSI C declarations */ 1480/* Anyone with POSIX signals should have ANSI C declarations */
1727 1481
@@ -2271,7 +2025,6 @@ dup2 (int oldd, int newd)
2271#ifndef HAVE_GETTIMEOFDAY 2025#ifndef HAVE_GETTIMEOFDAY
2272#ifdef HAVE_TIMEVAL 2026#ifdef HAVE_TIMEVAL
2273 2027
2274/* ARGSUSED */
2275int 2028int
2276gettimeofday (struct timeval *tp, struct timezone *tzp) 2029gettimeofday (struct timeval *tp, struct timezone *tzp)
2277{ 2030{