From 8165c33c808ce3e86173d14a30471fe8474eacf7 Mon Sep 17 00:00:00 2001 From: matt Date: Thu, 14 Aug 2008 16:19:25 +0000 Subject: [PATCH] Implement following constants and add support their to the UFS family of file systems: _PC_2_SYMLINKS _PC_SYMLINK_MAX From andy dot shevchenko at gmail dot com. --- lib/libc/sys/pathconf.2 | 9 ++++++++- sys/sys/unistd.h | 4 +++- sys/ufs/ufs/ufs_vnops.c | 10 ++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/libc/sys/pathconf.2 b/lib/libc/sys/pathconf.2 index 8c50cbb41e93..4be85403b96e 100644 --- a/lib/libc/sys/pathconf.2 +++ b/lib/libc/sys/pathconf.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: pathconf.2,v 1.19 2005/08/14 07:28:29 jmmv Exp $ +.\" $NetBSD: pathconf.2,v 1.20 2008/08/14 16:19:25 matt Exp $ .\" .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. @@ -105,6 +105,13 @@ If the maximum size file that could ever exist on the mounted file system is .Dv maxsize , then the returned value is 2 plus the floor of the base 2 logarithm of .Dv maxsize . +.It Li _PC_SYMLINK_MAX +The maximum number of bytes in a symbolic link. +.It Li _PC_2_SYMLINKS +When referring to a directory the system supports the creation of symbolic +links within that directory; for nondirectory files, the meaning of +.Dv {_PC_2_SYMLINKS} +is undefined. .El .Sh RETURN VALUES If the call to diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h index a606534252da..605cd70d8675 100644 --- a/sys/sys/unistd.h +++ b/sys/sys/unistd.h @@ -1,4 +1,4 @@ -/* $NetBSD: unistd.h,v 1.44 2008/08/06 17:17:03 matt Exp $ */ +/* $NetBSD: unistd.h,v 1.45 2008/08/14 16:19:25 matt Exp $ */ /* * Copyright (c) 1989, 1993 @@ -156,6 +156,8 @@ #define _PC_VDISABLE 9 #define _PC_SYNC_IO 10 #define _PC_FILESIZEBITS 11 +#define _PC_SYMLINK_MAX 12 +#define _PC_2_SYMLINKS 13 /* configurable system variables; use as argument to sysconf(3) */ /* diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index c5b09d661d68..2fc3027f87b6 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_vnops.c,v 1.168 2008/08/12 10:14:38 hannken Exp $ */ +/* $NetBSD: ufs_vnops.c,v 1.169 2008/08/14 16:19:25 matt Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.168 2008/08/12 10:14:38 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.169 2008/08/14 16:19:25 matt Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -2153,6 +2153,12 @@ ufs_pathconf(void *v) case _PC_FILESIZEBITS: *ap->a_retval = 42; return (0); + case _PC_SYMLINK_MAX: + *ap->a_retval = MAXPATHLEN; + return (0); + case _PC_2_SYMLINKS: + *ap->a_retval = 1; + return (0); default: return (EINVAL); }