diff --git a/src/include/kernel/socket.h b/src/include/kernel/socket.h index 60d4830..62412d7 100644 --- a/src/include/kernel/socket.h +++ b/src/include/kernel/socket.h @@ -58,6 +58,8 @@ typedef struct SocketDescriptor { void socketInit(); SocketDescriptor *getLocalSocket(const struct sockaddr *, socklen_t); +void socketLock(); +void socketRelease(); /* socket system calls */ int socket(Thread *, int, int, int); diff --git a/src/ipc/sockinit.c b/src/ipc/sockinit.c index a88889f..bb17f4e 100644 --- a/src/ipc/sockinit.c +++ b/src/ipc/sockinit.c @@ -59,6 +59,24 @@ SocketDescriptor *getLocalSocket(const struct sockaddr *addr, socklen_t len) { return NULL; } +/* socketLock(): acquires the socket descriptor spinlock + * params: none + * returns: nothing + */ + +void socketLock() { + acquireLockBlocking(&lock); +} + +/* socketRelease(): frees the socket descriptor spinlock + * params: none + * returns: nothing + */ + +void socketRelease() { + releaseLock(&lock); +} + /* socket(): opens a communication socket * params: t - calling thread, NULL for kernel threads * params: domain - socket domain/family