From nobody Mon Feb 9 23:18:26 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504862581048755.0998443015189; Fri, 8 Sep 2017 02:23:01 -0700 (PDT) Received: from localhost ([::1]:44058 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqFV5-000204-RR for importer@patchew.org; Fri, 08 Sep 2017 05:22:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqFPw-0006Co-JR for qemu-devel@nongnu.org; Fri, 08 Sep 2017 05:17:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dqFPr-0000ix-76 for qemu-devel@nongnu.org; Fri, 08 Sep 2017 05:17:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57990) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dqFPq-0000hp-UW for qemu-devel@nongnu.org; Fri, 08 Sep 2017 05:17:35 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0395D356E8; Fri, 8 Sep 2017 09:17:34 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-98.pek2.redhat.com [10.72.12.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 74AC960241; Fri, 8 Sep 2017 09:17:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0395D356E8 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=famz@redhat.com From: Fam Zheng To: qemu-devel@nongnu.org Date: Fri, 8 Sep 2017 17:16:58 +0800 Message-Id: <20170908091700.14867-6-famz@redhat.com> In-Reply-To: <20170908091700.14867-1-famz@redhat.com> References: <20170908091700.14867-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 08 Sep 2017 09:17:34 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH RFC 5/7] tests: 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: peter.maydell@linaro.org, thuth@redhat.com, Fam Zheng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , programmingkidx@gmail.com, crosa@redhat.com, pbonzini@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" To keep the compiler happy, and to fit in our buildsys flags: - Include "qemu/osdep.h" first - Make local functions "static" - #ifdef out unused functions Signed-off-by: Fam Zheng --- tests/tcg/linux-test.c | 67 +++++++++++++++++-----------------------------= ---- 1 file changed, 22 insertions(+), 45 deletions(-) diff --git a/tests/tcg/linux-test.c b/tests/tcg/linux-test.c index 5070d31446..2a7b8c2d05 100644 --- a/tests/tcg/linux-test.c +++ b/tests/tcg/linux-test.c @@ -17,6 +17,7 @@ * along with this program; if not, see . */ #define _GNU_SOURCE +#include "qemu/osdep.h" #include #include #include @@ -31,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -45,7 +47,7 @@ #define TESTPORT 7654 #define STACK_SIZE 16384 =20 -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 +58,7 @@ void error1(const char *filename, int line, const char *f= mt, ...) exit(1); } =20 -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=3D%d, errno=3D%d)", @@ -73,7 +75,7 @@ int __chk_error(const char *filename, int line, int ret) =20 #define FILE_BUF_SIZE 300 =20 -void test_file(void) +static void test_file(void) { int fd, i, len, ret; uint8_t buf[FILE_BUF_SIZE]; @@ -210,7 +212,7 @@ void test_file(void) chk_error(rmdir(TESTPATH)); } =20 -void test_fork(void) +static void test_fork(void) { int pid, status; =20 @@ -224,7 +226,7 @@ void test_fork(void) error("waitpid status=3D0x%x", status); } =20 -void test_time(void) +static void test_time(void) { struct timeval tv, tv2; struct timespec ts, rem; @@ -251,34 +253,7 @@ void test_time(void) error("getrusage"); } =20 -void pstrcpy(char *buf, int buf_size, const char *str) -{ - int c; - char *q =3D buf; - - if (buf_size <=3D 0) - return; - - for(;;) { - c =3D *str++; - if (c =3D=3D 0 || q >=3D buf + buf_size - 1) - break; - *q++ =3D c; - } - *q =3D '\0'; -} - -/* strcat and truncate. */ -char *pstrcat(char *buf, int buf_size, const char *s) -{ - int len; - len =3D 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 +273,7 @@ int server_socket(void) =20 } =20 -int client_socket(void) +static int client_socket(void) { int fd; struct sockaddr_in sockaddr; @@ -312,9 +287,9 @@ int client_socket(void) return fd; } =20 -const char socket_msg[] =3D "hello socket\n"; +static const char socket_msg[] =3D "hello socket\n"; =20 -void test_socket(void) +static void test_socket(void) { int server_fd, client_fd, fd, pid, ret, val; struct sockaddr_in sockaddr; @@ -348,9 +323,10 @@ void test_socket(void) chk_error(close(server_fd)); } =20 +#if 0 #define WCOUNT_MAX 512 =20 -void test_pipe(void) +static void test_pipe(void) { fd_set rfds, wfds; int fds[2], fd_max, ret; @@ -391,10 +367,10 @@ void test_pipe(void) chk_error(close(fds[1])); } =20 -int thread1_res; -int thread2_res; +static int thread1_res; +static int thread2_res; =20 -int thread1_func(void *arg) +static int thread1_func(void *arg) { int i; for(i=3D0;i<5;i++) { @@ -404,7 +380,7 @@ int thread1_func(void *arg) return 0; } =20 -int thread2_func(void *arg) +static int thread2_func(void *arg) { int i; for(i=3D0;i<6;i++) { @@ -435,27 +411,28 @@ void test_clone(void) thread2_res !=3D 6) error("clone"); } +#endif =20 /***********************************/ =20 volatile int alarm_count; jmp_buf jmp_env; =20 -void sig_alarm(int sig) +static void sig_alarm(int sig) { if (sig !=3D SIGALRM) error("signal"); alarm_count++; } =20 -void sig_segv(int sig, siginfo_t *info, void *puc) +static void sig_segv(int sig, siginfo_t *info, void *puc) { if (sig !=3D SIGSEGV) error("signal"); longjmp(jmp_env, 1); } =20 -void test_signal(void) +static void test_signal(void) { struct sigaction act; struct itimerval it, oit; @@ -510,7 +487,7 @@ void test_signal(void) =20 #define SHM_SIZE 32768 =20 -void test_shm(void) +static void test_shm(void) { void *ptr; int shmid; --=20 2.13.5