KAFS(3) NetBSD Programmer's Manual KAFS(3) NNAAMMEE kk__hhaassaaffss, kk__ppiiooccttll, kk__uunnlloogg, kk__sseettppaagg, kk__aaffss__cceellll__ooff__ffiillee, kkrrbb__aaffsslloogg, kkrrbb__aaffsslloogg__uuiidd - AFS library LLIIBBRRAARRYY AFS cache manager access library (libkafs, -lkafs) SSYYNNOOPPSSIISS ##iinncclluuddee <> _i_n_t kk__aaffss__cceellll__ooff__ffiillee(_c_o_n_s_t _c_h_a_r _*_p_a_t_h, _c_h_a_r _*_c_e_l_l, _i_n_t _l_e_n); _i_n_t kk__hhaassaaffss(); _i_n_t kk__ppiiooccttll(_c_h_a_r _*_a___p_a_t_h, _i_n_t _o___o_p_c_o_d_e, _s_t_r_u_c_t _V_i_c_e_I_o_c_t_l _*_a___p_a_r_a_m_s_P, _i_n_t _a___f_o_l_l_o_w_S_y_m_l_i_n_k_s); _i_n_t kk__sseettppaagg(); _i_n_t kk__uunnlloogg(); _i_n_t kkrrbb__aaffsslloogg(_c_h_a_r _*_c_e_l_l, _c_h_a_r _*_r_e_a_l_m); _i_n_t kkrrbb__aaffsslloogg__uuiidd(_c_h_a_r _*_c_e_l_l, _c_h_a_r _*_r_e_a_l_m, _u_i_d___t _u_i_d); DDEESSCCRRIIPPTTIIOONN kk__hhaassaaffss() initializes some library internal structures, and tests for the presence of AFS in the kernel, none of the other functions should be called before kk__hhaassaaffss() is called, or if it fails. kkrrbb__aaffsslloogg(), and kkrrbb__aaffsslloogg__uuiidd() obtains new tokens (and possibly tick- ets) for the specified _c_e_l_l and _r_e_a_l_m. If _c_e_l_l is NULL, the local cell is used. If _r_e_a_l_m is NULL, the function tries to guess what realm to use. Unless you have some good knowledge of what cell or realm to use, you should pass NULL. kkrrbb__aaffsslloogg() will use the real user-id for the ViceId field in the token, kkrrbb__aaffsslloogg__uuiidd() will use _u_i_d. kk__aaffss__cceellll__ooff__ffiillee() will in _c_e_l_l return the cell of a specified file, no more than _l_e_n characters is put in _c_e_l_l. kk__ppiiooccttll() does a ppiiooccttll() syscall with the specified arguments. This function is equivalent to llppiiooccttll(). kk__sseettppaagg() initializes a new PAG. kk__uunnlloogg() removes destroys all tokens in the current PAG. RREETTUURRNN VVAALLUUEESS kk__hhaassaaffss() returns 1 if AFS is present in the kernel, 0 otherwise. kkrrbb__aaffsslloogg() and kkrrbb__aaffsslloogg__uuiidd() returns 0 on success, or a kerberos er- ror number on failure. kk__aaffss__cceellll__ooff__ffiillee(), kk__ppiiooccttll(), kk__sseettppaagg(), and kk__uunnlloogg() all return the value of the underlaying system call, 0 on suc- cess. EENNVVIIRROONNMMEENNTT The following environment variable affect the mode of operation of kkaaffss: AFS_SYSCALL Normally, kkaaffss will try to figure out the correct system call(s) that are used by AFS by itself. If it does not man- age to do that, or does it incorrectly, you can set this variable to the system call number or list of system call numbers that should be used. EEXXAAMMPPLLEESS The following code from llooggiinn will obtain a new PAG and tokens for the local cell and the cell of the users home directory. if (k_hasafs()) { char cell[64]; k_setpag(); if(k_afs_cell_of_file(pwd->pw_dir, cell, sizeof(cell)) == 0) krb_afslog(cell, NULL); krb_afslog(NULL, NULL); } EERRRROORRSS If any of these functions (apart from kk__hhaassaaffss()) is called without AFS beeing present in the kernel, the process will usually (depending on the operating system) receive a SIGSYS signal. SSEEEE AALLSSOO Transarc Corporation, "File Server/Cache Manager Interface", _A_F_S_-_3 _P_r_o_g_r_a_m_m_e_r_'_s _R_e_f_e_r_e_n_c_e, 1991. BBUUGGSS AFS_SYSCALL has no effect under AIX. KTH-KRB May 7, 1997 2