<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre, #msg p { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[23519] trunk/launchd/src</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.macosforge.org/projects/launchd/changeset/23519">23519</a></dd>
<dt>Author</dt> <dd>zarzycki@apple.com</dd>
<dt>Date</dt> <dd>2008-02-20 12:36:39 -0800 (Wed, 20 Feb 2008)</dd>
</dl>
<h3>Log Message</h3>
<pre>Make launchd compile 64-bit. It still doesn't work. What remains is
malloc()/free() problems (in launchd_unix_ipc.c???).</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunklaunchdsrclaunchd_core_logicc">trunk/launchd/src/launchd_core_logic.c</a></li>
<li><a href="#trunklaunchdsrclaunchd_runtimec">trunk/launchd/src/launchd_runtime.c</a></li>
<li><a href="#trunklaunchdsrclaunchd_runtimeh">trunk/launchd/src/launchd_runtime.h</a></li>
<li><a href="#trunklaunchdsrclaunchd_runtime_killc">trunk/launchd/src/launchd_runtime_kill.c</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunklaunchdsrclaunchd_core_logicc"></a>
<div class="modfile"><h4>Modified: trunk/launchd/src/launchd_core_logic.c (23518 => 23519)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -4286,9 +4286,9 @@
</span><span class="cx">                 return;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-#if defined (__ppc__)
</del><ins>+#if defined (__ppc__) || defined(__ppc64__)
</ins><span class="cx">         f = PPC_THREAD_STATE64;
</span><del>-#elif defined(__i386__)
</del><ins>+#elif defined(__i386__) || defined(__x86_64__)
</ins><span class="cx">         f = x86_THREAD_STATE;
</span><span class="cx"> #elif defined(__arm__)
</span><span class="cx">         f = ARM_THREAD_STATE;
</span></span></pre></div>
<a id="trunklaunchdsrclaunchd_runtimec"></a>
<div class="modfile"><h4>Modified: trunk/launchd/src/launchd_runtime.c (23518 => 23519)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -113,6 +113,7 @@
</span><span class="cx">
</span><span class="cx"> static void do_file_init(void) __attribute__((constructor));
</span><span class="cx"> static mach_timebase_info_data_t tbi;
</span><ins>+static uint64_t tbi_safe_math_max;
</ins><span class="cx"> static double tbi_float_val;
</span><span class="cx">
</span><span class="cx"> static const int sigigns[] = { SIGHUP, SIGINT, SIGPIPE, SIGALRM, SIGTERM,
</span><span class="lines">@@ -1078,7 +1079,7 @@
</span><span class="cx">                         no_hang_fd = _fd(open("/dev/autofs_nowait", 0));
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                runtime_ktrace(RTKT_LAUNCHD_MACH_IPC|DBG_FUNC_START, bufRequest->Head.msgh_local_port, bufRequest->Head.msgh_id, (int)the_demux);
</del><ins>+                runtime_ktrace(RTKT_LAUNCHD_MACH_IPC|DBG_FUNC_START, bufRequest->Head.msgh_local_port, bufRequest->Head.msgh_id, (long)the_demux);
</ins><span class="cx">
</span><span class="cx">                 if (the_demux(&bufRequest->Head, &bufReply->Head) == FALSE) {
</span><span class="cx">                         /* XXX - also gross */
</span><span class="lines">@@ -1327,7 +1328,7 @@
</span><span class="cx">
</span><span class="cx">         /* This syscall returns EINVAL when the trace isn't enabled. */
</span><span class="cx">         if (do_apple_internal_logging) {
</span><del>-                syscall(180, code, 0, 0, 0, (int)ra);
</del><ins>+                syscall(180, code, 0, 0, 0, (long)ra);
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1338,18 +1339,18 @@
</span><span class="cx">
</span><span class="cx">         /* This syscall returns EINVAL when the trace isn't enabled. */
</span><span class="cx">         if (do_apple_internal_logging) {
</span><del>-                syscall(180, code, 0, 0, 0, (int)ra);
</del><ins>+                syscall(180, code, 0, 0, 0, (long)ra);
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> INTERNAL_ABI void
</span><del>-runtime_ktrace(runtime_ktrace_code_t code, int a, int b, int c)
</del><ins>+runtime_ktrace(runtime_ktrace_code_t code, long a, long b, long c)
</ins><span class="cx"> {
</span><span class="cx">         void *ra = __builtin_extract_return_addr(__builtin_return_address(0));
</span><span class="cx">
</span><span class="cx">         /* This syscall returns EINVAL when the trace isn't enabled. */
</span><span class="cx">         if (do_apple_internal_logging) {
</span><del>-                syscall(180, code, a, b, c, (int)ra);
</del><ins>+                syscall(180, code, a, b, c, (long)ra);
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1612,7 +1613,13 @@
</span><span class="cx"> #else
</span><span class="cx">         if (tbi.numer != tbi.denom) {
</span><span class="cx"> #endif
</span><del>-                if (o < INT32_MAX) {
</del><ins>+#ifdef __LP64__
+                __uint128_t tmp = o;
+                tmp *= tbi.numer;
+                tmp /= tbi.denom;
+                o = tmp;
+#else
+                if (o <= tbi_safe_math_max) {
</ins><span class="cx">                         o *= tbi.numer;
</span><span class="cx">                         o /= tbi.denom;
</span><span class="cx">                 } else {
</span><span class="lines">@@ -1620,6 +1627,7 @@
</span><span class="cx">                         d *= tbi_float_val;
</span><span class="cx">                         o = d;
</span><span class="cx">                 }
</span><ins>+#endif
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         return o;
</span><span class="lines">@@ -1633,6 +1641,7 @@
</span><span class="cx">         launchd_assert(mach_timebase_info(&tbi) == 0);
</span><span class="cx">         tbi_float_val = tbi.numer;
</span><span class="cx">         tbi_float_val /= tbi.denom;
</span><ins>+        tbi_safe_math_max = UINT64_MAX / tbi.numer;
</ins><span class="cx">
</span><span class="cx">         if (getpid() == 1) {
</span><span class="cx">                 pid1_magic = true;
</span></span></pre></div>
<a id="trunklaunchdsrclaunchd_runtimeh"></a>
<div class="modfile"><h4>Modified: trunk/launchd/src/launchd_runtime.h (23518 => 23519)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -163,7 +163,7 @@
</span><span class="cx"> /* All of these log the return address as "arg4" */
</span><span class="cx"> INTERNAL_ABI void runtime_ktrace1(runtime_ktrace_code_t code);
</span><span class="cx"> INTERNAL_ABI void runtime_ktrace0(runtime_ktrace_code_t code);
</span><del>-INTERNAL_ABI void runtime_ktrace(runtime_ktrace_code_t code, int a, int b, int c);
</del><ins>+INTERNAL_ABI void runtime_ktrace(runtime_ktrace_code_t code, long a, long b, long c);
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> #define LOG_APPLEONLY 0x4141504c /* AAPL in hex */
</span></span></pre></div>
<a id="trunklaunchdsrclaunchd_runtime_killc"></a>
<div class="modfile"><h4>Modified: trunk/launchd/src/launchd_runtime_kill.c (23518 => 23519)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -18,15 +18,19 @@
</span><span class="cx"> * @APPLE_APACHE_LICENSE_HEADER_END@
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#if !defined(__LP64__) && !defined(__arm__)
-#define _NONSTD_SOURCE 1
</del><ins>+#if defined(__LP64__)
+/* ??? No way to get the old behavior */
</ins><span class="cx"> #define old_kill(x, y) kill(x, y)
</span><del>-#define old_killpg(x, y) killpg(x, y)
-#else
</del><ins>+#define old_killpg(x, y) kill(-(x), y)
+#elif defined(__arm__)
</ins><span class="cx"> /* ??? No blessed way to get the old behavior */
</span><span class="cx"> extern int __kill(int, int, int);
</span><span class="cx"> #define old_kill(x, y) __kill(x, y, 0)
</span><span class="cx"> #define old_killpg(x, y) __kill(-(x), y, 0)
</span><ins>+#else
+#define _NONSTD_SOURCE 1
+#define old_kill(x, y) kill(x, y)
+#define old_killpg(x, y) killpg(x, y)
</ins><span class="cx"> #endif
</span><span class="cx"> #include <signal.h>
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>