Author: aurel32
Date: 2010-01-24 01:40:49 +0000 (Sun, 24 Jan 2010)
New Revision: 4101

Modified:
   glibc-package/trunk/debian/changelog
   glibc-package/trunk/debian/patches/kfreebsd/local-sysdeps.diff
Log:
  * kfreebsd/local-sysdeps.diff: update to revision 2947 (from glibc-bsd).



Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog        2010-01-23 17:27:20 UTC (rev 
4100)
+++ glibc-package/trunk/debian/changelog        2010-01-24 01:40:49 UTC (rev 
4101)
@@ -1,7 +1,7 @@
 eglibc (2.10.2-6) UNRELEASED; urgency=low
 
   [ Aurelien Jarno ]
-  * kfreebsd/local-sysdeps.diff: update to revision 2943 (from glibc-bsd).
+  * kfreebsd/local-sysdeps.diff: update to revision 2947 (from glibc-bsd).
   * Don't run the testsuite in parallel, as it sometimes causes some failures
     in some tests.
   * Add patches/any/cvs-malloc_info-init.diff to fix malloc_info() with no

Modified: glibc-package/trunk/debian/patches/kfreebsd/local-sysdeps.diff
===================================================================
--- glibc-package/trunk/debian/patches/kfreebsd/local-sysdeps.diff      
2010-01-23 17:27:20 UTC (rev 4100)
+++ glibc-package/trunk/debian/patches/kfreebsd/local-sysdeps.diff      
2010-01-24 01:40:49 UTC (rev 4101)
@@ -5850,7 +5850,7 @@
 +#endif        /* bits/socket.h */
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/stat.h
-@@ -0,0 +1,207 @@
+@@ -0,0 +1,214 @@
 +/* Copyright (C) 1992, 1996-1997, 2000, 2002 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +
@@ -6051,10 +6051,17 @@
 +/* Set file flags of the file referred to by FD to FLAGS.  */
 +extern int fchflags (int __fd, unsigned long int __flags) __THROW;
 +
++/* Set file flags for FILE to FLAGS without following symlinks.  */
++extern int lchflags(__const char *__file, int __flags);
 +
-+extern char *devname_r(__dev_t dev, __mode_t type, char *buf, int len) 
__THROW;
-+extern char *devname(__dev_t dev, __mode_t type) __THROW;
-+                                                                              
                                                                                
                                           
++/* Get device name in /dev with a device number of dev and a file type
++   matching the one encoded in type.  */
++extern char *devname(dev_t dev, mode_t type) __THROW;
++
++/* Store at most BUFLEN characters of the device name in /dev with a 
++   device number of dev and a file type matching the one encoded in type.  */
++extern char *devname_r(dev_t dev, mode_t type, char *buf, int buflen) __THROW;
++
 +__END_DECLS
 +
 +#endif /* __USE_BSD */
@@ -23733,7 +23740,7 @@
 +/* 'truncate64' is the same as 'truncate', because __off64_t == __off_t.  */
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/ttyname.c
-@@ -0,0 +1,125 @@
+@@ -0,0 +1,67 @@
 +/* Copyright (C) 1991,92,93,96,97,98,2000,2002 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +
@@ -23752,116 +23759,58 @@
 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 +   02111-1307 USA.  */
 +
-+#include <errno.h>
-+#include <limits.h>
 +#include <stddef.h>
-+#include <dirent.h>
 +#include <sys/types.h>
-+#include <sys/stat.h>
++#include <sys/ioctl.h>
 +#include <unistd.h>
 +#include <string.h>
 +#include <stdlib.h>
 +
-+char *__ttyname;
++/* Static buffer in `ttyname'.  */
++libc_freeres_ptr (static char *ttyname_buf);
 +
-+static char *getttyname (int fd, dev_t mydev, ino_t myino,
-+                       int save, int *dostat) internal_function;
++static const char dev[] = "/dev";
 +
