6 int gcov_flush(cp_grant_id_t grantid
, size_t size
);
8 /*===========================================================================*
10 *===========================================================================*/
13 /* A userland tool has requested the gcov data from another
14 * process (possibly vfs itself). Grant the target process
15 * access to the supplied buffer, and perform the call that
16 * makes the target copy its buffer to the caller (incl vfs
21 cp_grant_id_t grantid
;
27 size
= job_m_in
.GCOV_BUFF_SZ
;
28 target
= job_m_in
.GCOV_PID
;
29 buf
= (vir_bytes
) job_m_in
.GCOV_BUFF_P
;
31 /* If the wrong process is sent to, the system hangs; so make this root-only.
34 if (!super_user
) return(EPERM
);
36 /* Find target gcov process. */
37 for(n
= 0; n
< NR_PROCS
; n
++) {
38 if(fproc
[n
].fp_endpoint
!= NONE
&& fproc
[n
].fp_pid
== target
)
42 printf("VFS: gcov process %d not found\n", target
);
47 /* Grant target process to requestor's buffer. */
48 if ((grantid
= cpf_grant_magic(rfp
->fp_endpoint
, who_e
, buf
,
49 size
, CPF_WRITE
)) < 0) {
50 printf("VFS: gcov_flush: grant failed\n");
54 if (rfp
->fp_endpoint
== VFS_PROC_NR
) {
55 /* Request is for VFS itself. */
56 r
= gcov_flush(grantid
, size
);
58 /* Perform generic GCOV request. */
59 m
.GCOV_GRANT
= grantid
;
60 m
.GCOV_BUFF_SZ
= size
;
61 r
= _taskcall(rfp
->fp_endpoint
, COMMON_REQ_GCOV_DATA
, &m
);