Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions libc/src/sched/linux/sched_getcpuisset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

#include "src/sched/sched_getcpuisset.h"

#include "src/__support/common.h" // LLVM_LIBC_FUNCTION
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
#include "src/__support/common.h" // LLVM_LIBC_FUNCTION
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Update the cmake dependency of these targets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done! 9b0d165e

#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
#include "src/__support/macros/null_check.h" // LIBC_CRASH_ON_NULLPTR

#include "hdr/sched_macros.h" // NCPUBITS
#include "hdr/types/cpu_set_t.h"
Expand All @@ -19,6 +20,8 @@ namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, __sched_getcpuisset,
(int cpu, const size_t cpuset_size, cpu_set_t *set)) {
LIBC_CRASH_ON_NULLPTR(set);

if (static_cast<size_t>(cpu) / 8 < cpuset_size) {
const size_t element_index = static_cast<size_t>(cpu) / NCPUBITS;
const size_t bit_position = static_cast<size_t>(cpu) % NCPUBITS;
Expand Down
6 changes: 4 additions & 2 deletions libc/src/sched/linux/sched_setcpuset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

#include "src/sched/sched_setcpuset.h"

#include "src/__support/common.h" // LLVM_LIBC_FUNCTION
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
#include "src/__support/common.h" // LLVM_LIBC_FUNCTION
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
#include "src/__support/macros/null_check.h" // LIBC_CRASH_ON_NULLPTR

#include "hdr/sched_macros.h" // NCPUBITS
#include "hdr/types/cpu_set_t.h"
Expand All @@ -19,6 +20,7 @@ namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(void, __sched_setcpuset,
(int cpu, const size_t cpuset_size, cpu_set_t *set)) {
LIBC_CRASH_ON_NULLPTR(set);
if (static_cast<size_t>(cpu) / 8 < cpuset_size) {
const size_t element_index = static_cast<size_t>(cpu) / NCPUBITS;
const size_t bit_position = static_cast<size_t>(cpu) % NCPUBITS;
Expand Down
6 changes: 4 additions & 2 deletions libc/src/sched/linux/sched_setcpuzero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

#include "src/sched/sched_setcpuzero.h"

#include "src/__support/common.h" // LLVM_LIBC_FUNCTION
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
#include "src/__support/common.h" // LLVM_LIBC_FUNCTION
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
#include "src/__support/macros/null_check.h" // LIBC_CRASH_ON_NULLPTR

#include "hdr/types/cpu_set_t.h"
#include "hdr/types/size_t.h"
Expand All @@ -18,6 +19,7 @@ namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(void, __sched_setcpuzero,
(const size_t cpuset_size, cpu_set_t *set)) {
LIBC_CRASH_ON_NULLPTR(set);
__builtin_memset(set, 0, cpuset_size);
}

Expand Down
Loading