We need to flush and shutdown logging before exiting,
so we can't use _exit/_Exit directly.
In addition, with profiling (e.g. code-coverage) we
must flush the profile data, lest it's all for naught.
Change-Id: I726c5a2f4e699c17dd0d7d5b1c86d856e0118b3c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Count data sent as well as received, re-factor, and measure B/W
usage too.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I5d00f0568c774cc03d2b8e4f730bfe4a8fb5b06f
In an attempt to reduce the size of Util.{c,h}pp
which has grown to contain all sorts of unrelated
helpers, we move StringVector helpers into
the StringVector.{c,h}pp files.
This makes the code better organized.
Change-Id: I152f341606807ae66253415b951bc9f89b09df57
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Use it to create /dev/{u}random devices instead of calling mknod().
Signed-off-by: Gleb Popov <6yearold@gmail.com>
Change-Id: I6ae7842c89255f3f43a8ac7f082a275d5496690a
'sscanf' may overflow; destination buffer in 'smap_key' has size 20, but
the corresponding specifier in tools/map.cpp:570 may require size 21.
Change-Id: Ie7356db924193777869a39b882512a864c0e10c5
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
- new method for migrating "host" entries:
only done if there are new entries in the old config,
and then replace the list in the new config with the old one
- other small changes, eg.
don't migrate special default values if they match target value
Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: Idf43db4068c163077109825486855a259666181c
The vector is allocated on the stack in a for loop, so it's not valid to
refer to its address in the lambda that is executed on a thread. Rather
copy it.
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ie1f85d6efb27a4aa44b181f8d9f134e9fa41d508
On FreeBSD the mounting operations are allowed to be performed only by root
by default. When `loolwsd --cleanup` is called during normal compilation process,
it tries to unmount "jails" directory and spits EPERM-related errors.
Fix this by checking if the directory being unmounted is actually mounted and
return EINVAL in this case, just like Linux unmount2() does.
Signed-off-by: Gleb Popov <6yearold@gmail.com>
Change-Id: I0f72d265e33fb1e6129332bfa8e17e7d888d30b5
SteamSocket::eraseFirstInputBytes() removes from the beginning
of std::vector, which is generally slow. If the buffer becomes
too big, which it may under a load, then the function will get
slow, which in turn will likely lead to the buffer getting even
bigger because of accumulated backlog.
The Buffer class is optimized for removal at the beginning,
so use it instead of std::vector, including some API additions
for it to be an in-place replacement where it's used.
Signed-off-by: Luboš Luňák <l.lunak@collabora.com>
Change-Id: I4cf7ec56c908c7d3df391dc3f8e230ad32abb162
test/test.cpp and wsd/Storage.cpp has the same pattern.
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ic1dfbd3a5368eb9831bde9d77ea1bb813834d42b
There is one EndSession record for each session that edited the same
document. That is not an error.
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I9042411ad465fe07a8f88a29923f0dc051c755aa
Signed-off-by: Tor Lillqvist <tml@collabora.com>
I otherwise get values like this:
epochFile=18682409
deltaCurrent=34
rec.getTimestampNs()=18682409
deltaFile=0
delay=4294967262
Leading to the idiotic:
Sleeping for 4294967 ms
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I06530c31bc70bb7dcf3cd34c4684aa9f1f8036cb
Move the generic dummy implementation of
TraceEvent::emitOneRecording() to a source file of its own. (That is
the one which is used in test and tool executables.)
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I81cab07e5a6852b42d278a5446c13c3825cf546e
Modelled on how it is done in core. ProfileZone is derived from
NamedEvent which is derived from TraceEvent. Here we don't keep any
separate ProfileZone.hpp, though.
This was needed to introduce generation of "instant" events here, too.
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I6583134e96001641c50339deb4197fca6ab7d5d5
Don't bother collecting them into a vector, like in core. Instead,
just call a static member function ProfileZone::addOneRecording() for
each Event Trace object (string) to be emitted. That function then
needs to be implemented separately in each executable. In WSD it logs
the object to the Event Trace file. In Kit it sends it to WSD for
logging. In Unit tests we use a dummy implementation.
(If Event Trace logging is not enabled at all in loolwsd.xml (the
default), nothing is done, of course.)
When receiving the "traceeventrecording start" or "traceeventrecording
stop" message from the client, turn ProfileZone recoring on or off in
the WSD and Kit process. (Probably in WSD the flag should be
per-client.)
Change-Id: Ie1127d65dd44ed77e7eeab4b0f0a90cce95dc4a2
Signed-off-by: Tor Lillqvist <tml@collabora.com>