genode/repos/os/src/server/trace_fs
Christian Prochaska b0935ef9b2 VFS: nonblocking interface
The VFS library can be used in single-threaded or multi-threaded
environments and depending on that, signals are handled by the same thread
which uses the VFS library or possibly by a different thread. If a VFS
plugin needs to block to wait for a signal, there is currently no way
which works reliably in both environments.

For this reason, this commit makes the interface of the VFS library
nonblocking, similar to the File_system session interface.

The most important changes are:

- Directories are created and opened with the 'opendir()' function and the
  directory entries are read with the recently introduced 'queue_read()'
  and 'complete_read()' functions.

- Symbolic links are created and opened with the 'openlink()' function and
  the link target is read with the 'queue_read()' and 'complete_read()'
  functions and written with the 'write()' function.

- The 'write()' function does not wait for signals anymore. This can have
  the effect that data written by a VFS library user has not been
  processed by a file system server yet when the library user asks for the
  size of the file or closes it (both done with RPC functions at the file
  system server). For this reason, a user of the VFS library should
  request synchronization before calling 'stat()' or 'close()'. To make
  sure that a file system server has processed all write request packets
  which a client submitted before the synchronization request,
  synchronization is now requested at the file system server with a
  synchronization packet instead of an RPC function. Because of this
  change, the synchronization interface of the VFS library is now split
  into 'queue_sync()' and 'complete_sync()' functions.

Fixes #2399
2017-08-28 16:49:38 +02:00
..
buffer.h Adjust file headers to refer to the AGPLv3 2017-02-28 12:59:29 +01:00
chunk.h Adjust file headers to refer to the AGPLv3 2017-02-28 12:59:29 +01:00
directory.h file system: use Id_space instead of Node_handle_registry 2017-08-17 10:59:43 +02:00
file.h file system: use Id_space instead of Node_handle_registry 2017-08-17 10:59:43 +02:00
followed_subject.h file system: use Id_space instead of Node_handle_registry 2017-08-17 10:59:43 +02:00
main.cc VFS: nonblocking interface 2017-08-28 16:49:38 +02:00
node.h file system: use Id_space instead of Node_handle_registry 2017-08-17 10:59:43 +02:00
README Make label prefixing more strict 2016-11-30 13:37:07 +01:00
symlink.h file system: use Id_space instead of Node_handle_registry 2017-08-17 10:59:43 +02:00
target.mk os: removal of deprecated os/config.h (fix #2431) 2017-05-31 13:16:22 +02:00
trace_files.h file system: use Id_space instead of Node_handle_registry 2017-08-17 10:59:43 +02:00

The new _trace_fs_ server provides access to a trace session by providing a
file-system session as front end. Combined with Noux, it allows for the
interactive exploration and tracing of Genode's process tree using
traditional Unix tools.

Each trace subject is represented by a directory ('thread_name.subject') that
contains specific files, which are used to control the tracing process of the
thread as well as storing the content of its trace buffer:

:'enable': The tracing of a thread is activated if there is a valid policy
  installed and the intend to trace the subject was made clear by writing '1'
  to the 'enable' file. The tracing of a thread may be deactivated by writing a
  '0' to this file.

:'policy': A policy may be changed by overwriting the currently used one in the
  'policy' file. In this case, the old policy is replaced by the new one and
  automatically used by the framework.

:'buffer_size': Writing a value to the 'buffer_size' file changes the size of
  the trace buffer. This value is evaluated only when reactivating the tracing
  of the thread.

:'events': The trace-buffer contents may be accessed by reading from the
  'events' file. New trace events are appended to this file.

:'active': Reading the file will return whether the tracing is active (1) or
  not (0).

:'cleanup': Nodes of untraced subjects are kept as long as they do not change
  their tracing state to dead. Dead untraced nodes are automatically removed
  from the file system. Subjects that were traced before and are now untraced
  can be removed by writing '1' to the 'cleanup' file.

To use the trace_fs, a configuration similar to the following may be used:

! <start name="trace_fs">
!   <resource name="RAM" quantum="128M"/>
!   <provides><service name="File_system"/></provides>
!   <config>
!           <policy label_prefix="noux -> trace"
!                   interval="1000"
!                   subject_limit="512"
!                   trace_quota="64M" />
!   </config>
! </start>

:'interval': sets the period the Trace_session is polled. The
  time is given in milliseconds.

:'subject_limit': specifies how many trace subjects should by acquired at
  max when the Trace_session is polled.

:'trace_quota': is the amount of quota the trace_fs should use for the
  Trace_session connection. The remaining amount of RAM quota will be used
  for the actual nodes of the file system and the 'policy' as well as the
  'events' files.

In addition, there are 'buffer_size' and 'buffer_size_limit' that define
the initial and the upper limit of the size of a trace buffer.

A ready-to-use run script can by found in 'ports/run/noux_trace_fs.run'.