HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how to tell which file is the kernel that is runni...
Operating System - HP-UX
1833234
Members
2738
Online
110051
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
06-10-2003 02:23 PM
06-10-2003 02:23 PM
Re: how to tell which file is the kernel that is running
bill a little further information.
as I stated previously, in this test I have 3 kernel files vmunix, vmunix.prev, and vm. When I said kmpath returned nothing i was booted with /stand/vm as the kernel.
kmpath does return the correct kernel file if the system is booted from vmunix or vmunix.prev.
as I stated previously, in this test I have 3 kernel files vmunix, vmunix.prev, and vm. When I said kmpath returned nothing i was booted with /stand/vm as the kernel.
kmpath does return the correct kernel file if the system is booted from vmunix or vmunix.prev.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2003 08:45 PM
06-10-2003 08:45 PM
Re: how to tell which file is the kernel that is running
here is a short C program to return the boot_string from the running kernel.
1) being I'm not a C programmer, so I'll accept suggestions for improvements.
2)
a) how would i implement the ioctl statement if I had defined FILE *fp; instead of int fp; and used fopen and fclose. ie ioctl takes an int fildes.
b) how do you assign values using a pointer to a structure, ie how would you correctly do what I was trying to do in the comments.
3) my boot string is disk(8/0/19/0.6.0.0.0.0.0;0)/stand/vmunix. in C code how would i just get the "/stand/vmunix" portion.
#include
#include
#include
#include
int main(void){
struct mioc_rksym abc, *rks = &abc;
char buf[1024];
int fp;
if (( fp = open("/dev/kmem",O_RDONLY)) == NULL ) {
printf("kmem could not be opened\n);
exit(1);
}
abc.mirk_modname=NULL;
abc.mirk_sysname="boot_string";
abc.mirk_buf=buf;
abc.mirk_buflen=1023;
/*
rks->mirk_modename=NULL;
rks->mirk_sysname="boot_string";
rks->mirk_buf=buf;
rks->mirk_buflen=1023;
*/
if ( ioctl( fp, MIOC_READKSYM, *rks) != 0 ) {
perror("ioctl");
return -1;
}
printf("%s"\n",rks->mirk_buf);
if (close(fp) == EOF)
printf("kmem could not be closed\n");
}
to compile
cc file.c -o ofile
1) being I'm not a C programmer, so I'll accept suggestions for improvements.
2)
a) how would i implement the ioctl statement if I had defined FILE *fp; instead of int fp; and used fopen and fclose. ie ioctl takes an int fildes.
b) how do you assign values using a pointer to a structure, ie how would you correctly do what I was trying to do in the comments.
3) my boot string is disk(8/0/19/0.6.0.0.0.0.0;0)/stand/vmunix. in C code how would i just get the "/stand/vmunix" portion.
#include
#include
#include
#include
int main(void){
struct mioc_rksym abc, *rks = &abc;
char buf[1024];
int fp;
if (( fp = open("/dev/kmem",O_RDONLY)) == NULL ) {
printf("kmem could not be opened\n);
exit(1);
}
abc.mirk_modname=NULL;
abc.mirk_sysname="boot_string";
abc.mirk_buf=buf;
abc.mirk_buflen=1023;
/*
rks->mirk_modename=NULL;
rks->mirk_sysname="boot_string";
rks->mirk_buf=buf;
rks->mirk_buflen=1023;
*/
if ( ioctl( fp, MIOC_READKSYM, *rks) != 0 ) {
perror("ioctl");
return -1;
}
printf("%s"\n",rks->mirk_buf);
if (close(fp) == EOF)
printf("kmem could not be closed\n");
}
to compile
cc file.c -o ofile
- « Previous
-
- 1
- 2
- Next »
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP