aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Barksdale <amatus.amongus@gmail.com>2012-04-02 00:56:34 -0500
committerDavid Barksdale <amatus.amongus@gmail.com>2012-04-02 00:56:34 -0500
commit1eb8533cae8a93c71970c90dd66b1f6a5d75abe6 (patch)
tree97a757811be7393b0b90fd140346f1fefb048eca /src
parentdfd1e1ec6add75315e41a669f86c83b3222a3729 (diff)
Survive opendir handle exhaustion.
Diffstat (limited to 'src')
-rw-r--r--src/clojure/foofs/filesystem.clj21
-rw-r--r--src/clojure/foofs/fuse/jna.clj2
2 files changed, 15 insertions, 8 deletions
diff --git a/src/clojure/foofs/filesystem.clj b/src/clojure/foofs/filesystem.clj
index 13bf89a..7a94984 100644
--- a/src/clojure/foofs/filesystem.clj
+++ b/src/clojure/foofs/filesystem.clj
@@ -105,14 +105,19 @@
(range next-handle Long/MAX_VALUE)
(range Long/MIN_VALUE next-handle))))]
(.println *err* (str "got handle " handle))
- (send
- readdir-agent
- (fn [state]
- (continuation! {:handle handle
- :flags 0})
- state))
- {:opendirs (assoc opendirs handle [])
- :next-handle (inc handle)})))))))
+ (if (nil? handle)
+ (do
+ (continuation! errno-nomem)
+ state)
+ (do
+ (send
+ readdir-agent
+ (fn [state]
+ (continuation! {:handle handle
+ :flags 0})
+ state))
+ {:opendirs (assoc opendirs handle [])
+ :next-handle (inc handle)})))))))))
(readdir [this request continuation!]
(.println *err* (str "readdir " request))
(let [arg (:arg request)
diff --git a/src/clojure/foofs/fuse/jna.clj b/src/clojure/foofs/fuse/jna.clj
index ddf6abe..da58794 100644
--- a/src/clojure/foofs/fuse/jna.clj
+++ b/src/clojure/foofs/fuse/jna.clj
@@ -139,6 +139,7 @@
(when (Platform/isLinux)
(do
(def errno-noent 2)
+ (def errno-nomem 12)
(def errno-inval 22)
(def errno-nosys 38)
(def errno-proto 71)
@@ -158,6 +159,7 @@
(when (Platform/isFreeBSD)
(do
(def errno-noent 2)
+ (def errno-nomem 12)
(def errno-inval 22)
(def errno-nosys 78)
(def errno-proto 92)))