kernel: fix #0/brk/ qid (it's a special directory, not a special file)

This commit is contained in:
Giacomo Tesio 2017-01-09 00:44:01 +01:00
parent 01562d4ddb
commit 51d12f1f34
3 changed files with 5 additions and 3 deletions

View File

@ -23,7 +23,7 @@ main(void)
{
long b, b1;
b = create("#0/brk", -1, 16*1024*1024);
b = create("#0/brk/set", -1, 16*1024*1024);
if(b >= 0){
print("FAIL: create returned fd %d.\n", b);
exits("FAIL");

View File

@ -63,7 +63,7 @@ Cmdtab proccmd[] = {
static Dirtab selfdir[]={
".", {Qdir, 0, QTDIR}, 0, DMDIR|0777,
"brk", {Qbrk}, 0, 0,
"brk", {Qbrk, 0, QTDIR}, 0, DMDIR|0300,
"pid", {Qpid}, 0, 0400,
"ppid", {Qppid}, 0, 0400,
"pgrpid", {Qpgrpid}, 0, 0400,
@ -197,6 +197,8 @@ selfcreate(Chan* c, char* name, unsigned long omode, unsigned long perm)
default:
error(Eperm);
case Qbrk:
if(strcmp(name, "set") != 0)
error(Eperm);
e = (long)grow_bss(perm);
errorl(nil, ~e);
}

View File

@ -18,7 +18,7 @@ enum
Round = 7
};
#define brk_(p) ((uintptr_t)~create("#0/brk", -1, p))
#define brk_(p) ((uintptr_t)~create("#0/brk/set", -1, p))
int
brk(void *p)