From nobody Sat Feb 24 06:26:43 2024 X-Original-To: dev-commits-src-main@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 4ThcNN09TCz5C7cY; Sat, 24 Feb 2024 06:26:44 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ThcNM6QPXz44KS; Sat, 24 Feb 2024 06:26:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708756003; 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=SWbObpOEGtOmCBUnSzeUNvOko4g7moATDBYpZi2pPIY=; b=uP0Hj1kokUQSCu2XI8dxKhibuHxPDFuqbdYz4wiiJloPcBEbC8buQSH4sEACJrMzphd0Kz TmLOAtQsrxv1p9u5hjBmsUmyub1u0VvWkZ17EqO+rDvSIVzhtBKu8/Y5GLnIvi0vjDSwS0 Ka9aYWO329OLwUU1Uk5w1xKcrrE885QJ5++JFPzuYPpncZibHBc/GbEQcxV39qHRQg7v+I B8UvsFhMIiNhjSH+N24zZc1AD08GkBnIqtySTBgg712nS569AlbZCQpIgO8hE72EPEmtuP 0Bprm8HtY9BgcS7blXWZ1mOhSjHhGK/Z/QcZExsYzpXUBz4d40W9p3SKG/Wt0Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708756003; a=rsa-sha256; cv=none; b=Hfr+q7BlZNECmxwO+LonYagn1VDDMao307ep9209JmrTGH/K0RuulR7o8K6l6zmx31YP0M k8AD/I7V+23LqTnloWkIc+LEphUWDO9m3wDFjbJxprWB9jX82OdRBQ9b+LurvuvV5XHFiK XEdbCkKxKD4K35qcGqSRg/n7JY7eNZlzzYuNfIjxZ4DOPX5eI1Bi/Sfmx1JWtDy2dhmjP0 OE05Km6h6Q3IAg1E5e1bDScenmOjkP8z2L1wlXMgKnua/hwW13l85k4C5y/KvoO+t0DUYL mkk4ldZjodQbk16B5CArHIr/KY1UjnnHS5OFN6gab70OiOj+xh17XzOmVcfg5A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708756003; 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=SWbObpOEGtOmCBUnSzeUNvOko4g7moATDBYpZi2pPIY=; b=BcLIIIKv31+vq/vwdlXFW2kEaTVlHCYrYCQ10ds11D0ib1ghub7n37Nbh5JYhvz08qyu43 8BLezjFUOOvHj0PAzP3dfW15onOmufd+NnhMD7Bf29QMX9WgxfW1zte73RZX709dSPIETQ CmqBqvS7JjxI8tm2Oqc5C/Cuow32d6VHfJS2s1fk4SvvmrZbkVZO8wKLg6tvYbZkxpAel2 tdUnd4euY65uTmWi9AxiTiobKHqlAtwXqVBFpDx1R/Rgc+qtred19bTw3L3s71tKthP241 eluPKGMPHN3UmPoPMWWqTkJZ5tWD44RST4nbij0MxjwvCgXxbFtAStFjztWD+w== 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 4ThcNM5HgyzpnH; Sat, 24 Feb 2024 06:26:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41O6QhfM088345; Sat, 24 Feb 2024 06:26:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41O6QhqQ088342; Sat, 24 Feb 2024 06:26:43 GMT (envelope-from git) Date: Sat, 24 Feb 2024 06:26:43 GMT Message-Id: <202402240626.41O6QhqQ088342@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: d19f34821d66 - main - stress2: Add a helper tool List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d19f34821d661468486bdf4cacc9be795ac58780 Auto-Submitted: auto-generated The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=d19f34821d661468486bdf4cacc9be795ac58780 commit d19f34821d661468486bdf4cacc9be795ac58780 Author: Peter Holm AuthorDate: 2024-02-24 06:26:16 +0000 Commit: Peter Holm CommitDate: 2024-02-24 06:26:16 +0000 stress2: Add a helper tool --- tools/test/stress2/tools/serial.c | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tools/test/stress2/tools/serial.c b/tools/test/stress2/tools/serial.c new file mode 100644 index 000000000000..8dcf9c5da3a8 --- /dev/null +++ b/tools/test/stress2/tools/serial.c @@ -0,0 +1,44 @@ +/* Fill a file with a sequence of byte values from 0 - 0xff */ + +#include +#include +#include +#include +#include +#include +#include + +int +main(int argc, char *argv[]) +{ + size_t i, size; + int fd; + char *cp, *file; + + if (argc != 3) { + fprintf(stderr, "Usage: %s \n", argv[0]); + exit(1); + } + file = argv[1]; + size = atol(argv[2]); + + if ((fd = open(file, O_RDWR | O_CREAT | O_TRUNC, 0600)) < 0) + err(1, "%s", file); + + if (lseek(fd, size - 1, SEEK_SET) == -1) + err(1, "lseek error"); + + /* write a dummy byte at the last location */ + if (write(fd, "\0", 1) != 1) + err(1, "write error"); + + if ((cp = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == MAP_FAILED) + err(1, "mmap()"); + + for (i = 0; i < size; i++) + cp[i] = i & 0xff; + + if (munmap(cp, size) == -1) + err(1, "munmap"); + close(fd); +}