diff options
Diffstat (limited to '')
-rw-r--r-- | po/fr/man7/unix.7.po | 700 |
1 files changed, 650 insertions, 50 deletions
diff --git a/po/fr/man7/unix.7.po b/po/fr/man7/unix.7.po index 70c2eaed..4583cbd6 100644 --- a/po/fr/man7/unix.7.po +++ b/po/fr/man7/unix.7.po @@ -19,7 +19,7 @@ msgid "" msgstr "" "Project-Id-Version: perkamon\n" -"POT-Creation-Date: 2024-03-01 17:12+0100\n" +"POT-Creation-Date: 2024-06-01 06:33+0200\n" "PO-Revision-Date: 2021-12-01 11:37+0100\n" "Last-Translator: Jean-Paul Guillonneau <guillonneau.jeanpaul@free.fr>\n" "Language-Team: French <debian-l10n-french@lists.debian.org>\n" @@ -38,16 +38,16 @@ msgid "UNIX" msgstr "UNIX" #. type: TH -#: archlinux fedora-40 fedora-rawhide mageia-cauldron +#: archlinux debian-unstable opensuse-tumbleweed #, no-wrap -msgid "2023-12-21" -msgstr "21 décembre 2023" +msgid "2024-05-02" +msgstr "2 mai 2024" #. type: TH -#: archlinux fedora-40 fedora-rawhide mageia-cauldron +#: archlinux debian-unstable #, no-wrap -msgid "Linux man-pages 6.06" -msgstr "Pages du manuel de Linux 6.06" +msgid "Linux man-pages 6.8" +msgstr "Pages du manuel de Linux 6.8" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide @@ -192,10 +192,15 @@ msgstr "" "a pour taille 108 octets. Consultez NOTES, ci-dessous." #. type: Plain text -#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide -#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#: archlinux debian-unstable fedora-rawhide opensuse-tumbleweed +#, fuzzy +#| msgid "" +#| "Various systems calls (for example, B<bind>(2), B<connect>(2), and " +#| "B<sendto>(2)) take a I<sockaddr_un> argument as input. Some other " +#| "system calls (for example, B<getsockname>(2), B<getpeername>(2), " +#| "B<recvfrom>(2), and B<accept>(2)) return an argument of this type." msgid "" -"Various systems calls (for example, B<bind>(2), B<connect>(2), and " +"Various system calls (for example, B<bind>(2), B<connect>(2), and " "B<sendto>(2)) take a I<sockaddr_un> argument as input. Some other system " "calls (for example, B<getsockname>(2), B<getpeername>(2), B<recvfrom>(2), " "and B<accept>(2)) return an argument of this type." @@ -683,7 +688,8 @@ msgid "B<SO_PEERCRED>" msgstr "B<SO_PEERCRED>" #. type: Plain text -#: archlinux fedora-40 fedora-rawhide mageia-cauldron +#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron +#: opensuse-tumbleweed #, fuzzy #| msgid "" #| "This read-only socket option returns the credentials of the peer process " @@ -1819,11 +1825,23 @@ msgstr "BOGUES" #. The behavior on Solaris is quite similar. #. type: Plain text -#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide -#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#: archlinux debian-unstable fedora-rawhide opensuse-tumbleweed +#, fuzzy +#| msgid "" +#| "When binding a socket to an address, Linux is one of the implementations " +#| "that appends a null terminator if none is supplied in I<sun_path>. In " +#| "most cases this is unproblematic: when the socket address is retrieved, " +#| "it will be one byte longer than that supplied when the socket was bound. " +#| "However, there is one case where confusing behavior can result: if 108 " +#| "non-null bytes are supplied when a socket is bound, then the addition of " +#| "the null terminator takes the length of the pathname beyond " +#| "I<sizeof(sun_path)>. Consequently, when retrieving the socket address " +#| "(for example, via B<accept>(2)), if the input I<addrlen> argument for the " +#| "retrieving call is specified as I<sizeof(struct sockaddr_un)>, then the " +#| "returned address structure I<won't> have a null terminator in I<sun_path>." msgid "" "When binding a socket to an address, Linux is one of the implementations " -"that appends a null terminator if none is supplied in I<sun_path>. In most " +"that append a null terminator if none is supplied in I<sun_path>. In most " "cases this is unproblematic: when the socket address is retrieved, it will " "be one byte longer than that supplied when the socket was bound. However, " "there is one case where confusing behavior can result: if 108 non-null bytes " @@ -2029,17 +2047,30 @@ msgid "Program source" msgstr "Source du programme" #. type: Plain text -#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron -#: opensuse-tumbleweed -#, no-wrap +#: archlinux debian-unstable opensuse-tumbleweed +#, fuzzy, no-wrap +#| msgid "" +#| "#define SOCKET_NAME \"/tmp/9Lq7BNBnBycd6nxy.socket\"\n" +#| "#define BUFFER_SIZE 12\n" msgid "" "/*\n" " * File connection.h\n" " */\n" +"#ifndef CONNECTION_H\n" +"#define CONNECTION_H\n" "\\&\n" "#define SOCKET_NAME \"/tmp/9Lq7BNBnBycd6nxy.socket\"\n" "#define BUFFER_SIZE 12\n" "\\&\n" +"#endif // include guard\n" +msgstr "" +"#define SOCKET_NAME \"/tmp/9Lq7BNBnBycd6nxy.socket\"\n" +"#define BUFFER_SIZE 12\n" + +#. type: Plain text +#: archlinux debian-unstable opensuse-tumbleweed +#, no-wrap +msgid "" "/*\n" " * File server.c\n" " */\n" @@ -2048,20 +2079,23 @@ msgid "" "#include E<lt>stdlib.hE<gt>\n" "#include E<lt>string.hE<gt>\n" "#include E<lt>sys/socket.hE<gt>\n" +"#include E<lt>sys/types.hE<gt>\n" "#include E<lt>sys/un.hE<gt>\n" "#include E<lt>unistd.hE<gt>\n" +"\\&\n" "#include \"connection.h\"\n" "\\&\n" "int\n" -"main(int argc, char *argv[])\n" +"main(void)\n" "{\n" -" struct sockaddr_un name;\n" -" int down_flag = 0;\n" -" int ret;\n" -" int connection_socket;\n" -" int data_socket;\n" -" int result;\n" -" char buffer[BUFFER_SIZE];\n" +" int down_flag = 0;\n" +" int ret;\n" +" int connection_socket;\n" +" int data_socket;\n" +" int result;\n" +" ssize_t r, w;\n" +" struct sockaddr_un name;\n" +" char buffer[BUFFER_SIZE];\n" "\\&\n" " /* Create local socket. */\n" "\\&\n" @@ -2120,8 +2154,8 @@ msgid "" "\\&\n" " /* Wait for next data packet. */\n" "\\&\n" -" ret = read(data_socket, buffer, sizeof(buffer));\n" -" if (ret == -1) {\n" +" r = read(data_socket, buffer, sizeof(buffer));\n" +" if (r == -1) {\n" " perror(\"read\");\n" " exit(EXIT_FAILURE);\n" " }\n" @@ -2134,13 +2168,17 @@ msgid "" "\\&\n" " if (!strncmp(buffer, \"DOWN\", sizeof(buffer))) {\n" " down_flag = 1;\n" -" break;\n" +" continue;\n" " }\n" "\\&\n" " if (!strncmp(buffer, \"END\", sizeof(buffer))) {\n" " break;\n" " }\n" "\\&\n" +" if (down_flag) {\n" +" continue;\n" +" }\n" +"\\&\n" " /* Add received summand. */\n" "\\&\n" " result += atoi(buffer);\n" @@ -2149,8 +2187,8 @@ msgid "" " /* Send result. */\n" "\\&\n" " sprintf(buffer, \"%d\", result);\n" -" ret = write(data_socket, buffer, sizeof(buffer));\n" -" if (ret == -1) {\n" +" w = write(data_socket, buffer, sizeof(buffer));\n" +" if (w == -1) {\n" " perror(\"write\");\n" " exit(EXIT_FAILURE);\n" " }\n" @@ -2174,27 +2212,34 @@ msgid "" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" -"\\&\n" +msgstr "" + +#. type: Plain text +#: archlinux debian-unstable opensuse-tumbleweed +#, no-wrap +msgid "" "/*\n" " * File client.c\n" " */\n" "\\&\n" -"#include E<lt>errno.hE<gt>\n" "#include E<lt>stdio.hE<gt>\n" "#include E<lt>stdlib.hE<gt>\n" "#include E<lt>string.hE<gt>\n" "#include E<lt>sys/socket.hE<gt>\n" +"#include E<lt>sys/types.hE<gt>\n" "#include E<lt>sys/un.hE<gt>\n" "#include E<lt>unistd.hE<gt>\n" +"\\&\n" "#include \"connection.h\"\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" -" struct sockaddr_un addr;\n" -" int ret;\n" -" int data_socket;\n" -" char buffer[BUFFER_SIZE];\n" +" int ret;\n" +" int data_socket;\n" +" ssize_t r, w;\n" +" struct sockaddr_un addr;\n" +" char buffer[BUFFER_SIZE];\n" "\\&\n" " /* Create local socket. */\n" "\\&\n" @@ -2226,9 +2271,9 @@ msgid "" "\\&\n" " /* Send arguments. */\n" "\\&\n" -" for (size_t i = 1; i E<lt> argc; ++i) {\n" -" ret = write(data_socket, argv[i], strlen(argv[i]) + 1);\n" -" if (ret == -1) {\n" +" for (int i = 1; i E<lt> argc; ++i) {\n" +" w = write(data_socket, argv[i], strlen(argv[i]) + 1);\n" +" if (w == -1) {\n" " perror(\"write\");\n" " break;\n" " }\n" @@ -2237,16 +2282,16 @@ msgid "" " /* Request result. */\n" "\\&\n" " strcpy(buffer, \"END\");\n" -" ret = write(data_socket, buffer, strlen(buffer) + 1);\n" -" if (ret == -1) {\n" +" w = write(data_socket, buffer, strlen(buffer) + 1);\n" +" if (w == -1) {\n" " perror(\"write\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Receive result. */\n" "\\&\n" -" ret = read(data_socket, buffer, sizeof(buffer));\n" -" if (ret == -1) {\n" +" r = read(data_socket, buffer, sizeof(buffer));\n" +" if (r == -1) {\n" " perror(\"read\");\n" " exit(EXIT_FAILURE);\n" " }\n" @@ -2306,7 +2351,20 @@ msgid "Linux man-pages 6.03" msgstr "Pages du manuel de Linux 6.03" #. type: Plain text -#: debian-bookworm debian-unstable opensuse-leap-15-6 opensuse-tumbleweed +#: debian-bookworm fedora-40 mageia-cauldron opensuse-leap-15-6 +msgid "" +"Various systems calls (for example, B<bind>(2), B<connect>(2), and " +"B<sendto>(2)) take a I<sockaddr_un> argument as input. Some other system " +"calls (for example, B<getsockname>(2), B<getpeername>(2), B<recvfrom>(2), " +"and B<accept>(2)) return an argument of this type." +msgstr "" +"Divers appels système (par exemple, B<bind>(2), B<connect>(2) et " +"B<sendto>(2)) prennent un argument I<sockaddr_un> en entrée. D’autres appels " +"système (par exemple, B<getsockname>(2), B<getpeername>(2), B<recvfrom>(2) " +"et B<accept>(2)) renvoient un argument de ce type." + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 msgid "" "This read-only socket option returns the credentials of the peer process " "connected to this socket. The returned credentials are those that were in " @@ -2316,6 +2374,36 @@ msgstr "" "du processus pair connecté à ce socket. Les accréditations renvoyées sont " "celles effectives au moment de l’appel à B<connect>(2) ou B<socketpair>(2)." +#. The behavior on Solaris is quite similar. +#. type: Plain text +#: debian-bookworm fedora-40 mageia-cauldron opensuse-leap-15-6 +msgid "" +"When binding a socket to an address, Linux is one of the implementations " +"that appends a null terminator if none is supplied in I<sun_path>. In most " +"cases this is unproblematic: when the socket address is retrieved, it will " +"be one byte longer than that supplied when the socket was bound. However, " +"there is one case where confusing behavior can result: if 108 non-null bytes " +"are supplied when a socket is bound, then the addition of the null " +"terminator takes the length of the pathname beyond I<sizeof(sun_path)>. " +"Consequently, when retrieving the socket address (for example, via " +"B<accept>(2)), if the input I<addrlen> argument for the retrieving call is " +"specified as I<sizeof(struct sockaddr_un)>, then the returned address " +"structure I<won't> have a null terminator in I<sun_path>." +msgstr "" +"Lors de la liaison d’un socket à une adresse, Linux est une des " +"implémentations qui ajoute un octet NULL final si aucun n’est fourni dans " +"I<sun_path>. Dans la plupart des cas cela ne pose aucun problème : quand " +"l’adresse du socket est récupérée, elle sera plus grande d’un octet que " +"celle fournie lors de la liaison du socket. Cependant, il existe un cas où " +"un comportement déroutant peut se produire : si 108 octets non NULL sont " +"fournis quand un socket est lié, alors l’ajout de l’octet NULL final " +"incorpore la longueur du nom de chemin au-delà de I<sizeof(sun_path)>. Par " +"conséquent, lors de la récupération de l’adresse du socket (par exemple, à " +"l’aide de B<accept>(2)), si l’argument I<addrlen> de l’entrée pour l’appel " +"de récupération est indiqué comme I<sizeof(struct\\ sockaddr_un)>, alors la " +"structure d’adresse renvoyée I<n’aura pas> d’octet NULL final dans " +"I<sun_path>." + #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap @@ -2975,16 +3063,522 @@ msgid " close(data_socket);\n" msgstr " close(data_socket);\n" #. type: TH -#: debian-unstable opensuse-tumbleweed +#: fedora-40 mageia-cauldron #, no-wrap -msgid "2023-07-15" -msgstr "15 juillet 2023" +msgid "2023-12-21" +msgstr "21 décembre 2023" #. type: TH -#: debian-unstable opensuse-tumbleweed +#: fedora-40 mageia-cauldron #, no-wrap -msgid "Linux man-pages 6.05.01" -msgstr "Pages du manuel de Linux 6.05.01" +msgid "Linux man-pages 6.06" +msgstr "Pages du manuel de Linux 6.06" + +#. type: Plain text +#: fedora-40 mageia-cauldron +#, no-wrap +msgid "" +"/*\n" +" * File connection.h\n" +" */\n" +"\\&\n" +"#define SOCKET_NAME \"/tmp/9Lq7BNBnBycd6nxy.socket\"\n" +"#define BUFFER_SIZE 12\n" +"\\&\n" +"/*\n" +" * File server.c\n" +" */\n" +"\\&\n" +"#include E<lt>stdio.hE<gt>\n" +"#include E<lt>stdlib.hE<gt>\n" +"#include E<lt>string.hE<gt>\n" +"#include E<lt>sys/socket.hE<gt>\n" +"#include E<lt>sys/un.hE<gt>\n" +"#include E<lt>unistd.hE<gt>\n" +"#include \"connection.h\"\n" +"\\&\n" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" struct sockaddr_un name;\n" +" int down_flag = 0;\n" +" int ret;\n" +" int connection_socket;\n" +" int data_socket;\n" +" int result;\n" +" char buffer[BUFFER_SIZE];\n" +"\\&\n" +" /* Create local socket. */\n" +"\\&\n" +" connection_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);\n" +" if (connection_socket == -1) {\n" +" perror(\"socket\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /*\n" +" * For portability clear the whole structure, since some\n" +" * implementations have additional (nonstandard) fields in\n" +" * the structure.\n" +" */\n" +"\\&\n" +" memset(&name, 0, sizeof(name));\n" +"\\&\n" +" /* Bind socket to socket name. */\n" +"\\&\n" +" name.sun_family = AF_UNIX;\n" +" strncpy(name.sun_path, SOCKET_NAME, sizeof(name.sun_path) - 1);\n" +"\\&\n" +" ret = bind(connection_socket, (const struct sockaddr *) &name,\n" +" sizeof(name));\n" +" if (ret == -1) {\n" +" perror(\"bind\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /*\n" +" * Prepare for accepting connections. The backlog size is set\n" +" * to 20. So while one request is being processed other requests\n" +" * can be waiting.\n" +" */\n" +"\\&\n" +" ret = listen(connection_socket, 20);\n" +" if (ret == -1) {\n" +" perror(\"listen\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* This is the main loop for handling connections. */\n" +"\\&\n" +" for (;;) {\n" +"\\&\n" +" /* Wait for incoming connection. */\n" +"\\&\n" +" data_socket = accept(connection_socket, NULL, NULL);\n" +" if (data_socket == -1) {\n" +" perror(\"accept\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" result = 0;\n" +" for (;;) {\n" +"\\&\n" +" /* Wait for next data packet. */\n" +"\\&\n" +" ret = read(data_socket, buffer, sizeof(buffer));\n" +" if (ret == -1) {\n" +" perror(\"read\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* Ensure buffer is 0-terminated. */\n" +"\\&\n" +" buffer[sizeof(buffer) - 1] = 0;\n" +"\\&\n" +" /* Handle commands. */\n" +"\\&\n" +" if (!strncmp(buffer, \"DOWN\", sizeof(buffer))) {\n" +" down_flag = 1;\n" +" break;\n" +" }\n" +"\\&\n" +" if (!strncmp(buffer, \"END\", sizeof(buffer))) {\n" +" break;\n" +" }\n" +"\\&\n" +" /* Add received summand. */\n" +"\\&\n" +" result += atoi(buffer);\n" +" }\n" +"\\&\n" +" /* Send result. */\n" +"\\&\n" +" sprintf(buffer, \"%d\", result);\n" +" ret = write(data_socket, buffer, sizeof(buffer));\n" +" if (ret == -1) {\n" +" perror(\"write\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* Close socket. */\n" +"\\&\n" +" close(data_socket);\n" +"\\&\n" +" /* Quit on DOWN command. */\n" +"\\&\n" +" if (down_flag) {\n" +" break;\n" +" }\n" +" }\n" +"\\&\n" +" close(connection_socket);\n" +"\\&\n" +" /* Unlink the socket. */\n" +"\\&\n" +" unlink(SOCKET_NAME);\n" +"\\&\n" +" exit(EXIT_SUCCESS);\n" +"}\n" +"\\&\n" +"/*\n" +" * File client.c\n" +" */\n" +"\\&\n" +"#include E<lt>errno.hE<gt>\n" +"#include E<lt>stdio.hE<gt>\n" +"#include E<lt>stdlib.hE<gt>\n" +"#include E<lt>string.hE<gt>\n" +"#include E<lt>sys/socket.hE<gt>\n" +"#include E<lt>sys/un.hE<gt>\n" +"#include E<lt>unistd.hE<gt>\n" +"#include \"connection.h\"\n" +"\\&\n" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" struct sockaddr_un addr;\n" +" int ret;\n" +" int data_socket;\n" +" char buffer[BUFFER_SIZE];\n" +"\\&\n" +" /* Create local socket. */\n" +"\\&\n" +" data_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);\n" +" if (data_socket == -1) {\n" +" perror(\"socket\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /*\n" +" * For portability clear the whole structure, since some\n" +" * implementations have additional (nonstandard) fields in\n" +" * the structure.\n" +" */\n" +"\\&\n" +" memset(&addr, 0, sizeof(addr));\n" +"\\&\n" +" /* Connect socket to socket address. */\n" +"\\&\n" +" addr.sun_family = AF_UNIX;\n" +" strncpy(addr.sun_path, SOCKET_NAME, sizeof(addr.sun_path) - 1);\n" +"\\&\n" +" ret = connect(data_socket, (const struct sockaddr *) &addr,\n" +" sizeof(addr));\n" +" if (ret == -1) {\n" +" fprintf(stderr, \"The server is down.\\en\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* Send arguments. */\n" +"\\&\n" +" for (size_t i = 1; i E<lt> argc; ++i) {\n" +" ret = write(data_socket, argv[i], strlen(argv[i]) + 1);\n" +" if (ret == -1) {\n" +" perror(\"write\");\n" +" break;\n" +" }\n" +" }\n" +"\\&\n" +" /* Request result. */\n" +"\\&\n" +" strcpy(buffer, \"END\");\n" +" ret = write(data_socket, buffer, strlen(buffer) + 1);\n" +" if (ret == -1) {\n" +" perror(\"write\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* Receive result. */\n" +"\\&\n" +" ret = read(data_socket, buffer, sizeof(buffer));\n" +" if (ret == -1) {\n" +" perror(\"read\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* Ensure buffer is 0-terminated. */\n" +"\\&\n" +" buffer[sizeof(buffer) - 1] = 0;\n" +"\\&\n" +" printf(\"Result = %s\\en\", buffer);\n" +"\\&\n" +" /* Close socket. */\n" +"\\&\n" +" close(data_socket);\n" +"\\&\n" +" exit(EXIT_SUCCESS);\n" +"}\n" +msgstr "" + +#. type: TH +#: fedora-rawhide +#, no-wrap +msgid "2024-03-16" +msgstr "16 mars 2024" + +#. type: TH +#: fedora-rawhide +#, no-wrap +msgid "Linux man-pages 6.7" +msgstr "Pages du manuel de Linux 6.7" + +#. type: Plain text +#: fedora-rawhide +#, fuzzy, no-wrap +#| msgid "" +#| "#define SOCKET_NAME \"/tmp/9Lq7BNBnBycd6nxy.socket\"\n" +#| "#define BUFFER_SIZE 12\n" +msgid "" +"/*\n" +" * File connection.h\n" +" */\n" +"\\&\n" +"#define SOCKET_NAME \"/tmp/9Lq7BNBnBycd6nxy.socket\"\n" +"#define BUFFER_SIZE 12\n" +msgstr "" +"#define SOCKET_NAME \"/tmp/9Lq7BNBnBycd6nxy.socket\"\n" +"#define BUFFER_SIZE 12\n" + +#. type: Plain text +#: fedora-rawhide +#, no-wrap +msgid "" +"/*\n" +" * File server.c\n" +" */\n" +"\\&\n" +"#include E<lt>stdio.hE<gt>\n" +"#include E<lt>stdlib.hE<gt>\n" +"#include E<lt>string.hE<gt>\n" +"#include E<lt>sys/socket.hE<gt>\n" +"#include E<lt>sys/un.hE<gt>\n" +"#include E<lt>unistd.hE<gt>\n" +"\\&\n" +"#include \"connection.h\"\n" +"\\&\n" +"int\n" +"main(void)\n" +"{\n" +" int down_flag = 0;\n" +" int ret;\n" +" int connection_socket;\n" +" int data_socket;\n" +" int result;\n" +" ssize_t r, w;\n" +" struct sockaddr_un name;\n" +" char buffer[BUFFER_SIZE];\n" +"\\&\n" +" /* Create local socket. */\n" +"\\&\n" +" connection_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);\n" +" if (connection_socket == -1) {\n" +" perror(\"socket\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /*\n" +" * For portability clear the whole structure, since some\n" +" * implementations have additional (nonstandard) fields in\n" +" * the structure.\n" +" */\n" +"\\&\n" +" memset(&name, 0, sizeof(name));\n" +"\\&\n" +" /* Bind socket to socket name. */\n" +"\\&\n" +" name.sun_family = AF_UNIX;\n" +" strncpy(name.sun_path, SOCKET_NAME, sizeof(name.sun_path) - 1);\n" +"\\&\n" +" ret = bind(connection_socket, (const struct sockaddr *) &name,\n" +" sizeof(name));\n" +" if (ret == -1) {\n" +" perror(\"bind\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /*\n" +" * Prepare for accepting connections. The backlog size is set\n" +" * to 20. So while one request is being processed other requests\n" +" * can be waiting.\n" +" */\n" +"\\&\n" +" ret = listen(connection_socket, 20);\n" +" if (ret == -1) {\n" +" perror(\"listen\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* This is the main loop for handling connections. */\n" +"\\&\n" +" for (;;) {\n" +"\\&\n" +" /* Wait for incoming connection. */\n" +"\\&\n" +" data_socket = accept(connection_socket, NULL, NULL);\n" +" if (data_socket == -1) {\n" +" perror(\"accept\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" result = 0;\n" +" for (;;) {\n" +"\\&\n" +" /* Wait for next data packet. */\n" +"\\&\n" +" r = read(data_socket, buffer, sizeof(buffer));\n" +" if (r == -1) {\n" +" perror(\"read\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* Ensure buffer is 0-terminated. */\n" +"\\&\n" +" buffer[sizeof(buffer) - 1] = 0;\n" +"\\&\n" +" /* Handle commands. */\n" +"\\&\n" +" if (!strncmp(buffer, \"DOWN\", sizeof(buffer))) {\n" +" down_flag = 1;\n" +" continue;\n" +" }\n" +"\\&\n" +" if (!strncmp(buffer, \"END\", sizeof(buffer))) {\n" +" break;\n" +" }\n" +"\\&\n" +" if (down_flag) {\n" +" continue;\n" +" }\n" +"\\&\n" +" /* Add received summand. */\n" +"\\&\n" +" result += atoi(buffer);\n" +" }\n" +"\\&\n" +" /* Send result. */\n" +"\\&\n" +" sprintf(buffer, \"%d\", result);\n" +" w = write(data_socket, buffer, sizeof(buffer));\n" +" if (w == -1) {\n" +" perror(\"write\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* Close socket. */\n" +"\\&\n" +" close(data_socket);\n" +"\\&\n" +" /* Quit on DOWN command. */\n" +"\\&\n" +" if (down_flag) {\n" +" break;\n" +" }\n" +" }\n" +"\\&\n" +" close(connection_socket);\n" +"\\&\n" +" /* Unlink the socket. */\n" +"\\&\n" +" unlink(SOCKET_NAME);\n" +"\\&\n" +" exit(EXIT_SUCCESS);\n" +"}\n" +msgstr "" + +#. type: Plain text +#: fedora-rawhide +#, no-wrap +msgid "" +"/*\n" +" * File client.c\n" +" */\n" +"\\&\n" +"#include E<lt>stdio.hE<gt>\n" +"#include E<lt>stdlib.hE<gt>\n" +"#include E<lt>string.hE<gt>\n" +"#include E<lt>sys/socket.hE<gt>\n" +"#include E<lt>sys/un.hE<gt>\n" +"#include E<lt>unistd.hE<gt>\n" +"\\&\n" +"#include \"connection.h\"\n" +"\\&\n" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" int ret;\n" +" int data_socket;\n" +" ssize_t r, w;\n" +" struct sockaddr_un addr;\n" +" char buffer[BUFFER_SIZE];\n" +"\\&\n" +" /* Create local socket. */\n" +"\\&\n" +" data_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);\n" +" if (data_socket == -1) {\n" +" perror(\"socket\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /*\n" +" * For portability clear the whole structure, since some\n" +" * implementations have additional (nonstandard) fields in\n" +" * the structure.\n" +" */\n" +"\\&\n" +" memset(&addr, 0, sizeof(addr));\n" +"\\&\n" +" /* Connect socket to socket address. */\n" +"\\&\n" +" addr.sun_family = AF_UNIX;\n" +" strncpy(addr.sun_path, SOCKET_NAME, sizeof(addr.sun_path) - 1);\n" +"\\&\n" +" ret = connect(data_socket, (const struct sockaddr *) &addr,\n" +" sizeof(addr));\n" +" if (ret == -1) {\n" +" fprintf(stderr, \"The server is down.\\en\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* Send arguments. */\n" +"\\&\n" +" for (int i = 1; i E<lt> argc; ++i) {\n" +" w = write(data_socket, argv[i], strlen(argv[i]) + 1);\n" +" if (w == -1) {\n" +" perror(\"write\");\n" +" break;\n" +" }\n" +" }\n" +"\\&\n" +" /* Request result. */\n" +"\\&\n" +" strcpy(buffer, \"END\");\n" +" w = write(data_socket, buffer, strlen(buffer) + 1);\n" +" if (w == -1) {\n" +" perror(\"write\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* Receive result. */\n" +"\\&\n" +" r = read(data_socket, buffer, sizeof(buffer));\n" +" if (r == -1) {\n" +" perror(\"read\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* Ensure buffer is 0-terminated. */\n" +"\\&\n" +" buffer[sizeof(buffer) - 1] = 0;\n" +"\\&\n" +" printf(\"Result = %s\\en\", buffer);\n" +"\\&\n" +" /* Close socket. */\n" +"\\&\n" +" close(data_socket);\n" +"\\&\n" +" exit(EXIT_SUCCESS);\n" +"}\n" +msgstr "" #. type: TH #: opensuse-leap-15-6 @@ -2997,3 +3591,9 @@ msgstr "21 mars 2023" #, no-wrap msgid "Linux man-pages 6.04" msgstr "Pages du manuel de Linux 6.04" + +#. type: TH +#: opensuse-tumbleweed +#, no-wrap +msgid "Linux man-pages (unreleased)" +msgstr "Pages du manuel de Linux (non publiées)" |