Debian Codegraph @

lib/Pty.cpp

raw symbols SCIP
1 /*
2 * This file is a part of QTerminal - http://gitorious.org/qterminal
3 *
4 * This file was un-linked from KDE and modified
5 * by Maxim Bourmistrov <[email protected]>
6 *
7 */
8
9 /*
10 This file is part of Konsole, an X terminal.
11 Copyright 1997,1998 by Lars Doelle <[email protected]>
12
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 02110-1301 USA.
27 */
28
29 // Own
30 #include "Pty.h"cxx . . $ `<file>/lib/Pty.h`/
31
32 // System
33 #include <sys/types.h>
34 #include <sys/stat.h>
35 #include <unistd.h>
36 #include <cerrno>
37 #include <termios.h>
38 #include <csignal>
39
40 // Qt
41 #include <QStringList>
42 #include <QtDebug>
43
44 #include "kpty.h"cxx . . $ `<file>/lib/kpty.h`/
45 #include "kptydevice.h"cxx . . $ `<file>/lib/kptydevice.h`/
46
47 using namespace Konsole;
48
49 void Ptycxx . . $ Konsole/Pty#::setWindowSizecxx . . $ Konsole/Pty#setWindowSize(3e454b8ccf442868).(int lines, int cols)
50 {
51 _windowColumnscxx . . $ Konsole/Pty#_windowColumns. = cols;
52 _windowLinescxx . . $ Konsole/Pty#_windowLines. = lines;
53
54 if (ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->masterFdcxx . . $ KPty#masterFd(455f465bc33b4cdf).() >= 0)
55 ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->setWinSizecxx . . $ KPty#setWinSize(cf9ef193275fa6d8).(lines, cols);
56 }
57 QSizecxx . . $ QSize# Ptycxx . . $ Konsole/Pty#::windowSizecxx . . $ Konsole/Pty#windowSize(4b3b776e5ee2b367).() const
58 {
59 return {cxx . . $ QSize#QSize(c0d38f4800714fae)._windowColumnscxx . . $ Konsole/Pty#_windowColumns.,_windowLinescxx . . $ Konsole/Pty#_windowLines.};
60 }
61
62 void Ptycxx . . $ Konsole/Pty#::setFlowControlEnabledcxx . . $ Konsole/Pty#setFlowControlEnabled(b45ddcbc8423892c).(bool enable)
63 {
64 _xonXoffcxx . . $ Konsole/Pty#_xonXoff. = enable;
65
66 if (ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->masterFdcxx . . $ KPty#masterFd(455f465bc33b4cdf).() >= 0)
67 {
68 struct ::termioscxx . . $ termios# ttmode;
69 ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->tcGetAttrcxx . . $ KPty#tcGetAttr(5fad475f32619bec).(&ttmode);
70 if (!enable)
71 ttmode.c_iflagcxx . . $ termios#c_iflag. &= ~(IXOFFcxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:37:9`! | IXONcxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:35:9`!);
72 else
73 ttmode.c_iflagcxx . . $ termios#c_iflag. |= (IXOFFcxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:37:9`! | IXONcxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:35:9`!);
74 if (!ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->tcSetAttrcxx . . $ KPty#tcSetAttr(98b4f1f88d9dab40).(&ttmode))
75 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Unable to set terminal attributes.";
76 }
77 }
78 bool Ptycxx . . $ Konsole/Pty#::flowControlEnabledcxx . . $ Konsole/Pty#flowControlEnabled(50ce9a9e25b4a850).() const
79 {
80 if (ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->masterFdcxx . . $ KPty#masterFd(455f465bc33b4cdf).() >= 0)
81 {
82 struct ::termioscxx . . $ termios# ttmode;
83 ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->tcGetAttrcxx . . $ KPty#tcGetAttr(5fad475f32619bec).(&ttmode);
84 return ttmode.c_iflagcxx . . $ termios#c_iflag. & IXOFFcxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:37:9`! &&
85 ttmode.c_iflagcxx . . $ termios#c_iflag. & IXONcxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:35:9`!;
86 }
87 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Unable to get flow control status, terminal not connected.";
88 return false;
89 }
90
91 void Ptycxx . . $ Konsole/Pty#::setUtf8Modecxx . . $ Konsole/Pty#setUtf8Mode(b45ddcbc8423892c).(bool enable)
92 {
93 #ifdef IUTF8cxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:40:9`! // XXX not a reasonable place to check it.
94 _utf8cxx . . $ Konsole/Pty#_utf8. = enable;
95
96 if (ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->masterFdcxx . . $ KPty#masterFd(455f465bc33b4cdf).() >= 0)
97 {
98 struct ::termioscxx . . $ termios# ttmode;
99 ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->tcGetAttrcxx . . $ KPty#tcGetAttr(5fad475f32619bec).(&ttmode);
100 if (!enable)
101 ttmode.c_iflagcxx . . $ termios#c_iflag. &= ~IUTF8cxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:40:9`!;
102 else
103 ttmode.c_iflagcxx . . $ termios#c_iflag. |= IUTF8cxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:40:9`!;
104 if (!ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->tcSetAttrcxx . . $ KPty#tcSetAttr(98b4f1f88d9dab40).(&ttmode))
105 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Unable to set terminal attributes.";
106 }
107 #endif
108 }
109
110 void Ptycxx . . $ Konsole/Pty#::setErasecxx . . $ Konsole/Pty#setErase(44b6ea1973a07080).(char erase)
111 {
112 _eraseCharcxx . . $ Konsole/Pty#_eraseChar. = erase;
113
114 if (ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->masterFdcxx . . $ KPty#masterFd(455f465bc33b4cdf).() >= 0)
115 {
116 struct ::termioscxx . . $ termios# ttmode;
117 ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->tcGetAttrcxx . . $ KPty#tcGetAttr(5fad475f32619bec).(&ttmode);
118 ttmode.c_cccxx . . $ termios#c_cc.[VERASEcxx . . $ `<external>/5505922754558120548/termios-c_cc.h:26:9`!] = erase;
119 if (!ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->tcSetAttrcxx . . $ KPty#tcSetAttr(98b4f1f88d9dab40).(&ttmode))
120 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Unable to set terminal attributes.";
121 }
122 }
123
124 char Ptycxx . . $ Konsole/Pty#::erasecxx . . $ Konsole/Pty#erase(1b8b762cbef9c2c9).() const
125 {
126 if (ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->masterFdcxx . . $ KPty#masterFd(455f465bc33b4cdf).() >= 0)
127 {
128 struct ::termioscxx . . $ termios# ttyAttributes;
129 ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->tcGetAttrcxx . . $ KPty#tcGetAttr(5fad475f32619bec).(&ttyAttributes);
130 return ttyAttributes.c_cccxx . . $ termios#c_cc.[VERASEcxx . . $ `<external>/5505922754558120548/termios-c_cc.h:26:9`!];
131 }
132
133 return _eraseCharcxx . . $ Konsole/Pty#_eraseChar.;
134 }
135
136 void Ptycxx . . $ Konsole/Pty#::addEnvironmentVariablescxx . . $ Konsole/Pty#addEnvironmentVariables(631c0101495f0328).(const QStringListcxx . . $ QStringList#& environment)
137 {
138 QListIteratorcxx . . $ QListIterator#<QStringcxx . . $ QString#> itercxx . . $ QListIterator#QListIterator(742a15f66a895bc5).(environment);
139 while (iter.hasNextcxx . . $ QListIterator#hasNext(50ce9a9e25b4a850).())
140 {
141 QStringcxx . . $ QString# pair = itercxx . . $ QString#QString(132dd6869045752b)..nextcxx . . $ QListIterator#next(1306adbac230aeaa).();
142
143 // split on the first '=' character
144 int pos = pair.indexOfcxx . . $ QString#indexOf(75b556ba78e4903c).(QLatin1Charcxx . . $ QChar#QChar(a50889c09eec06d9).('='));
145
146 if ( pos >= 0 )
147 {
148 QStringcxx . . $ QString# variable = pair.leftcxx . . $ QString#left(3f3c3d0e9c0eb37f).(pos);
149 QStringcxx . . $ QString# value = pair.midcxx . . $ QString#mid(44b7563da18aea72).(pos+1);
150
151 setEnvcxx . . $ KProcess#setEnv(79b500c10be86587).(variable,value);
152 }
153 }
154 }
155
156 int Ptycxx . . $ Konsole/Pty#::startcxx . . $ Konsole/Pty#start(12019f053b0a97bc).(const QStringcxx . . $ QString#& program,
157 const QStringListcxx . . $ QStringList#& programArguments,
158 const QStringListcxx . . $ QStringList#& environment,
159 ulongcxx . . $ ulong# winid,
160 bool addToUtmp
161 //const QString& dbusService,
162 //const QString& dbusSession
163 )
164 {
165 clearProgramcxx . . $ KProcess#clearProgram(49f6e7a06ebc5aa8).();
166
167 // For historical reasons, the first argument in programArguments is the
168 // name of the program to execute, so create a list consisting of all
169 // but the first argument to pass to setProgram()
170 Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!(programArguments.count() >= 1);
171 setProgramcxx . . $ KProcess#setProgram(4a8467afe4f213e4).(program, programArgumentscxx . . $ QStringList#QStringList(6fe09f9fe6e0f503)..midcxx . . $ QList#mid(45fc363cae6a3705).(1));
172
173 addEnvironmentVariablescxx . . $ Konsole/Pty#addEnvironmentVariables(631c0101495f0328).(environment);
174
175 setEnvcxx . . $ KProcess#setEnv(79b500c10be86587).(QLatin1Stringcxx . . $ QString#QString(4641beeb24e75d60).("WINDOWID"), QStringcxx . . $ QString#::numbercxx . . $ QString#number(f54db86e0e113c71).(winid));
176 setEnvcxx . . $ KProcess#setEnv(79b500c10be86587).(QLatin1Stringcxx . . $ QString#QString(4641beeb24e75d60).("COLORTERM"), QLatin1Stringcxx . . $ QString#QString(4641beeb24e75d60).("truecolor"));
177
178 // unless the LANGUAGE environment variable has been set explicitly
179 // set it to a null string
180 // this fixes the problem where KCatalog sets the LANGUAGE environment
181 // variable during the application's startup to something which
182 // differs from LANG,LC_* etc. and causes programs run from
183 // the terminal to display messages in the wrong language
184 //
185 // this can happen if LANG contains a language which KDE
186 // does not have a translation for
187 //
188 // BR:149300
189 setEnvcxx . . $ KProcess#setEnv(79b500c10be86587).(QLatin1Stringcxx . . $ QString#QString(4641beeb24e75d60).("LANGUAGE"),QStringcxx . . $ QString#QString(ced63f7c635d850d).(),false /* do not overwrite existing value if any */);
190
191 setUseUtmpcxx . . $ KPtyProcess#setUseUtmp(b45ddcbc8423892c).(addToUtmp);
192
193 struct ::termioscxx . . $ termios# ttmode;
194 ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->tcGetAttrcxx . . $ KPty#tcGetAttr(5fad475f32619bec).(&ttmode);
195 if (!_xonXoffcxx . . $ Konsole/Pty#_xonXoff.)
196 ttmode.c_iflagcxx . . $ termios#c_iflag. &= ~(IXOFFcxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:37:9`! | IXONcxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:35:9`!);
197 else
198 ttmode.c_iflagcxx . . $ termios#c_iflag. |= (IXOFFcxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:37:9`! | IXONcxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:35:9`!);
199 #ifdef IUTF8cxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:40:9`! // XXX not a reasonable place to check it.
200 if (!_utf8cxx . . $ Konsole/Pty#_utf8.)
201 ttmode.c_iflagcxx . . $ termios#c_iflag. &= ~IUTF8cxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:40:9`!;
202 else
203 ttmode.c_iflagcxx . . $ termios#c_iflag. |= IUTF8cxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:40:9`!;
204 #endif
205
206 if (_eraseCharcxx . . $ Konsole/Pty#_eraseChar. != 0)
207 ttmode.c_cccxx . . $ termios#c_cc.[VERASEcxx . . $ `<external>/5505922754558120548/termios-c_cc.h:26:9`!] = _eraseCharcxx . . $ Konsole/Pty#_eraseChar.;
208
209 if (!ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->tcSetAttrcxx . . $ KPty#tcSetAttr(98b4f1f88d9dab40).(&ttmode))
210 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Unable to set terminal attributes.";
211
212 ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->setWinSizecxx . . $ KPty#setWinSize(cf9ef193275fa6d8).(_windowLinescxx . . $ Konsole/Pty#_windowLines., _windowColumnscxx . . $ Konsole/Pty#_windowColumns.);
213
214 KProcesscxx . . $ KProcess#::startcxx . . $ KProcess#start(49f6e7a06ebc5aa8).();
215
216 if (!waitForStartedcxx . . $ QProcess#waitForStarted(83c267b20bac841a).())
217 return -1;
218
219 return 0;
220 }
221
222 void Ptycxx . . $ Konsole/Pty#::setEmptyPTYPropertiescxx . . $ Konsole/Pty#setEmptyPTYProperties(49f6e7a06ebc5aa8).()
223 {
224 struct ::termioscxx . . $ termios# ttmode;
225 ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->tcGetAttrcxx . . $ KPty#tcGetAttr(5fad475f32619bec).(&ttmode);
226 if (!_xonXoffcxx . . $ Konsole/Pty#_xonXoff.)
227 ttmode.c_iflagcxx . . $ termios#c_iflag. &= ~(IXOFFcxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:37:9`! | IXONcxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:35:9`!);
228 else
229 ttmode.c_iflagcxx . . $ termios#c_iflag. |= (IXOFFcxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:37:9`! | IXONcxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:35:9`!);
230 #ifdef IUTF8cxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:40:9`! // XXX not a reasonable place to check it.
231 if (!_utf8cxx . . $ Konsole/Pty#_utf8.)
232 ttmode.c_iflagcxx . . $ termios#c_iflag. &= ~IUTF8cxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:40:9`!;
233 else
234 ttmode.c_iflagcxx . . $ termios#c_iflag. |= IUTF8cxx . . $ `<external>/8770703639284775376/termios-c_iflag.h:40:9`!;
235 #endif
236
237 if (_eraseCharcxx . . $ Konsole/Pty#_eraseChar. != 0)
238 ttmode.c_cccxx . . $ termios#c_cc.[VERASEcxx . . $ `<external>/5505922754558120548/termios-c_cc.h:26:9`!] = _eraseCharcxx . . $ Konsole/Pty#_eraseChar.;
239
240 if (!ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->tcSetAttrcxx . . $ KPty#tcSetAttr(98b4f1f88d9dab40).(&ttmode))
241 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Unable to set terminal attributes.";
242 }
243
244 void Ptycxx . . $ Konsole/Pty#::setWriteablecxx . . $ Konsole/Pty#setWriteable(b45ddcbc8423892c).(bool writeable)
245 {
246 struct stat sbuf;
247 stat(ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->ttyNamecxx . . $ KPty#ttyName(a9f41ea0e82d88cf).(), &sbuf);
248 if (writeable)
249 chmod(ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->ttyNamecxx . . $ KPty#ttyName(a9f41ea0e82d88cf).(), sbuf.st_mode | S_IWGRPcxx . . $ `<external>/531885356569766532/stat.h:181:9`!);
250 else
251 chmod(ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->ttyNamecxx . . $ KPty#ttyName(a9f41ea0e82d88cf).(), sbuf.st_mode & ~(S_IWGRPcxx . . $ `<external>/531885356569766532/stat.h:181:9`!|S_IWOTHcxx . . $ `<external>/531885356569766532/stat.h:187:9`!));
252 }
253
254 Ptycxx . . $ Konsole/Pty#::Ptycxx . . $ Konsole/Pty#Pty(1ee1e1ac455d3e6e).(int masterFd, QObjectcxx . . $ QObject#* parent)
255 : KPtyProcesscxx . . $ KPtyProcess#(masterFd,parent)
256 {
257 initcxx . . $ Konsole/Pty#init(49f6e7a06ebc5aa8).();
258 }
259 Ptycxx . . $ Konsole/Pty#::Ptycxx . . $ Konsole/Pty#Pty(749de1b6ae65bddd).(QObjectcxx . . $ QObject#* parent)
260 : KPtyProcesscxx . . $ KPtyProcess#(parent)
261 {
262 initcxx . . $ Konsole/Pty#init(49f6e7a06ebc5aa8).();
263 }
264 void Ptycxx . . $ Konsole/Pty#::initcxx . . $ Konsole/Pty#init(49f6e7a06ebc5aa8).()
265 {
266 _windowColumnscxx . . $ Konsole/Pty#_windowColumns. = 0;
267 _windowLinescxx . . $ Konsole/Pty#_windowLines. = 0;
268 _eraseCharcxx . . $ Konsole/Pty#_eraseChar. = 0;
269 _xonXoffcxx . . $ Konsole/Pty#_xonXoff. = true;
270 _utf8cxx . . $ Konsole/Pty#_utf8. =true;
271
272 connectcxx . . $ QObject#connect(158df1d9a01a3410).(ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).(), SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(readyRead()) , this , SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(dataReceived()));
273 setPtyChannelscxx . . $ KPtyProcess#setPtyChannels(fe45b12a10cd71c6).(KPtyProcesscxx . . $ QFlags#QFlags(93d577a3e9528307).::AllChannelscxx . . $ KPtyProcess#AllChannels.);
274 }
275
276 Ptycxx . . $ Konsole/Pty#::~cxx . . $ Konsole/Pty#`~Pty`(ced63f7c635d850d).Ptycxx . . $ Konsole/Pty#()
277 {
278 }
279
280 void Ptycxx . . $ Konsole/Pty#::sendDatacxx . . $ Konsole/Pty#sendData(34d26762b42c433a).(const char* data, int length)
281 {
282 if (!length)
283 return;
284
285 if (!ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->writecxx . . $ QIODevice#write(93d4069f65218ea4).(data,length))
286 {
287 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Pty::doSendJobs - Could not send input data to terminal process.";
288 return;
289 }
290 }
291
292 void Ptycxx . . $ Konsole/Pty#::dataReceivedcxx . . $ Konsole/Pty#dataReceived(49f6e7a06ebc5aa8).()
293 {
294 QByteArraycxx . . $ QByteArray# data = ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->readAllcxx . . $ QIODevice#readAll(b3c286cec66e09f4).();
295 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! receivedDatacxx . . $ Konsole/Pty#receivedData(34d26762b42c433a).(data.constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).(),data.countcxx . . $ QByteArray#count(455f465bc33b4cdf).());
296 }
297
298 void Ptycxx . . $ Konsole/Pty#::lockPtycxx . . $ Konsole/Pty#lockPty(b45ddcbc8423892c).(bool lock)
299 {
300 Q_UNUSEDcxx . . $ `<external>/15045578679651060896/qglobal.h:117:9`!(lock);
301
302 // TODO: Support for locking the Pty
303 //if (lock)
304 //suspend();
305 //else
306 //resume();
307 }
308
309 int Ptycxx . . $ Konsole/Pty#::foregroundProcessGroupcxx . . $ Konsole/Pty#foregroundProcessGroup(455f465bc33b4cdf).() const
310 {
311 int pid = tcgetpgrp(ptycxx . . $ KPtyProcess#pty(e0e5ab7122928a46).()->masterFdcxx . . $ KPty#masterFd(455f465bc33b4cdf).());
312
313 if ( pid != -1 )
314 {
315 return pid;
316 }
317
318 return 0;
319 }
320
321 void Ptycxx . . $ Konsole/Pty#::setupChildProcesscxx . . $ Konsole/Pty#setupChildProcess(49f6e7a06ebc5aa8).()
322 {
323 KPtyProcesscxx . . $ KPtyProcess#::setupChildProcesscxx . . $ KPtyProcess#setupChildProcess(49f6e7a06ebc5aa8).();
324
325 // reset all signal handlers
326 // this ensures that terminal applications respond to
327 // signals generated via key sequences such as Ctrl+C
328 // (which sends SIGINT)
329 struct sigaction action;
330 sigset_t sigset;
331 sigemptyset(&action.sa_mask);
332 sigemptyset(&sigset);
333 action.sa_handlercxx . . $ `<external>/16635209305659446502/sigaction.h:39:10`! = SIG_DFLcxx . . $ `<external>/11773118241360591791/signum-generic.h:29:9`!;
334 action.sa_flags = 0;
335 for (int signal=1;signal < NSIGcxx . . $ `<external>/10483943697151122783/signal.h:184:10`!; signal++) {
336 sigaction(signal,&action,nullptr);
337 sigaddset(&sigset, signal);
338 }
339 sigprocmask(SIG_UNBLOCKcxx . . $ `<external>/16635209305659446502/sigaction.h:80:9`!, &sigset, nullptr);
340 }