3 char buf_buf
[BUF_SIZE
+ CLICK_SIZE
];
5 /* SEF functions and variables. */
6 FORWARD
_PROTOTYPE( void sef_local_startup
, (void) );
8 /*===========================================================================*
10 *===========================================================================*/
11 int main(int argc
, char **argv
)
13 endpoint_t ep_self
, ep_requestor
;
14 int fid_send
, fid_get
;
19 /* SEF local startup. */
20 env_setargs(argc
, argv
);
24 buf
= (char*) CLICK_CEIL(buf_buf
);
25 fid_send
= open(FIFO_GRANTOR
, O_WRONLY
);
26 fid_get
= open(FIFO_REQUESTOR
, O_RDONLY
);
27 if(fid_get
< 0 || fid_send
< 0) {
28 printf("GRANTOR: can't open fifo files.\n");
33 /* Get the requestor's endpoint. */
34 read(fid_get
, &ep_requestor
, sizeof(ep_requestor
));
35 dprint("GRANTOR: getting requestor's endpoint: %d\n", ep_requestor
);
38 gid
= cpf_grant_direct(ep_requestor
, (long)buf
, BUF_SIZE
,
39 CPF_READ
| CPF_WRITE
);
40 ep_self
= getprocnr();
41 dprint("GRANTOR: sending my endpoint %d and gid %d\n", ep_self
, gid
);
42 write(fid_send
, &ep_self
, sizeof(ep_self
));
43 write(fid_send
, &gid
, sizeof(gid
));
45 /* Wait till requestor is done. */
51 /*===========================================================================*
53 *===========================================================================*/
54 PRIVATE
void sef_local_startup()
56 /* Let SEF perform startup. */