ZFS and pathconf(_PC_NO_TRUNC)
Martin Simmons
martin at lispworks.com
Thu Nov 11 12:06:36 UTC 2010
>>>>> On Wed, 10 Nov 2010 22:28:27 +0000, Mark Blackman said:
>
> I note that when testing the pathconf(2) NO_TRUNC property
> on a ZFS filesystem, I get a ENOENT, "No such file or directory".
>
> I'm not sure if this qualifies as correct behaviour, but thought
> a learned soul on this list could enlighten me.
>
> I've attached the C snippet I used for testing.
>
> #include <unistd.h>
> #include <stdlib.h>
> #include <stdio.h>
> #include <string.h>
> #include <errno.h>
>
> int main(int argc, char *argv[]){
> int result;
>
> result=pathconf(argv[1], _PC_NO_TRUNC);
> printf("for %s: no_trunc is %d\n",argv[1],result);
> if (result<0)
> perror(NULL);
> 1;
> }
Your call to printf is clobbering the real errno, which is EINVAL. That is an
allowed value according to the pathconf man page:
[EINVAL] The implementation does not support an association of
the variable name with the associated file.
So it is correct, but maybe not useful.
__Martin
More information about the freebsd-fs
mailing list