#include <unistd.h> long QlgPathconf(Qlg_Path_Name_T *path, int name);Service Program Name: QP0LLIB1
The QlgPathconf() function, like the pathconf() function, lets an application determine the value of a configuration variable (name) associated with a particular file or directory (path). The difference is that the QlgPathconf() function takes a pointer to a Qlg_Path_Name_T structure, while pathconf() takes a pointer to a character string.
Limited information on the path parameter is provided here. For more information on the path parameter and for a discussion of other parameters, authorities required, return values, and related information, see pathconf()--Get Configurable Path Name Variables.
See Code disclaimer information for information pertaining to code examples.
The following example determines the maximum number of bytes in a file name:
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
main() {
long result;
#define mypath "/"
const char US_const[3]= "US";
const char Language_const[4] ="ENU";
typedef struct pnstruct
{
Qlg_Path_Name_T qlg_struct;
char pn[100]; /* This array size must be >= the */
/* length of the path name or must */
/* be a pointer to the path name. */
};
struct pnstruct path;
/***************************************************************/
/* Initialize Qlg_Path_Name_T parameters */
/***************************************************************/
memset((void*)&path, 0x00, sizeof(struct pnstruct));
path.qlg_struct.CCSID = 37;
memcpy(path.qlg_struct.Country_ID,US_const,2);
memcpy(path.qlg_struct.Language_ID,Language_const,3);
path.qlg_struct.Path_Type = QLG_CHAR_SINGLE;
path.qlg_struct.Path_Length = sizeof(mypath)-1;
path.qlg_struct.Path_Name_Delimiter[0] = '/';
memcpy(path.pn,mypath,sizeof(mypath)-1);
errno = 0;
puts("examining NAME_MAX limit for root filesystem");
if ((result = QlgPathconf((Qlg_Path_Name_T *)&path,
_PC_NAME_MAX)) == -1)
if (errno == 0)
puts("There is no limit to NAME_MAX.");
else perror("QlgPathconf() error");
else
printf("NAME_MAX is %ld\n", result);
}
Output:
examining NAME_MAX limit for root filesystem NAME_MAX is 255
| Top | UNIX-Type APIs | APIs by category |