diff --git a/src/constants.js b/src/constants.js index 660810f..6c6a59e 100644 --- a/src/constants.js +++ b/src/constants.js @@ -68,6 +68,12 @@ define(function(require) { SUPER_NODE_ID: '00000000-0000-0000-0000-000000000000', + //Reserved FileDescriptors for streams + STDIN: 0, + STDOUT: 1, + STDERR: 2, + FIRST_DESCRIPTOR: 3, + ENVIRONMENT: { TMP: '/tmp', PATH: '' diff --git a/src/filesystem/interface.js b/src/filesystem/interface.js index 32e4053..cf8617d 100644 --- a/src/filesystem/interface.js +++ b/src/filesystem/interface.js @@ -19,6 +19,11 @@ define(function(require) { var FSWatcher = require('src/fs-watcher'); var Errors = require('src/errors'); + var STDIN = require('src/constants').STDIN; + var STDOUT = require('src/constants').STDOUT; + var STDERR = require('src/constants').STDERR; + var FD = require('src/constants').FIRST_DESCRIPTOR; + // The core fs operations live on impl var impl = require('src/filesystem/implementation'); @@ -74,10 +79,15 @@ define(function(require) { fs.name = name; fs.error = null; + fs.stdin = STDIN; + fs.stdout = STDOUT; + fs.stderr = STDERR; + fs.firstFD = FD; + // Safely expose the list of open files and file // descriptor management functions var openFiles = {}; - var nextDescriptor = 1; + var nextDescriptor = 3; Object.defineProperty(this, "openFiles", { get: function() { return openFiles; } });