smbd_opipe_doorsvc.c revision 9fb67ea305c66b6a297583b9b0db6796b0dfe497
/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdio.h>
#include <strings.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <door.h>
#include <errno.h>
#include <pthread.h>
#include <smbsrv/libmlrpc.h>
#include "smbd.h"
static int smbd_opipe_fd = -1;
static smbd_door_t smbd_opipe_sdh;
static int smbd_opipe_exec_async(uint32_t);
/*
* Create the smbd opipe door service.
* Returns the door descriptor on success. Otherwise returns -1.
*/
int
smbd_opipe_start(void)
{
(void) pthread_mutex_lock(&smbd_opipe_mutex);
if (smbd_opipe_fd != -1) {
(void) pthread_mutex_unlock(&smbd_opipe_mutex);
return (-1);
}
errno = 0;
smbd_opipe_fd = -1;
}
(void) pthread_mutex_unlock(&smbd_opipe_mutex);
return (smbd_opipe_fd);
}
/*
* Stop the smbd opipe door service.
*/
void
smbd_opipe_stop(void)
{
(void) pthread_mutex_lock(&smbd_opipe_mutex);
if (smbd_opipe_fd != -1) {
(void) door_revoke(smbd_opipe_fd);
smbd_opipe_fd = -1;
}
(void) pthread_mutex_unlock(&smbd_opipe_mutex);
}
/*
* Process smbd opipe requests.
*/
/*ARGSUSED*/
static void
{
char buf[SMB_OPIPE_DOOR_BUFSIZE];
if (!smbd_online())
}
case SMB_OPIPE_OPEN:
hdr.dh_datalen = 0;
break;
case SMB_OPIPE_CLOSE:
hdr.dh_datalen = 0;
break;
case SMB_OPIPE_READ:
break;
case SMB_OPIPE_WRITE:
hdr.dh_datalen = 0;
break;
case SMB_OPIPE_EXEC:
hdr.dh_datalen = 0;
break;
default:
break;
}
}
/*
* On success, arg will be freed by the thread.
*/
static int
{
int rc;
return (ENOMEM);
(void) pthread_attr_init(&attr);
(void) pthread_attr_destroy(&attr);
if (rc != 0)
return (rc);
}