summaryrefslogtreecommitdiff
path: root/syscall.c
diff options
context:
space:
mode:
authorkaashoek <kaashoek>2006-08-14 14:13:52 +0000
committerkaashoek <kaashoek>2006-08-14 14:13:52 +0000
commitbdb66433031ca96f2fd127995186623cd10c45b3 (patch)
tree037ffd2021f27718fba32c27cacd9ca52682b613 /syscall.c
parentd15f0d1033a7da6448966d9626ec2776781e4188 (diff)
downloadxv6-labs-bdb66433031ca96f2fd127995186623cd10c45b3.tar.gz
xv6-labs-bdb66433031ca96f2fd127995186623cd10c45b3.tar.bz2
xv6-labs-bdb66433031ca96f2fd127995186623cd10c45b3.zip
set size for directories correctly in wdir and mkfs
mkdir ls shows stat info for each dir entry
Diffstat (limited to 'syscall.c')
-rw-r--r--syscall.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/syscall.c b/syscall.c
index 0ef2670..0a017c7 100644
--- a/syscall.c
+++ b/syscall.c
@@ -294,8 +294,10 @@ sys_mkdir(void)
{
struct proc *cp = curproc[cpu()];
struct inode *nip;
+ struct inode *pip;
uint arg0;
int l;
+ struct dirent de;
if(fetcharg(0, &arg0) < 0)
return -1;
@@ -308,7 +310,15 @@ sys_mkdir(void)
nip = mknod (cp->mem + arg0, T_DIR, 0, 0);
- // XXX put . and .. in
+ de.name[0] = '.';
+ de.inum = nip->inum;
+ writei (nip, (char *) &de, 0, sizeof(de));
+
+ pip = namei(".", NAMEI_LOOKUP, 0);
+ de.inum = pip->inum;
+ de.name[1] = '.';
+ iput(pip);
+ writei (nip, (char *) &de, sizeof(de), sizeof(de));
iput(nip);
return (nip == 0) ? -1 : 0;