Skip to content

Commit 864d7cf

Browse files
committed
smp: Fix unused warnings when building single threaded
1 parent a10556e commit 864d7cf

5 files changed

Lines changed: 26 additions & 8 deletions

File tree

api/net/buffer_store.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ namespace net
8282
std::vector<buffer_t> available_;
8383
int cpu;
8484
static bool smp_enabled_;
85+
#ifndef INCLUDEOS_SINGLE_THREADED
8586
// has strict alignment reqs, so put at end
8687
spinlock_t plock;
87-
88+
#endif
8889
BufferStore(BufferStore&) = delete;
8990
BufferStore(BufferStore&&) = delete;
9091
BufferStore& operator=(BufferStore&) = delete;

src/arch/x86/smp.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ void ::SMP::unicast(int cpu, uint8_t irq)
171171
}
172172

173173
static spinlock_t __global_lock = 0;
174-
static spinlock_t __memory_lock = 0;
175174

176175
void ::SMP::global_lock() noexcept
177176
{
@@ -184,6 +183,8 @@ void ::SMP::global_unlock() noexcept
184183

185184
/// SMP variants of malloc and free ///
186185
#ifndef INCLUDEOS_SINGLE_THREADED
186+
static spinlock_t __memory_lock = 0;
187+
187188
#include <malloc.h>
188189
void* malloc(size_t size)
189190
{

src/kernel/elf.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ class ElfTables
168168
int status;
169169
// internally, demangle just returns buf when status is ok
170170
auto* res = __cxa_demangle(name, (char*) buffer, &buflen, &status);
171-
if (status) return name;
172-
return res;
171+
if (status == 0) return res;
172+
return name;
173173
}
174174

175175
SymTab symtab;
@@ -215,8 +215,8 @@ bool Elf::verify_symbols()
215215

216216
void print_backtrace()
217217
{
218-
char _symbol_buffer[4096];
219-
char _btrace_buffer[4096];
218+
char _symbol_buffer[8192];
219+
char _btrace_buffer[8192];
220220

221221
if (Elf::get_strtab() == NULL) {
222222
int len = snprintf(_btrace_buffer, sizeof(_btrace_buffer),

src/net/buffer_store.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ namespace net {
6666

6767
BufferStore::buffer_t BufferStore::get_buffer()
6868
{
69-
bool is_locked = false;
7069
#ifndef INCLUDEOS_SINGLE_THREADED
70+
bool is_locked = false;
7171
if (smp_enabled_) {
7272
lock(plock);
7373
is_locked = true;

src/net/inet4.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
//-*- C++ -*-
1+
// This file is a part of the IncludeOS unikernel - www.includeos.org
2+
//
3+
// Copyright 2015 Oslo and Akershus University College of Applied Sciences
4+
// and Alfred Bratterud
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
218
#include <net/inet4.hpp>
319
#include <net/dhcp/dh4client.hpp>
420
#include <smp>

0 commit comments

Comments
 (0)