From 2dcef83b5fce615cc486ab10692a6925cba037ca Mon Sep 17 00:00:00 2001
From: Vladimir Kurchatkin <vladimir.kurchatkin@gmail.com>
Date: Fri, 5 Jun 2015 10:37:11 +0300
Subject: [PATCH] fs: use `kMaxLength` from binding

This allows `graceful-fs` to evaluate `fs` source
without access to internals.

This is a temporary workaround that makes npm work.

See: https://github.com/isaacs/node-graceful-fs/issues/41
Fixes: https://github.com/nodejs/io.js/issues/1898
PR-URL: https://github.com/nodejs/io.js/pull/1903
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
---
 lib/fs.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/fs.js b/lib/fs.js
index 72251d0b7537f4..08b101625faf53 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -19,7 +19,7 @@ const Readable = Stream.Readable;
 const Writable = Stream.Writable;
 
 const kMinPoolSpace = 128;
-const kMaxLength = require('internal/smalloc').kMaxLength;
+const kMaxLength = process.binding('smalloc').kMaxLength;
 
 const O_APPEND = constants.O_APPEND || 0;
 const O_CREAT = constants.O_CREAT || 0;