linuxkpi: Add down_read_killable()
Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36528 Sponsored by: Google, Inc. (GSoC 2022)
This commit is contained in:
parent
7cc3ea9c6f
commit
f0b0f28f35
@ -46,6 +46,7 @@ struct rw_semaphore {
|
||||
#define down_read(_rw) sx_slock(&(_rw)->sx)
|
||||
#define up_read(_rw) sx_sunlock(&(_rw)->sx)
|
||||
#define down_read_trylock(_rw) !!sx_try_slock(&(_rw)->sx)
|
||||
#define down_read_killable(_rw) linux_down_read_killable(_rw)
|
||||
#define down_write_trylock(_rw) !!sx_try_xlock(&(_rw)->sx)
|
||||
#define down_write_killable(_rw) linux_down_write_killable(_rw)
|
||||
#define downgrade_write(_rw) sx_downgrade(&(_rw)->sx)
|
||||
@ -80,6 +81,7 @@ linux_init_rwsem(struct rw_semaphore *rw, const char *name)
|
||||
sx_init_flags(&rw->sx, name, SX_NOWITNESS);
|
||||
}
|
||||
|
||||
extern int linux_down_read_killable(struct rw_semaphore *);
|
||||
extern int linux_down_write_killable(struct rw_semaphore *);
|
||||
|
||||
#endif /* _LINUXKPI_LINUX_RWSEM_H_ */
|
||||
|
@ -159,6 +159,19 @@ linux_mutex_lock_interruptible(mutex_t *m)
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
linux_down_read_killable(struct rw_semaphore *rw)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = -sx_slock_sig(&rw->sx);
|
||||
if (error != 0) {
|
||||
linux_schedule_save_interrupt_value(current, error);
|
||||
error = -EINTR;
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
linux_down_write_killable(struct rw_semaphore *rw)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user