From patchwork Tue Jun 19 15:43:49 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: 931678 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Cu7OzXIV"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 419CBl0FYrz9s37 for ; Wed, 20 Jun 2018 01:51:59 +1000 (AEST) Received: from localhost ([::1]:43366 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVIvE-0003SN-OB for incoming@patchwork.ozlabs.org; Tue, 19 Jun 2018 11:51:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVIoM-0006e8-Jo for qemu-devel@nongnu.org; Tue, 19 Jun 2018 11:44:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVIoJ-0006Q3-DZ for qemu-devel@nongnu.org; Tue, 19 Jun 2018 11:44:50 -0400 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:55780) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fVIoJ-0006Pm-2s for qemu-devel@nongnu.org; Tue, 19 Jun 2018 11:44:47 -0400 Received: by mail-wm0-x231.google.com with SMTP id v16-v6so1146625wmh.5 for ; Tue, 19 Jun 2018 08:44:46 -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=vsF4LAvVx6Lz8hAJ8S/JCD2guENt6wij/9sOELtWrQI=; b=Cu7OzXIV4zw1FTYRDbczUKdAvSjgK37yr6JOpZSH917neXpFKgl7ssMI6QTreRwwfa NtiyXTmuEflc3mpxH5dkvwr6/zVrI4vuRmtjNfnuqZR9B2oxZVoj4Y/pBjmCHuo6WSMF +frVYGhJRBWo/UyqbKW907ev6JOHKictLpJs4= 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=vsF4LAvVx6Lz8hAJ8S/JCD2guENt6wij/9sOELtWrQI=; b=ud1Qo99HVweJAezNWySSM+hxQ0QCiLadiW+51Y36U7iAa2j6F7EoBYTiwBjt3/GBwm +2zRpGRnSxDfwrlipyGPFj5aK6FW3R3sslfrdjXuZt0q5SG210xfi4YgM2j6OKsN1HbL LOT5kIh/AdBz58NzJFDsHtnjEjvUTK7LKYnZ2nkB9kINw5j0qbxfbOwLO7kYo/4ayEJu UBY+du8qxu1uZNuuVpRnD94KKY1xI8R1jVWUWG8f+HsmxL9cJe3mhgnZTYg6voz283lU zUd36TrVKqcRq63PvjX0pczwrBxYYjPcytBE+ezzRCP3JJuqMGXTk3V96nGocWCCVUn8 jRfg== X-Gm-Message-State: APt69E2cmYFVc+wffJ8Xx9w1wjIe//pkHUdR34d6GxWWlgvssbKM6Dmu eFxcx7ckcPBIoZz4Tj4mITg7/A== X-Google-Smtp-Source: ADUXVKKEDXCSHnLGiy6Q6fV8PC2FB/MX9jYKVksH9Wne5Tk3Lvm/Ig2S3Y9yNq8PcTiIrt0yWA+VCw== X-Received: by 2002:a1c:9b04:: with SMTP id d4-v6mr11860926wme.8.1529423085965; Tue, 19 Jun 2018 08:44:45 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id e188-v6sm718239wmf.21.2018.06.19.08.44.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Jun 2018 08:44:40 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 51EE73E0A25; Tue, 19 Jun 2018 16:44:36 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Tue, 19 Jun 2018 16:43:49 +0100 Message-Id: <20180619154435.18898-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180619154435.18898-1-alex.bennee@linaro.org> References: <20180619154435.18898-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:c09::231 Subject: [Qemu-devel] [PULL 10/56] 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: agraf@suse.de, =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, qemu-devel@nongnu.org, f4bug@amsat.org, cota@braap.org, famz@redhat.com, aurelien@aurel32.net Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.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 Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson 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;