summaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-05-08 14:53:20 -0400
committerUlrich Drepper <drepper@gmail.com>2011-05-08 14:53:20 -0400
commit6fb2dde3f1aa3a1419cb6c2dfa53dd1d506722a4 (patch)
tree1ea14aa26ff3a32c8c14bf1849b7d94fbf685069 /sysdeps/unix
parent7fb90fb89bbdf273ab7ab96517fe1b156cd7aee1 (diff)
Make complete getcwd work in rtld
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/rewinddir.c5
-rw-r--r--sysdeps/unix/sysv/linux/Makefile3
-rw-r--r--sysdeps/unix/sysv/linux/dl-fxstatat64.c6
-rw-r--r--sysdeps/unix/sysv/linux/dl-openat64.c40
-rw-r--r--sysdeps/unix/sysv/linux/dl-opendir.c6
-rw-r--r--sysdeps/unix/sysv/linux/getcwd.c8
6 files changed, 58 insertions, 10 deletions
diff --git a/sysdeps/unix/rewinddir.c b/sysdeps/unix/rewinddir.c
index 89b0e6d20d..967289364e 100644
--- a/sysdeps/unix/rewinddir.c
+++ b/sysdeps/unix/rewinddir.c
@@ -23,16 +23,19 @@
#include <dirstream.h>
/* Rewind DIRP to the beginning of the directory. */
-/* XXX should be __rewinddir ? */
void
rewinddir (dirp)
DIR *dirp;
{
+#ifndef NOT_IN_libc
__libc_lock_lock (dirp->lock);
+#endif
(void) __lseek (dirp->fd, (off_t) 0, SEEK_SET);
dirp->filepos = 0;
dirp->offset = 0;
dirp->size = 0;
+#ifndef NOT_IN_libc
__libc_lock_unlock (dirp->lock);
+#endif
}
libc_hidden_def (rewinddir)
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 61fbfb4fc8..3b4b63f844 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -147,7 +147,8 @@ sysdep_routines += xstatconv internal_statvfs internal_statvfs64 \
endif
ifeq ($(subdir),elf)
-sysdep-rtld-routines += dl-brk dl-sbrk dl-getcwd
+sysdep-rtld-routines += dl-brk dl-sbrk dl-getcwd dl-openat64 dl-opendir \
+ dl-fxstatat64
CPPFLAGS-lddlibc4 += -DNOT_IN_libc
endif
diff --git a/sysdeps/unix/sysv/linux/dl-fxstatat64.c b/sysdeps/unix/sysv/linux/dl-fxstatat64.c
new file mode 100644
index 0000000000..9a17a9b739
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/dl-fxstatat64.c
@@ -0,0 +1,6 @@
+/* In this implementation we do not really care whether the call fails
+ because of missing kernel support since we do not even call the
+ function in this case. */
+#undef __ASSUME_ATFCTS
+#define __ASSUME_ATFCTS 1
+#include "fxstatat64.c"
diff --git a/sysdeps/unix/sysv/linux/dl-openat64.c b/sysdeps/unix/sysv/linux/dl-openat64.c
new file mode 100644
index 0000000000..ca296fd7ca
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/dl-openat64.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmain.com>, 2003.
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sysdep.h>
+
+
+int
+openat64 (dfd, file, oflag)
+ int dfd;
+ const char *file;
+ int oflag;
+{
+ assert ((oflag & O_CREAT) == 0);
+
+#ifdef __NR_openat
+ return INLINE_SYSCALL (openat, 3, dfd, file, oflag | O_LARGEFILE);
+#else
+ __set_errno (ENOSYS);
+ return -1;
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/dl-opendir.c b/sysdeps/unix/sysv/linux/dl-opendir.c
new file mode 100644
index 0000000000..72d2c06cdc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/dl-opendir.c
@@ -0,0 +1,6 @@
+/* In this implementation we do not really care whether the opened
+ file descriptor has the CLOEXEC bit set. The only call happens
+ long before there is a call to fork or exec. */
+#undef __ASSUME_O_CLOEXEC
+#define __ASSUME_O_CLOEXEC 1
+#include <opendir.c>
diff --git a/sysdeps/unix/sysv/linux/getcwd.c b/sysdeps/unix/sysv/linux/getcwd.c
index db3e292964..fb0dcefd58 100644
--- a/sysdeps/unix/sysv/linux/getcwd.c
+++ b/sysdeps/unix/sysv/linux/getcwd.c
@@ -124,9 +124,6 @@ __getcwd (char *buf, size_t size)
return buf;
}
- // XXX This should not be necessary but the full getcwd implementation
- // drags in too much for the current build proces of ld.so to handle
-#ifndef NOT_IN_libc
/* The system call cannot handle paths longer than a page.
Neither can the magic symlink in /proc/self. Just use the
generic implementation right away. */
@@ -149,7 +146,6 @@ __getcwd (char *buf, size_t size)
return result;
}
-#endif
# if __ASSUME_GETCWD_SYSCALL
/* It should never happen that the `getcwd' syscall failed because
@@ -241,11 +237,7 @@ __getcwd (char *buf, size_t size)
}
weak_alias (__getcwd, getcwd)
- // XXX This should not be necessary but the full getcwd implementation
- // drags in too much for the current build proces of ld.so to handle
-#ifndef NOT_IN_libc
/* Get the code for the generic version. */
#define GETCWD_RETURN_TYPE static char * internal_function
#define __getcwd generic_getcwd
#include <sysdeps/posix/getcwd.c>
-#endif