diff options
| author | ishaan <contact@ishaan.cc> | 2026-07-13 11:09:34 +0530 |
|---|---|---|
| committer | ishaan <contact@ishaan.cc> | 2026-07-13 11:09:34 +0530 |
| commit | d433b1af731ff901b9c14a647678471b27fdfe8a (patch) | |
| tree | b101b59e89d826386de8bbada4c405a3cfbf6b3f /internal/crypt/mem.go | |
| parent | 388971e7a86be97f6a7412cd1d526016bc4e14ce (diff) | |
better
Diffstat (limited to 'internal/crypt/mem.go')
| -rw-r--r-- | internal/crypt/mem.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/crypt/mem.go b/internal/crypt/mem.go new file mode 100644 index 0000000..9c1d21c --- /dev/null +++ b/internal/crypt/mem.go @@ -0,0 +1,16 @@ +package crypt + +import ( + "fmt" + "os" + "syscall" +) + +func TryMlock(b []byte) { + if len(b) == 0 { + return + } + if err := syscall.Mlock(b); err != nil { + fmt.Fprintf(os.Stderr, "mlock warning: %v\n", err) + } +} |