SCDynamicStore ConsoleUser change callback not working on Tiger?
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Hi all, Daniel void ConsoleUserChangedCallBackFunction(SCDynamicStoreRef store, CFArrayRef changedKeys, void * context) { [...] } _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... I have a daemon which registers a callback with SCDynamicStore to get notified of console user changes. This seems to work just fine on Panther, but it appears the callback never gets triggered on Tiger. Were there any relevant changes in Tiger's SCDynamicStore that I should be aware of? Any other suggestions? (The relevant code is given below.) int main (int argc, const char * argv[]) { SCDynamicStoreContext context = {0, NULL, NULL, NULL, NULL}; SCDynamicStoreRef session = NULL; CFStringRef consoleUserNameChangeKey = NULL; CFArrayRef notificationKeys; CFRunLoopSourceRef rls = NULL; FILE * pid_file; daemon(0,0); syslog(1, "Daemon starting up with PID %d.\n", getpid()); session = SCDynamicStoreCreate(NULL, CFSTR(kProgramName), ConsoleUserChangedCallBackFunction, &context); if (session == NULL) { syslog(1, "Couldn't create DynamicStore session!\n"); return 1; } consoleUserNameChangeKey = SCDynamicStoreKeyCreateConsoleUser(NULL); if (consoleUserNameChangeKey == NULL) { CFRelease(session); syslog(1, "Couldn't create ConsoleUser key!\n"); return 1; } notificationKeys = CFArrayCreate(NULL, (void*)&consoleUserNameChangeKey, (CFIndex)1, &kCFTypeArrayCallBacks); CFRelease(consoleUserNameChangeKey); if (notificationKeys == NULL) { CFRelease(session); syslog(1, "Couldn't create notification key array!\n"); return 1; } if (SCDynamicStoreSetNotificationKeys(session, notificationKeys, NULL) == FALSE) { CFRelease(notificationKeys); CFRelease(session); syslog(1, "Couldn't set up dynamic store notification!\n"); return 1; } CFRelease(notificationKeys); rls = SCDynamicStoreCreateRunLoopSource(NULL, session, (CFIndex)0); pid_file = fopen(kPIDFile, "w"); fprintf(pid_file, "%d\n", getpid()); fclose(pid_file); CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); CFRelease(rls); CFRunLoopRun(); unlink(kPIDFile); return 0; } This email sent to site_archiver@lists.apple.com
participants (1)
-
Daniel Becker