summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2025-07-03 19:31:24 -0500
committerJohn Estabrook <jestabro@vyos.io>2025-07-06 18:29:23 -0500
commit3be3209da87ad0902a77f1cda97c91a5033585e8 (patch)
tree37cdafef1b347ebadb3bbbb32719eb49dbd2498e /src
parent12dd62a1081a37d49bb663a39651f886115c0ca9 (diff)
downloadvyos1x-config-3be3209da87ad0902a77f1cda97c91a5033585e8.tar.gz
vyos1x-config-3be3209da87ad0902a77f1cda97c91a5033585e8.zip
T7499: remove internal locking
Read/write of internal cache always occurs under an external lock; remove internal lock.
Diffstat (limited to 'src')
-rw-r--r--src/internal.ml13
1 files changed, 0 insertions, 13 deletions
diff --git a/src/internal.ml b/src/internal.ml
index a57f3db..3951f92 100644
--- a/src/internal.ml
+++ b/src/internal.ml
@@ -21,17 +21,10 @@ module Make : FI = functor (M: T) -> struct
let yt = M.to_yojson x in
let ys = Yojson.Safe.to_string yt in
let fd = Unix.openfile file_name [Unix.O_CREAT;Unix.O_WRONLY] 0o664 in
- let () =
- try
- Unix.lockf fd Unix.F_TLOCK 0
- with _ ->
- Unix.close fd; raise (Write_error "write lock unavailable")
- in
let oc = Unix.out_channel_of_descr fd in
let () = Unix.ftruncate fd 0 in
let () = Printf.fprintf oc "%s" ys in
let () = Unix.fsync fd in
- let () = Unix.lockf fd Unix.F_ULOCK 0 in
close_out_noerr oc
let read_internal file_name =
@@ -43,12 +36,6 @@ module Make : FI = functor (M: T) -> struct
Printf.sprintf "%s %s: %s" (Unix.error_message e) f p
in raise (Read_error out)
in
- let () =
- try
- Unix.lockf fd Unix.F_TEST 0
- with _ ->
- Unix.close fd; raise (Read_error "read lock unavailable")
- in
let ic = Unix.in_channel_of_descr fd in
let ys = really_input_string ic (in_channel_length ic) in
let yt = Yojson.Safe.from_string ys in