ovni/compat.h

22 lines
466 B
C
Raw Normal View History

2022-09-19 12:39:02 +02:00
/* Copyright (c) 2022 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: MIT */
2022-01-11 15:47:17 +01:00
#ifndef COMPAT_H
#define COMPAT_H
#define _GNU_SOURCE
#include <sys/syscall.h>
#include <unistd.h>
/* Define gettid for older glibc versions (below 2.30) */
2022-01-11 19:08:37 +01:00
#if defined(__GLIBC__)
#if !__GLIBC_PREREQ(2, 30)
2022-01-11 15:47:17 +01:00
static inline pid_t gettid(void)
{
return (pid_t)syscall(SYS_gettid);
}
2022-01-11 19:08:37 +01:00
#endif /* !__GLIBC_PREREQ(2, 30) */
#endif /* defined(__GLIBC__) */
2022-01-11 15:47:17 +01:00
#endif // COMPAT_H