Deleted Added
sdiff udiff text old ( 159991 ) new ( 159993 )
full compact
1/*-
2 * Copyright (c) 1995 The NetBSD Foundation, Inc.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to The NetBSD Foundation
6 * by Christos Zoulas.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 57 unchanged lines hidden (view full) ---

66 * to preprocessor conditionals). A nice project for a kernel hacking
67 * novice might be to MakeItGo, but I have more important fish to fry
68 * at present.
69 *
70 * Derived from: $NetBSD: svr4_ipc.c,v 1.7 1998/10/19 22:43:00 tron Exp $
71 */
72
73#include <sys/cdefs.h>
74__FBSDID("$FreeBSD: head/sys/compat/svr4/svr4_ipc.c 159991 2006-06-27 18:28:50Z jhb $");
75
76#include "opt_sysvipc.h"
77
78#include <sys/param.h>
79#include <sys/ipc.h>
80#include <sys/msg.h>
81#include <sys/proc.h>
82#include <sys/sem.h>

--- 562 unchanged lines hidden (view full) ---

645};
646
647int
648svr4_shmctl(td, v)
649 struct thread *td;
650 void *v;
651{
652 struct svr4_sys_shmctl_args *uap = v;
653 int error;
654 caddr_t sg = stackgap_init();
655 struct shmctl_args ap;
656 struct shmid_ds bs;
657 struct svr4_shmid_ds ss;
658
659 ap.shmid = uap->shmid;
660
661 if (uap->buf != NULL) {
662 ap.buf = stackgap_alloc(&sg, sizeof (struct shmid_ds));
663 switch (uap->cmd) {
664 case SVR4_IPC_SET:
665 case SVR4_IPC_RMID:
666 case SVR4_SHM_LOCK:
667 case SVR4_SHM_UNLOCK:
668 error = copyin(uap->buf, (caddr_t) &ss,
669 sizeof ss);
670 if (error)
671 return error;
672 svr4_to_bsd_shmid_ds(&ss, &bs);
673 error = copyout(&bs, ap.buf, sizeof bs);
674 if (error)
675 return error;
676 break;
677 default:
678 break;
679 }
680 }
681 else
682 ap.buf = NULL;
683
684
685 switch (uap->cmd) {
686 case SVR4_IPC_STAT:
687 ap.cmd = IPC_STAT;
688 if ((error = shmctl(td, &ap)) != 0)
689 return error;
690 if (uap->buf == NULL)
691 return 0;
692 error = copyin(&bs, ap.buf, sizeof bs);
693 if (error)
694 return error;
695 bsd_to_svr4_shmid_ds(&bs, &ss);
696 return copyout(&ss, uap->buf, sizeof ss);
697
698 case SVR4_IPC_SET:
699 ap.cmd = IPC_SET;
700 return shmctl(td, &ap);
701
702 case SVR4_IPC_RMID:
703 case SVR4_SHM_LOCK:
704 case SVR4_SHM_UNLOCK:
705 switch (uap->cmd) {
706 case SVR4_IPC_RMID:
707 ap.cmd = IPC_RMID;
708 break;
709 case SVR4_SHM_LOCK:
710 ap.cmd = SHM_LOCK;
711 break;
712 case SVR4_SHM_UNLOCK:
713 ap.cmd = SHM_UNLOCK;
714 break;
715 default:
716 return EINVAL;
717 }
718 return shmctl(td, &ap);
719
720 default:
721 return EINVAL;
722 }
723}
724
725int
726svr4_sys_shmsys(td, uap)
727 struct thread *td;
728 struct svr4_sys_shmsys_args *uap;
729{
730

--- 18 unchanged lines hidden ---