History log of /fuchsia/zircon/system/ulib/fdio/unistd.c
Revision Date Author Comments
# 7a978d4f 26-Sep-2018 Adam Barth <abarth@google.com>

[fdio] Remove more redundant ordinals

Many of these are unused. The rest can use the declarations generated by
FIDL.

Test: No behavior change
Change-Id: I16e3834b6226c3739b7266d558c8e5ea4970a1ac


# 11a637e8 12-Sep-2018 Sean Klein <smklein@google.com>

[fs][fidl] Replaced filesystem ioctls with FIDL.

This patch allows "ioctl" to be removed from the
C++ VFS Vnode interface.

IOCTL_VFS_MOUNT_FS -> Mount()
IOCTL_VFS_UNMOUNT_FS -> Unmount()
IOCTL_VFS_UNMOUNT_NODE -> UnmounteNode()
IOCTL_VFS_QUERY_FS -> QueryFilesystem()
IOCTL_VFS_MOUNT_MKDIR_FS -> MountAndCreate()
IOCTL_VFS_GET_DEVICE_PATH -> GetDevicePath()
IOCTL_VFS_WATCH_DIR -> WatchDir()

Test: fs-management / fs / blobfs / fvm tests, df manually

Change-Id: Iefe8ec251ca6b8f4e4578ceb61bae6dff7a59e3d


# 4c75a4a2 21-Sep-2018 Adam Barth <abarth@google.com>

[fdio] Simplify process args and protocol names

Now that we can recover the type of a socket from the kernel, we only
need one process arg id for passing pipes, stream, and datagram sockets.

Also, replace the duplicated FDIO_PROTOCOL_* definitions with their FIDL
equivalent.

Test: No behavior change

Change-Id: I8b4bd830b9ef836827be6060cd0c4e0c096a7bbc


# d00a93e5 21-Sep-2018 George Kulakowski <kulakowski@google.com>

[fdio] Use -fvisibility=hidden

This exports only the symbols declared in the public headers.

ZX-1895 #comment

Test: full system build
Change-Id: Idf762ea94518d668c26235047a5917bc4d4399ef


# 21d5f468 21-Sep-2018 Adam Barth <abarth@google.com>

[fdio] Acquire socket type from kernel

After this change, we acquire the type of the socket (e.g., pipe,
stream, or datagram) using zx_object_get_info rather than using the
process args id. This CL paves the way for reducing the process args
ids.

Test: No behavior change
Change-Id: Ia92305fcf08a22d5403a315be11df3e21041aff3


# 964909ff 19-Sep-2018 Adam Barth <abarth@google.com>

[fdio] Merge pipe() and socketpair() impls

As far as I can tell, there's no reason for these implementations to be
separate. Merging the two means we'll be able to recover the client type
of a zx::socket from the information in the kernel. Specifically, a
stream socket with no control plane will map to a pipe (aka socketpair).

Test: pipe and socketpair tests continue to pass
Change-Id: If0251b662daa1ad4ce4017c7d949016204c667a1


# 5b2a508b 18-Sep-2018 Adam Barth <abarth@google.com>

[fdio] Always provide one handle for PA_FDIO_REMOTE

Previously, converting an zxrio_t into handles could create one or two
handles. After this CL, we always produce exactly one handle.

We obtain the second handle in __libc_extensions_init when we process
the handles from the startup message.

Test: devfs.fdio_tests
Change-Id: Ic980488a7a1f7ad7432d4fad95d03b0ea3d44e46


# 7f36f25d 23-Aug-2018 Sean Klein <smklein@google.com>

[fdio][fidl] Use unaligned dirents for readdir, add ino

Test: fs-tests
ZX-2502 #done

Change-Id: I93e932a629f25c7da9f9a1a06e022d907ada47ed


# 989ee4e8 13-Jun-2018 David Moore <davemoore@google.com>

[syscalls] Change vmar_... calls

- Create zx_vm_option_t type
- Change ZX_VM_FLAG_... to ZX_VM_... and make them new type.
- Change int32_t flags parameters to zx_vm_option_t options
- Make the options parameter be second.

- Modify vmar_..._old functions to keep other repos working.
Once they've all been updated these functions will go away.

ZX-2264
Test:CQ

Change-Id: I1faf4cc4e1e4dabf3d8ef680e398d83a545b0f09


# ab7c27b6 18-Aug-2018 Sean Klein <smklein@google.com>

[fs][fdio] Ensure O_APPEND is not lost on clone

