History log of /haiku/headers/posix/dirent.h
Revision Date Author Comments
# 7db2616c 18-Nov-2021 Augustin Cavalier <waddlesplash@gmail.com>

dirent: Use an actual flexible-length array for d_name.

GCC 11 treats [1] as a fixed-length array and not a flexible-length
array, and so some things that used direct strcmp("..", ent->d_name),
for instance, would be optimized out as being always unequal,
which was the cause of #17389. Using a real FLA informs GCC that
there is going to be more than one byte of data, and thus this
fixes that bug.

BeOS used [1] and not [0], possibly because it had to deal with
compilers (MetroWerks? Early GCC2?) that did not support FLAs.
GCC 2.95 does, using [0], and GCC 4 does, using [], so we can go
with that here.

(I did try using [0] for both, which seems to be OK with GCC 11,
but GCC 8 throws errors when d_name is dereferenced directly
as being-out-of-bounds. So, we have to use the #if here and give
newer GCC the [] syntax and not [0] to avoid that problem.)

The real question probably is whether or not we should backport
some variant of these changes to R1/beta3, as software at HaikuPorts
very well may run in to the same issue. (The alternative workaround
is to compile with -O1 and not -O2 for any affected software.) But
maybe this is an argument for keeping with the beta4 schedule of
this coming January...


# 173f54f1 19-Jul-2012 Matt Madia <mattmadia@gmail.com>

Updated copyright in headers. No functional change.


# bee827e2 06-Jan-2011 Jérôme Duval <korli@users.berlios.de>

