4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1998-2000 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
35 offset_t full
; /* full 64 bit offset value */
36 uint32_t half
[2]; /* two 32-bit halves */
40 * lseek() system call -- executed by subject process.
43 pr_lseek(struct ps_prochandle
*Pr
, int filedes
, off_t offset
, int whence
)
45 int syscall
; /* SYS_lseek or SYS_llseek */
46 int nargs
; /* 3 or 4, depending on syscall */
48 sysret_t rval
; /* return value from lseek() */
49 argdes_t argd
[4]; /* arg descriptors for lseek() */
54 return (lseek(filedes
, offset
, whence
));
56 adp
= &argd
[0]; /* filedes argument */
57 adp
->arg_value
= filedes
;
58 adp
->arg_object
= NULL
;
59 adp
->arg_type
= AT_BYVAL
;
60 adp
->arg_inout
= AI_INPUT
;
63 adp
++; /* offset argument */
64 if (Pstatus(Pr
)->pr_dmodel
== PR_MODEL_NATIVE
) {
67 adp
->arg_value
= offset
;
68 adp
->arg_object
= NULL
;
69 adp
->arg_type
= AT_BYVAL
;
70 adp
->arg_inout
= AI_INPUT
;
76 adp
->arg_value
= off
.half
[0]; /* first 32 bits */
77 adp
->arg_object
= NULL
;
78 adp
->arg_type
= AT_BYVAL
;
79 adp
->arg_inout
= AI_INPUT
;
82 adp
->arg_value
= off
.half
[1]; /* second 32 bits */
83 adp
->arg_object
= NULL
;
84 adp
->arg_type
= AT_BYVAL
;
85 adp
->arg_inout
= AI_INPUT
;
89 adp
++; /* whence argument */
90 adp
->arg_value
= whence
;
91 adp
->arg_object
= NULL
;
92 adp
->arg_type
= AT_BYVAL
;
93 adp
->arg_inout
= AI_INPUT
;
96 error
= Psyscall(Pr
, &rval
, syscall
, nargs
, &argd
[0]);
99 errno
= (error
> 0)? error
: ENOSYS
;
100 return ((off_t
)(-1));
103 if (Pstatus(Pr
)->pr_dmodel
== PR_MODEL_NATIVE
)
104 offset
= rval
.sys_rval1
;
106 off
.half
[0] = (uint32_t)rval
.sys_rval1
;
107 off
.half
[1] = (uint32_t)rval
.sys_rval2
;
108 offset
= (off_t
)off
.full
;
115 * llseek() system call -- executed by subject process.
118 pr_llseek(struct ps_prochandle
*Pr
, int filedes
, offset_t offset
, int whence
)
120 int syscall
; /* SYS_lseek or SYS_llseek */
121 int nargs
; /* 3 or 4, depending on syscall */
123 sysret_t rval
; /* return value from llseek() */
124 argdes_t argd
[4]; /* arg descriptors for llseek() */
129 return (llseek(filedes
, offset
, whence
));
131 adp
= &argd
[0]; /* filedes argument */
132 adp
->arg_value
= filedes
;
133 adp
->arg_object
= NULL
;
134 adp
->arg_type
= AT_BYVAL
;
135 adp
->arg_inout
= AI_INPUT
;
138 adp
++; /* offset argument */
139 if (Pstatus(Pr
)->pr_dmodel
== PR_MODEL_LP64
) {
142 adp
->arg_value
= offset
;
143 adp
->arg_object
= NULL
;
144 adp
->arg_type
= AT_BYVAL
;
145 adp
->arg_inout
= AI_INPUT
;
148 syscall
= SYS_llseek
;
151 adp
->arg_value
= off
.half
[0]; /* first 32 bits */
152 adp
->arg_object
= NULL
;
153 adp
->arg_type
= AT_BYVAL
;
154 adp
->arg_inout
= AI_INPUT
;
157 adp
->arg_value
= off
.half
[1]; /* second 32 bits */
158 adp
->arg_object
= NULL
;
159 adp
->arg_type
= AT_BYVAL
;
160 adp
->arg_inout
= AI_INPUT
;
164 adp
++; /* whence argument */
165 adp
->arg_value
= whence
;
166 adp
->arg_object
= NULL
;
167 adp
->arg_type
= AT_BYVAL
;
168 adp
->arg_inout
= AI_INPUT
;
171 error
= Psyscall(Pr
, &rval
, syscall
, nargs
, &argd
[0]);
174 errno
= (error
> 0)? error
: ENOSYS
;
175 return ((offset_t
)(-1));
178 if (Pstatus(Pr
)->pr_dmodel
== PR_MODEL_LP64
)
179 offset
= rval
.sys_rval1
;
181 off
.half
[0] = (uint32_t)rval
.sys_rval1
;
182 off
.half
[1] = (uint32_t)rval
.sys_rval2
;