From patchwork Tue Apr 10 19:39:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 133107 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1639000ljb; Tue, 10 Apr 2018 12:49:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+1Loj5mPVfscbBY0sgT5UNhoeS6eJ21TQRW3u2HMsCrFOPmQ/KwWvh+0dYlRHdzii8abWV X-Received: by 10.200.48.58 with SMTP id f55mr2853147qte.140.1523389787278; Tue, 10 Apr 2018 12:49:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523389787; cv=none; d=google.com; s=arc-20160816; b=x13piVtc4MlO/bzH63dXuD0a2RSH46dkh4oh7StsEN6onpGHEp2XGzF45OuJMOdKP8 qXABjB5oADT+XWAUKPdQoaCwqvcKxEu0FMnifN4UbEjI4scGcEv0ErMg3uaMYgYCaD+Y bST6guLpLGbpCMBl9MQFZXVFBgeSUTqoccBagTV1050HW0REIQurSetBJuKY5VEH39ML Q9XWgSUfpxJJQIFoERmluIriQUzYw1US2SKOrKZBx12BlY1RgZaomxGOciRlv+1MQH7n yen3Znb9REMNPzZD7oLO5LmfW6JcxLyi9MA80KBAPhk4cW0/1mTTkEwFWlwv2Su+MIVk BW2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=LxEi/2ysyPLekxD6Wk6CRble46QmAhFUVAEWvv6GZiE=; b=h+EziwZ5VkFPaTl8qEQafuvr++hNq6k704eddU76/rJEhVSY6TW5qXLgn9csWbn1eK 83WwC422YG9rWJHT4S7VnxflHKKYi19TGeFAiZJ5zpXmmXvbQM1DbsC+GV0VZhysXrmv y6XxXfEqC7hxl1nUhmtSln/q1058jvGcGdst7Y3dJYiKAsl1hWWiFPMY4JkK3z4HkOfR JH8pCgaSfNtdd2Yj7rEi2gtBu9jII3s0XIDFXhAkNa5U2d1qZoHGjtKXuM9bo1E+or0d lQBuV/ODXHsEs/afbMIHciRxbf86Cusel84MudKOXzYyHzWfZzcf2TjNn1J8pg2NZsMx RTrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=L3b9dlsR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id y6si397715qki.427.2018.04.10.12.49.47 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 10 Apr 2018 12:49:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=L3b9dlsR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39832 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5zH0-0000PI-N5 for patch@linaro.org; Tue, 10 Apr 2018 15:49:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5z79-0000Hc-47 for qemu-devel@nongnu.org; Tue, 10 Apr 2018 15:39:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5z76-0006NT-J1 for qemu-devel@nongnu.org; Tue, 10 Apr 2018 15:39:35 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:33660) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f5z76-0006My-8R for qemu-devel@nongnu.org; Tue, 10 Apr 2018 15:39:32 -0400 Received: by mail-wr0-x241.google.com with SMTP id z73so13954459wrb.0 for ; Tue, 10 Apr 2018 12:39:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LxEi/2ysyPLekxD6Wk6CRble46QmAhFUVAEWvv6GZiE=; b=L3b9dlsRYmIoWDdqNRKEVcfcLiXMSyw4rEcYQdXFl4ljGGv8BTYx5tdoqUW3p1/Q9L l607/gS5akuI4X+yxZ9IywJG/qhs9nNqJeZsr4TGP1yvUfxjHIbBrx1JPq1uI+AoWJSP AqQCrggOlF7+6ZntMxht8nxrePgM5gh02zYMQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LxEi/2ysyPLekxD6Wk6CRble46QmAhFUVAEWvv6GZiE=; b=Zzx5fsbsLm+RRobdn9l5IyOnJbJiMmod9HBqhGdlSDUlnmYe3/7FG+o5SVf8ZL+RVz gUmHAFOqCv1eKojQ6g2TS7daNYUwDphpW91sgWjyjiraPBpld1G1fUymWi8sLSyJ6eHF vEI6BwKD3b1dMu2mqyZy9NIY9DYicReusPaSXLigehy8z0dqJef1ZNQZ6wHbYRtjyKF9 k1+B3PUH9eKYsXzkX5oRpfJoTZxk6YmRwtng0Oz1VUhjtJqEdl/ZJ9AXbWwKa1TVoK6J c+k23FMI4pf5giQ5Ryu7SEkZGVIk3k7v95jZUNKU0hkT8zsmCC0cCP+mgpRObsC/5e+B 9VtQ== X-Gm-Message-State: ALQs6tBesJszDzuK+dBcH1xbwx/RoPcA6uXGcOVzb8NE20ZIZyj+KSZY OBJX3gOmVFlC+1mOTwRJU8jRVg== X-Received: by 10.223.184.109 with SMTP id u42mr1229108wrf.3.1523389171126; Tue, 10 Apr 2018 12:39:31 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id d7sm1793085wrj.26.2018.04.10.12.39.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Apr 2018 12:39:24 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 271013E0AAE; Tue, 10 Apr 2018 20:39:20 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 20:39:05 +0100 Message-Id: <20180410193919.28026-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180410193919.28026-1-alex.bennee@linaro.org> References: <20180410193919.28026-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PATCH v1 10/24] tests/tcg/multiarch: Build fix for linux-test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , famz@redhat.com, cota@braap.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Fam Zheng To keep the compiler happy, and to fit in our buildsys flags: - Make local functions "static" - #ifdef out unused functions - drop cutils/osdep dependencies Signed-off-by: Fam Zheng [AJB: drop cutils/osdep dependencies] Signed-off-by: Alex Bennée --- tests/tcg/multiarch/linux-test.c | 68 +++++++++++++--------------------------- 1 file changed, 21 insertions(+), 47 deletions(-) -- 2.16.2 Reviewed-by: Thomas Huth diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c index 5070d31446..4457bd04ba 100644 --- a/tests/tcg/multiarch/linux-test.c +++ b/tests/tcg/multiarch/linux-test.c @@ -16,7 +16,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ -#define _GNU_SOURCE #include #include #include @@ -31,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -39,13 +39,12 @@ #include #include #include -#include "qemu/cutils.h" #define TESTPATH "/tmp/linux-test.tmp" #define TESTPORT 7654 #define STACK_SIZE 16384 -void error1(const char *filename, int line, const char *fmt, ...) +static void error1(const char *filename, int line, const char *fmt, ...) { va_list ap; va_start(ap, fmt); @@ -56,7 +55,7 @@ void error1(const char *filename, int line, const char *fmt, ...) exit(1); } -int __chk_error(const char *filename, int line, int ret) +static int __chk_error(const char *filename, int line, int ret) { if (ret < 0) { error1(filename, line, "%m (ret=%d, errno=%d)", @@ -73,7 +72,7 @@ int __chk_error(const char *filename, int line, int ret) #define FILE_BUF_SIZE 300 -void test_file(void) +static void test_file(void) { int fd, i, len, ret; uint8_t buf[FILE_BUF_SIZE]; @@ -210,7 +209,7 @@ void test_file(void) chk_error(rmdir(TESTPATH)); } -void test_fork(void) +static void test_fork(void) { int pid, status; @@ -224,7 +223,7 @@ void test_fork(void) error("waitpid status=0x%x", status); } -void test_time(void) +static void test_time(void) { struct timeval tv, tv2; struct timespec ts, rem; @@ -251,34 +250,7 @@ void test_time(void) error("getrusage"); } -void pstrcpy(char *buf, int buf_size, const char *str) -{ - int c; - char *q = buf; - - if (buf_size <= 0) - return; - - for(;;) { - c = *str++; - if (c == 0 || q >= buf + buf_size - 1) - break; - *q++ = c; - } - *q = '\0'; -} - -/* strcat and truncate. */ -char *pstrcat(char *buf, int buf_size, const char *s) -{ - int len; - len = strlen(buf); - if (len < buf_size) - pstrcpy(buf + len, buf_size - len, s); - return buf; -} - -int server_socket(void) +static int server_socket(void) { int val, fd; struct sockaddr_in sockaddr; @@ -298,7 +270,7 @@ int server_socket(void) } -int client_socket(void) +static int client_socket(void) { int fd; struct sockaddr_in sockaddr; @@ -312,9 +284,9 @@ int client_socket(void) return fd; } -const char socket_msg[] = "hello socket\n"; +static const char socket_msg[] = "hello socket\n"; -void test_socket(void) +static void test_socket(void) { int server_fd, client_fd, fd, pid, ret, val; struct sockaddr_in sockaddr; @@ -348,9 +320,10 @@ void test_socket(void) chk_error(close(server_fd)); } +#if 0 #define WCOUNT_MAX 512 -void test_pipe(void) +static void test_pipe(void) { fd_set rfds, wfds; int fds[2], fd_max, ret; @@ -391,10 +364,10 @@ void test_pipe(void) chk_error(close(fds[1])); } -int thread1_res; -int thread2_res; +static int thread1_res; +static int thread2_res; -int thread1_func(void *arg) +static int thread1_func(void *arg) { int i; for(i=0;i<5;i++) { @@ -404,7 +377,7 @@ int thread1_func(void *arg) return 0; } -int thread2_func(void *arg) +static int thread2_func(void *arg) { int i; for(i=0;i<6;i++) { @@ -435,27 +408,28 @@ void test_clone(void) thread2_res != 6) error("clone"); } +#endif /***********************************/ volatile int alarm_count; jmp_buf jmp_env; -void sig_alarm(int sig) +static void sig_alarm(int sig) { if (sig != SIGALRM) error("signal"); alarm_count++; } -void sig_segv(int sig, siginfo_t *info, void *puc) +static void sig_segv(int sig, siginfo_t *info, void *puc) { if (sig != SIGSEGV) error("signal"); longjmp(jmp_env, 1); } -void test_signal(void) +static void test_signal(void) { struct sigaction act; struct itimerval it, oit; @@ -510,7 +484,7 @@ void test_signal(void) #define SHM_SIZE 32768 -void test_shm(void) +static void test_shm(void) { void *ptr; int shmid;