Additionally, ensure that O_APPEND may be both
toggled on and off using fcntl. For cases where
fcntl is called with "F_SETFL" and the flags "0",
it's not possible to tell if this is turning off
a remote "O_APPEND" state without actually
sending the RPC.

Test: /boot/test/fs/fs-test, new append tests added.
ZX-2519 #done

Change-Id: I86ab0ad61554820409a1eb52aa83b10e590d8d3e


# 64ce93ed 01-Aug-2018 Sean Klein <smklein@google.com>

[fdio] Reduce usage of 'misc' operation.

Rather than relying on an ioctl-like 'misc' function
which acted as a bottleneck for both remote and
socket operations, split operations into separate
optional function pointers.

This change provides type safety to remote operations,
and makes it less cumbersome to add / modify these
ops.

Additionlly, fix an fd leak in futimens.

Test: Expanded fdio tests, fs tests

Change-Id: I78f0c2a4291636b35727a9bcbfeaa4e67fdcbce1


# e302c45d 26-Jul-2018 Nick Maniscalco <maniscalco@google.com>

[zircon][syscalls] Make zx_time_t and zx_duration_t signed types

This change is part of a hard transition and breaks the layers above.

zx_time_t and zx_duration_t are now int64_t. ZX_TIME_INFINITE is now
INT64_MAX.

A negative time value passed to a syscall is treated as any other time
value that's "in the past".

Test: CQ; new unit tests; built and ran topaz system on Eve

ZX-2100 #comment

Change-Id: I2a020cb2cf3dd7212608e24c1ee90cec58dd51ef


# b33437b1 26-Jul-2018 Nick Maniscalco <maniscalco@google.com>

[zircon][kernel] Use proper time types and overflow-safe arithmetic

This change is preparation for converting zx_time_t and zx_duration_t
from unsigned to signed types (ZX-2100).

1. Fix several places where the wrong time type was used (e.g.
zx_time_t instead of zx_duration_t). Because these are simple typedefs
it's easy to use the wrong one. While it generally doesn't cause a
problem, using the wrong type can be misleading and lead to bugs like
passing a relative time when an absolute time is expected.

2. Update kernel/ and some other parts of zircon to use the new
overflow-safe arithmetic functions from zircon/time.h.

Performance: Ran "/pkgfs/packages/zircon_benchmarks/0/bin/app -p" on
NUC before and after this change. Differences were withing the noise,
some slightly faster, some slightly slower.

Test: CQ

ZX-2100 #comment cleanup before conversion

Change-Id: I75d074e5850ade5385decd9bbf330497bf7610e9


# 593d7113 20-Jul-2018 Sean Klein <smklein@google.com>

[fdio][fidl][devmgr][fs] Deprecate Remote IO, enable FIDL2

Test: runtests (fs tests, fdio tests)
ZX-1919 #done

Change-Id: I459eb79546a3b952633faad2bb4914d9a3c68e05


# 379f22fa 06-Jun-2018 Adam Barth <abarth@google.com>

[fdio] Move headers into lib/fdio/...

Change-Id: Ie8d74e716da913bf6e2672c4acf8cd67b4962b7f


# cd3a7c55 15-May-2018 Roland McGrath <mcgrathr@google.com>

[ulib][fdio] Deliver nonzero d_reclen and d_ino values from readdir

These nonstandard fields have traditional uses and existing code
has expectations about their values if they exist. d_reclen must
be an upper bound for the size of the individual `struct dirent`.
d_ino should be nonzero.

musl's scandir and glob code relies on d_reclen in this way.

Change-Id: I2af6656b8f3af1d13f3878103fba8724000fde9d


# 9b4a07ea 01-May-2018 Sean Klein <smklein@google.com>

[fs][fdio] Explicitly observe VFS terminating status

ManagedVfs teardown involves the following:
1) On the async dispatch thread, identiify
that the vfs is terminating.
2) Signal all open connections.
3) When all connections are terminated, invoke
a ShutdownCallback.

Unfortunately if a connection (also executing
on the async dispatch thread) receives a port
packet that their channel is "readable", it may
be dequeued without identifying that the channel
is also "signalled for teardown".

Expose the "terminating" status of the VFS layer,
and explicitly check that instead of observing the
signal. This prevents a flaky failure condition
in memfs test.

Change-Id: Iedc17ae0cce759eec81bdd5e2d5a14a92613f2fa


# c6155325 23-Feb-2018 Ian McKellar <ianloic@google.com>

