PKOPEN(3) UNIX Programmer's Manual PKOPEN(3) NAME pkopen, pkclose, pkread, pkwrite, pkfail - packet driver simulator SYNOPSIS char *pkopen(fd) pkclose(ptr) char *ptr; pkread(ptr, buffer, count) char *ptr, *buffer; pkwrite(ptr, buffer, count) char *ptr, *buffer; pkfail() DESCRIPTION These routines are a user-level implementation of the full- duplex end-to-end communication protocol described in _p_k(4). If _f_d is a file descriptor open for reading and writing, _p_k_o_p_e_n carries out the initial synchronization and returns an identifying pointer. The pointer is used as the first parameter to _p_k_r_e_a_d, _p_k_w_r_i_t_e, and _p_k_c_l_o_s_e. _P_k_r_e_a_d, _p_k_w_r_i_t_e and _p_k_c_l_o_s_e behave analogously to _r_e_a_d, _w_r_i_t_e and _c_l_o_s_e(2). However, a write of zero bytes is mean- ingful and will produce a corresponding read of zero bytes. SEE ALSO pkon(2), pk(4) DIAGNOSTICS _P_k_f_a_i_l is called upon persistent breakdown of communication. _P_k_f_a_i_l must be supplied by the user. _P_k_o_p_e_n returns a null (0) pointer if packet protocol can not be established. _P_k_r_e_a_d returns -1 on end of file, 0 in correspondence with a 0-length write. BUGS This simulation of _p_k(4) leaves something to be desired in needing special read and write routines, and in not being inheritable across calls of _e_x_e_c_v_e(2). Its prime use is on systems that lack _p_k. These functions use _a_l_a_r_m(2); simultaneous use of _a_l_a_r_m for other puposes may cause trouble. Printed 7/31/83 1