1753486 Members
4299 Online
108794 Solutions
New Discussion юеВ

Re: dlkm compiled error

 
SOLVED
Go to solution
kaijile
Frequent Advisor

dlkm compiled error

I wrote a code on hpux11.11
and compiled the dlkm error

extern struct sysent sysent[];

int my_kill(pid_t pid, int sig)
{
printf( "pid is %d\n", pid );

return kill( pid, sig );
}

int my_load()
{
sysent[SYS_kill].sy_call = &(my_kill);//line 278
return 0;
}

cc: "my_mod.c", line 278: error 1720: Subscript expression must combine object pointer and integer.
cc: "my_mod.c", line 278: error 1529: Cannot select field of non-structure.

why have these errors?


bash-4.0# uname -a
HP-UX rp5470 B.11.11 U 9000/800 142444635 unlimited-user license
7 REPLIES 7
Laurent Menase
Honored Contributor
Solution

Re: dlkm compiled error

where did you get struct sysent definition?
what is your struct sysent definition?
What is you SYS_kill definition?

Usually they are private and not available.
Laurent Menase
Honored Contributor

Re: dlkm compiled error

basically your sysent structure doesn't look to be defined.
Laurent Menase
Honored Contributor

Re: dlkm compiled error

external api exist using
sysent_delete()
sysent_assign_function()
sysent_define_arg()

kaijile
Frequent Advisor

Re: dlkm compiled error

indirect kill system call on HP-UX 11.11i

http://unix.derkeiler.com/Newsgroups/comp.sys.hp.hpux/2003-09/0224.html


bash-4.0# nm /stand/vmunix |grep sysent
[8356] | 9565376| 8|OBJT |LOCAL|0| .rodata|S$414$sysent_link_function
[38471] | 11852496| 8|OBJT |GLOB |0| .data|kload_sysent
[20530] | 12472824| 4|OBJT |GLOB |0| .sdata|nsysent
[35194] | 4311816| 328|FUNC |GLOB |0| .text|patch_sysent_stub
[20577] | 11733352| 4|OBJT |GLOB |0| .data|sysent
[24412] | 4312712| 784|FUNC |GLOB |0| .text|sysent_assign_function
[22214] | 4313960| 452|FUNC |GLOB |0| .text|sysent_complain
[28378] | 4312144| 564|FUNC |GLOB |0| .text|sysent_define_arg
[39319] | 4310184| 472|FUNC |GLOB |0| .text|sysent_delete
[27159] | 4310656| 492|FUNC |GLOB |0| .text|sysent_enable
[38654] | 4310112| 36|FUNC |GLOB |0| .text|sysent_get_function
[26765] | 4310040| 36|FUNC |GLOB |0| .text|sysent_get_name
[26665] | 4310080| 32|FUNC |GLOB |0| .text|sysent_get_narg
[38537] | 4311152| 660|FUNC |GLOB |0| .text|sysent_link_function
[25129] | 4310168| 8|FUNC |GLOB |0| .text|sysent_returns_long
[22001] | 4310152| 8|FUNC |GLOB |0| .text|sysent_returns_pointer
[39362] | 4310176| 8|FUNC |GLOB |0| .text|sysent_returns_range
[27135] | 4310160| 8|FUNC |GLOB |0| .text|sysent_returns_ulong


Dennis Handly
Acclaimed Contributor

Re: dlkm compiled error

>indirect kill system call on 11.11

You can't write C code unless you have a header that defines your variables, types (struct sysent), enums and defines.
Laurent Menase
Honored Contributor

Re: dlkm compiled error

If your purpose is only to get kill printouts there are other solutions.
An HP internal support instrumentation called timer9 exist which traces kill calls.
but it is statically linked.

you can also use ktracer

ktracer -a kill
ktracer -B

ktracedump -D will tell you all kill called on the system.

Also there is an other problem
a syscall have only 1 parameter which is a pointer to the uarea.
kaijile
Frequent Advisor

Re: dlkm compiled error

thanks Laurent Menase & Dennis Handly