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