From source_changes at macosforge.org Mon Dec 4 08:51:36 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:36 2007 Subject: [launchd-changes] [22963] trunk/launchd/src/launchd.c Message-ID: <20061204165136.9596A3CC300@cvs.opensource.apple.com> Revision: 22963 http://trac.macosforge.org/projects/launchd/changeset/22963 Author: zarzycki@apple.com Date: 2006-12-04 08:51:34 -0800 (Mon, 04 Dec 2006) Log Message: ----------- CrashTracer: 6 crashes in launchd at launchd: main + 1672 Modified Paths: -------------- trunk/launchd/src/launchd.c Modified: trunk/launchd/src/launchd.c =================================================================== --- trunk/launchd/src/launchd.c 2006-11-29 22:10:38 UTC (rev 22962) +++ trunk/launchd/src/launchd.c 2006-12-04 16:51:34 UTC (rev 22963) @@ -98,6 +98,7 @@ static bool get_network_state(void); static void monitor_networking_state(void); static void fatal_signal_handler(int sig, siginfo_t *si, void *uap); +static void handle_pid1_crashes_separately(void); static bool re_exec_in_single_user_mode = false; static char *pending_stdout = NULL; @@ -121,7 +122,6 @@ SIGTTIN, SIGTTOU, SIGIO, SIGXCPU, SIGXFSZ, SIGVTALRM, SIGPROF, SIGWINCH, SIGINFO, SIGUSR1, SIGUSR2 }; - struct sigaction fsa; bool sflag = false, dflag = false, Dflag = false; char ldconf[PATH_MAX] = PID1LAUNCHD_CONF; const char *h = getenv("HOME"); @@ -301,23 +301,35 @@ job_dispatch(fbj, true); } - if (getpid() == 1 && !job_active(rlcj)) { - init_pre_kevent(); + if (getpid() == 1) { + handle_pid1_crashes_separately(); + + if (!job_active(rlcj)) { + init_pre_kevent(); + } } + launchd_runtime(); +} + +void +handle_pid1_crashes_separately(void) +{ + struct sigaction fsa; + switch (setjmp(doom_doom_doom)) { - case SIGILL: - case SIGFPE: - syslog(LOG_EMERG, "We crashed at instruction: %p", crash_addr); - abort(); - case SIGBUS: - case SIGSEGV: - syslog(LOG_EMERG, "We crashed trying to read/write: %p", crash_addr); - abort(); - default: - abort(); - case 0: - break; + case SIGILL: + case SIGFPE: + syslog(LOG_EMERG, "We crashed at instruction: %p", crash_addr); + abort(); + case SIGBUS: + case SIGSEGV: + syslog(LOG_EMERG, "We crashed trying to read/write: %p", crash_addr); + abort(); + default: + abort(); + case 0: + break; } fsa.sa_sigaction = fatal_signal_handler; @@ -328,8 +340,6 @@ launchd_assumes(sigaction(SIGFPE, &fsa, NULL) != -1); launchd_assumes(sigaction(SIGBUS, &fsa, NULL) != -1); launchd_assumes(sigaction(SIGSEGV, &fsa, NULL) != -1); - - launchd_runtime(); } void -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061204/904fcb11/attachment.html From source_changes at macosforge.org Mon Dec 4 09:24:23 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:36 2007 Subject: [launchd-changes] [22964] trunk/launchd/src/launchd_core_logic.c Message-ID: <20061204172423.A5AA53CCBD8@cvs.opensource.apple.com> Revision: 22964 http://trac.macosforge.org/projects/launchd/changeset/22964 Author: zarzycki@apple.com Date: 2006-12-04 09:24:22 -0800 (Mon, 04 Dec 2006) Log Message: ----------- HOME environment variable not set in miniterm when run as loginitem Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-04 16:51:34 UTC (rev 22963) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-04 17:24:22 UTC (rev 22964) @@ -1921,6 +1921,7 @@ job_postfork_become_user(job_t j) { char loginname[2000]; + char homedir[PATH_MAX]; struct passwd *pwe; gid_t desired_gid = -1; uid_t desired_uid = -1; @@ -1944,6 +1945,7 @@ } strlcpy(loginname, pwe->pw_name, sizeof(loginname)); + strlcpy(homedir, pwe->pw_dir, sizeof(homedir)); if (pwe->pw_expire && time(NULL) >= pwe->pw_expire) { job_log(j, LOG_ERR, "Expired account"); @@ -1984,6 +1986,8 @@ job_log_error(j, LOG_ERR, "setuid(%u)", desired_uid); _exit(EXIT_FAILURE); } + + setenv("HOME", homedir, 0); } void -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061204/ea1c88bb/attachment.html From source_changes at macosforge.org Mon Dec 4 09:26:23 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:36 2007 Subject: [launchd-changes] [22965] trunk/launchd/src Message-ID: <20061204172623.B41A33CCC7C@cvs.opensource.apple.com> Revision: 22965 http://trac.macosforge.org/projects/launchd/changeset/22965 Author: zarzycki@apple.com Date: 2006-12-04 09:26:23 -0800 (Mon, 04 Dec 2006) Log Message: ----------- 9A318: /etc/launchd.conf forces all servers into user session Modified Paths: -------------- trunk/launchd/src/launchctl.c trunk/launchd/src/launchd.c Modified: trunk/launchd/src/launchctl.c =================================================================== --- trunk/launchd/src/launchctl.c 2006-12-04 17:24:22 UTC (rev 22964) +++ trunk/launchd/src/launchctl.c 2006-12-04 17:26:23 UTC (rev 22965) @@ -1180,6 +1180,11 @@ int hnmib[] = { CTL_KERN, KERN_HOSTNAME }; struct group *tfp_gr; + if (getuid() != 0) { + fprintf(stderr, "%s: Only root can run the 'bootstrap' sub-command right now.\n", getprogname()); + return 1; + } + if (assumes((tfp_gr = getgrnam("procview")) != NULL)) { int tfp_r_mib[3] = { CTL_KERN, KERN_TFP, KERN_TFP_READ_GROUP }; gid_t tfp_r_gid = tfp_gr->gr_gid; Modified: trunk/launchd/src/launchd.c =================================================================== --- trunk/launchd/src/launchd.c 2006-12-04 17:24:22 UTC (rev 22964) +++ trunk/launchd/src/launchd.c 2006-12-04 17:26:23 UTC (rev 22965) @@ -106,7 +106,7 @@ static job_t rlcj = NULL; static jmp_buf doom_doom_doom; static void *crash_addr; -static const char *launchctl_bootstrap_tool[] = { "/bin/launchctl", "bootstrap", NULL }; +static const char *launchctl_bootstrap_tool[] = { "/bin/launchctl", /* "bootstrap", */ NULL }; sigset_t blocked_signals = 0; bool shutdown_in_progress = false; -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061204/1a21daa4/attachment.html From source_changes at macosforge.org Mon Dec 4 09:34:49 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:36 2007 Subject: [launchd-changes] [22966] trunk/launchd/src Message-ID: <20061204173449.283C03CCF6E@cvs.opensource.apple.com> Revision: 22966 http://trac.macosforge.org/projects/launchd/changeset/22966 Author: zarzycki@apple.com Date: 2006-12-04 09:34:49 -0800 (Mon, 04 Dec 2006) Log Message: ----------- Less globals and no more need for a mount table update callback from the kernel (via kqueue). Now we can have stdout/stderr per jobmgr. Modified Paths: -------------- trunk/launchd/src/launchctl.c trunk/launchd/src/launchd.c trunk/launchd/src/launchd_core_logic.c trunk/launchd/src/launchd_core_logic.h Modified: trunk/launchd/src/launchctl.c =================================================================== --- trunk/launchd/src/launchctl.c 2006-12-04 17:26:23 UTC (rev 22965) +++ trunk/launchd/src/launchctl.c 2006-12-04 17:34:49 UTC (rev 22966) @@ -1719,22 +1719,16 @@ stdio_cmd(int argc, char *const argv[]) { launch_data_t resp, msg, tmp; - int e, fd = -1, r = 0; + int e, r = 0; if (argc != 2) { fprintf(stderr, "usage: %s %s \n", getprogname(), argv[0]); return 1; } - fd = open(argv[1], O_CREAT|O_APPEND|O_WRONLY|O_NOCTTY, DEFFILEMODE); - msg = launch_data_alloc(LAUNCH_DATA_DICTIONARY); - if (fd == -1) { - tmp = launch_data_new_string(argv[1]); - } else { - tmp = launch_data_new_fd(fd); - } + tmp = launch_data_new_string(argv[1]); if (!strcmp(argv[0], "stdout")) { launch_data_dict_insert(msg, tmp, LAUNCH_KEY_SETSTDOUT); @@ -1758,9 +1752,6 @@ r = 1; } - if (fd != -1) - close(fd); - launch_data_free(resp); return r; Modified: trunk/launchd/src/launchd.c =================================================================== --- trunk/launchd/src/launchd.c 2006-12-04 17:26:23 UTC (rev 22965) +++ trunk/launchd/src/launchd.c 2006-12-04 17:34:49 UTC (rev 22966) @@ -81,12 +81,10 @@ extern char **environ; static void signal_callback(void *, struct kevent *); -static void fs_callback(void); static void ppidexit_callback(void); static void pfsystem_callback(void *, struct kevent *); static kq_callback kqsignal_callback = signal_callback; -static kq_callback kqfs_callback = (kq_callback)fs_callback; static kq_callback kqppidexit_callback = (kq_callback)ppidexit_callback; static kq_callback kqpfsystem_callback = pfsystem_callback; @@ -101,8 +99,6 @@ static void handle_pid1_crashes_separately(void); static bool re_exec_in_single_user_mode = false; -static char *pending_stdout = NULL; -static char *pending_stderr = NULL; static job_t rlcj = NULL; static jmp_buf doom_doom_doom; static void *crash_addr; @@ -269,9 +265,6 @@ monitor_networking_state(); - /* do this after pid1_magic_init() to not catch ourselves mounting stuff */ - launchd_assumes(kevent_mod(0, EVFILT_FS, EV_ADD, 0, 0, &kqfs_callback) != -1); - if (session_type) { pid_t pp = getppid(); @@ -475,29 +468,6 @@ } void -fs_callback(void) -{ - if (pending_stdout) { - int fd = open(pending_stdout, O_CREAT|O_APPEND|O_WRONLY|O_NOCTTY, DEFFILEMODE); - if (fd != -1) { - launchd_assumes(dup2(fd, STDOUT_FILENO) != -1); - launchd_assumes(close(fd) == 0); - free(pending_stdout); - pending_stdout = NULL; - } - } - if (pending_stderr) { - int fd = open(pending_stderr, O_CREAT|O_APPEND|O_WRONLY|O_NOCTTY, DEFFILEMODE); - if (fd != -1) { - launchd_assumes(dup2(fd, STDERR_FILENO) != -1); - launchd_assumes(close(fd) == 0); - free(pending_stderr); - pending_stderr = NULL; - } - } -} - -void launchd_SessionCreate(void) { OSStatus (*sescr)(SessionCreationFlags flags, SessionAttributeBits attributes); @@ -534,17 +504,17 @@ launch_data_t resp = launch_data_new_errno(0); if (launch_data_get_type(o) == LAUNCH_DATA_STRING) { - char **where = &pending_stderr; - - if (d == STDOUT_FILENO) { - where = &pending_stdout; + switch (d) { + case STDOUT_FILENO: + jobmgr_set_stdout(root_jobmgr, launch_data_get_string(o)); + break; + case STDERR_FILENO: + jobmgr_set_stderr(root_jobmgr, launch_data_get_string(o)); + break; + default: + launch_data_set_errno(resp, EINVAL); + break; } - if (*where) { - free(*where); - } - *where = strdup(launch_data_get_string(o)); - } else if (launch_data_get_type(o) == LAUNCH_DATA_FD) { - launchd_assumes(dup2(launch_data_get_fd(o), d) != -1); } else { launch_data_set_errno(resp, EINVAL); } Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-04 17:26:23 UTC (rev 22965) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-04 17:34:49 UTC (rev 22966) @@ -3018,6 +3018,26 @@ return true; } +void +jobmgr_set_stdout(jobmgr_t jm, const char *what) +{ + if (jm->jm_stdout) { + free(jm->jm_stdout); + } + + jm->jm_stdout = strdup(what); +} + +void +jobmgr_set_stderr(jobmgr_t jm, const char *what) +{ + if (jm->jm_stderr) { + free(jm->jm_stderr); + } + + jm->jm_stderr = strdup(what); +} + char * jobmgr_get_stdout(jobmgr_t jm) { Modified: trunk/launchd/src/launchd_core_logic.h =================================================================== --- trunk/launchd/src/launchd_core_logic.h 2006-12-04 17:26:23 UTC (rev 22965) +++ trunk/launchd/src/launchd_core_logic.h 2006-12-04 17:34:49 UTC (rev 22966) @@ -29,6 +29,8 @@ extern jobmgr_t root_jobmgr; extern jobmgr_t gc_this_jobmgr; +void jobmgr_set_stdout(jobmgr_t jm, const char *what); +void jobmgr_set_stderr(jobmgr_t jm, const char *what); bool jobmgr_is_idle(jobmgr_t jm); void jobmgr_remove_all_inactive(jobmgr_t jm); void jobmgr_dispatch_all_other_semaphores(jobmgr_t jm, job_t nj); -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061204/32555104/attachment.html From source_changes at macosforge.org Mon Dec 4 09:44:33 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:36 2007 Subject: [launchd-changes] [22967] trunk/launchd/src/launchd.c Message-ID: <20061204174433.DEA633CD279@cvs.opensource.apple.com> Revision: 22967 http://trac.macosforge.org/projects/launchd/changeset/22967 Author: zarzycki@apple.com Date: 2006-12-04 09:44:33 -0800 (Mon, 04 Dec 2006) Log Message: ----------- It is probably, just probably, a good idea for the setjmp() to have a valid stack frame when returned to via longjmp(). :-P Modified Paths: -------------- trunk/launchd/src/launchd.c Modified: trunk/launchd/src/launchd.c =================================================================== --- trunk/launchd/src/launchd.c 2006-12-04 17:34:49 UTC (rev 22966) +++ trunk/launchd/src/launchd.c 2006-12-04 17:44:33 UTC (rev 22967) @@ -294,6 +294,21 @@ job_dispatch(fbj, true); } + switch (setjmp(doom_doom_doom)) { + case SIGILL: + case SIGFPE: + syslog(LOG_EMERG, "We crashed at instruction: %p", crash_addr); + abort(); + case SIGBUS: + case SIGSEGV: + syslog(LOG_EMERG, "We crashed trying to read/write: %p", crash_addr); + abort(); + default: + abort(); + case 0: + break; + } + if (getpid() == 1) { handle_pid1_crashes_separately(); @@ -310,21 +325,6 @@ { struct sigaction fsa; - switch (setjmp(doom_doom_doom)) { - case SIGILL: - case SIGFPE: - syslog(LOG_EMERG, "We crashed at instruction: %p", crash_addr); - abort(); - case SIGBUS: - case SIGSEGV: - syslog(LOG_EMERG, "We crashed trying to read/write: %p", crash_addr); - abort(); - default: - abort(); - case 0: - break; - } - fsa.sa_sigaction = fatal_signal_handler; fsa.sa_flags = SA_SIGINFO; sigemptyset(&fsa.sa_mask); -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061204/d1c0d8ca/attachment.html From source_changes at macosforge.org Mon Dec 4 14:29:37 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:36 2007 Subject: [launchd-changes] [22968] trunk/launchd/src/launchd_core_logic.c Message-ID: <20061204222937.23A1E3D1570@cvs.opensource.apple.com> Revision: 22968 http://trac.macosforge.org/projects/launchd/changeset/22968 Author: zarzycki@apple.com Date: 2006-12-04 14:29:36 -0800 (Mon, 04 Dec 2006) Log Message: ----------- Jobs don't have sub-jobs anymore. Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-04 17:44:33 UTC (rev 22967) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-04 22:29:36 UTC (rev 22968) @@ -497,22 +497,6 @@ launch_data_dict_insert(r, tmp, LAUNCH_JOBKEY_MACHSERVICES); } -#if 0 - /* jobs don't have subjobs anymore... */ - if (subjobs && !SLIST_EMPTY(&j->jobs) && (tmp = launch_data_alloc(LAUNCH_DATA_ARRAY))) { - job_t ji; - size_t i = 0; - - SLIST_FOREACH(ji, &j->jobs, sle) { - tmp2 = job_export2(ji, true); - launch_data_array_set_index(tmp, tmp2, i); - i++; - } - - launch_data_dict_insert(r, tmp, LAUNCH_JOBKEY_SUBJOBS); - } -#endif - return r; } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061204/3fa9bfff/attachment.html From source_changes at macosforge.org Mon Dec 4 14:47:27 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:36 2007 Subject: [launchd-changes] [22969] trunk/launchd/src/launchd_core_logic.c Message-ID: <20061204224727.D359B3D18BB@cvs.opensource.apple.com> Revision: 22969 http://trac.macosforge.org/projects/launchd/changeset/22969 Author: zarzycki@apple.com Date: 2006-12-04 14:47:27 -0800 (Mon, 04 Dec 2006) Log Message: ----------- USER environment variable not set running ARD startup script from Sharing Pref Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-04 22:29:36 UTC (rev 22968) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-04 22:47:27 UTC (rev 22969) @@ -1972,6 +1972,8 @@ } setenv("HOME", homedir, 0); + setenv("USER", loginname, 0); + setenv("LOGNAME", loginname, 0); } void -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061204/842f8815/attachment.html From source_changes at macosforge.org Mon Dec 4 14:59:12 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:36 2007 Subject: [launchd-changes] [22970] tags/launchd-178/ Message-ID: <20061204225912.A1CBC3D1991@cvs.opensource.apple.com> Revision: 22970 http://trac.macosforge.org/projects/launchd/changeset/22970 Author: zarzycki@apple.com Date: 2006-12-04 14:59:12 -0800 (Mon, 04 Dec 2006) Log Message: ----------- "Tagging launchd-178 from https://svn.macosforge.org/repository/launchd/trunk" Added Paths: ----------- tags/launchd-178/ Copied: tags/launchd-178 (from rev 22969, trunk) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061204/cd787eae/attachment.html From source_changes at macosforge.org Wed Dec 6 11:22:58 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:36 2007 Subject: [launchd-changes] [22971] trunk/launchd/src/launchd_core_logic.c Message-ID: <20061206192258.0F4873F4462@cvs.opensource.apple.com> Revision: 22971 http://trac.macosforge.org/projects/launchd/changeset/22971 Author: zarzycki@apple.com Date: 2006-12-06 11:22:57 -0800 (Wed, 06 Dec 2006) Log Message: ----------- switch to posix_spawn() Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-04 22:59:12 UTC (rev 22970) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-06 19:22:57 UTC (rev 22971) @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -70,6 +69,7 @@ #include #include #include +#include #include "liblaunch_public.h" #include "liblaunch_private.h" @@ -87,6 +87,8 @@ #define LAUNCHD_MIN_JOB_RUN_TIME 10 #define LAUNCHD_ADVISABLE_IDLE_TIMEOUT 30 +extern char **environ; + mach_port_t inherited_bootstrap_port; struct machservice { @@ -1683,11 +1685,6 @@ socketgroup_callback(j, kev); break; } - if (j->wait4debugger) { - /* Allow somebody else to attach */ - job_assumes(j, kill(j->p, SIGSTOP) != -1); - job_assumes(j, ptrace(PT_DETACH, j->p, NULL, 0) != -1); - } if (kev->data > 0) { int e; @@ -1824,10 +1821,15 @@ { const char *file2exec = "/usr/libexec/launchproxy"; const char **argv; + posix_spawnattr_t spattr; int gflags = GLOB_NOSORT|GLOB_NOCHECK|GLOB_TILDE|GLOB_DOOFFS; + pid_t junk_pid; glob_t g; + short spflags = POSIX_SPAWN_SETEXEC; int i; + posix_spawnattr_init(&spattr); + job_setup_attributes(j); if (j->argv && j->globargv) { @@ -1860,8 +1862,8 @@ argv++; } - if (j->wait4debugger && ptrace(PT_TRACE_ME, getpid(), NULL, 0) == -1) { - job_log_error(j, LOG_ERR, "ptrace(PT_TRACE_ME, ...)"); + if (j->wait4debugger) { + spflags |= POSIX_SPAWN_START_SUSPENDED; } if (j->force_ppc) { @@ -1873,12 +1875,14 @@ } } + posix_spawnattr_setflags(&spattr, spflags); + if (j->prog) { - execv(j->inetcompat ? file2exec : j->prog, (char *const*)argv); - job_log_error(j, LOG_ERR, "execv(\"%s\", ...)", j->prog); + posix_spawn(&junk_pid, j->inetcompat ? file2exec : j->prog, NULL, &spattr, (char *const*)argv, environ); + job_log_error(j, LOG_ERR, "posix_spawn(\"%s\", ...)", j->prog); } else { - execvp(j->inetcompat ? file2exec : argv[0], (char *const*)argv); - job_log_error(j, LOG_ERR, "execvp(\"%s\", ...)", argv[0]); + posix_spawnp(&junk_pid, j->inetcompat ? file2exec : argv[0], NULL, &spattr, (char *const*)argv, environ); + job_log_error(j, LOG_ERR, "posix_spawnp(\"%s\", ...)", argv[0]); } write(execfd, &errno, sizeof(errno)); -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061206/838a8e61/attachment.html From source_changes at macosforge.org Wed Dec 6 15:45:01 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:36 2007 Subject: [launchd-changes] [22972] trunk/launchd/src/launchd_core_logic.c Message-ID: <20061206234501.160BD3F7B75@cvs.opensource.apple.com> Revision: 22972 http://trac.macosforge.org/projects/launchd/changeset/22972 Author: zarzycki@apple.com Date: 2006-12-06 15:45:00 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Simplify the internal spawn logic. Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-06 19:22:57 UTC (rev 22971) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-06 23:45:00 UTC (rev 22972) @@ -254,7 +254,7 @@ pid_t p; int argc; int last_exit_status; - int execfd; + int forkfd; int nice; int timeout; int stdout_err_fd; @@ -288,7 +288,7 @@ static bool job_useless(job_t j); static bool job_keepalive(job_t j); static void job_start(job_t j); -static void job_start_child(job_t j, int execfd) __attribute__((noreturn)); +static void job_start_child(job_t j) __attribute__((noreturn)); static void job_setup_attributes(job_t j); static bool job_setup_machport(job_t j); static void job_setup_fd(job_t j, int target_fd, const char *path, int flags); @@ -595,8 +595,8 @@ SLIST_REMOVE(&j->mgr->jobs, j, job_s, sle); } - if (j->execfd) { - job_assumes(j, close(j->execfd) == 0); + if (j->forkfd) { + job_assumes(j, close(j->forkfd) != -1); } if (j->j_port) { @@ -1562,9 +1562,9 @@ job_log(j, LOG_DEBUG, "Reaping"); - if (j->execfd) { - job_assumes(j, close(j->execfd) == 0); - j->execfd = 0; + if (j->forkfd) { + job_assumes(j, close(j->forkfd) != -1); + j->forkfd = 0; } if (!job_assumes(j, wait4(j->p, &status, 0, &ru) != -1)) { @@ -1681,22 +1681,7 @@ watchpath_callback(j, kev); break; case EVFILT_READ: - if ((int)kev->ident != j->execfd) { - socketgroup_callback(j, kev); - break; - } - if (kev->data > 0) { - int e; - - read(j->execfd, &e, sizeof(e)); - errno = e; - job_log_error(j, LOG_ERR, "execve()"); - job_remove(j); - j = NULL; - } else { - job_assumes(j, close(j->execfd) == 0); - j->execfd = 0; - } + socketgroup_callback(j, kev); break; case EVFILT_MACHPORT: job_dispatch(j, true); @@ -1785,19 +1770,16 @@ snprintf(nbuf, sizeof(nbuf), "%d", spair[1]); setenv(LAUNCHD_TRUSTED_FD_ENV, nbuf, 1); } - job_start_child(j, execspair[1]); + job_start_child(j); break; default: j->p = c; + j->forkfd = _fd(execspair[0]); job_assumes(j, close(execspair[1]) == 0); - j->execfd = _fd(execspair[0]); if (sipc) { job_assumes(j, close(spair[1]) == 0); ipc_open(_fd(spair[0]), j); } - if (kevent_mod(j->execfd, EVFILT_READ, EV_ADD, 0, 0, &j->kqjob_callback) == -1) { - job_log_error(j, LOG_ERR, "kevent_mod(j->execfd): %m"); - } if (kevent_mod(c, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, &j->kqjob_callback) == -1) { job_log_error(j, LOG_ERR, "kevent()"); job_reap(j); @@ -1808,16 +1790,14 @@ } if (!j->stall_before_exec) { - /* this unblocks the child and avoids a race - * between the above fork() and the kevent_mod() */ - write(j->execfd, &c, sizeof(c)); + job_uncork_fork(j); } break; } } void -job_start_child(job_t j, int execfd) +job_start_child(job_t j) { const char *file2exec = "/usr/libexec/launchproxy"; const char **argv; @@ -1885,8 +1865,7 @@ job_log_error(j, LOG_ERR, "posix_spawnp(\"%s\", ...)", argv[0]); } - write(execfd, &errno, sizeof(errno)); - exit(EXIT_FAILURE); + _exit(EXIT_FAILURE); } void jobmgr_setup_env_from_other_jobs(jobmgr_t jm) @@ -3063,15 +3042,12 @@ { pid_t c = j->p; - if (j->stall_before_exec) { - job_log(j, LOG_DEBUG, "Uncorking the fork()."); - /* this unblocks the child and avoids a race - * between the above fork() and the kevent_mod() */ - write(j->execfd, &c, sizeof(c)); - j->stall_before_exec = false; - } else { - job_log(j, LOG_WARNING, "Attempt to uncork a job that isn't in the middle of a fork()."); - } + job_log(j, LOG_DEBUG, "Uncorking the fork()."); + /* this unblocks the child and avoids a race + * between the above fork() and the kevent_mod() */ + job_assumes(j, write(j->forkfd, &c, sizeof(c)) == sizeof(c)); + job_assumes(j, close(j->forkfd) != -1); + j->forkfd = 0; } jobmgr_t @@ -4316,8 +4292,13 @@ return BOOTSTRAP_NO_MEMORY; } - job_uncork_fork(j); + if (!j->stall_before_exec) { + job_log(j, LOG_WARNING, "Attempt to uncork a job that isn't in the middle of a fork()."); + return 1; + } + job_uncork_fork(j); + j->stall_before_exec = false; return 0; } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061206/8e3d37e9/attachment.html From source_changes at macosforge.org Wed Dec 6 15:49:25 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:36 2007 Subject: [launchd-changes] [22973] tags/launchd-179/ Message-ID: <20061206234925.204E33F7BE3@cvs.opensource.apple.com> Revision: 22973 http://trac.macosforge.org/projects/launchd/changeset/22973 Author: zarzycki@apple.com Date: 2006-12-06 15:49:24 -0800 (Wed, 06 Dec 2006) Log Message: ----------- "Tagging launchd-179 from https://svn.macosforge.org/repository/launchd/trunk" Added Paths: ----------- tags/launchd-179/ Copied: tags/launchd-179 (from rev 22972, trunk) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061206/396f80d9/attachment.html From source_changes at macosforge.org Thu Dec 7 11:43:17 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22974] trunk/launchd/src/launchd_core_logic.c Message-ID: <20061207194317.647B240294F@cvs.opensource.apple.com> Revision: 22974 http://trac.macosforge.org/projects/launchd/changeset/22974 Author: zarzycki@apple.com Date: 2006-12-07 11:43:17 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Better logging. Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-06 23:49:24 UTC (rev 22973) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-07 19:43:17 UTC (rev 22974) @@ -1922,6 +1922,12 @@ desired_uid = pwe->pw_uid; desired_gid = pwe->pw_gid; + if (j->username && strcmp(j->username, loginname) != 0) { + job_log(j, LOG_WARNING, "Suspicious setup: User \"%s\" maps to user: %s", j->username, loginname); + } else if (j->mach_uid && (j->mach_uid != desired_uid)) { + job_log(j, LOG_WARNING, "Suspicious setup: UID %u maps to UID %u", j->mach_uid, desired_uid); + } + if (j->groupname) { struct group *gre; @@ -3213,7 +3219,7 @@ if (ms->recv) { if (ms->isActive) { /* FIXME we should cancel the notification */ - job_log(ms->job, LOG_ERR, "Mach service deleted while we didn't own the receive right: %s", ms->name); + job_log(ms->job, LOG_DEBUG, "Mach service deleted while we didn't own the receive right: %s", ms->name); } else { job_assumes(ms->job, launchd_mport_close_recv(ms->port) == KERN_SUCCESS); } @@ -3673,9 +3679,11 @@ } } else #endif - if ((getuid() != 0) && server_uid) { - job_log(j, LOG_WARNING, "Server create: \"%s\": As UID %d, we will not be able to switch to UID %d", - server_cmd, getuid(), server_uid); + if (getuid()) { + if (server_uid != getuid()) { + job_log(j, LOG_WARNING, "Server create: \"%s\": As UID %d, we will not be able to switch to UID %d", + server_cmd, getuid(), server_uid); + } server_uid = 0; /* zero means "do nothing" */ } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061207/ca7cbcd9/attachment.html From source_changes at macosforge.org Tue Dec 12 08:50:00 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22975] trunk/launchd/src/launchd_core_logic.c Message-ID: <20061212165000.219C84589D6@cvs.opensource.apple.com> Revision: 22975 http://trac.macosforge.org/projects/launchd/changeset/22975 Author: zarzycki@apple.com Date: 2006-12-12 08:49:59 -0800 (Tue, 12 Dec 2006) Log Message: ----------- Switch to posix_spawn for more cases. Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-07 19:43:17 UTC (rev 22974) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-12 16:49:59 UTC (rev 22975) @@ -3383,21 +3383,15 @@ void job_force_sampletool(job_t j) { + char *sample_args[] = { "sample", NULL, "1", "-mayDie", NULL }; char pidstr[100]; pid_t sp; snprintf(pidstr, sizeof(pidstr), "%u", j->p); + sample_args[1] = pidstr; - switch ((sp = fork())) { - case -1: - job_log_error(j, LOG_DEBUG, "Failed to spawn sample tool"); - break; - case 0: - job_assumes(j, execlp("sample", "sample", pidstr, "1", "-mayDie", NULL) != -1); - _exit(EXIT_FAILURE); - default: + if (job_assumes(j, posix_spawnp(&sp, sample_args[0], NULL, NULL, sample_args, environ) == 0)) { job_assumes(j, kevent_mod(sp, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, &kqsimple_zombie_reaper) != -1); - break; } } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061212/07db181e/attachment.html From source_changes at macosforge.org Tue Dec 12 09:08:30 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22976] trunk/launchd/src/launchd_core_logic.c Message-ID: <20061212170830.66B5B458CFE@cvs.opensource.apple.com> Revision: 22976 http://trac.macosforge.org/projects/launchd/changeset/22976 Author: zarzycki@apple.com Date: 2006-12-12 09:08:30 -0800 (Tue, 12 Dec 2006) Log Message: ----------- Leopard9A321: SHELL environment variable not set Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-12 16:49:59 UTC (rev 22975) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-12 17:08:30 UTC (rev 22976) @@ -1888,6 +1888,7 @@ job_postfork_become_user(job_t j) { char loginname[2000]; + char shellpath[PATH_MAX]; char homedir[PATH_MAX]; struct passwd *pwe; gid_t desired_gid = -1; @@ -1911,6 +1912,7 @@ return; } + strlcpy(shellpath, pwe->pw_shell, sizeof(shellpath)); strlcpy(loginname, pwe->pw_name, sizeof(loginname)); strlcpy(homedir, pwe->pw_dir, sizeof(homedir)); @@ -1960,6 +1962,7 @@ _exit(EXIT_FAILURE); } + setenv("SHELL", shellpath, 0); setenv("HOME", homedir, 0); setenv("USER", loginname, 0); setenv("LOGNAME", loginname, 0); -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061212/babed665/attachment.html From source_changes at macosforge.org Thu Dec 14 09:29:56 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22977] trunk/launchd Message-ID: <20061214172956.DB6C94600FB@cvs.opensource.apple.com> Revision: 22977 http://trac.macosforge.org/projects/launchd/changeset/22977 Author: zarzycki@apple.com Date: 2006-12-14 09:29:56 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Investigation: Figure out what remaining processes are hanging at shutdown Modified Paths: -------------- trunk/launchd/configure trunk/launchd/src/Makefile.am trunk/launchd/src/Makefile.in trunk/launchd/src/launchd.c Added Paths: ----------- trunk/launchd/src/shutdown_debugger.8 trunk/launchd/src/shutdown_debugger.c Modified: trunk/launchd/configure =================================================================== --- trunk/launchd/configure 2006-12-12 17:08:30 UTC (rev 22976) +++ trunk/launchd/configure 2006-12-14 17:29:56 UTC (rev 22977) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.60 for launchd 1.0. +# Generated by GNU Autoconf 2.61 for launchd 1.0. # # Report bugs to . # @@ -12,7 +12,8 @@ ## M4sh Initialization. ## ## --------------------- ## -# Be Bourne compatible +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -21,12 +22,15 @@ alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + + # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' @@ -217,7 +221,7 @@ else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. @@ -235,7 +239,6 @@ # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF -# Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -244,18 +247,19 @@ alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF -# Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -264,11 +268,13 @@ alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + : (as_func_return () { (exit $1) @@ -514,19 +520,28 @@ as_mkdir_p=false fi -# Find out whether ``test -x'' works. Don't use a zero-byte file, as -# systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - as_executable_p="test -x" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' else - as_executable_p=: + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' fi -rm -f conf$$.file +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -567,39 +582,41 @@ # Factoring default headers for most tests. ac_includes_default="\ #include -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H # include #endif -#if HAVE_SYS_STAT_H +#ifdef HAVE_SYS_STAT_H # include #endif -#if STDC_HEADERS +#ifdef STDC_HEADERS # include # include #else -# if HAVE_STDLIB_H +# ifdef HAVE_STDLIB_H # include # endif #endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif -#if HAVE_STRINGS_H +#ifdef HAVE_STRINGS_H # include #endif -#if HAVE_INTTYPES_H +#ifdef HAVE_INTTYPES_H # include #endif -#if HAVE_STDINT_H +#ifdef HAVE_STDINT_H # include #endif -#if HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H # include #endif" +ac_header_list= +ac_func_list= ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME @@ -690,6 +707,7 @@ CC CFLAGS LDFLAGS +LIBS CPPFLAGS CPP' @@ -797,10 +815,10 @@ -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) @@ -816,10 +834,10 @@ -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ @@ -1013,19 +1031,19 @@ -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=no ;; --x) @@ -1275,6 +1293,7 @@ CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory + LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor @@ -1344,7 +1363,7 @@ if $ac_init_version; then cat <<\_ACEOF launchd configure 1.0 -generated by GNU Autoconf 2.60 +generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. @@ -1358,7 +1377,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by launchd $as_me 1.0, which was -generated by GNU Autoconf 2.60. Invocation command line was +generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -1630,6 +1649,9 @@ >$cache_file fi +ac_header_list="$ac_header_list sys/time.h" +ac_header_list="$ac_header_list unistd.h" +ac_func_list="$ac_func_list alarm" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -1779,7 +1801,7 @@ # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -1945,7 +1967,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2080,7 +2102,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2120,7 +2142,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2200,7 +2222,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2240,7 +2262,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2297,7 +2319,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2338,7 +2360,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -2396,7 +2418,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2440,7 +2462,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2581,7 +2603,7 @@ # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. -for ac_file in $ac_files +for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in @@ -2609,6 +2631,12 @@ test "$ac_cv_exeext" = no && ac_cv_exeext= else + ac_file='' +fi + +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } +if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -2620,8 +2648,6 @@ fi ac_exeext=$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6; } # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. @@ -2799,27 +2825,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 @@ -2874,27 +2883,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 @@ -2929,27 +2921,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 @@ -2985,27 +2960,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 @@ -3121,27 +3079,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 @@ -3369,7 +3310,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3409,7 +3350,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3495,27 +3436,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 @@ -3588,27 +3512,11 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_search_opendir=$ac_res else echo "$as_me: failed program was:" >&5 @@ -3617,7 +3525,7 @@ fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then break @@ -3688,27 +3596,11 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_search_opendir=$ac_res else echo "$as_me: failed program was:" >&5 @@ -3717,7 +3609,7 @@ fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then break @@ -3793,17 +3685,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : else echo "$as_me: failed program was:" >&5 @@ -3837,17 +3722,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then # Broken: success on invalid input. continue else @@ -3912,17 +3790,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : else echo "$as_me: failed program was:" >&5 @@ -3956,17 +3827,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then # Broken: success on invalid input. continue else @@ -4021,7 +3885,7 @@ for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_executable_p "$ac_path_GREP"; } || continue + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in @@ -4103,7 +3967,7 @@ for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_executable_p "$ac_path_EGREP"; } || continue + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in @@ -4199,27 +4063,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 @@ -4396,27 +4243,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_header_sys_wait_h=yes else echo "$as_me: failed program was:" >&5 @@ -4479,27 +4309,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 @@ -4578,27 +4391,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -4634,17 +4430,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -4810,27 +4599,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_header_stdbool_h=yes else echo "$as_me: failed program was:" >&5 @@ -4880,27 +4652,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type__Bool=yes else echo "$as_me: failed program was:" >&5 @@ -4949,10 +4704,10 @@ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; - const charset x; + const charset cs; /* SunOS 4.1.1 cc rejects this. */ - char const *const *ccp; - char **p; + char const *const *pcpcc; + char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; @@ -4961,11 +4716,11 @@ an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; - ccp = &g + (g ? g-g : 0); + pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ - ++ccp; - p = (char**) ccp; - ccp = (char const *const *) p; + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; @@ -4992,7 +4747,7 @@ const int foo = 10; if (!foo) return 0; } - return !x[0] && !zero.x; + return !cs[0] && !zero.x; #endif ; @@ -5012,27 +4767,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 @@ -5128,27 +4866,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type_mode_t=yes else echo "$as_me: failed program was:" >&5 @@ -5208,27 +4929,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type_off_t=yes else echo "$as_me: failed program was:" >&5 @@ -5288,27 +4992,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type_pid_t=yes else echo "$as_me: failed program was:" >&5 @@ -5368,27 +5055,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 @@ -5448,27 +5118,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_header_time=yes else echo "$as_me: failed program was:" >&5 @@ -5506,7 +5159,9 @@ int main () { -struct tm *tp; tp->tm_sec; +struct tm tm; + int *p = &tm.tm_sec; + return !p; ; return 0; } @@ -5524,27 +5179,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_struct_tm=time.h else echo "$as_me: failed program was:" >&5 @@ -5603,27 +5241,11 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_working_alloca_h=yes else echo "$as_me: failed program was:" >&5 @@ -5632,7 +5254,7 @@ ac_cv_working_alloca_h=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 @@ -5663,7 +5285,7 @@ # include # define alloca _alloca # else -# if HAVE_ALLOCA_H +# ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX @@ -5699,27 +5321,11 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_func_alloca_works=yes else echo "$as_me: failed program was:" >&5 @@ -5728,7 +5334,7 @@ ac_cv_func_alloca_works=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 @@ -5848,27 +5454,11 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -5877,7 +5467,7 @@ eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -6085,27 +5675,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -6141,17 +5714,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -6283,27 +5849,11 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -6312,7 +5862,7 @@ eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -6425,7 +5975,7 @@ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include -#if HAVE_VFORK_H +#ifdef HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming @@ -6920,27 +6470,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -6976,17 +6509,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -7064,7 +6590,7 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if STDC_HEADERS || HAVE_STDLIB_H +#if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); @@ -7143,7 +6669,8 @@ -for ac_header in stdlib.h sys/time.h unistd.h + +for ac_header in $ac_header_list do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then @@ -7181,27 +6708,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -7237,17 +6747,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -7312,7 +6815,14 @@ done -for ac_func in alarm + + + + + + + +for ac_func in $ac_func_list do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -7378,27 +6888,11 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -7407,7 +6901,7 @@ eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -7421,6 +6915,22 @@ fi done + + + + + + + + + + + + + + + + { echo "$as_me:$LINENO: checking for working mktime" >&5 echo $ECHO_N "checking for working mktime... $ECHO_C" >&6; } if test "${ac_cv_func_working_mktime+set}" = set; then @@ -7436,26 +6946,24 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Test program from Paul Eggert and Tony Leneis. */ -#if TIME_WITH_SYS_TIME +#ifdef TIME_WITH_SYS_TIME # include # include #else -# if HAVE_SYS_TIME_H +# ifdef HAVE_SYS_TIME_H # include # else # include # endif #endif -#if HAVE_STDLIB_H -# include -#endif +#include -#if HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H # include #endif -#if !HAVE_ALARM +#ifndef HAVE_ALARM # define alarm(X) /* empty */ #endif @@ -7556,6 +7064,36 @@ return 1; } +static int +year_2050_test () +{ + /* The correct answer for 2050-02-01 00:00:00 in Pacific time, + ignoring leap seconds. */ + unsigned long int answer = 2527315200UL; + + struct tm tm; + time_t t; + tm.tm_year = 2050 - 1900; + tm.tm_mon = 2 - 1; + tm.tm_mday = 1; + tm.tm_hour = tm.tm_min = tm.tm_sec = 0; + tm.tm_isdst = -1; + + /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0" + instead of "TZ=America/Vancouver" in order to detect the bug even + on systems that don't support the Olson extension, or don't have the + full zoneinfo tables installed. */ + putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); + + t = mktime (&tm); + + /* Check that the result is either a failure, or close enough + to the correct answer that we can assume the discrepancy is + due to leap seconds. */ + return (t == (time_t) -1 + || (0 < t && answer - 120 <= t && t <= answer + 120)); +} + int main () { @@ -7593,7 +7131,7 @@ if (! bigtime_test (j - 1)) return 1; } - return ! (irix_6_4_bug () && spring_forward_gap ()); + return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ()); } _ACEOF rm -f conftest$ac_exeext @@ -7681,27 +7219,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -7737,17 +7258,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -7878,27 +7392,11 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -7907,7 +7405,7 @@ eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -7964,21 +7462,21 @@ #include #include -#if !STDC_HEADERS && !HAVE_STDLIB_H +#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H char *malloc (); #endif /* This mess was copied from the GNU getpagesize.h. */ -#if !HAVE_GETPAGESIZE +#ifndef HAVE_GETPAGESIZE /* Assume that all systems that can run configure have sys/param.h. */ -# if !HAVE_SYS_PARAM_H +# ifndef HAVE_SYS_PARAM_H # define HAVE_SYS_PARAM_H 1 # endif # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ -# if HAVE_SYS_PARAM_H +# ifdef HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE @@ -8146,27 +7644,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -8202,17 +7683,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -8290,7 +7764,7 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if STDC_HEADERS || HAVE_STDLIB_H +#if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *realloc (); @@ -8406,27 +7880,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -8462,17 +7919,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -8551,10 +8001,10 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -#if HAVE_SYS_SELECT_H +#ifdef HAVE_SYS_SELECT_H # include #endif -#if HAVE_SYS_SOCKET_H +#ifdef HAVE_SYS_SOCKET_H # include #endif @@ -8581,27 +8031,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3 else echo "$as_me: failed program was:" >&5 @@ -8676,27 +8109,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type_signal=int else echo "$as_me: failed program was:" >&5 @@ -8874,27 +8290,11 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -8903,7 +8303,7 @@ eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -9073,7 +8473,8 @@ ## M4sh Initialization. ## ## --------------------- ## -# Be Bourne compatible +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -9082,12 +8483,15 @@ alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + + # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' @@ -9309,19 +8713,28 @@ as_mkdir_p=false fi -# Find out whether ``test -x'' works. Don't use a zero-byte file, as -# systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - as_executable_p="test -x" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' else - as_executable_p=: + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' fi -rm -f conf$$.file +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -9337,7 +8750,7 @@ # values after options handling. ac_log=" This file was extended by launchd $as_me 1.0, which was -generated by GNU Autoconf 2.60. Invocation command line was +generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -9366,7 +8779,7 @@ Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit - -V, --version print version number, then exit + -V, --version print version number and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions @@ -9390,7 +8803,7 @@ cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ launchd config.status 1.0 -configured by $0, generated by GNU Autoconf 2.60, +configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. Modified: trunk/launchd/src/Makefile.am =================================================================== --- trunk/launchd/src/Makefile.am 2006-12-12 17:08:30 UTC (rev 22976) +++ trunk/launchd/src/Makefile.am 2006-12-14 17:29:56 UTC (rev 22977) @@ -32,7 +32,7 @@ bin_PROGRAMS = launchctl wait4path sbin_PROGRAMS = launchd SystemStarter -libexec_PROGRAMS = launchproxy +libexec_PROGRAMS = launchproxy shutdown_debugger sysconf_DATA = hostconfig rc.common rc.netboot rc.shutdown Modified: trunk/launchd/src/Makefile.in =================================================================== --- trunk/launchd/src/Makefile.in 2006-12-12 17:08:30 UTC (rev 22976) +++ trunk/launchd/src/Makefile.in 2006-12-14 17:29:56 UTC (rev 22977) @@ -40,7 +40,8 @@ @LIBS_ONLY_FALSE@bin_PROGRAMS = launchctl$(EXEEXT) wait4path$(EXEEXT) @LIBS_ONLY_FALSE@sbin_PROGRAMS = launchd$(EXEEXT) \ @LIBS_ONLY_FALSE@ SystemStarter$(EXEEXT) -@LIBS_ONLY_FALSE@libexec_PROGRAMS = launchproxy$(EXEEXT) +@LIBS_ONLY_FALSE@libexec_PROGRAMS = launchproxy$(EXEEXT) \ +@LIBS_ONLY_FALSE@ shutdown_debugger$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/config.h.in @@ -109,6 +110,9 @@ launchproxy_SOURCES = launchproxy.c launchproxy_OBJECTS = launchproxy.$(OBJEXT) launchproxy_LDADD = $(LDADD) +shutdown_debugger_SOURCES = shutdown_debugger.c +shutdown_debugger_OBJECTS = shutdown_debugger.$(OBJEXT) +shutdown_debugger_LDADD = $(LDADD) wait4path_SOURCES = wait4path.c wait4path_OBJECTS = wait4path.$(OBJEXT) wait4path_LDADD = $(LDADD) @@ -123,11 +127,12 @@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(liblaunch_a_SOURCES) $(liblaunch_profile_a_SOURCES) \ $(SystemStarter_SOURCES) launchctl.c $(launchd_SOURCES) \ - launchproxy.c wait4path.c + launchproxy.c shutdown_debugger.c wait4path.c DIST_SOURCES = $(am__liblaunch_a_SOURCES_DIST) \ $(am__liblaunch_profile_a_SOURCES_DIST) \ $(am__SystemStarter_SOURCES_DIST) launchctl.c \ - $(am__launchd_SOURCES_DIST) launchproxy.c wait4path.c + $(am__launchd_SOURCES_DIST) launchproxy.c shutdown_debugger.c \ + wait4path.c man1dir = $(mandir)/man1 man5dir = $(mandir)/man5 man8dir = $(mandir)/man8 @@ -393,6 +398,9 @@ launchproxy$(EXEEXT): $(launchproxy_OBJECTS) $(launchproxy_DEPENDENCIES) @rm -f launchproxy$(EXEEXT) $(LINK) $(launchproxy_LDFLAGS) $(launchproxy_OBJECTS) $(launchproxy_LDADD) $(LIBS) +shutdown_debugger$(EXEEXT): $(shutdown_debugger_OBJECTS) $(shutdown_debugger_DEPENDENCIES) + @rm -f shutdown_debugger$(EXEEXT) + $(LINK) $(shutdown_debugger_LDFLAGS) $(shutdown_debugger_OBJECTS) $(shutdown_debugger_LDADD) $(LIBS) wait4path$(EXEEXT): $(wait4path_OBJECTS) $(wait4path_DEPENDENCIES) @rm -f wait4path$(EXEEXT) $(LINK) $(wait4path_LDFLAGS) $(wait4path_OBJECTS) $(wait4path_LDADD) $(LIBS) @@ -445,6 +453,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblaunch_profile_a-protocol_vprocUser.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvproc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protocol_vprocUser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shutdown_debugger.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wait4path.Po@am__quote@ .c.o: Modified: trunk/launchd/src/launchd.c =================================================================== --- trunk/launchd/src/launchd.c 2006-12-12 17:08:30 UTC (rev 22976) +++ trunk/launchd/src/launchd.c 2006-12-14 17:29:56 UTC (rev 22977) @@ -63,6 +63,7 @@ #include #include #include +#include #include "libbootstrap_public.h" #include "libvproc_public.h" @@ -82,10 +83,12 @@ static void signal_callback(void *, struct kevent *); static void ppidexit_callback(void); +static void debugshutdown_callback(void); static void pfsystem_callback(void *, struct kevent *); static kq_callback kqsignal_callback = signal_callback; static kq_callback kqppidexit_callback = (kq_callback)ppidexit_callback; +static kq_callback kqdebugshutdown_callback = (kq_callback)debugshutdown_callback; static kq_callback kqpfsystem_callback = pfsystem_callback; static void pid1_magic_init(bool sflag); @@ -401,14 +404,15 @@ void launchd_shutdown(void) { - struct stat sb; - if (shutdown_in_progress) { return; } shutdown_in_progress = true; +#if 0 + struct stat sb; + if (stat("/var/db/debugShutdownHangs", &sb) != -1) { /* * When this changes to a more sustainable API, update this: @@ -416,6 +420,12 @@ */ debug_shutdown_hangs = true; } +#else + if (getpid() == 1) { + launchd_assumes(kevent_mod((uintptr_t)debugshutdown_callback, + EVFILT_TIMER, EV_ADD|EV_ONESHOT, NOTE_SECONDS, 5, &kqdebugshutdown_callback) != -1); + } +#endif rlcj = NULL; @@ -656,3 +666,14 @@ init_pre_kevent(); } } + +void +debugshutdown_callback(void) +{ + char *sdd_args[] = { "/usr/libexec/shutdown_debugger", NULL }; + pid_t sddp; + + if (launchd_assumes(posix_spawn(&sddp, sdd_args[0], NULL, NULL, sdd_args, environ) == 0)) { + launchd_assumes(kevent_mod(sddp, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, &kqsimple_zombie_reaper) != -1); + } +} Added: trunk/launchd/src/shutdown_debugger.8 =================================================================== --- trunk/launchd/src/shutdown_debugger.8 (rev 0) +++ trunk/launchd/src/shutdown_debugger.8 2006-12-14 17:29:56 UTC (rev 22977) @@ -0,0 +1,10 @@ +.Dd December 14, 2006 +.Dt shutdown_debugger 8 +.Os Darwin +.Sh NAME +.Nm shutdown_debugger +.Nd tool to aid debugging shutdowns +.Sh SYNOPSIS +.Nm +.Sh DESCRIPTION +This tool is invoked a few seconds after a shutdown or reboot request to figure out why the machine isn't off yet. Useful debug files are placed in /var/log/shutdown. Added: trunk/launchd/src/shutdown_debugger.c =================================================================== --- trunk/launchd/src/shutdown_debugger.c (rev 0) +++ trunk/launchd/src/shutdown_debugger.c 2006-12-14 17:29:56 UTC (rev 22977) @@ -0,0 +1,526 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern char **environ; + +struct hproc { + TAILQ_ENTRY(hproc) tqe; + pid_t stuck_p; + pid_t sample_p; +}; + +static void hproc_new(pid_t p, const char *pname); + +static TAILQ_HEAD(hproc_head, hproc) hprocs = TAILQ_HEAD_INITIALIZER(hprocs); + +static void populate_proc_list(void); +static void debug_machports(pid_t pid, const char *pname); +static void debug_machports2(pid_t pid, FILE *where); + +static int kq; + +#define SHUTDOWN_LOG_DIR "/var/log/shutdown" + +int +main(void) +{ + struct kevent kev; + struct stat sb; + struct hproc *hp; + struct dirent *de; + DIR *thedir; + int wstatus; + + mkdir(SHUTDOWN_LOG_DIR, S_IRWXU); + + assert(lstat(SHUTDOWN_LOG_DIR, &sb) != -1); + + assert(S_ISDIR(sb.st_mode)); + + assert(chdir(SHUTDOWN_LOG_DIR) != -1); + + assert((thedir = opendir(".")) != NULL); + + while ((de = readdir(thedir))) { + if (strcmp(de->d_name, ".") == 0) { + continue; + } else if (strcmp(de->d_name, "..") == 0) { + continue; + } else { + remove(de->d_name); + } + } + + closedir(thedir); + + assert((kq = kqueue()) != -1); + + debug_machports(1, "launchd"); + + populate_proc_list(); + + while (!TAILQ_EMPTY(&hprocs)) { + assert(kevent(kq, NULL, 0, &kev, 1, NULL) != -1); + + hp = kev.udata; + + assert(waitpid(hp->sample_p, &wstatus, 0) != -1); + + TAILQ_REMOVE(&hprocs, hp, tqe); + } + + exit(EXIT_SUCCESS); +} + +void +populate_proc_list(void) +{ + int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL }; + struct kinfo_proc *kp = NULL; + size_t i, len = 0; + + assert(sysctl(mib, 3, kp, &len, NULL, 0) != -1); + + assert((kp = malloc(len * 2)) != NULL); + + assert(sysctl(mib, 3, kp, &len, NULL, 0) != -1); + + for (i = 0; i < (len / sizeof(struct kinfo_proc)); i++) { + pid_t p_iter = kp[i].kp_proc.p_pid; + + if (p_iter == 0 || p_iter == 1 || p_iter == getpid()) { + continue; + } + + hproc_new(p_iter, kp[i].kp_proc.p_comm); + } + + free(kp); +} + +void +hproc_new(pid_t p, const char *pname) +{ + char pidstr[100], logfile[PATH_MAX]; + char *sample_args[] = { "sample", pidstr, "1", "-mayDie", "-file", logfile, NULL }; + posix_spawnattr_t spattr; + struct kevent kev; + struct hproc *hp; + pid_t sp; + + debug_machports(p, pname); + + assert((hp = calloc(1, sizeof(struct hproc))) != NULL); + + assert(posix_spawnattr_init(&spattr) == 0); + + assert(posix_spawnattr_setflags(&spattr, POSIX_SPAWN_START_SUSPENDED) == 0); + + snprintf(pidstr, sizeof(pidstr), "%u", p); + snprintf(logfile, sizeof(logfile), "%s-%u.sample.txt", pname, p); + + assert(posix_spawnp(&sp, sample_args[0], NULL, &spattr, sample_args, environ) == 0); + + assert(posix_spawnattr_destroy(&spattr) == 0); + + EV_SET(&kev, sp, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, hp); + + assert(kevent(kq, &kev, 1, NULL, 0, NULL) != -1); + + assert(kill(sp, SIGCONT) != -1); + + hp->stuck_p = p; + hp->sample_p = sp; + + TAILQ_INSERT_TAIL(&hprocs, hp, tqe); +} + +void +debug_machports(pid_t pid, const char *pname) +{ + char logfilepath[PATH_MAX]; + FILE *mplogfile; + + snprintf(logfilepath, sizeof(logfilepath), "%s-%u.machports.txt", pname, pid); + + assert((mplogfile = fopen(logfilepath, "a")) != NULL); + + debug_machports2(pid, mplogfile); + + fclose(mplogfile); +} + + +/* + * WARNING - these types are copied from xnu/osfmk/kern/ipc_kobject.h + * Need to stay in sync to print accurate results. + */ +#define IKOT_NONE 0 +#define IKOT_THREAD 1 +#define IKOT_TASK 2 +#define IKOT_HOST 3 +#define IKOT_HOST_PRIV 4 +#define IKOT_PROCESSOR 5 +#define IKOT_PSET 6 +#define IKOT_PSET_NAME 7 +#define IKOT_TIMER 8 +#define IKOT_PAGING_REQUEST 9 +#define IKOT_MIG 10 +#define IKOT_MEMORY_OBJECT 11 +#define IKOT_XMM_PAGER 12 +#define IKOT_XMM_KERNEL 13 +#define IKOT_XMM_REPLY 14 +#define IKOT_UND_REPLY 15 +#define IKOT_HOST_NOTIFY 16 +#define IKOT_HOST_SECURITY 17 +#define IKOT_LEDGER 18 +#define IKOT_MASTER_DEVICE 19 +#define IKOT_TASK_NAME 20 +#define IKOT_SUBSYSTEM 21 +#define IKOT_IO_DONE_QUEUE 22 +#define IKOT_SEMAPHORE 23 +#define IKOT_LOCK_SET 24 +#define IKOT_CLOCK 25 +#define IKOT_CLOCK_CTRL 26 +#define IKOT_IOKIT_SPARE 27 +#define IKOT_NAMED_ENTRY 28 +#define IKOT_IOKIT_CONNECT 29 +#define IKOT_IOKIT_OBJECT 30 +#define IKOT_UPL 31 + +static const char * +kobject_name(natural_t kotype) +{ + switch (kotype) { + case IKOT_NONE: return "message-queue"; + case IKOT_THREAD: return "kobject(THREAD)"; + case IKOT_TASK: return "kobject(TASK)"; + case IKOT_HOST: return "kobject(HOST)"; + case IKOT_HOST_PRIV: return "kobject(HOST-PRIV)"; + case IKOT_PROCESSOR: return "kobject(PROCESSOR)"; + case IKOT_PSET: return "kobject(PROCESSOR-SET)"; + case IKOT_PSET_NAME: return "kobject(PROCESSOR-SET-NAME)"; + case IKOT_TIMER: return "kobject(TIMER)"; + case IKOT_PAGING_REQUEST: return "kobject(PAGER-REQUEST)"; + case IKOT_MIG: return "kobject(MIG)"; + case IKOT_MEMORY_OBJECT: return "kobject(MEMORY-OBJECT)"; + case IKOT_XMM_PAGER: return "kobject(XMM-PAGER)"; + case IKOT_XMM_KERNEL: return "kobject(XMM-KERNEL)"; + case IKOT_XMM_REPLY: return "kobject(XMM-REPLY)"; + case IKOT_UND_REPLY: return "kobject(UND-REPLY)"; + case IKOT_HOST_NOTIFY: return "message-queue"; + case IKOT_HOST_SECURITY: return "kobject(HOST-SECURITY)"; + case IKOT_LEDGER: return "kobject(LEDGER)"; + case IKOT_MASTER_DEVICE: return "kobject(MASTER-DEVICE)"; + case IKOT_TASK_NAME: return "kobject(TASK-NAME)"; + case IKOT_SUBSYSTEM: return "kobject(SUBSYSTEM)"; + case IKOT_IO_DONE_QUEUE: return "kobject(IO-QUEUE-DONE)"; + case IKOT_SEMAPHORE: return "kobject(SEMAPHORE)"; + case IKOT_LOCK_SET: return "kobject(LOCK-SET)"; + case IKOT_CLOCK: return "kobject(CLOCK)"; + case IKOT_CLOCK_CTRL: return "kobject(CLOCK-CONTROL)"; + case IKOT_IOKIT_SPARE: return "kobject(IOKIT-SPARE)"; + case IKOT_NAMED_ENTRY: return "kobject(NAMED-MEMORY)"; + case IKOT_IOKIT_CONNECT: return "kobject(IOKIT-CONNECT)"; + case IKOT_IOKIT_OBJECT: return "kobject(IOKIT-OBJECT)"; + case IKOT_UPL: return "kobject(UPL)"; + default: return "kobject(UNKNOWN)"; + } +} + +/* private structure to wrap up per-task info */ +typedef struct my_per_task_info { + task_t task; + pid_t pid; + ipc_info_space_t info; + ipc_info_name_array_t table; + mach_msg_type_number_t tableCount; + ipc_info_tree_name_array_t tree; + mach_msg_type_number_t treeCount; +} my_per_task_info_t; + +void +debug_machports2(pid_t pid, FILE *where) +{ + kern_return_t ret; + my_per_task_info_t aTask; + my_per_task_info_t *taskinfo = NULL; + my_per_task_info_t *psettaskinfo; + mach_msg_type_number_t i, j, k, taskCount; + int emptycount = 0, portsetcount = 0, sendcount = 0, receivecount = 0, sendoncecount = 0, deadcount = 0, dncount = 0; + + /* if priviledged, get the info for all tasks so we can match ports up */ + if (geteuid() == 0) { + processor_set_name_array_t psets; + mach_msg_type_number_t psetCount; + mach_port_t pset_priv; + task_array_t tasks; + + ret = host_processor_sets(mach_host_self(), &psets, &psetCount); + if (ret != KERN_SUCCESS) { + fprintf(where, "host_processor_sets() failed: %s\n", mach_error_string(ret)); + return; + } + if (psetCount != 1) { + fprintf(where, "Assertion Failure: pset count greater than one (%d)\n", psetCount); + return; + } + + /* convert the processor-set-name port to a privileged port */ + ret = host_processor_set_priv(mach_host_self(), psets[0], &pset_priv); + if (ret != KERN_SUCCESS) { + fprintf(where, "host_processor_set_priv() failed: %s\n", mach_error_string(ret)); + return; + } + mach_port_deallocate(mach_task_self(), psets[0]); + vm_deallocate(mach_task_self(), (vm_address_t)psets, (vm_size_t)psetCount * sizeof(mach_port_t)); + + /* convert the processor-set-priv to a list of tasks for the processor set */ + ret = processor_set_tasks(pset_priv, &tasks, &taskCount); + if (ret != KERN_SUCCESS) { + fprintf(where, "processor_set_tasks() failed: %s\n", mach_error_string(ret)); + return; + } + mach_port_deallocate(mach_task_self(), pset_priv); + + /* convert each task to structure of pointer for the task info */ + psettaskinfo = (my_per_task_info_t *)malloc(taskCount * sizeof(my_per_task_info_t)); + for (i = 0; i < taskCount; i++) { + psettaskinfo[i].task = tasks[i]; + pid_for_task(tasks[i], &psettaskinfo[i].pid); + ret = mach_port_space_info(tasks[i], &psettaskinfo[i].info, + &psettaskinfo[i].table, &psettaskinfo[i].tableCount, + &psettaskinfo[i].tree, &psettaskinfo[i].treeCount); + if (ret != KERN_SUCCESS) { + fprintf(where, "mach_port_space_info() failed: %s\n", mach_error_string(ret)); + return; + } + if (psettaskinfo[i].pid == pid) + taskinfo = &psettaskinfo[i]; + } + vm_deallocate(mach_task_self(), (vm_address_t)tasks, (vm_size_t)taskCount * sizeof(mach_port_t)); + } + else + { + /* just the one process */ + ret = task_for_pid((mach_task_self)(), pid, &aTask.task); + if (ret != KERN_SUCCESS) { + fprintf(where, "task_for_pid() failed: %s\n", mach_error_string(ret)); + return; + } + ret = mach_port_space_info(aTask.task, &aTask.info, + &aTask.table, &aTask.tableCount, + &aTask.tree, &aTask.treeCount); + if (ret != KERN_SUCCESS) { + fprintf(where, "mach_port_space_info() failed: %s\n", mach_error_string(ret)); + return; + } + taskinfo = &aTask; + psettaskinfo = taskinfo; + taskCount = 1; + } + + fprintf(where, "set-name ipc-object rights "); + fprintf(where, " member-cnt\n"); + fprintf(where, "recv-name ipc-object rights "); + fprintf(where, "reqs urefs orefs qlimit msgcount\n"); + fprintf(where, "send-name ipc-object rights "); + fprintf(where, "reqs urefs orefs kern-object type\n"); + fprintf(where, "--------where, - ---------- ---------- "); + fprintf(where, "---where, - ----- ----- ----------- ------------\n"); + + for (i = 0; i < taskinfo->tableCount; i++) { + boolean_t found = FALSE; + boolean_t sendr = FALSE; + boolean_t sendonce = FALSE; + boolean_t dnreq = FALSE; + int sendrights = 0; + unsigned int kotype = 0; + vm_offset_t kobject = (vm_offset_t)0; + + /* skip empty slots in the table */ + if (taskinfo->table[i].iin_object == 0) { + emptycount++; + continue; + } + + if (taskinfo->table[i].iin_type == MACH_PORT_TYPE_PORT_SET) { + mach_port_name_array_t members; + mach_msg_type_number_t membersCnt; + + ret = mach_port_get_set_status(taskinfo->task, + taskinfo->table[i].iin_name, + &members, &membersCnt); + if (ret != KERN_SUCCESS) { + fprintf(where, "mach_port_get_set_status(0x%08x) failed: %s\n", + taskinfo->table[i].iin_name, + mach_error_string(ret)); + continue; + } + fprintf(where, "0x%08x 0x%08x port-set --- 1 %5d members\n", + taskinfo->table[i].iin_name, + taskinfo->table[i].iin_object, + membersCnt); + /* get some info for each portset member */ + for (j = 0; j < membersCnt; j++) { + for (k = 0; k < taskinfo->tableCount; k++) { + if (taskinfo->table[k].iin_name == members[j]) { + fprintf(where, " 0x%08x %s --- 0x%08x process(%d)\n", + taskinfo->table[k].iin_object, + (taskinfo->table[k].iin_type & MACH_PORT_TYPE_SEND) ? "recv,send ":"recv ", + taskinfo->table[k].iin_name, + pid); + break; + } + } + } + + ret = vm_deallocate(mach_task_self(), (vm_address_t)members, + membersCnt * sizeof(mach_port_name_t)); + if (ret != KERN_SUCCESS) { + fprintf(where, "vm_deallocate() failed: %s\n", + mach_error_string(ret)); + return; + } + portsetcount++; + continue; + } + + if (taskinfo->table[i].iin_type & MACH_PORT_TYPE_SEND) { + sendr = TRUE; + sendrights = taskinfo->table[i].iin_urefs; + sendcount++; + } + + if (taskinfo->table[i].iin_type & MACH_PORT_TYPE_SEND_ONCE) { + sendonce = TRUE; + sendoncecount++; + } + + if (taskinfo->table[i].iin_type & MACH_PORT_TYPE_DNREQUEST) { + dnreq = TRUE; + dncount++; + } + + if (taskinfo->table[i].iin_type & MACH_PORT_TYPE_RECEIVE) { + mach_port_status_t status; + mach_msg_type_number_t statusCnt; + + statusCnt = MACH_PORT_RECEIVE_STATUS_COUNT; + ret = mach_port_get_attributes(taskinfo->task, + taskinfo->table[i].iin_name, + MACH_PORT_RECEIVE_STATUS, + (mach_port_info_t)&status, + &statusCnt); + if (ret != KERN_SUCCESS) { + fprintf(where, "mach_port_get_attributes(0x%08x) failed: %s\n", + taskinfo->table[i].iin_name, + mach_error_string(ret)); + continue; + } + + fprintf(where, "0x%08x 0x%08x %s %s%s%s %5d %s(%02d) 0x%08x 0x%08x\n", + taskinfo->table[i].iin_name, + taskinfo->table[i].iin_object, + (sendr) ? "recv,send ":"recv ", + (dnreq) ? "D":"-", + (status.mps_nsrequest) ? "N":"-", + (status.mps_pdrequest) ? "P":"-", + sendrights + 1, + (status.mps_srights) ? "Y":"N", + status.mps_sorights, + status.mps_qlimit, + status.mps_msgcount); + receivecount++; + + /* show other rights (in this and other tasks) for the port */ + for (j = 0; j < taskCount; j++) { + for (k = 0; k < psettaskinfo->tableCount; k++) { + if (&psettaskinfo[j].table[k] == &taskinfo->table[i] || + psettaskinfo[j].table[k].iin_object != taskinfo->table[i].iin_object) + continue; + fprintf(where, " 0x%08x %s --- %5d 0x%08x process(%d)\n", + psettaskinfo[j].table[k].iin_object, + (psettaskinfo[j].table[k].iin_type & MACH_PORT_TYPE_SEND_ONCE) ? + "send-once " : "send ", + psettaskinfo[j].table[k].iin_urefs, + psettaskinfo[j].table[k].iin_name, + psettaskinfo[j].pid); + } + } + continue; + } + else if (taskinfo->table[i].iin_type & MACH_PORT_TYPE_DEAD_NAME) + { + fprintf(where, "0x%08x 0x%08x dead-name --- %5d\n", + taskinfo->table[i].iin_name, + taskinfo->table[i].iin_object, + taskinfo->table[i].iin_urefs); + deadcount++; + continue; + } + + fprintf(where, "0x%08x 0x%08x %s %s%s%s %5d ", + taskinfo->table[i].iin_name, + taskinfo->table[i].iin_object, + (sendr) ? "send ":"send-once ", + (dnreq) ? "D":"-", + "-", + "-", + (sendr) ? sendrights : 1); + + /* converting to kobjects is not always supported */ + ret = mach_port_kernel_object(taskinfo->task, + taskinfo->table[i].iin_name, + &kotype, &kobject); + if (kotype != 0) { + fprintf(where, "0x%08x %s\n", kobject, kobject_name(kotype)); + continue; + } + + /* not kobject - find the receive right holder */ + for (j = 0; j < taskCount && !found; j++) { + for (k = 0; k < psettaskinfo[j].tableCount && !found; k++) { + if ((psettaskinfo[j].table[k].iin_type & MACH_PORT_TYPE_RECEIVE) && + psettaskinfo[j].table[k].iin_object == taskinfo->table[i].iin_object ) { + fprintf(where, "0x%08x process(%d)\n", + psettaskinfo[j].table[k].iin_name, + psettaskinfo[j].pid); + found = TRUE; + } + } + } + if (!found) + fprintf(where, "0x00000000 process(unknown)\n"); + } + fprintf(where, "total = %d\n", taskinfo->tableCount + taskinfo->treeCount - emptycount); + fprintf(where, "SEND = %d\n", sendcount); + fprintf(where, "RECEIVE = %d\n", receivecount); + fprintf(where, "SEND_ONCE = %d\n", sendoncecount); + fprintf(where, "PORT_SET = %d\n", portsetcount); + fprintf(where, "DEAD_NAME = %d\n", deadcount); + fprintf(where, "DNREQUEST = %d\n", dncount); + + if (taskCount > 1) + free(psettaskinfo); + + fprintf(where, "Finished.\n"); + return; +} -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061214/b37126c5/attachment.html From source_changes at macosforge.org Thu Dec 14 09:37:15 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22978] trunk/launchd/src/launchd_core_logic.c Message-ID: <20061214173715.2310946011D@cvs.opensource.apple.com> Revision: 22978 http://trac.macosforge.org/projects/launchd/changeset/22978 Author: zarzycki@apple.com Date: 2006-12-14 09:37:14 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Silly comment update. Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-14 17:29:56 UTC (rev 22977) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-14 17:37:14 UTC (rev 22978) @@ -1947,7 +1947,8 @@ } /* - * launchctl should invoke initgroups after setgid + * The kernel team and the DirectoryServices team want initgroups() + * called after setgid(). See 4616864 for more information. */ if (!j->no_init_groups) { -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061214/f2d8643b/attachment.html From source_changes at macosforge.org Thu Dec 14 09:50:19 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22979] trunk/launchd/src Message-ID: <20061214175019.D874446013D@cvs.opensource.apple.com> Revision: 22979 http://trac.macosforge.org/projects/launchd/changeset/22979 Author: zarzycki@apple.com Date: 2006-12-14 09:50:19 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Investigation: Figure out what remaining processes are hanging at shutdown Modified Paths: -------------- trunk/launchd/src/Makefile.am trunk/launchd/src/Makefile.in Modified: trunk/launchd/src/Makefile.am =================================================================== --- trunk/launchd/src/Makefile.am 2006-12-14 17:37:14 UTC (rev 22978) +++ trunk/launchd/src/Makefile.am 2006-12-14 17:50:19 UTC (rev 22979) @@ -66,7 +66,7 @@ man5_MANS = launchd.plist.5 launchd.conf.5 -man8_MANS = StartupItemContext.8 SystemStarter.8 rc.8 launchd.8 service.8 launchproxy.8 +man8_MANS = StartupItemContext.8 SystemStarter.8 rc.8 launchd.8 service.8 launchproxy.8 shutdown_debugger.8 STARTUPITEMS = $(basename $(notdir $(wildcard $(srcdir)/StartupItems/*.plist))) Modified: trunk/launchd/src/Makefile.in =================================================================== --- trunk/launchd/src/Makefile.in 2006-12-14 17:37:14 UTC (rev 22978) +++ trunk/launchd/src/Makefile.in 2006-12-14 17:50:19 UTC (rev 22979) @@ -253,7 +253,7 @@ @LIBS_ONLY_FALSE@launchproxy_LDFLAGS = -weak_framework Security @LIBS_ONLY_FALSE@man1_MANS = wait4path.1 launchctl.1 @LIBS_ONLY_FALSE@man5_MANS = launchd.plist.5 launchd.conf.5 -@LIBS_ONLY_FALSE@man8_MANS = StartupItemContext.8 SystemStarter.8 rc.8 launchd.8 service.8 launchproxy.8 +@LIBS_ONLY_FALSE@man8_MANS = StartupItemContext.8 SystemStarter.8 rc.8 launchd.8 service.8 launchproxy.8 shutdown_debugger.8 @LIBS_ONLY_FALSE@STARTUPITEMS = $(basename $(notdir $(wildcard $(srcdir)/StartupItems/*.plist))) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061214/866ff68f/attachment.html From source_changes at macosforge.org Thu Dec 14 10:08:28 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22980] trunk/launchd/src/launchctl.c Message-ID: <20061214180828.037F8460170@cvs.opensource.apple.com> Revision: 22980 http://trac.macosforge.org/projects/launchd/changeset/22980 Author: zarzycki@apple.com Date: 2006-12-14 10:08:28 -0800 (Thu, 14 Dec 2006) Log Message: ----------- launchd apply_func_to_dir() should guard against nasty leftovers Modified Paths: -------------- trunk/launchd/src/launchctl.c Modified: trunk/launchd/src/launchctl.c =================================================================== --- trunk/launchd/src/launchctl.c 2006-12-14 17:50:19 UTC (rev 22979) +++ trunk/launchd/src/launchctl.c 2006-12-14 18:08:28 UTC (rev 22980) @@ -130,9 +130,8 @@ static bool path_check(const char *path); static bool is_safeboot(void); static bool is_netboot(void); -static void apply_func_to_dir(const char *thedir, void (*thefunc)(const char *)); static void apply_sysctls_from_file(const char *thefile); -static void empty_dir(const char *path); +static void empty_dir(const char *thedir, struct stat *psb); static int touch_file(const char *path, mode_t m); static void do_sysversion_sysctl(void); static void workaround4465949(void); @@ -1238,8 +1237,8 @@ assumes(fwexec(rccleanup_tool, true) != -1); } - apply_func_to_dir(_PATH_VARRUN, empty_dir); - apply_func_to_dir(_PATH_TMP, empty_dir); + empty_dir(_PATH_VARRUN, NULL); + empty_dir(_PATH_TMP, NULL); remove(_PATH_NOLOGIN); // XXX --> RMRF_ITEMS="/var/tmp/folders.* @@ -2549,34 +2548,66 @@ } void -apply_func_to_dir(const char *thedir, void (*thefunc)(const char *)) +empty_dir(const char *thedir, struct stat *psb) { struct dirent *de; + struct stat psb2; DIR *od; int currend_dir_fd; - if (!assumes((currend_dir_fd = open(".", 0)) != -1)) + if (!psb) { + psb = &psb2; + if (!assumes(lstat(thedir, psb) != -1)) { + return; + } + } + + if (!assumes((currend_dir_fd = open(".", 0)) != -1)) { return; + } - if (!assumes(chdir(thedir) != -1)) + if (!assumes(chdir(thedir) != -1)) { goto out; + } - if (!assumes(od = opendir("."))) + if (!assumes(od = opendir("."))) { goto out; + } while ((de = readdir(od))) { struct stat sb; - if (strcmp(de->d_name, ".") == 0) + if (strcmp(de->d_name, ".") == 0) { continue; - if (strcmp(de->d_name, "..") == 0) + } + + if (strcmp(de->d_name, "..") == 0) { continue; + } - if (assumes(lstat(de->d_name, &sb) != -1)) { - if (S_ISDIR(sb.st_mode)) - apply_func_to_dir(de->d_name, thefunc); - thefunc(de->d_name); + if (!assumes(lstat(de->d_name, &sb) != -1)) { + continue; } + + if (psb->st_dev != sb.st_dev) { + assumes(unmount(de->d_name, MNT_FORCE) != -1); + + /* Let's lstat() again to see if the unmount() worked and what was under it */ + if (!assumes(lstat(de->d_name, &sb) != -1)) { + continue; + } + + if (!assumes(psb->st_dev == sb.st_dev)) { + continue; + } + } + + if (S_ISDIR(sb.st_mode)) { + empty_dir(de->d_name, &sb); + } + + assumes(lchflags(de->d_name, 0) != -1); + assumes(remove(de->d_name) != -1); } assumes(closedir(od) != -1); @@ -2586,13 +2617,6 @@ assumes(close(currend_dir_fd) != -1); } -void -empty_dir(const char *path) -{ - assumes(lchflags(path, 0) != -1); - assumes(remove(path) != -1); -} - int touch_file(const char *path, mode_t m) { -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061214/c7586483/attachment.html From source_changes at macosforge.org Thu Dec 14 11:18:26 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22981] trunk/launchd/src/launchd_core_logic.c Message-ID: <20061214191826.4E35A46023D@cvs.opensource.apple.com> Revision: 22981 http://trac.macosforge.org/projects/launchd/changeset/22981 Author: zarzycki@apple.com Date: 2006-12-14 11:18:26 -0800 (Thu, 14 Dec 2006) Log Message: ----------- launchd crashes when parsing malformed plist Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-14 18:08:28 UTC (rev 22980) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-14 19:18:26 UTC (rev 22981) @@ -1377,24 +1377,52 @@ if (pload == NULL) { return NULL; } + if (launch_data_get_type(pload) != LAUNCH_DATA_DICTIONARY) { + errno = EINVAL; return NULL; } if ((tmp = launch_data_dict_lookup(pload, LAUNCH_JOBKEY_LABEL)) && (launch_data_get_type(tmp) == LAUNCH_DATA_STRING)) { - label = launch_data_get_string(tmp); + if (!(label = launch_data_get_string(tmp))) { + errno = EINVAL; + return NULL; + } } + if ((tmp = launch_data_dict_lookup(pload, LAUNCH_JOBKEY_PROGRAM)) && (launch_data_get_type(tmp) == LAUNCH_DATA_STRING)) { prog = launch_data_get_string(tmp); } - ldpa = launch_data_dict_lookup(pload, LAUNCH_JOBKEY_PROGRAMARGUMENTS); - if (label == NULL) { - errno = EINVAL; - return NULL; - } else if ((j = jobmgr_find(root_jobmgr, label)) != NULL) { + if ((ldpa = launch_data_dict_lookup(pload, LAUNCH_JOBKEY_PROGRAMARGUMENTS))) { + size_t i, c; + + if (launch_data_get_type(ldpa) != LAUNCH_DATA_ARRAY) { + errno = EINVAL; + return NULL; + } + + c = launch_data_array_get_count(ldpa); + + argv = alloca((c + 1) * sizeof(char *)); + + for (i = 0; i < c; i++) { + tmp = launch_data_array_get_index(ldpa, i); + + if (launch_data_get_type(tmp) != LAUNCH_DATA_STRING) { + errno = EINVAL; + return NULL; + } + + argv[i] = launch_data_get_string(tmp); + } + + argv[i] = NULL; + } + + if ((j = jobmgr_find(root_jobmgr, label)) != NULL) { errno = EEXIST; return NULL; } else if (label[0] == '\0' || (strncasecmp(label, "", strlen("com.apple.launchd")) == 0) || @@ -1405,16 +1433,6 @@ return NULL; } - if (ldpa) { - size_t i, c = launch_data_array_get_count(ldpa); - - argv = alloca((c + 1) * sizeof(char *)); - - for (i = 0; i < c; i++) - argv[i] = launch_data_get_string(launch_data_array_get_index(ldpa, i)); - argv[i] = NULL; - } - if ((j = job_new(root_jobmgr, label, prog, argv, NULL))) { launch_data_dict_iterate(pload, job_import_keys, j); } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061214/80635fbf/attachment.html From source_changes at macosforge.org Thu Dec 14 11:59:58 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22982] trunk/launchd/src/launchd_core_logic.c Message-ID: <20061214195958.93C134604A1@cvs.opensource.apple.com> Revision: 22982 http://trac.macosforge.org/projects/launchd/changeset/22982 Author: zarzycki@apple.com Date: 2006-12-14 11:59:58 -0800 (Thu, 14 Dec 2006) Log Message: ----------- spawn_env attribute with spawn_via_launchd doesn't seem to work Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-14 19:18:26 UTC (rev 22981) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-14 19:59:58 UTC (rev 22982) @@ -811,6 +811,7 @@ job_new_spawn(job_t j, const char *label, const char *path, const char *workingdir, const char *const *argv, const char *const *env, mode_t *u_mask, bool w4d, bool fppc) { job_t jr; + size_t i; if ((jr = jobmgr_find(root_jobmgr, label)) != NULL) { errno = EEXIST; @@ -845,15 +846,20 @@ jr->setmask = true; } - if (env) for (; *env; env++) { - char newkey[strlen(*env) + 1], *eqoff = strchr(*env, '='); + if (env) for (i = 0; env[i]; i++) { + char *eqoff, tmpstr[strlen(env[i]) + 1]; + + strcpy(tmpstr, env[i]); + + eqoff = strchr(tmpstr, '='); + if (!eqoff) { - job_log(jr, LOG_WARNING, "Environmental variable missing '=' separator: %s", *env); + job_log(jr, LOG_WARNING, "Environmental variable missing '=' separator: %s", tmpstr); continue; } - strcpy(newkey, *env); + *eqoff = '\0'; - envitem_new(jr, newkey, eqoff + 1, false); + envitem_new(jr, tmpstr, eqoff + 1, false); } job_dispatch(jr, true); @@ -2575,6 +2581,8 @@ SLIST_INSERT_HEAD(&j->env, ei, sle); } + job_log(j, LOG_DEBUG, "Added environmental variable: %s=%s", k, v); + return true; } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061214/845648a4/attachment.html From source_changes at macosforge.org Thu Dec 14 12:47:04 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22983] trunk/launchd/src/launchd_core_logic.c Message-ID: <20061214204704.6877C46054C@cvs.opensource.apple.com> Revision: 22983 http://trac.macosforge.org/projects/launchd/changeset/22983 Author: zarzycki@apple.com Date: 2006-12-14 12:47:04 -0800 (Thu, 14 Dec 2006) Log Message: ----------- launchd hangs when KeepAlive.PathState doesn't exist Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-14 19:59:58 UTC (rev 22982) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-14 20:47:04 UTC (rev 22983) @@ -377,6 +377,7 @@ void job_watch(job_t j) { + struct semaphoreitem *si; struct socketgroup *sg; struct machservice *ms; struct watchpath *wp; @@ -398,6 +399,13 @@ SLIST_FOREACH(ms, &j->machservices, sle) { job_assumes(j, runtime_add_mport(ms->port, NULL, 0) == KERN_SUCCESS); } + + SLIST_FOREACH(si, &j->semaphores, sle) { + if (si->why == PATH_EXISTS || si->why == PATH_MISSING) { + /* Maybe another job has the inverse path based semaphore as this job */ + jobmgr_dispatch_all_other_semaphores(root_jobmgr, j); + } + } } void @@ -2707,7 +2715,6 @@ struct machservice *ms; struct stat sb; bool good_exit = (WIFEXITED(j->last_exit_status) && WEXITSTATUS(j->last_exit_status) == 0); - bool dispatch_others = false; if (j->mgr->global_on_demand_cnt > 0) { return false; @@ -2765,16 +2772,10 @@ wanted_state ? "exists" : "is missing", si->what); return true; } - dispatch_others = true; break; } } - /* Maybe another job has the inverse path based semaphore as this job */ - if (dispatch_others) { - jobmgr_dispatch_all_other_semaphores(root_jobmgr, j); - } - return false; } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061214/c0ba2af6/attachment.html From source_changes at macosforge.org Thu Dec 14 15:20:17 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22984] tags/launchd-180/ Message-ID: <20061214232017.EC99E460892@cvs.opensource.apple.com> Revision: 22984 http://trac.macosforge.org/projects/launchd/changeset/22984 Author: zarzycki@apple.com Date: 2006-12-14 15:20:17 -0800 (Thu, 14 Dec 2006) Log Message: ----------- "Tagging launchd-180 from https://svn.macosforge.org/repository/launchd/trunk" Added Paths: ----------- tags/launchd-180/ Copied: tags/launchd-180 (from rev 22983, trunk) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061214/b6c2c01f/attachment.html From source_changes at macosforge.org Fri Dec 15 13:12:36 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22985] trunk/launchd/src/StartupItemContext Message-ID: <20061215211236.9452E461B2D@cvs.opensource.apple.com> Revision: 22985 http://trac.macosforge.org/projects/launchd/changeset/22985 Author: zarzycki@apple.com Date: 2006-12-15 13:12:36 -0800 (Fri, 15 Dec 2006) Log Message: ----------- StartUpItemContext won't work if path contains spaces Modified Paths: -------------- trunk/launchd/src/StartupItemContext Modified: trunk/launchd/src/StartupItemContext =================================================================== --- trunk/launchd/src/StartupItemContext 2006-12-14 23:20:17 UTC (rev 22984) +++ trunk/launchd/src/StartupItemContext 2006-12-15 21:12:36 UTC (rev 22985) @@ -2,4 +2,4 @@ unset LAUNCHD_SOCKET -exec launchctl bsexec / $@ +exec launchctl bsexec / "$@" -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061215/de31d824/attachment.html From source_changes at macosforge.org Fri Dec 15 13:13:18 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22986] trunk/launchd/src/init.c Message-ID: <20061215211318.ADF05461B37@cvs.opensource.apple.com> Revision: 22986 http://trac.macosforge.org/projects/launchd/changeset/22986 Author: zarzycki@apple.com Date: 2006-12-15 13:13:18 -0800 (Fri, 15 Dec 2006) Log Message: ----------- launchd should stop creating a boot record Modified Paths: -------------- trunk/launchd/src/init.c Modified: trunk/launchd/src/init.c =================================================================== --- trunk/launchd/src/init.c 2006-12-15 21:12:36 UTC (rev 22985) +++ trunk/launchd/src/init.c 2006-12-15 21:13:18 UTC (rev 22986) @@ -411,7 +411,6 @@ } if (WIFEXITED(status) && WEXITSTATUS(status) == EXIT_SUCCESS) { - logwtmp("~", "reboot", ""); return; } else if (WIFSIGNALED(status) && (WTERMSIG(status) == SIGTERM || WTERMSIG(status) == SIGKILL)) { return; -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061215/f998584c/attachment.html From source_changes at macosforge.org Fri Dec 15 14:10:33 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22987] trunk/launchd/src/StartupItems Message-ID: <20061215221033.EF0D9461D7B@cvs.opensource.apple.com> Revision: 22987 http://trac.macosforge.org/projects/launchd/changeset/22987 Author: zarzycki@apple.com Date: 2006-12-15 14:10:33 -0800 (Fri, 15 Dec 2006) Log Message: ----------- The remote_cmds project now installs this. Removed Paths: ------------- trunk/launchd/src/StartupItems/NIS trunk/launchd/src/StartupItems/NIS.plist Deleted: trunk/launchd/src/StartupItems/NIS =================================================================== --- trunk/launchd/src/StartupItems/NIS 2006-12-15 21:13:18 UTC (rev 22986) +++ trunk/launchd/src/StartupItems/NIS 2006-12-15 22:10:33 UTC (rev 22987) @@ -1,79 +0,0 @@ -#!/bin/sh - -## -# Network Information Service -## - -. /etc/rc.common - - -Startyppasswdd() -{ - # rpc.yppasswdd is run on NIS masters - if [ -f "${VARYP}/${NISDOMAIN}/ypservers.db" ]; then - NISMASTER=$(makedbm -U "${VARYP}/${NISDOMAIN}/ypservers" | sed -n '/YP_MASTER_NAME/p' | awk '{print $2}') - if [ "$NISMASTER" = "$(hostname)" ]; then - rpc.yppasswdd - fi - fi -} - -StartService () -{ - ## - # Network Information Service. - ## - CheckForNetwork - if [ -f /var/run/NIS.StartupItem -o "${NETWORKUP}" = "-NO-" ]; then exit; fi - touch /var/run/NIS.StartupItem - - if [ "${NISDOMAIN:=-NO-}" != "-NO-" ]; then - - VARYP=/var/yp - - echo "Starting Network Information Service" - - echo "Setting NIS domainname to ${NISDOMAIN}" - domainname "${NISDOMAIN}" - - # ypserv is run on NIS servers - machines with an ${VARYP}/${NISDOMAIN} dir - if [ -d "${VARYP}/${NISDOMAIN}" ]; then - if ! pid=$(GetPID ypserv); then - ypserv - fi - fi - - Startyppasswdd - - # ypbind is run on all NIS clients - ypbind - fi -} - -StopService () -{ - echo "Stopping Network Information Service" - killall -TERM ypbind > /dev/null 2>&1 - killall -TERM rpc.yppasswdd > /dev/null 2>&1 - - if pid=$(GetPID ypserv); then - kill -TERM "${pid}" - fi -} - -RestartService () -{ - echo "Restarting Network Information Service" - killall -TERM ypbind > /dev/null 2>&1 - killall -TERM rpc.yppasswdd > /dev/null 2>&1 - - if pid=$(GetPID ypserv); then - kill -HUP "${pid}" - Startyppasswdd - ypbind - else - StartService - fi -} - -RunService "$1" Deleted: trunk/launchd/src/StartupItems/NIS.plist =================================================================== --- trunk/launchd/src/StartupItems/NIS.plist 2006-12-15 21:13:18 UTC (rev 22986) +++ trunk/launchd/src/StartupItems/NIS.plist 2006-12-15 22:10:33 UTC (rev 22987) @@ -1,4 +0,0 @@ -{ - Description = "Network Information Service"; - Provides = ("NIS"); -} -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061215/290d7379/attachment.html From source_changes at macosforge.org Fri Dec 15 14:10:57 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22988] trunk/launchd/src/launchd.c Message-ID: <20061215221057.0CACC461D83@cvs.opensource.apple.com> Revision: 22988 http://trac.macosforge.org/projects/launchd/changeset/22988 Author: zarzycki@apple.com Date: 2006-12-15 14:10:56 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Better self crash reporting in the case of PID 1. Modified Paths: -------------- trunk/launchd/src/launchd.c Modified: trunk/launchd/src/launchd.c =================================================================== --- trunk/launchd/src/launchd.c 2006-12-15 22:10:33 UTC (rev 22987) +++ trunk/launchd/src/launchd.c 2006-12-15 22:10:56 UTC (rev 22988) @@ -105,6 +105,7 @@ static job_t rlcj = NULL; static jmp_buf doom_doom_doom; static void *crash_addr; +static pid_t crash_pid; static const char *launchctl_bootstrap_tool[] = { "/bin/launchctl", /* "bootstrap", */ NULL }; sigset_t blocked_signals = 0; @@ -297,18 +298,24 @@ job_dispatch(fbj, true); } + char *doom_why = "at instruction"; switch (setjmp(doom_doom_doom)) { + case 0: + break; + case SIGBUS: + case SIGSEGV: + doom_why = "trying to read/write"; case SIGILL: case SIGFPE: - syslog(LOG_EMERG, "We crashed at instruction: %p", crash_addr); - abort(); - case SIGBUS: - case SIGSEGV: - syslog(LOG_EMERG, "We crashed trying to read/write: %p", crash_addr); - abort(); + syslog(LOG_EMERG, "We crashed %s: %p (sent by PID %u)", doom_why, crash_addr, crash_pid); default: - abort(); - case 0: + sync(); + sleep(3); + /* the kernel will panic() when PID 1 exits */ + _exit(EXIT_FAILURE); + /* we should never get here */ + reboot(0); + /* or here either */ break; } @@ -338,10 +345,33 @@ launchd_assumes(sigaction(SIGSEGV, &fsa, NULL) != -1); } +#define PID1_CRASH_LOGFILE "/var/log/launchd-pid1.crash" + void fatal_signal_handler(int sig, siginfo_t *si, void *uap) { + char *sample_args[] = { "/usr/bin/sample", "1", "1", "-file", PID1_CRASH_LOGFILE, NULL }; + pid_t sample_p; + int wstatus; + crash_addr = si->si_addr; + crash_pid = si->si_pid; + + unlink(PID1_CRASH_LOGFILE); + + switch ((sample_p = vfork())) { + case 0: + execve(sample_args[0], sample_args, environ); + _exit(EXIT_FAILURE); + break; + default: + waitpid(sample_p, &wstatus, 0); + sync(); + break; + case -1: + break; + } + longjmp(doom_doom_doom, sig); } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061215/1d038d08/attachment.html From source_changes at macosforge.org Fri Dec 15 14:12:46 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22989] tags/launchd-181/ Message-ID: <20061215221246.B392C461D8B@cvs.opensource.apple.com> Revision: 22989 http://trac.macosforge.org/projects/launchd/changeset/22989 Author: zarzycki@apple.com Date: 2006-12-15 14:12:46 -0800 (Fri, 15 Dec 2006) Log Message: ----------- "Tagging launchd-181 from https://svn.macosforge.org/repository/launchd/trunk" Added Paths: ----------- tags/launchd-181/ Copied: tags/launchd-181 (from rev 22988, trunk) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061215/a9a2120a/attachment.html From source_changes at macosforge.org Mon Dec 18 14:30:29 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22990] trunk/launchd/src/launchd_core_logic.c Message-ID: <20061218223029.9DB844653BD@cvs.opensource.apple.com> Revision: 22990 http://trac.macosforge.org/projects/launchd/changeset/22990 Author: zarzycki@apple.com Date: 2006-12-18 14:30:29 -0800 (Mon, 18 Dec 2006) Log Message: ----------- Pro Tools LE 7.3 fails to launch on Leopard9A322 Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-15 22:12:46 UTC (rev 22989) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-18 22:30:29 UTC (rev 22990) @@ -2219,7 +2219,9 @@ job_logv(job_t j, int pri, int err, const char *msg, va_list ap) { char newmsg[10000]; + char *newlabel; int oldmask = 0; + size_t i, o, jlabel_len = strlen(j->label); /* * Hack: If bootstrap_port is set, we must be on the child side of a @@ -2230,10 +2232,21 @@ return _vproc_logv(pri, err, msg, ap); } + newlabel = alloca((jlabel_len + 1) * 2); + + for (i = 0, o = 0; i < jlabel_len; i++, o++) { + if (j->label[i] == '%') { + newlabel[o] = '%'; + o++; + } + newlabel[o] = j->label[i]; + } + newlabel[o] = '\0'; + if (err) { - snprintf(newmsg, sizeof(newmsg), "%s: %s: %s", j->label, msg, strerror(err)); + snprintf(newmsg, sizeof(newmsg), "%s: %s: %s", newlabel, msg, strerror(err)); } else { - snprintf(newmsg, sizeof(newmsg), "%s: %s", j->label, msg); + snprintf(newmsg, sizeof(newmsg), "%s: %s", newlabel, msg); } if (j->debug) { -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061218/6dc97941/attachment.html From source_changes at macosforge.org Tue Dec 19 08:35:11 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22991] trunk/launchd/src/launchd_core_logic.c Message-ID: <20061219163511.AD7ED466162@cvs.opensource.apple.com> Revision: 22991 http://trac.macosforge.org/projects/launchd/changeset/22991 Author: zarzycki@apple.com Date: 2006-12-19 08:35:11 -0800 (Tue, 19 Dec 2006) Log Message: ----------- getlogin returns "root" instead of correct username Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-18 22:30:29 UTC (rev 22990) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-19 16:35:11 UTC (rev 22991) @@ -1973,6 +1973,10 @@ desired_gid = gre->gr_gid; } + if (!job_assumes(j, setlogin(loginname) != -1)) { + _exit(EXIT_FAILURE); + } + if (-1 == setgid(desired_gid)) { job_log_error(j, LOG_ERR, "setgid(%u)", desired_gid); _exit(EXIT_FAILURE); -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061219/d8575ef4/attachment.html From source_changes at macosforge.org Tue Dec 19 08:38:37 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22992] trunk/launchd/src/launchd_core_logic.c Message-ID: <20061219163837.B02B346616E@cvs.opensource.apple.com> Revision: 22992 http://trac.macosforge.org/projects/launchd/changeset/22992 Author: zarzycki@apple.com Date: 2006-12-19 08:38:37 -0800 (Tue, 19 Dec 2006) Log Message: ----------- Use the assumes() macro in more places. Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-19 16:35:11 UTC (rev 22991) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-19 16:38:37 UTC (rev 22992) @@ -1977,8 +1977,7 @@ _exit(EXIT_FAILURE); } - if (-1 == setgid(desired_gid)) { - job_log_error(j, LOG_ERR, "setgid(%u)", desired_gid); + if (!job_assumes(j, setgid(desired_gid) != -1)) { _exit(EXIT_FAILURE); } @@ -1988,14 +1987,12 @@ */ if (!j->no_init_groups) { - if (initgroups(loginname, desired_gid) == -1) { - job_log_error(j, LOG_ERR, "initgroups()"); + if (!job_assumes(j, initgroups(loginname, desired_gid) != -1)) { _exit(EXIT_FAILURE); } } - if (-1 == setuid(desired_uid)) { - job_log_error(j, LOG_ERR, "setuid(%u)", desired_uid); + if (!job_assumes(j, setuid(desired_uid) != -1)) { _exit(EXIT_FAILURE); } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061219/e6e1f9f4/attachment.html From source_changes at macosforge.org Tue Dec 19 16:48:11 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22993] tags/launchd-182/ Message-ID: <20061220004811.B486C466883@cvs.opensource.apple.com> Revision: 22993 http://trac.macosforge.org/projects/launchd/changeset/22993 Author: zarzycki@apple.com Date: 2006-12-19 16:48:11 -0800 (Tue, 19 Dec 2006) Log Message: ----------- "Tagging launchd-182 from https://svn.macosforge.org/repository/launchd/trunk" Added Paths: ----------- tags/launchd-182/ Copied: tags/launchd-182 (from rev 22992, trunk) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061219/a1dabcda/attachment.html From source_changes at macosforge.org Thu Dec 21 11:23:39 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22994] trunk/launchd/src Message-ID: <20061221192339.31D754686FE@cvs.opensource.apple.com> Revision: 22994 http://trac.macosforge.org/projects/launchd/changeset/22994 Author: zarzycki@apple.com Date: 2006-12-21 11:23:38 -0800 (Thu, 21 Dec 2006) Log Message: ----------- ER: Specific binary slice selection for spawn_via_launchd Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c trunk/launchd/src/launchd_mig_types.defs trunk/launchd/src/liblaunch_private.h trunk/launchd/src/liblaunch_public.h trunk/launchd/src/libvproc.c trunk/launchd/src/libvproc_internal.h trunk/launchd/src/protocol_job.defs Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-20 00:48:11 UTC (rev 22993) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-21 19:23:38 UTC (rev 22994) @@ -238,6 +238,8 @@ SLIST_HEAD(, machservice) machservices; SLIST_HEAD(, semaphoreitem) semaphores; struct rusage ru; + binpref_t j_binpref; + size_t j_binpref_cnt; mach_port_t j_port; mach_port_t wait_reply_port; uid_t mach_uid; @@ -266,8 +268,8 @@ importing_global_env:1, importing_hard_limits:1, setmask:1, legacy_mach_job:1, runatload:1, anonymous:1; mode_t mask; - unsigned int globargv:1, wait4debugger:1, unload_at_exit:1, force_ppc:1, stall_before_exec:1, - only_once:1, currently_ignored:1, forced_peers_to_demand_mode:1; + unsigned int globargv:1, wait4debugger:1, unload_at_exit:1, stall_before_exec:1, only_once:1, + currently_ignored:1, forced_peers_to_demand_mode:1; char label[0]; }; @@ -297,7 +299,7 @@ static void job_reparent_to_aqua_hack(job_t j); static void job_callback(void *obj, struct kevent *kev); static launch_data_t job_export2(job_t j, bool subjobs); -static job_t job_new_spawn(job_t j, const char *label, const char *path, const char *workingdir, const char *const *argv, const char *const *env, mode_t *u_mask, bool w4d, bool fppc); +static job_t job_new_spawn(job_t j, const char *label, const char *path, const char *workingdir, const char *const *argv, const char *const *env, mode_t *u_mask, bool w4d); static job_t job_new_via_mach_init(job_t j, const char *cmd, uid_t uid, bool ond); static const char *job_prog(job_t j); static pid_t job_get_pid(job_t j); @@ -816,7 +818,7 @@ } job_t -job_new_spawn(job_t j, const char *label, const char *path, const char *workingdir, const char *const *argv, const char *const *env, mode_t *u_mask, bool w4d, bool fppc) +job_new_spawn(job_t j, const char *label, const char *path, const char *workingdir, const char *const *argv, const char *const *env, mode_t *u_mask, bool w4d) { job_t jr; size_t i; @@ -843,7 +845,6 @@ jr->unload_at_exit = true; jr->stall_before_exec = w4d; - jr->force_ppc = fppc; if (workingdir) { jr->workingdir = strdup(workingdir); @@ -870,8 +871,6 @@ envitem_new(jr, tmpstr, eqoff + 1, false); } - job_dispatch(jr, true); - return jr; } @@ -1018,12 +1017,6 @@ job_import_bool(job_t j, const char *key, bool value) { switch (key[0]) { - case 'f': - case 'F': - if (strcasecmp(key, LAUNCH_JOBKEY_FORCEPOWERPC) == 0) { - j->force_ppc = value; - } - break; case 'k': case 'K': if (strcasecmp(key, LAUNCH_JOBKEY_KEEPALIVE) == 0) { @@ -1838,9 +1831,10 @@ pid_t junk_pid; glob_t g; short spflags = POSIX_SPAWN_SETEXEC; + size_t binpref_out_cnt = 0; int i; - posix_spawnattr_init(&spattr); + job_assumes(j, posix_spawnattr_init(&spattr) == 0); job_setup_attributes(j); @@ -1878,17 +1872,13 @@ spflags |= POSIX_SPAWN_START_SUSPENDED; } - if (j->force_ppc) { - int affinmib[] = { CTL_KERN, KERN_AFFINITY, 1, 1 }; - size_t mibsz = sizeof(affinmib) / sizeof(affinmib[0]); + job_assumes(j, posix_spawnattr_setflags(&spattr, spflags) == 0); - if (sysctl(affinmib, mibsz, NULL, NULL, NULL, 0) == -1) { - job_log_error(j, LOG_WARNING, "Failed to force PowerPC execution"); - } + if (j->j_binpref_cnt) { + job_assumes(j, posix_spawnattr_setbinpref_np(&spattr, j->j_binpref_cnt, j->j_binpref, &binpref_out_cnt) == 0); + job_assumes(j, binpref_out_cnt == j->j_binpref_cnt); } - posix_spawnattr_setflags(&spattr, spflags); - if (j->prog) { posix_spawn(&junk_pid, j->inetcompat ? file2exec : j->prog, NULL, &spattr, (char *const*)argv, environ); job_log_error(j, LOG_ERR, "posix_spawn(\"%s\", ...)", j->prog); @@ -4352,7 +4342,7 @@ kern_return_t job_mig_spawn(job_t j, _internal_string_t charbuf, mach_msg_type_number_t charbuf_cnt, uint32_t argc, uint32_t envc, uint64_t flags, uint16_t mig_umask, - pid_t *child_pid, mach_port_t *obsvr_port) + binpref_t bin_pref, uint32_t binpref_cnt, pid_t *child_pid, mach_port_t *obsvr_port) { job_t jr; size_t offset = 0; @@ -4406,7 +4396,7 @@ } jr = job_new_spawn(j, label, path, workingdir, argv, env, flags & SPAWN_HAS_UMASK ? &mig_umask : NULL, - flags & SPAWN_WANTS_WAIT4DEBUGGER, flags & SPAWN_WANTS_FORCE_PPC); + flags & SPAWN_WANTS_WAIT4DEBUGGER); if (jr == NULL) switch (errno) { case EEXIST: @@ -4415,14 +4405,17 @@ return BOOTSTRAP_NO_MEMORY; } + memcpy(jr->j_binpref, bin_pref, sizeof(jr->j_binpref)); + jr->j_binpref_cnt = binpref_cnt; + + job_dispatch(jr, true); + if (!job_setup_machport(jr)) { job_remove(jr); return BOOTSTRAP_NO_MEMORY; } - job_log(j, LOG_INFO, "Spawned with flags:%s%s", - flags & SPAWN_WANTS_FORCE_PPC ? " ppc": "", - flags & SPAWN_WANTS_WAIT4DEBUGGER ? " stopped": ""); + job_log(j, LOG_INFO, "Spawned with flags:%s", flags & SPAWN_WANTS_WAIT4DEBUGGER ? " stopped": ""); *child_pid = job_get_pid(jr); *obsvr_port = jr->j_port; Modified: trunk/launchd/src/launchd_mig_types.defs =================================================================== --- trunk/launchd/src/launchd_mig_types.defs 2006-12-20 00:48:11 UTC (rev 22993) +++ trunk/launchd/src/launchd_mig_types.defs 2006-12-21 19:23:38 UTC (rev 22994) @@ -35,6 +35,7 @@ type _internal_string_t = ^array [] of char; type bootstrap_status_t = integer_t; type bootstrap_status_array_t = ^array [] of bootstrap_status_t; +type binpref_t = array [8] of integer_t; type job_t = mach_port_t intran: job_t job_mig_intran(mach_port_t) Modified: trunk/launchd/src/liblaunch_private.h =================================================================== --- trunk/launchd/src/liblaunch_private.h 2006-12-20 00:48:11 UTC (rev 22993) +++ trunk/launchd/src/liblaunch_private.h 2006-12-21 19:23:38 UTC (rev 22994) @@ -20,6 +20,7 @@ #ifndef _LAUNCH_PRIV_H_ #define _LAUNCH_PRIV_H_ +#include #include #include @@ -93,7 +94,6 @@ */ #define SPAWN_VIA_LAUNCHD_STOPPED 0x0001 -#define SPAWN_VIA_LAUNCHD_FORCE_PPC 0x0002 struct spawn_via_launchd_attr { uint64_t spawn_flags; @@ -102,9 +102,11 @@ const char *const * spawn_env; const mode_t * spawn_umask; mach_port_t * spawn_observer_port; + const cpu_type_t * spawn_binpref; + size_t spawn_binpref_cnt; }; -#define spawn_via_launchd(a, b, c) _spawn_via_launchd(a, b, c, 0) +#define spawn_via_launchd(a, b, c) _spawn_via_launchd(a, b, c, 1) pid_t _spawn_via_launchd( const char *label, const char *const *argv, Modified: trunk/launchd/src/liblaunch_public.h =================================================================== --- trunk/launchd/src/liblaunch_public.h 2006-12-20 00:48:11 UTC (rev 22993) +++ trunk/launchd/src/liblaunch_public.h 2006-12-21 19:23:38 UTC (rev 22994) @@ -75,7 +75,6 @@ #define LAUNCH_JOBKEY_WORKINGDIRECTORY "WorkingDirectory" #define LAUNCH_JOBKEY_ENVIRONMENTVARIABLES "EnvironmentVariables" #define LAUNCH_JOBKEY_USERENVIRONMENTVARIABLES "UserEnvironmentVariables" -#define LAUNCH_JOBKEY_FORCEPOWERPC "ForcePowerPC" #define LAUNCH_JOBKEY_UMASK "Umask" #define LAUNCH_JOBKEY_NICE "Nice" #define LAUNCH_JOBKEY_LOWPRIORITYIO "LowPriorityIO" Modified: trunk/launchd/src/libvproc.c =================================================================== --- trunk/launchd/src/libvproc.c 2006-12-20 00:48:11 UTC (rev 22993) +++ trunk/launchd/src/libvproc.c 2006-12-21 19:23:38 UTC (rev 22994) @@ -68,10 +68,14 @@ uint64_t flags = 0; uint32_t argc = 0; uint32_t envc = 0; + binpref_t bin_pref; + size_t binpref_cnt = 0, binpref_max = sizeof(bin_pref) / sizeof(bin_pref[0]); pid_t p = -1; mode_t u_mask = CMASK; mach_port_t obsvr_port = MACH_PORT_NULL; + memset(&bin_pref, 0, sizeof(bin_pref)); + for (tmpp = argv; *tmpp; tmpp++) { argc++; len = strlen(*tmpp) + 1; @@ -81,13 +85,21 @@ } if (spawn_attrs) switch (struct_version) { + case 1: + if (spawn_attrs->spawn_binpref) { + if (spawn_attrs->spawn_binpref_cnt < binpref_max) { + binpref_max = spawn_attrs->spawn_binpref_cnt; + } + + for (; binpref_cnt < binpref_max; binpref_cnt++) { + bin_pref[binpref_cnt] = spawn_attrs->spawn_binpref[binpref_cnt]; + } + } + case 0: if (spawn_attrs->spawn_flags & SPAWN_VIA_LAUNCHD_STOPPED) { flags |= SPAWN_WANTS_WAIT4DEBUGGER; } - if (spawn_attrs->spawn_flags & SPAWN_VIA_LAUNCHD_FORCE_PPC) { - flags |= SPAWN_WANTS_FORCE_PPC; - } if (spawn_attrs->spawn_env) { for (tmpp = spawn_attrs->spawn_env; *tmpp; tmpp++) { @@ -125,13 +137,13 @@ break; } - kr = vproc_mig_spawn(bootstrap_port, buf, buf_len, argc, envc, flags, u_mask, &p, &obsvr_port); + kr = vproc_mig_spawn(bootstrap_port, buf, buf_len, argc, envc, flags, u_mask, bin_pref, binpref_cnt, &p, &obsvr_port); if (kr == VPROC_ERR_TRY_PER_USER) { mach_port_t puc; if (vproc_mig_lookup_per_user_context(bootstrap_port, 0, &puc) == 0) { - kr = vproc_mig_spawn(puc, buf, buf_len, argc, envc, flags, u_mask, &p, &obsvr_port); + kr = vproc_mig_spawn(puc, buf, buf_len, argc, envc, flags, u_mask, bin_pref, binpref_cnt, &p, &obsvr_port); mach_port_deallocate(mach_task_self(), puc); } } Modified: trunk/launchd/src/libvproc_internal.h =================================================================== --- trunk/launchd/src/libvproc_internal.h 2006-12-20 00:48:11 UTC (rev 22993) +++ trunk/launchd/src/libvproc_internal.h 2006-12-21 19:23:38 UTC (rev 22994) @@ -27,6 +27,7 @@ typedef char * _internal_string_t; typedef char * logmsg_t; typedef mach_port_t vproc_mig_t; +typedef integer_t binpref_t[8]; typedef enum { LAST_EXIT_STATUS = 1, GLOBAL_ON_DEMAND, @@ -45,7 +46,6 @@ #define SPAWN_HAS_WDIR 0x0002 #define SPAWN_HAS_UMASK 0x0004 #define SPAWN_WANTS_WAIT4DEBUGGER 0x0008 -#define SPAWN_WANTS_FORCE_PPC 0x0010 kern_return_t _vproc_grab_subset(mach_port_t bp, mach_port_t *reqport, mach_port_t *rcvright, Modified: trunk/launchd/src/protocol_job.defs =================================================================== --- trunk/launchd/src/protocol_job.defs 2006-12-20 00:48:11 UTC (rev 22993) +++ trunk/launchd/src/protocol_job.defs 2006-12-21 19:23:38 UTC (rev 22994) @@ -99,6 +99,8 @@ __envc : uint32_t; __flags : uint64_t; __umask : uint16_t; + __binpref : binpref_t; + __binpref_cnt : uint32_t; out __pid : pid_t; out __obsvr_port : mach_port_make_send_t); -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061221/0a3fa00d/attachment.html From source_changes at macosforge.org Thu Dec 21 11:43:50 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22995] trunk/launchd/src/launchd_core_logic.c Message-ID: <20061221194350.D15D6468723@cvs.opensource.apple.com> Revision: 22995 http://trac.macosforge.org/projects/launchd/changeset/22995 Author: zarzycki@apple.com Date: 2006-12-21 11:43:50 -0800 (Thu, 21 Dec 2006) Log Message: ----------- launchd support needed for Crash Reporter to handle 64 bit exception codes Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-21 19:23:38 UTC (rev 22994) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-21 19:43:50 UTC (rev 22995) @@ -2983,6 +2983,14 @@ job_assumes(ms->job, host_set_UNDServer(mhp, ms->port) == KERN_SUCCESS); } break; + case LAUNCH_DATA_DICTIONARY: +#ifdef MACH_EXCEPTION_CODES + if (strcasecmp(key, LAUNCH_JOBKEY_MACH_EXCEPTIONSERVER) == 0) { + job_assumes(ms->job, task_set_exception_ports(mts, em, ms->port, + EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES, f) == KERN_SUCCESS); + } +#endif + break; default: break; } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061221/f67f7e3e/attachment.html From source_changes at macosforge.org Fri Dec 22 11:05:57 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22996] trunk/launchd/src Message-ID: <20061222190557.4536946934C@cvs.opensource.apple.com> Revision: 22996 http://trac.macosforge.org/projects/launchd/changeset/22996 Author: zarzycki@apple.com Date: 2006-12-22 11:05:56 -0800 (Fri, 22 Dec 2006) Log Message: ----------- CAS: WindowServer hangs in CGXProcessHIDEvent/.../CGXPseudoActivateWindow/.../_LSDoSetFrontProcess Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c trunk/launchd/src/libvproc.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-12-21 19:43:50 UTC (rev 22995) +++ trunk/launchd/src/launchd_core_logic.c 2006-12-22 19:05:56 UTC (rev 22996) @@ -748,6 +748,11 @@ goto out_bad2; } + if (!job_assumes(j, launchd_mport_notify_req(j->j_port, MACH_NOTIFY_NO_SENDERS) == KERN_SUCCESS)) { + job_assumes(j, launchd_mport_close_recv(j->j_port) == KERN_SUCCESS); + goto out_bad; + } + return true; out_bad2: job_assumes(j, launchd_mport_close_recv(j->j_port) == KERN_SUCCESS); @@ -788,11 +793,6 @@ goto out_bad; } - if (!job_assumes(jr, launchd_mport_notify_req(jr->j_port, MACH_NOTIFY_NO_SENDERS) == KERN_SUCCESS)) { - job_assumes(jr, launchd_mport_close_recv(jr->j_port) == KERN_SUCCESS); - goto out_bad; - } - job_log(jr, LOG_INFO, "Legacy%s server created", ond ? " on-demand" : ""); return jr; @@ -2691,9 +2691,12 @@ bool job_useless(job_t j) { - /* Yes, j->unload_at_exit and j->j->only_once seem the same, but they'll differ someday... */ + /* Yes, j->unload_at_exit and j->only_once seem the same, but they'll differ someday... */ if ((j->unload_at_exit || j->only_once) && j->start_time != 0) { + if (j->unload_at_exit && j->j_port) { + return false; + } job_log(j, LOG_INFO, "Exited. Was only configured to run once."); return true; } else if (shutdown_in_progress) { Modified: trunk/launchd/src/libvproc.c =================================================================== --- trunk/launchd/src/libvproc.c 2006-12-21 19:43:50 UTC (rev 22995) +++ trunk/launchd/src/libvproc.c 2006-12-22 19:05:56 UTC (rev 22996) @@ -170,22 +170,11 @@ return -1; } -#if 0 kern_return_t mpm_wait(mach_port_t ajob __attribute__((unused)), int *wstatus) { - /* Stubbed out for now... - * CAS: WindowServer hangs in CGXProcessHIDEvent/.../CGXPseudoActivateWindow/.../_LSDoSetFrontProcess - */ return vproc_mig_wait(ajob, wstatus); } -#else -kern_return_t -mpm_wait(mach_port_t ajob __attribute__((unused)), int *wstatus __attribute__((unused))) -{ - return MIG_BAD_ID; -} -#endif kern_return_t mpm_uncork_fork(mach_port_t ajob) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061222/a93dc0a8/attachment.html From source_changes at macosforge.org Fri Dec 22 11:44:52 2006 From: source_changes at macosforge.org (source_changes@macosforge.org) Date: Tue Oct 9 16:25:37 2007 Subject: [launchd-changes] [22997] tags/launchd-184/ Message-ID: <20061222194452.3BCDD46947D@cvs.opensource.apple.com> Revision: 22997 http://trac.macosforge.org/projects/launchd/changeset/22997 Author: zarzycki@apple.com Date: 2006-12-22 11:44:52 -0800 (Fri, 22 Dec 2006) Log Message: ----------- "Tagging launchd-184 from https://svn.macosforge.org/repository/launchd/trunk" Added Paths: ----------- tags/launchd-184/ Copied: tags/launchd-184 (from rev 22996, trunk) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061222/c7003512/attachment.html