[libc][fdio] answer sysconf(_SC_OPEN_MAX) from fdio

sysconf(_SC_OPEN_MAX) should return the maximum number of file
descriptors but libc doesn't know the answer to that question, fdio
does. This defines a weak _fd_open_max function that is implemented by
fdio and used by libc's sysconf.

ZX-1742 #done

Change-Id: I0ba60bf92590e40d55ec857bf290133d7dcef4f6


# 7018fa04 16-Apr-2018 Adam Barth <abarth@google.com>

[fdio] Add fdio_ns_get_installed

This function exposes the installed namespace, which will let clients
manipulate the installed namespace. Also, make installed namespaces
mutable and remove unreachable codepath in initialization.

Change-Id: I74f2db3e4a9450f9de979922542839cd9e8c862a


# 9f4af83f 16-Apr-2018 Adam Barth <abarth@google.com>

[fdio] Remove fdio_clone_root

It's unlikely that fdio_clone_root will do anything useful now that we
have process-local namespaces. This function also has no clients, so now
is a good time to remove it.

Change-Id: I401ced91d9ce388cb554cd69d32a27f11adc49e2


# 1ba17458 06-Apr-2018 Toshi Kikuchi <toshik@google.com>

[fdio] map ZX_ERR_CANCELED to EBADF

ZX_ERR_CANCELED means the handle corresponding to a fd is closed
by somebody while the caller is still waiting on it. POSIX doesn't
define how the event-wait APIs should behave on such a case (it is
basically a programming error). But probably EBADF is a better error
code than ECANCELED, which is currently returning.

ZX-1892

Change-Id: Ie6ca36991a6a401897757b6fa63903e9ecf8907e


# 54dc7146 26-Mar-2018 Ruchira Ravoori <ravoorir@rodete-desktop-imager.corp.google.com>

[zircon][xhci][usb-cdc]Add a delay between requests when TRB Error occurs

When downloading files from the target using some of the usb-c ethernet adapters that use
usb-cdc-ecm driver, the scp loses connection intermittently and will not work until a reboot.
The underlying reason is that the device is not able to match the pace of the requests from
client driver. When this happens, the xhc controller converts the NRDY packets on the bus to
TRB Error. There is no way we can further know what the reason for TRB Error and it can be
other things too. So we do the normal reset deque ptr when we see a TRB Error, but we also
introduce a delay between the requests to slow down the I/O. There is a likely chance that
we might need to increase the delays as the situation arises.
NET-97 #done

Change-Id: Id06022e5a7b0129419b2768e37ec61daaa2df368


# 8fb6e776 27-Mar-2018 Matt Perry <mpcomplete@google.com>

[netstack] Remove obsolete oldsocket code.

We've enabled the newsocket protocol by default. This removes the code
specific to oldsocket.

ZX-1134 #progress

Change-Id: I74f85a6afbacd4399a6f2b40fb3bcf8a03663472


# d459236f 26-Feb-2018 Matt Perry <mpcomplete@google.com>

[fdio] Fix oldsocket build.

I am going to try reverting to oldsocket to see if that fixes a Chrome issue.
This ensures oldsocket still compiles.

Change-Id: I533fe23e1ead24add028f0f0acf24c71e4e14a32


# 00c7fc64 22-Feb-2018 Brian Swetland <swetland@google.com>

[fdio] fix incorrect refcounts on shared stdio fds

When initializing all stdio (0/1/2) from a single passed fd,
ensure that the refcounts on the fdio_t underlying the shared
object reflect that, to avoid releasing it too soon if some
of the fdtab entries are closed or replaced.

Change-Id: I4b837b1b3e069f702591f27e324a7185320d01d9


# 5bb74770 22-Feb-2018 Brian Swetland <swetland@google.com>

[fdio] debug tooling and cleanup

- move all fdio_t* allocation and freeing to bottleneck through
fdio_alloc() and fdio_free()
- remove direct use of free() in unwrap hook, in favor of correctly
doing a fdio_release() to balance the unbind
- remove dead code related to reply channels (wow?!)
- super-cheesy FDIO_ALLOCDEBUG, disabled by default but already useful
- remove unused vmofile_release()
- add some useful LOG() tracing (only included when FDIO_LLDEBUG)

Change-Id: Iedd7473c482a2b2779d85f7c344bd7c5ff83f608


# 46547e15 22-Feb-2018 Brian Swetland <swetland@google.com>

