4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
33 * rename() system call -- executed by subject process.
36 pr_rename(struct ps_prochandle
*Pr
, const char *old
, const char *new)
44 return (rename(old
, new));
46 adp
= &argd
[0]; /* old fd argument */
47 adp
->arg_value
= AT_FDCWD
;
48 adp
->arg_object
= NULL
;
49 adp
->arg_type
= AT_BYVAL
;
50 adp
->arg_inout
= AI_INPUT
;
53 adp
++; /* move to old argument */
55 adp
->arg_object
= (void *)old
;
56 adp
->arg_type
= AT_BYREF
;
57 adp
->arg_inout
= AI_INPUT
;
58 adp
->arg_size
= strlen(old
) + 1;
60 adp
++; /* move to new fd argument */
61 adp
->arg_value
= AT_FDCWD
;
62 adp
->arg_object
= NULL
;
63 adp
->arg_type
= AT_BYVAL
;
64 adp
->arg_inout
= AI_INPUT
;
67 adp
++; /* move to new argument */
69 adp
->arg_object
= (void *)new;
70 adp
->arg_type
= AT_BYREF
;
71 adp
->arg_inout
= AI_INPUT
;
72 adp
->arg_size
= strlen(new) + 1;
74 error
= Psyscall(Pr
, &rval
, SYS_renameat
, 4, &argd
[0]);
77 errno
= (error
> 0) ? error
: ENOSYS
;
80 return (rval
.sys_rval1
);
84 * link() system call -- executed by subject process.
87 pr_link(struct ps_prochandle
*Pr
, const char *existing
, const char *new)
95 return (link(existing
, new));
97 adp
= &argd
[0]; /* first directory fd argument */
98 adp
->arg_value
= AT_FDCWD
;
99 adp
->arg_object
= NULL
;
100 adp
->arg_type
= AT_BYVAL
;
101 adp
->arg_inout
= AI_INPUT
;
104 adp
++; /* existing argument */
106 adp
->arg_object
= (void *)existing
;
107 adp
->arg_type
= AT_BYREF
;
108 adp
->arg_inout
= AI_INPUT
;
109 adp
->arg_size
= strlen(existing
) + 1;
111 adp
++; /* second directory fd argument */
112 adp
->arg_value
= AT_FDCWD
;
113 adp
->arg_object
= NULL
;
114 adp
->arg_type
= AT_BYVAL
;
115 adp
->arg_inout
= AI_INPUT
;
118 adp
++; /* new argument */
120 adp
->arg_object
= (void *)new;
121 adp
->arg_type
= AT_BYREF
;
122 adp
->arg_inout
= AI_INPUT
;
123 adp
->arg_size
= strlen(new) + 1;
125 adp
++; /* flag argument */
127 adp
->arg_object
= NULL
;
128 adp
->arg_type
= AT_BYVAL
;
129 adp
->arg_inout
= AI_INPUT
;
132 error
= Psyscall(Pr
, &rval
, SYS_linkat
, 5, &argd
[0]);
135 errno
= (error
> 0) ? error
: ENOSYS
;
138 return (rval
.sys_rval1
);
142 * unlink() system call -- executed by subject process.
145 pr_unlink(struct ps_prochandle
*Pr
, const char *path
)
153 return (unlink(path
));
155 adp
= &argd
[0]; /* directory fd argument */
156 adp
->arg_value
= AT_FDCWD
;
157 adp
->arg_object
= NULL
;
158 adp
->arg_type
= AT_BYVAL
;
159 adp
->arg_inout
= AI_INPUT
;
161 adp
++; /* move to path argument */
164 adp
->arg_object
= (void *)path
;
165 adp
->arg_type
= AT_BYREF
;
166 adp
->arg_inout
= AI_INPUT
;
167 adp
->arg_size
= strlen(path
) + 1;
168 adp
++; /* move to flags argument */
171 adp
->arg_object
= NULL
;
172 adp
->arg_type
= AT_BYVAL
;
173 adp
->arg_inout
= AI_INPUT
;
176 error
= Psyscall(Pr
, &rval
, SYS_unlinkat
, 3, &argd
[0]);
179 errno
= (error
> 0) ? error
: ENOSYS
;
182 return (rval
.sys_rval1
);