-+
-+libc_freeres_ptr (static char *getttyname_name);
-+
-+static char *
-+internal_function
-+getttyname (fd, mydev, myino, save, dostat)
-+     int fd;
-+     dev_t mydev;
-+     ino_t myino;
-+     int save;
-+     int *dostat;
-+{
-+  static const char dev[] = "/dev";
-+  static size_t namelen;
-+  struct stat st;
-+  DIR *dirstream;
-+  struct dirent *d;
-+
-+  dirstream = __opendir (dev);
-+  if (dirstream == NULL)
-+    {
-+      *dostat = -1;
-+      return NULL;
-+    }
-+
-+  while ((d = __readdir (dirstream)) != NULL)
-+    if (((ino_t) d->d_fileno == myino || *dostat)
-+      && strcmp (d->d_name, "stdin")
-+      && strcmp (d->d_name, "stdout")
-+      && strcmp (d->d_name, "stderr"))
-+      {
-+      size_t dlen = _D_ALLOC_NAMLEN (d);
-+      if (sizeof (dev) + dlen > namelen)
-+        {
-+          free (getttyname_name);
-+          namelen = 2 * (sizeof (dev) + dlen); /* Big enough.  */
-+          getttyname_name = malloc (namelen);
-+          if (! getttyname_name)
-+            {
-+              *dostat = -1;
-+              /* Perhaps it helps to free the directory stream buffer.  */
-+              (void) __closedir (dirstream);
-+              return NULL;
-+            }
-+          *((char *) __mempcpy (getttyname_name, dev, sizeof (dev) - 1))
-+            = '/';
-+        }
-+      (void) __mempcpy (&getttyname_name[sizeof (dev)], d->d_name, dlen);
-+      if (stat (getttyname_name, &st) == 0
-+          && (ino_t) d->d_fileno == myino
-+          && (S_ISCHR (st.st_mode) || st.st_dev == mydev)
-+         )
-+        {
-+          (void) __closedir (dirstream);
-+          __ttyname = getttyname_name;
-+          __set_errno (save);
-+          return getttyname_name;
-+        }
-+      }
-+
-+  (void) __closedir (dirstream);
-+  __set_errno (save);
-+  return NULL;
-+}
-+
 +/* Return the pathname of the terminal FD is open on, or NULL on errors.
 +   The returned storage is good only until the next call to this function.  */
 +char *
 +ttyname (fd)
 +     int fd;
 +{
-+  struct stat st;
-+  int dostat = 0;
-+  char *name;
-+  int save = errno;
++  static size_t buflen;
++  struct fiodgname_arg fgn;
 +
 +  if (!__isatty (fd))
 +    return NULL;
 +
-+  if (fstat (fd, &st) < 0)
-+    return NULL;
++  if (buflen == 0)
++    {
++      buflen = 4095;
++      ttyname_buf = (char *) malloc (buflen + 1);
++      if (ttyname_buf == NULL)
++      {
++        buflen = 0;
++        return NULL;
++      }
++    }
 +
-+  name = getttyname (fd, st.st_dev, st.st_ino, save, &dostat);
++  /* Prepare the result buffer.  */
++  memcpy (ttyname_buf, dev, sizeof (dev) - 1);
++  ttyname_buf[sizeof (dev) - 1] = '/';
 +
-+  if (!name && dostat != -1)
++  fgn.buf = ttyname_buf + sizeof (dev);
++  fgn.len = buflen - sizeof (dev);
++
++  if (__ioctl(fd, FIODGNAME, &fgn) == -1)
 +    {
-+      dostat = 1;
-+      name = getttyname (fd, st.st_dev, st.st_ino, save, &dostat);
++      return NULL; 
 +    }
 +
-+  return name;
++  return ttyname_buf;
 +}
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/ttyname_r.c
-@@ -0,0 +1,153 @@
+@@ -0,0 +1,77 @@
 +/* Copyright (C) 1991,92,93,95,96,97,98,2004 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +
@@ -23881,85 +23830,15 @@
 +   02111-1307 USA.  */
 +
 +#include <errno.h>
-+#include <limits.h>
 +#include <stddef.h>
-+#include <dirent.h>
 +#include <sys/types.h>
