- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- ioscan -m lun hangs on HP-UX 11.31.1109
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
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
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
03-28-2013 02:18 AM - last edited on 03-28-2013 06:52 PM by Maiko-I
03-28-2013 02:18 AM - last edited on 03-28-2013 06:52 PM by Maiko-I
ioscan -m lun hangs on HP-UX 11.31.1109
I could run /usr/bin/sh -c ioscan -m lun from console, it could get result.
I also get result through function execl("/usr/bin/sh", "sh", "-c", "ioscan -m lun", 0);
While when I call execl with child process, it hangs under SD2 with over 10 file system but it could work in most IA64 machine and it worked before configure with many file system.
Here is source code, any idea?
bool getCmdOutput(std::string& strOutput, const std::string& strCmd) { strOutput = ""; int pipe_fd[2] = {0}; pipe(pipe_fd); pid_t pid = fork(); if (-1 == pid) { return false; // error } if (0 == pid) // child { close(pipe_fd[0]); dup2(pipe_fd[1], STDOUT_FILENO); close(pipe_fd[1]); execl("/usr/bin/sh", "sh", "-c", strCmd.c_str(), 0); exit(0); } else { int stat_loc; wait(&stat_loc); close(pipe_fd[1]); char buffer[BUFFER_SIZE]; memset(buffer, 0, sizeof(buffer)); while(0 < read(pipe_fd[0], buffer, BUFFER_SIZE-1)) strOutput += buffer; close(pipe_fd[0]); } return true; }
P.S. This thread has been moved from HP-UX > System Administration to HP-UX > languages - HP Forums Moderator
- Tags:
- pipe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2013 02:34 AM
03-28-2013 02:34 AM
Re: ioscan -m lun hangs on HP-UX 11.31.1109
here is the information from ioscan core file:
Core was generated by `ioscan'.
#0 0x401f090:0 in _write_sys+0x30 ()
(gdb) bt
#0 0x401f090:0 in _write_sys+0x30 ()
#1 0x401ef90:0 in write+0x1b0 ()
#2 0x401ec20:0 in _xflsbuf+0x220 ()
#3 0x401e910:0 in __fflush_unlocked+0x2d0 ()
#4 0x401e550:0 in do_exitcu+0x50 ()
#5 0x401da40:0 in ___stdio_unsup_1+0x2830 ()
#6 0x401b1d0:0 in _exitcu+0x30 ()
#7 0x401b170:0 in __exit_handler+0x140 ()
#8 0x4077df0:0 in EM_mark_BOS+0x50 ()
(gdb)
Core was generated by `sh'.
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...#0 0x60000000c0369310:0 in _waitpid_sys+0x30 ()
from /usr/lib/hpux32/libc.so.1
(gdb) bt
#0 0x60000000c0369310:0 in _waitpid_sys+0x30 () from /usr/lib/hpux32/libc.so.1
#1 0x60000000c03813e0:0 in waitpid+0x80 () from /usr/lib/hpux32/libc.so.1
#2 0x402b010:0 in job_wait+0x4b0 ()
#3 0x4043c00:0 in xec_switch+0x3fc0 ()
#4 0x403fb90:0 in sh_exec+0x6e0 ()
#5 0x4087b70:0 in exfile+0xc80 ()
#6 0x400ffe0:0 in main+0xc80 ()
(gdb) q
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2013 11:58 AM - edited 03-28-2013 12:09 PM
03-28-2013 11:58 AM - edited 03-28-2013 12:09 PM
Re: ioscan -m lun hangs on HP-UX 11.31.1109 (pipe full)
>I also get result through function execl("/usr/bin/sh", "sh", "-c", "ioscan -m lun", 0);
You shouldn't be calling sh, but invoke ioscan directly. You do need to tokenize the parms.
You have created a deadlock. You are waiting for Godot. :-)
wait(&stat_loc); // the pipe isn't big enough to hold all of the data!
close(pipe_fd[1]);
read the pipe ...
This is in the wrong order, try:
close(pipe_fd[1]);
read the pipe ...
close(pipe_fd[0]);
wait(&stat_loc);