From 6ab5f50de41c22de3752722108def4ae721aec13 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 5 Oct 2004 09:26:23 +0000 Subject: [PATCH] Update. 2004-10-05 Jakub Jelinek * sysdeps/unix/sysv/linux/x86_64/sysconf.c (__sysconf): Return 200112L for _SC_CPUTIME or _SC_THREAD_CPUTIME. * nscd/Makefile (nscd-cflags): Set to -DIS_IN_nscd=1, plus -fpie if building PIE. (CFLAGS-*.c): Use it. * nscd/Makefile (relro-LDFLAGS): Add -Wl,-z,now if have-z-relro. ($(objpfx)nscd): Add $(relro-LDFLAGS). * sysdeps/unix/sysv/linux/i386/sysconf.c: Include hp-timing.h. (__sysconf): Return -1 for _SC_CPUTIME or _SC_THREAD_CPUTIME if !HP_TIMING_AVAIL. 2004-10-05 Ulrich Drepper * nscd/Makefile (distribute): Remove TODO. * nscd/TODO: Removed. --- ChangeLog | 21 +++++++ linuxthreads/ChangeLog | 5 ++ .../unix/sysv/linux/x86_64/bits/posix_opt.h | 4 +- nptl/ChangeLog | 5 ++ .../unix/sysv/linux/x86_64/bits/posix_opt.h | 4 +- nscd/Makefile | 59 +++++++++++-------- nscd/TODO | 3 - sysdeps/unix/sysv/linux/i386/sysconf.c | 14 ++--- sysdeps/unix/sysv/linux/x86_64/sysconf.c | 6 ++ 9 files changed, 82 insertions(+), 39 deletions(-) delete mode 100644 nscd/TODO diff --git a/ChangeLog b/ChangeLog index b51f6ba5c4..6edd7c3c84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2004-10-05 Jakub Jelinek + + * sysdeps/unix/sysv/linux/x86_64/sysconf.c (__sysconf): Return 200112L + for _SC_CPUTIME or _SC_THREAD_CPUTIME. + + * nscd/Makefile (nscd-cflags): Set to -DIS_IN_nscd=1, plus + -fpie if building PIE. + (CFLAGS-*.c): Use it. + + * nscd/Makefile (relro-LDFLAGS): Add -Wl,-z,now if have-z-relro. + ($(objpfx)nscd): Add $(relro-LDFLAGS). + + * sysdeps/unix/sysv/linux/i386/sysconf.c: Include hp-timing.h. + (__sysconf): Return -1 for _SC_CPUTIME or _SC_THREAD_CPUTIME if + !HP_TIMING_AVAIL. + +2004-10-05 Ulrich Drepper + + * nscd/Makefile (distribute): Remove TODO. + * nscd/TODO: Removed. + 2004-10-04 Ulrich Drepper * nscd/gai.c: Define __no_netlink_support if NEED_NETLINK is diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index a7bb38a5fe..a4a4222f7b 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,8 @@ +2004-10-05 Jakub Jelinek + + * sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h (_POSIX_CPUTIME, + _POSIX_THREAD_CPUTIME): Define to 0. + 2004-10-04 Ulrich Drepper * sysdeps/unix/sysv/linux/i386/bits/posix_opt.h: Set _POSIX_CPUTIME diff --git a/linuxthreads/sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h b/linuxthreads/sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h index b45d121f64..d4be569168 100644 --- a/linuxthreads/sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h +++ b/linuxthreads/sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h @@ -106,10 +106,10 @@ #define _POSIX_SHARED_MEMORY_OBJECTS 200112L /* CPU-time clocks supported. */ -#define _POSIX_CPUTIME 200112L +#define _POSIX_CPUTIME 0 /* We support the clock also in threads. */ -#define _POSIX_THREAD_CPUTIME 200112L +#define _POSIX_THREAD_CPUTIME 0 /* GNU libc provides regular expression handling. */ #define _POSIX_REGEXP 1 diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 49c4a94286..6e0cdc6d63 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,8 @@ +2004-10-05 Jakub Jelinek + + * sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h (_POSIX_CPUTIME, + _POSIX_THREAD_CPUTIME): Define to 0. + 2004-10-04 Ulrich Drepper * sysdeps/unix/sysv/linux/i386/bits/posix_opt.h: Define _POSIX_CPUTIME diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h b/nptl/sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h index 7563de8ad2..2b5a3e6db8 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h @@ -103,10 +103,10 @@ #define _POSIX_SHARED_MEMORY_OBJECTS 200112L /* CPU-time clocks supported. */ -#define _POSIX_CPUTIME 200112L +#define _POSIX_CPUTIME 0 /* We support the clock also in threads. */ -#define _POSIX_THREAD_CPUTIME 200112L +#define _POSIX_THREAD_CPUTIME 0 /* GNU libc provides regular expression handling. */ #define _POSIX_REGEXP 1 diff --git a/nscd/Makefile b/nscd/Makefile index 16d67bd1d4..70a35198c2 100644 --- a/nscd/Makefile +++ b/nscd/Makefile @@ -58,7 +58,7 @@ endif distribute := nscd.h nscd-client.h dbg_log.h \ $(addsuffix .c, $(filter-out xmalloc, $(nscd-modules))) \ - nscd_nischeck.c TODO nscd.conf nscd.init nscd_proto.h \ + nscd_nischeck.c nscd.conf nscd.init nscd_proto.h \ nscd-types.h include ../Rules @@ -69,34 +69,43 @@ CFLAGS-nscd_gethst_r.c = -fexceptions CFLAGS-nscd_getai.c = -fexceptions CFLAGS-nscd_initgroups.c = -fexceptions +nscd-cflags = -DIS_IN_nscd=1 ifeq (yesyes,$(have-fpie)$(build-shared)) -CFLAGS-nscd.c += -fpie -CFLAGS-connections.c += -fpie -CFLAGS-pwdcache.c += -fpie -CFLAGS-getpwnam_r.c += -fpie -CFLAGS-getpwuid_r.c += -fpie -CFLAGS-grpcache.c += -fpie -CFLAGS-getgrnam_r.c += -fpie -CFLAGS-getgrgid_r.c += -fpie -CFLAGS-hstcache.c += -fpie -CFLAGS-gethstbyad_r.c += -fpie -CFLAGS-gethstbynm2_r.c += -fpie -CFLAGS-dbg_log.c += -fpie -CFLAGS-nscd_conf.c += -fpie -CFLAGS-nscd_stat.c += -fpie -CFLAGS-cache.c += -fpie -CFLAGS-xmalloc.c += -fpie -CFLAGS-xstrdup.c += -fpie -CFLAGS-mem.c += -fpie -CFLAGS-nscd_setup_thread.c += -fpie -CFLAGS-aicache.c += -fpie -CFLAGS-selinux.c += -fpie -CFLAGS-initgrcache.c += -fpie -CFLAGS-gai.c += -fpie +nscd-cflags += -fpie +endif + +CFLAGS-nscd.c += $(nscd-cflags) +CFLAGS-connections.c += $(nscd-cflags) +CFLAGS-pwdcache.c += $(nscd-cflags) +CFLAGS-getpwnam_r.c += $(nscd-cflags) +CFLAGS-getpwuid_r.c += $(nscd-cflags) +CFLAGS-grpcache.c += $(nscd-cflags) +CFLAGS-getgrnam_r.c += $(nscd-cflags) +CFLAGS-getgrgid_r.c += $(nscd-cflags) +CFLAGS-hstcache.c += $(nscd-cflags) +CFLAGS-gethstbyad_r.c += $(nscd-cflags) +CFLAGS-gethstbynm2_r.c += $(nscd-cflags) +CFLAGS-dbg_log.c += $(nscd-cflags) +CFLAGS-nscd_conf.c += $(nscd-cflags) +CFLAGS-nscd_stat.c += $(nscd-cflags) +CFLAGS-cache.c += $(nscd-cflags) +CFLAGS-xmalloc.c += $(nscd-cflags) +CFLAGS-xstrdup.c += $(nscd-cflags) +CFLAGS-mem.c += $(nscd-cflags) +CFLAGS-nscd_setup_thread.c += $(nscd-cflags) +CFLAGS-aicache.c += $(nscd-cflags) +CFLAGS-selinux.c += $(nscd-cflags) +CFLAGS-initgrcache.c += $(nscd-cflags) +CFLAGS-gai.c += $(nscd-cflags) + +ifeq (yesyes,$(have-fpie)$(build-shared)) +ifeq (yes,$(have-z-relro)) +relro-LDFLAGS += -Wl,-z,now +endif $(objpfx)nscd: $(addprefix $(objpfx),$(nscd-modules:=.o)) $(LINK.o) -pie -Wl,-O1 \ - $(sysdep-LDFLAGS) $(config-LDFLAGS) \ + $(sysdep-LDFLAGS) $(config-LDFLAGS) $(relro-LDFLAGS) \ $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \ $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \ $(LDFLAGS) $(LDFLAGS-$(@F)) \ diff --git a/nscd/TODO b/nscd/TODO deleted file mode 100644 index 0ae9d1845c..0000000000 --- a/nscd/TODO +++ /dev/null @@ -1,3 +0,0 @@ - -* If we have reached the max. # of process, close accept socket. - ! THIS COULD CAUSE THE KERNEL TO HANG ! BE CAREFUL ! diff --git a/sysdeps/unix/sysv/linux/i386/sysconf.c b/sysdeps/unix/sysv/linux/i386/sysconf.c index 8a9ab61912..eae849b277 100644 --- a/sysdeps/unix/sysv/linux/i386/sysconf.c +++ b/sysdeps/unix/sysv/linux/i386/sysconf.c @@ -21,7 +21,7 @@ #include #include #include - +#include static long int linux_sysconf (int name); @@ -347,13 +347,13 @@ __sysconf (int name) { if (name == _SC_CPUTIME || name == _SC_THREAD_CPUTIME) { - /* Check dynamically. */ - int ac = i386_i486_test (); - - /* Only i386 and i486 have no TSC. */ +#if HP_TIMING_AVAIL // XXX We can add here test for machines which cannot support a - // XXX usabel TSC. - return ac == 0 || (ac & (1 << 21)) == 0 ? -1 : 200112L; + // XXX usable TSC. + return 200112L; +#else + return -1; +#endif } /* All the remainder, except the cache information, is handled in diff --git a/sysdeps/unix/sysv/linux/x86_64/sysconf.c b/sysdeps/unix/sysv/linux/x86_64/sysconf.c index 87f2c451f3..407fd46bc3 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysconf.c +++ b/sysdeps/unix/sysv/linux/x86_64/sysconf.c @@ -279,6 +279,12 @@ handle_amd (int name) long int __sysconf (int name) { + if (name == _SC_CPUTIME || name == _SC_THREAD_CPUTIME) + { + /* XXX Test whether TSC is usable. */ + return 200112L; + } + /* We only handle the cache information here (for now). */ if (name < _SC_LEVEL1_ICACHE_SIZE || name > _SC_LEVEL4_CACHE_LINESIZE) return linux_sysconf (name);