Deleted Added
full compact
sysv_shm.c (194766) sysv_shm.c (194832)
1/* $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $ */
2/*-
3 * Copyright (c) 1994 Adam Glass and Charles Hannum. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE.
60 */
61
62#include <sys/cdefs.h>
1/* $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $ */
2/*-
3 * Copyright (c) 1994 Adam Glass and Charles Hannum. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE.
60 */
61
62#include <sys/cdefs.h>
63__FBSDID("$FreeBSD: head/sys/kern/sysv_shm.c 194766 2009-06-23 20:45:22Z kib $");
63__FBSDID("$FreeBSD: head/sys/kern/sysv_shm.c 194832 2009-06-24 13:35:38Z jhb $");
64
65#include "opt_compat.h"
66#include "opt_sysvipc.h"
67
68#include <sys/param.h>
69#include <sys/systm.h>
70#include <sys/kernel.h>
71#include <sys/lock.h>

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

514 mtx_unlock(&Giant);
515 return (error);
516#else
517 return (EINVAL);
518#endif
519}
520#endif
521
64
65#include "opt_compat.h"
66#include "opt_sysvipc.h"
67
68#include <sys/param.h>
69#include <sys/systm.h>
70#include <sys/kernel.h>
71#include <sys/lock.h>

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

514 mtx_unlock(&Giant);
515 return (error);
516#else
517 return (EINVAL);
518#endif
519}
520#endif
521
522#ifndef _SYS_SYSPROTO_H_
523struct shmctl_args {
524 int shmid;
525 int cmd;
526 struct shmid_ds *buf;
527};
528#endif
529int
530kern_shmctl(td, shmid, cmd, buf, bufsz)
531 struct thread *td;
532 int shmid;
533 int cmd;
534 void *buf;
535 size_t *bufsz;
536{

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

631 error = EINVAL;
632 break;
633 }
634done2:
635 mtx_unlock(&Giant);
636 return (error);
637}
638
522int
523kern_shmctl(td, shmid, cmd, buf, bufsz)
524 struct thread *td;
525 int shmid;
526 int cmd;
527 void *buf;
528 size_t *bufsz;
529{

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

624 error = EINVAL;
625 break;
626 }
627done2:
628 mtx_unlock(&Giant);
629 return (error);
630}
631
632#ifndef _SYS_SYSPROTO_H_
633struct shmctl_args {
634 int shmid;
635 int cmd;
636 struct shmid_ds *buf;
637};
638#endif
639int
640shmctl(td, uap)
641 struct thread *td;
642 struct shmctl_args *uap;
643{
644 int error = 0;
645 struct shmid_ds buf;
646 size_t bufsz;

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

675 if (error) {
676 /* Invalidate the return value */
677 td->td_retval[0] = -1;
678 }
679 return (error);
680}
681
682
639int
640shmctl(td, uap)
641 struct thread *td;
642 struct shmctl_args *uap;
643{
644 int error = 0;
645 struct shmid_ds buf;
646 size_t bufsz;

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

675 if (error) {
676 /* Invalidate the return value */
677 td->td_retval[0] = -1;
678 }
679 return (error);
680}
681
682
683#ifndef _SYS_SYSPROTO_H_
684struct shmget_args {
685 key_t key;
686 size_t size;
687 int shmflg;
688};
689#endif
690static int
691shmget_existing(td, uap, mode, segnum)
692 struct thread *td;
693 struct shmget_args *uap;
694 int mode;
695 int segnum;
696{
697 struct shmid_kernel *shmseg;

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

802 */
803 shmseg->u.shm_perm.mode &= ~SHMSEG_WANTED;
804 wakeup(shmseg);
805 }
806 td->td_retval[0] = shmid;
807 return (0);
808}
809
683static int
684shmget_existing(td, uap, mode, segnum)
685 struct thread *td;
686 struct shmget_args *uap;
687 int mode;
688 int segnum;
689{
690 struct shmid_kernel *shmseg;

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

795 */
796 shmseg->u.shm_perm.mode &= ~SHMSEG_WANTED;
797 wakeup(shmseg);
798 }
799 td->td_retval[0] = shmid;
800 return (0);
801}
802
803#ifndef _SYS_SYSPROTO_H_
804struct shmget_args {
805 key_t key;
806 size_t size;
807 int shmflg;
808};
809#endif
810int
811shmget(td, uap)
812 struct thread *td;
813 struct shmget_args *uap;
814{
815 int segnum, mode;
816 int error;
817

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

1019};
1020
1021SYSCALL_MODULE_HELPER(shmsys);
1022SYSCALL_MODULE_HELPER(shmat);
1023SYSCALL_MODULE_HELPER(shmctl);
1024SYSCALL_MODULE_HELPER(shmdt);
1025SYSCALL_MODULE_HELPER(shmget);
1026
810int
811shmget(td, uap)
812 struct thread *td;
813 struct shmget_args *uap;
814{
815 int segnum, mode;
816 int error;
817

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

1019};
1020
1021SYSCALL_MODULE_HELPER(shmsys);
1022SYSCALL_MODULE_HELPER(shmat);
1023SYSCALL_MODULE_HELPER(shmctl);
1024SYSCALL_MODULE_HELPER(shmdt);
1025SYSCALL_MODULE_HELPER(shmget);
1026
1027DECLARE_MODULE(sysvshm, sysvshm_mod,
1028 SI_SUB_SYSV_SHM, SI_ORDER_FIRST);
1027DECLARE_MODULE(sysvshm, sysvshm_mod, SI_SUB_SYSV_SHM, SI_ORDER_FIRST);
1029MODULE_VERSION(sysvshm, 1);
1028MODULE_VERSION(sysvshm, 1);