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 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1988 AT&T */
28 /* All Rights Reserved */
30 #pragma weak _shmat = shmat
31 #pragma weak _shmctl = shmctl
32 #pragma weak _shmctl64 = shmctl64
33 #pragma weak _shmdt = shmdt
34 #pragma weak _shmget = shmget
35 #pragma weak _shmids = shmids
38 #include <sys/types.h>
40 #include <sys/ipc_impl.h>
42 #include <sys/shm_impl.h>
43 #include <sys/syscall.h>
47 shmat(int shmid
, const void *shmaddr
, int shmflg
)
52 error
= __systemcall(&rval
, SYS_shmsys
, SHMAT
, shmid
, shmaddr
, shmflg
);
54 (void) __set_errno(error
);
55 return ((void *)rval
.sys_rval1
);
59 shmctl(int shmid
, int cmd
, struct shmid_ds
*buf
)
61 if (cmd
== IPC_SET64
|| cmd
== IPC_STAT64
) {
62 (void) __set_errno(EINVAL
);
65 return (syscall(SYS_shmsys
, SHMCTL
, shmid
, cmd
, buf
));
69 shmctl64(int shmid
, int cmd
, struct shmid_ds64
*buf
)
71 if (cmd
!= IPC_SET64
&& cmd
!= IPC_STAT64
) {
72 (void) __set_errno(EINVAL
);
75 return (syscall(SYS_shmsys
, SHMCTL
, shmid
, cmd
, buf
));
81 return (syscall(SYS_shmsys
, SHMDT
, shmaddr
));
85 shmget(key_t key
, size_t size
, int shmflg
)
87 return (syscall(SYS_shmsys
, SHMGET
, key
, size
, shmflg
));
91 shmids(int *buf
, uint_t nids
, uint_t
*pnids
)
93 return (syscall(SYS_shmsys
, SHMIDS
, buf
, nids
, pnids
));