2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License, Version 1.0 only 2N/A * (the "License"). You may not use this file except in compliance 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A * Lookup seq_num. We can not use the standard nvlist_lookup functions since 2N/A * the nvlist is not allocated with NV_UNIQUE_NAME or NV_UNIQUE_NAME_TYPE. 2N/A * Get event service from a named door. 2N/A * This is similar to sysevent_post_event(), except that it deals with 2N/A * the "return buffer problem": 2N/A * Typically, the door service places the return buffer on the stack 2N/A * when calling door_return(). This places an artificial limit on the 2N/A * size of the return buffer. 2N/A * This problem is solved by placing large buffers on the heap, referenced 2N/A * through door_info. When client detects a large buffer, it will make a 2N/A * second door_call() to free the buffer. The client and the server agrees 2N/A * on a size, which is defined as BUF_THRESHOLD. 2N/A * Returns -1 if message not delivered. With errno set to cause of error. 2N/A * Returns 0 for success with the results returned in posting buffer. 2N/A * Open the service door 2N/A * EAGAIN is returned when the door server is temporarily 2N/A * out of threads to service the door call. So retry. 2N/A * If requiring a buf free, make another door call. There is 2N/A * no need to call munmap() after this door call, though. 2N/A dprint(
"fail to free event buf in server\n");
2N/A * Export an event service door 2N/A * add result to cookie, this is only invoked if result size > BUF_THRESHOLD 2N/A * Need a better way to handle memory here 2N/A * Attach current door result to the door cookie 2N/A * free a previous door result as described by number. 2N/A dprint(
"attempting to free nonexistent buf: %llu\n",
2N/A * Special case for asking to free buffer 2N/A * door_func update args to point to return results. 2N/A * memory for results are dynamically allocated. 2N/A * If no results, just return 2N/A dprint(
"null results returned from door_func().\n");
2N/A /* Determine the size of the packed nvlist */ 2N/A * If the size of the packed nvlist would exceed the buffer threshold 2N/A * then get a sequence number and add it to the nvlist. 2N/A /* Refill the args with a packed version of the nvlist */ 2N/A * Based on the size of the packed nvlist, either use the local buffer 2N/A * or add it to the results list. 2N/A * for long data, append results to end of queue in cook 2N/A * and set ndid, ask client to do another door_call 2N/A * to free the buffer. 2N/A /* create an fs file */ 2N/A /* allocate space for door cookie */ 2N/A * EBUSY error may occur if anyone references the door 2N/A * file while we are fattach'ing. Since librcm, in the 2N/A * the process context of a DR initiator program, may 2N/A * door_call etc.) while we are still fattach'ing, 2N/A /* wait for existing door calls to finish */