door.h revision 49b225e1cfa7bbf7738d4df0a03f18e3283426eb
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* The door lightweight RPC I/F.
*/
#ifndef _SYS_DOOR_H
#define _SYS_DOOR_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Attributes associated with doors.
*/
/* Attributes originally obtained from door_create operation */
/* Attributes (additional) returned with door_info and door_desc_t data */
#if !defined(_ASM)
#if defined(_KERNEL)
#include <sys/door_impl.h>
#endif /* defined(_KERNEL) */
/* Basic door type information */
typedef unsigned long long door_ptr_t; /* Handle 64 bit pointers */
typedef unsigned long long door_id_t; /* Unique door identifier */
typedef unsigned int door_attr_t; /* Door attributes */
#ifdef _KERNEL
struct __door_handle;
#endif
/* Door descriptor passed to door_info to get current thread's binding */
#define DOOR_QUERY -2
/* Masks of applicable flags */
/* Mask of above attributes */
#define DOOR_ATTR_MASK (DOOR_CREATE_MASK | \
/* Attributes used to describe door_desc_t data */
#ifdef _KERNEL
#endif
/* Misc attributes used internally */
/* door parameters */
/*
* On AMD64, 32-bit pack door_desc and door_info to avoid needing special
* 32-bit x86 and 64-bit amd64.
*/
#pragma pack(4)
#endif
/*
* Structure used to pass descriptors/objects in door invocations
*/
typedef struct door_desc {
union {
/* File descriptor is passed */
struct {
int d_descriptor;
} d_desc;
#ifdef _KERNEL
/* Kernel passes handles referring to doors */
#endif
/* Reserved space */
int d_resv[5];
} d_data;
} door_desc_t;
/*
* Structure used to return info from door_info
*/
typedef struct door_info {
} door_info_t;
#pragma pack()
#endif
/*
* Structure used to return info from door_cred
*/
typedef struct door_cred {
} door_cred_t;
/*
*
* are updated to reflect the true location and size of the results.
*/
typedef struct door_arg {
char *rbuf; /* Result area */
} door_arg_t;
#if defined(_SYSCALL32)
/*
*/
typedef struct door_arg32 {
} door_arg32_t;
#endif
/*
* Structure used to pass door invocation information.
*/
struct door_results {
void *cookie;
char *data_ptr;
void (*pc)();
int nservers; /* zero if thread pool is empty */
};
#if defined(_SYSCALL32)
/*
* Structure used to pass door invocation information to 32-bit processes.
*/
struct door_results32 {
int nservers;
};
#endif
/*
* Structure used to pass a descriptor list to door_return.
*/
typedef struct door_return_desc {
#if defined(_SYSCALL32)
typedef struct door_return_desc32 {
#endif
#if defined(_KERNEL)
/*
* Errors used for doors. Negative numbers to avoid conflicts with errnos
*/
#define DTOV(d) ((d)->door_vnode)
/*
* Underlying 'filesystem' object definition
*/
typedef struct door_node {
void (*door_pc)(); /* Door server entry point */
void *door_data; /* Cookie passed during invocations */
} door_node_t;
/* Test if a door has been revoked */
struct file;
int door_finish_dispatch(caddr_t);
void door_slam(void);
void door_exit(void);
void door_revoke_all(void);
void door_deliver_unref(door_node_t *);
void door_list_delete(door_node_t *);
void door_bind_thread(door_node_t *);
void door_unbind_thread(door_node_t *);
extern kcondvar_t door_cv;
extern size_t door_max_arg;
/*
* In-kernel doors interface. These functions are considered Sun Private
* and may change incompatibly in a minor release of Solaris.
*/
int door_ki_create(void (*)(void *, door_arg_t *,
void (**)(void *, void *), void **, int *), void *, door_attr_t,
door_handle_t *);
void door_ki_hold(door_handle_t);
void door_ki_rele(door_handle_t);
int door_ki_open(char *, door_handle_t *);
#endif /* defined(_KERNEL) */
#endif /* !defined(_ASM) */
/*
* System call subcodes
*/
#define DOOR_CREATE 0
#define DOOR_REVOKE 1
#define DOOR_INFO 2
#define DOOR_CALL 3
#define DOOR_BIND 6
#define DOOR_UNBIND 7
#define DOOR_UNREFSYS 8
#define DOOR_UCRED 9
#define DOOR_RETURN 10
#define DOOR_GETPARAM 11
#define DOOR_SETPARAM 12
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DOOR_H */