[fdio] add low level debugging facility

Debugging stdio from inside the guts of its implementation is not fun.

This adds an optional (disabled and uncompiled by default) low level
debug facilty for poking around inside libfdio when necessary.

Change-Id: If1c82b11c2fe2475be37a7848357fc4f3f300512


# 2a26980f 21-Feb-2018 Brian Swetland <swetland@google.com>

[fdio] make fdio_t flags clearer

Make it easier to differentiate between the state flags on fdio_t's
and various other "flags" used in the assorted posix APIs implemented
by libfdio.

- rename this field from "flags" to "ioflag"
- rename constants from FDIO_FLAG_* to IOFLAG_*

Change-Id: I37e6f93cd422adbaf38d33eea75557735d681436


# de065875 23-Jan-2018 Sean Klein <smklein@google.com>

[fdio][fs] Remove usage of private headers in public libraries

ZX-1592 #done

Change-Id: I152d4164cb0a4d5e3cf74dfe231c234a78550f0f


# ec9928ea 22-Jan-2018 Adam Barth <abarth@google.com>

[syscalls] Rename zx_time_get to zx_clock_get

This change frees up the get() method in for a zx_time_t accessor in the
zx::time class.

Change-Id: Ia4cdc7e3e558df5ba0cfeedb27a442abf4d6f305


# e00ff3e4 10-Nov-2017 Sean Klein <smklein@google.com>

[fdio] Use ZXRIO_ON_OPEN unsolicited requests for open

- The zxrio_describe_t object replaces the zxrio_object_t
with a FIDL2 compatible format.
- Flip the usage of ZX_FS_FLAG_PIPELINE to be implied by
default. "ZX_FS_FLAG_DESCRIBE" may be used to request a
description object.
- ZXRIO_DESCRIBE can be trivially implemented using the
description object -- it currently isn't, because there
would be no clients through RIO.

ZX-1360 #comment In Progress

Change-Id: I1c7cad185af468b26c770dfd092382814a436c04


# bff061dc 28-Dec-2017 rvargas <rvargas@google.com>

[fs] Fill out statfs' f_type and f_fsid fields.

zx-1319 #done

Change-Id: I0d364f553aebb34031d431ccb96978d2e20b882b


# 30205fab 01-Dec-2017 George Kulakowski <kulakowski@google.com>

[fdio] Move fdio cleanup to __libc_extensions_init

Now that we have __libc_extensions_fini, we can cleanup fdio data
structures without worrying about interleaving atexit() handler access
to file descriptors.

MA-368 #done

Change-Id: Ib76dedb1cc77b38a10c02fa2e3c933f4a598f33d


# 8401cffb 30-Nov-2017 Sean Klein <smklein@google.com>

[fdio] Implement syncfs

This implementation is cheating a little, since currently
fsync and syncfs use the same implementation, but by existing
it will allow clients to (conservatively) use the appropriate
API for their use case.

ZX-1409 #done

Change-Id: I7c682d70d448f76c4e7c82341903d75f056462d6


# 20460b5f 06-Nov-2017 Sean Klein <smklein@google.com>

[fs] Use the Fuchsia-defined open flags

Re-lands 2aff2cba029cf0f7e98e6d19f6dc7a663c318227

This change uses the Fuchsia-defined flags on the wire
as well as on filesystem servers. Clients interacting
with filesystems through the POSIX compatibility layer
can continue using POSIX open flags; they will be translated
by the RIO layers client-side.

ZX-1359 #comment In Progress

Change-Id: I4972c024547a0daa2146831e49e34d3ef905d4b4


# 4a7a143c 15-Nov-2017 Brian Swetland <swetland@google.com>

[fdio][socket] skeleton for new socket type

Set ENABLE_NEW_SOCKET to true to get the new path
(which as of this change does nothing).

Change-Id: Id358b49d8a8f0b4574128ae7cc9477dfdd92a829


# f2f31ab8 16-Nov-2017 Wez <wez@chromium.org>

Fix handling of FDIO_FLAG_USE_FOR_STDIO

Change-Id: I846283534387872069863149c956498297d4dfce


# e7d169f7 13-Nov-2017 rvargas <rvargas@google.com>

[fs] Implement statfs / fstatfs.

This cl:
- Extends vfs_query_info to return the block size and max filename length.
- Extends minfs and blobstore to return the new values.
- Adds a unix level test for the statfs implementation, with a single minfs volume.
- Adds minfs and blobstore tests for ioctl_vfs_query_fs.

