mirror of
https://codeberg.org/TicklishHoneyBee/CLIte.git
synced 2026-03-11 09:04:37 +00:00
the system is now multi-user
This commit is contained in:
parent
f2be72edc1
commit
abc7e6c4a5
5 changed files with 323 additions and 246 deletions
|
|
@ -102,7 +102,12 @@ Options:
|
|||
return;
|
||||
}
|
||||
var st = stdio.fstat(fd);
|
||||
if (!st || st.type != stdio.types.FT_DIR) {
|
||||
if (!st) {
|
||||
stdio.write(io.stderr,'cannot read file: '+dir);
|
||||
stdio.close(fd);
|
||||
return;
|
||||
}
|
||||
if (st.type != stdio.types.FT_DIR) {
|
||||
writeNodeData(st,fd);
|
||||
stdio.close(fd);
|
||||
return;
|
||||
|
|
@ -690,7 +695,9 @@ Options:
|
|||
if (window.location.protocol == 'file:')
|
||||
clite.commands.load('test',function(args,env,io) {
|
||||
var stdio = io.include('stdio');
|
||||
var stdlib = io.include('stdlib');
|
||||
stdio.printf('Hello world');
|
||||
stdio.printf('uid:'+stdlib.getuid());
|
||||
function rcb(data) {
|
||||
stdio.printf(data);
|
||||
io.exit(0);
|
||||
|
|
|
|||
515
clite/core.js
515
clite/core.js
File diff suppressed because it is too large
Load diff
|
|
@ -8,7 +8,6 @@ return Object.create({
|
|||
resolvePath:function(txt,base) {
|
||||
if (txt == '/')
|
||||
return txt;
|
||||
var env = clite.user.getEnv();
|
||||
if (txt[0] == '~') {
|
||||
txt = env.HOME+txt.substring(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,12 +45,12 @@ return Object.create({
|
|||
|
||||
// returns the current user id
|
||||
getuid:function() {
|
||||
return clite.user.getUID();
|
||||
return clite.proc.getUID(io.pid);
|
||||
},
|
||||
|
||||
// returns the current group id
|
||||
getgid:function() {
|
||||
return clite.user.getGID();
|
||||
return clite.proc.getGID(io.pid);
|
||||
},
|
||||
|
||||
// wait for any child process to exit
|
||||
|
|
|
|||
|
|
@ -7,85 +7,85 @@ return Object.create({
|
|||
types:clite.io.types,
|
||||
|
||||
creat:function(path,type) {
|
||||
return clite.io.creat(path,type);
|
||||
return clite.io.creat(io.pid,path,type);
|
||||
},
|
||||
|
||||
open:function(path,cb,open_link) {
|
||||
return clite.io.open(path,cb,open_link);
|
||||
return clite.io.open(io.pid,path,cb,open_link);
|
||||
},
|
||||
|
||||
close:function(fd) {
|
||||
return clite.io.close(fd);
|
||||
return clite.io.close(io.pid,fd);
|
||||
},
|
||||
|
||||
read:function(fd,cb) {
|
||||
return clite.io.read(fd,cb);
|
||||
return clite.io.read(io.pid,fd,cb);
|
||||
},
|
||||
|
||||
readLine:function(fd,cb) {
|
||||
return clite.io.readLine(fd,cb);
|
||||
return clite.io.readLine(io.pid,fd,cb);
|
||||
},
|
||||
|
||||
readAll:function(fd) {
|
||||
return clite.io.readAll(fd);
|
||||
return clite.io.readAll(io.pid,fd);
|
||||
},
|
||||
|
||||
write:function(fd,data) {
|
||||
return clite.io.write(fd,data);
|
||||
return clite.io.write(io.pid,fd,data);
|
||||
},
|
||||
|
||||
ftruncate:function(fd,len) {
|
||||
return clite.io.ftruncate(fd,len);
|
||||
return clite.io.ftruncate(io.pid,fd,len);
|
||||
},
|
||||
|
||||
truncate:function(path,len) {
|
||||
return clite.io.truncate(path,len);
|
||||
return clite.io.truncate(io.pid,path,len);
|
||||
},
|
||||
|
||||
seek:function(fd,pos) {
|
||||
return clite.io.seek(fd,pos);
|
||||
return clite.io.seek(io.pid,fd,pos);
|
||||
},
|
||||
|
||||
remove:function(path) {
|
||||
return clite.io.remove(path);
|
||||
return clite.io.remove(io.pid,path);
|
||||
},
|
||||
|
||||
link:function(path,target) {
|
||||
return clite.io.link(path,target);
|
||||
return clite.io.link(io.pid,path,target);
|
||||
},
|
||||
|
||||
stat:function(path) {
|
||||
return clite.io.stat(path);
|
||||
return clite.io.stat(io.pid,path);
|
||||
},
|
||||
|
||||
fstat:function(fd) {
|
||||
return clite.io.fstat(fd);
|
||||
return clite.io.fstat(io.pid,fd);
|
||||
},
|
||||
|
||||
chmod:function(path,mode) {
|
||||
return clite.io.chmod(path,mode);
|
||||
return clite.io.chmod(io.pid,path,mode);
|
||||
},
|
||||
|
||||
fchmod:function(fd,mode) {
|
||||
return clite.io.fchmod(fd,mode);
|
||||
return clite.io.fchmod(io.pid,fd,mode);
|
||||
},
|
||||
|
||||
isatty:function(fd) {
|
||||
return clite.io.isatty(fd);
|
||||
return clite.io.isatty(io.pid,fd);
|
||||
},
|
||||
|
||||
vfprintf:function(fd,fmt,args) {
|
||||
return clite.io.vfprintf(fd,fmt,args);
|
||||
return clite.io.vfprintf(io.pid,fd,fmt,args);
|
||||
},
|
||||
|
||||
fprintf:function(fd,fmt) {
|
||||
var args = [];
|
||||
return clite.io.vfprintf(fd,fmt,args);
|
||||
return clite.io.vfprintf(io.pid,fd,fmt,args);
|
||||
},
|
||||
|
||||
printf:function(fmt) {
|
||||
var args = [];
|
||||
return clite.io.vfprintf(io.stdout,fmt,args);
|
||||
return clite.io.vfprintf(io.pid,io.stdout,fmt,args);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue