diff options
| author | chs <chs@NetBSD.org> | 2010-09-11 20:53:04 +0000 |
|---|---|---|
| committer | chs <chs@NetBSD.org> | 2010-09-11 20:53:04 +0000 |
| commit | e0ef945ceeb539dbcab5075a742dc92df2c5fb8e (patch) | |
| tree | d49e8b33ec82780956406c5958d6af91367a9c02 /sys/compat/linux/common | |
| parent | 590b90699b95d6d966d45fec0bd6cb91432b239a (diff) | |
recent versions of linux (which we now claim to be) supply a BSD-style
d_type value in getdents() results, after the d_name field.
make our emulation do the same. fixes part of PR 43695.
Diffstat (limited to 'sys/compat/linux/common')
| -rw-r--r-- | sys/compat/linux/common/linux_dirent.h | 6 | ||||
| -rw-r--r-- | sys/compat/linux/common/linux_misc.c | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/sys/compat/linux/common/linux_dirent.h b/sys/compat/linux/common/linux_dirent.h index 312d13d0a72..b07400e6dfa 100644 --- a/sys/compat/linux/common/linux_dirent.h +++ b/sys/compat/linux/common/linux_dirent.h @@ -1,4 +1,4 @@ -/* $NetBSD: linux_dirent.h,v 1.11 2008/04/28 20:23:43 martin Exp $ */ +/* $NetBSD: linux_dirent.h,v 1.12 2010/09/11 20:53:04 chs Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ struct linux_dirent { linux_ino_t d_ino; linux_off_t d_off; u_short d_reclen; - char d_name[LINUX_MAXNAMLEN + 1]; + char d_name[LINUX_MAXNAMLEN + 2]; }; struct linux_dirent64 { @@ -51,6 +51,6 @@ struct linux_dirent64 { #define LINUX_NAMEOFF(dp) ((char *)&(dp)->d_name - (char *)(dp)) -#define LINUX_RECLEN(de,namlen) ALIGN((LINUX_NAMEOFF(de) + (namlen) + 1)) +#define LINUX_RECLEN(de,namlen) ALIGN((LINUX_NAMEOFF(de) + (namlen) + 2)) #endif /* !_LINUX_DIRENT_H */ diff --git a/sys/compat/linux/common/linux_misc.c b/sys/compat/linux/common/linux_misc.c index 9191c1692cb..02815d9fe52 100644 --- a/sys/compat/linux/common/linux_misc.c +++ b/sys/compat/linux/common/linux_misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_misc.c,v 1.216 2010/07/07 01:30:35 chs Exp $ */ +/* $NetBSD: linux_misc.c,v 1.217 2010/09/11 20:53:04 chs Exp $ */ /*- * Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.216 2010/07/07 01:30:35 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.217 2010/09/11 20:53:04 chs Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -779,6 +779,7 @@ again: idb.d_reclen = (u_short)linux_reclen; } strcpy(idb.d_name, bdp->d_name); + idb.d_name[strlen(idb.d_name) + 1] = bdp->d_type; if ((error = copyout((void *)&idb, outp, linux_reclen))) goto out; /* advance past this real entry */ |
