libsys: various updates
- move system calls for use by services from libminlib into libsys; - move srv_fork(2) and srv_kill(2) from RS and into libsys; - replace getprocnr(2) with sef_self(3); - rename previous getnprocnr(2) to getprocnr(2); - clean up getepinfo(2); - change all libsys calls that used _syscall to use _taskcall, so as to avoid going through errno to pass errors; this is already how most calls work anyway, and many of the calls previously using _syscall were already assumed to return the actual error; - initialize request messages to zero, for future compatibility (note that this does not include PCI calls, which are in need of a much bigger overhaul, nor kernel calls); - clean up more of dead DS code as a side effect. Change-Id: I8788f54c68598fcf58e23486e270c2d749780ebb
This commit is contained in:
@@ -32,13 +32,13 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Get the requestor's endpoint. */
|
||||
read(fid_get, &ep_requestor, sizeof(ep_requestor));
|
||||
dprint("GRANTOR: getting requestor's endpoint: %d\n", ep_requestor);
|
||||
dprint(("GRANTOR: getting requestor's endpoint: %d\n", ep_requestor));
|
||||
|
||||
/* Grant. */
|
||||
gid = cpf_grant_direct(ep_requestor, (long)buf, BUF_SIZE,
|
||||
CPF_READ | CPF_WRITE);
|
||||
ep_self = getprocnr();
|
||||
dprint("GRANTOR: sending my endpoint %d and gid %d\n", ep_self, gid);
|
||||
ep_self = sef_self();
|
||||
dprint(("GRANTOR: sending my endpoint %d and gid %d\n", ep_self, gid));
|
||||
write(fid_send, &ep_self, sizeof(ep_self));
|
||||
write(fid_send, &gid, sizeof(gid));
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <minix/safecopies.h>
|
||||
#include <minix/syslib.h>
|
||||
#include <minix/sysutil.h>
|
||||
#include <minix/minlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* TEST_PAGE_SHIFT =
|
||||
@@ -44,8 +45,8 @@
|
||||
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
# define dprint printf
|
||||
# define dprint(x) printf x
|
||||
#else
|
||||
# define dprint (void)
|
||||
# define dprint(x)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -63,15 +63,15 @@ int main(int argc, char **argv)
|
||||
/* Sending the endpoint to the granter, in order to let him
|
||||
* create the grant.
|
||||
*/
|
||||
ep_self = getprocnr();
|
||||
ep_self = sef_self();
|
||||
write(fid_send, &ep_self, sizeof(ep_self));
|
||||
dprint("REQUESTOR: sending my endpoint: %d\n", ep_self);
|
||||
dprint(("REQUESTOR: sending my endpoint: %d\n", ep_self));
|
||||
|
||||
/* Getting the granter's endpoint and gid. */
|
||||
read(fid_get, &ep_granter, sizeof(ep_granter));
|
||||
read(fid_get, &gid, sizeof(gid));
|
||||
dprint("REQUESTOR: getting granter's endpoint %d and gid %d\n",
|
||||
ep_granter, gid);
|
||||
dprint(("REQUESTOR: getting granter's endpoint %d and gid %d\n",
|
||||
ep_granter, gid));
|
||||
|
||||
/* Test SAFECOPY. */
|
||||
for(i = 0; i <= TEST_PAGE_SHIFT; i++) {
|
||||
|
||||
Reference in New Issue
Block a user