169dafa9836625753c972fd8edd75775b927bcd4
[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
19 #include <afs/afs_args.h>
20 #include <afs/sys_prototypes.h>
21 #include <unistd.h>
22 #include <stdio.h>
23 #if !defined(AFS_AIX_ENV) && !defined(AFS_NT40_ENV)
24 # include <sys/syscall.h>
25 #endif
26 #include "afssyscalls.h"
27
28 #ifdef AFS_AIX32_ENV
29 /*
30  * in VRMIX, system calls look just like function calls, so we don't
31  * need to do anything!
32  */
33
34 #else
35 #if defined(AFS_SGI_ENV)
36
37 #pragma weak xlsetpag = lsetpag
38
39 int
40 lsetpag(void)
41 {
42     return (syscall(AFS_SETPAG));
43 }
44
45 #else /* AFS_SGI_ENV */
46
47 int
48 lsetpag(void)
49 {
50     int errcode;
51
52 #ifdef AFS_LINUX20_ENV
53     int rval;
54
55     rval = proc_afs_syscall(AFSCALL_SETPAG,0,0,0,0,&errcode);
56
57     if(rval)
58       errcode = syscall(AFS_SYSCALL, AFSCALL_SETPAG);
59 #elif defined(AFS_DARWIN80_ENV)
60     errcode = ioctl_afs_syscall(AFSCALL_SETPAG,0,0,0,0,0,0,&errcode);
61 #else
62     errcode = syscall(AFS_SYSCALL, AFSCALL_SETPAG);
63 #endif
64
65     return (errcode);
66 }
67
68 #endif /* !AFS_SGI_ENV */
69 #endif /* !AFS_AIX32_ENV */