Skip to content

Commit

Permalink
Assignment 8: Bug rmmod: ERROR: Module is in use
Browse files Browse the repository at this point in the history
  • Loading branch information
mukesh2006 committed Jan 15, 2025
1 parent a7e2c13 commit 1d39015
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions aesd-char-driver/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

#adding default rule
all: modules

modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules

Expand Down
7 changes: 4 additions & 3 deletions server/aesdsocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ int main(int argc, char* argv[])
setup_print_time_thread(10);

// h. Restarts accepting connections from new clients forever in a loop until SIGINT or SIGTERM is received
syslog(LOG_DEBUG,"Entering While (true)\n");
printf("Entering While (true)\n");
syslog(LOG_DEBUG,"Entering While (true) Now\n");
printf("Entering While (true) Now\n");

while(true)
{
Expand Down Expand Up @@ -244,7 +244,7 @@ void* connection_handler_thread_fxn(void* thread_parameter)
int number_of_bytes_sent = 0;
int number_of_bytes_read = 0;


printf("\nconnection_handler_thread_fxn: number_of_bytes_read = recv(thread_func_args->client_fd, read_buffer, RECEIVE_PACKET_SIZE, 0)) > 0 \n");
while((number_of_bytes_read = recv(thread_func_args->client_fd, read_buffer, RECEIVE_PACKET_SIZE, 0)) > 0)
{
printf("\nconnection_handler_thread_fxn: received_data_file_fd = fopen(RECEIVE_DATA_FILE) \n");
Expand All @@ -262,6 +262,7 @@ void* connection_handler_thread_fxn(void* thread_parameter)
}
}
// f. Returns the full content of /var/tmp/aesdsocketdata to the client as soon as the received data packet completes.
received_data_file_fd = fopen(RECEIVE_DATA_FILE, "w+");
lseek(fileno(received_data_file_fd), 0, SEEK_SET);
while((number_of_bytes_sent = read(fileno(received_data_file_fd), read_buffer, RECEIVE_PACKET_SIZE)) > 0)
{
Expand Down

0 comments on commit 1d39015

Please sign in to comment.