git: fe920a4f2f80 - main - libsys: move errno to libsys

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 21 Feb 2024 00:29:25 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=fe920a4f2f80fda4a24c3991de0d593e06ae7f6f

commit fe920a4f2f80fda4a24c3991de0d593e06ae7f6f
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-02-20 15:13:09 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-02-21 00:26:11 +0000

    libsys: move errno to libsys
    
    Before, the 'errno' itself was defined in libc and was referenced by
    libsys, causing undesired dependency.
    
    Reviewed by:    brooks, imp
    Sponsored by:   The FreeBSD Foundation
    Differential revision:  https://reviews.freebsd.org/D43985
---
 lib/libc/gen/Makefile.inc |  1 -
 lib/libc/gen/Symbol.map   |  1 -
 lib/libc/gen/errno.c      | 29 -----------------------------
 lib/libsys/Symbol.sys.map |  1 +
 lib/libsys/__error.c      |  2 +-
 5 files changed, 2 insertions(+), 32 deletions(-)

diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index ce7a34d0e58e..648ddc76e056 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -47,7 +47,6 @@ SRCS+= \
 	erand48.c \
 	err.c \
 	errlst.c \
-	errno.c \
 	eventfd.c \
 	exec.c \
 	exect.c \
diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map
index 0821563e0c9f..7b002941ea4e 100644
--- a/lib/libc/gen/Symbol.map
+++ b/lib/libc/gen/Symbol.map
@@ -99,7 +99,6 @@ FBSD_1.0 {
 	vwarnx;
 	sys_errlist;
 	sys_nerr;
-	errno;
 	exect;
 	execl;
 	execle;
diff --git a/lib/libc/gen/errno.c b/lib/libc/gen/errno.c
deleted file mode 100644
index d35a481dff3f..000000000000
--- a/lib/libc/gen/errno.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
- * Copyright (c) 2002 Peter Wemm <peter@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-int errno;
diff --git a/lib/libsys/Symbol.sys.map b/lib/libsys/Symbol.sys.map
index d59ac8674669..4b9373ffa773 100644
--- a/lib/libsys/Symbol.sys.map
+++ b/lib/libsys/Symbol.sys.map
@@ -76,6 +76,7 @@ FBSD_1.0 {
 	extattr_set_file;
 	extattr_set_link;
 	extattrctl;
+	errno;
 	fchdir;
 	fchflags;
 	fchmod;
diff --git a/lib/libsys/__error.c b/lib/libsys/__error.c
index 7f2bf5713b1d..1132bdba9c65 100644
--- a/lib/libsys/__error.c
+++ b/lib/libsys/__error.c
@@ -31,7 +31,7 @@
 
 #include "libc_private.h"
 
-extern int errno;
+int errno;
 
 static int *
 __error_unthreaded(void)