home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / gdb-4.9 / gdb / ultra3-xdep.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-12  |  2.6 KB  |  128 lines

  1. /* Host-dependent code for GDB, for NYU Ultra3 running Sym1 OS.
  2.    Copyright (C) 1988, 1989, 1991, 1992 Free Software Foundation, Inc.
  3.    Contributed by David Wood (wood@nyu.edu) at New York University.
  4.  
  5. This file is part of GDB.
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. #define DEBUG
  22. #include "defs.h"
  23. #include "frame.h"
  24. #include "inferior.h"
  25. #include "symtab.h"
  26. #include "value.h"
  27.  
  28. #include <sys/types.h>
  29. #include <sys/param.h>
  30. #include <signal.h>
  31. #include <sys/ioctl.h>
  32. #include <fcntl.h>  
  33.  
  34. #include "gdbcore.h"
  35.  
  36. #include <sys/file.h>
  37. #include <sys/stat.h>
  38.  
  39. /* Assorted operating system circumventions */
  40.  
  41. #ifdef SYM1
  42.  
  43. /* FIXME: Kludge this for now. It really should be system call. */
  44. int
  45. getpagesize()
  46. { return(8192); }
  47.  
  48. /* FIXME: Fake out the fcntl() call, which we don't have.  */
  49. fcntl(fd, cmd, arg)
  50. int fd, cmd, arg;
  51. {
  52.  
  53.   switch (cmd) {
  54.     case F_GETFL: return(O_RDONLY);    break;
  55.     default:    
  56.         printf("Ultra3's fcntl() failing, cmd = %d.\n",cmd);
  57.         return(-1);
  58.   }
  59. }
  60.  
  61.  
  62. /* 
  63.  * 4.2 Signal support, requires linking with libjobs.
  64.  */
  65. static int    _SigMask;
  66. #define sigbit(s)       (1L << ((s)-1))
  67.  
  68. init_SigMask()
  69. {
  70.     /* Taken from the sym1 kernel in machdep.c:startup() */
  71.     _SigMask = sigbit (SIGTSTP) | sigbit (SIGTTOU) | sigbit (SIGTTIN) |
  72.                         sigbit (SIGCHLD) | sigbit (SIGTINT);
  73. }
  74.  
  75. sigmask(signo)
  76.     int signo;
  77. {
  78.     return (1 << (signo-1));
  79. }
  80.  
  81. sigsetmask(sigmask)
  82. unsigned int sigmask;
  83. {
  84.     int i, mask = 1;
  85.     int lastmask = _SigMask;
  86.  
  87.     for (i=0 ; i<NSIG ; i++) {
  88.         if (sigmask & mask) { 
  89.             if (!(_SigMask & mask)) {
  90.                 sighold(i+1);
  91.                 _SigMask |= mask;
  92.             }
  93.         } else if (_SigMask & mask) {
  94.             sigrelse(i+1);
  95.             _SigMask &= ~mask;
  96.         }
  97.         mask <<= 1;
  98.     }
  99.     return (lastmask);
  100. }
  101.  
  102. sigblock(sigmask)
  103. unsigned int sigmask;
  104. {
  105.     int i, mask = 1;
  106.     int lastmask = _SigMask;
  107.  
  108.     for (i=0 ; i<NSIG ; i++) {
  109.         if ((sigmask & mask) && !(_SigMask & mask)) {
  110.             sighold(i+1);
  111.             _SigMask |= mask;
  112.         }
  113.         mask <<= 1;
  114.     }
  115.     return (lastmask);
  116. }
  117. #endif /* SYM1 */
  118.  
  119.  
  120. /* Initialization code for this module.  */
  121.  
  122. _initialize_ultra3 ()
  123. {
  124. #ifdef SYM1
  125.     init_SigMask();
  126. #endif
  127. }
  128.