FYI, Brian used 0 instead of those flags and it solved the problem. A quick look at the code suggests that we probably don't using SMF_IMMEDIATE or SMF_TEMPORARY flags. In svcadm.c,
while ((o = getopt(argc, argv, "It")) != -1) { if (o == 'I') flags |= MARK_IMMEDIATE; else if (o == 't') flags |= MARK_TEMPORARY; else if (o == '?') usage(); ...... ...... } else if (strcmp(argv[optind], "maintenance") == 0) { callback = force_maintenance; } else { usage(); } if ((err = scf_walk_fmri(h, argc - optind - 1, argv + optind + 1, 0, callback, NULL, &exit_status, uu_warn)) != 0) { The 6th argument, NULL value, is what we use to call force_maintenance. As the result, force_maintenance always calls set_inst_action with SCF_PROPERTY_MAINT_ON which is the same if we call smf_maintain_instance with 0 flag. Below are snippets from force_maintenance and smf_maintain_instance force_maintenance() .... if (flags & MARK_IMMEDIATE) { prop = (flags & MARK_TEMPORARY) ? SCF_PROPERTY_MAINT_ON_IMMTEMP : SCF_PROPERTY_MAINT_ON_IMMEDIATE; } else { prop = (flags & MARK_TEMPORARY) ? SCF_PROPERTY_MAINT_ON_TEMPORARY : SCF_PROPERTY_MAINT_ON; } set_inst_action(wip->fmri, wip->inst, prop); smf_maintain_instance() ... if (flags & SMF_TEMPORARY) return (set_inst_action(instance, (flags & SMF_IMMEDIATE) ? SCF_PROPERTY_MAINT_ON_IMMTEMP : SCF_PROPERTY_MAINT_ON_TEMPORARY)); else return (set_inst_action(instance, (flags & SMF_IMMEDIATE) ? SCF_PROPERTY_MAINT_ON_IMMEDIATE : SCF_PROPERTY_MAINT_ON)); I'll file a bug so we can further investigate the issue. -tony Brian Utterback wrote: > Notice that my first attempt did not use SMF_IMMEDIATE. I just added > that hopefully. I have now removed it again. > > The output of svcs -l is: > > # svcs -l ntp > fmri svc:/network/ntp:default > name Network Time Protocol (NTP) > enabled true > state online > next_state none > state_time Tue May 01 09:59:39 2007 > logfile /var/svc/log/network-ntp:default.log > restarter svc:/system/svc/restarter:default > contract_id 228 > dependency require_all/error file://localhost/usr/sbin/ntpq (online) > file://localhost/usr/sbin/ntpdate (online) > dependency require_any/error svc:/network/service (online) > > > The /var/svc/log/network-ntp:default.log has no entries in it from after > the startup. The last line is: > [ May 1 09:59:39 Method "start" exited with status 0 ] > > > > David Bustos wrote: >> Quoth Brian Utterback on Tue, May 01, 2007 at 12:26:03PM -0400: >>> Okay, I tried that, and smf never kills the process nor even puts it >>> into maintenance status. Here is the code I have: >>> >>> /* enter the maintenance mode */ >>> if ((fmri = getenv("SMF_FMRI")) != NULL) { >>> if (0 > smf_maintain_instance(fmri, >>> SMF_TEMPORARY|SMF_IMMEDIATE)) { >>> >>> printf("smf_maintain_instance:%s\n",scf_error()); >>> exit(1); >>> } >>> /* sleep until SMF kills us */ >>> while (1) { >>> pause(); >>> } >>> } >> >> Don't use _IMMEDIATE. What does "svcs -l" report while you're sleeping? >> What does your /var/svc/log file say? >> >> >> David >