03-26-2019
If you really wanted to do IPC between processes just to count directories, though, shared memory beats pipes IMO. mmap() an anonymous segment, and each fork()ed process will have access to it. Give each child a unique index to mess with so they don't stomp on each other, wait() for each child to quit, and tada.
This User Gave Thanks to Corona688 For This Post:
10 More Discussions You Might Find Interesting
1. HP-UX
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)
Discussion started by: alert0919
3 Replies
2. AIX
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)
Discussion started by: ajaysahoo
1 Replies
3. UNIX for Dummies Questions & Answers
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)
Discussion started by: RRVARMA
3 Replies
4. AIX
How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies
5. Programming
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)
Discussion started by: arunkumar_mca
0 Replies
6. Programming
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)
Discussion started by: beandj
11 Replies
7. Shell Programming and Scripting
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)
Discussion started by: urfrnddpk
3 Replies
8. Shell Programming and Scripting
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)
Discussion started by: harish612
6 Replies
9. UNIX for Dummies Questions & Answers
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)
Discussion started by: aimeet
10 Replies
10. Shell Programming and Scripting
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 DEBIAN
getopt::usaginator
Getopt::Usaginator(3pm) User Contributed Perl Documentation Getopt::Usaginator(3pm)
NAME
Getopt::Usaginator - Conjure up a usage function for your applications
VERSION
version 0.0012
SYNOPSIS
use Getopt::Usaginator <<_END_;
Usage: xyzzy <options>
--derp Derp derp derp
--durp Durp durp durp
-h, --help This usage
_END_
# The 'usage' subroutine is now installed
...
$options = parse_options( @ARGV ); # Not supplied by Usaginator
usage if $options{help}; # Print usage and exit with status 0
if ( ! $options{derp} ) {
# Print warning and usage and exit with status -1
usage "You should really derp";
}
if ( $options{durp} ) {
# Print warning and usage and exit with status 2
usage 2 => "--durp is not ready yet";
}
...
usage 3 # Print usage and exit with status 3
DESCRIPTION
Getopt::Usaginator is a tool for creating a handy usage subroutine for commandline applications
It does not do any option parsing, but is best paired with Getopt::Long or any of the other myriad of option parsers
USAGE
use Getopt::Usaginator <usage>
Install a "usage" subroutine configured with the <usage> text
$code = Getopt::Usaginator->usaginator( <usage> )
Return a subroutine configured with the <usage> text
...
More advanced usage is possible, peek under the hood for more information
perldoc -m Getopt::Usaginator
An example:
use Getopt::Usaginator
# Called with the error
error => sub { ... },
# Called when usage printing is needed
usage => sub { ... },
...
;
An example with Getopt::Long parsing
use Getopt::Usaginator ...
sub run {
my $self = shift;
my @arguments = @_;
usage 0 unless @arguments;
my ( $help );
{
local @ARGV = @arguments;
GetOptions(
'help|h|?' => $help,
);
}
usage 0 if $help;
...
}
AUTHOR
Robert Krimen <robertkrimen@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Robert Krimen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.10.1 2010-06-05 Getopt::Usaginator(3pm)