5 int gcov_flush(cp_grant_id_t grantid
, size_t size
);
7 /*===========================================================================*
9 *===========================================================================*/
12 /* A userland tool has requested the gcov data from another
13 * process (possibly vfs itself). Grant the target process
14 * access to the supplied buffer, and perform the call that
15 * makes the target copy its buffer to the caller (incl vfs
20 cp_grant_id_t grantid
;
26 size
= job_m_in
.m_lc_vfs_gcov
.buff_sz
;
27 target
= job_m_in
.m_lc_vfs_gcov
.pid
;
28 buf
= job_m_in
.m_lc_vfs_gcov
.buff_p
;
30 /* If the wrong process is sent to, the system hangs; so make this root-only.
33 if (!super_user
) return(EPERM
);
35 /* Find target gcov process. */
36 for(n
= 0; n
< NR_PROCS
; n
++) {
37 if(fproc
[n
].fp_endpoint
!= NONE
&& fproc
[n
].fp_pid
== target
)
41 printf("VFS: gcov process %d not found\n", target
);
46 /* Grant target process to requestor's buffer. */
47 if ((grantid
= cpf_grant_magic(rfp
->fp_endpoint
, who_e
, buf
,
48 size
, CPF_WRITE
)) < 0) {
49 printf("VFS: gcov_flush: grant failed\n");
53 if (rfp
->fp_endpoint
== VFS_PROC_NR
) {
54 /* Request is for VFS itself. */
55 r
= gcov_flush(grantid
, size
);
57 /* Perform generic GCOV request. */
58 m
.m_lc_vfs_gcov
.grant
= grantid
;
59 m
.m_lc_vfs_gcov
.buff_sz
= size
;
60 r
= _taskcall(rfp
->fp_endpoint
, COMMON_REQ_GCOV_DATA
, &m
);