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) 1997-2000 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include <sys/isa_defs.h>
37 * fcntl() system call -- executed by subject process.
40 pr_fcntl(struct ps_prochandle
*Pr
, int fd
, int cmd
, void *argp
)
42 sysret_t rval
; /* return value from fcntl() */
43 argdes_t argd
[3]; /* arg descriptors for fcntl() */
47 if (Pr
== NULL
) /* no subject process */
48 return (fcntl(fd
, cmd
, argp
));
50 adp
= &argd
[0]; /* file descriptor argument */
52 adp
->arg_object
= NULL
;
53 adp
->arg_type
= AT_BYVAL
;
54 adp
->arg_inout
= AI_INPUT
;
57 adp
++; /* cmd argument */
59 if (Pstatus(Pr
)->pr_dmodel
== PR_MODEL_ILP32
) {
61 * Guilty knowledge of the large file compilation environment
80 adp
->arg_object
= NULL
;
81 adp
->arg_type
= AT_BYVAL
;
82 adp
->arg_inout
= AI_INPUT
;
85 adp
++; /* argp argument */
88 adp
->arg_object
= NULL
;
89 adp
->arg_type
= AT_BYVAL
;
90 adp
->arg_inout
= AI_INPUT
;
94 adp
->arg_object
= argp
;
95 adp
->arg_type
= AT_BYREF
;
96 adp
->arg_inout
= AI_INOUT
;
103 adp
->arg_size
= sizeof (struct flock
);
110 adp
->arg_size
= sizeof (struct flock64_32
);
116 adp
->arg_size
= sizeof (struct flock64
);
121 adp
->arg_size
= sizeof (struct fshare
);
124 adp
->arg_value
= (long)argp
;
125 adp
->arg_object
= NULL
;
126 adp
->arg_type
= AT_BYVAL
;
127 adp
->arg_inout
= AI_INPUT
;
133 error
= Psyscall(Pr
, &rval
, SYS_fcntl
, 3, &argd
[0]);
136 errno
= (error
> 0)? error
: ENOSYS
;
139 return (rval
.sys_rval1
);