diff --git a/regression/apps/execve/execve.c b/regression/apps/execve/execve.c index 92c79bd83..a79921573 100644 --- a/regression/apps/execve/execve.c +++ b/regression/apps/execve/execve.c @@ -15,4 +15,4 @@ int main() printf("Should not print\n"); fflush(stdout); return 0; -} \ No newline at end of file +} diff --git a/regression/apps/execve/hello.c b/regression/apps/execve/hello.c index 26b3180f4..7530f0a91 100644 --- a/regression/apps/execve/hello.c +++ b/regression/apps/execve/hello.c @@ -16,4 +16,4 @@ int main(int argc, char *argv[], char *envp[]) printf("%s\n", envp[i]); } return 0; -} \ No newline at end of file +} diff --git a/regression/apps/fork_c/fork.c b/regression/apps/fork_c/fork.c index fe474c4b8..a83d6bc2b 100644 --- a/regression/apps/fork_c/fork.c +++ b/regression/apps/fork_c/fork.c @@ -14,4 +14,4 @@ int main() } fflush(stdout); return 0; -} \ No newline at end of file +} diff --git a/regression/apps/hello_c/hello.c b/regression/apps/hello_c/hello.c index 98c7eddd4..c3ec64e05 100644 --- a/regression/apps/hello_c/hello.c +++ b/regression/apps/hello_c/hello.c @@ -6,4 +6,4 @@ int main() { printf("hello world from hello_c!\n"); return 0; -} \ No newline at end of file +} diff --git a/regression/apps/hello_pie/hello.c b/regression/apps/hello_pie/hello.c index 6ea9b3f80..2a49408a9 100644 --- a/regression/apps/hello_pie/hello.c +++ b/regression/apps/hello_pie/hello.c @@ -6,4 +6,4 @@ int main() { printf("hello world from hello_pie!\n"); return 0; -} \ No newline at end of file +} diff --git a/regression/apps/network/socketpair.c b/regression/apps/network/socketpair.c index bd2591b1a..fc43a610d 100644 --- a/regression/apps/network/socketpair.c +++ b/regression/apps/network/socketpair.c @@ -38,4 +38,4 @@ int main() close(sockets[0]); } return 0; -} \ No newline at end of file +} diff --git a/regression/apps/network/sockoption.c b/regression/apps/network/sockoption.c index bf5ea6a64..1219ebc14 100644 --- a/regression/apps/network/sockoption.c +++ b/regression/apps/network/sockoption.c @@ -76,4 +76,4 @@ int main() close(sockfd); return 0; -} \ No newline at end of file +} diff --git a/regression/apps/network/udp_client.c b/regression/apps/network/udp_client.c index 2570bceec..7ecc142a8 100644 --- a/regression/apps/network/udp_client.c +++ b/regression/apps/network/udp_client.c @@ -59,4 +59,4 @@ int main() // close socket close(sock_fd); return 0; -} \ No newline at end of file +} diff --git a/regression/apps/network/udp_server.c b/regression/apps/network/udp_server.c index 2898a3ab9..139863b84 100644 --- a/regression/apps/network/udp_server.c +++ b/regression/apps/network/udp_server.c @@ -63,8 +63,8 @@ int main() exit(EXIT_FAILURE); } - // 关闭socket + // Close socket close(sock_fd); return 0; -} \ No newline at end of file +} diff --git a/regression/apps/network/unix_client.c b/regression/apps/network/unix_client.c index 69fcb4fce..95810eaac 100644 --- a/regression/apps/network/unix_client.c +++ b/regression/apps/network/unix_client.c @@ -65,4 +65,4 @@ int main() close(client_fd); return 0; -} \ No newline at end of file +} diff --git a/regression/apps/network/unix_server.c b/regression/apps/network/unix_server.c index 19552b90f..2b8f40997 100644 --- a/regression/apps/network/unix_server.c +++ b/regression/apps/network/unix_server.c @@ -17,14 +17,14 @@ int main() struct sockaddr_un server_addr, client_addr; char buf[BUFFER_SIZE]; - // 创建Server Socket + // Create the server socket server_fd = socket(AF_UNIX, SOCK_STREAM, 0); if (server_fd == -1) { perror("socket"); exit(EXIT_FAILURE); } - // 绑定Socket地址 + // Bind the socket address memset(&server_addr, 0, sizeof(server_addr)); server_addr.sun_family = AF_UNIX; strncpy(server_addr.sun_path, SOCKET_NAME, @@ -36,7 +36,7 @@ int main() exit(EXIT_FAILURE); } - // 监听连接请求 + // Listen for an incoming connection if (listen(server_fd, 5) == -1) { perror("listen"); exit(EXIT_FAILURE); @@ -44,7 +44,7 @@ int main() printf("Server is listening...\n"); - // 接收连接请求 + // Accept the incoming connection len = sizeof(client_addr); accepted_fd = accept(server_fd, (struct sockaddr *)&client_addr, &len); if (accepted_fd == -1) { @@ -64,7 +64,8 @@ int main() printf("Server is connected to client\n"); char *mesg = "Hello from unix socket server"; write(accepted_fd, mesg, strlen(mesg)); - // 读取客户端发送的数据并打印 + + // Read data from the client memset(buf, 0, BUFFER_SIZE); if (read(accepted_fd, buf, BUFFER_SIZE) == -1) { perror("read"); @@ -72,10 +73,10 @@ int main() } printf("Server Received: %s\n", buf); - // 关闭Socket + // Close the socket close(accepted_fd); close(server_fd); unlink(SOCKET_NAME); return 0; -} \ No newline at end of file +} diff --git a/regression/apps/pthread/pthread_test.c b/regression/apps/pthread/pthread_test.c index 3a8416e00..5e24d1807 100644 --- a/regression/apps/pthread/pthread_test.c +++ b/regression/apps/pthread/pthread_test.c @@ -64,19 +64,19 @@ static void *thread_func(void *_arg) static int test_mutex_with_concurrent_counter(void) { /* - * Multiple threads are to increase a global counter concurrently - */ + * Multiple threads are to increase a global counter concurrently + */ volatile unsigned long global_count = 0; pthread_t threads[NTHREADS]; struct thread_arg thread_args[NTHREADS]; /* - * Protect the counter with a mutex - */ + * Protect the counter with a mutex + */ pthread_mutex_t mutex; pthread_mutex_init(&mutex, NULL); /* - * Start the threads - */ + * Start the threads + */ for (int ti = 0; ti < NTHREADS; ti++) { struct thread_arg *thread_arg = &thread_args[ti]; thread_arg->ti = ti; @@ -91,8 +91,8 @@ static int test_mutex_with_concurrent_counter(void) } } /* - * Wait for the threads to finish - */ + * Wait for the threads to finish + */ for (int ti = 0; ti < NTHREADS; ti++) { if (pthread_join(threads[ti], NULL) < 0) { printf("ERROR: pthread_join failed (ti = %d)\n", ti); @@ -100,8 +100,8 @@ static int test_mutex_with_concurrent_counter(void) } } /* - * Check the correctness of the concurrent counter - */ + * Check the correctness of the concurrent counter + */ if (global_count != EXPECTED_GLOBAL_COUNT) { printf("ERROR: incorrect global_count (actual = %ld, expected = %ld)\n", global_count, EXPECTED_GLOBAL_COUNT); @@ -247,8 +247,8 @@ static int test_mutex_with_cond_wait(void) pthread_cond_t cond_val = PTHREAD_COND_INITIALIZER; pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* - * Start the threads waiting on the condition variable - */ + * Start the threads waiting on the condition variable + */ for (int ti = 0; ti < NTHREADS; ti++) { struct thread_cond_arg *thread_arg = &thread_args[ti]; thread_arg->ti = ti; @@ -264,8 +264,8 @@ static int test_mutex_with_cond_wait(void) } } /* - * Unblock all threads currently waiting on the condition variable - */ + * Unblock all threads currently waiting on the condition variable + */ while (exit_thread_count < NTHREADS) { pthread_mutex_lock(&mutex); val = 1; @@ -277,8 +277,8 @@ static int test_mutex_with_cond_wait(void) pthread_mutex_unlock(&mutex); } /* - * Wait for the threads to finish - */ + * Wait for the threads to finish + */ for (int ti = 0; ti < NTHREADS; ti++) { if (pthread_join(threads[ti], NULL) < 0) { printf("ERROR: pthread_join failed (ti = %d)\n", ti); @@ -294,4 +294,4 @@ int main() test_robust_mutex_with_concurrent_counter(); // test_mutex_with_cond_wait(); return 0; -} \ No newline at end of file +} diff --git a/regression/apps/signal_c/signal_test.c b/regression/apps/signal_c/signal_test.c index 98f48b117..cfe809eb9 100644 --- a/regression/apps/signal_c/signal_test.c +++ b/regression/apps/signal_c/signal_test.c @@ -372,4 +372,4 @@ int main() test_sigchld(); test_sigaltstack(); return 0; -} \ No newline at end of file +}