NAME
init_service - initialize interface to service server
service_checkin - get receive rights to a standard server
port
SYNOPSIS
#include <servers/service.h>
void init_service(reply_port);
port_t reply_port;
kern_return_t
service_checkin(ServicePort, service_desired,
service_granted);
port_t ServicePort;
port_t service_desired;
port_t *service_granted;
ARGUMENTS
reply_port port that service_checkin will reply on. If set
to
PORT_NULL a new port will be allocated.
ServicePort port to the Service
server. service_port exported by
mach_init should be used.
service_desired
the port defined by mach_init for the service that
this server wishes to provide.
service_granted
if service_checkin succeeded this will be the same
port as service_desired but with receive rights.
DESCRIPTION
The Service server is started early in system initialization
and
allocates service ports for the standard system servers. So
far
these are the Environment Manager and the Network Name
Server.
Send rights to these ports are passed to all subsequently
spawned
tasks via the mach_init_ports array.
When the Environment Manager and
the Network Name Server tasks are
created, they need to get receive rights to their respective
service ports in order to provide their services. The
service_checkin call provides this function. It can only
grant
receive rights once, so the first task that asks for the
rights
gets them. Since the standard servers are started before any
user
processes, this should not be a problem.
If one of the standard servers
should die, the receive rights will
return to the Service server, which will then be able to
grant
these rights to a new instantiation of a standard server. A
user of
these servers will be able to continue to use the same port
to talk
to the new server as it used for the old server. For a
stateless
server, such as the Network Name Server, the user will see
nothing
but a temporary loss of response. In the case of the
Environment
Manager, the client’s state will be lost when the
server crashes,
so the restarting of a new server cannot be transparent.
RESULTS
KERN_SUCCESS the service_desired port is returned with
receive
rights.
KERN_FAILURE the Service server
didn’t have receive rights to the
service_desired port.
FILES
/usr/include/servers/service.h
SEE ALSO
mach_init(3)