From patchwork Fri Jun 8 12:32:28 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: 137976 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp836111lji; Fri, 8 Jun 2018 05:54:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLrqmZsSrPsWG3nxKp1N+NMTJwgChWprrYv92ZYb+74HBjqS3XPgrcFu32AaO2fyTrB+kcs X-Received: by 2002:ac8:33cf:: with SMTP id d15-v6mr5942350qtb.261.1528462474491; Fri, 08 Jun 2018 05:54:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528462474; cv=none; d=google.com; s=arc-20160816; b=ysYztwz/CFBmcTgKxFz68rqxgxb9t2d5lTHyZHUtsVDS89p1OP3AszV6iIYZ39jKyD balwt5cYtklcVZB7MPveTzWEaIdsv+7BATjrpmyCJOw4AKfHM21Fgn0o3Nb+RaI136Oj XRyDB6OYS3EheOq9yKzX2ZqF1cYAuF7vFdTjB0lzFGPFu5+LuQPx7N4PQA4b62mpoQZq faGwf64L0C8UsvtaD72NkIJDVkFRQYKAVwNEw10ZLYyevIIJijbwBtywYIek98SSg5Pa Nly4PxW9DutCQC3t5MXiT7U5OzdnrpBJ6ZxGb+7eYOPgZo14Eo8wN2oXbIUvrLCN7ELj yLLQ== 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=1QcK4F/pzBjEIcLo7xpk+NmEvJypaJEaoEwy5nuua3I=; b=hk1J3IryKjsuxavzYHU84BEEYfa/d7G83orQs2gMuOqo0FFLF58REGQNA+4trfrfeg 28cbaejSKDDD1wOWRPCVhnjSZrrt77Oq5MQaZsxKhcmDMYNlqZ55eLAWeOAeCuxLJMnt KSL70yc0jeOvhULXjS0CGs0IRmuPyh0JXre3XytarGV4vL3DRfab9eZC0ryBKyDLXsKl 3kt2ZpD12o5EcSrWu3m5kHfm8J4vSwxW4ulueITTW0DGamJUa5RaXFycYgnHOynBnb18 1vVGav86ifRiNyFMxG9nn9pAk3oUmtLSI3Eo2LYLp/WxgCcbWI32ZYTGiv860XS77kHZ 3q6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dpBL25JF; 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 m6-v6si7793699qkb.400.2018.06.08.05.54.34 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 08 Jun 2018 05:54:34 -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=dpBL25JF; 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]:35470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRGuX-0001es-Vi for patch@linaro.org; Fri, 08 Jun 2018 08:54:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46742) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRGa2-0001Es-87 for qemu-devel@nongnu.org; Fri, 08 Jun 2018 08:33:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRGa0-0006GB-SW for qemu-devel@nongnu.org; Fri, 08 Jun 2018 08:33:22 -0400 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:52453) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRGa0-0006Fb-It for qemu-devel@nongnu.org; Fri, 08 Jun 2018 08:33:20 -0400 Received: by mail-wm0-x231.google.com with SMTP id p126-v6so3081111wmb.2 for ; Fri, 08 Jun 2018 05:33:20 -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=1QcK4F/pzBjEIcLo7xpk+NmEvJypaJEaoEwy5nuua3I=; b=dpBL25JF94j0VNVwV/JZTHQ6ofmrVQm1T1EF5QuksOX+WanGpnsTGDIlqpFbRyghxN dnCUfk2rMuox3y/6QeyxOQrAVWR5yKCgj9OLOE5qExIQtkwc8/nyAIXgGxjbuo77UKk3 L3fOQ5/Y6CHhXO1B3sRBHWnfuAZgIxrREFZTg= 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=1QcK4F/pzBjEIcLo7xpk+NmEvJypaJEaoEwy5nuua3I=; b=kQsiNT1zN+vpUzqRbId0wpCaBrnuDR6Dxi/hIobv4OjD/K+KAJWN9bk1Hc9uKsGunr gij1zB5XpSMiODJrNOtRDoSxez/GeZAAR4TyweGzS/J7qRaVH/Wmsz3xpaQfzjt0NerY gUoxjYtOnKgphJZvoR/rIGoV20Qu5vI9AwBBsQcWGEnJ2l/lpvTHK1V30QcUS8reH8FH iP/cERLToIh4NRjPPi2O8LtvLw8bwFVtjWWi7E4tmaah7sRJmjX04feSZQu9BukIsIsh kH8dgfFY2LZQFHrweAgGfgBtpu7ze+RpguuXdQJuwNkdIKDBFUIksioeXG1OVa7UY6BZ FcqA== X-Gm-Message-State: APt69E27fJbYJmxB/EBn4MTA1Z6hUh6WLDOMbZMUbKmzhywnX4JT8Fgo y/EeqyKmdIN+59xbaxzHL5TubQ== X-Received: by 2002:a1c:256:: with SMTP id 83-v6mr1558500wmc.41.1528461199419; Fri, 08 Jun 2018 05:33:19 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id l84-v6sm1894223wmi.3.2018.06.08.05.33.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Jun 2018 05:33:13 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id E09233E0489; Fri, 8 Jun 2018 13:33:07 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: cota@braap.org, famz@redhat.com, berrange@redhat.com, f4bug@amsat.org, richard.henderson@linaro.org, balrogg@gmail.com, aurelien@aurel32.net, agraf@suse.de, pbonzini@redhat.com, stefanha@redhat.com, stefanb@linux.vnet.ibm.com, marcandre.lureau@redhat.com Date: Fri, 8 Jun 2018 13:32:28 +0100 Message-Id: <20180608123307.24773-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180608123307.24773-1-alex.bennee@linaro.org> References: <20180608123307.24773-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] [PATCH v6 10/49] 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?= , qemu-devel@nongnu.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 Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- tests/tcg/multiarch/linux-test.c | 68 ++++++++++---------------------- 1 file changed, 21 insertions(+), 47 deletions(-) -- 2.17.1 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;