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 159993 2006-06-27 18:31:36Z 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 struct shmid_ds bs; 654 struct svr4_shmid_ds ss; |
655 size_t bufsize; 656 int cmd, error; |
657 |
658 if (uap->buf != NULL) { |
659 switch (uap->cmd) { 660 case SVR4_IPC_SET: 661 case SVR4_IPC_RMID: 662 case SVR4_SHM_LOCK: 663 case SVR4_SHM_UNLOCK: |
664 error = copyin(uap->buf, &ss, sizeof(ss)); |
665 if (error) |
666 return (error); |
667 svr4_to_bsd_shmid_ds(&ss, &bs); |
668 break; 669 default: |
670 return (EINVAL); |
671 } 672 } |
673 |
674 switch (uap->cmd) { 675 case SVR4_IPC_STAT: |
676 cmd = IPC_STAT; 677 break; |
678 case SVR4_IPC_SET: |
679 cmd = IPC_SET; 680 break; |
681 case SVR4_IPC_RMID: |
682 cmd = IPC_RMID; 683 break; |
684 case SVR4_SHM_LOCK: |
685 cmd = SHM_LOCK; 686 break; |
687 case SVR4_SHM_UNLOCK: |
688 cmd = SHM_UNLOCK; 689 break; |
690 default: |
691 return (EINVAL); |
692 } |
693 694 error = kern_shmctl(td, uap->shmid, cmd, &bs, &bufsize); 695 if (error) 696 return (error); 697 698 switch (uap->cmd) { 699 case SVR4_IPC_STAT: 700 if (uap->buf != NULL) { 701 bsd_to_svr4_shmid_ds(&bs, &ss); 702 error = copyout(&ss, uap->buf, sizeof(ss)); 703 } 704 break; 705 } 706 707 return (error); |
708} 709 710int 711svr4_sys_shmsys(td, uap) 712 struct thread *td; 713 struct svr4_sys_shmsys_args *uap; 714{ 715 --- 18 unchanged lines hidden --- |