summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fastos/src/tests/CMakeLists.txt7
-rw-r--r--fastos/src/tests/backtracetest.cpp179
-rw-r--r--fastos/src/vespa/fastos/CMakeLists.txt1
-rw-r--r--fastos/src/vespa/fastos/backtrace.c84
-rw-r--r--fastos/src/vespa/fastos/backtrace.h17
-rw-r--r--fastos/src/vespa/fastos/file.h20
-rw-r--r--fastos/src/vespa/fastos/linux_file.cpp14
-rw-r--r--fastos/src/vespa/fastos/linux_file.h6
-rw-r--r--fastos/src/vespa/fastos/unix_file.cpp65
-rw-r--r--fastos/src/vespa/fastos/unix_file.h3
-rw-r--r--vespalib/src/vespa/vespalib/util/backtrace.cpp10
11 files changed, 50 insertions, 356 deletions
diff --git a/fastos/src/tests/CMakeLists.txt b/fastos/src/tests/CMakeLists.txt
index 54341ff8e9a..3bf68a88e79 100644
--- a/fastos/src/tests/CMakeLists.txt
+++ b/fastos/src/tests/CMakeLists.txt
@@ -27,13 +27,6 @@ vespa_add_executable(fastos_threadtest_app TEST
fastos
)
vespa_add_test(NAME fastos_threadtest_app NO_VALGRIND COMMAND fastos_threadtest_app)
-vespa_add_executable(fastos_backtracetest_app TEST
- SOURCES
- backtracetest.cpp
- DEPENDS
- fastos
-)
-vespa_add_test(NAME fastos_backtracetest_app NO_VALGRIND COMMAND fastos_backtracetest_app)
vespa_add_executable(fastos_typetest_app TEST
SOURCES
typetest.cpp
diff --git a/fastos/src/tests/backtracetest.cpp b/fastos/src/tests/backtracetest.cpp
deleted file mode 100644
index 43aa264ea2c..00000000000
--- a/fastos/src/tests/backtracetest.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include <vespa/fastos/backtrace.h>
-#include <cassert>
-#include <string.h>
-
-#include "tests.h"
-
-#ifndef noinline__
-#ifdef __GNUC__
-#define noinline__ __attribute__((noinline))
-#endif
-#ifndef noinline__
-#define noinline__
-#endif
-#endif
-
-#if (defined(__x86_64__) || defined(__aarch64__)) && defined(__linux__)
-class Tracker
-{
-private:
- int _found;
- int _level;
- void dotrace() {
- _found = FastOS_backtrace(_codepoints, _level);
- }
- void deepFill();
-
-protected:
- virtual void deepFill20() noinline__;
- virtual void deepFill19() noinline__;
- virtual void deepFill18() noinline__;
- virtual void deepFill17() noinline__;
- virtual void deepFill16() noinline__;
- virtual void deepFill15() noinline__;
- virtual void deepFill14() noinline__;
- virtual void deepFill13() noinline__;
- virtual void deepFill12() noinline__;
- virtual void deepFill11() noinline__;
- virtual void deepFill10() noinline__;
- virtual void deepFill9() noinline__;
- virtual void deepFill8() noinline__;
- virtual void deepFill7() noinline__;
- virtual void deepFill6() noinline__;
- virtual void deepFill5() noinline__;
- virtual void deepFill4() noinline__;
- virtual void deepFill3() noinline__;
- virtual void deepFill2() noinline__;
- virtual void deepFill1() noinline__;
-
- virtual void deepFill0();
-
-public:
- void *_codepoints[25];
- Tracker() : _found(0), _level(25) {}
- virtual ~Tracker() { }
- void doTest(int levels) {
- for (int j=0; j<25; j++) {
- _codepoints[j] = (void *)0;
- }
- _level = levels;
- deepFill();
- printf("found levels: %d\n", _found);
- for (int i=0; i<levels; i++) {
- printf("level %2d -> %p\n", i, _codepoints[i]);
- if (_codepoints[i] == 0) break;
- }
- }
- int found() { return _found; }
-};
-
-class Tracker2: public Tracker
-{
-protected:
- void deepFill20() override noinline__;
- void deepFill18() override noinline__;
- void deepFill16() override noinline__;
- void deepFill14() override noinline__;
- void deepFill12() override noinline__;
- void deepFill10() override noinline__;
- void deepFill8() override noinline__;
- void deepFill6() override noinline__;
- void deepFill4() override noinline__;
- void deepFill2() override noinline__;
-};
-
-
-class BackTraceTest : public BaseTest
-{
-
-public:
- void TestBackTrace ()
- {
- bool rc = true;
-
- TestHeader("backtrace test");
-
- Tracker2 t;
-
- t.doTest(25);
- Progress(rc, "minimal functionality");
- t.doTest(25);
- rc = (t._codepoints[10] != 0);
- Progress(rc, "many levels");
- rc = (t.found() > 10);
- Progress(rc, "many levels retval");
- t.doTest(8);
- rc = (t.found() == 8);
- Progress(rc, "few levels retval");
- rc = (t._codepoints[8] == 0);
- Progress(rc, "few levels");
-
- PrintSeparator();
- }
-
- int Main () override
- {
- TestBackTrace();
- return allWasOk() ? 0 : 1;
- }
-};
-
-
-int main (int argc, char **argv)
-{
- BackTraceTest app;
-
- setvbuf(stdout, nullptr, _IOLBF, 8192);
- return app.Entry(argc, argv);
-}
-
-
-void Tracker2::deepFill20() { printf("a"); deepFill19(); printf("a"); }
-void Tracker2::deepFill18() { printf("c"); deepFill17(); printf("c"); }
-void Tracker2::deepFill16() { printf("e"); deepFill15(); printf("e"); }
-void Tracker2::deepFill14() { printf("g"); deepFill13(); printf("g"); }
-void Tracker2::deepFill12() { printf("i"); deepFill11(); printf("i"); }
-void Tracker2::deepFill10() { printf("k"); deepFill9(); printf("k"); }
-void Tracker2::deepFill8() { printf("m"); deepFill7(); printf("m"); }
-void Tracker2::deepFill6() { printf("o"); deepFill5(); printf("o"); }
-void Tracker2::deepFill4() { printf("q"); deepFill3(); printf("q"); }
-void Tracker2::deepFill2() { printf("s"); deepFill1(); printf("s"); }
-
-
-void Tracker::deepFill() { deepFill20(); printf("\n"); }
-
-void Tracker::deepFill20() { printf("a"); deepFill19(); }
-void Tracker::deepFill19() { printf("b"); deepFill18(); }
-void Tracker::deepFill18() { printf("c"); deepFill17(); }
-void Tracker::deepFill17() { printf("d"); deepFill16(); }
-void Tracker::deepFill16() { printf("e"); deepFill15(); }
-void Tracker::deepFill15() { printf("f"); deepFill14(); }
-void Tracker::deepFill14() { printf("g"); deepFill13(); }
-void Tracker::deepFill13() { printf("h"); deepFill12(); }
-void Tracker::deepFill12() { printf("i"); deepFill11(); }
-void Tracker::deepFill11() { printf("j"); deepFill10(); }
-void Tracker::deepFill10() { printf("k"); deepFill9(); }
-void Tracker::deepFill9() { printf("l"); deepFill8(); }
-void Tracker::deepFill8() { printf("m"); deepFill7(); }
-void Tracker::deepFill7() { printf("n"); deepFill6(); }
-void Tracker::deepFill6() { printf("o"); deepFill5(); }
-void Tracker::deepFill5() { printf("p"); deepFill4(); }
-void Tracker::deepFill4() { printf("q"); deepFill3(); }
-void Tracker::deepFill3() { printf("r"); deepFill2(); }
-void Tracker::deepFill2() { printf("s"); deepFill1(); }
-void Tracker::deepFill1() { printf("t"); deepFill0(); }
-
-void Tracker::deepFill0() { dotrace(); }
-
-#else
-int
-main(int argc, char **argv)
-{
- (void)argc;
- (void)argv;
- printf("No backtrace support, skipping tests...\n");
- return 0;
-}
-#endif
diff --git a/fastos/src/vespa/fastos/CMakeLists.txt b/fastos/src/vespa/fastos/CMakeLists.txt
index e4274261951..0e2bb51f79e 100644
--- a/fastos/src/vespa/fastos/CMakeLists.txt
+++ b/fastos/src/vespa/fastos/CMakeLists.txt
@@ -1,7 +1,6 @@
# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
vespa_add_library(fastos_objects OBJECT
SOURCES
- backtrace.c
file.cpp
file_rw_ops.cpp
linux_file.cpp
diff --git a/fastos/src/vespa/fastos/backtrace.c b/fastos/src/vespa/fastos/backtrace.c
deleted file mode 100644
index 786fdea8f01..00000000000
--- a/fastos/src/vespa/fastos/backtrace.c
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include "backtrace.h"
-
-#if defined(__i386__) || defined(__clang__) || defined(__aarch64__)
-// use GLIBC version, hope it works
-extern int backtrace(void **buffer, int size);
-#define HAVE_BACKTRACE
-#endif
-
-#if defined(__x86_64__) && !defined(__clang__)
-
-/**
- Written by Arne H. J. based on docs:
-
- http://www.kernel.org/pub/linux/devel/gcc/unwind/
- http://www.codesourcery.com/public/cxx-abi/abi-eh.html
- http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/libgcc-s-ddefs.html
-**/
-
-#include <unwind.h>
-
-struct trace_context {
- void **array;
- int size;
- int index;
-};
-
-static _Unwind_Reason_Code
-trace_fn(struct _Unwind_Context *ctxt, void *arg)
-{
- struct trace_context *tp = (struct trace_context *)arg;
- void *ip = (void *)_Unwind_GetIP(ctxt);
-
- if (ip == 0) {
- return _URC_END_OF_STACK;
- }
- if (tp->index <= tp->size) {
- // there's no point filling in the address of the backtrace()
- // function itself, that doesn't provide any extra information,
- // so skip one level
- if (tp->index > 0) {
- tp->array[tp->index - 1] = ip;
- }
- tp->index++;
- } else {
- return _URC_NORMAL_STOP;
- }
- return _URC_NO_REASON; // "This is not the destination frame" -> try next frame
-}
-
-#define HAVE_BACKTRACE
-int
-backtrace (void **array, int size)
-{
- struct trace_context t;
- t.array = array;
- t.size = size;
- t.index = 0;
- _Unwind_Backtrace(trace_fn, &t);
- return t.index - 1;
-}
-#endif // x86_64
-
-
-#ifdef HAVE_BACKTRACE
-
-int
-FastOS_backtrace (void **array, int size)
-{
- return backtrace(array, size);
-}
-
-#else
-
-# warning "backtrace not supported on this CPU"
-int
-FastOS_backtrace (void **array, int size)
-{
- (void) array;
- (void) size;
- return 0;
-}
-
-#endif
diff --git a/fastos/src/vespa/fastos/backtrace.h b/fastos/src/vespa/fastos/backtrace.h
deleted file mode 100644
index 3bd18111b5d..00000000000
--- a/fastos/src/vespa/fastos/backtrace.h
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int FastOS_backtrace (void **array, int size);
-
-#if defined(__x86_64__)
-int backtrace (void **array, int size);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
diff --git a/fastos/src/vespa/fastos/file.h b/fastos/src/vespa/fastos/file.h
index 9821cc138c5..1cf6fee71dd 100644
--- a/fastos/src/vespa/fastos/file.h
+++ b/fastos/src/vespa/fastos/file.h
@@ -14,16 +14,16 @@
#include <cstdint>
#include <string>
-const int FASTOS_FILE_OPEN_READ = (1<<0);
-const int FASTOS_FILE_OPEN_WRITE = (1<<1);
-const int FASTOS_FILE_OPEN_EXISTING = (1<<2);
-const int FASTOS_FILE_OPEN_CREATE = (1<<3);
-const int FASTOS_FILE_OPEN_TRUNCATE = (1<<4);
-const int FASTOS_FILE_OPEN_STDOUT = (2<<5);
-const int FASTOS_FILE_OPEN_STDERR = (3<<5);
-const int FASTOS_FILE_OPEN_STDFLAGS = (3<<5);
-const int FASTOS_FILE_OPEN_DIRECTIO = (1<<7);
-const int FASTOS_FILE_OPEN_SYNCWRITES = (1<<9); // synchronous writes
+constexpr int FASTOS_FILE_OPEN_READ = (1<<0);
+constexpr int FASTOS_FILE_OPEN_WRITE = (1<<1);
+constexpr int FASTOS_FILE_OPEN_EXISTING = (1<<2);
+constexpr int FASTOS_FILE_OPEN_CREATE = (1<<3);
+constexpr int FASTOS_FILE_OPEN_TRUNCATE = (1<<4);
+constexpr int FASTOS_FILE_OPEN_STDOUT = (2<<5);
+constexpr int FASTOS_FILE_OPEN_STDERR = (3<<5);
+constexpr int FASTOS_FILE_OPEN_STDFLAGS = (3<<5);
+constexpr int FASTOS_FILE_OPEN_DIRECTIO = (1<<7);
+constexpr int FASTOS_FILE_OPEN_SYNCWRITES = (1<<9); // synchronous writes
/**
* This class contains regular file-access functionality.
diff --git a/fastos/src/vespa/fastos/linux_file.cpp b/fastos/src/vespa/fastos/linux_file.cpp
index 6b58006eb62..6fb29782957 100644
--- a/fastos/src/vespa/fastos/linux_file.cpp
+++ b/fastos/src/vespa/fastos/linux_file.cpp
@@ -36,8 +36,8 @@ FastOS_Linux_File::~FastOS_Linux_File () {
}
#define DIRECTIOPOSSIBLE(buf, len, off) \
- ((off & (_directIOFileAlign - 1)) == 0 && \
- (len & (_directIOFileAlign - 1)) == 0 && \
+ (((off) & (_directIOFileAlign - 1)) == 0 && \
+ ((len) & (_directIOFileAlign - 1)) == 0 && \
(reinterpret_cast<unsigned long>(buf) & (_directIOMemAlign - 1)) == 0)
ssize_t
@@ -135,8 +135,7 @@ FastOS_Linux_File::ReadBufInternal(void *buffer, size_t length, int64_t readOffs
} else {
readResult = 0;
}
- if (static_cast<size_t>(readResult) == alignedLength &&
- remain != 0) {
+ if (static_cast<size_t>(readResult) == alignedLength && (remain != 0)) {
ssize_t readResult2 = readUnalignedEnd(static_cast<char *>(buffer) + alignedLength,
remain, readOffset + alignedLength);
if (readResult == 0) {
@@ -434,11 +433,4 @@ FastOS_Linux_File::count_open_files()
return count;
}
-#include <vespa/fastos/backtrace.h>
-
-void forceStaticLinkOf_backtrace()
-{
- void * dummy[2];
- FastOS_backtrace(dummy, 2);
-}
#endif
diff --git a/fastos/src/vespa/fastos/linux_file.h b/fastos/src/vespa/fastos/linux_file.h
index 567af9e8ab0..2481b163210 100644
--- a/fastos/src/vespa/fastos/linux_file.h
+++ b/fastos/src/vespa/fastos/linux_file.h
@@ -25,7 +25,7 @@ protected:
public:
FastOS_Linux_File (const char *filename = nullptr);
- ~FastOS_Linux_File ();
+ ~FastOS_Linux_File () override;
bool GetDirectIORestrictions(size_t &memoryAlignment, size_t &transferGranularity, size_t &transferMaximum) override;
bool DirectIOPadding(int64_t offset, size_t length, size_t &padBefore, size_t &padAfter) override;
void EnableDirectIO() override;
@@ -49,8 +49,8 @@ private:
ssize_t ReadBufInternal(void *buffer, size_t length, int64_t readOffset);
ssize_t readInternal(int fh, void *buffer, size_t length, int64_t readOffset);
ssize_t readInternal(int fh, void *buffer, size_t length);
- ssize_t writeInternal(int fh, const void *buffer, size_t length, int64_t writeOffset);
- ssize_t writeInternal(int fh, const void *buffer, size_t length);
+ static ssize_t writeInternal(int fh, const void *buffer, size_t length, int64_t writeOffset);
+ static ssize_t writeInternal(int fh, const void *buffer, size_t length);
static const size_t _directIOFileAlign;
static const size_t _directIOMemAlign;
diff --git a/fastos/src/vespa/fastos/unix_file.cpp b/fastos/src/vespa/fastos/unix_file.cpp
index 71a9f6e6faa..7c4cde19125 100644
--- a/fastos/src/vespa/fastos/unix_file.cpp
+++ b/fastos/src/vespa/fastos/unix_file.cpp
@@ -29,6 +29,10 @@
using fastos::File_RW_Ops;
+int FastOS_UNIX_File::GetLastOSError() {
+ return errno;
+}
+
ssize_t
FastOS_UNIX_File::Read(void *buffer, size_t len)
{
@@ -52,7 +56,7 @@ FastOS_UNIX_File::SetPosition(int64_t desiredPosition)
int64_t
-FastOS_UNIX_File::GetPosition(void)
+FastOS_UNIX_File::GetPosition()
{
return lseek(_filedes, 0, SEEK_CUR);
}
@@ -79,7 +83,7 @@ FastOS_UNIX_File::Stat(const char *filename, FastOS_StatInfo *statInfo)
{
bool rc = false;
- struct stat stbuf;
+ struct stat stbuf{};
int lstatres;
do {
@@ -129,7 +133,7 @@ int FastOS_UNIX_File::GetMaximumPathLength(const char *pathName)
}
std::string
-FastOS_UNIX_File::getCurrentDirectory(void)
+FastOS_UNIX_File::getCurrentDirectory()
{
std::string res;
int maxPathLen = FastOS_File::GetMaximumPathLength(".");
@@ -222,7 +226,6 @@ FastOS_UNIX_File::Open(unsigned int openFlags, const char *filename)
break;
default:
- file = nullptr;
fprintf(stderr, "Invalid open-flags %08X\n", openFlags);
abort();
}
@@ -248,7 +251,7 @@ FastOS_UNIX_File::Open(unsigned int openFlags, const char *filename)
_openFlags = openFlags;
if (_mmapEnabled) {
int64_t filesize = GetSize();
- size_t mlen = static_cast<size_t>(filesize);
+ auto mlen = static_cast<size_t>(filesize);
if ((static_cast<int64_t>(mlen) == filesize) && (mlen > 0)) {
void *mbase = mmap(nullptr, mlen, PROT_READ, MAP_SHARED | _mmapFlags, _filedes, 0);
if (mbase == MAP_FAILED) {
@@ -295,7 +298,7 @@ void FastOS_UNIX_File::dropFromCache() const
bool
-FastOS_UNIX_File::Close(void)
+FastOS_UNIX_File::Close()
{
bool ok = true;
@@ -325,10 +328,10 @@ FastOS_UNIX_File::Close(void)
int64_t
-FastOS_UNIX_File::GetSize(void)
+FastOS_UNIX_File::GetSize()
{
int64_t fileSize=-1;
- struct stat stbuf;
+ struct stat stbuf{};
assert(IsOpened());
@@ -343,14 +346,12 @@ FastOS_UNIX_File::GetSize(void)
time_t
-FastOS_UNIX_File::GetModificationTime(void)
+FastOS_UNIX_File::GetModificationTime()
{
- struct stat stbuf;
- int res;
-
+ struct stat stbuf{};
assert(IsOpened());
- res = fstat(_filedes, &stbuf);
+ int res = fstat(_filedes, &stbuf);
assert(res == 0);
(void) res;
@@ -366,7 +367,7 @@ FastOS_UNIX_File::Delete(const char *name)
bool
-FastOS_UNIX_File::Delete(void)
+FastOS_UNIX_File::Delete()
{
assert( ! IsOpened());
@@ -379,7 +380,7 @@ bool FastOS_UNIX_File::Rename (const char *currentFileName, const char *newFileN
// Enforce documentation. If the destination file exists,
// fail Rename.
- FastOS_StatInfo statInfo;
+ FastOS_StatInfo statInfo{};
if (!FastOS_File::Stat(newFileName, &statInfo)) {
rc = (rename(currentFileName, newFileName) == 0);
} else {
@@ -427,6 +428,7 @@ FastOS_UNIX_File::TranslateError (const int osError)
case EPERM: return ERR_PERM; // Not owner
case ENODEV: return ERR_NODEV; // No such device
case ENXIO: return ERR_NXIO; // Device not configured
+ default: break;
}
if (osError == ENFILE)
@@ -449,16 +451,13 @@ FastOS_UNIX_File::getErrorString(const int osError)
int64_t FastOS_UNIX_File::GetFreeDiskSpace (const char *path)
{
- int64_t freeSpace = -1;
-
- struct statfs statBuf;
- int statVal = -1;
- statVal = statfs(path, &statBuf);
+ struct statfs statBuf{};
+ int statVal = statfs(path, &statBuf);
if (statVal == 0) {
- freeSpace = int64_t(statBuf.f_bavail) * int64_t(statBuf.f_bsize);
+ return int64_t(statBuf.f_bavail) * int64_t(statBuf.f_bsize);
}
- return freeSpace;
+ return -1;
}
int
@@ -507,7 +506,7 @@ FastOS_UNIX_DirectoryScan::FastOS_UNIX_DirectoryScan(const char *searchPath)
}
-FastOS_UNIX_DirectoryScan::~FastOS_UNIX_DirectoryScan(void)
+FastOS_UNIX_DirectoryScan::~FastOS_UNIX_DirectoryScan()
{
if (_dir != nullptr) {
closedir(_dir);
@@ -518,25 +517,23 @@ FastOS_UNIX_DirectoryScan::~FastOS_UNIX_DirectoryScan(void)
bool
-FastOS_UNIX_DirectoryScan::ReadNext(void)
+FastOS_UNIX_DirectoryScan::ReadNext()
{
- bool rc = false;
-
_statRun = false;
if (_dir != nullptr) {
_dp = readdir(_dir);
- rc = _dp != nullptr;
+ return (_dp != nullptr);
}
- return rc;
+ return false;
}
void
-FastOS_UNIX_DirectoryScan::DoStat(void)
+FastOS_UNIX_DirectoryScan::DoStat()
{
- struct stat stbuf;
+ struct stat stbuf{};
assert(_dp != nullptr);
@@ -556,7 +553,7 @@ FastOS_UNIX_DirectoryScan::DoStat(void)
bool
-FastOS_UNIX_DirectoryScan::IsDirectory(void)
+FastOS_UNIX_DirectoryScan::IsDirectory()
{
if (!_statRun) {
DoStat();
@@ -567,7 +564,7 @@ FastOS_UNIX_DirectoryScan::IsDirectory(void)
bool
-FastOS_UNIX_DirectoryScan::IsRegular(void)
+FastOS_UNIX_DirectoryScan::IsRegular()
{
if (!_statRun) {
DoStat();
@@ -578,7 +575,7 @@ FastOS_UNIX_DirectoryScan::IsRegular(void)
const char *
-FastOS_UNIX_DirectoryScan::GetName(void)
+FastOS_UNIX_DirectoryScan::GetName()
{
assert(_dp != nullptr);
@@ -587,7 +584,7 @@ FastOS_UNIX_DirectoryScan::GetName(void)
bool
-FastOS_UNIX_DirectoryScan::IsValidScan(void) const
+FastOS_UNIX_DirectoryScan::IsValidScan() const
{
return _dir != nullptr;
}
diff --git a/fastos/src/vespa/fastos/unix_file.h b/fastos/src/vespa/fastos/unix_file.h
index 368d3c5aca5..31e45f8d2fa 100644
--- a/fastos/src/vespa/fastos/unix_file.h
+++ b/fastos/src/vespa/fastos/unix_file.h
@@ -10,7 +10,6 @@
#pragma once
#include <vespa/fastos/file.h>
-#include <cerrno>
/**
* This is the generic UNIX implementation of @ref FastOS_FileInterface.
@@ -90,7 +89,7 @@ public:
void dropFromCache() const override;
static bool Delete(const char *filename);
- static int GetLastOSError() { return errno; }
+ static int GetLastOSError();
static Error TranslateError(const int osError);
static std::string getErrorString(const int osError);
static int64_t GetFreeDiskSpace (const char *path);
diff --git a/vespalib/src/vespa/vespalib/util/backtrace.cpp b/vespalib/src/vespa/vespalib/util/backtrace.cpp
index a020f6c33c0..79f64ef9ef1 100644
--- a/vespalib/src/vespa/vespalib/util/backtrace.cpp
+++ b/vespalib/src/vespa/vespalib/util/backtrace.cpp
@@ -1,11 +1,9 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/util/backtrace.h>
-#include <vespa/vespalib/util/memory.h>
#include <vespa/vespalib/util/classname.h>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/stllike/asciistream.h>
-#include <vespa/fastos/backtrace.h>
#include <execinfo.h>
#include <csignal>
@@ -49,7 +47,7 @@ demangleBacktraceLine(const vespalib::string& line)
int
vespalib::getStackTraceFrames(void** framesOut, int maxFrames) {
- return FastOS_backtrace(framesOut, maxFrames);
+ return backtrace(framesOut, maxFrames);
}
vespalib::string
@@ -69,12 +67,8 @@ vespalib::getStackTrace(int ignoreTop, void* const* stack, int size)
vespalib::string
vespalib::getStackTrace(int ignoreTop) {
-#ifdef __i386__
- ignoreTop += 2;
-#else
ignoreTop += 1;
-#endif
void* stack[25];
- int size = FastOS_backtrace(stack, 25);
+ int size = backtrace(stack, 25);
return getStackTrace(ignoreTop, stack, size);
}