summaryrefslogtreecommitdiff
path: root/kernel/sysfile.c
diff options
context:
space:
mode:
authorMole Shang <[email protected]>2024-02-17 11:55:33 +0800
committerMole Shang <[email protected]>2024-02-17 12:22:07 +0800
commite8e0a7b4c97064eb5e9415726d7e38aaceccd3fd (patch)
treefb42ba5be7a8ae608b968266f62fd71fa889a89d /kernel/sysfile.c
parenta6af72924b115c1177d18d9b1eaba56623e4248b (diff)
parentd85aec2689c4250d0384904bdc11aa618c726bec (diff)
downloadxv6-labs-e8e0a7b4c97064eb5e9415726d7e38aaceccd3fd.tar.gz
xv6-labs-e8e0a7b4c97064eb5e9415726d7e38aaceccd3fd.tar.bz2
xv6-labs-e8e0a7b4c97064eb5e9415726d7e38aaceccd3fd.zip
Merge branch 'thread' into fs
Conflicts: .gitignore Makefile conf/lab.mk kernel/param.h
Diffstat (limited to 'kernel/sysfile.c')
-rw-r--r--kernel/sysfile.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/kernel/sysfile.c b/kernel/sysfile.c
index 16b668c..4b2189a 100644
--- a/kernel/sysfile.c
+++ b/kernel/sysfile.c
@@ -503,3 +503,29 @@ sys_pipe(void)
}
return 0;
}
+
+
+#ifdef LAB_NET
+int
+sys_connect(void)
+{
+ struct file *f;
+ int fd;
+ uint32 raddr;
+ uint32 rport;
+ uint32 lport;
+
+ argint(0, (int*)&raddr);
+ argint(1, (int*)&lport);
+ argint(2, (int*)&rport);
+
+ if(sockalloc(&f, raddr, lport, rport) < 0)
+ return -1;
+ if((fd=fdalloc(f)) < 0){
+ fileclose(f);
+ return -1;
+ }
+
+ return fd;
+}
+#endif