-+#include <sys/stat.h>
++#include <sys/ioctl.h>
 +#include <unistd.h>
 +#include <string.h>
 +#include <stdlib.h>
 +
-+#ifndef MIN
-+# define MIN(a, b) ((a) < (b) ? (a) : (b))
-+#endif
-+
 +static const char dev[] = "/dev";
 +
-+static int getttyname_r (int fd, char *buf, size_t buflen,
-+                       dev_t mydev, ino_t myino, int save,
-+                       int *dostat) __THROW internal_function;
-+
-+static int
-+internal_function
-+getttyname_r (fd, buf, buflen, mydev, myino, save, dostat)
-+     int fd;
-+     char *buf;
-+     size_t buflen;
-+     dev_t mydev;
-+     ino_t myino;
-+     int save;
-+     int *dostat;
-+{
-+  struct stat st;
-+  DIR *dirstream;
-+  struct dirent *d;
-+
-+  dirstream = __opendir (dev);
-+  if (dirstream == NULL)
-+    {
-+      *dostat = -1;
-+      return errno;
-+    }
-+
-+  while ((d = __readdir (dirstream)) != NULL)
-+    if (((ino_t) d->d_fileno == myino || *dostat)
-+      && strcmp (d->d_name, "stdin")
-+      && strcmp (d->d_name, "stdout")
-+      && strcmp (d->d_name, "stderr"))
-+      {
-+      char *cp;
-+      size_t needed = _D_EXACT_NAMLEN (d) + 1;
-+
-+      if (needed > buflen)
-+        {
-+          *dostat = -1;
-+          (void) __closedir (dirstream);
-+          __set_errno (ERANGE);
-+          return ERANGE;
-+        }
-+
-+      cp = __stpncpy (&buf[sizeof (dev)], d->d_name, needed);
-+      cp[0] = '\0';
-+
-+      if (stat (buf, &st) == 0
-+          && (ino_t) d->d_fileno == myino
-+          && (S_ISCHR (st.st_mode) || st.st_dev == mydev)
-+         )
-+        {
-+          (void) __closedir (dirstream);
-+          __set_errno (save);
-+          return 0;
-+        }
-+      }
-+
-+  (void) __closedir (dirstream);
-+  __set_errno (save);
-+  /* It is not clear what to return in this case.  `isatty' says FD
-+     refers to a TTY but no entry in /dev has this inode.  */
-+  return ENOTTY;
-+}
-+
 +/* Store at most BUFLEN character of the pathname of the terminal FD is
 +   open on in BUF.  Return 0 on success,  otherwise an error number.  */
 +int
@@ -23968,10 +23847,8 @@
 +     char *buf;
 +     size_t buflen;
 +{
-+  struct stat st;
-+  int dostat = 0;
-+  int save = errno;
 +  int ret;
++  struct fiodgname_arg fgn;
 +
 +  /* Test for the absolute minimal size.  This makes life easier inside
 +     the loop.  */
@@ -23993,25 +23870,21 @@
 +      return ENOTTY;
 +    }
 +
-+  if (fstat (fd, &st) < 0)
-+    return errno;
-+
 +  /* Prepare the result buffer.  */
 +  memcpy (buf, dev, sizeof (dev) - 1);
 +  buf[sizeof (dev) - 1] = '/';
-+  buflen -= sizeof (dev);
 +
-+  ret = getttyname_r (fd, buf, buflen, st.st_dev, st.st_ino, save,
-+                    &dostat);
++  fgn.buf = buf + sizeof (dev);
++  fgn.len = buflen - sizeof (dev);
 +
-+  if (ret && dostat != -1)
++  ret = __ioctl(fd, FIODGNAME, &fgn);
++  if (ret == -1)
 +    {
-+      dostat = 1;
-+      ret = getttyname_r (fd, buf, buflen, st.st_dev, st.st_ino,
-+                        save, &dostat);
++      __set_errno (EBADF);
++      return EBADF;
 +    }
 +
-+  return ret;
++  return 0;
 +}
 +
 +weak_alias (__ttyname_r, ttyname_r)


-- 
To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to