Page MenuHomeFreeBSD

Make pseudofs(9) create directory entries in order
ClosedPublic

Authored by trasz on Fri, Sep 6, 1:07 PM.

Details

Summary

Make pseudofs(9) create directory entries in order, instead
of the reverse.

This fixes Linux sysctl(8) binary - it assumes the first two
directory entries are always "." and "..". There might be other
Linux apps affected by this.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

trasz created this revision.Fri, Sep 6, 1:07 PM
trasz added reviewers: des, kib.Fri, Sep 6, 1:08 PM
kib added inline comments.Fri, Sep 6, 2:00 PM
sys/fs/pseudofs/pseudofs.c
145 ↗(On Diff #61728)

I think you do not need this check, instead fold it with the previous pn_nodes == NULL branch. KASSERT() there demonstrates it nicely.

172 ↗(On Diff #61728)

What if pn_next never equal to pn ?

trasz updated this revision to Diff 61832.Mon, Sep 9, 11:32 AM
trasz marked an inline comment as done.

Fixes from kib.

trasz marked an inline comment as done.Mon, Sep 9, 11:32 AM

Thanks; does the updated version look ok?

kib accepted this revision.Mon, Sep 9, 12:41 PM

Did you considered switching to sys/queue.h ?

This revision is now accepted and ready to land.Mon, Sep 9, 12:41 PM
trasz added a comment.Mon, Sep 9, 12:58 PM

I've thought about it; I guess des@ hadn't used that to avoid contaminating pseudofs headers with queue.h, and I didn't want to change it.

kib added a comment.Mon, Sep 9, 2:08 PM

I've thought about it; I guess des@ hadn't used that to avoid contaminating pseudofs headers with queue.h, and I didn't want to change it.

Lets take a look. Very first line of pseudofs.h includes sys/jail.h. In sys/jail.h line 121 we see inclusion of sys/queue.h.

This revision was automatically updated to reflect the committed changes.