summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2018-12-16 03:36:02 +0000
committerdlg <dlg@openbsd.org>2018-12-16 03:36:02 +0000
commitff4a31df00d60e7bdbdb7aa285f60033f5a00e26 (patch)
treea0c7893216ae746b0b705185b894525def1017f5
parentThe .HP macro was deprecated by groff, and that makes sense (diff)
downloadwireguard-openbsd-ff4a31df00d60e7bdbdb7aa285f60033f5a00e26.tar.xz
wireguard-openbsd-ff4a31df00d60e7bdbdb7aa285f60033f5a00e26.zip
add task_pending
jsg@ wants this for drm, and i've had a version of it in diffs sine 2016, but obviously havent needed to use it just yet. task_pending is modelled on timeout_pending, and tells you if the task is on a list waiting to execute. ok jsg@
-rw-r--r--sys/kern/kern_task.c4
-rw-r--r--sys/net/ifq.c4
-rw-r--r--sys/sys/task.h6
3 files changed, 7 insertions, 7 deletions
diff --git a/sys/kern/kern_task.c b/sys/kern/kern_task.c
index 5c4f15903f5..2839b64eccf 100644
--- a/sys/kern/kern_task.c
+++ b/sys/kern/kern_task.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_task.c,v 1.22 2017/12/14 00:45:16 dlg Exp $ */
+/* $OpenBSD: kern_task.c,v 1.23 2018/12/16 03:36:02 dlg Exp $ */
/*
* Copyright (c) 2013 David Gwynne <dlg@openbsd.org>
@@ -24,8 +24,6 @@
#include <sys/task.h>
#include <sys/proc.h>
-#define TASK_ONQUEUE 1
-
struct taskq {
enum {
TQ_S_CREATED,
diff --git a/sys/net/ifq.c b/sys/net/ifq.c
index 373707131f7..418f5f7c32b 100644
--- a/sys/net/ifq.c
+++ b/sys/net/ifq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifq.c,v 1.24 2018/12/11 01:36:42 dlg Exp $ */
+/* $OpenBSD: ifq.c,v 1.25 2018/12/16 03:36:02 dlg Exp $ */
/*
* Copyright (c) 2015 David Gwynne <dlg@openbsd.org>
@@ -71,8 +71,6 @@ void ifq_start_task(void *);
void ifq_restart_task(void *);
void ifq_barrier_task(void *);
-#define TASK_ONQUEUE 0x1
-
void
ifq_serialize(struct ifqueue *ifq, struct task *t)
{
diff --git a/sys/sys/task.h b/sys/sys/task.h
index f7385ca0cfd..ba98b64443b 100644
--- a/sys/sys/task.h
+++ b/sys/sys/task.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: task.h,v 1.12 2017/11/13 23:52:49 dlg Exp $ */
+/* $OpenBSD: task.h,v 1.13 2018/12/16 03:36:02 dlg Exp $ */
/*
* Copyright (c) 2013 David Gwynne <dlg@openbsd.org>
@@ -30,6 +30,8 @@ struct task {
unsigned int t_flags;
};
+#define TASK_ONQUEUE 1
+
TAILQ_HEAD(task_list, task);
#define TASKQ_MPSAFE (1 << 0)
@@ -49,6 +51,8 @@ void task_set(struct task *, void (*)(void *), void *);
int task_add(struct taskq *, struct task *);
int task_del(struct taskq *, struct task *);
+#define task_pending(_t) ((_t)->t_flags & TASK_ONQUEUE)
+
#endif /* _KERNEL */
#endif /* _SYS_TASK_H_ */