public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* IPC subsystem
@ 2003-07-09 10:06 Frederick, Fabian
  2003-07-09 18:18 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Frederick, Fabian @ 2003-07-09 10:06 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 437 bytes --]

Hi,
	I'm trying to port the ipc stuff to work as a subsystem in order to
have sysfs outputs (/sysfs/ipc/sem {,shm,msg} ) .
	Output I have is an early oops (which is not reported in /var/log
...)

	It seems the ipc stuff init begins before kobject stuff or something
?

"EIP is at sysfs_create_dir

<0>kernel panic : attempted to kill the idle task!
"

Here is my patch attached + complete files

Someone could help ?

Regards,
Fabian




[-- Attachment #2: ipc2.diff --]
[-- Type: application/octet-stream, Size: 3557 bytes --]

diff -Naur ipc/shm.c ./../linux-2.5.74ff1/ipc/shm.c
--- ipc/shm.c	2003-07-02 22:48:07.000000000 +0200
+++ ./../linux-2.5.74ff1/ipc/shm.c	2003-07-07 22:32:45.000000000 +0200
@@ -13,6 +13,7 @@
  * Shared /dev/zero support, Kanoj Sarcar <kanoj@sgi.com>
  * Move the mm functionality over to mm/shmem.c, Christoph Rohland <cr@sap.com>
  *
+ * /sys/ipc support (c) 2003 Fabian Frédérick<ffrederick@users.sourceforge.net>
  */
 
 #include <linux/config.h>
@@ -27,7 +28,8 @@
 #include <linux/shmem_fs.h>
 #include <linux/security.h>
 #include <asm/uaccess.h>
-
+#include <linux/kobject.h>
+#include <linux/kobj_map.h>
 #include "util.h"
 
 #define shm_flags	shm_perm.mode
@@ -62,6 +64,9 @@
 #ifdef CONFIG_PROC_FS
 	create_proc_read_entry("sysvipc/shm", 0, 0, sysvipc_shm_read_proc, NULL);
 #endif
+	shm_ids.kobj.parent = &ipc_subsys.kset.kobj;	
+	sprintf(shm_ids.kobj.name, "%s", "shm");
+	kobject_register(&shm_ids.kobj);
 }
 
 static inline int shm_checkid(struct shmid_kernel *s, int id)
@@ -234,6 +239,10 @@
 	return error;
 }
 
+/* Create a shared memory segment with given size and flags
+ * Returns negative result in case of failure
+ */
+
 asmlinkage long sys_shmget (key_t key, size_t size, int shmflg)
 {
 	struct shmid_kernel *shp;
diff -Naur ipc/util.c ./../linux-2.5.74ff1/ipc/util.c
--- ipc/util.c	2003-07-02 22:46:12.000000000 +0200
+++ ./../linux-2.5.74ff1/ipc/util.c	2003-07-07 22:32:10.000000000 +0200
@@ -24,6 +24,7 @@
 #include <linux/security.h>
 #include <linux/rcupdate.h>
 #include <linux/workqueue.h>
+#include <linux/kobject.h>
 
 #if defined(CONFIG_SYSVIPC)
 
@@ -35,9 +36,10 @@
  *	The various system5 IPC resources (semaphores, messages and shared
  *	memory are initialised
  */
- 
 void __init ipc_init (void)
 {
+	sprintf(ipc_subsys.kset.kobj.name, "%s", "ipc");
+	subsystem_register(&ipc_subsys);
 	sem_init();
 	msg_init();
 	shm_init();
@@ -196,6 +198,8 @@
 	rcu_read_lock();
 	spin_lock(&new->lock);
 	ids->entries[id].p = new;
+	kobject_register(&ids->entries[id].kobj);
+	
 	return id;
 }
 
@@ -432,12 +436,12 @@
  * So far only shm_get_stat() calls ipc_get() via shm_get(), so ipc_get()
  * is called with shm_ids.sem locked.  Since grow_ary() is also called with
  * shm_ids.sem down(for Shared Memory), there is no need to add read 
- * barriers here to gurantee the writes in grow_ary() are seen in order 
+ * barriers here to guarantee the writes in grow_ary() are seen in order 
  * here (for Alpha).
  *
- * However ipc_get() itself does not necessary require ipc_ids.sem down. So
+ * However ipc_get() itself does not necessarily require ipc_ids.sem down. So
  * if in the future ipc_get() is used by other places without ipc_ids.sem
- * down, then ipc_get() needs read memery barriers as ipc_lock() does.
+ * down, then ipc_get() needs read memory barriers as ipc_lock() does.
  */
 struct kern_ipc_perm* ipc_get(struct ipc_ids* ids, int id)
 {
diff -Naur ipc/util.h ./../linux-2.5.74ff1/ipc/util.h
--- ipc/util.h	2003-07-02 22:49:13.000000000 +0200
+++ ./../linux-2.5.74ff1/ipc/util.h	2003-07-07 22:32:11.000000000 +0200
@@ -7,6 +7,7 @@
 #define USHRT_MAX 0xffff
 #define SEQ_MULTIPLIER	(IPCMNI)
 
+static struct subsystem ipc_subsys;
 void sem_init (void);
 void msg_init (void);
 void shm_init (void);
@@ -19,9 +20,11 @@
 	unsigned short seq_max;
 	struct semaphore sem;	
 	struct ipc_id* entries;
+	struct kobject kobj;
 };
 
 struct ipc_id {
+	struct kobject kobj;
 	struct kern_ipc_perm* p;
 };
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-07-09 18:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-09 10:06 IPC subsystem Frederick, Fabian
2003-07-09 18:18 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox