parent
8d10e61144
commit
1ca5ccee9c
|
@ -0,0 +1,54 @@
|
|||
commit a4551b7f6ce08317220a8cd79cd3d02a03648752
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Wed Jul 13 11:50:04 2016 +0200
|
||||
|
||||
sln: Preprocessor cleanups
|
||||
|
||||
diff --git a/elf/sln.c b/elf/sln.c
|
||||
index f52cb9f..fa4ccec 100644
|
||||
--- a/elf/sln.c
|
||||
+++ b/elf/sln.c
|
||||
@@ -16,10 +16,6 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
-#ifdef HAVE_CONFIG_H
|
||||
-# include "config.h"
|
||||
-#endif
|
||||
-
|
||||
#include <error.h>
|
||||
#include <errno.h>
|
||||
#include <libintl.h>
|
||||
@@ -37,10 +33,6 @@
|
||||
|
||||
#define PACKAGE _libc_intl_domainname
|
||||
|
||||
-#if !defined S_ISDIR && defined S_IFDIR
|
||||
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
-#endif
|
||||
-
|
||||
static int makesymlink (const char *src, const char *dest);
|
||||
static int makesymlinks (const char *file);
|
||||
static void usage (void);
|
||||
@@ -89,9 +81,6 @@ usage (void)
|
||||
static int
|
||||
makesymlinks (const char *file)
|
||||
{
|
||||
-#ifndef PATH_MAX
|
||||
-#define PATH_MAX 4095
|
||||
-#endif
|
||||
char *buffer = NULL;
|
||||
size_t bufferlen = 0;
|
||||
int ret;
|
||||
@@ -190,11 +179,7 @@ makesymlink (const char *src, const char *dest)
|
||||
return -1;
|
||||
}
|
||||
|
||||
-#ifdef S_ISLNK
|
||||
if (symlink (src, dest) == 0)
|
||||
-#else
|
||||
- if (link (src, dest) == 0)
|
||||
-#endif
|
||||
{
|
||||
/* Destination must exist by now. */
|
||||
if (access (dest, F_OK))
|
|
@ -0,0 +1,164 @@
|
|||
commit 9f9503b56a8c7566c91d486a67be5d41792a87ca
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Wed Jul 13 14:06:00 2016 +0200
|
||||
|
||||
sln: Install as a hard link to ldconfig
|
||||
|
||||
Implementing and sln and ldconfig with the same binary saves
|
||||
around 850 KiB from a glibc installation.
|
||||
|
||||
The sln program is implicitly tested during the build, so no test
|
||||
case is needed.
|
||||
|
||||
diff --git a/elf/Makefile b/elf/Makefile
|
||||
index 593403c..d90f21a 100644
|
||||
--- a/elf/Makefile
|
||||
+++ b/elf/Makefile
|
||||
@@ -70,12 +70,8 @@ install-others = $(inst_rtlddir)/$(rtld-installed-name)
|
||||
install-bin-script = ldd
|
||||
endif
|
||||
|
||||
-others = sprof sln
|
||||
+others = sprof
|
||||
install-bin = sprof
|
||||
-others-static = sln
|
||||
-install-rootsbin = sln
|
||||
-sln-modules := static-stubs
|
||||
-extra-objs += $(sln-modules:=.o)
|
||||
|
||||
ifeq (yes,$(use-ldconfig))
|
||||
ifeq (yes,$(build-shared))
|
||||
@@ -83,8 +79,16 @@ others-static += ldconfig
|
||||
others += ldconfig
|
||||
install-rootsbin += ldconfig
|
||||
|
||||
-ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon static-stubs
|
||||
+ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon static-stubs sln
|
||||
extra-objs += $(ldconfig-modules:=.o)
|
||||
+
|
||||
+# Install sln as a hard link to ldconfig.
|
||||
+install-others-programs += $(inst_rootsbindir)/sln
|
||||
+others: $(objpfx)sln
|
||||
+$(objpfx)sln: $(objpfx)ldconfig
|
||||
+ ln -f $< $@
|
||||
+$(inst_rootsbindir)/sln: $(inst_rootsbindir)/ldconfig
|
||||
+ ln -f $< $@
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -466,8 +470,6 @@ $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
|
||||
|
||||
$(objpfx)sprof: $(libdl)
|
||||
|
||||
-$(objpfx)sln: $(sln-modules:%=$(objpfx)%.o)
|
||||
-
|
||||
$(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
|
||||
|
||||
SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
|
||||
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
|
||||
index 467ca82..972737c 100644
|
||||
--- a/elf/ldconfig.c
|
||||
+++ b/elf/ldconfig.c
|
||||
@@ -44,6 +44,8 @@
|
||||
|
||||
#include <dl-procinfo.h>
|
||||
|
||||
+#include "sln.h"
|
||||
+
|
||||
#ifdef _DL_FIRST_PLATFORM
|
||||
# define _DL_FIRST_EXTRA (_DL_FIRST_PLATFORM + _DL_PLATFORMS_COUNT)
|
||||
#else
|
||||
@@ -1275,6 +1277,9 @@ main (int argc, char **argv)
|
||||
/* Set the text message domain. */
|
||||
textdomain (_libc_intl_domainname);
|
||||
|
||||
+ if (run_sln (argv[0]))
|
||||
+ return sln_main (argc, argv);
|
||||
+
|
||||
/* Parse and process arguments. */
|
||||
int remaining;
|
||||
argp_parse (&argp, argc, argv, 0, &remaining, NULL);
|
||||
diff --git a/elf/sln.c b/elf/sln.c
|
||||
index fa4ccec..c6889d7 100644
|
||||
--- a/elf/sln.c
|
||||
+++ b/elf/sln.c
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* `sln' program to create symbolic links between files.
|
||||
+/* sln helper to create symbolic links between files, invoked from ldconfig.
|
||||
Copyright (C) 1998-2016 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
@@ -31,21 +31,29 @@
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
-#define PACKAGE _libc_intl_domainname
|
||||
+#include "sln.h"
|
||||
|
||||
static int makesymlink (const char *src, const char *dest);
|
||||
static int makesymlinks (const char *file);
|
||||
static void usage (void);
|
||||
|
||||
-int
|
||||
-main (int argc, char **argv)
|
||||
+/* Check if we have to run sln. */
|
||||
+bool
|
||||
+run_sln (const char *argv0)
|
||||
{
|
||||
- /* Set locale via LC_ALL. */
|
||||
- setlocale (LC_ALL, "");
|
||||
-
|
||||
- /* Set the text message domain. */
|
||||
- textdomain (PACKAGE);
|
||||
+ const char *slash = strrchr (argv0, '/');
|
||||
+ const char *progname;
|
||||
+ if (slash == NULL)
|
||||
+ progname = argv0;
|
||||
+ else
|
||||
+ progname = slash + 1;
|
||||
+ return strcmp (progname, "sln") == 0;
|
||||
+}
|
||||
|
||||
+/* Invoked from ldconfig. */
|
||||
+int
|
||||
+sln_main (int argc, char **argv)
|
||||
+{
|
||||
switch (argc)
|
||||
{
|
||||
case 2:
|
||||
diff --git a/elf/sln.h b/elf/sln.h
|
||||
new file mode 100644
|
||||
index 0000000..a3a16ab
|
||||
--- /dev/null
|
||||
+++ b/elf/sln.h
|
||||
@@ -0,0 +1,30 @@
|
||||
+/* Interface of the sln command-line tool.
|
||||
+ Copyright (C) 2016 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, see
|
||||
+ <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#ifndef SLN_H
|
||||
+#define SLN_H
|
||||
+
|
||||
+#include <stdbool.h>
|
||||
+
|
||||
+/* Return true if main should invoke sln_main. */
|
||||
+bool run_sln (const char *argv0);
|
||||
+
|
||||
+/* Main routine of the sln command. */
|
||||
+int sln_main (int argc, char **argv);
|
||||
+
|
||||
+#endif /* SLN_H */
|
|
@ -301,6 +301,10 @@ Patch2039: glibc-rh1344830.patch
|
|||
# Upstream BZ 20313
|
||||
Patch2110: glibc-rh1351108-update-to-unicode-9.0.0.patch
|
||||
|
||||
# sln implemented by ldconfig, to conserve disk space.
|
||||
Patch2111: glibc-rh1315476-1.patch
|
||||
Patch2112: glibc-rh1315476-2.patch
|
||||
|
||||
##############################################################################
|
||||
# End of glibc patches.
|
||||
##############################################################################
|
||||
|
@ -780,6 +784,8 @@ microbenchmark tests on the system.
|
|||
%patch2038 -p1
|
||||
%patch2039 -p1
|
||||
%patch2110 -p1
|
||||
%patch2111 -p1
|
||||
%patch2112 -p1
|
||||
|
||||
##############################################################################
|
||||
# %%prep - Additional prep required...
|
||||
|
@ -2077,6 +2083,7 @@ rm -f *.filelist*
|
|||
- Auto-sync with upstream master, commit
|
||||
f531f93056b34800383c5154280e7ba5112563c7.
|
||||
- Add de_LI.UTF-8 locale.
|
||||
- Make ldconfig and sln the same binary. (#1315476)
|
||||
|
||||
* Fri Jul 08 2016 Mike FABIAN <mfabian@redhat.com> - 2.23.90-27
|
||||
- Unicode 9.0.0 updates (ctype, charmap, transliteration) (#1351108)
|
||||
|
|
Loading…
Reference in New Issue