Skip to content

Commit

Permalink
ipc: expose socket spinlock
Browse files Browse the repository at this point in the history
  • Loading branch information
jewelcodes committed Sep 7, 2024
1 parent aa87cf0 commit 701f8d0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/include/kernel/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 18 additions & 0 deletions src/ipc/sockinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 701f8d0

Please sign in to comment.