[launchd-changes] [23519] trunk/launchd/src
source_changes at macosforge.org
source_changes at macosforge.org
Wed Feb 20 12:36:40 PST 2008
Revision: 23519
http://trac.macosforge.org/projects/launchd/changeset/23519
Author: zarzycki at apple.com
Date: 2008-02-20 12:36:39 -0800 (Wed, 20 Feb 2008)
Log Message:
-----------
Make launchd compile 64-bit. It still doesn't work. What remains is
malloc()/free() problems (in launchd_unix_ipc.c???).
Modified Paths:
--------------
trunk/launchd/src/launchd_core_logic.c
trunk/launchd/src/launchd_runtime.c
trunk/launchd/src/launchd_runtime.h
trunk/launchd/src/launchd_runtime_kill.c
Modified: trunk/launchd/src/launchd_core_logic.c
===================================================================
--- trunk/launchd/src/launchd_core_logic.c 2008-02-15 22:18:20 UTC (rev 23518)
+++ trunk/launchd/src/launchd_core_logic.c 2008-02-20 20:36:39 UTC (rev 23519)
@@ -4286,9 +4286,9 @@
return;
}
-#if defined (__ppc__)
+#if defined (__ppc__) || defined(__ppc64__)
f = PPC_THREAD_STATE64;
-#elif defined(__i386__)
+#elif defined(__i386__) || defined(__x86_64__)
f = x86_THREAD_STATE;
#elif defined(__arm__)
f = ARM_THREAD_STATE;
Modified: trunk/launchd/src/launchd_runtime.c
===================================================================
--- trunk/launchd/src/launchd_runtime.c 2008-02-15 22:18:20 UTC (rev 23518)
+++ trunk/launchd/src/launchd_runtime.c 2008-02-20 20:36:39 UTC (rev 23519)
@@ -113,6 +113,7 @@
static void do_file_init(void) __attribute__((constructor));
static mach_timebase_info_data_t tbi;
+static uint64_t tbi_safe_math_max;
static double tbi_float_val;
static const int sigigns[] = { SIGHUP, SIGINT, SIGPIPE, SIGALRM, SIGTERM,
@@ -1078,7 +1079,7 @@
no_hang_fd = _fd(open("/dev/autofs_nowait", 0));
}
- runtime_ktrace(RTKT_LAUNCHD_MACH_IPC|DBG_FUNC_START, bufRequest->Head.msgh_local_port, bufRequest->Head.msgh_id, (int)the_demux);
+ runtime_ktrace(RTKT_LAUNCHD_MACH_IPC|DBG_FUNC_START, bufRequest->Head.msgh_local_port, bufRequest->Head.msgh_id, (long)the_demux);
if (the_demux(&bufRequest->Head, &bufReply->Head) == FALSE) {
/* XXX - also gross */
@@ -1327,7 +1328,7 @@
/* This syscall returns EINVAL when the trace isn't enabled. */
if (do_apple_internal_logging) {
- syscall(180, code, 0, 0, 0, (int)ra);
+ syscall(180, code, 0, 0, 0, (long)ra);
}
}
@@ -1338,18 +1339,18 @@
/* This syscall returns EINVAL when the trace isn't enabled. */
if (do_apple_internal_logging) {
- syscall(180, code, 0, 0, 0, (int)ra);
+ syscall(180, code, 0, 0, 0, (long)ra);
}
}
INTERNAL_ABI void
-runtime_ktrace(runtime_ktrace_code_t code, int a, int b, int c)
+runtime_ktrace(runtime_ktrace_code_t code, long a, long b, long c)
{
void *ra = __builtin_extract_return_addr(__builtin_return_address(0));
/* This syscall returns EINVAL when the trace isn't enabled. */
if (do_apple_internal_logging) {
- syscall(180, code, a, b, c, (int)ra);
+ syscall(180, code, a, b, c, (long)ra);
}
}
@@ -1612,7 +1613,13 @@
#else
if (tbi.numer != tbi.denom) {
#endif
- if (o < INT32_MAX) {
+#ifdef __LP64__
+ __uint128_t tmp = o;
+ tmp *= tbi.numer;
+ tmp /= tbi.denom;
+ o = tmp;
+#else
+ if (o <= tbi_safe_math_max) {
o *= tbi.numer;
o /= tbi.denom;
} else {
@@ -1620,6 +1627,7 @@
d *= tbi_float_val;
o = d;
}
+#endif
}
return o;
@@ -1633,6 +1641,7 @@
launchd_assert(mach_timebase_info(&tbi) == 0);
tbi_float_val = tbi.numer;
tbi_float_val /= tbi.denom;
+ tbi_safe_math_max = UINT64_MAX / tbi.numer;
if (getpid() == 1) {
pid1_magic = true;
Modified: trunk/launchd/src/launchd_runtime.h
===================================================================
--- trunk/launchd/src/launchd_runtime.h 2008-02-15 22:18:20 UTC (rev 23518)
+++ trunk/launchd/src/launchd_runtime.h 2008-02-20 20:36:39 UTC (rev 23519)
@@ -163,7 +163,7 @@
/* All of these log the return address as "arg4" */
INTERNAL_ABI void runtime_ktrace1(runtime_ktrace_code_t code);
INTERNAL_ABI void runtime_ktrace0(runtime_ktrace_code_t code);
-INTERNAL_ABI void runtime_ktrace(runtime_ktrace_code_t code, int a, int b, int c);
+INTERNAL_ABI void runtime_ktrace(runtime_ktrace_code_t code, long a, long b, long c);
#define LOG_APPLEONLY 0x4141504c /* AAPL in hex */
Modified: trunk/launchd/src/launchd_runtime_kill.c
===================================================================
--- trunk/launchd/src/launchd_runtime_kill.c 2008-02-15 22:18:20 UTC (rev 23518)
+++ trunk/launchd/src/launchd_runtime_kill.c 2008-02-20 20:36:39 UTC (rev 23519)
@@ -18,15 +18,19 @@
* @APPLE_APACHE_LICENSE_HEADER_END@
*/
-#if !defined(__LP64__) && !defined(__arm__)
-#define _NONSTD_SOURCE 1
+#if defined(__LP64__)
+/* ??? No way to get the old behavior */
#define old_kill(x, y) kill(x, y)
-#define old_killpg(x, y) killpg(x, y)
-#else
+#define old_killpg(x, y) kill(-(x), y)
+#elif defined(__arm__)
/* ??? No blessed way to get the old behavior */
extern int __kill(int, int, int);
#define old_kill(x, y) __kill(x, y, 0)
#define old_killpg(x, y) __kill(-(x), y, 0)
+#else
+#define _NONSTD_SOURCE 1
+#define old_kill(x, y) kill(x, y)
+#define old_killpg(x, y) killpg(x, y)
#endif
#include <signal.h>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20080220/75574aa5/attachment.html
More information about the launchd-changes
mailing list