1 #ifndef _VPROC_PRIVATE_H_
2 #define _VPROC_PRIVATE_H_
4 * Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
6 * @APPLE_APACHE_LICENSE_HEADER_START@
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
20 * @APPLE_APACHE_LICENSE_HEADER_END@
23 #include <sys/types.h>
24 #include <sys/cdefs.h>
25 #include <sys/syslog.h>
32 #pragma GCC visibility push(default)
34 /* DO NOT use this. This is a hack for launchctl */
35 #define VPROC_MAGIC_UNLOAD_SIGNAL 0x4141504C
38 VPROC_GSK_LAST_EXIT_STATUS
= 1,
39 VPROC_GSK_GLOBAL_ON_DEMAND
,
43 VPROC_GSK_BASIC_KEEPALIVE
,
44 VPROC_GSK_START_INTERVAL
,
45 VPROC_GSK_IDLE_TIMEOUT
,
46 VPROC_GSK_EXIT_TIMEOUT
,
47 VPROC_GSK_ENVIRONMENT
,
49 VPROC_GSK_GLOBAL_LOG_MASK
,
50 VPROC_GSK_GLOBAL_UMASK
,
53 vproc_err_t
vproc_swap_integer(vproc_t vp
, vproc_gsk_t key
, int64_t *inval
, int64_t *outval
);
54 vproc_err_t
vproc_swap_complex(vproc_t vp
, vproc_gsk_t key
, launch_data_t inval
, launch_data_t
*outval
);
56 vproc_err_t
_vproc_get_last_exit_status(int *wstatus
);
57 vproc_err_t
_vproc_set_global_on_demand(bool val
);
59 typedef void (*_vprocmgr_log_drain_callback_t
)(struct timeval
*when
, pid_t from_pid
, pid_t about_pid
, uid_t sender_uid
, gid_t sender_gid
, int priority
, const char *from_name
, const char *about_name
, const char *session_name
, const char *msg
);
61 vproc_err_t
_vprocmgr_log_drain(vproc_t vp
, pthread_mutex_t
*optional_mutex_around_callback
, _vprocmgr_log_drain_callback_t func
);
63 vproc_err_t
_vproc_send_signal_by_label(const char *label
, int sig
);
64 vproc_err_t
_vproc_kickstart_by_label(const char *label
, pid_t
*out_pid
, mach_port_t
*out_port_name
);
65 vproc_err_t
_vproc_wait_by_label(const char *label
, int *out_wstatus
);
67 void _vproc_log(int pri
, const char *msg
, ...) __attribute__((format(printf
, 2, 3)));
68 void _vproc_log_error(int pri
, const char *msg
, ...) __attribute__((format(printf
, 2, 3)));
70 #define VPROCMGR_SESSION_LOGINWINDOW "LoginWindow"
71 #define VPROCMGR_SESSION_BACKGROUND "Background"
72 #define VPROCMGR_SESSION_AQUA "Aqua"
73 #define VPROCMGR_SESSION_STANDARDIO "StandardIO"
74 #define VPROCMGR_SESSION_SYSTEM "System"
76 vproc_err_t
_vprocmgr_move_subset_to_user(uid_t target_user
, const char *session_type
);
78 #pragma GCC visibility pop