Hi, all,

        Would you please have a look to the following code for me? This code has no 
compile error, but it will get an error message "unresolved symbol sys_semctl". I 
don't know why.

/* gcc -c -Wall test.c*/ 
  
  
#define __KERNEL__ 
 #define MODULE 
  
 #include <linux/module.h> 
 #include <linux/kernel.h> 
  
#include <linux/string.h> 
#include <linux/types.h> 
#include <linux/ipc.h> 
#include <linux/sem.h> 
#include <linux/slab.h> /*kmalloc(), kfree()*/ 
#include <linux/stat.h> 
  
#include <asm/types.h> 
#include <asm/ipc.h> 
#include <asm/uaccess.h> 
#include <asm/semaphore.h> 
  
key_t ftok(path, id) 
        const char *path; 
        char id; 
{ 
        struct stat st; 
  
/*      if (stat(path, &st) < 0) 
                return (key_t)-1;*/ 
  
        return (key_t) (id << 24 | (st.st_dev & 0xff) << 16 | (st.st_ino & 0xfff 
)); 
} 

init_module()
{
        int i;
        int AgentLock;
    union semun options;
        key_t MyKey = ftok( ".", "xyz" );
        AgentLock = sys_semget( MyKey, 5, IPC_CREAT | IPC_EXCL );

    options.val = 1;
    for( i = 0; i < 5; i++ )
        sys_semctl( AgentLock, i, SETVAL, options );
}      


                                 
               Jiangbo
               [EMAIL PROTECTED]
                                        2002-11-28 



_______________________________________________
Redhat-devel-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

Reply via email to