/usr/include/libupstart-app-launch-2/upstart-app-launch.h is in libupstart-app-launch2-dev 0.3+14.04.20140411-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | /*
* Copyright 2013 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authors:
* Ted Gould <ted.gould@canonical.com>
*/
#include <glib.h>
#ifndef __UPSTART_APP_LAUNCH_H__
#define __UPSTART_APP_LAUNCH_H__ 1
#pragma GCC visibility push(default)
#ifdef __cplusplus
extern "C" {
#endif
/**
* UpstartAppLaunchAppFailed:
*
* Types of failure that we report.
*/
typedef enum { /*< prefix=UPSTART_APP_LAUNCH_APP_FAILED */
UPSTART_APP_LAUNCH_APP_FAILED_CRASH, /*< nick=crash */
UPSTART_APP_LAUNCH_APP_FAILED_START_FAILURE, /*< nick=start-failure */
} UpstartAppLaunchAppFailed;
typedef UpstartAppLaunchAppFailed upstart_app_launch_app_failed_t;
/**
* UpstartAppLaunchAppObserver:
*
* Function prototype for application observers.
*/
typedef void (*UpstartAppLaunchAppObserver) (const gchar * appid, gpointer user_data);
/* Backwards compatible. Drop when making API bump. */
typedef UpstartAppLaunchAppObserver upstart_app_launch_app_observer_t;
/**
* UpstartAppLaunchAppFailedObserver:
*
* Function prototype for application failed observers.
*/
typedef void (*UpstartAppLaunchAppFailedObserver) (const gchar * appid, UpstartAppLaunchAppFailed failure_type, gpointer user_data);
/* Backwards compatible. Drop when making API bump. */
typedef UpstartAppLaunchAppFailedObserver upstart_app_launch_app_failed_observer_t;
/**
* UpstartAppLaunchHelperObserver:
*
* Function to watch for helpers that are starting and stopping
*/
typedef void (*UpstartAppLaunchHelperObserver) (const gchar * appid, const gchar * instanceid, const gchar * helpertype, gpointer user_data);
/**
* upstart_app_launch_start_application:
* @appid: ID of the application to launch
* @uris: (allow-none) (array zero-terminated=1) (element-type utf8) (transfer none): A NULL terminated list of URIs to send to the application
*
* Asks upstart to launch an application.
*
* Return value: Whether the launch succeeded (may fail later, but upstart
* will report the error in that case.
*/
gboolean upstart_app_launch_start_application (const gchar * appid,
const gchar * const * uris);
/**
* upstart_app_launch_start_application_test:
* @appid: ID of the application to launch
* @uris: (allow-none) (array zero-terminated=1) (element-type utf8) (transfer none): A NULL terminated list of URIs to send to the application
*
* Asks upstart to launch an application with environment variables set
* to enable testing. Should only be used in testing.
*
* Return value: Whether the launch succeeded (may fail later, but upstart
* will report the error in that case.
*/
gboolean upstart_app_launch_start_application_test (const gchar * appid,
const gchar * const * uris);
/**
* upstart_app_launch_stop_application:
* @appid: ID of the application to launch
*
* Asks upstart to stop an application.
*
* Return value: Whether we were able to ask Upstart to stop the process,
* used upstart_app_launch_observer_add_app_stop() to know when it is
* finally stopped.
*/
gboolean upstart_app_launch_stop_application (const gchar * appid);
/**
* upstart_app_launch_application_log_path:
* @appid: ID of the application
*
* Calculates the path for the log file that may be generated by
* the application. The log file won't be created until the application
* prints some output. Also, this doens't work for legacy applications
* that are multi-instance, only single instance ones.
*
* Return value: Path to a log file or NULL if unavailable
*/
gchar * upstart_app_launch_application_log_path (const gchar * appid);
/**
* upstart_app_launch_observer_add_app_starting:
* @observer: (scope notified): Callback when an application is about to start
* @user_data: (closure) (allow-none): Data to pass to the observer
*
* Sets up a callback to get called each time an application
* is about to start. The application will not start until the
* function returns.
*
* Return value: Whether adding the observer was successful.
*/
gboolean upstart_app_launch_observer_add_app_starting (UpstartAppLaunchAppObserver observer,
gpointer user_data);
/**
* upstart_app_launch_observer_add_app_started:
* @observer: (scope notified): Callback when an application started
* @user_data: (closure) (allow-none): Data to pass to the observer
*
* Sets up a callback to get called each time an application
* has been started.
*
* Return value: Whether adding the observer was successful.
*/
gboolean upstart_app_launch_observer_add_app_started (UpstartAppLaunchAppObserver observer,
gpointer user_data);
/**
* upstart_app_launch_observer_add_app_stop:
* @observer: (scope notified): Callback when an application stops
* @user_data: (closure) (allow-none): Data to pass to the observer
*
* Sets up a callback to get called each time an application
* stops.
*
* Return value: Whether adding the observer was successful.
*/
gboolean upstart_app_launch_observer_add_app_stop (UpstartAppLaunchAppObserver observer,
gpointer user_data);
/**
* upstart_app_launch_observer_add_app_focus:
* @observer: (scope notified): Callback when an application is started for the second time
* @user_data: (closure) (allow-none): Data to pass to the observer
*
* Sets up a callback to get called each time an app gets called
* that is already running, so we request it to be focused again.
*
* Return value: Whether adding the observer was successful.
*/
gboolean upstart_app_launch_observer_add_app_focus (UpstartAppLaunchAppObserver observer,
gpointer user_data);
/**
* upstart_app_launch_observer_add_app_resume:
* @observer: (scope notified): Callback when an application is started and possibly asleep
* @user_data: (closure) (allow-none): Data to pass to the observer
*
* Sets up a callback to get called each time an app gets called
* that is already running, so we request it to be given CPU time.
* At the end of the observer running the app as assumed to be active.
*
* Return value: Whether adding the observer was successful.
*/
gboolean upstart_app_launch_observer_add_app_resume (UpstartAppLaunchAppObserver observer,
gpointer user_data);
/**
* upstart_app_launch_observer_add_app_failed:
* @observer: (scope notified): Callback when an application fails
* @user_data: (allow-none) (closure): Data to pass to the observer
*
* Sets up a callback to get called each time an application
* stops via failure.
*
* Return value: Whether adding the observer was successful.
*/
gboolean upstart_app_launch_observer_add_app_failed (UpstartAppLaunchAppFailedObserver observer,
gpointer user_data);
/**
* upstart_app_launch_observer_delete_app_starting:
* @observer: (scope notified): Callback to remove
* @user_data: (closure) (allow-none): Data that was passed to the observer
*
* Removes a previously registered callback to ensure it no longer
* gets signaled.
*
* Return value: Whether deleting the observer was successful.
*/
gboolean upstart_app_launch_observer_delete_app_starting (UpstartAppLaunchAppObserver observer,
gpointer user_data);
/**
* upstart_app_launch_observer_delete_app_started:
* @observer: (scope notified): Callback to remove
* @user_data: (closure) (allow-none): Data that was passed to the observer
*
* Removes a previously registered callback to ensure it no longer
* gets signaled.
*
* Return value: Whether deleting the observer was successful.
*/
gboolean upstart_app_launch_observer_delete_app_started (UpstartAppLaunchAppObserver observer,
gpointer user_data);
/**
* upstart_app_launch_observer_delete_app_stop:
* @observer: (scope notified): Callback to remove
* @user_data: (closure) (allow-none): Data that was passed to the observer
*
* Removes a previously registered callback to ensure it no longer
* gets signaled.
*
* Return value: Whether deleting the observer was successful.
*/
gboolean upstart_app_launch_observer_delete_app_stop (UpstartAppLaunchAppObserver observer,
gpointer user_data);
/**
* upstart_app_launch_observer_delete_app_focus:
* @observer: (scope notified): Callback to remove
* @user_data: (closure) (allow-none): Data that was passed to the observer
*
* Removes a previously registered callback to ensure it no longer
* gets signaled.
*
* Return value: Whether deleting the observer was successful.
*/
gboolean upstart_app_launch_observer_delete_app_focus (UpstartAppLaunchAppObserver observer,
gpointer user_data);
/**
* upstart_app_launch_observer_delete_app_resume:
* @observer: (scope notified): Callback to remove
* @user_data: (closure) (allow-none): Data that was passed to the observer
*
* Removes a previously registered callback to ensure it no longer
* gets signaled.
*
* Return value: Whether deleting the observer was successful.
*/
gboolean upstart_app_launch_observer_delete_app_resume (UpstartAppLaunchAppObserver observer,
gpointer user_data);
/**
* upstart_app_launch_observer_delete_app_failed:
* @observer: (scope notified): Callback to remove
* @user_data: (closure) (allow-none): Data to pass to the observer
*
* Removes a previously registered callback to ensure it no longer
* gets signaled.
*
* Return value: Whether deleting the observer was successful.
*/
gboolean upstart_app_launch_observer_delete_app_failed (UpstartAppLaunchAppFailedObserver observer,
gpointer user_data);
/**
* upstart_app_launch_list_running_apps:
*
* Gets the Application IDs of all the running applications
* in the system.
*
* Return value: (transfer full): A NULL terminated list of
* application IDs. Should be free'd with g_strfreev().
*/
gchar ** upstart_app_launch_list_running_apps (void);
/**
* upstart_app_launch_get_primary_pid:
* @appid: ID of the application to look for
*
* Checks to see if an application is running and returns its
* main PID if so.
*
* Return Value: Either the PID of the application or 0 if it
* is not running.
*/
GPid upstart_app_launch_get_primary_pid (const gchar * appid);
/**
* upstart_app_launch_pid_in_app_id:
* @pid: Process ID to check on
* @appid: ID of the application to look in
*
* Checks to see if a PID is associated with the current application ID.
*
* Currently the implementation just calls upstart_app_launch_get_primary_pid()
* and checks to see if they're the same. But in the future this will check
* any PID created in the cgroup to see if it is associated.
*
* Return Value: Whether @pid is associated with the @appid
*/
gboolean upstart_app_launch_pid_in_app_id (GPid pid,
const gchar * appid);
/**
* upstart_app_launch_triplet_to_app_id:
* @pkg: Click package name
* @app: (allow-none): Application name, see description
* @version: (allow-none): Specific version or wildcard, see description
*
* Constructs an appid from pkg, app, version triple. Wildcards are allowed
* for the @app and @version parameters.
*
* For the @app parameter the wildcards * "first-listed-app", "last-listed-app"
* and "only-listed-app" can be used. A NULL value will default to the
* first listed app.
*
* For the @version parameter only one wildcard is allowed, "current-user-version".
* If NULL is passed that is the default.
*
* Return Value: Either the properly constructed @appid or NULL if it failed
* to construct it.
*/
gchar * upstart_app_launch_triplet_to_app_id (const gchar * pkg,
const gchar * app,
const gchar * version);
/**
* upstart_app_launch_app_id_parse:
* @appid: Application ID to parse
* @package: (out) (transfer full) (allow-none): Package section of @appid
* @application: (out) (transfer full) (allow-none): Application section of @appid
* @version: (out) (transfer full) (allow-none): Version section of @appid
*
* Takes an application ID @appid and breaks it into its component parts. Each
* of them can be NULL if those parts aren't desired. If all are NULL it will
* still parse to generate a proper return value check if @appid is valid.
*
* Return value: Whether @appid is valid
*/
gboolean upstart_app_launch_app_id_parse (const gchar * appid,
gchar ** package,
gchar ** application,
gchar ** version);
/**
* upstart_app_launch_start_helper:
* @type: Type of helper
* @appid: App ID of the helper
* @uris: (allow-none) (array zero-terminated=1) (element-type utf8) (transfer none): A NULL terminated list of URIs to send to the helper
*
* Start an untrusted helper for a specific @type on a given
* @appid. We don't know how that is done specifically, as Upstart
* will call a helper for that type. And then execute it under the
* AppArmor profile for the helper as defined in its manifest.
*
* Return value: Whether the helper was able to be started
*/
gboolean upstart_app_launch_start_helper (const gchar * type,
const gchar * appid,
const gchar * const * uris);
/**
* upstart_app_launch_start_multiple_helper:
* @type: Type of helper
* @appid: App ID of the helper
* @uris: (allow-none) (array zero-terminated=1) (element-type utf8) (transfer none): A NULL terminated list of URIs to send to the helper
*
* Start an untrusted helper for a specific @type on a given
* @appid. We don't know how that is done specifically, as Upstart
* will call a helper for that type. And then execute it under the
* Apparmor profile for that helper type. This function is different
* from @upstart_app_launch_start_helper in that it works for helpers
* that aren't single instance and the manager will be managing the
* instances as well.
*
* Return value: The generated instance ID or NULL on failure
*/
gchar * upstart_app_launch_start_multiple_helper (const gchar * type,
const gchar * appid,
const gchar * const * uris);
/**
* upstart_app_launch_stop_helper:
* @type: Type of helper
* @appid: App ID of the helper
*
* Asks Upstart to kill a helper. In general, this should be a last resort
* as we should ask the helper a better way probably with an in-band protocol
* of use.
*
* Return value: Whether the helper is stopped
*/
gboolean upstart_app_launch_stop_helper (const gchar * type,
const gchar * appid);
/**
* upstart_app_launch_stop_multiple_helper:
* @type: Type of helper
* @appid: App ID of the helper
* @instanceid: The instance ID returned when starting the helper
*
* Asks Upstart to kill a helper. In general, this should be a last resort
* as we should ask the helper a better way probably with an in-band protocol
* of use.
*
* Return value: Whether the helper is stopped
*/
gboolean upstart_app_launch_stop_multiple_helper (const gchar * type,
const gchar * appid,
const gchar * instanceid);
/**
* upstart_app_launch_list_helpers:
* @type: Type of helper
*
* List all App IDs of helpers of a given @type.
*
* Return value: (transfer full): List of application IDs
*/
gchar ** upstart_app_launch_list_helpers (const gchar * type);
/**
* upstart_app_launch_list_helper_instances:
* @type: Type of helper
* @appid: AppID of helper
*
* List all the instances for a particular AppID
*
* Return value: (transfer full): List of instance IDs
*/
gchar ** upstart_app_launch_list_helper_instances (const gchar * type,
const gchar * appid);
/**
* upstart_app_launch_observer_add_helper_started:
* @observer: (scope notified): Callback when a helper started
* @helper_type: (closure) (allow-none): Type of helpers to look for
* @user_data: (allow-none): Data to pass to the observer
*
* Sets up a callback to get called each time a helper of
* @helper_type has been started.
*
* Return value: Whether adding the observer was successful.
*/
gboolean upstart_app_launch_observer_add_helper_started (UpstartAppLaunchHelperObserver observer,
const gchar * helper_type,
gpointer user_data);
/**
* upstart_app_launch_observer_add_helper_stop:
* @observer: (scope notified): Callback when a helper stops
* @helper_type: (closure) (allow-none): Type of helpers to look for
* @user_data: (allow-none): Data to pass to the observer
*
* Sets up a callback to get called each time a helper of
* @helper_type stops.
*
* Return value: Whether adding the observer was successful.
*/
gboolean upstart_app_launch_observer_add_helper_stop (UpstartAppLaunchHelperObserver observer,
const gchar * helper_type,
gpointer user_data);
/**
* upstart_app_launch_observer_delete_helper_started:
* @observer: (scope notified): Callback to remove
* @helper_type: (closure) (allow-none): Type of helpers it looked for
* @user_data: (allow-none): Data that was passed to the observer
*
* Removes a previously registered callback to ensure it no longer
* gets signaled.
*
* Return value: Whether deleting the observer was successful.
*/
gboolean upstart_app_launch_observer_delete_helper_started (UpstartAppLaunchHelperObserver observer,
const gchar * helper_type,
gpointer user_data);
/**
* upstart_app_launch_observer_delete_helper_stop:
* @observer: (scope notified): Callback to remove
* @helper_type: (closure) (allow-none): Type of helpers it looked for
* @user_data: (allow-none): Data that was passed to the observer
*
* Removes a previously registered callback to ensure it no longer
* gets signaled.
*
* Return value: Whether deleting the observer was successful.
*/
gboolean upstart_app_launch_observer_delete_helper_stop (UpstartAppLaunchHelperObserver observer,
const gchar * helper_type,
gpointer user_data);
#ifdef __cplusplus
}
#endif
#pragma GCC visibility pop
#endif /* __UPSTART_APP_LAUNCH_H__ */
|