door_create(3c) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

door_create(3c)

door_create(3C)          Standard C Library Functions          door_create(3C)

NAME
       door_create - create a door descriptor

SYNOPSIS
       #include <door.h>

       int door_create(void (*server_procedure) (void *cookie, char *argp,
            size_t arg_size, door_desc_t *dp, uint_t n_desc), void *cookie,
            uint_t attributes);

DESCRIPTION
       The door_create() function creates a door descriptor that describes the
       procedure  specified  by  the function server_procedure. The data item,
       cookie, is associated with the door descriptor, and is passed as an ar‐
       gument to the invoked function  server_procedure  during  door_call(3C)
       invocations. Other arguments passed to server_procedure from an associ‐
       ated  door_call()  are placed on the stack and include argp and dp. The
       argp argument points to arg_size bytes of  data  and  the  dp  argument
       points to n_desc  door_desc_t structures. The attributes argument spec‐
       ifies  attributes  associated with the newly created door. Valid values
       for attributes are constructed by OR-ing one or more of  the  following
       values:

       DOOR_UNREF

           Delivers  a  special  invocation on the door when the number of de‐
           scriptors that refer to this door drops to one. In order to trigger
           this condition, more than one descriptor must have referred to this
           door at some time. DOOR_UNREF_DATA designates an unreferenced invo‐
           cation, as the argp argument passed  to  server_procedure.  In  the
           case of an unreferenced invocation, the values for arg_size, dp and
           n_desc  are 0. Only one unreferenced invocation is delivered on be‐
           half of a door.


       DOOR_UNREF_MULTI

           Similar to DOOR_UNREF, except multiple unreferenced invocations can
           be delivered on the same door if the number of  descriptors  refer‐
           ring  to  the door drops to one more than once. Since an additional
           reference may have been passed by the time an unreferenced  invoca‐
           tion   arrives,   the   DOOR_IS_UNREF  attribute  returned  by  the
           door_info(3C) call can be used to determine if the  door  is  still
           unreferenced.


       DOOR_PRIVATE

           Maintains  a separate pool of server threads on behalf of the door.
           Server threads are associated with a door's private server pool us‐
           ing door_bind(3C).

           The door_xcreate(3C) function allows better handling  of  the  cre‐
           ation of server threads for private doors than is possible with the
           door_create() function.


       DOOR_REFUSE_DESC

           Any  attempt  to  call door_call(3C) on this door with argument de‐
           scriptors will fail with ENOTSUP. When this flag is set, the door's
           server procedure will always be invoked with an n_desc argument  of
           0.


       DOOR_NO_CANCEL

           Clients  which  abort  calls  to  door_call() on this door will not
           cause the cancellation of the server thread handling  the  request.
           See cancellation(7).



       The  descriptor  returned from door_create() will be marked as close on
       exec (FD_CLOEXEC). Information  about  a  door  is  available  for  all
       clients  of a door using door_info(). Applications concerned with secu‐
       rity should not place secure information in door data that is  accessi‐
       ble  by door_info(). In particular, secure data should not be stored in
       the data item cookie.


       By default, additional threads are created as needed to handle  concur‐
       rent  door_call()  invocations. See door_server_create(3C) for informa‐
       tion on how to change this behavior.


       A process can advertise a door in the file system name space using fat‐
       tach(3C).


       After creation, door_setparam(3C) can be used  to  set  limits  on  the
       amount of data and descriptors clients can send over the door.

RETURN VALUES
       Upon successful completion, door_create() returns a non-negative value.
       Otherwise, door_create returns −1 and sets errno to indicate the error.

ERRORS
       The door_create() function will fail if:

       EINVAL    Invalid attributes are passed.


       EMFILE    The process has too many open descriptors.


EXAMPLES
       Example 1 Creating a door



       The  following  example  creates a door and uses fattach() to advertise
       the door in the file system namespace.


         void
         server(void *cookie, char *argp, size_t arg_size, door_desc_t *dp,
             uint_t n_desc)
         {
             door_return(NULL, 0, NULL, 0);
             /* NOTREACHED */
         }

         int
         main(int argc, char *argv[])
         {
             int did;
             struct stat buf;

             if ((did = door_create(server, 0, 0)) < 0) {
                 perror("door_create");
                 exit(1);
             }

             /* make sure file system location exists */
             if (stat("/tmp/door", &buf) < 0) {
                 int newfd;
                 if ((newfd = creat("/tmp/door", 0444)) < 0) {
                     perror("creat");
                     exit(1);
                 }
                 (void) close(newfd);
             }

             /* make sure nothing else is attached */
             (void) fdetach("/tmp/door");

             /* attach to file system */
             if (fattach(did, "/tmp/door") < 0) {
                 perror("fattach");
                 exit(2);
             }
             [...]
         }


ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:

       tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE  TYPEAT‐
       TRIBUTE  VALUE  _ Architectureall _ Availabilitysystem/core-os _ Inter‐
       face StabilityCommitted _ MT-LevelSafe


SEE ALSO
       door_revoke(3C),    door_bind(3C),    door_call(3C),     door_info(3C),
       door_server_create(3C),       door_setparam(3C),      door_xcreate(3C),
       fattach(3C), attributes(7), cancellation(7)

HISTORY
       The door_create() function was introduced in Solaris 2.6.


       Definitions for the following attribute values are available in Solaris
       starting with the listed release:

       tab() box; cw(4.4i) |cw(1.1i)  lw(4.4i)  |lw(1.1i)  ATTRIBUTERELEASE  _
       DOOR_NO_CANCEL11.0.0 _ DOOR_REFUSE_DESC10 3/05 _ DOOR_UNREF_MULTI7 3/99
       (Update 1) _ DOOR_UNREF, DOOR_PRIVATE2.6


Oracle Solaris 11.4               27 Aug 2025                  door_create(3C)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3