2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
29 #include <sys/cdefs.h>
30 #include <sys/types.h>
32 #include <sys/resource.h>
33 #include <CoreFoundation/CoreFoundation.h>
42 @define kSCBundleRequires
44 #define kSCBundleRequires CFSTR("Requires")
48 @define kSCBundleVerbose
50 #define kSCBundleVerbose CFSTR("Verbose")
54 @typedef SCDynamicStoreBundleLoadFunction
55 @discussion Type of the load() initialization function that will be
56 called when a plug-in is loaded. This function is called
57 before calling the start() function and can be uesd to
58 initialize any variables, open any sessions with "configd",
59 and register any needed notifications.
60 @param bundle The CFBundle being loaded.
61 @param verbose A boolean value indicating whether verbose logging has
62 been enabled for this bundle.
64 typedef void (*SCDynamicStoreBundleLoadFunction
) (CFBundleRef bundle
,
65 Boolean bundleVerbose
);
68 @typedef SCDynamicStoreBundleStartFunction
69 @discussion Type of the start() initialization function that will be
70 called after all plug-ins have been loaded and their load()
71 functions have been called. This function can initialize
72 variables, open sessions with "configd", and register any
74 @param bundleName The name of the plug-in / bundle.
75 @param bundlePath The path name associated with the plug-in / bundle.
77 typedef void (*SCDynamicStoreBundleStartFunction
) (const char *bundleName
,
78 const char *bundlePath
);
81 @typedef SCDynamicStoreBundlePrimeFunction
82 @discussion Type of the prime() initialization function that will be
83 called after all plug-ins have executed their start() function but
84 before the main plug-in run loop is started. This function should
85 be used to initialize any configuration information and/or state
88 typedef void (*SCDynamicStoreBundlePrimeFunction
) ();
92 @typedef SCDPluginExecCallBack
93 @discussion Type of the callback function used when a child process
94 started by a plug-in has exited.
95 @param pid The process id of the child which has exited.
96 @param status The exit status of the child which has exited.
97 @param rusage A summary of the resources used by the child process
99 @param context The callback argument specified on the call
100 to _SCDPluginExecCommand().
102 typedef void (*SCDPluginExecCallBack
) (pid_t pid
,
104 struct rusage
*rusage
,
109 @typedef SCDPluginExecSetup
110 @discussion Type of the setup function used when a child process
112 @param pid The process id of the child, zero for the child process.
113 @param setupContext The setup argument specified on the call
114 to _SCDPluginExecCommand2().
116 typedef void (*SCDPluginExecSetup
) (pid_t pid
,
123 @function _SCDPluginExecCommand
124 @discussion Starts a child process.
125 @param callout The function to be called when the child
126 process exits. A NULL value can be specified if no
127 callouts are desired.
128 @param context A argument which will be passed
129 to the callout function.
130 @param uid The desired user id of the child process.
131 @param gid The desired group id of the child process.
132 @param path The command to be executed.
133 @param argv The arguments to be passed to the child process.
134 @result The process ID of the child.
137 _SCDPluginExecCommand (
138 SCDPluginExecCallBack callout
,
147 @function _SCDPluginExecCommand2
148 @discussion Starts a child process.
149 @param callout The function to be called when the child
150 process exits. A NULL value can be specified if no
151 callouts are desired.
152 @param context An argument which will be passed
153 to the callout function.
154 @param uid The desired user id of the child process.
155 @param gid The desired group id of the child process.
156 @param path The command to be executed.
157 @param argv The arguments to be passed to the child process.
158 @param setup A pointer to a function which, if specified, will
159 be called after the call to fork(2) but before the call
161 The function will be called in both the parent and child
163 The process ID returned by fork(2) will be passed as
164 an argument to this function (i.e. non-zero in the parent,
167 Note: the setup function is responsibile for establishing
168 (and closing) all file descriptors that are (not) needed
169 by the child process.
170 @param setupContext An argument which will be passed
171 to the setup function.
172 @result The process ID of the child.
175 _SCDPluginExecCommand2 (
176 SCDPluginExecCallBack callout
,
182 SCDPluginExecSetup setup
,
188 #endif /* _SCDPLUGIN_H */