Modifying launchd-compliant daemon's plist from within the deamon.
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=3+RP4jCrfufVZxuqii0OZOHYgK7GlBFam+txcO9V5Wg=; b=Da31OWl06wd9VVt57B7xsNZz1b/ki/Fdfq3yofDl3acwf1B0QNeupP23huI0QDMMNe segKI9EIkxDRvvprYTBT4vvY9ZCezfSWCLO3rQJ1nNKCyx9CfolrAF634JSev5zQ+Ba2 zmWIbuqrSQbXpcZpSzVbiQ4UWY/cxdxWzM3c0= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=H//cth45sry2yP3aFxSaCS6/hRhZDVwPbHrQfMdhLs53joRtQ6/8P0no9VzIgLgaZi 2dFlhmZNljmSCj2PUzO43V8OBPCGsF5mODU+JF54cFPbaNvJyIrQpxh6muDBNi4hwYAf P9W9Zw/lR0Jejy93oJas+Q1TfJsGKFgs4DtH4= Hi, all. I'm to implement a daemon, that should change RunAtLoad key value on a user demand. I guess, the following code should do the thing: <code> if ( ( checkin_request = launch_data_new_string( LAUNCH_KEY_CHECKIN ) ) == NULL ) { fprintf(stderr,"unable to init checkin request\n"); return; } if ( ( checkin_response = launch_msg( checkin_request ) ) == NULL ) { fprintf(stderr,"unable to get checkin response\n"); return; } if ( launch_data_get_type( checkin_response ) == LAUNCH_DATA_ERRNO ) <--- HERE ERRNO=13 ERROR OCCURE { fprintf(stderr,"checkin failed with errno = %d\n", launch_data_get_errno(checkin_response) ); return; } if ( ( runatload_key = launch_data_dict_lookup( checkin_response, LAUNCH_JOBKEY_RUNATLOAD ) ) == NULL ) { fprintf(stderr,"unable to get RunAtLoad key\n"); return; } if ( launch_data_set_bool (runatload_key, ( user_defined_value == true_value ) ? true: false ) == false ) { fprintf(stderr,"unable to set RunAtLoad key\n"); return; } if ( launch_msg( runatload_key ) == NULL ) { fprintf(stderr,"unable to msg RunAtLoad\n"); return; } </code> Here is my *.plist file: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>blah-blah</string> <key>RunAtLoad</key> <false/> <key>ServiceIPC</key> <true/> <key>WatchPaths</key> <array> <string>some_kickstart_path</string> </array> </dict> </plist> And the question is: why do I get errno=13 error, while checkin. Thaks in advance, - Maxim. _______________________________________________ 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... This email sent to site_archiver@lists.apple.com
participants (1)
-
Maxim Zhuravlev