If it's saying bad file descriptor it probably means it. Without seeing your actual code, I can't tell why you're closing a bad file descriptor, you should print the FD's to stderr when you open a pipe, and print them to stderr again when you try and close it to see what's going on. But I have some further comments.
fork() is pointless. Disks don't multithread. Forcing it to read 19 directories at once will make your disk run 19 times slower. You already benefit from the caching and read-ahead built into the OS, too.
Second, there's a system function for what you want to do, ftw() It operates depth-first, so every time you see a new second-level folder, you'll know everything afterwards will be within that folder until it leaves.
Last edited by Corona688; 03-26-2019 at 03:18 PM..
how can I find cpu usage memory usage swap usage and
I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times
my final destination is monitor process
logical volume usage above X % and number of Logical voluage above
can I not to... (3 Replies)
Hi,
I am working on AIX 5.3 . I have client-server program which is in ProC.while sending packet to server i am getting error as broken pipe and program exiting.
please help?/? (1 Reply)
Hello,
Could any one help me how to find the Disk Usage for all the files in the running directory and the sub directories without the disk usage of the directory. I mean to say, i need only the file names without the size of the directories.
See, i used this command
du -a .|sort... (3 Replies)
All,
I am using the below code
The C code :
if ((fp2=fopen(szout_fname,"r"))==NULL)
{
sprintf(stream_ptr1,"cat %s | sort -t, -rn -k 11,11 | awk -F\",\" '{ \
if ( \$3 ==\"%s\" ) {print... (0 Replies)
hi guys, o have a big error
in this program but i cant solve
someone ?!
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
int main(int argc, char *argv){
int cont = 2, posicao;
char geraArquivo= "|cat>>", espaco=" ";
char nomeArquivo, comando,... (11 Replies)
Hello
while doing sftp over server "A" , i am getting a broken pipe error i.e
cat: write error: Broken pipe
what does that mean? please let me know if you want any other info on this.. (3 Replies)
Hi ,
I am using below code to list the 6th,7th and 8th field of the file
ls -lrt test | awk '{print $6,$7,$8}'
output:
Nov 21 19:34
Now the problem here is that I want to do it without the usage of pipes as its now allowed in my production environment
Please let me know... (6 Replies)
I'm new to scripting, and this forum has been invaluable in helping me out. I'm hoping I can get some personal help now though.
I have a korn script that takes a list of servers and either telnets or sshs into it (only some are set up for ssh). What I'm doing now is trying to telnet first, and... (10 Replies)
Hi,
I have a script that runs a tar command to standard out then pipes to a gzip:
tar cfE - * | gzip -c > OUT.gz
At the moment, even if the tar fails (e.g. because of lack of disk space), the gzip still runs successfully.
Is there a way to make the whole line exit with a non-zero error... (6 Replies)
Discussion started by: Catullus
6 Replies
LEARN ABOUT SUNOS
usb_pipe_get_state
usb_pipe_get_state(9F) Kernel Functions for Drivers usb_pipe_get_state(9F)NAME
usb_pipe_get_state - Return USB pipe state
SYNOPSIS
#include <sys/usb/usba.h>
int usb_pipe_get_state(usb_pipe_handle_t pipe_handle, usb_pipe_state_t *pipe_state, usb_flags_t usb_flags);
INTERFACE LEVEL
Solaris DDI specific (Solaris DDI)
PARAMETERS
pipe_handle
Handle of the pipe to retrieve the state.
pipe_state
Pointer to where pipe state is returned.
usb_flags
No flags are recognized. Reserved for future expansion.
DESCRIPTION
The usb_pipe_get_state() function retrieves the state of the pipe referred to by pipe_handle into the location pointed to by pipe_state.
Possible pipe states are:
USB_PIPE_STATE_CLOSED
Pipe is closed.
USB_PIPE_STATE_ACTIVE
Pipe is active and can send/receive data. Polling is active for isochronous and interrupt pipes.
USB_PIPE_STATE_IDLE
Polling is stopped for isochronous and interrupt-IN pipes.
USB_PIPE_STATE_ERROR
An error occurred. Client must call usb_pipe_reset(). Note that this status is not seen by a client driver if USB_ATTRS_AUTOCLEARING is
set in the request attributes.
USB_PIPE_STATE_CLOSING
Pipe is being closed. Requests are being drained from the pipe and other cleanup is in progress.
RETURN VALUES
USB_SUCCESS Pipe state returned in second argument.
USB_INVALID_ARGS Pipe_state argument is NULL.
USB_INVALID_PIPE Pipe_handle argument is NULL.
CONTEXT
May be called from user, kernel or interrupt context.
EXAMPLES
usb_pipe_handle_t pipe;
usb_pipe_state_t state;
/* Recover if the pipe is in an error state. */
if ((usb_pipe_get_state(pipe, &state, 0) == USB_SUCCESS) &&
(state == USB_PIPE_STATE_ERROR)) {
cmn_err (CE_WARN, "%s%d: USB Pipe error.",
ddi_driver_name(dip), ddi_get_instance(dip));
do_recovery();
}
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Architecture |PCI-based systems |
+-----------------------------+-----------------------------+
|Interface stability |Evolving |
+-----------------------------+-----------------------------+
|Availability |SUNWusb |
+-----------------------------+-----------------------------+
SEE ALSO attributes(5), usb_clr_feature(9F), usb_get_cfg(9F). usb_get_status(9F), usb_pipe_close(9F), usb_pipe_ctrl_xfer(9F), usb_pipe_open(9F).
usb_pipe_reset(9F)SunOS 5.10 5 Jan 2004 usb_pipe_get_state(9F)