xref: /minix3/minix/lib/libc/sys/minix_rs.c (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc #define _SYSTEM	1
2*433d6423SLionel Sambuc #define _MINIX_SYSTEM	1
3*433d6423SLionel Sambuc 
4*433d6423SLionel Sambuc #include <sys/cdefs.h>
5*433d6423SLionel Sambuc 
6*433d6423SLionel Sambuc #include <minix/com.h>
7*433d6423SLionel Sambuc #include <minix/config.h>
8*433d6423SLionel Sambuc #include <minix/ipc.h>
9*433d6423SLionel Sambuc #include <minix/endpoint.h>
10*433d6423SLionel Sambuc #include <minix/sysutil.h>
11*433d6423SLionel Sambuc #include <minix/syslib.h>
12*433d6423SLionel Sambuc #include <minix/const.h>
13*433d6423SLionel Sambuc #include <minix/type.h>
14*433d6423SLionel Sambuc #include <minix/ds.h>
15*433d6423SLionel Sambuc #include <minix/rs.h>
16*433d6423SLionel Sambuc 
17*433d6423SLionel Sambuc #include <stdio.h>
18*433d6423SLionel Sambuc #include <stdlib.h>
19*433d6423SLionel Sambuc #include <errno.h>
20*433d6423SLionel Sambuc #include <string.h>
21*433d6423SLionel Sambuc #include <lib.h>
22*433d6423SLionel Sambuc 
minix_rs_lookup(const char * name,endpoint_t * value)23*433d6423SLionel Sambuc int minix_rs_lookup(const char *name, endpoint_t *value)
24*433d6423SLionel Sambuc {
25*433d6423SLionel Sambuc 	message m;
26*433d6423SLionel Sambuc 	size_t len_key;
27*433d6423SLionel Sambuc 
28*433d6423SLionel Sambuc 	len_key = strlen(name)+1;
29*433d6423SLionel Sambuc 
30*433d6423SLionel Sambuc 	memset(&m, 0, sizeof(m));
31*433d6423SLionel Sambuc 	m.m_rs_req.name = name;
32*433d6423SLionel Sambuc 	m.m_rs_req.name_len = len_key;
33*433d6423SLionel Sambuc 
34*433d6423SLionel Sambuc 	if (_syscall(RS_PROC_NR, RS_LOOKUP, &m) != -1) {
35*433d6423SLionel Sambuc 		*value = m.m_rs_req.endpoint;
36*433d6423SLionel Sambuc 		return OK;
37*433d6423SLionel Sambuc 	}
38*433d6423SLionel Sambuc 
39*433d6423SLionel Sambuc 	return -1;
40*433d6423SLionel Sambuc }
41*433d6423SLionel Sambuc 
42