Fix improper uses of ScopedLockSignal.
This commit is contained in:
parent
b2235844da
commit
fff849b151
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2013, 2014, 2015, 2016 Jonas 'Sortie' Termansen.
|
||||
* Copyright (c) 2012, 2013, 2014, 2015, 2016, 2021 Jonas 'Sortie' Termansen.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -249,7 +249,7 @@ void LogTerminal::ProcessKeystroke(int kbkey)
|
|||
|
||||
ssize_t LogTerminal::tcgetblob(ioctx_t* ctx, const char* name, void* buffer, size_t count)
|
||||
{
|
||||
ScopedLockSignal lock(&termlock);
|
||||
ScopedLock lock(&termlock);
|
||||
if ( hungup )
|
||||
return errno = EIO, -1;
|
||||
if ( !name )
|
||||
|
@ -280,7 +280,7 @@ ssize_t LogTerminal::tcgetblob(ioctx_t* ctx, const char* name, void* buffer, siz
|
|||
|
||||
ssize_t LogTerminal::tcsetblob(ioctx_t* ctx, const char* name, const void* buffer, size_t count)
|
||||
{
|
||||
ScopedLockSignal lock(&termlock);
|
||||
ScopedLock lock(&termlock);
|
||||
if ( hungup )
|
||||
return errno = EIO, -1;
|
||||
if ( !name )
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015 Jonas 'Sortie' Termansen.
|
||||
* Copyright (c) 2015, 2021 Jonas 'Sortie' Termansen.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -240,7 +240,7 @@ short PS2MouseDevice::PollEventStatus()
|
|||
|
||||
int PS2MouseDevice::poll(ioctx_t* /*ctx*/, PollNode* node)
|
||||
{
|
||||
ScopedLockSignal lock(&devlock);
|
||||
ScopedLock lock(&devlock);
|
||||
short ret_status = PollEventStatus() & node->events;
|
||||
if ( ret_status )
|
||||
{
|
||||
|
@ -253,7 +253,7 @@ int PS2MouseDevice::poll(ioctx_t* /*ctx*/, PollNode* node)
|
|||
|
||||
void PS2MouseDevice::OnMouseByte(PS2Mouse* /*mouse*/, void* /*user*/)
|
||||
{
|
||||
ScopedLockSignal lock(&devlock);
|
||||
ScopedLock lock(&devlock);
|
||||
poll_channel.Signal(PollEventStatus());
|
||||
kthread_cond_signal(&datacond);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 2012, 2013, 2014, 2015, 2017 Jonas 'Sortie' Termansen.
|
||||
* Copyright (c) 2011-2017, 2021 Jonas 'Sortie' Termansen.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -435,7 +435,7 @@ short PipeChannel::WritePollEventStatus()
|
|||
|
||||
int PipeChannel::read_poll(ioctx_t* /*ctx*/, PollNode* node)
|
||||
{
|
||||
ScopedLockSignal lock(&pipelock);
|
||||
ScopedLock lock(&pipelock);
|
||||
short ret_status = ReadPollEventStatus() & node->events;
|
||||
if ( ret_status )
|
||||
return node->master->revents |= ret_status, 0;
|
||||
|
@ -445,7 +445,7 @@ int PipeChannel::read_poll(ioctx_t* /*ctx*/, PollNode* node)
|
|||
|
||||
int PipeChannel::write_poll(ioctx_t* /*ctx*/, PollNode* node)
|
||||
{
|
||||
ScopedLockSignal lock(&pipelock);
|
||||
ScopedLock lock(&pipelock);
|
||||
short ret_status = WritePollEventStatus() & node->events;
|
||||
if ( ret_status )
|
||||
return node->master->revents |= ret_status, 0;
|
||||
|
@ -455,31 +455,31 @@ int PipeChannel::write_poll(ioctx_t* /*ctx*/, PollNode* node)
|
|||
|
||||
bool PipeChannel::GetSIGPIPEDelivery()
|
||||
{
|
||||
ScopedLockSignal lock(&pipelock);
|
||||
ScopedLock lock(&pipelock);
|
||||
return is_sigpipe_enabled;
|
||||
}
|
||||
|
||||
void PipeChannel::SetSIGPIPEDelivery(bool deliver_sigpipe)
|
||||
{
|
||||
ScopedLockSignal lock(&pipelock);
|
||||
ScopedLock lock(&pipelock);
|
||||
is_sigpipe_enabled = deliver_sigpipe;
|
||||
}
|
||||
|
||||
size_t PipeChannel::ReadSize()
|
||||
{
|
||||
ScopedLockSignal lock(&pipelock);
|
||||
ScopedLock lock(&pipelock);
|
||||
return pretended_read_buffer_size;
|
||||
}
|
||||
|
||||
size_t PipeChannel::WriteSize()
|
||||
{
|
||||
ScopedLockSignal lock(&pipelock);
|
||||
ScopedLock lock(&pipelock);
|
||||
return buffersize;
|
||||
}
|
||||
|
||||
bool PipeChannel::ReadResize(size_t new_size)
|
||||
{
|
||||
ScopedLockSignal lock(&pipelock);
|
||||
ScopedLock lock(&pipelock);
|
||||
if ( !new_size )
|
||||
return errno = EINVAL, false;
|
||||
// The read and write end share the same buffer, so let the write end decide
|
||||
|
@ -490,7 +490,7 @@ bool PipeChannel::ReadResize(size_t new_size)
|
|||
|
||||
bool PipeChannel::WriteResize(size_t new_size)
|
||||
{
|
||||
ScopedLockSignal lock(&pipelock);
|
||||
ScopedLock lock(&pipelock);
|
||||
if ( !new_size )
|
||||
return errno = EINVAL, false;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, 2016 Jonas 'Sortie' Termansen.
|
||||
* Copyright (c) 2015, 2016, 2021 Jonas 'Sortie' Termansen.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2013, 2014, 2015, 2016 Jonas 'Sortie' Termansen.
|
||||
* Copyright (c) 2012, 2013, 2014, 2015, 2016, 2021 Jonas 'Sortie' Termansen.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -648,6 +648,8 @@ ssize_t TTY::read(ioctx_t* ctx, uint8_t* userbuf, size_t count)
|
|||
ssize_t TTY::write(ioctx_t* ctx, const uint8_t* io_buffer, size_t count)
|
||||
{
|
||||
ScopedLockSignal lock(&termlock);
|
||||
if ( !lock.IsAcquired() )
|
||||
return errno = EINTR, -1;
|
||||
if ( hungup )
|
||||
return errno = EIO, -1;
|
||||
if ( tio.c_lflag & TOSTOP && !RequireForeground(SIGTTOU) )
|
||||
|
@ -726,7 +728,7 @@ short TTY::PollEventStatus()
|
|||
|
||||
int TTY::poll(ioctx_t* /*ctx*/, PollNode* node)
|
||||
{
|
||||
ScopedLockSignal lock(&termlock);
|
||||
ScopedLock lock(&termlock);
|
||||
short ret_status = PollEventStatus() & node->events;
|
||||
if ( ret_status )
|
||||
{
|
||||
|
@ -739,7 +741,7 @@ int TTY::poll(ioctx_t* /*ctx*/, PollNode* node)
|
|||
|
||||
int TTY::tcdrain(ioctx_t* /*ctx*/)
|
||||
{
|
||||
ScopedLockSignal lock(&termlock);
|
||||
ScopedLock lock(&termlock);
|
||||
if ( hungup )
|
||||
return errno = EIO, -1;
|
||||
if ( !RequireForeground(SIGTTOU) )
|
||||
|
@ -749,7 +751,7 @@ int TTY::tcdrain(ioctx_t* /*ctx*/)
|
|||
|
||||
int TTY::tcflow(ioctx_t* /*ctx*/, int action)
|
||||
{
|
||||
ScopedLockSignal lock(&termlock);
|
||||
ScopedLock lock(&termlock);
|
||||
if ( !RequireForeground(SIGTTOU) )
|
||||
return -1;
|
||||
switch ( action )
|
||||
|
@ -767,7 +769,7 @@ int TTY::tcflush(ioctx_t* /*ctx*/, int queue_selector)
|
|||
{
|
||||
if ( queue_selector & ~TCIOFLUSH )
|
||||
return errno = EINVAL, -1;
|
||||
ScopedLockSignal lock(&termlock);
|
||||
ScopedLock lock(&termlock);
|
||||
if ( hungup )
|
||||
return errno = EIO, -1;
|
||||
if ( !RequireForeground(SIGTTOU) )
|
||||
|
@ -779,7 +781,7 @@ int TTY::tcflush(ioctx_t* /*ctx*/, int queue_selector)
|
|||
|
||||
int TTY::tcgetattr(ioctx_t* ctx, struct termios* io_tio)
|
||||
{
|
||||
ScopedLockSignal lock(&termlock);
|
||||
ScopedLock lock(&termlock);
|
||||
if ( hungup )
|
||||
return errno = EIO, -1;
|
||||
if ( !ctx->copy_to_dest(io_tio, &tio, sizeof(tio)) )
|
||||
|
@ -789,7 +791,7 @@ int TTY::tcgetattr(ioctx_t* ctx, struct termios* io_tio)
|
|||
|
||||
pid_t TTY::tcgetsid(ioctx_t* /*ctx*/)
|
||||
{
|
||||
ScopedLockSignal lock(&termlock);
|
||||
ScopedLock lock(&termlock);
|
||||
if ( hungup )
|
||||
return errno = EIO, -1;
|
||||
return sid;
|
||||
|
@ -797,7 +799,7 @@ pid_t TTY::tcgetsid(ioctx_t* /*ctx*/)
|
|||
|
||||
int TTY::tcsendbreak(ioctx_t* /*ctx*/, int /*duration*/)
|
||||
{
|
||||
ScopedLockSignal lock(&termlock);
|
||||
ScopedLock lock(&termlock);
|
||||
if ( hungup )
|
||||
return errno = EIO, -1;
|
||||
if ( !RequireForeground(SIGTTOU) )
|
||||
|
@ -807,7 +809,7 @@ int TTY::tcsendbreak(ioctx_t* /*ctx*/, int /*duration*/)
|
|||
|
||||
int TTY::tcsetattr(ioctx_t* ctx, int actions, const struct termios* io_tio)
|
||||
{
|
||||
ScopedLockSignal lock(&termlock);
|
||||
ScopedLock lock(&termlock);
|
||||
if ( hungup )
|
||||
return errno = EIO, -1;
|
||||
if ( !RequireForeground(SIGTTOU) )
|
||||
|
@ -834,7 +836,7 @@ int TTY::tcsetattr(ioctx_t* ctx, int actions, const struct termios* io_tio)
|
|||
|
||||
int TTY::ioctl(ioctx_t* ctx, int cmd, uintptr_t arg)
|
||||
{
|
||||
ScopedLockSignal lock(&termlock);
|
||||
ScopedLock lock(&termlock);
|
||||
if ( hungup )
|
||||
return errno = EIO, -1;
|
||||
if ( cmd == TIOCSCTTY )
|
||||
|
|
Loading…
Reference in New Issue