[Glibc-bsd-commits] r4178 - trunk/glibc-ports/kfreebsd
Robert Millan
rmh at alioth.debian.org
Sun Apr 8 19:59:24 UTC 2012
Author: rmh
Date: 2012-04-08 19:59:23 +0000 (Sun, 08 Apr 2012)
New Revision: 4178
Added:
trunk/glibc-ports/kfreebsd/getosreldate.h
Modified:
trunk/glibc-ports/kfreebsd/Makefile
trunk/glibc-ports/kfreebsd/Versions
trunk/glibc-ports/kfreebsd/clone.c
trunk/glibc-ports/kfreebsd/getosreldate.c
trunk/glibc-ports/kfreebsd/testrtsig.h
Log:
Factorize KERN_OSRELDATE sysctl calls into a single function (__kernel_getosreldate).
Modified: trunk/glibc-ports/kfreebsd/Makefile
===================================================================
--- trunk/glibc-ports/kfreebsd/Makefile 2012-04-07 21:09:07 UTC (rev 4177)
+++ trunk/glibc-ports/kfreebsd/Makefile 2012-04-08 19:59:23 UTC (rev 4178)
@@ -58,7 +58,7 @@
# For <sched.h>.
sysdep_routines += clone start_thread
# For <unistd.h>.
-sysdep_routines += sys_ftruncate sys_freebsd6_ftruncate sys_truncate sys_freebsd6_truncate
+sysdep_routines += sys_ftruncate sys_freebsd6_ftruncate sys_truncate sys_freebsd6_truncate getosreldate
# For <sys/acl.h>.
sysdep_routines += acl_aclcheck_fd acl_aclcheck_file acl_delete_fd acl_delete_file acl_get_fd acl_get_file acl_set_fd acl_set_file
# For <sys/extattr.h>.
Modified: trunk/glibc-ports/kfreebsd/Versions
===================================================================
--- trunk/glibc-ports/kfreebsd/Versions 2012-04-07 21:09:07 UTC (rev 4177)
+++ trunk/glibc-ports/kfreebsd/Versions 2012-04-08 19:59:23 UTC (rev 4178)
@@ -100,7 +100,7 @@
}
GLIBC_PRIVATE {
# needed by libpthread.
- __clone; __libc_fork; __libc_sigaction;
+ __clone; __libc_fork; __libc_sigaction; __kernel_getosreldate;
# needed by libpthread as INLINE_SYSCALL:
__syscall_fork;
__syscall_open; __syscall_close;
Modified: trunk/glibc-ports/kfreebsd/clone.c
===================================================================
--- trunk/glibc-ports/kfreebsd/clone.c 2012-04-07 21:09:07 UTC (rev 4177)
+++ trunk/glibc-ports/kfreebsd/clone.c 2012-04-08 19:59:23 UTC (rev 4178)
@@ -24,30 +24,9 @@
#include <errno.h>
#include <signal.h>
#include <stddef.h>
+#include <getosreldate.h>
#undef __clone
-
-#include <sys/sysctl.h>
-
-static inline int
-__kernel_osreldate(void)
-{
- static int osreldate;
-
- int mib[2];
- size_t size;
-
- if (osreldate == 0)
- {
- mib[0] = CTL_KERN;
- mib[1] = KERN_OSRELDATE;
- size = sizeof osreldate;
- if (__sysctl(mib, 2, &osreldate, &size, NULL, 0) == -1)
- return (-1);
- }
- return (osreldate);
-}
-
/* __start_thread (flags, child_stack, fn, arg)
is roughly equivalent to
@@ -86,7 +65,7 @@
if ((flags & CSIGNAL) != SIGCHLD)
{
- if (__kernel_osreldate() >= 802510)
+ if (__kernel_getosreldate() >= 802510)
/* we slightly cheat here, */
/* the 9.x snapshot prior to r223966 does not support it too */
{
Modified: trunk/glibc-ports/kfreebsd/getosreldate.c
===================================================================
--- trunk/glibc-ports/kfreebsd/getosreldate.c 2012-04-07 21:09:07 UTC (rev 4177)
+++ trunk/glibc-ports/kfreebsd/getosreldate.c 2012-04-08 19:59:23 UTC (rev 4178)
@@ -30,8 +30,28 @@
#include <stddef.h>
#include <sys/sysctl.h>
#include <stdlib.h>
+#include <getosreldate.h>
int
+__kernel_getosreldate(void)
+{
+ static int osreldate;
+
+ int mib[2];
+ size_t size;
+
+ if (osreldate == 0)
+ {
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_OSRELDATE;
+ size = sizeof osreldate;
+ if (__sysctl(mib, 2, &osreldate, &size, NULL, 0) == -1)
+ return (-1);
+ }
+ return (osreldate);
+}
+
+int
__getosreldate(void)
{
static int osreldate;
@@ -47,11 +67,7 @@
return (osreldate);
}
- mib[0] = CTL_KERN;
- mib[1] = KERN_OSRELDATE;
- size = sizeof osreldate;
- if (__sysctl(mib, 2, &osreldate, &size, NULL, 0) == -1)
- return (-1);
+ osreldate = __kernel_getosreldate ();
}
return (osreldate);
}
Added: trunk/glibc-ports/kfreebsd/getosreldate.h
===================================================================
--- trunk/glibc-ports/kfreebsd/getosreldate.h (rev 0)
+++ trunk/glibc-ports/kfreebsd/getosreldate.h 2012-04-08 19:59:23 UTC (rev 4178)
@@ -0,0 +1,2 @@
+int __kernel_getosreldate (void);
+int __getosreldate (void);
Modified: trunk/glibc-ports/kfreebsd/testrtsig.h
===================================================================
--- trunk/glibc-ports/kfreebsd/testrtsig.h 2012-04-07 21:09:07 UTC (rev 4177)
+++ trunk/glibc-ports/kfreebsd/testrtsig.h 2012-04-08 19:59:23 UTC (rev 4178)
@@ -22,6 +22,7 @@
#include <string.h>
#include <kernel-features.h>
+#include <getosreldate.h>
static int
kernel_has_rtsig (void)
@@ -29,16 +30,8 @@
#if __ASSUME_REALTIME_SIGNALS
return 1;
#else
-
- int request[2] = { CTL_KERN, KERN_OSRELDATE};
- size_t len;
- int val;
-
- len = sizeof (val);
- if (__sysctl (request, 2, &val, &len, NULL, 0) < 0)
+ if (__kernel_getosreldate () < 700050) /* FreeBSD 7.0 is 700055 */
return 0;
- if ( val < 700050) /* FreeBSD 7.0 is 700055 */
- return 0;
return 1;
#endif
}
More information about the Glibc-bsd-commits
mailing list