From patchwork Fri Mar 9 13:47:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 131107 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1010342lja; Fri, 9 Mar 2018 05:48:17 -0800 (PST) X-Google-Smtp-Source: AG47ELuNYIMvlWu7Sdf8fgMsf/d7fweThRGF8MCqbXD/aiVrjvlq76rRtIMGN2j3U1PK4ZKo9tMV X-Received: by 10.167.131.135 with SMTP id u7mr23627691pfm.50.1520603297627; Fri, 09 Mar 2018 05:48:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520603297; cv=none; d=google.com; s=arc-20160816; b=G4durleiBzh+FkeI+dIYsvuiVvffwLv3YHeeHBownEDGInf618fLsFZj7ebLWQAU/f Z89FaPDucPR4y9nX1Gy6pCITOFbtHN8oe+Z8FJCuQgpv9jdrALN6ho+5EomiiJj47Y5u JRMN+epIvYkAoz3/MrtWTHnEu8hfo1+doeMYMWl3W2KzeztmQUaQPcQzfGCjSzPRy5UM AuuWhVYEZ5Vc/X3Qo0MF4hOVHKh4h+JwqEwcpqFzkbiswYsItgaRhbLJSCCMn89k3XsF WOhXI0y4G28Ft9XQokshsbuAE/MxFtQs1yUHNxfLWXG3o5MlafosdU8dF9cC5v4Yaetc GnSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=s/XUaEhQIHhKgB8j+5p5o7Uz0DZoguakwLYqCHYZ/nY=; b=DpN3skU9mR0Wqw0DCkfe9lL+SgAVuw6uPxZ/cYVW7yu6sSKKFSAwzIfgV6Xe3wGUSj ZDo/anmOXI2RlEgLs+AEGtnFk7pz9DD0Yl/UHsKwSkjszuodiCdewOJRivPjRj9xnlhc TPInshHtRQePpPJckb4LckIvNMwWXe3b0JgSgAl6Kr+U43zEANhIyaXLzDiC8JMacRuc 4CUEQqX6MPiJxqeWL3wbTeuLh8k7yWnSAupHbd1dhaXL+Wf5hR8bT7DKM4tSuWG/nSUr +ae9YUAfvRN0zhVVwbGQuuo+4ND6OkBAE3BSD3cQLiQxhFch+4pcHuZfGONQ3l/iqRgO Y93A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EYrRupQL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r12-v6si907416plo.359.2018.03.09.05.48.17; Fri, 09 Mar 2018 05:48:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EYrRupQL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932189AbeCINsN (ORCPT + 28 others); Fri, 9 Mar 2018 08:48:13 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:40159 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932133AbeCINsI (ORCPT ); Fri, 9 Mar 2018 08:48:08 -0500 Received: by mail-lf0-f66.google.com with SMTP id 37-v6so13267082lfs.7 for ; Fri, 09 Mar 2018 05:48:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=s/XUaEhQIHhKgB8j+5p5o7Uz0DZoguakwLYqCHYZ/nY=; b=EYrRupQLgsEHn2F5PHlHy5kATpybML8KVasxnhUzSUZCJSTwerafKio3v6LHo13pki QKIha8Bn2TA/Ez3Sf8HBQPAAYOpnKWZqQuF1lJuCouFYl3uHo+F7ZE+xJ9YJg5WTs6x+ mxHxH3h/fegxXhgkZMNiYS/zteZ8SkG1k6Wa0= 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:mime-version :content-transfer-encoding; bh=s/XUaEhQIHhKgB8j+5p5o7Uz0DZoguakwLYqCHYZ/nY=; b=qbJSLNHEKraWyc6cHxnuQFr9kw2J4RBlR+uDwnOj8cDj0Bz2MfVG/fjQHc4J4DfkY6 0tVBeLlJJNNkUvpnRmQhYZxZ+RiuVzcDfOU0xf2lRSumz5PDkfobrl5mncZlirA2vPe9 2NN9tNUBH7ObGmWLg07u6Pw1Jafa4dgLJgL/BU3Ad0LE7Dmg0Gu37kSvxZqMGcEcSOJ+ jInoPwVL2FWsIQBQGuKj7cveITO0mHPuht92RMfeM2bi5o5V/26SeM0IhcMxsxSVZs5N brC1iu6kpSUKbt7BZspkFAZ69fGOuajt/DypqtoaZ/P591Wk673QcWz4Ccj8qqYkQpwe p1uQ== X-Gm-Message-State: AElRT7Fbo+wTFiJd8SCTcEUIlXJQnIHiogWWVfABfm4rV/6RW+7hIaU+ Y/gkh4kNlDnyVIaC6gnHujCBKA== X-Received: by 10.25.143.209 with SMTP id s78mr22434813lfk.56.1520603286531; Fri, 09 Mar 2018 05:48:06 -0800 (PST) Received: from localhost (185-130-167-110.kund.ip-osteraker.se. [185.130.167.110]) by smtp.gmail.com with ESMTPSA id z24sm305542ljb.49.2018.03.09.05.48.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Mar 2018 05:48:05 -0800 (PST) From: Anders Roxell To: shuah@kernel.org Cc: skinsbursky@parallels.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Anders Roxell Subject: [PATCH] selftests/ipc/msgque: Fix warning implicit declaration Date: Fri, 9 Mar 2018 14:47:55 +0100 Message-Id: <20180309134755.11101-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org gcc warns about implicit declaration. gcc -I../../../../usr/include/ msgque.c -o msgque msgque.c: In function ‘restore_queue’: msgque.c:52:7: warning: implicit declaration of function ‘msgget’ [-Wimplicit-function-declaration] id = msgget(msgque->key, msgque->mode | IPC_CREAT | IPC_EXCL); ^~~~~~ msgque.c:66:7: warning: implicit declaration of function ‘msgsnd’ [-Wimplicit-function-declaration] if (msgsnd(msgque->msq_id, &msgque->messages[i].mtype, ^~~~~~ msgque.c:76:6: warning: implicit declaration of function ‘msgctl’ [-Wimplicit-function-declaration] if (msgctl(id, IPC_RMID, 0)) ^~~~~~ msgque.c: In function ‘check_and_destroy_queue’: msgque.c:87:9: warning: implicit declaration of function ‘msgrcv’ [-Wimplicit-function-declaration] ret = msgrcv(msgque->msq_id, &message.mtype, MAX_MSG_SIZE, ^~~~~~ msgque.c: In function ‘main’: msgque.c:204:15: warning: implicit declaration of function ‘ftok’ [-Wimplicit-function-declaration] msgque.key = ftok(argv[0], 822155650); ^~~~ In the current code, we include the headers that the functions want according to the man pages, and we define MSG_COPY if its not defined. We also use 'struct msqid_ds' instead of 'struct msqid64_ds'. I thought about another patch where I just forward declared these functions. However, I wasn't happy with that patch since it feels that it forces user space apps to do the same in order to get this to work. Another reason was that checkpatch.pl complained that I added forward declarations in the c file. Fixes: 3a665531a3b7 ("selftests: IPC message queue copy feature test") Signed-off-by: Anders Roxell --- tools/testing/selftests/ipc/msgque.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) -- 2.11.0 diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c index ee9382bdfadc..3e32917cd7f4 100644 --- a/tools/testing/selftests/ipc/msgque.c +++ b/tools/testing/selftests/ipc/msgque.c @@ -3,11 +3,18 @@ #include #include #include -#include #include +#include +#include +#include + #include "../kselftest.h" +#ifndef MSG_COPY +# define MSG_COPY 040000 /* copy (not remove) all queue messages */ +#endif + #define MAX_MSG_SIZE 32 struct msg1 { @@ -129,7 +136,7 @@ int check_and_destroy_queue(struct msgque_data *msgque) int dump_queue(struct msgque_data *msgque) { - struct msqid64_ds ds; + struct msqid_ds ds; int kern_id; int i, ret;