summaryrefslogtreecommitdiff
path: root/libc/sysdeps/unix/sysv/linux/pathconf.c
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2011-05-05 11:06:02 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2011-05-05 11:06:02 +0000
commit9dffe5df04949a0dd0f37832415009bf84d882b6 (patch)
tree5218a6b2ebaaa2dcd1c1e55e6858ccacda03397e /libc/sysdeps/unix/sysv/linux/pathconf.c
parentc46d4a9b60ba79c321ab9075f71751389808a15a (diff)
Merge changes between r13354 and r13697 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@13698 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/sysdeps/unix/sysv/linux/pathconf.c')
-rw-r--r--libc/sysdeps/unix/sysv/linux/pathconf.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/libc/sysdeps/unix/sysv/linux/pathconf.c b/libc/sysdeps/unix/sysv/linux/pathconf.c
index ae597fb5b..52610a14d 100644
--- a/libc/sysdeps/unix/sysv/linux/pathconf.c
+++ b/libc/sysdeps/unix/sysv/linux/pathconf.c
@@ -1,5 +1,5 @@
/* Get file-specific information about a file. Linux version.
- Copyright (C) 1991,1995,1996,1998-2003,2008,2010 Free Software Foundation, Inc.
+ Copyright (C) 1991,1995,1996,1998-2003,2008,2010,2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -36,6 +36,8 @@ long int
__pathconf (const char *file, int name)
{
struct statfs fsbuf;
+ int fd;
+ int flags;
switch (name)
{
@@ -51,6 +53,21 @@ __pathconf (const char *file, int name)
case _PC_CHOWN_RESTRICTED:
return __statfs_chown_restricted (__statfs (file, &fsbuf), &fsbuf);
+ case _PC_PIPE_BUF:
+ flags = O_RDONLY|O_NONBLOCK|O_NOCTTY;
+#ifdef O_CLOEXEC
+ flags |= O_CLOEXEC;
+#endif
+ fd = open_not_cancel_2 (file, flags);
+ if (fd >= 0)
+ {
+ long int r = __fcntl (fd, F_GETPIPE_SZ);
+ close_not_cancel_no_status (fd);
+ if (r > 0)
+ return r;
+ }
+ /* FALLTHROUGH */
+
default:
return posix_pathconf (file, name);
}