comparison src/nt.c @ 613:023b83f4e54b

[xemacs-hg @ 2001-06-10 10:42:16 by ben] ------ signal-code changes ------ data.c, device-tty.c, emacs.c, floatfns.c, linuxplay.c, nas.c, process-unix.c, signal.c, sunplay.c, sysdep.c, syssignal.h: use EMACS_SIGNAL everywhere instead of playing preprocessing games with signal(). s\windowsnt.h, s\mingw32.h, syssignal.h: Remove mswindows signal code from s+m headers and move to syssignal.h as one of the five ways of signal handling, instead of playing preprocessing games. fileio.c, sysdep.c: Rename sys_do_signal to qxe_reliable_signal. signal.c, process-unix.c, profile.c: Create set_timeout_signal(); use instead of just EMACS_SIGNAL to establish a signal handler on a timeout signal; this does special things under Cygwin. nt.c: Eliminate term_ntproc(), which is blank; used as a SIGABRT handler, which was wrong anyway. nt.c, win32.c: Move signal code from nt.c to win32.c, since Cygwin needs it too when dealing with timeout signals. s\cygwin32.h: Define CYGWIN_BROKEN_SIGNALS. ------ other changes ------ s\mingw32.h: Fix problems with NOT_C_CODE being in the wrong place and excluding defines needed when building Makefile.in.in. filelock.c, mule-canna.c, mule-ccl.c, mule-ccl.h, ralloc.c, unexalpha.c, unexapollo.c, unexcw.c, unexelfsgi.c, unexnt.c, unexsni.c, s\aix3-1.h, s\bsd4-1.h, s\bsd4-2.h, s\bsd4-3.h, s\cxux.h, s\cygwin32.h, s\dgux.h, s\dgux5-4r2.h, s\dgux5-4r3.h, s\dgux5-4r4.h, s\ewsux5r4.h, s\gnu.h, s\hpux.h, s\iris3-5.h, s\iris3-6.h, s\irix3-3.h, s\linux.h, s\mingw32.h, s\newsos5.h, s\nextstep.h, s\ptx.h, s\riscix1-1.h, s\riscix1-2.h, s\rtu.h, s\sco4.h, s\sco5.h, s\template.h, s\ultrix.h, s\umax.h, s\umips.h, s\unipl5-0.h, s\unipl5-2.h, s\usg5-0.h, s\usg5-2-2.h, s\usg5-2.h, s\usg5-3.h, s\usg5-4.h, s\windowsnt.h, s\xenix.h: Rename 'GNU Emacs' to XEmacs in the copyright and comments. nas.c: Stylistic cleanup. Avoid preprocessing games with names such as play_sound_file. ------ signal-code changes ------ data.c, device-tty.c, emacs.c, floatfns.c, linuxplay.c, nas.c, process-unix.c, signal.c, sunplay.c, sysdep.c, syssignal.h: use EMACS_SIGNAL everywhere instead of playing preprocessing games with signal(). s\windowsnt.h, s\mingw32.h, syssignal.h: Remove mswindows signal code from s+m headers and move to syssignal.h as one of the five ways of signal handling, instead of playing preprocessing games. fileio.c, sysdep.c: Rename sys_do_signal to qxe_reliable_signal. signal.c, process-unix.c, profile.c: Create set_timeout_signal(); use instead of just EMACS_SIGNAL to establish a signal handler on a timeout signal; this does special things under Cygwin. nt.c: Eliminate term_ntproc(), which is blank; used as a SIGABRT handler, which was wrong anyway. nt.c, win32.c: Move signal code from nt.c to win32.c, since Cygwin needs it too when dealing with timeout signals. s\cygwin32.h: Define CYGWIN_BROKEN_SIGNALS. ------ other changes ------ s\mingw32.h: Fix problems with NOT_C_CODE being in the wrong place and excluding defines needed when building Makefile.in.in. filelock.c, mule-canna.c, mule-ccl.c, mule-ccl.h, ralloc.c, unexalpha.c, unexapollo.c, unexcw.c, unexelfsgi.c, unexnt.c, unexsni.c, s\aix3-1.h, s\bsd4-1.h, s\bsd4-2.h, s\bsd4-3.h, s\cxux.h, s\cygwin32.h, s\dgux.h, s\dgux5-4r2.h, s\dgux5-4r3.h, s\dgux5-4r4.h, s\ewsux5r4.h, s\gnu.h, s\hpux.h, s\iris3-5.h, s\iris3-6.h, s\irix3-3.h, s\linux.h, s\mingw32.h, s\newsos5.h, s\nextstep.h, s\ptx.h, s\riscix1-1.h, s\riscix1-2.h, s\rtu.h, s\sco4.h, s\sco5.h, s\template.h, s\ultrix.h, s\umax.h, s\umips.h, s\unipl5-0.h, s\unipl5-2.h, s\usg5-0.h, s\usg5-2-2.h, s\usg5-2.h, s\usg5-3.h, s\usg5-4.h, s\windowsnt.h, s\xenix.h: Rename 'GNU Emacs' to XEmacs in the copyright and comments. nas.c: Stylistic cleanup. Avoid preprocessing games with names such as play_sound_file. xemacs-faq.texi: Update sections on Windows and MacOS availability. alist.el, apropos.el, autoload.el, bytecomp.el, cl-compat.el, cl-extra.el, cl-macs.el, cl-seq.el, cl.el, cmdloop.el, cus-edit.el, derived.el, gpm.el, itimer.el, lisp-mode.el, shadow.el, version.el, wid-browse.el: Rename 'GNU Emacs' to XEmacs in the copyright. Fix other references to GNU Emacs that should be XEmacs or just Emacs. files.el: Fix warning. simple.el: transpose-line-up/down will now move the region up or down by a line if active. cvtmail.c, fakemail.c, gnuserv.c, gnuserv.h, gnuslib.c, make-msgfile.c, make-path.c, pop.c, pop.h, profile.c, tcp.c: Rename 'GNU Emacs' to XEmacs in the copyright. Fix comments in similar ways. digest-doc.c, sorted-doc.c: Fix program and author name to reflect XEmacs.
author ben
date Sun, 10 Jun 2001 10:42:39 +0000
parents 38db05db9cb5
children a307f9a2021d
comparison
equal deleted inserted replaced
612:ff0d9e7facba 613:023b83f4e54b
1687 1687
1688 return rc; 1688 return rc;
1689 } 1689 }
1690 1690
1691 void 1691 void
1692 term_ntproc (int unused)
1693 {
1694 }
1695
1696 void
1697 init_ntproc (void) 1692 init_ntproc (void)
1698 { 1693 {
1699 /* Initial preparation for subprocess support: replace our standard 1694 /* Initial preparation for subprocess support: replace our standard
1700 handles with non-inheritable versions. */ 1695 handles with non-inheritable versions. */
1701 { 1696 {
1753 else 1748 else
1754 _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); 1749 _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY);
1755 _fdopen (2, "w"); 1750 _fdopen (2, "w");
1756 } 1751 }
1757 1752
1758 /* unfortunately, atexit depends on implementation of malloc */
1759 /* atexit (term_ntproc); */
1760 signal (SIGABRT, term_ntproc);
1761
1762 /* determine which drives are fixed, for GetCachedVolumeInformation */ 1753 /* determine which drives are fixed, for GetCachedVolumeInformation */
1763 { 1754 {
1764 /* GetDriveType must have trailing backslash. */ 1755 /* GetDriveType must have trailing backslash. */
1765 char drive[] = "A:\\"; 1756 char drive[] = "A:\\";
1766 1757
1802 Error_Behavior errb) 1793 Error_Behavior errb)
1803 { 1794 {
1804 return Vstdio_str; 1795 return Vstdio_str;
1805 } 1796 }
1806 #endif 1797 #endif
1807
1808 /*--------------------------------------------------------------------*/
1809 /* Signal support */
1810 /*--------------------------------------------------------------------*/
1811
1812 /* We need MS-defined signal and raise here */
1813 #undef signal
1814 #undef raise
1815
1816 #define sigmask(nsig) (1U << nsig)
1817
1818 /* We can support as many signals as fit into word */
1819 #define SIG_MAX 32
1820
1821 /* Signal handlers. Initial value = 0 = SIG_DFL */
1822 static void (__cdecl *signal_handlers[SIG_MAX])(int) = {0};
1823
1824 /* Signal block mask: bit set to 1 means blocked */
1825 unsigned signal_block_mask = 0;
1826
1827 /* Signal pending mask: bit set to 1 means sig is pending */
1828 unsigned signal_pending_mask = 0;
1829
1830 mswindows_sighandler
1831 mswindows_sigset (int nsig, mswindows_sighandler handler)
1832 {
1833 /* We delegate some signals to the system function */
1834 if (nsig == SIGFPE || nsig == SIGABRT || nsig == SIGINT)
1835 return signal (nsig, handler);
1836
1837 if (nsig < 0 || nsig > SIG_MAX)
1838 {
1839 errno = EINVAL;
1840 return NULL;
1841 }
1842
1843 /* Store handler ptr */
1844 {
1845 mswindows_sighandler old_handler = signal_handlers[nsig];
1846 signal_handlers[nsig] = handler;
1847 return old_handler;
1848 }
1849 }
1850
1851 int
1852 mswindows_sighold (int nsig)
1853 {
1854 if (nsig < 0 || nsig > SIG_MAX)
1855 return errno = EINVAL;
1856
1857 signal_block_mask |= sigmask (nsig);
1858 return 0;
1859 }
1860
1861 int
1862 mswindows_sigrelse (int nsig)
1863 {
1864 if (nsig < 0 || nsig > SIG_MAX)
1865 return errno = EINVAL;
1866
1867 signal_block_mask &= ~sigmask (nsig);
1868
1869 if (signal_pending_mask & sigmask (nsig))
1870 mswindows_raise (nsig);
1871
1872 return 0;
1873 }
1874
1875 int
1876 mswindows_sigpause (int nsig)
1877 {
1878 /* This is currently not called, because the only call to sigpause
1879 inside XEmacs is with SIGCHLD parameter. Just in case, we put an
1880 assert here, so anyone adds a call to sigpause will be surprised
1881 (or surprise someone else...) */
1882 assert (0);
1883 return 0;
1884 }
1885
1886 int
1887 mswindows_raise (int nsig)
1888 {
1889 /* We delegate some raises to the system routine */
1890 if (nsig == SIGFPE || nsig == SIGABRT || nsig == SIGINT)
1891 return raise (nsig);
1892
1893 if (nsig < 0 || nsig > SIG_MAX)
1894 return errno = EINVAL;
1895
1896 /* If the signal is blocked, remember to issue later */
1897 if (signal_block_mask & sigmask (nsig))
1898 {
1899 signal_pending_mask |= sigmask (nsig);
1900 return 0;
1901 }
1902
1903 if (signal_handlers[nsig] == SIG_IGN)
1904 return 0;
1905
1906 if (signal_handlers[nsig] != SIG_DFL)
1907 {
1908 (*signal_handlers[nsig]) (nsig);
1909 return 0;
1910 }
1911
1912 /* Default signal actions */
1913 if (nsig == SIGALRM || nsig == SIGPROF)
1914 exit (3);
1915
1916 /* Other signals are ignored by default */
1917 return 0;
1918 }
1919 1798
1920 1799
1921 /*--------------------------------------------------------------------*/ 1800 /*--------------------------------------------------------------------*/
1922 /* Memory-mapped files */ 1801 /* Memory-mapped files */
1923 /*--------------------------------------------------------------------*/ 1802 /*--------------------------------------------------------------------*/