Page MenuHomeFreeBSD

Add scandirat(3)
ClosedPublic

Authored by kib on Aug 23 2022, 5:04 AM.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Aug 23 2022, 5:04 AM
kib added a reviewer: manpages.
gbe added a subscriber: gbe.

LGTM for the man page parts.

emaste added inline comments.
include/dirent.h
135 ↗(On Diff #109700)

any reason the first argument [only] is named?

This revision is now accepted and ready to land.Aug 23 2022, 1:34 PM
kib marked an inline comment as done.Aug 23 2022, 1:35 PM
kib added inline comments.
include/dirent.h
135 ↗(On Diff #109700)

No, it was copy/paste. Thanks for noting.

kib marked an inline comment as done.

Do not name dirfd in scandirat(3) prototype.

This revision now requires review to proceed.Aug 23 2022, 1:37 PM
This revision is now accepted and ready to land.Aug 23 2022, 1:38 PM

Looks good. Maybe add a 'tidy up a few scandir_b related issues while in the area' to the commit message?
Otherwise looks great.

lib/libc/gen/Makefile.inc
498 ↗(On Diff #109721)

I'd mention adding this link in the commit since it was missing before (eg, it's otherwise unrelated to this change)

Looks fine to me aside from the manpage typos :)

lib/libc/gen/scandir.3
35

Shouldn't scandirat be added here too?

107

Missing "an" ("takes an additional dirfd argument")?

114
In D36301#824708, @imp wrote:

Looks good. Maybe add a 'tidy up a few scandir_b related issues while in the area' to the commit message?
Otherwise looks great.

This is the cumulative diff against the branch.
Per commit view is available at https://kib.kiev.ua/git/gitweb.cgi?p=deviant3.git;a=shortlog;h=refs/heads/scandirat

kib marked 4 inline comments as done.

Man page fixes.
Add scandirat and scandir_b to .Nm's of scandir.3

This revision now requires review to proceed.Aug 24 2022, 3:15 AM
This revision is now accepted and ready to land.Aug 24 2022, 3:19 AM
markj added inline comments.
lib/libc/gen/scandir.3
112
118

The wording implies that in the case where dirname is absolute, dirfd may be invalid. But, that's not true right? So in the description of the absolute case, perhaps add, "The .Fa dirfd argument is unused, but must be a valid file descriptor or the special value .Dv AT_FDCWD."

121
kib marked 2 inline comments as done.Aug 24 2022, 5:33 PM
kib added inline comments.
lib/libc/gen/scandir.3
118

Hm, I thought that dirfd can be invalid. And both from my reading of namei_setup(), and actual testing, dirfd is ignored when first character of path is '/':

openat(-10000004,"/etc/passwd",O_RDONLY,00)      = 3 (0x3)
This revision now requires review to proceed.Aug 24 2022, 5:34 PM
markj added inline comments.
lib/libc/gen/scandir.3
118

Oops, sorry. I looked at namei() before writing the comment, but misread.

This revision is now accepted and ready to land.Aug 24 2022, 5:47 PM