From nobody Sun Feb 8 14:35:22 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 1499864826904221.44390288786155; Wed, 12 Jul 2017 06:07:06 -0700 (PDT) Received: from localhost ([::1]:52657 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVHM2-0005pj-Bm for importer@patchew.org; Wed, 12 Jul 2017 09:06:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42371) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVH6A-0008Uh-2K for qemu-devel@nongnu.org; Wed, 12 Jul 2017 08:50:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVH69-0004WJ-D3 for qemu-devel@nongnu.org; Wed, 12 Jul 2017 08:50:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14984) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVH69-0004Vw-77 for qemu-devel@nongnu.org; Wed, 12 Jul 2017 08:50:33 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A3EFDC0587E8; Wed, 12 Jul 2017 12:50:31 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-117-62.ams2.redhat.com [10.36.117.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id B75E26DB95; Wed, 12 Jul 2017 12:50:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A3EFDC0587E8 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=thuth@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A3EFDC0587E8 From: Thomas Huth To: qemu-devel@nongnu.org, Christian Borntraeger , Cornelia Huck Date: Wed, 12 Jul 2017 14:49:46 +0200 Message-Id: <1499863793-18627-5-git-send-email-thuth@redhat.com> In-Reply-To: <1499863793-18627-1-git-send-email-thuth@redhat.com> References: <1499863793-18627-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 12 Jul 2017 12:50:32 +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 v5 04/11] pc-bios/s390-ccw: Add a write() function for stdio 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: Viktor Mihajlovski , Farhan Ali , Alexander Graf , David Hildenbrand 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" The stdio functions from the SLOF libc need a write() function for printing text to stdout/stderr. Let's implement this function by refactoring the code from sclp_print(). Acked-by: Cornelia Huck Reviewed-by: David Hildenbrand Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/sclp.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pc-bios/s390-ccw/sclp.c b/pc-bios/s390-ccw/sclp.c index 2ee204a..b1fc8ff 100644 --- a/pc-bios/s390-ccw/sclp.c +++ b/pc-bios/s390-ccw/sclp.c @@ -12,6 +12,8 @@ #include "s390-ccw.h" #include "sclp.h" =20 +long write(int fd, const void *str, size_t len); + static char _sccb[PAGE_SIZE] __attribute__((__aligned__(4096))); =20 const unsigned char ebc2asc[256] =3D @@ -71,11 +73,14 @@ static int _strlen(const char *str) return i; } =20 -void sclp_print(const char *str) +long write(int fd, const void *str, size_t len) { - int len =3D _strlen(str); WriteEventData *sccb =3D (void *)_sccb; =20 + if (fd !=3D 1 && fd !=3D 2) { + return -EIO; + } + sccb->h.length =3D sizeof(WriteEventData) + len; sccb->h.function_code =3D SCLP_FC_NORMAL_WRITE; sccb->ebh.length =3D sizeof(EventBufferHeader) + len; @@ -84,6 +89,13 @@ void sclp_print(const char *str) memcpy(sccb->data, str, len); =20 sclp_service_call(SCLP_CMD_WRITE_EVENT_DATA, sccb); + + return len; +} + +void sclp_print(const char *str) +{ + write(1, str, _strlen(str)); } =20 void sclp_get_loadparm_ascii(char *loadparm) --=20 1.8.3.1