openbsd35-20031009
[openafs.git] / src / afs / OBSD / osi_misc.c
1 /* 
2  * osi_misc.c
3  *
4  * $Id$
5  */
6
7 /*
8 copyright 2002
9 the regents of the university of michigan
10 all rights reserved
11
12 permission is granted to use, copy, create derivative works 
13 and redistribute this software and such derivative works 
14 for any purpose, so long as the name of the university of 
15 michigan is not used in any advertising or publicity 
16 pertaining to the use or distribution of this software 
17 without specific, written prior authorization.  if the 
18 above copyright notice or any other identification of the 
19 university of michigan is included in any copy of any 
20 portion of this software, then the disclaimer below must 
21 also be included.
22
23 this software is provided as is, without representation 
24 from the university of michigan as to its fitness for any 
25 purpose, and without warranty by the university of 
26 michigan of any kind, either express or implied, including 
27 without limitation the implied warranties of 
28 merchantability and fitness for a particular purpose. the 
29 regents of the university of michigan shall not be liable 
30 for any damages, including special, indirect, incidental, or 
31 consequential damages, with respect to any claim arising 
32 out of or in connection with the use of the software, even 
33 if it has been or is hereafter advised of the possibility of 
34 such damages.
35 */
36
37 /*
38  * Copyright 2000, International Business Machines Corporation and others.
39  * All Rights Reserved.
40  * 
41  * This software has been released under the terms of the IBM Public
42  * License.  For details, see the LICENSE file in the top-level source
43  * directory or online at http://www.openafs.org/dl/license10.html
44  */
45
46 #include <afsconfig.h>
47 #include "afs/param.h"
48
49 RCSID
50     ("$Header$");
51
52 #include "afs/sysincludes.h"    /* Standard vendor system headers */
53 #include "afs/afsincludes.h"    /* Afs-based standard headers */
54
55 /*
56  * afs_suser() returns true if the caller is superuser, false otherwise.
57  *
58  * Note that it must NOT set errno.
59  */
60
61 /* 
62  * OpenBSD version of afs_osi_suser() by Jim Rees.
63  * See osi_machdep.h for afs_suser macro. It simply calls afs_osi_suser()
64  * with the creds of the current process.
65  */
66
67 int
68 afs_osi_suser(void *credp)
69 {
70 #ifdef AFS_OBSD35_ENV
71     return (suser_ucred((struct ucred *)credp) ? 0 : 1);
72 #else
73     return (suser((struct ucred *)credp, &curproc->p_acflag) ? 0 : 1);
74 #endif
75 }
76
77 void *
78 afs_nbsd_Alloc(size_t asize)
79 {
80     void *p;
81
82     MALLOC(p, void *, asize, M_AFSGENERIC, M_WAITOK);
83     return p;
84 }
85
86 void
87 afs_nbsd_Free(void *p, size_t asize)
88 {
89     FREE(p, M_AFSGENERIC);
90 }
91
92 int
93 afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, retval)
94      long *retval;
95      long dev, near_inode, param1, param2, param3, param4;
96 {
97     return EINVAL;
98 }
99
100 int
101 afs_syscall_iopen(dev, inode, usrmod, retval)
102      long *retval;
103      int dev, inode, usrmod;
104 {
105     return EINVAL;
106 }
107
108 int
109 afs_syscall_iincdec(dev, inode, inode_p1, amount)
110      int dev, inode, inode_p1, amount;
111 {
112     return EINVAL;
113 }