Skip to content

Commit 1818b84

Browse files
benzearichardweinberger
authored andcommitted
um: Do not use printk in SIGWINCH helper thread
The thread is running outside of the UML kernel scope and is a helper. As such, printk cannot work and os_info must be used instead. Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent 236f9fe commit 1818b84

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

arch/um/drivers/chan_user.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ static int winch_thread(void *arg)
153153
pipe_fd = data->pipe_fd;
154154
count = write(pipe_fd, &c, sizeof(c));
155155
if (count != sizeof(c))
156-
printk(UM_KERN_ERR "winch_thread : failed to write "
157-
"synchronization byte, err = %d\n", -count);
156+
os_info("winch_thread : failed to write synchronization byte, err = %d\n",
157+
-count);
158158

159159
/*
160160
* We are not using SIG_IGN on purpose, so don't fix it as I thought to
@@ -166,28 +166,28 @@ static int winch_thread(void *arg)
166166
sigfillset(&sigs);
167167
/* Block all signals possible. */
168168
if (sigprocmask(SIG_SETMASK, &sigs, NULL) < 0) {
169-
printk(UM_KERN_ERR "winch_thread : sigprocmask failed, "
170-
"errno = %d\n", errno);
169+
os_info("winch_thread : sigprocmask failed, errno = %d\n",
170+
errno);
171171
exit(1);
172172
}
173173
/* In sigsuspend(), block anything else than SIGWINCH. */
174174
sigdelset(&sigs, SIGWINCH);
175175

176176
if (setsid() < 0) {
177-
printk(UM_KERN_ERR "winch_thread : setsid failed, errno = %d\n",
177+
os_info("winch_thread : setsid failed, errno = %d\n",
178178
errno);
179179
exit(1);
180180
}
181181

182182
if (ioctl(pty_fd, TIOCSCTTY, 0) < 0) {
183-
printk(UM_KERN_ERR "winch_thread : TIOCSCTTY failed on "
184-
"fd %d err = %d\n", pty_fd, errno);
183+
os_info("winch_thread : TIOCSCTTY failed on "
184+
"fd %d err = %d\n", pty_fd, errno);
185185
exit(1);
186186
}
187187

188188
if (tcsetpgrp(pty_fd, os_getpid()) < 0) {
189-
printk(UM_KERN_ERR "winch_thread : tcsetpgrp failed on "
190-
"fd %d err = %d\n", pty_fd, errno);
189+
os_info("winch_thread : tcsetpgrp failed on fd %d err = %d\n",
190+
pty_fd, errno);
191191
exit(1);
192192
}
193193

@@ -199,8 +199,8 @@ static int winch_thread(void *arg)
199199
*/
200200
count = read(pipe_fd, &c, sizeof(c));
201201
if (count != sizeof(c))
202-
printk(UM_KERN_ERR "winch_thread : failed to read "
203-
"synchronization byte, err = %d\n", errno);
202+
os_info("winch_thread : failed to read synchronization byte, err = %d\n",
203+
errno);
204204

205205
while(1) {
206206
/*
@@ -211,8 +211,8 @@ static int winch_thread(void *arg)
211211

212212
count = write(pipe_fd, &c, sizeof(c));
213213
if (count != sizeof(c))
214-
printk(UM_KERN_ERR "winch_thread : write failed, "
215-
"err = %d\n", errno);
214+
os_info("winch_thread : write failed, err = %d\n",
215+
errno);
216216
}
217217
}
218218

0 commit comments

Comments
 (0)