Page MenuHomeFreeBSD

Implement the basic system calls that operate on pathnames.
ClosedPublic

Authored by ed on Jul 15 2015, 10:51 AM.
Tags
None
Referenced Files
F107709188: D3097.id6967.diff
Fri, Jan 17, 5:26 PM
Unknown Object (File)
Wed, Jan 8, 4:18 AM
Unknown Object (File)
Sat, Dec 28, 3:02 PM
Unknown Object (File)
Nov 28 2024, 8:20 AM
Unknown Object (File)
Nov 28 2024, 8:19 AM
Unknown Object (File)
Nov 28 2024, 8:17 AM
Unknown Object (File)
Nov 28 2024, 8:16 AM
Unknown Object (File)
Nov 16 2024, 3:44 PM
Subscribers

Details

Summary

Unlike FreeBSD, CloudABI does not use null terminated strings for its
pathnames. Introduce a function called copyin_path() that can be used by
all of the filesystem system calls that use pathnames. This change
already implements the system calls that don't depend on any additional
functionality (e.g., conversion of struct stat).

Also implement the socket system calls that operate on pathnames, namely
the ones used by the C library functions bindat() and connectat(). These
don't receive a 'struct sockaddr_un', but just the pathname, meaning
they could be implemented in such a way that they don't depend on the
size of sun_path. For now, just use the existing interfaces.

Add a missing #include to cloudabi_syscalldefs.h to get this code to
build, as one of its macros depends on UINT64_C().

Test Plan

These implementations have already been tested in the CloudABI branch on
GitHub. They pass all of the tests.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ed retitled this revision from to Implement the basic system calls that operate on pathnames..
ed updated this object.
ed edited the test plan for this revision. (Show Details)
ed added reviewers: kib, pjd.
sys/compat/cloudabi/cloudabi_file.c
66 ↗(On Diff #6967)

This results in double-copying of the input string, first to the malloced area, then, from the area to the namei structure pbuf.

I am not sure how invasive would be a change to the vfs_lookup.c, but note that both cn and ni already carry the length of the strings.

sys/compat/cloudabi/cloudabi_file.c
66 ↗(On Diff #6967)

Exactly. I'm not happy with this approach. For what it's worth, on NetBSD I was able to do this slightly easier, because they have a structure (pathbuf, IIRC?) that you can pass in, instead of the {stringptr,uioseg} pair that we use right now.

Shall I leave it the way it is for now, but add a TODO to the comment above?

I was just brainstorming a bit: instead of going into NetBSD's direction of adding a struct pathbuf, maybe we could reuse struct uio for this purpose? As in, generalize struct uio to allow both sized and null-terminated buffers and let kern_...() use those instead. Or maybe I'm overthinking things.

Add a comment describing that there's room for improvement.

sys/compat/cloudabi/cloudabi_file.c
66 ↗(On Diff #6967)

I've added a TODO() to the comment.

This revision was automatically updated to reflect the committed changes.