#include <stdlib.h>
#include <errno.h>
#include <string.h>
+#include <lib.h>
int minix_rs_lookup(const char *name, endpoint_t *value)
{
- int r;
message m;
size_t len_key;
m.RS_NAME = (char *) name;
m.RS_NAME_LEN = len_key;
- r = _taskcall(RS_PROC_NR, RS_LOOKUP, &m);
-
- if(r == OK) {
+ if (_syscall(RS_PROC_NR, RS_LOOKUP, &m) != -1) {
*value = m.RS_ENDPOINT;
+ return OK;
}
- return r;
+ return -1;
}
+++ /dev/null
-#include "../syslib/syslib.h"
-
-/*===========================================================================*
- * sys_enable_iop *
- *===========================================================================*/
-PUBLIC int sys_enable_iop(proc_nr_e)
-endpoint_t proc_nr_e; /* number of process to allow I/O */
-{
- message m_iop;
- m_iop.IO_ENDPT = proc_nr_e;
- return _taskcall(SYSTASK, SYS_IOPENABLE, &m_iop);
-}
-
-
+++ /dev/null
-/* _taskcall() is the same as _syscall() except it returns negative error
- * codes directly and not in errno. This is a better interface for MM and
- * FS.
- */
-
-#include <lib.h>
-#include <minix/syslib.h>
-
-PUBLIC int _taskcall(who, syscallnr, msgptr)
-endpoint_t who;
-int syscallnr;
-register message *msgptr;
-{
- int status;
-
- msgptr->m_type = syscallnr;
- status = _sendrec(who, msgptr);
- if (status != 0) return(status);
- return(msgptr->m_type);
-}
+++ /dev/null
-/* _taskcall() is the same as _syscall() except it returns negative error
- * codes directly and not in errno. This is a better interface for MM and
- * FS.
- */
-
-#include <lib.h>
-#include <minix/syslib.h>
-
-PUBLIC int _taskcall(who, syscallnr, msgptr)
-endpoint_t who;
-int syscallnr;
-register message *msgptr;
-{
- int status;
-
- msgptr->m_type = syscallnr;
- status = _sendrec(who, msgptr);
- if (status != 0) return(status);
- return(msgptr->m_type);
-}
#include <pwd.h>
#include <unistd.h>
#include <limits.h>
+#include <lib.h>
#include <minix/config.h>
#include <minix/com.h>
#include <minix/const.h>
/* A request to the RS server failed. Report and exit.
*/
-PRIVATE void failure(int num)
+PRIVATE void failure(void)
{
- fprintf(stderr, "Request to RS failed: %s (error %d)\n", strerror(num), num);
- exit(num);
+ fprintf(stderr, "Request to RS failed: %s (error %d)\n", strerror(errno), errno);
+ exit(errno);
}
message m;
int result;
int request;
- int i, s;
+ int i;
char *label, *progname = NULL;
struct passwd *pw;
m.RS_CMD_ADDR = (char *) &rs_start;
/* Build request message and send the request. */
- if (OK != (s=_taskcall(RS_PROC_NR, request, &m)))
- failure(-s);
+ if (_syscall(RS_PROC_NR, request, &m) == -1)
+ failure();
else if(req_printep)
printf("%d\n", m.RS_ENDPOINT);
result = m.m_type;
case RS_RESTART:
m.RS_CMD_ADDR = req_label;
m.RS_CMD_LEN = strlen(req_label);
- if (OK != (s=_taskcall(RS_PROC_NR, request, &m)))
- failure(-s);
+ if (_syscall(RS_PROC_NR, request, &m) == -1)
+ failure();
break;
case RS_SHUTDOWN:
- if (OK != (s=_taskcall(RS_PROC_NR, request, &m)))
- failure(-s);
+ if (_syscall(RS_PROC_NR, request, &m) == -1)
+ failure();
break;
case RS_UPDATE:
m.RS_CMD_ADDR = req_label;
m.RS_CMD_LEN = strlen(req_label);
m.RS_LU_STATE = req_lu_state;
m.RS_LU_PREPARE_MAXTIME = req_prepare_maxtime;
- if (OK != (s=_taskcall(RS_PROC_NR, request, &m)))
- failure(-s);
+ if (_syscall(RS_PROC_NR, request, &m) == -1)
+ failure();
break;
default:
print_usage(argv[ARG_NAME], "request is not yet supported");