Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2/include/linux recursive locking is bad...
details: https://anonhg.NetBSD.org/src/rev/c7dfb3f5240e
branches: trunk
changeset: 1027956:c7dfb3f5240e
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 01:21:22 2021 +0000
description:
recursive locking is bad, do not use this ever.
diffstat:
sys/external/bsd/drm2/include/linux/mutex.h | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diffs (33 lines):
diff -r 06d36b045201 -r c7dfb3f5240e sys/external/bsd/drm2/include/linux/mutex.h
--- a/sys/external/bsd/drm2/include/linux/mutex.h Sun Dec 19 01:21:15 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/mutex.h Sun Dec 19 01:21:22 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mutex.h,v 1.15 2021/12/19 00:54:46 riastradh Exp $ */
+/* $NetBSD: mutex.h,v 1.16 2021/12/19 01:21:22 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -115,4 +115,23 @@
mutex_lock(mutex);
}
+/*
+ * `recursive locking is bad, do not use this ever.'
+ * -- linux/scripts/checkpath.pl
+ */
+static inline enum {
+ MUTEX_TRYLOCK_FAILED,
+ MUTEX_TRYLOCK_SUCCESS,
+ MUTEX_TRYLOCK_RECURSIVE,
+}
+mutex_trylock_recursive(struct mutex *mutex)
+{
+ if (mutex_owned(&mutex->mtx_lock))
+ return MUTEX_TRYLOCK_RECURSIVE;
+ else if (mutex_tryenter(&mutex->mtx_lock))
+ return MUTEX_TRYLOCK_SUCCESS;
+ else
+ return MUTEX_TRYLOCK_FAILED;
+}
+
#endif /* _LINUX_MUTEX_H_ */
Home |
Main Index |
Thread Index |
Old Index