From nobody Sat Oct 12 18:30:23 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XQsVm2mMLz5YnjJ; Sat, 12 Oct 2024 18:30:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XQsVm1DJ3z4F2p; Sat, 12 Oct 2024 18:30:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728757824; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dPYmFKspLKqNzXZxRgBRWH1qhJE6+2FfLnwgIOyMdbU=; b=HrpHX/WTmaGObAT19L5XV8cGJaAoE8AeA+Fj5t5yR+AU5dpTPreJijuNdBkQM+nYgFzpnk 5kw6ith87ADGJsATFeMqt8o8SvNHs8M1D/MhjaLG3BE/jyMatS0fIeuvjKDUuLd1u/NI+L AOnTZZPaq7WH5amNCT90JQbrTqLHTT9oWDWzejpibOnqUWssSMSrd6Etw4GlJrd+5suo6R 7S4TxRSOo6td4BfFjKmMulyaTSz5LMvMP2VtYGoAY7H+fuUODOoxeDre7boKRat2M4L8VP r8UMdofigyEd60za7F38fE/LD5KNW/zjf3t7xfTBk+rjhco++v6K0M/7fY3MJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728757824; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dPYmFKspLKqNzXZxRgBRWH1qhJE6+2FfLnwgIOyMdbU=; b=OKmK5LQskaEBkv7aRVIKuEe2Qu1IQTkGetglgHrDohxir0Mk5fTcjPm8TAiUhzLIWYK0P5 N3xhjGq62qpoym5WgGPS9Duz4vxX8+hr1imGMQt6xcQXwA9JxoiRHFf1IBfBmaOv1GinBC EWkGQ7RBhxYvSLSM1423h45KENG7/WDIpEHaaNV65M0LJVh8F0J3M3V6JNFSQXQihe7jml BeWMAl2WMeZL7trfrfS01jb3QOqKYIAPYqNgyw9bzEjlbcuAvia6aL52lyXlkd6ykl0MCH 89BHLXSe0awAyJ8mZlsRAnfI4GO+dQ0ht6CaKY/tqH4mZ0XMh/XJFrKYk98xMw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728757824; a=rsa-sha256; cv=none; b=DwC/pz47kMKEhcE+erys4ijegD60jdFxKIu0L5PMabO0LZYEwj4fCM7TRoh0lMTd0S4ziw nxUYMxMxyjmjk/nveHpQ9SmPc6YfIRSQQ/yRgzu6LSUd2Cco9ZGMBXjkUY8ODev2CUKqSX 9tm+Mur6OaVpPeaP9ysdIOY4bz6sgt5Je+nDYoGLEdqhbkbUDJ8ZAAAND9Kvr95m7stNwj nRAdtp99BtQcBg684utsT4T4XrUlGyy+cPEJHvl9XLe92r90iMZxSbcYErSVqUBfjw2TOL ZlugY/3LhGCEji8AhF/qM5cnW+64/bnKoPOPGP9GPONJ42v9Rf2rK1ELyDecUg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XQsVm0jSfzLkX; Sat, 12 Oct 2024 18:30:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49CIUNBB092416; Sat, 12 Oct 2024 18:30:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49CIUNZ5092413; Sat, 12 Oct 2024 18:30:23 GMT (envelope-from git) Date: Sat, 12 Oct 2024 18:30:23 GMT Message-Id: <202410121830.49CIUNZ5092413@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: f5ee007c3939 - main - vmstat(8): Complete libxo transition List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f5ee007c39391ef6b1b273713d421a508f7fbc8b Auto-Submitted: auto-generated The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=f5ee007c39391ef6b1b273713d421a508f7fbc8b commit f5ee007c39391ef6b1b273713d421a508f7fbc8b Author: Yan-Hao Wang AuthorDate: 2024-10-12 15:24:46 +0000 Commit: Li-Wen Hsu CommitDate: 2024-10-12 18:21:47 +0000 vmstat(8): Complete libxo transition Reviewed by: des MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D41432 --- usr.bin/vmstat/vmstat.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c index 862cc4809fbe..680eb8bc8fde 100644 --- a/usr.bin/vmstat/vmstat.c +++ b/usr.bin/vmstat/vmstat.c @@ -49,7 +49,6 @@ #include #include -#include #include #include #include @@ -338,8 +337,9 @@ retry_nlist: xo_error("undefined symbols:\n", buf); } else xo_warnx("kvm_nlist: %s", kvm_geterr(kd)); - xo_finish(); - exit(1); + if (xo_finish() < 0) + xo_err(EXIT_FAILURE, "stdout"); + exit(EXIT_FAILURE); } nlist_ok: if (kd && Pflag) @@ -386,8 +386,9 @@ nlist_ok: if (todo & VMSTAT) dovmstat(interval, reps); xo_close_container("vmstat"); - xo_finish(); - exit(0); + if (xo_finish() < 0) + xo_err(EXIT_FAILURE, "stdout"); + exit(EXIT_SUCCESS); } static int @@ -796,7 +797,8 @@ dovmstat(unsigned int interval, int reps) else cpustats(); xo_emit("\n"); - xo_flush(); + if (xo_flush() < 0) + xo_err(EXIT_FAILURE, "stdout"); if (reps >= 0 && --reps <= 0) break; osum = sum; @@ -1192,7 +1194,7 @@ read_intrcnts(unsigned long **intrcnts) if (kd != NULL) { kread(X_SINTRCNT, &intrcntlen, sizeof(intrcntlen)); if ((*intrcnts = malloc(intrcntlen)) == NULL) - err(1, "malloc()"); + xo_err(1, "malloc()"); if (namelist[X_NINTRCNT].n_type == 0) kread(X_INTRCNT, *intrcnts, intrcntlen); else { @@ -1203,7 +1205,7 @@ read_intrcnts(unsigned long **intrcnts) for (*intrcnts = NULL, intrcntlen = 1024; ; intrcntlen *= 2) { *intrcnts = reallocf(*intrcnts, intrcntlen); if (*intrcnts == NULL) - err(1, "reallocf()"); + xo_err(1, "reallocf()"); if (mysysctl("hw.intrcnt", *intrcnts, &intrcntlen) == 0) break; } @@ -1311,7 +1313,8 @@ dointr(unsigned int interval, int reps) print_intrcnts(intrcnts, old_intrcnts, intrnames, nintr, istrnamlen, period_ms); - xo_flush(); + if (xo_flush() < 0) + xo_err(EXIT_FAILURE, "stdout"); free(old_intrcnts); old_intrcnts = intrcnts; @@ -1616,6 +1619,7 @@ usage(void) xo_error("%s%s", "usage: vmstat [-afHhimoPsz] [-M core [-N system]] [-c count] [-n devs]\n", " [-p type,if,pass] [-w wait] [disks] [wait [count]]\n"); - xo_finish(); - exit(1); + if (xo_finish() < 0) + xo_err(EXIT_FAILURE, "stdout"); + exit(EXIT_FAILURE); }