From: Arne Welzel Date: Sat, 22 Sep 2012 20:02:14 +0000 (+0000) Subject: libsys: add sys_safememset() X-Git-Tag: v3.2.1~303 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.dnssec-keygen.html?a=commitdiff_plain;h=bf33a1c097c2356dfee214234f966ab123f392cc;p=minix.git libsys: add sys_safememset() --- diff --git a/include/minix/com.h b/include/minix/com.h index b44dccffa..2ab581de6 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -560,15 +560,15 @@ #define SCP_SEG_OBSOLETE m2_i2 /* my own segment */ #define SCP_GID m2_i3 /* grant id */ #define SCP_OFFSET m2_l1 /* offset within grant */ -#define SCP_ADDRESS m2_p1 /* my own address */ -#define SCP_BYTES m2_l2 /* bytes from offset */ +#define SCP_ADDRESS m2_p1 /* my own address */ +#define SCP_BYTES m2_l2 /* bytes from offset */ /* SYS_SAFEMEMSET */ #define SMS_DST m2_i1 /* dst endpoint */ #define SMS_GID m2_i3 /* grant id */ #define SMS_OFFSET m2_l1 /* offset within grant */ -#define SMS_BYTES m2_l2 /* bytes from offset */ -#define SMS_PATTERN m2_i2 /* memset() pattern */ +#define SMS_BYTES m2_l2 /* bytes from offset */ +#define SMS_PATTERN m2_i2 /* memset() pattern */ /* Field names for SYS_VSAFECOPY* */ #define VSCP_VEC_ADDR m2_p1 /* start of vector */ diff --git a/include/minix/syslib.h b/include/minix/syslib.h index 7614a0259..ad2c0a4ae 100644 --- a/include/minix/syslib.h +++ b/include/minix/syslib.h @@ -147,6 +147,9 @@ int sys_safecopyto(endpoint_t dest, cp_grant_id_t grant, vir_bytes grant_offset, vir_bytes my_address, size_t bytes); int sys_vsafecopy(struct vscp_vec *copyvec, int elements); +int sys_safememset(endpoint_t source, cp_grant_id_t grant, vir_bytes + grant_offset, int pattern, size_t bytes); + int sys_memset(endpoint_t who, unsigned long pattern, phys_bytes base, phys_bytes bytes); diff --git a/lib/libsys/Makefile b/lib/libsys/Makefile index ff8693eca..59670d2e4 100644 --- a/lib/libsys/Makefile +++ b/lib/libsys/Makefile @@ -53,6 +53,7 @@ SRCS= \ sys_runctl.c \ sys_safecopy.c \ sys_safemap.c \ + sys_safememset.c \ sys_schedctl.c \ sys_schedule.c \ sys_setalarm.c \ diff --git a/lib/libsys/sys_safememset.c b/lib/libsys/sys_safememset.c new file mode 100644 index 000000000..8032a20bb --- /dev/null +++ b/lib/libsys/sys_safememset.c @@ -0,0 +1,19 @@ +#include "syslib.h" + +#include + +int sys_safememset(endpoint_t dst_e, cp_grant_id_t gr_id, + vir_bytes offset, int pattern, size_t len) +{ +/* memset() a block of data using pattern */ + + message copy_mess; + + copy_mess.SMS_DST = dst_e; + copy_mess.SMS_GID = gr_id; + copy_mess.SMS_OFFSET = (long) offset; + copy_mess.SMS_PATTERN = pattern; + copy_mess.SMS_BYTES = (long) len; + + return(_kernel_call(SYS_SAFEMEMSET, ©_mess)); +}