10-28-2009
Hi.
In perl (and many other scripting languages), printing intermediate values is a useful debugging technique. Setting up a small array and running it through your code will likely illuminate the problem ... cheers, drl
10 More Discussions You Might Find Interesting
1. Programming
Hi folks,
I'm trying to make a reconnection algorithm using rexec(), but I noticed that when rexec() fails returning -1, it is impossible to make it run successfully again until you restart the program or the thread.
Example, I have a endless loop for connection retries, if I supply a wrong... (7 Replies)
Discussion started by: lcmoreno
7 Replies
2. Programming
Hello,
How to execute a call back function after aio_write() or aio_read() in Sun Solaris 5.7?
I have filled the control block struct aiocb as follows:
aio_sigevent.sigev_signo = SIGEV
aio_sigevent.sigev_notify = SIGEV_THREAD
Then I have filled the call back function in ... (0 Replies)
Discussion started by: hmurali
0 Replies
3. Shell Programming and Scripting
I have perl script as follow.
------------------------------------------------------------------------
#! /usr/bin/env perl
use strict;
sub printLines
{
print "Inside the function.............\n";
my (@file , $count , $key ) = $_;
print $count , $ key ; #... (2 Replies)
Discussion started by: avadhani
2 Replies
4. Shell Programming and Scripting
Hi all,
I have to move all the files in a tree directory structure to a single directory. Inorder to know which file is from which directory , i'll have to add the name of the directory to the file name. For this i wrote a recursive function which is as follows... (4 Replies)
Discussion started by: malle
4 Replies
5. Shell Programming and Scripting
Hi All,
What is the problem with the following script:
function mmdd
{
dd=$2
case $1 in
"Jan") mm=01;;
"Feb") mm=02;;
"Mar") mm=03;;
"Apr") mm=04;;
"May") mm=05;;
"Jun") mm=06;;
"Jul") mm=07;;
"Aug") mm=08;;
"Sep") mm=09;;
"Oct") mm=10;;
"Nov") mm=11;;
"Dec") mm=12;;
*)... (3 Replies)
Discussion started by: Hiso
3 Replies
6. Shell Programming and Scripting
Hi,
I had a scripts which calls two function. One function will call another function, script is working fine but the second function is not calling the first function. Below is the script
#!/usr/bin/ksh
fun1() {
echo $DATETIME >> Test1.ksh
return 0
}
fun2() {
typeset DATETIME=`date... (5 Replies)
Discussion started by: somu_june
5 Replies
7. Shell Programming and Scripting
I created two functions that output two random variables. I want to output them in the output file. But it does not seem to work.
# Function rgaussian1(r1, r2)
# Gaussian random number generator
function rgaussian1(r1, r2) {
pi = 3.142
v1 = sqrt( -2 * log(rand()) )
v2... (18 Replies)
Discussion started by: kristinu
18 Replies
8. Solaris
I noticed we have a small splice on end of disk that is not mounted. What could that be and how do we move it few sectors?
Thanks. (7 Replies)
Discussion started by: orange47
7 Replies
9. Shell Programming and Scripting
hey guys, im trying to learn bourne shell atm and I'm having some issues with functions.
so heres my code:
#!/bin/bash
##functions
memory () {
free -m
}
space () {
df -h
}
ip () { (5 Replies)
Discussion started by: hawkfro12
5 Replies
10. Shell Programming and Scripting
I am trying to figure out why I am having a "problem" with some functions in a bash script I am running. The reason for air quoting is that the functions are working, they are just not displaying anything to screen when called from another function. Here's an example:
function Create_Input
{... (6 Replies)
Discussion started by: dagamier
6 Replies
LEARN ABOUT HPUX
vmsplice
VMSPLICE(2) Linux Programmer's Manual VMSPLICE(2)
NAME
vmsplice - splice user pages into a pipe
SYNOPSIS
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <fcntl.h>
#include <sys/uio.h>
ssize_t vmsplice(int fd, const struct iovec *iov,
unsigned long nr_segs, unsigned int flags);
DESCRIPTION
The vmsplice() system call maps nr_segs ranges of user memory described by iov into a pipe. The file descriptor fd must refer to a pipe.
The pointer iov points to an array of iovec structures as defined in <sys/uio.h>:
struct iovec {
void *iov_base; /* Starting address */
size_t iov_len; /* Number of bytes */
};
The flags argument is a bit mask that is composed by ORing together zero or more of the following values:
SPLICE_F_MOVE
Unused for vmsplice(); see splice(2).
SPLICE_F_NONBLOCK
Do not block on I/O; see splice(2) for further details.
SPLICE_F_MORE
Currently has no effect for vmsplice(), but may be implemented in the future; see splice(2).
SPLICE_F_GIFT
The user pages are a gift to the kernel. The application may not modify this memory ever, otherwise the page cache and on-disk data
may differ. Gifting pages to the kernel means that a subsequent splice(2) SPLICE_F_MOVE can successfully move the pages; if this
flag is not specified, then a subsequent splice(2) SPLICE_F_MOVE must copy the pages. Data must also be properly page aligned, both
in memory and length.
RETURN VALUE
Upon successful completion, vmsplice() returns the number of bytes transferred to the pipe. On error, vmsplice() returns -1 and errno is
set to indicate the error.
ERRORS
EAGAIN SPLICE_F_NONBLOCK was specified in flags, and the operation would block.
EBADF fd either not valid, or doesn't refer to a pipe.
EINVAL nr_segs is greater than IOV_MAX; or memory not aligned if SPLICE_F_GIFT set.
ENOMEM Out of memory.
VERSIONS
The vmsplice() system call first appeared in Linux 2.6.17; library support was added to glibc in version 2.5.
CONFORMING TO
This system call is Linux-specific.
NOTES
vmsplice() follows the other vectorized read/write type functions when it comes to limitations on the number of segments being passed in.
This limit is IOV_MAX as defined in <limits.h>. Currently, this limit is 1024.
SEE ALSO
splice(2), tee(2), pipe(7)
COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the
latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
Linux 2017-09-15 VMSPLICE(2)