summaryrefslogtreecommitdiffstats
path: root/libc/misc/internals
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/internals')
-rw-r--r--libc/misc/internals/Makefile61
-rw-r--r--libc/misc/internals/Makefile.in10
-rw-r--r--libc/misc/internals/tempname.c26
-rw-r--r--libc/misc/internals/tempname.h4
4 files changed, 25 insertions, 76 deletions
diff --git a/libc/misc/internals/Makefile b/libc/misc/internals/Makefile
index 1df05a934..4a8f4a072 100644
--- a/libc/misc/internals/Makefile
+++ b/libc/misc/internals/Makefile
@@ -1,58 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# 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 Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library 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
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-CSRC=__uClibc_main.c tempname.c errno.c __errno_location.c __h_errno_location.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-
-__uClibc_main.o: CFLAGS += $(SSP_DISABLE_FLAGS)
-
-OBJS=$(COBJS)
-
-ifeq ($(UCLIBC_HAS_THREADS),y)
-CFLAGS += $(PTINC)
-endif
-
-OBJ_LIST=../../obj.misc.internals
-
-all: $(OBJ_LIST) interp.o static.o
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/internals/%, $(OBJS)) > $(OBJ_LIST)
-
-interp.c: Makefile
- echo "/* Force shared libraries to know about the correct library loader */" > interp.c
- echo "#include <features.h>" >> interp.c
- echo "#ifdef __HAVE_ELF__" >> interp.c
- echo "const char __dl_ldso__[] __attribute__ ((section " \
- "(\".interp\"))) =\""$(SHARED_LIB_LOADER_PREFIX)/$(UCLIBC_LDSO)"\";" >> interp.c
- echo "#endif" >> interp.c
-
-$(COBJS) interp.o static.o: %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] interp.c *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/internals/Makefile.in b/libc/misc/internals/Makefile.in
index 8863aba7b..4c7012d9a 100644
--- a/libc/misc/internals/Makefile.in
+++ b/libc/misc/internals/Makefile.in
@@ -16,14 +16,6 @@ MISC_INTERNALS_OUT:=$(top_builddir)libc/misc/internals
MISC_INTERNALS_SRC:=$(patsubst %.c,$(MISC_INTERNALS_DIR)/%.c,$(CSRC))
MISC_INTERNALS_OBJ:=$(patsubst %.c,$(MISC_INTERNALS_OUT)/%.o,$(CSRC))
-$(MISC_INTERNALS_OUT)/interp.c: $(top_builddir)include/headers_done
- $(Q)echo "/* Force shared libraries to know about the correct library loader */" > $@
- $(Q)echo "#include <features.h>" >> $@
- $(Q)echo "#ifdef __HAVE_ELF__" >> $@
- $(Q)echo "const char __dl_ldso__[] __attribute__ ((section " \
- "(\".interp\"))) =\""$(SHARED_LIB_LOADER_PREFIX)/$(UCLIBC_LDSO)"\";" >> $@
- $(Q)echo "#endif" >> $@
-
libc-a-y+=$(MISC_INTERNALS_OBJ)
libc-so-y+=$(MISC_INTERNALS_OBJ:.o=.os)
libc-shared-y+=$(MISC_INTERNALS_OUT)/__uClibc_main.oS
@@ -34,4 +26,4 @@ libc-multi-y+=$(MISC_INTERNALS_SRC)
objclean-y+=misc_internals_objclean
misc_internals_objclean:
- $(RM) $(MISC_INTERNALS_OUT)/{*.{o,os,oS},interp.c}
+ $(RM) $(MISC_INTERNALS_OUT)/*.{o,os,oS}
diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c
index cd1f3497b..360c76879 100644
--- a/libc/misc/internals/tempname.c
+++ b/libc/misc/internals/tempname.c
@@ -31,6 +31,8 @@
* Use brain damaged getpid() if real random fails.
*/
+#define open64 __open64
+
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
@@ -59,7 +61,7 @@ static int direxists (const char *dir)
for use with mk[s]temp. Will fail (-1) if DIR is non-null and
doesn't exist, none of the searched dirs exists, or there's not
enough space in TMPL. */
-int __path_search (char *tmpl, size_t tmpl_len, const char *dir,
+int attribute_hidden __path_search (char *tmpl, size_t tmpl_len, const char *dir,
const char *pfx, int try_tmpdir)
{
//const char *d;
@@ -72,7 +74,7 @@ int __path_search (char *tmpl, size_t tmpl_len, const char *dir,
}
else
{
- plen = strlen (pfx);
+ plen = __strlen (pfx);
if (plen > 5)
plen = 5;
}
@@ -94,7 +96,7 @@ int __path_search (char *tmpl, size_t tmpl_len, const char *dir,
{
if (direxists (P_tmpdir))
dir = P_tmpdir;
- else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
+ else if (__strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
dir = "/tmp";
else
{
@@ -103,7 +105,7 @@ int __path_search (char *tmpl, size_t tmpl_len, const char *dir,
}
}
- dlen = strlen (dir);
+ dlen = __strlen (dir);
while (dlen > 1 && dir[dlen - 1] == '/')
dlen--; /* remove trailing slashes */
@@ -126,13 +128,13 @@ static unsigned int fillrand(unsigned char *buf, unsigned int len)
{
int fd;
unsigned int result = -1;
- fd = open("/dev/urandom", O_RDONLY);
+ fd = __open("/dev/urandom", O_RDONLY);
if (fd < 0) {
- fd = open("/dev/random", O_RDONLY | O_NONBLOCK);
+ fd = __open("/dev/random", O_RDONLY | O_NONBLOCK);
}
if (fd >= 0) {
- result = read(fd, buf, len);
- close(fd);
+ result = __read(fd, buf, len);
+ __close(fd);
}
return result;
}
@@ -175,15 +177,15 @@ static void brain_damaged_fillrand(unsigned char *buf, unsigned int len)
__GT_DIR: create a directory, which will be mode 0700.
*/
-int __gen_tempname (char *tmpl, int kind)
+int attribute_hidden __gen_tempname (char *tmpl, int kind)
{
char *XXXXXX;
unsigned int k;
int len, i, count, fd, save_errno = errno;
unsigned char randomness[6];
- len = strlen (tmpl);
- if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX"))
+ len = __strlen (tmpl);
+ if (len < 6 || __strcmp (&tmpl[len - 6], "XXXXXX"))
{
__set_errno (EINVAL);
return -1;
@@ -223,7 +225,7 @@ int __gen_tempname (char *tmpl, int kind)
continue;
}
case __GT_FILE:
- fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
+ fd = __open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
break;
#if defined __UCLIBC_HAS_LFS__
case __GT_BIGFILE:
diff --git a/libc/misc/internals/tempname.h b/libc/misc/internals/tempname.h
index f068727a7..dfe9399ca 100644
--- a/libc/misc/internals/tempname.h
+++ b/libc/misc/internals/tempname.h
@@ -4,8 +4,8 @@
#define __need_size_t
#include <stddef.h>
extern int __path_search (char *tmpl, size_t tmpl_len, const char *dir,
- const char *pfx, int try_tmpdir);
-extern int __gen_tempname (char *__tmpl, int __kind);
+ const char *pfx, int try_tmpdir) attribute_hidden;
+extern int __gen_tempname (char *__tmpl, int __kind) attribute_hidden;
/* The __kind argument to __gen_tempname may be one of: */
#define __GT_FILE 0 /* create a file */