From 2a3484ba88c98832fcd11da18cd367bcc0ca7431 Mon Sep 17 00:00:00 2001 From: ada-dmitry Date: Fri, 3 Nov 2023 15:54:20 +0300 Subject: [PATCH] added py --- Python/c.c | 32 ++++++++++++++++++++++++++++++++ Python/server.py | 4 ++++ 2 files changed, 36 insertions(+) create mode 100644 Python/c.c create mode 100644 Python/server.py diff --git a/Python/c.c b/Python/c.c new file mode 100644 index 0000000..afe2da2 --- /dev/null +++ b/Python/c.c @@ -0,0 +1,32 @@ +#include +#include +#include + +int main(int argc, char *argv[]) +{ + static char *newargv[] = {"/usr/bin/python", NULL, NULL}; + static char *newenviron[] = {NULL}; + pid_t pid; + + if (argc != 2) + { + fprintf(stderr, "Usage: $s \n", argv[0]); + exit(EXIT_FAILURE); + } + newargv[1] = argv[1]; + + if ((pid = fork()) == -1) + { + perror("fork"); + exit(EXIT_FAILURE); + } + + if (pid == 0) + { + execve(newargv[0], newargv, newenviron); + perror("execve"); + } + + printf("%d process started\n", pid); + return 0; +} \ No newline at end of file diff --git a/Python/server.py b/Python/server.py new file mode 100644 index 0000000..da41839 --- /dev/null +++ b/Python/server.py @@ -0,0 +1,4 @@ +import socket +import os + +socket_path = '/tmp/unix_sock.server' \ No newline at end of file