Deleted Added
full compact
sysv_shm.c (77104) sysv_shm.c (77461)
1/* $FreeBSD: head/sys/kern/sysv_shm.c 77104 2001-05-23 23:38:05Z dd $ */
1/* $FreeBSD: head/sys/kern/sysv_shm.c 77461 2001-05-30 03:28:59Z dd $ */
2/* $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $ */
3
4/*
5 * Copyright (c) 1994 Adam Glass and Charles Hannum. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

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

99static struct shmid_ds *shm_find_segment_by_shmid __P((int));
100static int shm_delete_mapping __P((struct proc *, struct shmmap_state *));
101static void shmrealloc __P((void));
102static void shminit __P((void));
103static int sysvshm_modload __P((struct module *, int, void *));
104static int shmunload __P((void));
105static void shmexit_myhook __P((struct proc *p));
106static void shmfork_myhook __P((struct proc *p1, struct proc *p2));
2/* $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $ */
3
4/*
5 * Copyright (c) 1994 Adam Glass and Charles Hannum. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

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

99static struct shmid_ds *shm_find_segment_by_shmid __P((int));
100static int shm_delete_mapping __P((struct proc *, struct shmmap_state *));
101static void shmrealloc __P((void));
102static void shminit __P((void));
103static int sysvshm_modload __P((struct module *, int, void *));
104static int shmunload __P((void));
105static void shmexit_myhook __P((struct proc *p));
106static void shmfork_myhook __P((struct proc *p1, struct proc *p2));
107static int sysctl_shmsegs __P((SYSCTL_HANDLER_ARGS));
107
108/*
109 * Tuneable values.
110 */
111#ifndef SHMMAXPGS
112#define SHMMAXPGS 8192 /* Note: sysv shared memory is swap backed. */
113#endif
114#ifndef SHMMAX

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

140SYSCTL_DECL(_kern_ipc);
141SYSCTL_INT(_kern_ipc, OID_AUTO, shmmax, CTLFLAG_RW, &shminfo.shmmax, 0, "");
142SYSCTL_INT(_kern_ipc, OID_AUTO, shmmin, CTLFLAG_RW, &shminfo.shmmin, 0, "");
143SYSCTL_INT(_kern_ipc, OID_AUTO, shmmni, CTLFLAG_RD, &shminfo.shmmni, 0, "");
144SYSCTL_INT(_kern_ipc, OID_AUTO, shmseg, CTLFLAG_RD, &shminfo.shmseg, 0, "");
145SYSCTL_INT(_kern_ipc, OID_AUTO, shmall, CTLFLAG_RW, &shminfo.shmall, 0, "");
146SYSCTL_INT(_kern_ipc, OID_AUTO, shm_use_phys, CTLFLAG_RW,
147 &shm_use_phys, 0, "");
108
109/*
110 * Tuneable values.
111 */
112#ifndef SHMMAXPGS
113#define SHMMAXPGS 8192 /* Note: sysv shared memory is swap backed. */
114#endif
115#ifndef SHMMAX

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

141SYSCTL_DECL(_kern_ipc);
142SYSCTL_INT(_kern_ipc, OID_AUTO, shmmax, CTLFLAG_RW, &shminfo.shmmax, 0, "");
143SYSCTL_INT(_kern_ipc, OID_AUTO, shmmin, CTLFLAG_RW, &shminfo.shmmin, 0, "");
144SYSCTL_INT(_kern_ipc, OID_AUTO, shmmni, CTLFLAG_RD, &shminfo.shmmni, 0, "");
145SYSCTL_INT(_kern_ipc, OID_AUTO, shmseg, CTLFLAG_RD, &shminfo.shmseg, 0, "");
146SYSCTL_INT(_kern_ipc, OID_AUTO, shmall, CTLFLAG_RW, &shminfo.shmall, 0, "");
147SYSCTL_INT(_kern_ipc, OID_AUTO, shm_use_phys, CTLFLAG_RW,
148 &shm_use_phys, 0, "");
149SYSCTL_PROC(_kern_ipc, OID_AUTO, shmsegs, CTLFLAG_RD,
150 NULL, 0, sysctl_shmsegs, "", "");
148
149static int
150shm_find_segment_by_key(key)
151 key_t key;
152{
153 int i;
154
155 for (i = 0; i < shmalloced; i++)

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

738
739 free(shmsegs, M_SHM);
740 shmexit_hook = NULL;
741 shmfork_hook = NULL;
742 return (0);
743}
744
745static int
151
152static int
153shm_find_segment_by_key(key)
154 key_t key;
155{
156 int i;
157
158 for (i = 0; i < shmalloced; i++)

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

741
742 free(shmsegs, M_SHM);
743 shmexit_hook = NULL;
744 shmfork_hook = NULL;
745 return (0);
746}
747
748static int
749sysctl_shmsegs(SYSCTL_HANDLER_ARGS)
750{
751
752 return (SYSCTL_OUT(req, shmsegs, shmalloced * sizeof(shmsegs[0])));
753}
754
755static int
746sysvshm_modload(struct module *module, int cmd, void *arg)
747{
748 int error = 0;
749
750 switch (cmd) {
751 case MOD_LOAD:
752 shminit();
753 break;

--- 27 unchanged lines hidden ---
756sysvshm_modload(struct module *module, int cmd, void *arg)
757{
758 int error = 0;
759
760 switch (cmd) {
761 case MOD_LOAD:
762 shminit();
763 break;

--- 27 unchanged lines hidden ---