• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/ipc/

Lines Matching refs:ns

48 	struct ipc_namespace *ns;
60 #define shm_ids(ns) (*((ns)->ids[IPC_SHM_IDS]))
62 #define shm_lock(ns, id) \
63 ((struct shmid_kernel*)ipc_lock(&shm_ids(ns),id))
66 #define shm_get(ns, id) \
67 ((struct shmid_kernel*)ipc_get(&shm_ids(ns),id))
68 #define shm_buildid(ns, id, seq) \
69 ipc_buildid(&shm_ids(ns), id, seq)
71 static int newseg (struct ipc_namespace *ns, key_t key,
75 static void shm_destroy (struct ipc_namespace *ns, struct shmid_kernel *shp);
80 static void __ipc_init __shm_init_ns(struct ipc_namespace *ns, struct ipc_ids *ids)
82 ns->ids[IPC_SHM_IDS] = ids;
83 ns->shm_ctlmax = SHMMAX;
84 ns->shm_ctlall = SHMALL;
85 ns->shm_ctlmni = SHMMNI;
86 ns->shm_tot = 0;
90 static void do_shm_rmid(struct ipc_namespace *ns, struct shmid_kernel *shp)
98 shm_destroy(ns, shp);
102 int shm_init_ns(struct ipc_namespace *ns)
110 __shm_init_ns(ns, ids);
114 void shm_exit_ns(struct ipc_namespace *ns)
119 mutex_lock(&shm_ids(ns).mutex);
120 for (i = 0; i <= shm_ids(ns).max_id; i++) {
121 shp = shm_lock(ns, i);
125 do_shm_rmid(ns, shp);
127 mutex_unlock(&shm_ids(ns).mutex);
129 ipc_fini_ids(ns->ids[IPC_SHM_IDS]);
130 kfree(ns->ids[IPC_SHM_IDS]);
131 ns->ids[IPC_SHM_IDS] = NULL;
143 static inline int shm_checkid(struct ipc_namespace *ns,
146 if (ipc_checkid(&shm_ids(ns), &s->shm_perm, id))
151 static inline struct shmid_kernel *shm_rmid(struct ipc_namespace *ns, int id)
153 return (struct shmid_kernel *)ipc_rmid(&shm_ids(ns), id);
156 static inline int shm_addid(struct ipc_namespace *ns, struct shmid_kernel *shp)
158 return ipc_addid(&shm_ids(ns), &shp->shm_perm, ns->shm_ctlmni);
170 shp = shm_lock(sfd->ns, sfd->id);
186 static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp)
188 ns->shm_tot -= (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT;
189 shm_rmid(ns, shp->id);
212 struct ipc_namespace *ns = sfd->ns;
214 mutex_lock(&shm_ids(ns).mutex);
216 shp = shm_lock(ns, sfd->id);
223 shm_destroy(ns, shp);
226 mutex_unlock(&shm_ids(ns).mutex);
284 put_ipc_ns(sfd->ns);
339 static int newseg (struct ipc_namespace *ns, key_t key, int shmflg, size_t size)
348 if (size < SHMMIN || size > ns->shm_ctlmax)
351 if (ns->shm_tot + numpages > ns->shm_ctlall)
390 id = shm_addid(ns, shp);
400 shp->id = shm_buildid(ns, id, shp->shm_perm.seq);
408 ns->shm_tot += numpages;
424 struct ipc_namespace *ns;
426 ns = current->nsproxy->ipc_ns;
428 mutex_lock(&shm_ids(ns).mutex);
430 err = newseg(ns, key, shmflg, size);
431 } else if ((id = ipc_findkey(&shm_ids(ns), key)) == -1) {
435 err = newseg(ns, key, shmflg, size);
439 shp = shm_lock(ns, id);
446 int shmid = shm_buildid(ns, id, shp->shm_perm.seq);
453 mutex_unlock(&shm_ids(ns).mutex);
549 static void shm_get_stat(struct ipc_namespace *ns, unsigned long *rss,
557 for (i = 0; i <= shm_ids(ns).max_id; i++) {
561 shp = shm_get(ns, i);
585 struct ipc_namespace *ns;
593 ns = current->nsproxy->ipc_ns;
605 shminfo.shmmni = shminfo.shmseg = ns->shm_ctlmni;
606 shminfo.shmmax = ns->shm_ctlmax;
607 shminfo.shmall = ns->shm_ctlall;
613 err= shm_ids(ns).max_id;
627 mutex_lock(&shm_ids(ns).mutex);
628 shm_info.used_ids = shm_ids(ns).in_use;
629 shm_get_stat (ns, &shm_info.shm_rss, &shm_info.shm_swp);
630 shm_info.shm_tot = ns->shm_tot;
633 err = shm_ids(ns).max_id;
634 mutex_unlock(&shm_ids(ns).mutex);
649 shp = shm_lock(ns, shmid);
655 if (shmid > shm_ids(ns).max_id)
657 result = shm_buildid(ns, shmid, shp->shm_perm.seq);
659 err = shm_checkid(ns, shp,shmid);
688 shp = shm_lock(ns, shmid);
693 err = shm_checkid(ns, shp,shmid);
744 mutex_lock(&shm_ids(ns).mutex);
745 shp = shm_lock(ns, shmid);
749 err = shm_checkid(ns, shp, shmid);
768 do_shm_rmid(ns, shp);
769 mutex_unlock(&shm_ids(ns).mutex);
779 mutex_lock(&shm_ids(ns).mutex);
780 shp = shm_lock(ns, shmid);
784 err = shm_checkid(ns, shp,shmid);
821 mutex_unlock(&shm_ids(ns).mutex);
847 struct ipc_namespace *ns;
891 ns = current->nsproxy->ipc_ns;
892 shp = shm_lock(ns, shmid);
896 err = shm_checkid(ns, shp,shmid);
930 sfd->ns = get_ipc_ns(ns);
959 mutex_lock(&shm_ids(ns).mutex);
960 shp = shm_lock(ns, shmid);
965 shm_destroy(ns, shp);
968 mutex_unlock(&shm_ids(ns).mutex);