2024-01-16 11:17:59 -08:00
|
|
|
load("//pkg/sync/locking:locking.bzl", "declare_mutex")
|
2020-01-27 10:04:07 -08:00
|
|
|
load("//tools:defs.bzl", "go_library", "go_test")
|
2018-04-27 10:37:02 -07:00
|
|
|
load("//tools/go_generics:defs.bzl", "go_template_instance")
|
|
|
|
|
|
2023-03-02 10:46:34 -08:00
|
|
|
package(
|
|
|
|
|
default_applicable_licenses = ["//:license"],
|
|
|
|
|
licenses = ["notice"],
|
|
|
|
|
)
|
2019-10-16 16:27:55 -07:00
|
|
|
|
2022-11-28 17:49:29 -08:00
|
|
|
declare_mutex(
|
2022-05-19 18:27:34 -07:00
|
|
|
name = "futex_mutex",
|
|
|
|
|
out = "futex_mutex.go",
|
2022-11-28 17:49:29 -08:00
|
|
|
nested_lock_names = [
|
|
|
|
|
"b",
|
|
|
|
|
],
|
2022-05-19 18:27:34 -07:00
|
|
|
package = "futex",
|
|
|
|
|
prefix = "futexBucket",
|
|
|
|
|
)
|
|
|
|
|
|
2018-10-08 10:19:27 -07:00
|
|
|
go_template_instance(
|
|
|
|
|
name = "atomicptr_bucket",
|
2019-07-09 16:42:54 -07:00
|
|
|
out = "atomicptr_bucket_unsafe.go",
|
2018-10-08 10:19:27 -07:00
|
|
|
package = "futex",
|
|
|
|
|
suffix = "Bucket",
|
2021-06-01 17:45:10 -07:00
|
|
|
template = "//pkg/sync/atomicptr:generic_atomicptr",
|
2018-10-08 10:19:27 -07:00
|
|
|
types = {
|
|
|
|
|
"Value": "bucket",
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
|
2018-04-27 10:37:02 -07:00
|
|
|
go_template_instance(
|
|
|
|
|
name = "waiter_list",
|
|
|
|
|
out = "waiter_list.go",
|
|
|
|
|
package = "futex",
|
|
|
|
|
prefix = "waiter",
|
|
|
|
|
template = "//pkg/ilist:generic_list",
|
|
|
|
|
types = {
|
2018-09-04 09:18:00 -07:00
|
|
|
"Element": "*Waiter",
|
2018-04-27 10:37:02 -07:00
|
|
|
"Linker": "*Waiter",
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
|
2018-08-01 19:56:12 -07:00
|
|
|
go_library(
|
|
|
|
|
name = "futex",
|
|
|
|
|
srcs = [
|
2019-07-09 16:42:54 -07:00
|
|
|
"atomicptr_bucket_unsafe.go",
|
2018-08-01 19:56:12 -07:00
|
|
|
"futex.go",
|
2022-05-19 18:27:34 -07:00
|
|
|
"futex_mutex.go",
|
2018-08-01 19:56:12 -07:00
|
|
|
"waiter_list.go",
|
|
|
|
|
],
|
2018-04-27 10:37:02 -07:00
|
|
|
visibility = ["//pkg/sentry:internal"],
|
2018-10-08 10:19:27 -07:00
|
|
|
deps = [
|
2018-11-16 12:16:37 -08:00
|
|
|
"//pkg/abi/linux",
|
2020-01-27 15:17:58 -08:00
|
|
|
"//pkg/context",
|
2021-06-29 15:05:27 -07:00
|
|
|
"//pkg/errors/linuxerr",
|
2021-03-29 13:28:32 -07:00
|
|
|
"//pkg/hostarch",
|
2019-03-05 23:39:14 -08:00
|
|
|
"//pkg/log",
|
2018-10-08 10:19:27 -07:00
|
|
|
"//pkg/sentry/memmap",
|
2020-01-09 22:00:42 -08:00
|
|
|
"//pkg/sync",
|
2022-05-19 18:27:34 -07:00
|
|
|
"//pkg/sync/locking",
|
2020-01-27 15:17:58 -08:00
|
|
|
"//pkg/usermem",
|
2018-10-08 10:19:27 -07:00
|
|
|
],
|
2018-04-27 10:37:02 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
go_test(
|
|
|
|
|
name = "futex_test",
|
|
|
|
|
size = "small",
|
|
|
|
|
srcs = ["futex_test.go"],
|
2020-01-27 10:04:07 -08:00
|
|
|
library = ":futex",
|
2020-01-09 22:00:42 -08:00
|
|
|
deps = [
|
2022-04-21 18:29:35 -07:00
|
|
|
"//pkg/atomicbitops",
|
2020-08-03 13:33:47 -07:00
|
|
|
"//pkg/context",
|
2021-06-30 08:15:44 -07:00
|
|
|
"//pkg/errors/linuxerr",
|
2021-03-29 13:28:32 -07:00
|
|
|
"//pkg/hostarch",
|
2020-01-09 22:00:42 -08:00
|
|
|
"//pkg/sync",
|
|
|
|
|
],
|
2018-04-27 10:37:02 -07:00
|
|
|
)
|