;( wrapped source-code, try this[Re: pseudo function-call from kernel to

Marcel Lanz (marcel.lanz@ds9.ch)
Tue, 09 Nov 1999 19:12:30 +0100


This is a multi-part message in MIME format.
--------------4C17A0956DDD8B23A336DB20
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

see the attachment

-- 
Marcel Lanz <marcel.lanz@ds9.ch>

PGP-Key fingerprint = 71 BE AC 43 04 53 F9 2D 4F B7 B1 47 E5 9B 91 72 --------------4C17A0956DDD8B23A336DB20 Content-Type: text/plain; charset=us-ascii; name="pseudo" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="pseudo"

-------------- syscall dkmctl ------- #define DKM_MAP_REQ 1 #define DKM_CSD_REG 2 #define DKM_CSD_DEREG 3 #define DKM_DOSIG 4 #define DKM_MAP_RESP 5

pid_t dkm_csd_pid; /*spinlock_t dkm_map_lock = SPIN_LOCK_UNLOCKED;*/

struct semaphore dkm_map_sema = MUTEX; dkm_csd_pid = -1;

asmlinkage int sys_dkmctl(int cmd, void *arg, void *resp) { char* node_name; node_name = (char*) kmalloc(64, GFP_KERNEL); switch(cmd) { case DKM_MAP_REQ: /*spin_lock_irqsave(&dkm_map_lock, flags);*/ down(&dkm_map_sema); copy_to_user((char*)arg, "filename", 9); break; case DKM_MAP_RESP: strncpy_from_user(node_name, arg, strlen_user(arg)); printk("node to name is: %s\n", node_name); /*spin_unlock_irq(&dkm_map_lock);*/ up(&dkm_map_sema); break; case DKM_CSD_REG: dkm_csd_pid = *(int*)arg; break; case DKM_CSD_DEREG: dkm_csd_pid = -1; break; case DKM_DOSIG: if(dkm_csd_pid > 0) force_sig(SIGUSR2, find_task_by_pid(dkm_csd_pid)); break; default: break; } /* switch */

printk("csd_pid is: %d, current->pid is: %d\n", dkm_csd_pid, current->pid); kfree(node_name);

return 0; }

------------------------------ signal-handler:

void on_sigusr2(int signal) { char* node_name; char* buff;

node_name = (char*) malloc(64); buff = (char*) malloc(64);

printf("sigusr2 from kernel reveived\n"); dkmctl(DKM_MAP_REQ, buff, NULL); printf("buff is: %s\n", buff); strcpy(node_name, "orinoco"); dkmctl(DKM_MAP_RESP, node_name);

free(node_name); free(buff); }

--------------4C17A0956DDD8B23A336DB20--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/