ZX-1319

Change-Id: I9bef3a7257df666e9adecbc7e33c436b3734a555


# c830a868 14-Nov-2017 Sean Klein <smklein@google.com>

Revert "[fs] Use the Fuchsia-defined open flags"

This reverts commit 2aff2cba029cf0f7e98e6d19f6dc7a663c318227.

Reason for revert: Fuchsia uses upstream Rust, which doesn't pull these constants from our C library, but their own. I'll need to wait a few days for us to update upstream Rust before we can make progress here.

Original change's description:
> [fs] Use the Fuchsia-defined open flags
>
> This change uses the Fuchsia-defined flags on the wire
> as well as on filesystem servers. Clients interacting
> with filesystems through the POSIX compatibility layer
> can continue using POSIX open flags; they will be translated
> by the RIO layers client-side.
>
> ZX-1359 #comment In Progress
>
> Change-Id: I27dfdea2024183d5d59daa1ed7d8886d89d503d0

TBR=kulakowski@google.com,smklein@google.com,swetland@google.com,mcgrathr@google.com,planders@google.com

Change-Id: If93c2da36f92ea28ed013a61c01c6ec521da26cc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true


# 2aff2cba 06-Nov-2017 Sean Klein <smklein@google.com>

[fs] Use the Fuchsia-defined open flags

This change uses the Fuchsia-defined flags on the wire
as well as on filesystem servers. Clients interacting
with filesystems through the POSIX compatibility layer
can continue using POSIX open flags; they will be translated
by the RIO layers client-side.

ZX-1359 #comment In Progress

Change-Id: I27dfdea2024183d5d59daa1ed7d8886d89d503d0


# 4d31eaa0 09-Nov-2017 Adam Barth <abarth@google.com>

[fdio] Remove fdio_install_root

This function has no clients and we're close to removing the concept of a root
FDIO handle (in favor of namespaces).

Change-Id: I487890f6ffa4e2e3a3c778ba6a94b4f9d690a5a0


# 3232373b 20-Oct-2017 Sean Klein <smklein@google.com>

[fdio] Allow extraction of CWD handles from process

Change-Id: I22e41fffdeff95d4f2534421c0912d314ef04a90


# e41908e8 19-Oct-2017 Sean Klein <smklein@google.com>

[fdio][launchpad] Open CWD relative to root, using PWD env variable

With fallback path to PWD = "/", if no environment variable
named PWD is provided.

This improves the launchpad API by reducing the risk that a client
could unintentionally provide a CWD handle to a subprocess
which exists outside the subprocess' sandboxed root.

Change-Id: Icc9cfa002d7036e2de2b7775ae10cc04dba13f4d


# 3c637aeb 12-Oct-2017 John Bauman <jbauman@google.com>

[fdio] Add ppoll implementation

This allows for shorter timeouts than poll, and is used by
libvulkan_arm. poll's implementation now calls into ppoll.

Change-Id: I3c2cb46eaabcda0d1a22a607426fd0186ee535f2


# bf87ce2d 17-Oct-2017 Toshi Kikuchi <toshik@google.com>

[fdio] Fix pipe2 sets a wrong errno

fdio_bind_to_fd() returns a posix error in errno.
pipe2 mistakenly treats it returning a zx status.

ZX-1264 #done

Change-Id: I3b84e2c3366398be94ab087706da7897bf7c5996


# 6428433c 15-Oct-2017 Sean Klein <smklein@google.com>

[fdio] Enable lstat on non-readable files

ZX-1151 #comment In Progress

Change-Id: I0119d68530b75466d3220d07d1e6ec2aafaf51f7


# b4b6ce11 15-Sep-2017 Brian Swetland <swetland@google.com>

[fdio] fix name: MAX_FDIO_FD -> FDIO_MAX_FD

Old symbol is provided with deprecation warning for now.

ZX-1131

Change-Id: Iea7afe2e76325c5597d98da92f5ae337c23b5038


# e0fbf267 12-Sep-2017 George Kulakowski <kulakowski@google.com>

[zx] Rename bug references from MG-nnn to ZX-nnn

Change-Id: I07b0ee32bd7e8cc08e344896352c156b3b420349


# f3e2126c 12-Sep-2017 Roland McGrath <mcgrathr@google.com>

[zx] Magenta -> Zircon

The Great Renaming is here!

Change-Id: I3229bdeb2a3d0e40fb4db6fec8ca7d971fbffb94