- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how to get current process in hpux11 dlkm
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2009 10:50 PM
07-16-2009 10:50 PM
Re: how to get current process in hpux11 dlkm
in the kernel this get the filename from the dnlc, or rebuild it which has no public API because needing multiple locks
The easiest way to do it is to have a daemon process in charge of identifying process pathname.
For instance your dlkm read() ( or a ioctl) could return the pid of current process calling kill, and sleeping to get the answer
then your user process run at rtprio read() the pid and call pstat* to get the pathname,
then write the answer to your dlkm ( with write or ioctl())
I think it is the more easy way to do it.
But again what exactly are you trying to develop? are you in contact with hp partners program? - it is a way sometime to get access to private APIs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2009 11:21 PM
07-16-2009 11:21 PM
Re: how to get current process in hpux11 dlkm
will be changed,so i want to do it in kernel
I haven't contact with hp partners program hp patners program .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2009 11:51 PM
07-16-2009 11:51 PM
Re: how to get current process in hpux11 dlkm
I assume it is preferable to contact with hp partners program.
Regards
Sunny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2009 08:22 AM
07-20-2009 08:22 AM
Re: how to get current process in hpux11 dlkm
it need to use mknod commond to create a character device file.
Is it exist a method that not need to create a new file (such as mknod),can transmit data
from application layer to kernel?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2009 09:19 AM
07-20-2009 09:19 AM
Re: how to get current process in hpux11 dlkm
What problem do you see to have a new node?
your dlkm can create the node itself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2009 11:12 AM
07-20-2009 11:12 AM
Re: how to get current process in hpux11 dlkm
The thread running only in the kernel.
but you need to use copyin/copyout to use the data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2009 06:14 PM
07-20-2009 06:14 PM
Re: how to get current process in hpux11 dlkm
I don't know
In my experiment after make load
bash-4.0# lsdev |grep mymod
96 3 mymod pseudo
I use the mknod commond
#mknod /dev/mytest c 96 0
AT last i write a application program to use ioctl.
"create a new syscall" is replace the system call?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2009 06:36 PM
07-20-2009 06:36 PM
Re: how to get current process in hpux11 dlkm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2009 12:17 AM
07-21-2009 12:17 AM
Re: how to get current process in hpux11 dlkm
- the other being to use vn_create() in your _load function using the c_major field of the drv_info.
the ioctl can be used to start a function which will answer to any request using the same buffer each time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2009 11:49 PM
07-21-2009 11:49 PM
Re: how to get current process in hpux11 dlkm
{
struct test_data {
char buf[16];
uint32_t len;
};
struct test_data *ptr = NULL;
int ret = ESUCCESS;
switch (cmd) {
case CHGR_SSRFC_IS_PRESENT:
ptr = (struct test_data *)arg;
printf("%s:arg addr 0x%lx\n", __FUNCTION__, (uint32_t)(arg));
printf("%s:buf=%s,len=%d\n", __FUNCTION__, ptr->buf, ptr->len);
(void) strcpy(ptr->buf, "TESTIOCLtest");
break;
default:
break;
}
printf("%s: Exit mymod_ioctl \n", __FUNCTION__);
out:
return ret;
}
#include
#include
#include
#include
#include
#include
#include
struct test_data {
char buf[16];
uint32_t len;
};
int main()
{
int fd;
int ret;
struct test_data test;
fd = open("/dev/test", O_RDWR);
if(fd == -1)
perror("open()");
strncpy(test.buf, "hpuxxxx3hp", 16);
test.len = strlen(test.buf);
printf("before ioctl: test.buf=%s,test.len=%d\n", test.buf, test.len);
ret = ioctl(fd, CHGR_SSRFC_IS_PRESENT, &test);
if(ret == -1)
perror("ioctl()");
printf("after ioctl: test.buf=%s,test.len=%d\n", test.buf, test.len);
close(fd);
return 0;
}
bash-4.0# ./ioctl
before ioctl: test.buf=hpuxxxx3hp,test.len=10
after ioctl: test.buf=TESTxxx3hp,test.len=10
#dmesg|grep mymod_ioctl
mymod_ioctl:arg addr 0x49e31040
mymod_ioctl:buf=,len=-16777216
mymod_ioctl: Exit mymod_ioctl
why test data is not correct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2009 12:06 AM
07-22-2009 12:06 AM
Re: how to get current process in hpux11 dlkm
#define CHGR_SSRFC_IS_PRESENT _IOR('X', 1, int)
which define it as needing to copy 1 int from the kernel on ioctl return.
in your case you must define:
struct test_data {
char buf[16];
uint32_t len;
};
#define MYIOCTL _IORW('Z',1,struct test_data)
This will make ioctl to copy your structure to the kernel (W), and back on exit (R) if the return value is 0.
if you want to pass user buffer address to the ioctl then you need to use
_IO('Z',1)
in that case data will point to uarea containing the value directly.
and you need to use copyin()/copyout() to copy to and from data to that buffer. But you will have user space address.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2009 06:01 PM
07-23-2009 06:01 PM
Re: how to get current process in hpux11 dlkm
char buf[16];
uint32_t len;
};
#define MYIOCTL _IORW('Z',1,struct test_data)"
It's work fine
when i replace the test_data structure to
struct test_data {
char *buf;
uint64_t len;
};
I used copyin(arg->buf, tmp, arg->len),but can't get the data .
why the copyin function return a error number 14(Bad address)?
I printf the arg->buf is 0x400051e800000000
In application layer my program ioctl.c printf the addr is 0x400051e8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2009 10:29 PM
07-23-2009 10:29 PM
Re: how to get current process in hpux11 dlkm
so you need first move it to a 64 bit pointer before colling copyin
in fact it depends if your application is a 32bit one or a 64bit one.
so you must do:
struct test_data {
char *buf;
uint64_t len;
};
struct test_data32 {
unsigned int buf;
uint64_t len;
} *arg32;
if (ThisCallis32bit())
{
arg32=arg;
error = copyin(arg32->buf,tmp,arg32->len);
}
why the copyin function return a error number 14(Bad address)?
I printf the arg->buf is 0x400051e800000000
In application layer my program ioctl.c printf the addr is 0x400051e8
just a remark, don't forget to test the len before copyin, else you can garbage the memory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2009 10:33 PM
07-23-2009 10:33 PM
Re: how to get current process in hpux11 dlkm
if you want to be sure you can still do
copyin((unsigned long) arg32->buf,....)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2009 07:07 PM
07-27-2009 07:07 PM
Re: how to get current process in hpux11 dlkm
[30860] |0x0000000000174c30|0x00000064|FUNC |GLOB |0| .text|lookupname
bash-4.0# nm -x /stand/vmunix |grep vn_create
[21615] |0x00000000001998f0|0x0000019c|FUNC |GLOB |0| .text|vn_create
where can i get the man pages for the exported interfaces?, like lookupname/vn_create/proc_pstat_idx_lookup_hold/proc_pstat_lookup_next_hold/proc_release
.
I cannot find these exported interfaces in the DDR.pdf and DDG.pdf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2009 02:38 AM
08-12-2009 02:38 AM
Re: how to get current process in hpux11 dlkm
- « Previous
-
- 1
- 2
- Next »