11.2Schristos/*	$NetBSD: compat___shmctl13.c,v 1.2 2009/01/11 02:46:26 christos Exp $	*/
21.2Schristos
31.2Schristos/*-
41.2Schristos * Copyright (c) 2008 The NetBSD Foundation, Inc.
51.2Schristos * All rights reserved.
61.2Schristos *
71.2Schristos * This code is derived from software contributed to The NetBSD Foundation
81.2Schristos * by Christos Zoulas.
91.2Schristos *
101.2Schristos * Redistribution and use in source and binary forms, with or without
111.2Schristos * modification, are permitted provided that the following conditions
121.2Schristos * are met:
131.2Schristos * 1. Redistributions of source code must retain the above copyright
141.2Schristos *    notice, this list of conditions and the following disclaimer.
151.2Schristos * 2. Redistributions in binary form must reproduce the above copyright
161.2Schristos *    notice, this list of conditions and the following disclaimer in the
171.2Schristos *    documentation and/or other materials provided with the distribution.
181.2Schristos * 3. All advertising materials mentioning features or use of this software
191.2Schristos *    must display the following acknowledgement:
201.2Schristos *        This product includes software developed by the NetBSD
211.2Schristos *        Foundation, Inc. and its contributors.
221.2Schristos * 4. Neither the name of The NetBSD Foundation nor the names of its
231.2Schristos *    contributors may be used to endorse or promote products derived
241.2Schristos *    from this software without specific prior written permission.
251.2Schristos *
261.2Schristos * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
271.2Schristos * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
281.2Schristos * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
291.2Schristos * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
301.2Schristos * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
311.2Schristos * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
321.2Schristos * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
331.2Schristos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
341.2Schristos * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
351.2Schristos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
361.2Schristos * POSSIBILITY OF SUCH DAMAGE.
371.2Schristos */
381.2Schristos#include <sys/cdefs.h>
391.2Schristos#if defined(LIBC_SCCS) && !defined(lint)
401.2Schristos__RCSID("$NetBSD: compat___shmctl13.c,v 1.2 2009/01/11 02:46:26 christos Exp $");
411.2Schristos#endif /* LIBC_SCCS and not lint */
421.2Schristos
431.2Schristos#include "namespace.h"
441.2Schristos#define __LIBC12_SOURCE__
451.2Schristos#include <sys/time.h>
461.2Schristos#include <compat/sys/time.h>
471.2Schristos#include <sys/shm.h>
481.2Schristos#include <compat/sys/shm.h>
491.2Schristos
501.2Schristos__warn_references(__shmctl13,
511.2Schristos    "warning: reference to compatibility __shmctl13(); include <sys/shm.h> to generate correct reference")
521.2Schristos
531.2Schristosint
541.2Schristos__shmctl13(int shmid, int cmd, struct shmid_ds13 *ds13)
551.2Schristos{
561.2Schristos	struct shmid_ds ds;
571.2Schristos	int error;
581.2Schristos
591.2Schristos	if (cmd == IPC_SET)
601.2Schristos		__shmid_ds13_to_native(ds13, &ds);
611.2Schristos
621.2Schristos	error = __shmctl50(shmid, cmd, &ds);
631.2Schristos	if (error)
641.2Schristos		return error;
651.2Schristos	if (cmd == IPC_STAT)
661.2Schristos		__native_to_shmid_ds13(&ds, ds13);
671.2Schristos	return 0;
681.2Schristos}
69