]> git.corax.cc Git - corax/commitdiff
Add dummy soshutdown() function and call it from sys_shutdown()
authorMatthias Kruk <m@m10k.eu>
Sat, 5 Oct 2019 07:13:21 +0000 (16:13 +0900)
committerMatthias Kruk <m@m10k.eu>
Sat, 5 Oct 2019 07:13:21 +0000 (16:13 +0900)
kernel/core/cxnet.c
kernel/core/socket.c
kernel/core/socket.h

index 364996b2bddb63d989e723373ff803ebeb9d3837..2d0be44b6b13fd4af517222ec14bcb62c0ad1423 100644 (file)
@@ -21,7 +21,10 @@ int sys_socket(int domain, int type, int protocol)
         * to do here.
         */
        ret_val = socreate(domain, type, protocol);
+
+#if FEATURE(DEBUG_NET)
        dbg_printf("socreate(0x%08x, 0x%08x, 0x%08x) = 0x%08x\n", domain, type, protocol, ret_val);
+#endif /* FEATURE(DEBUG_NET) */
 
        return(ret_val);
 }
@@ -48,7 +51,10 @@ int sys_close(int procfd)
                 * going to return to the caller.
                 */
                if(ret_val >= 0) {
+#if FEATURE(DEBUG_NET)
                        dbg_printf("soclose(0x%08x)\n", ret_val);
+#endif /* FEATURE(DEBUG_NET) */
+
                        ret_val = soclose(ret_val);
                }
        }
@@ -176,9 +182,25 @@ gtfo:
        return(ret_val);
 }
 
-int sys_shutdown(int sockfd, int how)
+int sys_shutdown(int procfd, int how)
 {
-       return(-ENOSYS);
+       process_t *cproc;
+       int ret_val;
+
+       ret_val = -EFAULT;
+       cproc = process_get_current();
+
+       if(cproc) {
+               /* attempt to look up the system-wide sockfd for this procfd */
+               ret_val = process_flookup(cproc, procfd);
+
+               /* pass on the arguments to soshutdown(), if the lookup was successful */
+               if(!ret_val) {
+                       ret_val = soshutdown(ret_val, how);
+               }
+       }
+
+       return(ret_val);
 }
 
 int sys_select(int nfds, fd_set *readfds, fd_set *writefds,
index 35157ea512996b3d731c24486fb2c09236e6f41e..bde7f1d98bbdc2582090880b446ee6448880c63e 100644 (file)
@@ -283,3 +283,8 @@ int sogetopt(int sockfd, int opt, void *data, size_t *dlen)
 {
        return(-ENOSYS);
 }
+
+int soshutdown(int sockfd, int how)
+{
+       return(-ENOSYS);
+}
index fb681469f565d5392cdf55f882be00e67080226c..e06a8c402bceb30b9c48cdbf51e7dfa594cb9dc9 100644 (file)
@@ -26,5 +26,6 @@ int sofree(int);
 
 int sosetopt(int, int, const void*, size_t);
 int sogetopt(int, int, void*, size_t*);
+int soshutdown(int, int);
 
 #endif /* __SOCKET_H */