summaryrefslogtreecommitdiff
path: root/lib/thread/fsbase+linux.myr
diff options
context:
space:
mode:
Diffstat (limited to 'lib/thread/fsbase+linux.myr')
-rw-r--r--lib/thread/fsbase+linux.myr28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/thread/fsbase+linux.myr b/lib/thread/fsbase+linux.myr
new file mode 100644
index 0000000..1641a64
--- /dev/null
+++ b/lib/thread/fsbase+linux.myr
@@ -0,0 +1,28 @@
+use std
+use sys
+
+use "types"
+
+pkg thread =
+ pkglocal const setfsbase : (h : tlshdr# -> void)
+ pkglocal const getfsbase : (-> tlshdr#)
+;;
+
+const setfsbase = {h
+ match sys.arch_prctl(sys.Archsetfs, (h : void#))
+ | 0:
+ | err:
+ std.fput(std.Err, "error: arch_prctl returned {}\n", err)
+ std.suicide()
+ ;;
+}
+
+const getfsbase = {
+ var h : tlshdr#
+ match sys.arch_prctl(sys.Archgetfs, (&h : void#))
+ | 0: -> h
+ | err:
+ std.fput(std.Err, "error: arch_prctl returned {}\n", err)
+ std.suicide()
+ ;;
+}