1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate * 22*0Sstevel@tonic-gate * Copyright 1997 Sun Microsystems, Inc. All rights reserved. 23*0Sstevel@tonic-gate * Use is subject to license terms. 24*0Sstevel@tonic-gate */ 25*0Sstevel@tonic-gate 26*0Sstevel@tonic-gate #ifndef _SYS_PATHCONF_H 27*0Sstevel@tonic-gate #define _SYS_PATHCONF_H 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gate /* pathconf.h 1.9 89/06/26 SMI */ 32*0Sstevel@tonic-gate 33*0Sstevel@tonic-gate #include <sys/unistd.h> 34*0Sstevel@tonic-gate #include <sys/types.h> 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate #ifdef __cplusplus 37*0Sstevel@tonic-gate extern "C" { 38*0Sstevel@tonic-gate #endif 39*0Sstevel@tonic-gate 40*0Sstevel@tonic-gate /* 41*0Sstevel@tonic-gate * POSIX pathconf information 42*0Sstevel@tonic-gate * 43*0Sstevel@tonic-gate * static pathconf kludge notes: 44*0Sstevel@tonic-gate * For NFSv2 servers, we've added a vop (vop_cntl) to dig out pathconf 45*0Sstevel@tonic-gate * information. The mount program asked for the information from 46*0Sstevel@tonic-gate * a remote mountd daemon. If it gets it, it passes the info 47*0Sstevel@tonic-gate * down in a new args field. The info is passed in the struct below 48*0Sstevel@tonic-gate * in nfsargs.pathconf. There's a new NFS mount flag so that you know 49*0Sstevel@tonic-gate * this is happening. NFS stores the information locally; when a 50*0Sstevel@tonic-gate * pathconf request is made, the request is intercepted at the client 51*0Sstevel@tonic-gate * and the information is retrieved from the struct passed down by 52*0Sstevel@tonic-gate * mount. It's a kludge that will go away as soon 53*0Sstevel@tonic-gate * as we can ask the nfs protocol these sorts of questions (NFSr3). 54*0Sstevel@tonic-gate * All code is noted by "static pathconf kludge" comments and is 55*0Sstevel@tonic-gate * restricted to nfs code in the kernel. 56*0Sstevel@tonic-gate */ 57*0Sstevel@tonic-gate 58*0Sstevel@tonic-gate #define _BITS (8 * sizeof (short)) 59*0Sstevel@tonic-gate #define _PC_N ((_PC_LAST + _BITS - 1) / _BITS) 60*0Sstevel@tonic-gate #define _PC_ISSET(n, a) (a[(n) / _BITS] & (1 << ((n) % _BITS))) 61*0Sstevel@tonic-gate #define _PC_SET(n, a) (a[(n) / _BITS] |= (1 << ((n) % _BITS))) 62*0Sstevel@tonic-gate #define _PC_ERROR 0 63*0Sstevel@tonic-gate 64*0Sstevel@tonic-gate struct pathcnf { 65*0Sstevel@tonic-gate /* 66*0Sstevel@tonic-gate * pathconf() information 67*0Sstevel@tonic-gate */ 68*0Sstevel@tonic-gate int pc_link_max; /* max links allowed */ 69*0Sstevel@tonic-gate short pc_max_canon; /* max line len for a tty */ 70*0Sstevel@tonic-gate short pc_max_input; /* input a tty can eat all once */ 71*0Sstevel@tonic-gate short pc_name_max; /* max file name length (dir entry) */ 72*0Sstevel@tonic-gate short pc_path_max; /* path name len (/x/y/z/...) */ 73*0Sstevel@tonic-gate short pc_pipe_buf; /* size of a pipe (bytes) */ 74*0Sstevel@tonic-gate uchar_t pc_vdisable; /* safe char to turn off c_cc[i] */ 75*0Sstevel@tonic-gate char pc_xxx; /* alignment padding; cc_t == char */ 76*0Sstevel@tonic-gate short pc_mask[_PC_N]; /* see below */ 77*0Sstevel@tonic-gate #ifdef _KERNEL 78*0Sstevel@tonic-gate short pc_refcnt; /* number of mounts that use this */ 79*0Sstevel@tonic-gate struct pathcnf *pc_next; /* linked list */ 80*0Sstevel@tonic-gate #endif 81*0Sstevel@tonic-gate }; 82*0Sstevel@tonic-gate 83*0Sstevel@tonic-gate #ifdef _SYSCALL32 84*0Sstevel@tonic-gate struct pathcnf32 { 85*0Sstevel@tonic-gate /* 86*0Sstevel@tonic-gate * pathconf() information 87*0Sstevel@tonic-gate */ 88*0Sstevel@tonic-gate int32_t pc_link_max; /* max links allowed */ 89*0Sstevel@tonic-gate int16_t pc_max_canon; /* max line len for a tty */ 90*0Sstevel@tonic-gate int16_t pc_max_input; /* input a tty can eat all once */ 91*0Sstevel@tonic-gate int16_t pc_name_max; /* max file name length (dir entry) */ 92*0Sstevel@tonic-gate int16_t pc_path_max; /* path name len (/x/y/z/...) */ 93*0Sstevel@tonic-gate int16_t pc_pipe_buf; /* size of a pipe (bytes) */ 94*0Sstevel@tonic-gate uint8_t pc_vdisable; /* safe char to turn off c_cc[i] */ 95*0Sstevel@tonic-gate int8_t pc_xxx; /* alignment padding; cc_t == char */ 96*0Sstevel@tonic-gate int16_t pc_mask[_PC_N]; /* see below */ 97*0Sstevel@tonic-gate #ifdef _KERNEL 98*0Sstevel@tonic-gate int16_t pc_refcnt; /* number of mounts that use this */ 99*0Sstevel@tonic-gate caddr32_t pc_next; /* linked list */ 100*0Sstevel@tonic-gate #endif 101*0Sstevel@tonic-gate }; 102*0Sstevel@tonic-gate #endif /* _SYSCALL32 */ 103*0Sstevel@tonic-gate 104*0Sstevel@tonic-gate /* 105*0Sstevel@tonic-gate * pc_mask is used to encode either 106*0Sstevel@tonic-gate * a) boolean values (for chown_restricted and no_trunc) 107*0Sstevel@tonic-gate * b) errno on/off (for link, canon, input, name, path, and pipe) 108*0Sstevel@tonic-gate * The _PC_XXX values are defined in unistd.h; they start at 1 and go up 109*0Sstevel@tonic-gate * sequentially. 110*0Sstevel@tonic-gate * _PC_ERROR is used as the first bit to indicate total failure 111*0Sstevel@tonic-gate * (all info invalid). 112*0Sstevel@tonic-gate * To check for an error something like 113*0Sstevel@tonic-gate * _PC_ISSET(_PC_PATHMAX, foo.pc_mask) != 0 114*0Sstevel@tonic-gate * is used. 115*0Sstevel@tonic-gate */ 116*0Sstevel@tonic-gate 117*0Sstevel@tonic-gate /* 118*0Sstevel@tonic-gate * The size of the non-kernel part of the struct. 119*0Sstevel@tonic-gate */ 120*0Sstevel@tonic-gate #ifdef _KERNEL 121*0Sstevel@tonic-gate #define PCSIZ (int)(&(((struct pathcnf *)0)->pc_refcnt)) 122*0Sstevel@tonic-gate #define PCCMP(p1, p2) bcmp((char *)p1, (char *)p2, PCSIZ) 123*0Sstevel@tonic-gate #endif 124*0Sstevel@tonic-gate 125*0Sstevel@tonic-gate #ifdef __cplusplus 126*0Sstevel@tonic-gate } 127*0Sstevel@tonic-gate #endif 128*0Sstevel@tonic-gate 129*0Sstevel@tonic-gate #endif /* _SYS_PATHCONF_H */ 130