Modifying launchd-compliant daemon's plist from within the deamon.
Modifying launchd-compliant daemon's plist from within the deamon.
- Subject: Modifying launchd-compliant daemon's plist from within the deamon.
- From: "Maxim Zhuravlev" <email@hidden>
- Date: Tue, 5 Aug 2008 15:55:05 +0400
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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden