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