mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-25 07:49:18 +00:00
Simplify issig().
We always call it twice with JUSTLOOKING and then FORREAL. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net> Closes #16225
This commit is contained in:
parent
6b95031f56
commit
01c8efdd59
@ -39,20 +39,14 @@
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/debug.h>
|
||||
|
||||
#define FORREAL 0
|
||||
#define JUSTLOOKING 1
|
||||
|
||||
static __inline int
|
||||
issig(int why)
|
||||
issig(void)
|
||||
{
|
||||
struct thread *td = curthread;
|
||||
struct proc *p;
|
||||
int sig;
|
||||
|
||||
ASSERT(why == FORREAL || why == JUSTLOOKING);
|
||||
if (SIGPENDING(td)) {
|
||||
if (why == JUSTLOOKING)
|
||||
return (1);
|
||||
p = td->td_proc;
|
||||
PROC_LOCK(p);
|
||||
mtx_lock(&p->p_sigacts->ps_mtx);
|
||||
|
@ -30,9 +30,6 @@
|
||||
#include <linux/sched/signal.h>
|
||||
#endif
|
||||
|
||||
#define FORREAL 0 /* Usual side-effects */
|
||||
#define JUSTLOOKING 1 /* Don't stop the process */
|
||||
|
||||
extern int issig(int why);
|
||||
extern int issig(void);
|
||||
|
||||
#endif /* SPL_SIGNAL_H */
|
||||
|
@ -249,8 +249,7 @@ extern struct proc p0;
|
||||
extern kthread_t *zk_thread_create(const char *name, void (*func)(void *),
|
||||
void *arg, size_t stksize, int state);
|
||||
|
||||
#define issig(why) (FALSE)
|
||||
#define ISSIG(thr, why) (FALSE)
|
||||
#define issig() (FALSE)
|
||||
|
||||
#define KPREEMPT_SYNC (-1)
|
||||
|
||||
|
@ -152,26 +152,16 @@ spl_kthread_create(int (*func)(void *), void *data, const char namefmt[], ...)
|
||||
EXPORT_SYMBOL(spl_kthread_create);
|
||||
|
||||
/*
|
||||
* The "why" argument indicates the allowable side-effects of the call:
|
||||
*
|
||||
* FORREAL: Extract the next pending signal from p_sig into p_cursig;
|
||||
* stop the process if a stop has been requested or if a traced signal
|
||||
* is pending.
|
||||
*
|
||||
* JUSTLOOKING: Don't stop the process, just indicate whether or not
|
||||
* a signal might be pending (FORREAL is needed to tell for sure).
|
||||
* Extract the next pending signal from p_sig into p_cursig; stop the process
|
||||
* if a stop has been requested or if a traced signal is pending.
|
||||
*/
|
||||
int
|
||||
issig(int why)
|
||||
issig(void)
|
||||
{
|
||||
ASSERT(why == FORREAL || why == JUSTLOOKING);
|
||||
|
||||
if (!signal_pending(current))
|
||||
return (0);
|
||||
|
||||
if (why != FORREAL)
|
||||
return (1);
|
||||
|
||||
struct task_struct *task = current;
|
||||
spl_kernel_siginfo_t __info;
|
||||
sigset_t set;
|
||||
|
@ -116,7 +116,7 @@ diff_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
|
||||
dmu_diffarg_t *da = arg;
|
||||
int err = 0;
|
||||
|
||||
if (issig(JUSTLOOKING) && issig(FORREAL))
|
||||
if (issig())
|
||||
return (SET_ERROR(EINTR));
|
||||
|
||||
if (zb->zb_level == ZB_DNODE_LEVEL ||
|
||||
|
@ -2437,7 +2437,7 @@ dmu_objset_space_upgrade(objset_t *os)
|
||||
if (err != 0)
|
||||
return (err);
|
||||
|
||||
if (issig(JUSTLOOKING) && issig(FORREAL))
|
||||
if (issig())
|
||||
return (SET_ERROR(EINTR));
|
||||
|
||||
objerr = dmu_bonus_hold(os, obj, FTAG, &db);
|
||||
|
@ -3389,7 +3389,7 @@ dmu_recv_stream(dmu_recv_cookie_t *drc, offset_t *voffp)
|
||||
* stream, then we free drc->drc_rrd and exit.
|
||||
*/
|
||||
while (rwa->err == 0) {
|
||||
if (issig(JUSTLOOKING) && issig(FORREAL)) {
|
||||
if (issig()) {
|
||||
err = SET_ERROR(EINTR);
|
||||
break;
|
||||
}
|
||||
|
@ -912,7 +912,7 @@ perform_redaction(objset_t *os, redaction_list_t *rl,
|
||||
object = prev_obj;
|
||||
}
|
||||
while (err == 0 && object <= rec->end_object) {
|
||||
if (issig(JUSTLOOKING) && issig(FORREAL)) {
|
||||
if (issig()) {
|
||||
err = EINTR;
|
||||
break;
|
||||
}
|
||||
|
@ -2552,7 +2552,7 @@ dmu_send_impl(struct dmu_send_params *dspp)
|
||||
while (err == 0 && !range->eos_marker) {
|
||||
err = do_dump(&dsc, range);
|
||||
range = get_next_range(&srt_arg->q, range);
|
||||
if (issig(JUSTLOOKING) && issig(FORREAL))
|
||||
if (issig())
|
||||
err = SET_ERROR(EINTR);
|
||||
}
|
||||
|
||||
|
@ -780,8 +780,7 @@ zcp_lua_counthook(lua_State *state, lua_Debug *ar)
|
||||
* Check if we were canceled while waiting for the
|
||||
* txg to sync or from our open context thread
|
||||
*/
|
||||
if (ri->zri_canceled ||
|
||||
(!ri->zri_sync && issig(JUSTLOOKING) && issig(FORREAL))) {
|
||||
if (ri->zri_canceled || (!ri->zri_sync && issig())) {
|
||||
ri->zri_canceled = B_TRUE;
|
||||
(void) lua_pushstring(state, "Channel program was canceled.");
|
||||
(void) lua_error(state);
|
||||
|
@ -2336,7 +2336,7 @@ zfs_ioc_snapshot_list_next(zfs_cmd_t *zc)
|
||||
}
|
||||
|
||||
while (error == 0) {
|
||||
if (issig(JUSTLOOKING) && issig(FORREAL)) {
|
||||
if (issig()) {
|
||||
error = SET_ERROR(EINTR);
|
||||
break;
|
||||
}
|
||||
|
@ -1413,7 +1413,7 @@ zfs_clone_range(znode_t *inzp, uint64_t *inoffp, znode_t *outzp,
|
||||
len -= size;
|
||||
done += size;
|
||||
|
||||
if (issig(JUSTLOOKING) && issig(FORREAL)) {
|
||||
if (issig()) {
|
||||
error = SET_ERROR(EINTR);
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user