summaryrefslogtreecommitdiff
path: root/syscall.c
diff options
context:
space:
mode:
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;