3c90279ee7abd7b43881995b122adaa160ed4068
[openafs.git] / src / sys / setpag.c
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  *
9  * This file contains the lsetpag system call.  (setpag is handled by the
10  * rmtsys layer and turned into either setpag or a remote call as is
11  * appropriate.)  It is kept separate to allow for the creation of a simple
12  * shared library containing only setpag.
13  */
14
15 #include <afsconfig.h>
16 #include <afs/param.h>
17
18 #include <roken.h>
19
20 #if !defined(AFS_AIX_ENV) && !defined(AFS_NT40_ENV)
21 # include <sys/syscall.h>
22 #endif
23
24 #include <afs/afs_args.h>
25 #include <afs/sys_prototypes.h>
26
27 #include "afssyscalls.h"
28
29 #ifdef AFS_AIX32_ENV
30 /*
31  * in VRMIX, system calls look just like function calls, so we don't
32  * need to do anything!
33  */
34
35 #else
36 #if defined(AFS_SGI_ENV)
37
38 #pragma weak xlsetpag = lsetpag
39
40 int
41 lsetpag(void)
42 {
43     return (syscall(AFS_SETPAG));
44 }
45
46 #else /* AFS_SGI_ENV */
47
48 int
49 lsetpag(void)
50 {
51     int errcode;
52
53 #ifdef AFS_LINUX20_ENV
54     int rval;
55
56     rval = proc_afs_syscall(AFSCALL_SETPAG,0,0,0,0,&errcode);
57
58     if(rval)
59       errcode = syscall(AFS_SYSCALL, AFSCALL_SETPAG);
60 #elif defined(AFS_DARWIN80_ENV)
61     int rval;
62
63     rval = ioctl_afs_syscall(AFSCALL_SETPAG,0,0,0,0,0,0,&errcode);
64     if (rval) {
65         errcode = rval;
66     }
67 #elif defined(AFS_SUN511_ENV)
68     int rval;
69
70     rval = ioctl_sun_afs_syscall(AFSCALL_SETPAG,0,0,0,0,0,0,&errcode);
71     if (rval) {
72         errcode = rval;
73     }
74 #else
75     errcode = syscall(AFS_SYSCALL, AFSCALL_SETPAG);
76 #endif
77
78     return (errcode);
79 }
80
81 #endif /* !AFS_SGI_ENV */
82 #endif /* !AFS_AIX32_ENV */