1f9a21cf8SJérôme Duval/*
2f9a21cf8SJérôme Duval * Copyright 2009, Colin G��nther, coling@gmx.de.
3f9a21cf8SJérôme Duval * All rights reserved. Distributed under the terms of the MIT License.
4f9a21cf8SJérôme Duval */
5f9a21cf8SJérôme Duval
6f9a21cf8SJérôme Duval
7f9a21cf8SJérôme Duval#include <thread.h>
8f9a21cf8SJérôme Duval
9f9a21cf8SJérôme Duval#include <sys/param.h>
10f9a21cf8SJérôme Duval#include <sys/priv.h>
11f9a21cf8SJérôme Duval
12f9a21cf8SJérôme Duval
13f9a21cf8SJérôme Duval/*
14f9a21cf8SJérôme Duval * FreeBSD has a more sophisticated privilege checking system.
15f9a21cf8SJérôme Duval * We only check for superuser rights.
16f9a21cf8SJérôme Duval */
17f9a21cf8SJérôme Duvalint
18f9a21cf8SJérôme Duvalpriv_check(struct thread *thread, int privilegeLevel)
19f9a21cf8SJérôme Duval{
20f9a21cf8SJérôme Duval	// Note: The thread parameter is ignored intentionally (cf. the comment in
21f9a21cf8SJérôme Duval	// pcpu.h). Currently calling this function is only valid for the current
22f9a21cf8SJérôme Duval	// thread.
23f9a21cf8SJérôme Duval	if (thread_get_current_thread()->team->effective_uid == 0)
24f9a21cf8SJérôme Duval		return ENOERR;
25f9a21cf8SJérôme Duval
26f9a21cf8SJérôme Duval	return EPERM;
27f9a21cf8SJérôme Duval}
28