From nobody Wed Feb 21 03:38:28 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 4Tfhnc4x6vz5BJ7D; Wed, 21 Feb 2024 03:38:28 +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 4Tfhnc46kBz4WDk; Wed, 21 Feb 2024 03:38:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708486708; 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=QOxvzMCA2pWhdVXA82CsUvOG5kIabyT5W+6Vkdxxh3w=; b=a1QFZMt88Z7sy1uT1hOQvVq6YnglxCVf4o3maSQKQuKZhESOk0FxBAhGHoeEpqohMWcuU3 ADTfkLS5fOl2gRpHhPcE8huZ9DkoWPBqO+PF8rKJ/xKdsHhh37NFIYWewX9MWTFz+y7JVk qVdZNBtmlcxcI6tolkE/P7EQ5yTh9/9ANargc7hC73mZPyvs9a2UwvfD4uaV/Fd0PzY9kP OzgFdSiLbWC5LKVOH1KS8lKKz6E2Uh7WDJ97avJBAPtXu3x2vncRUOjE+E2Jvozv+axaQu q+kDD9BnC+T1zc3eEuBbHuUBSv3Fo8z5kPPRxAjARAwDK4Xoed8j8biW4BvE+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708486708; 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=QOxvzMCA2pWhdVXA82CsUvOG5kIabyT5W+6Vkdxxh3w=; b=EmHkmUA/EB0uuwJUvpXBcx5obxTc5P5aSKRZn/w+gew6MeGackiP+y1lJDUXcRkINHVCxT o5UKnLUQQ5iUoLn+SGNTfHIMcH1glmEJwzmaZhA/zyIvrHBwMUu/IwLZbz44ZUiHdH2q+S kbViiKAzGsokjX8CHTx1Wf3XhNQNSRHrrXpWOgOL+VY74jY8IVayhVRT6e5u+qlEQal0KH 8RK955vazyby0aos7YCKgZNl1cumzLtWxgdJrYbLT6fno0C3+LQJMT93U5OkG+uOwlEopV o1ivFfiAXm/qc4AtV2WVOuTsFJFyU5eDUDBoCYXqjvpJv1C9oambPr/7Sbzvkw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708486708; a=rsa-sha256; cv=none; b=NSR87rJjUGqgsC+Mx8xNUUCypYrVWvI1zTkzEC1+i6o79/zswV+QkZDmZmQ4K/qSWq/K4B u28nRRYjbEeiGMHCfVSLOtMvr2P7C6TUSpWtPpaSRDTWIwF+T90CEzY8tG6c2oCsS3JNMd 0IWpA8M0rUHx0QAwHB1jXCW2J+Tib0m/FS2+x2NN3kbc13aLefWFFe7JeOBQrDxntxg3cu 9yw8ORDc7yg1StKoM5bxuM6Ew1cp8PeFwIOWjVEOoZGjZEmUtae9XiC16k7FvY8VUs1vAb lq/LizjZI3NY4JKzgkVtnE6cstaS/ebMJI3T8KKMjpVxwtPKg0nDh/fa+4BTpA== 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 4Tfhnc3BP3zmrq; Wed, 21 Feb 2024 03:38:28 +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 41L3cSZ0021159; Wed, 21 Feb 2024 03:38:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41L3cSwL021156; Wed, 21 Feb 2024 03:38:28 GMT (envelope-from git) Date: Wed, 21 Feb 2024 03:38:28 GMT Message-Id: <202402210338.41L3cSwL021156@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 9a5aaa97cbae - main - loader: For the mini-stdio we have for lua, #define them to something else 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9a5aaa97cbae024f90bb626f78c3dbde28653c58 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9a5aaa97cbae024f90bb626f78c3dbde28653c58 commit 9a5aaa97cbae024f90bb626f78c3dbde28653c58 Author: Warner Losh AuthorDate: 2024-02-21 03:31:50 +0000 Commit: Warner Losh CommitDate: 2024-02-21 03:31:50 +0000 loader: For the mini-stdio we have for lua, #define them to something else To make it easier to port lua and some of the lua modules, we have a series of routines to implement the stdio routines, even though we don't normally implement them in the boot loader. Add a comment to this effect. Also, some tools, like sanitizers and static analysis tools, make unwarranted assumptions about these, so #define them to a different name so they stop. Sponsored by: Netflix --- stand/liblua/lstd.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/stand/liblua/lstd.h b/stand/liblua/lstd.h index 05a8b8843d9c..ce3aef4bc5fc 100644 --- a/stand/liblua/lstd.h +++ b/stand/liblua/lstd.h @@ -34,6 +34,15 @@ #include #include +/* + * Mini stdio FILE and DIR routines. These are the minimal routines needed by + * the lfs module and lua's base code. We define them minimally here so we don't + * have to modify lua on every import. Further, since they aren't completely + * standard, we #define them to other names so they don't conflict with other + * tooling that makes assumptions about these routines that might not be, in + * fact, correct. + */ + typedef struct FILE { int fd; @@ -46,6 +55,18 @@ typedef struct DIR int fd; } DIR; +#define fopen lua_loader_fopen +#define freopen lua_loader_freopen +#define fread lua_loader_fread +#define fwrite lua_loader_fwrite +#define fclose lua_loader_fclose +#define ferror lua_loader_ferror +#define feof lua_loader_feof +#define getc lua_loader_getc +#define opendir lua_loader_opendir +#define fdopendir lua_loader_fdopendir +#define closedir lua_loader_closedir + FILE *fopen(const char *filename, const char *mode); FILE *freopen( const char *filename, const char *mode, FILE *stream); size_t fread(void *ptr, size_t size, size_t count, FILE *stream);