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