mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-06 01:57:40 +00:00
Remove expired port:
2021-03-10 sysutils/prelink: Have no users in the ports tree
This commit is contained in:
parent
2b22d35494
commit
f844bbfcca
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=568134
1
MOVED
1
MOVED
@ -16191,3 +16191,4 @@ www/moodle35|www/moodle39|2021-03-04|Has expired: Deprecated by upstream
|
||||
www/moodle38|www/moodle39|2021-03-04|Has expired: Deprecated by upstream
|
||||
devel/llvm60|devel/llvm80|2021-03-06|Has expired: Uses Python 2.7 which is EOLed upstream
|
||||
audio/fplib||2021-03-07|Dead service since 2015
|
||||
sysutils/prelink||2021-03-11|Has expired: Have no users in the ports tree
|
||||
|
@ -962,7 +962,6 @@
|
||||
SUBDIR += powermon
|
||||
SUBDIR += pp
|
||||
SUBDIR += pprotectd
|
||||
SUBDIR += prelink
|
||||
SUBDIR += prips
|
||||
SUBDIR += procenv
|
||||
SUBDIR += procmap
|
||||
|
@ -1,29 +0,0 @@
|
||||
# Created by: Damjan Jovanovic <damjan.jov@gmail.com>
|
||||
# $FreeBSD$
|
||||
|
||||
PORTNAME= prelink
|
||||
PORTVERSION= 20130503
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= sysutils
|
||||
MASTER_SITES= http://people.redhat.com/jakub/prelink/
|
||||
|
||||
MAINTAINER= damjan.jov@gmail.com
|
||||
COMMENT= ELF prelinking utility to speed up dynamic linking
|
||||
|
||||
DEPRECATED= Have no users in the ports tree
|
||||
EXPIRATION_DATE=2021-03-10
|
||||
|
||||
LIB_DEPENDS= libargp.so:devel/argp-standalone
|
||||
|
||||
USES= autoreconf gmake tar:bzip2 libtool
|
||||
GNU_CONFIGURE= yes
|
||||
CPPFLAGS+= -I${LOCALBASE}/include
|
||||
LDFLAGS+= -L${LOCALBASE}/lib
|
||||
|
||||
WRKSRC= ${WRKDIR}/${PORTNAME}
|
||||
PLIST_FILES= bin/execstack \
|
||||
man/man8/execstack.8.gz \
|
||||
man/man8/prelink.8.gz \
|
||||
sbin/prelink
|
||||
|
||||
.include <bsd.port.mk>
|
@ -1,2 +0,0 @@
|
||||
SHA256 (prelink-20130503.tar.bz2) = 6339c7605e9b6f414d1be32530c9c8011f38820d36431c8a62e8674ca37140f0
|
||||
SIZE (prelink-20130503.tar.bz2) = 928040
|
@ -1,25 +0,0 @@
|
||||
diff -Nur configure.in configure.in
|
||||
--- configure.in 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ configure.in 2013-02-19 23:57:04.000000000 +0200
|
||||
@@ -72,6 +72,11 @@
|
||||
AC_CHECK_LIB(selinux,is_selinux_enabled)
|
||||
AC_CHECK_HEADERS(selinux/selinux.h)
|
||||
|
||||
+AC_CHECK_HEADERS(endian.h sys/endian.h)
|
||||
+AC_CHECK_HEADERS(byteswap.h)
|
||||
+AC_CHECK_HEADERS(sys/xattr.h)
|
||||
+AC_CHECK_HEADERS(alloca.h)
|
||||
+
|
||||
dnl This test must come as early as possible after the compiler configuration
|
||||
dnl tests, because the choice of the file model can (in principle) affect
|
||||
dnl whether functions and headers are available, whether they work, etc.
|
||||
@@ -85,7 +85,7 @@
|
||||
AC_SYS_LARGEFILE
|
||||
fi
|
||||
|
||||
-AC_LIBELF_SXWORD
|
||||
+dnl AC_LIBELF_SXWORD
|
||||
|
||||
AC_OUTPUT([Makefile
|
||||
src/Makefile
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,14 +0,0 @@
|
||||
diff -Nur gelf/gelf.c gelf/gelf.c
|
||||
--- gelf/gelf.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ gelf/gelf.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -17,7 +17,9 @@
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <config.h>
|
||||
-#include <elf.h>
|
||||
+#include "elf.h"
|
||||
+#define _SYS_ELF32_H_ 1
|
||||
+#define _SYS_ELF64_H_ 1
|
||||
#include <libelf.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
@ -1,17 +0,0 @@
|
||||
diff -Nur gelfx/gelfx.h gelfx/gelfx.h
|
||||
--- gelfx/gelfx.h 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ gelfx/gelfx.h 2013-02-19 23:50:32.000000000 +0200
|
||||
@@ -19,8 +19,12 @@
|
||||
#ifndef GELFX_H
|
||||
#define GELFX_H
|
||||
|
||||
+#include "../gelf/elf.h"
|
||||
+#define _SYS_ELF32_H_ 1
|
||||
+#define _SYS_ELF64_H_ 1
|
||||
#include <libelf.h>
|
||||
-#include <gelf.h>
|
||||
+#include "../gelf/gelf.h"
|
||||
+#undef HAVE_GELFX_GETSHDR
|
||||
|
||||
#ifndef HAVE_GELFX_GETSHDR
|
||||
|
@ -1,23 +0,0 @@
|
||||
diff -Nur src/Makefile.am src/Makefile.am
|
||||
--- src/Makefile.am 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/Makefile.am 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -14,15 +14,17 @@
|
||||
arch-sparc.c arch-sparc64.c arch-x86_64.c arch-mips.c \
|
||||
arch-s390.c arch-s390x.c arch-arm.c arch-sh.c arch-ia64.c
|
||||
common_SOURCES = checksum.c data.c dso.c dwarf2.c dwarf2.h fptr.c fptr.h \
|
||||
- hashtab.c hashtab.h mdebug.c prelink.h stabs.c crc32.c
|
||||
+ hashtab.c hashtab.h mdebug.c prelink.h stabs.c crc32.c \
|
||||
+ error.c
|
||||
prelink_SOURCES = cache.c conflict.c cxx.c doit.c exec.c execle_open.c get.c \
|
||||
gather.c layout.c main.c prelink.c \
|
||||
prelinktab.h reloc.c reloc.h space.c undo.c undoall.c \
|
||||
verify.c canonicalize.c md5.c md5.h sha.c sha.h \
|
||||
$(common_SOURCES) $(arch_SOURCES)
|
||||
-prelink_LDADD = @LIBGELF@
|
||||
+prelink_LDADD = @LIBGELF@ -largp
|
||||
prelink_LDFLAGS = -all-static
|
||||
|
||||
execstack_SOURCES = execstack.c $(common_SOURCES) $(arch_SOURCES)
|
||||
+execstack_LDADD = -largp
|
||||
|
||||
extra_DIST = makecrc.c
|
@ -1,83 +0,0 @@
|
||||
diff -Nur src/cache.c src/cache.c
|
||||
--- src/cache.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/cache.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -88,13 +88,22 @@
|
||||
}
|
||||
|
||||
struct prelink_entry *
|
||||
+#if __LINUX__
|
||||
prelink_find_entry (const char *filename, const struct stat64 *stp,
|
||||
int insert)
|
||||
+#else
|
||||
+prelink_find_entry (const char *filename, const struct stat *stp,
|
||||
+ int insert)
|
||||
+#endif
|
||||
{
|
||||
struct prelink_entry e, *ent = NULL;
|
||||
void **filename_slot, *dummy = NULL;
|
||||
void **devino_slot = NULL;
|
||||
+#if __LINUX__
|
||||
struct stat64 st;
|
||||
+#else
|
||||
+ struct stat st;
|
||||
+#endif
|
||||
char *canon_filename = NULL;
|
||||
|
||||
e.filename = filename;
|
||||
@@ -113,7 +122,11 @@
|
||||
if (! stp)
|
||||
{
|
||||
canon_filename = prelink_canonicalize (filename, &st);
|
||||
+#if __LINUX__
|
||||
if (canon_filename == NULL && stat64 (filename, &st) < 0)
|
||||
+#else
|
||||
+ if (canon_filename == NULL && stat (filename, &st) < 0)
|
||||
+#endif
|
||||
{
|
||||
error (0, errno, "Could not stat %s", filename);
|
||||
if (insert)
|
||||
@@ -236,7 +249,11 @@
|
||||
struct prelink_entry e, *ent = NULL;
|
||||
void **filename_slot, *dummy = NULL;
|
||||
void **devino_slot = &dummy;
|
||||
+#if __LINUX__
|
||||
struct stat64 st;
|
||||
+#else
|
||||
+ struct stat st;
|
||||
+#endif
|
||||
uint32_t ctime = 0, mtime = 0;
|
||||
char *canon_filename = NULL;
|
||||
|
||||
@@ -358,7 +375,11 @@
|
||||
prelink_load_cache (void)
|
||||
{
|
||||
int fd, i, j;
|
||||
+#if __LINUX__
|
||||
struct stat64 st;
|
||||
+#else
|
||||
+ struct stat st;
|
||||
+#endif
|
||||
struct prelink_cache *cache;
|
||||
struct prelink_entry **ents;
|
||||
size_t cache_size;
|
||||
@@ -368,7 +389,11 @@
|
||||
if (fd < 0)
|
||||
return 0; /* The cache does not exist yet. */
|
||||
|
||||
+#if __LINUX__
|
||||
if (fstat64 (fd, &st) < 0
|
||||
+#else
|
||||
+ if (fstat (fd, &st) < 0
|
||||
+#endif
|
||||
|| st.st_size == 0)
|
||||
{
|
||||
close (fd);
|
||||
@@ -670,7 +695,7 @@
|
||||
|
||||
size_t prelink_cache_len = strlen (prelink_cache);
|
||||
char prelink_cache_tmp [prelink_cache_len + sizeof (".XXXXXX")];
|
||||
- memcpy (mempcpy (prelink_cache_tmp, prelink_cache, prelink_cache_len),
|
||||
+ memcpy (memcpy (prelink_cache_tmp, prelink_cache, prelink_cache_len)+prelink_cache_len,
|
||||
".XXXXXX", sizeof (".XXXXXX"));
|
||||
fd = mkstemp (prelink_cache_tmp);
|
||||
if (fd < 0)
|
@ -1,81 +0,0 @@
|
||||
diff -Nur src/canonicalize.c src/canonicalize.c
|
||||
--- src/canonicalize.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/canonicalize.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -73,7 +73,11 @@
|
||||
The result is malloc'd. */
|
||||
|
||||
static char *
|
||||
+#if __LINUX__
|
||||
canon_filename (const char *name, int nested, struct stat64 *stp)
|
||||
+#else
|
||||
+canon_filename (const char *name, int nested, struct stat *stp)
|
||||
+#endif
|
||||
{
|
||||
char *rpath, *dest, *extra_buf = NULL;
|
||||
const char *start, *end, *rpath_limit;
|
||||
@@ -145,7 +149,11 @@
|
||||
if (ep != NULL)
|
||||
{
|
||||
char *dirname = (char *) (ep + 1);
|
||||
+#if __LINUX__
|
||||
struct stat64 st;
|
||||
+#else
|
||||
+ struct stat st;
|
||||
+#endif
|
||||
|
||||
ep->dirname = (const char *) dirname;
|
||||
ep->dirname_len = e.dirname_len;
|
||||
@@ -182,7 +190,7 @@
|
||||
rpath = new_rpath;
|
||||
rpath_limit = rpath + new_size;
|
||||
}
|
||||
- dest = mempcpy (rpath, ep->canon_dirname, ep->canon_dirname_len);
|
||||
+ dest = memcpy (rpath, ep->canon_dirname, ep->canon_dirname_len) + ep->canon_dirname_len;
|
||||
*dest = '\0';
|
||||
name = end + 1;
|
||||
}
|
||||
@@ -238,10 +246,14 @@
|
||||
dest = rpath + dest_offset;
|
||||
}
|
||||
|
||||
- dest = mempcpy (dest, start, end - start);
|
||||
+ dest = memcpy (dest, start, end - start) + (end-start);
|
||||
*dest = '\0';
|
||||
|
||||
+#if __LINUX__
|
||||
if (lstat64 (rpath, stp) < 0)
|
||||
+#else
|
||||
+ if (lstat (rpath, stp) < 0)
|
||||
+#endif
|
||||
goto error;
|
||||
|
||||
stp_initialized = 1;
|
||||
@@ -294,7 +306,11 @@
|
||||
--dest;
|
||||
*dest = '\0';
|
||||
|
||||
+#if __LINUX__
|
||||
if (!stp_initialized && lstat64 (rpath, stp) < 0)
|
||||
+#else
|
||||
+ if (!stp_initialized && lstat (rpath, stp) < 0)
|
||||
+#endif
|
||||
goto error;
|
||||
|
||||
if (dest + 1 - rpath <= (rpath_limit - rpath) / 2)
|
||||
@@ -312,8 +328,16 @@
|
||||
}
|
||||
|
||||
char *
|
||||
+#if __LINUX__
|
||||
prelink_canonicalize (const char *name, struct stat64 *stp)
|
||||
+#else
|
||||
+prelink_canonicalize (const char *name, struct stat *stp)
|
||||
+#endif
|
||||
{
|
||||
+#if __LINUX__
|
||||
struct stat64 st;
|
||||
+#else
|
||||
+ struct stat st;
|
||||
+#endif
|
||||
return canon_filename (name, 0, stp ? stp : &st);
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
diff -Nur src/checksum.c src/checksum.c
|
||||
--- src/checksum.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/checksum.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -17,7 +17,16 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <assert.h>
|
||||
+
|
||||
+#if HAVE_ENDIAN_H
|
||||
#include <endian.h>
|
||||
+#elif HAVE_SYS_ENDIAN_H
|
||||
+#include <sys/endian.h>
|
||||
+#define __BYTE_ORDER _BYTE_ORDER
|
||||
+#define __BIG_ENDIAN _BIG_ENDIAN
|
||||
+#define __LITTLE_ENDIAN _LITTLE_ENDIAN
|
||||
+#endif
|
||||
+
|
||||
#include <errno.h>
|
||||
#include <error.h>
|
||||
#include <fcntl.h>
|
@ -1,13 +0,0 @@
|
||||
diff -Nur src/cxx.c src/cxx.c
|
||||
--- src/cxx.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/cxx.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -16,7 +16,9 @@
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <config.h>
|
||||
+#if HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
+#endif
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <error.h>
|
@ -1,70 +0,0 @@
|
||||
diff -Nur src/doit.c src/doit.c
|
||||
--- src/doit.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/doit.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -16,7 +16,9 @@
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <config.h>
|
||||
+#if HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
+#endif
|
||||
#include <errno.h>
|
||||
#include <error.h>
|
||||
#include <fcntl.h>
|
||||
@@ -51,7 +53,11 @@
|
||||
{
|
||||
int i, j;
|
||||
DSO *dso;
|
||||
+#if __LINUX__
|
||||
struct stat64 st;
|
||||
+#else
|
||||
+ struct stat st;
|
||||
+#endif
|
||||
struct prelink_link *hardlink;
|
||||
char *move = NULL;
|
||||
size_t movelen = 0;
|
||||
@@ -109,7 +115,11 @@
|
||||
if (dso == NULL)
|
||||
goto error_out;
|
||||
|
||||
+#if __LINUX__
|
||||
if (fstat64 (dso->fd, &st) < 0)
|
||||
+#else
|
||||
+ if (fstat (dso->fd, &st) < 0)
|
||||
+#endif
|
||||
{
|
||||
error (0, errno, "%s changed during prelinking", ent->filename);
|
||||
goto error_out;
|
||||
@@ -145,7 +155,11 @@
|
||||
{
|
||||
size_t len;
|
||||
|
||||
+#if __LINUX__
|
||||
if (lstat64 (hardlink->canon_filename, &st) < 0)
|
||||
+#else
|
||||
+ if (lstat (hardlink->canon_filename, &st) < 0)
|
||||
+#endif
|
||||
{
|
||||
error (0, 0, "Could not stat %s (former hardlink to %s)",
|
||||
hardlink->canon_filename, ent->canon_filename);
|
||||
@@ -186,7 +200,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- memcpy (mempcpy (move, hardlink->canon_filename, len), ".#prelink#",
|
||||
+ memcpy (memcpy (move, hardlink->canon_filename, len) + len, ".#prelink#",
|
||||
sizeof (".#prelink#"));
|
||||
if (rename (hardlink->canon_filename, move) < 0)
|
||||
{
|
||||
@@ -216,7 +230,11 @@
|
||||
}
|
||||
free (move);
|
||||
|
||||
+#if __LINUX__
|
||||
if (! dry_run && stat64 (ent->canon_filename, &st) >= 0)
|
||||
+#else
|
||||
+ if (! dry_run && stat (ent->canon_filename, &st) >= 0)
|
||||
+#endif
|
||||
{
|
||||
ent->dev = st.st_dev;
|
||||
ent->ino = st.st_ino;
|
@ -1,90 +0,0 @@
|
||||
diff -Nur src/dso.c src/dso.c
|
||||
--- src/dso.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/dso.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -33,7 +33,9 @@
|
||||
#define USE_SELINUX
|
||||
#endif
|
||||
|
||||
+#if HAVE_SYS_XATTR_H
|
||||
#include <sys/xattr.h>
|
||||
+#endif
|
||||
|
||||
#define RELOCATE_SCN(shf) \
|
||||
((shf) & (SHF_WRITE | SHF_ALLOC | SHF_EXECINSTR))
|
||||
@@ -1699,6 +1701,7 @@
|
||||
static int
|
||||
copy_xattrs (const char *temp_name, const char *name, int ignore_errors)
|
||||
{
|
||||
+#if HAVE_SYS_XATTR_H
|
||||
ssize_t sz = listxattr (name, NULL, 0), valsz = 0;
|
||||
char *list = NULL, *end, *p, *val = NULL, *newval;
|
||||
|
||||
@@ -1777,6 +1780,8 @@
|
||||
free (val);
|
||||
free (list);
|
||||
return 1;
|
||||
+#endif
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -1816,9 +1821,17 @@
|
||||
}
|
||||
|
||||
int
|
||||
+#ifdef __LINUX__
|
||||
copy_fd_to_file (int fdin, const char *name, struct stat64 *st)
|
||||
+#else
|
||||
+copy_fd_to_file (int fdin, const char *name, struct stat *st)
|
||||
+#endif
|
||||
{
|
||||
+#ifdef __LINUX__
|
||||
struct stat64 stt;
|
||||
+#else
|
||||
+ struct stat stt;
|
||||
+#endif
|
||||
off_t off = 0;
|
||||
int err, fdout;
|
||||
struct utimbuf u;
|
||||
@@ -1828,7 +1841,11 @@
|
||||
else
|
||||
fdout = open (name, O_WRONLY | O_CREAT, 0600);
|
||||
if (fdout != -1
|
||||
+#ifdef __LINUX__
|
||||
&& fstat64 (fdin, &stt) >= 0
|
||||
+#else
|
||||
+ && fstat (fdin, &stt) >= 0
|
||||
+#endif
|
||||
&& send_file (fdout, fdin, &off, stt.st_size) == stt.st_size)
|
||||
{
|
||||
if (fchown (fdout, st->st_uid, st->st_gid) >= 0)
|
||||
@@ -1863,7 +1880,11 @@
|
||||
{
|
||||
char *name1, *name2;
|
||||
struct utimbuf u;
|
||||
+#ifdef __LINUX__
|
||||
struct stat64 st;
|
||||
+#else
|
||||
+ struct stat st;
|
||||
+#endif
|
||||
int fdin;
|
||||
|
||||
switch (write_dso (dso))
|
||||
@@ -1879,9 +1900,15 @@
|
||||
break;
|
||||
}
|
||||
|
||||
- name1 = strdupa (dso->filename);
|
||||
- name2 = strdupa (dso->temp_filename);
|
||||
+ name1 = alloca(strlen(dso->filename) + 1);
|
||||
+ strcpy(name1, dso->filename);
|
||||
+ name2 = alloca(strlen(dso->temp_filename) + 1);
|
||||
+ strcpy(name2, dso->temp_filename);
|
||||
+#if __LINUX__
|
||||
if (fstat64 (dso->fdro, &st) < 0)
|
||||
+#else
|
||||
+ if (fstat (dso->fdro, &st) < 0)
|
||||
+#endif
|
||||
{
|
||||
error (0, errno, "Could not stat %s", dso->filename);
|
||||
close_dso (dso);
|
@ -1,24 +0,0 @@
|
||||
diff -Nur src/dwarf2.c src/dwarf2.c
|
||||
--- src/dwarf2.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/dwarf2.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -17,8 +17,20 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <assert.h>
|
||||
+
|
||||
+#if HAVE_BYTESWAP_H
|
||||
#include <byteswap.h>
|
||||
+#elif HAVE_SYS_ENDIAN_H
|
||||
+#include <sys/endian.h>
|
||||
+#define bswap_32 bswap32
|
||||
+#endif
|
||||
+
|
||||
+#if HAVE_ENDIAN_H
|
||||
#include <endian.h>
|
||||
+#elif HAVE_SYS_ENDIAN_H
|
||||
+#include <sys/endian.h>
|
||||
+#endif
|
||||
+
|
||||
#include <errno.h>
|
||||
#include <error.h>
|
||||
#include <limits.h>
|
@ -1,317 +0,0 @@
|
||||
Copied from /usr/src/contrib/diff/lib/error.c and hacked.
|
||||
|
||||
diff -Nur src/error.c src/error.c
|
||||
--- src/error.c 1970-01-01 02:00:00.000000000 +0200
|
||||
+++ src/error.c 2013-02-19 23:50:32.000000000 +0200
|
||||
@@ -0,0 +1,311 @@
|
||||
+/* Error handler for noninteractive utilities
|
||||
+ Copyright (C) 1990-1998, 2000-2002, 2003 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2, or (at your option)
|
||||
+ any later version.
|
||||
+
|
||||
+ This program 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 General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License along
|
||||
+ with this program; if not, write to the Free Software Foundation,
|
||||
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
|
||||
+
|
||||
+#ifdef HAVE_CONFIG_H
|
||||
+# include <config.h>
|
||||
+#endif
|
||||
+
|
||||
+#include "error.h"
|
||||
+
|
||||
+#include <stdarg.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#ifdef _LIBC
|
||||
+# include <libintl.h>
|
||||
+#else
|
||||
+//# include "gettext.h"
|
||||
+#endif
|
||||
+
|
||||
+#ifdef _LIBC
|
||||
+# include <wchar.h>
|
||||
+# define mbsrtowcs __mbsrtowcs
|
||||
+#endif
|
||||
+
|
||||
+//#if !_LIBC
|
||||
+#if _LIBC
|
||||
+# include "unlocked-io.h"
|
||||
+#endif
|
||||
+
|
||||
+#ifndef _
|
||||
+# define _(String) String
|
||||
+#endif
|
||||
+
|
||||
+/* If NULL, error will flush stdout, then print on stderr the program
|
||||
+ name, a colon and a space. Otherwise, error will call this
|
||||
+ function without parameters instead. */
|
||||
+void (*error_print_progname) (void);
|
||||
+
|
||||
+/* This variable is incremented each time `error' is called. */
|
||||
+unsigned int error_message_count;
|
||||
+
|
||||
+#ifdef _LIBC
|
||||
+/* In the GNU C library, there is a predefined variable for this. */
|
||||
+
|
||||
+# define program_name program_invocation_name
|
||||
+# include <errno.h>
|
||||
+# include <libio/libioP.h>
|
||||
+
|
||||
+/* In GNU libc we want do not want to use the common name `error' directly.
|
||||
+ Instead make it a weak alias. */
|
||||
+extern void __error (int status, int errnum, const char *message, ...)
|
||||
+ __attribute__ ((__format__ (__printf__, 3, 4)));
|
||||
+extern void __error_at_line (int status, int errnum, const char *file_name,
|
||||
+ unsigned int line_number, const char *message,
|
||||
+ ...)
|
||||
+ __attribute__ ((__format__ (__printf__, 5, 6)));;
|
||||
+# define error __error
|
||||
+# define error_at_line __error_at_line
|
||||
+
|
||||
+# include <libio/iolibio.h>
|
||||
+# define fflush(s) INTUSE(_IO_fflush) (s)
|
||||
+# undef putc
|
||||
+# define putc(c, fp) INTUSE(_IO_putc) (c, fp)
|
||||
+
|
||||
+# include <bits/libc-lock.h>
|
||||
+
|
||||
+#else /* not _LIBC */
|
||||
+
|
||||
+# if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P
|
||||
+# ifndef HAVE_DECL_STRERROR_R
|
||||
+"this configure-time declaration test was not run"
|
||||
+# endif
|
||||
+char *strerror_r ();
|
||||
+# endif
|
||||
+
|
||||
+# ifndef SIZE_MAX
|
||||
+# define SIZE_MAX ((size_t) -1)
|
||||
+# endif
|
||||
+
|
||||
+/* The calling program should define program_name and set it to the
|
||||
+ name of the executing program. */
|
||||
+//extern char *program_name;
|
||||
+
|
||||
+# if HAVE_STRERROR_R || defined strerror_r
|
||||
+# define __strerror_r strerror_r
|
||||
+# endif
|
||||
+#endif /* not _LIBC */
|
||||
+
|
||||
+static void
|
||||
+print_errno_message (int errnum)
|
||||
+{
|
||||
+ char const *s;
|
||||
+
|
||||
+#if defined HAVE_STRERROR_R || _LIBC
|
||||
+ char errbuf[1024];
|
||||
+# if STRERROR_R_CHAR_P || _LIBC
|
||||
+ s = __strerror_r (errnum, errbuf, sizeof errbuf);
|
||||
+# else
|
||||
+ if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
|
||||
+ s = errbuf;
|
||||
+ else
|
||||
+ s = 0;
|
||||
+# endif
|
||||
+#else
|
||||
+ s = strerror (errnum);
|
||||
+#endif
|
||||
+
|
||||
+#if !_LIBC
|
||||
+ if (! s)
|
||||
+ s = _("Unknown system error");
|
||||
+#endif
|
||||
+
|
||||
+#if _LIBC
|
||||
+ if (_IO_fwide (stderr, 0) > 0)
|
||||
+ {
|
||||
+ __fwprintf (stderr, L": %s", s);
|
||||
+ return;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ fprintf (stderr, ": %s", s);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+error_tail (int status, int errnum, const char *message, va_list args)
|
||||
+{
|
||||
+#if _LIBC
|
||||
+ if (_IO_fwide (stderr, 0) > 0)
|
||||
+ {
|
||||
+# define ALLOCA_LIMIT 2000
|
||||
+ size_t len = strlen (message) + 1;
|
||||
+ const wchar_t *wmessage = L"out of memory";
|
||||
+ wchar_t *wbuf = (len < ALLOCA_LIMIT
|
||||
+ ? alloca (len * sizeof *wbuf)
|
||||
+ : len <= SIZE_MAX / sizeof *wbuf
|
||||
+ ? malloc (len * sizeof *wbuf)
|
||||
+ : NULL);
|
||||
+
|
||||
+ if (wbuf)
|
||||
+ {
|
||||
+ size_t res;
|
||||
+ mbstate_t st;
|
||||
+ const char *tmp = message;
|
||||
+ memset (&st, '\0', sizeof (st));
|
||||
+ res = mbsrtowcs (wbuf, &tmp, len, &st);
|
||||
+ wmessage = res == (size_t) -1 ? L"???" : wbuf;
|
||||
+ }
|
||||
+
|
||||
+ __vfwprintf (stderr, wmessage, args);
|
||||
+ if (! (len < ALLOCA_LIMIT))
|
||||
+ free (wbuf);
|
||||
+ }
|
||||
+ else
|
||||
+#endif
|
||||
+ vfprintf (stderr, message, args);
|
||||
+ va_end (args);
|
||||
+
|
||||
+ ++error_message_count;
|
||||
+ if (errnum)
|
||||
+ print_errno_message (errnum);
|
||||
+#if _LIBC
|
||||
+ if (_IO_fwide (stderr, 0) > 0)
|
||||
+ putwc (L'\n', stderr);
|
||||
+ else
|
||||
+#endif
|
||||
+ putc ('\n', stderr);
|
||||
+ fflush (stderr);
|
||||
+ if (status)
|
||||
+ exit (status);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/* Print the program name and error message MESSAGE, which is a printf-style
|
||||
+ format string with optional args.
|
||||
+ If ERRNUM is nonzero, print its corresponding system error message.
|
||||
+ Exit with status STATUS if it is nonzero. */
|
||||
+void
|
||||
+error (int status, int errnum, const char *message, ...)
|
||||
+{
|
||||
+ va_list args;
|
||||
+
|
||||
+#if defined _LIBC && defined __libc_ptf_call
|
||||
+ /* We do not want this call to be cut short by a thread
|
||||
+ cancellation. Therefore disable cancellation for now. */
|
||||
+ int state = PTHREAD_CANCEL_ENABLE;
|
||||
+ __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
|
||||
+ 0);
|
||||
+#endif
|
||||
+
|
||||
+ fflush (stdout);
|
||||
+#ifdef _LIBC
|
||||
+ _IO_flockfile (stderr);
|
||||
+#endif
|
||||
+ if (error_print_progname)
|
||||
+ (*error_print_progname) ();
|
||||
+ else
|
||||
+ {
|
||||
+#if _LIBC
|
||||
+ if (_IO_fwide (stderr, 0) > 0)
|
||||
+ __fwprintf (stderr, L"%s: ", program_name);
|
||||
+ else
|
||||
+#endif
|
||||
+ fprintf (stderr, "%s: ", getprogname() /*program_name*/);
|
||||
+ }
|
||||
+
|
||||
+ va_start (args, message);
|
||||
+ error_tail (status, errnum, message, args);
|
||||
+
|
||||
+#ifdef _LIBC
|
||||
+ _IO_funlockfile (stderr);
|
||||
+# ifdef __libc_ptf_call
|
||||
+ __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
|
||||
+# endif
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+/* Sometimes we want to have at most one error per line. This
|
||||
+ variable controls whether this mode is selected or not. */
|
||||
+int error_one_per_line;
|
||||
+
|
||||
+void
|
||||
+error_at_line (int status, int errnum, const char *file_name,
|
||||
+ unsigned int line_number, const char *message, ...)
|
||||
+{
|
||||
+ va_list args;
|
||||
+
|
||||
+ if (error_one_per_line)
|
||||
+ {
|
||||
+ static const char *old_file_name;
|
||||
+ static unsigned int old_line_number;
|
||||
+
|
||||
+ if (old_line_number == line_number
|
||||
+ && (file_name == old_file_name
|
||||
+ || strcmp (old_file_name, file_name) == 0))
|
||||
+ /* Simply return and print nothing. */
|
||||
+ return;
|
||||
+
|
||||
+ old_file_name = file_name;
|
||||
+ old_line_number = line_number;
|
||||
+ }
|
||||
+
|
||||
+#if defined _LIBC && defined __libc_ptf_call
|
||||
+ /* We do not want this call to be cut short by a thread
|
||||
+ cancellation. Therefore disable cancellation for now. */
|
||||
+ int state = PTHREAD_CANCEL_ENABLE;
|
||||
+ __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
|
||||
+ 0);
|
||||
+#endif
|
||||
+
|
||||
+ fflush (stdout);
|
||||
+#ifdef _LIBC
|
||||
+ _IO_flockfile (stderr);
|
||||
+#endif
|
||||
+ if (error_print_progname)
|
||||
+ (*error_print_progname) ();
|
||||
+ else
|
||||
+ {
|
||||
+#if _LIBC
|
||||
+ if (_IO_fwide (stderr, 0) > 0)
|
||||
+ __fwprintf (stderr, L"%s: ", program_name);
|
||||
+ else
|
||||
+#endif
|
||||
+ fprintf (stderr, "%s:", getprogname() /*program_name*/);
|
||||
+ }
|
||||
+
|
||||
+ if (file_name != NULL)
|
||||
+ {
|
||||
+#if _LIBC
|
||||
+ if (_IO_fwide (stderr, 0) > 0)
|
||||
+ __fwprintf (stderr, L"%s:%d: ", file_name, line_number);
|
||||
+ else
|
||||
+#endif
|
||||
+ fprintf (stderr, "%s:%d: ", file_name, line_number);
|
||||
+ }
|
||||
+
|
||||
+ va_start (args, message);
|
||||
+ error_tail (status, errnum, message, args);
|
||||
+
|
||||
+#ifdef _LIBC
|
||||
+ _IO_funlockfile (stderr);
|
||||
+# ifdef __libc_ptf_call
|
||||
+ __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
|
||||
+# endif
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+#ifdef _LIBC
|
||||
+/* Make the weak alias. */
|
||||
+# undef error
|
||||
+# undef error_at_line
|
||||
+weak_alias (__error, error)
|
||||
+weak_alias (__error_at_line, error_at_line)
|
||||
+#endif
|
@ -1,72 +0,0 @@
|
||||
Copied from /usr/src/contrib/diff/lib/error.h
|
||||
|
||||
diff -Nur src/error.h src/error.h
|
||||
--- src/error.h 1970-01-01 02:00:00.000000000 +0200
|
||||
+++ src/error.h 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -0,0 +1,66 @@
|
||||
+/* Declaration for error-reporting function
|
||||
+ Copyright (C) 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2, or (at your option)
|
||||
+ any later version.
|
||||
+
|
||||
+ This program 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 General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License along
|
||||
+ with this program; if not, write to the Free Software Foundation,
|
||||
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+#ifndef _ERROR_H
|
||||
+#define _ERROR_H 1
|
||||
+
|
||||
+#ifndef __attribute__
|
||||
+/* This feature is available in gcc versions 2.5 and later. */
|
||||
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
|
||||
+# define __attribute__(Spec) /* empty */
|
||||
+# endif
|
||||
+/* The __-protected variants of `format' and `printf' attributes
|
||||
+ are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
|
||||
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
|
||||
+# define __format__ format
|
||||
+# define __printf__ printf
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+extern "C" {
|
||||
+#endif
|
||||
+
|
||||
+/* Print a message with `fprintf (stderr, FORMAT, ...)';
|
||||
+ if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
|
||||
+ If STATUS is nonzero, terminate the program with `exit (STATUS)'. */
|
||||
+
|
||||
+extern void error (int __status, int __errnum, const char *__format, ...)
|
||||
+ __attribute__ ((__format__ (__printf__, 3, 4)));
|
||||
+
|
||||
+extern void error_at_line (int __status, int __errnum, const char *__fname,
|
||||
+ unsigned int __lineno, const char *__format, ...)
|
||||
+ __attribute__ ((__format__ (__printf__, 5, 6)));
|
||||
+
|
||||
+/* If NULL, error will flush stdout, then print on stderr the program
|
||||
+ name, a colon and a space. Otherwise, error will call this
|
||||
+ function without parameters instead. */
|
||||
+extern void (*error_print_progname) (void);
|
||||
+
|
||||
+/* This variable is incremented each time `error' is called. */
|
||||
+extern unsigned int error_message_count;
|
||||
+
|
||||
+/* Sometimes we want to have at most one error per line. This
|
||||
+ variable controls whether this mode is selected or not. */
|
||||
+extern int error_one_per_line;
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+#endif /* error.h */
|
@ -1,109 +0,0 @@
|
||||
diff -Nur src/gather.c src/gather.c
|
||||
--- src/gather.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/gather.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -235,7 +235,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
- depends[ndepends] = strdupa (p);
|
||||
+ depends[ndepends] = alloca (strlen(p) + 1);
|
||||
+ strcpy(depends[ndepends], p);
|
||||
++ndepends;
|
||||
} while (!feof (f));
|
||||
|
||||
@@ -495,7 +496,11 @@
|
||||
}
|
||||
|
||||
static int
|
||||
+#if __LINUX__
|
||||
gather_exec (DSO *dso, const struct stat64 *st)
|
||||
+#else
|
||||
+gather_exec (DSO *dso, const struct stat *st)
|
||||
+#endif
|
||||
{
|
||||
int i, j;
|
||||
Elf_Data *data;
|
||||
@@ -635,7 +640,11 @@
|
||||
}
|
||||
|
||||
static int
|
||||
+#if __LINUX__
|
||||
gather_func (const char *name, const struct stat64 *st, int type,
|
||||
+#else
|
||||
+gather_func (const char *name, const struct stat *st, int type,
|
||||
+#endif
|
||||
struct FTW *ftwp)
|
||||
{
|
||||
unsigned char e_ident [sizeof (Elf64_Ehdr) + sizeof (Elf64_Phdr)];
|
||||
@@ -901,7 +910,11 @@
|
||||
}
|
||||
|
||||
static int
|
||||
+#if __LINUX__
|
||||
gather_binlib (const char *name, const struct stat64 *st)
|
||||
+#else
|
||||
+gather_binlib (const char *name, const struct stat *st)
|
||||
+#endif
|
||||
{
|
||||
unsigned char e_ident [EI_NIDENT + 2];
|
||||
int fd, type;
|
||||
@@ -1014,9 +1027,17 @@
|
||||
int
|
||||
gather_object (const char *name, int deref, int onefs)
|
||||
{
|
||||
+#if __LINUX__
|
||||
struct stat64 st;
|
||||
+#else
|
||||
+ struct stat st;
|
||||
+#endif
|
||||
|
||||
+#if __LINUX__
|
||||
if (stat64 (name, &st) < 0)
|
||||
+#else
|
||||
+ if (stat (name, &st) < 0)
|
||||
+#endif
|
||||
{
|
||||
if (implicit)
|
||||
return 0;
|
||||
@@ -1039,7 +1060,11 @@
|
||||
if (!all && implicit && ! deref)
|
||||
return 0;
|
||||
++implicit;
|
||||
+#if __LINUX__
|
||||
ret = nftw64 (name, gather_func, 20, flags | FTW_ACTIONRETVAL);
|
||||
+#else
|
||||
+ ret = nftw (name, gather_func, 20, flags | FTW_ACTIONRETVAL);
|
||||
+#endif
|
||||
--implicit;
|
||||
if (ret < 0)
|
||||
error (0, errno, "Failed searching %s", name);
|
||||
@@ -1300,9 +1325,17 @@
|
||||
const char *canon_name;
|
||||
struct prelink_dir *path;
|
||||
size_t len;
|
||||
+#if __LINUX__
|
||||
struct stat64 st;
|
||||
+#else
|
||||
+ struct stat st;
|
||||
+#endif
|
||||
|
||||
+#if __LINUX__
|
||||
if (stat64 (name, &st) < 0)
|
||||
+#else
|
||||
+ if (stat (name, &st) < 0)
|
||||
+#endif
|
||||
{
|
||||
if (implicit)
|
||||
return 0;
|
||||
@@ -1421,7 +1454,11 @@
|
||||
{
|
||||
glob_t g;
|
||||
|
||||
+#ifdef GLOB_PERIOD
|
||||
if (!glob (p, GLOB_BRACE | GLOB_PERIOD, NULL, &g))
|
||||
+#else
|
||||
+ if (!glob (p, GLOB_BRACE, NULL, &g))
|
||||
+#endif
|
||||
{
|
||||
size_t n;
|
||||
|
@ -1,21 +0,0 @@
|
||||
diff -Nur src/get.c src/get.c
|
||||
--- src/get.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/get.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -163,9 +163,17 @@
|
||||
|
||||
if (hardlink == NULL)
|
||||
{
|
||||
+#if __LINUX__
|
||||
struct stat64 st;
|
||||
+#else
|
||||
+ struct stat st;
|
||||
+#endif
|
||||
|
||||
+#if __LINUX__
|
||||
if (stat64 (filename, &st) < 0)
|
||||
+#else
|
||||
+ if (stat (filename, &st) < 0)
|
||||
+#endif
|
||||
{
|
||||
error (0, errno, "%s: Could not stat %s",
|
||||
info->ent->filename, filename);
|
@ -1,13 +0,0 @@
|
||||
diff -Nur src/layout.c src/layout.c
|
||||
--- src/layout.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/layout.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -16,7 +16,9 @@
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <config.h>
|
||||
+#if HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
+#endif
|
||||
#include <errno.h>
|
||||
#include <error.h>
|
||||
#include <fcntl.h>
|
@ -1,22 +0,0 @@
|
||||
diff -Nur src/main.c src/main.c
|
||||
--- src/main.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/main.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -403,10 +403,18 @@
|
||||
|
||||
if (!dso_is_rdwr (dso))
|
||||
{
|
||||
+#if __LINUX__
|
||||
struct stat64 st;
|
||||
+#else
|
||||
+ struct stat st;
|
||||
+#endif
|
||||
int err;
|
||||
|
||||
+#if __LINUX__
|
||||
if (fstat64 (dso->fd, &st) < 0)
|
||||
+#else
|
||||
+ if (fstat (dso->fd, &st) < 0)
|
||||
+#endif
|
||||
{
|
||||
error (0, errno, "Could not stat %s", dso->filename);
|
||||
++failures;
|
@ -1,27 +0,0 @@
|
||||
diff -Nur src/md5.c src/md5.c
|
||||
--- src/md5.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/md5.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -23,8 +23,23 @@
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
+
|
||||
+#if HAVE_ENDIAN_H
|
||||
#include <endian.h>
|
||||
+#elif HAVE_SYS_ENDIAN_H
|
||||
+#include <sys/endian.h>
|
||||
+#define __BYTE_ORDER _BYTE_ORDER
|
||||
+#define __BIG_ENDIAN _BIG_ENDIAN
|
||||
+#define __LITTLE_ENDIAN _LITTLE_ENDIAN
|
||||
+#endif
|
||||
+
|
||||
+#if HAVE_BYTESWAP_H
|
||||
#include <byteswap.h>
|
||||
+#else
|
||||
+#include <sys/endian.h>
|
||||
+#define bswap_32 bswap32
|
||||
+#endif
|
||||
+
|
||||
#include "md5.h"
|
||||
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
@ -1,28 +0,0 @@
|
||||
diff -Nur src/mdebug.c src/mdebug.c
|
||||
--- src/mdebug.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/mdebug.c 2013-02-20 00:00:05.000000000 +0200
|
||||
@@ -17,8 +17,24 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <assert.h>
|
||||
+
|
||||
+#if HAVE_BYTESWAP_H
|
||||
#include <byteswap.h>
|
||||
+#elif HAVE_SYS_ENDIAN_H
|
||||
+#include <sys/endian.h>
|
||||
+#define bswap_32 bswap32
|
||||
+#define bswap_64 bswap64
|
||||
+#endif
|
||||
+
|
||||
+#if HAVE_ENDIAN_H
|
||||
#include <endian.h>
|
||||
+#elif HAVE_SYS_ENDIAN_H
|
||||
+#include <sys/endian.h>
|
||||
+#define __BYTE_ORDER _BYTE_ORDER
|
||||
+#define __BIG_ENDIAN _BIG_ENDIAN
|
||||
+#define __LITTLE_ENDIAN _LITTLE_ENDIAN
|
||||
+#endif
|
||||
+
|
||||
#include <error.h>
|
||||
#include <stddef.h>
|
||||
|
@ -1,33 +0,0 @@
|
||||
diff -Nur src/prelink.c src/prelink.c
|
||||
--- src/prelink.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/prelink.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -17,7 +17,13 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <assert.h>
|
||||
+
|
||||
+#if HAVE_ENDIAN_H
|
||||
#include <endian.h>
|
||||
+#elif HAVE_SYS_ENDIAN_H
|
||||
+#include <sys/endian.h>
|
||||
+#endif
|
||||
+
|
||||
#include <errno.h>
|
||||
#include <error.h>
|
||||
#include <fcntl.h>
|
||||
@@ -439,6 +445,7 @@
|
||||
adjusting the rest of the library. */
|
||||
break;
|
||||
case SHT_DYNAMIC:
|
||||
+#ifdef SHT_MIPS_REGINFO
|
||||
case SHT_MIPS_REGINFO:
|
||||
/* The same applies to these sections on MIPS. The convention
|
||||
is to put .dynamic and .reginfo near the beginning of the
|
||||
@@ -446,6 +453,7 @@
|
||||
may refer to them. */
|
||||
if (dso->ehdr.e_machine == EM_MIPS)
|
||||
break;
|
||||
+#endif
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
/* The rest of sections are not safe. */
|
@ -1,62 +0,0 @@
|
||||
diff -Nur src/prelink.h src/prelink.h
|
||||
--- src/prelink.h 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/prelink.h 2013-02-20 00:02:54.000000000 +0200
|
||||
@@ -19,7 +19,9 @@
|
||||
#ifndef PRELINK_H
|
||||
#define PRELINK_H
|
||||
|
||||
-#include <elf.h>
|
||||
+#include "../gelf/elf.h"
|
||||
+#define _SYS_ELF32_H_ 1
|
||||
+#define _SYS_ELF64_H_ 1
|
||||
#include <libelf.h>
|
||||
#include <gelfx.h>
|
||||
#include <stdint.h>
|
||||
@@ -253,7 +255,11 @@
|
||||
int adjust_mdebug (DSO *dso, int n, GElf_Addr start, GElf_Addr adjust);
|
||||
int finalize_mdebug (DSO *dso);
|
||||
int relocate_dso (DSO *dso, GElf_Addr base);
|
||||
+#if __LINUX__
|
||||
int copy_fd_to_file (int fdin, const char *name, struct stat64 *st);
|
||||
+#else
|
||||
+int copy_fd_to_file (int fdin, const char *name, struct stat *st);
|
||||
+#endif
|
||||
int update_dso (DSO *dso, const char *);
|
||||
int prepare_write_dso (DSO *dso);
|
||||
int write_dso (DSO *dso);
|
||||
@@ -368,7 +374,11 @@
|
||||
GElf_Word checksum;
|
||||
GElf_Addr base, end, layend, pltgot;
|
||||
dev_t dev;
|
||||
+#if __LINUX__
|
||||
ino64_t ino;
|
||||
+#else
|
||||
+ ino_t ino;
|
||||
+#endif
|
||||
#define ET_BAD (ET_NUM)
|
||||
#define ET_CACHE_EXEC (ET_NUM + 1)
|
||||
#define ET_CACHE_DYN (ET_NUM + 2)
|
||||
@@ -478,7 +488,11 @@
|
||||
int prelink_print_cache (void);
|
||||
int prelink_save_cache (int do_warn);
|
||||
struct prelink_entry *
|
||||
+#if __LINUX__
|
||||
prelink_find_entry (const char *filename, const struct stat64 *stp,
|
||||
+#else
|
||||
+ prelink_find_entry (const char *filename, const struct stat *stp,
|
||||
+#endif
|
||||
int insert);
|
||||
struct prelink_conflict *
|
||||
prelink_conflict (struct prelink_info *info, GElf_Word r_sym,
|
||||
@@ -517,7 +531,11 @@
|
||||
|
||||
int undo_all (void);
|
||||
|
||||
+#if __LINUX__
|
||||
char *prelink_canonicalize (const char *name, struct stat64 *stp);
|
||||
+#else
|
||||
+char *prelink_canonicalize (const char *name, struct stat *stp);
|
||||
+#endif
|
||||
|
||||
extern const char *dynamic_linker;
|
||||
extern const char *ld_library_path;
|
@ -1,18 +0,0 @@
|
||||
diff -Nur src/sha.c src/sha.c
|
||||
--- src/sha.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/sha.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -11,7 +11,14 @@
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
+
|
||||
+#if HAVE_BYTESWAP_H
|
||||
#include <byteswap.h>
|
||||
+#elif HAVE_SYS_ENDIAN_H
|
||||
+#include <sys/endian.h>
|
||||
+#define bswap_32 bswap32
|
||||
+#endif
|
||||
+
|
||||
#include "md5.h"
|
||||
#include "sha.h"
|
||||
|
@ -1,27 +0,0 @@
|
||||
diff -Nur src/stabs.c src/stabs.c
|
||||
--- src/stabs.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/stabs.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -17,8 +17,23 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <assert.h>
|
||||
+
|
||||
+#if HAVE_BYTESWAP_H
|
||||
#include <byteswap.h>
|
||||
+#elif HAVE_SYS_ENDIAN_H
|
||||
+#include <sys/endian.h>
|
||||
+#define bswap_32 bswap32
|
||||
+#endif
|
||||
+
|
||||
+#if HAVE_ENDIAN_H
|
||||
#include <endian.h>
|
||||
+#elif HAVE_SYS_ENDIAN_H
|
||||
+#include <sys/endian.h>
|
||||
+#define __BYTE_ORDER _BYTE_ORDER
|
||||
+#define __BIG_ENDIAN _BIG_ENDIAN
|
||||
+#define __LITTLE_ENDIAN _LITTLE_ENDIAN
|
||||
+#endif
|
||||
+
|
||||
#include <error.h>
|
||||
|
||||
#include "prelink.h"
|
@ -1,17 +0,0 @@
|
||||
diff -Nur src/undo.c src/undo.c
|
||||
--- src/undo.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/undo.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -17,7 +17,13 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <assert.h>
|
||||
+
|
||||
+#if HAVE_ENDIAN_H
|
||||
#include <endian.h>
|
||||
+#elif HAVE_SYS_ENDIAN_H
|
||||
+#include <sys/endian.h>
|
||||
+#endif
|
||||
+
|
||||
#include <errno.h>
|
||||
#include <error.h>
|
||||
#include <fcntl.h>
|
@ -1,58 +0,0 @@
|
||||
diff -Nur src/undoall.c src/undoall.c
|
||||
--- src/undoall.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/undoall.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -16,7 +16,9 @@
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <config.h>
|
||||
+#if HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
+#endif
|
||||
#include <errno.h>
|
||||
#include <error.h>
|
||||
#include <fcntl.h>
|
||||
@@ -31,7 +33,11 @@
|
||||
{
|
||||
struct prelink_entry *ent = * (struct prelink_entry **) p;
|
||||
DSO *dso;
|
||||
+#if __LINUX__
|
||||
struct stat64 st;
|
||||
+#else
|
||||
+ struct stat st;
|
||||
+#endif
|
||||
struct prelink_link *hardlink;
|
||||
char *move = NULL;
|
||||
size_t movelen = 0;
|
||||
@@ -47,7 +53,11 @@
|
||||
if (dso == NULL)
|
||||
goto error_out;
|
||||
|
||||
+#if __LINUX__
|
||||
if (fstat64 (dso->fd, &st) < 0)
|
||||
+#else
|
||||
+ if (fstat (dso->fd, &st) < 0)
|
||||
+#endif
|
||||
{
|
||||
error (0, errno, "%s changed during prelinking", ent->filename);
|
||||
goto error_out;
|
||||
@@ -88,7 +98,11 @@
|
||||
{
|
||||
size_t len;
|
||||
|
||||
+#if __LINUX__
|
||||
if (lstat64 (hardlink->canon_filename, &st) < 0)
|
||||
+#else
|
||||
+ if (lstat (hardlink->canon_filename, &st) < 0)
|
||||
+#endif
|
||||
{
|
||||
error (0, 0, "Could not stat %s (former hardlink to %s)",
|
||||
hardlink->canon_filename, ent->canon_filename);
|
||||
@@ -126,7 +140,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- memcpy (mempcpy (move, hardlink->canon_filename, len), ".#prelink#",
|
||||
+ memcpy (memcpy (move, hardlink->canon_filename, len) + len, ".#prelink#",
|
||||
sizeof (".#prelink#"));
|
||||
if (rename (hardlink->canon_filename, move) < 0)
|
||||
{
|
@ -1,138 +0,0 @@
|
||||
diff -Nur src/verify.c prelink-port/src/verify.c
|
||||
--- src/verify.c 2013-02-19 23:54:34.000000000 +0200
|
||||
+++ src/verify.c 2013-02-19 23:50:31.000000000 +0200
|
||||
@@ -17,7 +17,13 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <assert.h>
|
||||
+
|
||||
+#if HAVE_ENDIAN_H
|
||||
#include <endian.h>
|
||||
+#elif HAVE_SYS_ENDIAN_H
|
||||
+#include <sys/endian.h>
|
||||
+#endif
|
||||
+
|
||||
#include <errno.h>
|
||||
#include <error.h>
|
||||
#include <fcntl.h>
|
||||
@@ -44,7 +50,9 @@
|
||||
q = p + count;
|
||||
while (p != q)
|
||||
{
|
||||
- n = TEMP_FAILURE_RETRY (write (outfd, p, q - p));
|
||||
+ do {
|
||||
+ n = write (outfd, p, q - p);
|
||||
+ } while (n < 0 && errno == EINTR);
|
||||
if (n <= 0)
|
||||
{
|
||||
munmap (b, count);
|
||||
@@ -65,7 +73,9 @@
|
||||
q = buf + len;
|
||||
while (p != q)
|
||||
{
|
||||
- n = TEMP_FAILURE_RETRY (read (infd, p, q - p));
|
||||
+ do {
|
||||
+ n = read (infd, p, q - p);
|
||||
+ } while (n < 0 && errno == EINTR);
|
||||
if (n <= 0)
|
||||
return -1;
|
||||
p += n;
|
||||
@@ -73,7 +83,9 @@
|
||||
p = buf;
|
||||
while (p != q)
|
||||
{
|
||||
- n = TEMP_FAILURE_RETRY (write (outfd, p, q - p));
|
||||
+ do {
|
||||
+ n = write (outfd, p, q - p);
|
||||
+ } while (n < 0 && errno == EINTR);
|
||||
if (n <= 0)
|
||||
return -1;
|
||||
p += n;
|
||||
@@ -107,7 +119,9 @@
|
||||
q = b + len;
|
||||
while (p != q)
|
||||
{
|
||||
- n = TEMP_FAILURE_RETRY (read (fd, p, q - p));
|
||||
+ do {
|
||||
+ n = read (fd, p, q - p);
|
||||
+ } while (n < 0 && errno == EINTR);
|
||||
if (n < 0)
|
||||
return 1;
|
||||
p += n;
|
||||
@@ -123,9 +137,17 @@
|
||||
{
|
||||
off_t off;
|
||||
size_t cnt;
|
||||
+#if __LINUX__
|
||||
struct stat64 st;
|
||||
+#else
|
||||
+ struct stat st;
|
||||
+#endif
|
||||
|
||||
+#if __LINUX__
|
||||
if (fstat64 (fd, &st) < 0)
|
||||
+#else
|
||||
+ if (fstat (fd, &st) < 0)
|
||||
+#endif
|
||||
{
|
||||
error (0, errno, "%s: couldn't fstat temporary file", filename);
|
||||
return 1;
|
||||
@@ -186,14 +208,22 @@
|
||||
{
|
||||
DSO *dso = NULL, *dso2 = NULL;
|
||||
int fd = -1, fdorig = -1, fdundone = -1, undo, ret;
|
||||
+#if __LINUX__
|
||||
struct stat64 st, st2;
|
||||
+#else
|
||||
+ struct stat st, st2;
|
||||
+#endif
|
||||
struct prelink_entry *ent;
|
||||
GElf_Addr base;
|
||||
char buffer[32768], buffer2[32768];
|
||||
size_t count;
|
||||
char *p, *q;
|
||||
|
||||
+#if __LINUX__
|
||||
if (stat64 (filename, &st) < 0)
|
||||
+#else
|
||||
+ if (stat (filename, &st) < 0)
|
||||
+#endif
|
||||
error (EXIT_FAILURE, errno, "Couldn't stat %s", filename);
|
||||
|
||||
dso = open_dso (filename);
|
||||
@@ -214,7 +244,11 @@
|
||||
if (undo == dso->ehdr.e_shnum)
|
||||
goto not_prelinked;
|
||||
|
||||
+#if __LINUX__
|
||||
if (fstat64 (dso->fd, &st2) < 0)
|
||||
+#else
|
||||
+ if (fstat (dso->fd, &st2) < 0)
|
||||
+#endif
|
||||
{
|
||||
error (0, errno, "Couldn't fstat %s", filename);
|
||||
goto failure;
|
||||
@@ -326,7 +360,11 @@
|
||||
close_dso (dso2);
|
||||
dso2 = NULL;
|
||||
|
||||
+#if __LINUX__
|
||||
if (fstat64 (fdorig, &st2) < 0)
|
||||
+#else
|
||||
+ if (fstat (fdorig, &st2) < 0)
|
||||
+#endif
|
||||
{
|
||||
error (0, errno, "Couldn't fstat %s", filename);
|
||||
goto failure;
|
||||
@@ -339,7 +377,11 @@
|
||||
goto failure;
|
||||
}
|
||||
|
||||
+#if __LINUX__
|
||||
if (fstat64 (fd, &st2) < 0)
|
||||
+#else
|
||||
+ if (fstat (fd, &st2) < 0)
|
||||
+#endif
|
||||
{
|
||||
error (0, errno, "Couldn't fstat temporary file");
|
||||
goto failure;
|
@ -1,3 +0,0 @@
|
||||
ELF prelinking utility to speed up dynamic linking.
|
||||
|
||||
WWW: http://people.redhat.com/jakub/prelink/
|
Loading…
Reference in New Issue
Block a user