917 (strncmp((path), (zone)->zone_rootpath, \
918 (zone)->zone_rootpathlen - 1) == 0)
919
920 /*
921 * Convenience macro to go from the global view of a path to that seen
922 * from within said zone. It is the responsibility of the caller to
923 * ensure that the path is a resolved one (ie, no '..'s or '.'s), and is
924 * in fact visible from within the zone.
925 */
926 #define ZONE_PATH_TRANSLATE(path, zone) \
927 (ASSERT(ZONE_PATH_VISIBLE(path, zone)), \
928 (path) + (zone)->zone_rootpathlen - 2)
929
930 /*
931 * Special processes visible in all zones.
932 */
933 #define ZONE_SPECIALPID(x) ((x) == 0 || (x) == 1)
934
935 /*
936 * The root vnode of the current zone.
937 */
938 #define ZONE_ROOTVP() (curzone->zone_rootvp)
939
940 /*
941 * Since a zone's root isn't necessarily an actual filesystem boundary
942 * (i.e. VROOT may not be set on zone->zone_rootvp) we need to not assume it.
943 * This macro helps in checking if a vnode is the current zone's rootvp.
944 * NOTE: Using the VN_ prefix, even though it's defined here in zone.h.
945 */
946 #define VN_IS_CURZONEROOT(vp) (VN_CMP(vp, ZONE_ROOTVP()))
947
948 /*
949 * Zone-safe version of thread_create() to be used when the caller wants to
950 * create a kernel thread to run within the current zone's context.
951 */
952 extern kthread_t *zthread_create(caddr_t, size_t, void (*)(), void *, size_t,
953 pri_t);
954 extern void zthread_exit(void);
955
956 /*
957 * Functions for an external observer to register interest in a zone's status
958 * change. Observers will be woken up when the zone status equals the status
959 * argument passed in (in the case of zone_status_timedwait, the function may
960 * also return because of a timeout; zone_status_wait_sig may return early due
961 * to a signal being delivered; zone_status_timedwait_sig may return for any of
962 * the above reasons).
963 *
964 * Otherwise these behave identically to cv_timedwait(), cv_wait(), and
|
917 (strncmp((path), (zone)->zone_rootpath, \
918 (zone)->zone_rootpathlen - 1) == 0)
919
920 /*
921 * Convenience macro to go from the global view of a path to that seen
922 * from within said zone. It is the responsibility of the caller to
923 * ensure that the path is a resolved one (ie, no '..'s or '.'s), and is
924 * in fact visible from within the zone.
925 */
926 #define ZONE_PATH_TRANSLATE(path, zone) \
927 (ASSERT(ZONE_PATH_VISIBLE(path, zone)), \
928 (path) + (zone)->zone_rootpathlen - 2)
929
930 /*
931 * Special processes visible in all zones.
932 */
933 #define ZONE_SPECIALPID(x) ((x) == 0 || (x) == 1)
934
935 /*
936 * The root vnode of the current zone.
937 *
938 * NOTE: It may be necessary (initialization time for file sharing where an
939 * NGZ loads a file-sharing kernel module that does zsd initialization) to NOT
940 * use this macro. One should ASSERT() that curzone == active ZSD (an
941 * ASSERTion that's not always true at ZSD initialization time) during regular
942 * use of this macro.
943 */
944 #define ZONE_ROOTVP() (curzone->zone_rootvp)
945
946 /*
947 * Since a zone's root isn't necessarily an actual filesystem boundary
948 * (i.e. VROOT may not be set on zone->zone_rootvp) we need to not assume it.
949 * This macro helps in checking if a vnode is the current zone's rootvp.
950 * NOTE: Using the VN_ prefix, even though it's defined here in zone.h.
951 * NOTE2: See above warning about ZONE_ROOTVP().
952 */
953 #define VN_IS_CURZONEROOT(vp) (VN_CMP(vp, ZONE_ROOTVP()))
954
955 /*
956 * Zone-safe version of thread_create() to be used when the caller wants to
957 * create a kernel thread to run within the current zone's context.
958 */
959 extern kthread_t *zthread_create(caddr_t, size_t, void (*)(), void *, size_t,
960 pri_t);
961 extern void zthread_exit(void);
962
963 /*
964 * Functions for an external observer to register interest in a zone's status
965 * change. Observers will be woken up when the zone status equals the status
966 * argument passed in (in the case of zone_status_timedwait, the function may
967 * also return because of a timeout; zone_status_wait_sig may return early due
968 * to a signal being delivered; zone_status_timedwait_sig may return for any of
969 * the above reasons).
970 *
971 * Otherwise these behave identically to cv_timedwait(), cv_wait(), and
|