mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 21:25:04 -07:00
build/NetBSD: use kinfo_proc2; undef uint64_t (#8197)
closes #8196 For historical reasons, uint64_t and friends are defined both as typedefs and macros. Some platforms that do that define the macros as identity (#define uint64_t uint64_t), others like NetBSD define to the backing type (#define uint64_t __uint64_t). This is normally transparent, except when multiple levels of macro expansions are used inconsistently.
This commit is contained in:
parent
bbca3142e8
commit
e9cf40f2b6
@ -8,6 +8,11 @@
|
|||||||
#include "nvim/api/private/dispatch.h"
|
#include "nvim/api/private/dispatch.h"
|
||||||
#include "nvim/bufhl_defs.h"
|
#include "nvim/bufhl_defs.h"
|
||||||
|
|
||||||
|
#if defined(__NetBSD__)
|
||||||
|
# undef uint64_t
|
||||||
|
# define uint64_t uint64_t
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAP_DECLS(T, U) \
|
#define MAP_DECLS(T, U) \
|
||||||
KHASH_DECLARE(T##_##U##_map, T, U) \
|
KHASH_DECLARE(T##_##U##_map, T, U) \
|
||||||
\
|
\
|
||||||
|
@ -12,12 +12,16 @@
|
|||||||
# include <tlhelp32.h> // for CreateToolhelp32Snapshot
|
# include <tlhelp32.h> // for CreateToolhelp32Snapshot
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__FreeBSD__) // XXX: OpenBSD, NetBSD ?
|
#if defined(__FreeBSD__) // XXX: OpenBSD ?
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# include <sys/user.h>
|
# include <sys/user.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__NetBSD__)
|
||||||
|
# include <sys/param.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__) || defined(BSD)
|
#if defined(__APPLE__) || defined(BSD)
|
||||||
# include <sys/sysctl.h>
|
# include <sys/sysctl.h>
|
||||||
# include <pwd.h>
|
# include <pwd.h>
|
||||||
@ -155,7 +159,11 @@ int os_proc_children(int ppid, int **proc_list, size_t *proc_count)
|
|||||||
# define KP_PID(o) o.p_pid
|
# define KP_PID(o) o.p_pid
|
||||||
# define KP_PPID(o) o.p_ppid
|
# define KP_PPID(o) o.p_ppid
|
||||||
# endif
|
# endif
|
||||||
|
# ifdef __NetBSD__
|
||||||
|
static int name[] = { CTL_KERN, KERN_PROC2, KERN_PROC_ALL, 0, (int)(sizeof(struct kinfo_proc2)), 0 };
|
||||||
|
# else
|
||||||
static int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0 };
|
static int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0 };
|
||||||
|
# endif
|
||||||
|
|
||||||
// Get total process count.
|
// Get total process count.
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
@ -165,7 +173,11 @@ int os_proc_children(int ppid, int **proc_list, size_t *proc_count)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get ALL processes.
|
// Get ALL processes.
|
||||||
|
# ifdef __NetBSD__
|
||||||
|
struct kinfo_proc2 *p_list = xmalloc(len);
|
||||||
|
# else
|
||||||
struct kinfo_proc *p_list = xmalloc(len);
|
struct kinfo_proc *p_list = xmalloc(len);
|
||||||
|
# endif
|
||||||
rv = sysctl(name, ARRAY_SIZE(name) - 1, p_list, &len, NULL, 0);
|
rv = sysctl(name, ARRAY_SIZE(name) - 1, p_list, &len, NULL, 0);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
xfree(p_list);
|
xfree(p_list);
|
||||||
|
Loading…
Reference in New Issue
Block a user