changed dirfd() to its POSIX signature, without const (see #4947).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40137 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0fae8733 03-Nov-2010 Scott McCreary <scottmc2@gmail.com>

Updated posix headers to remove commas from copyright line, to match the preferred coding guidelines.
Cleaned up some header style violations, making sure there are two blank lines after the header guards.
This fixes the posix header part of #2191.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39288 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4e8123ba 01-Jan-2010 Axel Dörfler <axeld@pinc-software.de>

* Accidently moved the fdopendir() prototype around.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34839 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 31e49a2f 01-Jan-2010 Axel Dörfler <axeld@pinc-software.de>

* Implemented missing alphasort(), and scandir() POSIX functions. Completely
untested yet, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34838 a95241bf-73f2-0310-859d-f6bbb57e9c96


# adbf8b25 29-Aug-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added fdopendir() (POSIX).
* Got rid of <dirent_private.h> -- the __DIR structure is private to dirent.c,
now. The attribute directory, index directory, and query functions use the
the public POSIX API, so does the kernel module code. Those components were
not initializing the structure correctly anymore since the introduction of
telldir()/seekdir().

+alphabranch


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32819 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eaf71fbd 16-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Build fix: coreutils had a replacement for dirfd().
* Made DIR argument const in dirfd().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26469 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d73327e2 16-Jul-2008 Michael Lotz <mmlr@mlotz.ch>

Make dirfd() publically available. It used on other systems as well it seems.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26466 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9c5c79ad 09-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Made DIR definition private, and moved it into the new dirent_private.h
header.
* Added fields necessary to make it possible to retrieve more than one
dirent from the underlying file system.
* Unless some app creates a DIR on its own to it to feed readdir(), this
change should be binary compatible. If we find an application misbehaving,
we can still make it a GCC4 only thing.
* fs_attr/fs_index/fs_query now all use readdir() directly (as that one
contains the logic to iterate through a number of dirents in userspace).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26339 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0680eec7 04-Nov-2005 Jérôme Duval <korli@users.berlios.de>

added two missing functions : seekdir and telldir


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14699 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d8b0b6fe 14-Sep-2004 Axel Dörfler <axeld@pinc-software.de>

Added readdir_r() function prototype. Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8957 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 717eabde 28-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Added comments to the fields of the dirent structure. Most important one
is d_reclen which points out that this field is not the name length but
the one of the whole record (this is also handled incorrectly by the kernel
file systems right now).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2109 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 23f9ab0a 26-Oct-2002 beveloper <beveloper@nowhere.fake>

fixed the extern "C" header guards, it must read __cplusplus, not _cplusplus.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1679 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eb11b673 20-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Added a preliminary sys/types.h that just includes ktypes.h for now.
Changed other headers to include sys/types.h rather than ktypes.h.
Added a license reference at the beginning of those files.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@840 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ae372703 02-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Big commit: Added symlink support to the kernel.
- added needed syscalls to access symlink support from userland
- implemented lstat(), symlink(), and readlink()
- added dev_t to ktypes.h (for now - should be in a public header anyway)
- added symlink support to the "ls" command (now calls lstat() and shows the
link target with the -l option)
- changed the sys_read_stat() call to support symlinks, and updated files
using that function (it gets an extra argument: bool traverseLink)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@560 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 09cdca46 11-Jul-2002 David Reid <dreid@nowhere.fake>

This is where it belongs!


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@83 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 173f54f1473bd6a6511c5fc6dc899c91fb8dd667 19-Jul-2012 Matt Madia <mattmadia@gmail.com>

Updated copyright in headers. No functional change.


# bee827e203112ee6b4f73a782db046bbce7ed45c 06-Jan-2011 Jérôme Duval <korli@users.berlios.de>

changed dirfd() to its POSIX signature, without const (see #4947).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40137 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0fae873352b02792db93f721c1a2ff6b240c8ecc 03-Nov-2010 Scott McCreary <scottmc2@gmail.com>

Updated posix headers to remove commas from copyright line, to match the preferred coding guidelines.
Cleaned up some header style violations, making sure there are two blank lines after the header guards.
This fixes the posix header part of #2191.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39288 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4e8123ba980a708f8da9d08223f6c2b1606e182a 01-Jan-2010 Axel Dörfler <axeld@pinc-software.de>

* Accidently moved the fdopendir() prototype around.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34839 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 31e49a2f1de5dbf89d312330180b5ee8cfd3f460 01-Jan-2010 Axel Dörfler <axeld@pinc-software.de>

* Implemented missing alphasort(), and scandir() POSIX functions. Completely
untested yet, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34838 a95241bf-73f2-0310-859d-f6bbb57e9c96


# adbf8b25f8b29263fcb344ac86beceb9e83ce594 29-Aug-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added fdopendir() (POSIX).
* Got rid of <dirent_private.h> -- the __DIR structure is private to dirent.c,
now. The attribute directory, index directory, and query functions use the
the public POSIX API, so does the kernel module code. Those components were
not initializing the structure correctly anymore since the introduction of
telldir()/seekdir().

+alphabranch


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32819 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eaf71fbdb659656fd0fb429305051e64afb8cb65 16-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Build fix: coreutils had a replacement for dirfd().
* Made DIR argument const in dirfd().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26469 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d73327e2744b81f295e25d1e13f27bf791990a5c 16-Jul-2008 Michael Lotz <mmlr@mlotz.ch>

Make dirfd() publically available. It used on other systems as well it seems.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26466 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9c5c79ad8679dfbb8c0d611cfc95c3ee767aef77 09-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Made DIR definition private, and moved it into the new dirent_private.h
header.
* Added fields necessary to make it possible to retrieve more than one
dirent from the underlying file system.
* Unless some app creates a DIR on its own to it to feed readdir(), this
change should be binary compatible. If we find an application misbehaving,
we can still make it a GCC4 only thing.
* fs_attr/fs_index/fs_query now all use readdir() directly (as that one
contains the logic to iterate through a number of dirents in userspace).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26339 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0680eec72ca129bc018697035d3686513c657317 04-Nov-2005 Jérôme Duval <korli@users.berlios.de>

added two missing functions : seekdir and telldir


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14699 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d8b0b6fe51404f5d19139635aac7ec01dea36e2e 14-Sep-2004 Axel Dörfler <axeld@pinc-software.de>

Added readdir_r() function prototype. Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8957 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 717eabde1f5b49b7377931e6b0ac0790be5305f7 28-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Added comments to the fields of the dirent structure. Most important one
is d_reclen which points out that this field is not the name length but
the one of the whole record (this is also handled incorrectly by the kernel
file systems right now).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2109 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 23f9ab0a7d370b5da4088036baaa49b6e0ad79d1 26-Oct-2002 beveloper <beveloper@nowhere.fake>

fixed the extern "C" header guards, it must read __cplusplus, not _cplusplus.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1679 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eb11b67370ab6acec53f88af085b91c4e2f64f6e 20-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Added a preliminary sys/types.h that just includes ktypes.h for now.
Changed other headers to include sys/types.h rather than ktypes.h.
Added a license reference at the beginning of those files.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@840 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ae372703ce511d5bf7e2034e44241908b012b1ee 02-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Big commit: Added symlink support to the kernel.
- added needed syscalls to access symlink support from userland
- implemented lstat(), symlink(), and readlink()
- added dev_t to ktypes.h (for now - should be in a public header anyway)
- added symlink support to the "ls" command (now calls lstat() and shows the
link target with the -l option)
- changed the sys_read_stat() call to support symlinks, and updated files
using that function (it gets an extra argument: bool traverseLink)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@560 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 09cdca467d7b7bf436ce6c6d430667fdbce97a93 11-Jul-2002 David Reid <dreid@nowhere.fake>

This is where it belongs!


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@83 a95241bf-73f2-0310-859d-f6bbb57e9c96