system command returns 32512

unix

    Sponsored Links

    Next

  • 1. slhs.dev.obj
    Where can I get this? Thanks, Tim
  • 2. Striped disks in AIX 5.3
    Hi, I'm a newbie in AIX 5.3, I have 2 disks in a Pserver and I want to create a RAID 0 (not RAID10 and not mirroring) including 2 disks in a striped volume to gain more space. Can someone to help me to create this striping volume during the AIX installation or after installation? is it from the smitty tool? Thanks a lot for your help, Imad

system command returns 32512

Postby kiranhiremath » Fri, 20 Jan 2006 22:01:37 GMT

Hi,

I am executing a C program in AIX 4.3 machine.

The program sends email with the body redirected from a file.
I use mailx command ( sendmail utility ) in AIX.
The code has following lines:

########################
char *str = "mailx -s hi -c  XXXX@XXXXX.COM   XXXX@XXXXX.COM  < test.txt"

rc = system(str);

#########################

I execute this in a loop for many times.
For example, if i execute it for 10 times then 1-2 mails are not sent.
The return from system command for these 2-3 failed mails is 32512

I printed value of rc and it showed that rc=32512.
The mailx command was not invoked.
I saw in some groups, they have mentioned that the return 32512 is
because the exec of the child process failed.

I want to know the reason why the exec of the child process failed.
I have verified that the number of processes is not exceding the system
limit.
Can anyone please tell me the root cause of this return 32512.

Thanks and Regards
Kiran Hiremath


Re: system command returns 32512

Postby Dan Foster » Fri, 20 Jan 2006 22:31:10 GMT




32512 divided by 256 is 127... so it sounds like EOVERFLOW.

(grep 127 /usr/include/errno.h)

What is the size of file.txt? And the size of the target user's mailbox?

Is there any entry in 'errpt' for the problem?

Is the machine at 4.3.3 and fully patched?

-Dan

Re: system command returns 32512

Postby kiranhiremath » Fri, 20 Jan 2006 23:01:36 GMT

Hi Dan,

I checked the file size and it is just 90 bytes.
And what is the entry 'errpt'. where can i find it.
I could see that when the system caommand failed, the mailx command was
not triggerred.
The target mailbox has a very huge size.
Also please not, some mailx commands which have a bigger file as a body
are executed successfully.

Also please let me know which are the patches which should be
installed.
What does the Error Number EOVERFLOW indicate?

Thanks and Regards
Kiran


Re: system command returns 32512

Postby Dan Foster » Fri, 20 Jan 2006 23:06:47 GMT



It's a command. For example:

# /usr/sbin/errpt | more

But may not be needed.


Ahh! Is the target mailbox at least 2,147,483,648 bytes?

If it is 2 GB or more, mailx will fail.

I would guess maybe because mailx could be written to only handle signed
32-bit numbers for file I/O access, or related to non-big files JFS.

So when the value is too big to fit in the off_t data type, you get the
overflow error (errno number 127).

Solution: reduce target user's mailbox size to less than 2 GB.

-Dan

Re: system command returns 32512

Postby kiranhiremath » Fri, 20 Jan 2006 23:17:49 GMT

Hi Dan,

The target user mailbox size is 50 MB.
The system command forks a child process and then it calls the exec
command.
I think the exec command is failing.
Can it be due to any memory error? For example current process memory
usage.
Do you have any idea on this?

Thanks 
Kiran


Re: system command returns 32512

Postby Dan Foster » Fri, 20 Jan 2006 23:32:52 GMT



Ahh. Hmm. Guess that's not a problem, then.


# /usr/bin/errpt | grep VMM

That will report if there were any virtual memory-related failures
logged.

-Dan

Re: system command returns 32512

Postby kiranhiremath » Sat, 21 Jan 2006 16:19:08 GMT

Hi Dan,
Actaully my code is as follows:

################################################################

  length = strlen(to) + strlen(from) + strlen(replyto) + strlen(cc) +
strlen(subject);
  mailcommand = (char*)malloc(length + 128);

   strcpy(mailcommand,"mailx -s \'");
   strcat(mailcommand,subject);
   strcat(mailcommand,"\' ");
   strcat(mailcommand,"-c \"");
   strcat(mailcommand,cc);
   strcat(mailcommand,"\" ");
   strcat(mailcommand,"-r \"");
   strcat(mailcommand,replyto);
   strcat(mailcommand,"\" ");
   strcat(mailcommand,"\"");
   strcat(mailcommand,to);
   strcat(mailcommand,"\"");
   strcat(mailcommand," ");

   strcat(mailcommand,"< ");
   strcat(mailcommand,tmpfilename);
   strcat(mailcommand,"\n");

  system(mailcommand);

  free(mailcommand);

#######################################################
The tmpfilename is the file which contains body.

Do you think there is any memory leak or any such thing here ?

Thanks and Regards
Kiran


Re: system command returns 32512

Postby Laurenz Albe » Sat, 21 Jan 2006 18:25:22 GMT



I cannot see a memory leak.
The '\n' at the end of the command is superfluous, but I don't think that
is the problem (since you say it occurs only sometimes).

Here's what the manual has to say about system(2) return values:

 Return Values

 Upon successful completion, the system subroutine returns the exit status
 of the shell. The exit status of the shell is returned in the same manner
 as a call to the wait or waitpid subroutine, using the structures in the
 sys/wait.h file.

 If the String parameter is a null pointer and a command processor is
 available, the system subroutine returns a nonzero value. If the fork
 subroutine fails or if the exit status of the shell cannot be obtained,
 the system subroutine returns a value of -1. If the exec l subroutine
 fails, the system subroutine returns a value of 127. In all cases, the
 errno global variable is set to indicate the error.

What I would do in your place is change the code for debugging purposes:

#include <errno.h>
#include <string.h>
#include <stdio.h>

...

int rc;

...

rc = system(mailcommand);
printf("Executed command \"%s\", got return code %d, errno = %d (%s)\n",
       mailcommand, rc, errno, strerror(errno));

Then let it run and examine the output. Share your observations!

Yours,
Laurenz Albe

Re: system command returns 32512

Postby Jeff Herrick » Sun, 22 Jan 2006 00:13:25 GMT






You need to include a sizeof() operator in your call to malloc. Your
current code assumes a character is one byte in size when most
likely you're dealing with either 32 bytes or 64 bytes per char i.e.

mailcommand = (char *)malloc(sizeof(char)*length+128)

This may not be your actual problem, but sloppy code like that will
come back and bite you at some point.

Cheers

JH

Re: system command returns 32512

Postby Laurenz Albe » Sun, 22 Jan 2006 01:18:11 GMT



As far as I know, the ANSI standard requires sizeof(char) to be 1.

Yours,
Laurenz Albe

Re: system command returns 32512

Postby Jeff Herrick » Sun, 22 Jan 2006 02:08:32 GMT






Not sure of leakage but you could eliminate the overhead of 15 strcat()
calls with one call to sprintf()  =8-)

Also, you don't add the length of your tempfilename to the command
buffer length....I guess that's what the extra 128 bytes is for?

How do you arrive at the 32512 value if you're not saving the
system() function's return value?

Cheers

JH

Re: system command returns 32512

Postby Jeff Herrick » Sun, 22 Jan 2006 04:31:06 GMT






You are correct, I hit send too fast and I was confusing bytes with
word size =8-0

Cheers

JH

Re: system command returns 32512

Postby kiranhiremath » Tue, 24 Jan 2006 17:13:07 GMT

Hi,

my code is as follows:

##################################

rc = system(mailcommand);

if ( rc != 0)
        printf("Return from system command is RC=%d",rc);

###################################

mailcommand = (char*)malloc(length + 128);

In this command, i add 128 just to have little extra memory for single
quotes , double quotes, mailx options spaces etc.

Do you mean that :
sizeof(char) = 1 in 32 bit system
sizeof(char) = 2 in 64 bit system
How much will this affect my code?

For 20 runs of this code, I have 2-3 emails missing.
I am worried why other emails were recieved and only some emails
failed.

When I reboot the system, an run the code, then all the emails are
recieved successfully.
After 4-5 runs of my code again the missing email problem arises.

Any idea !!!!

Thanks and Regards
Kiran Hiremath


Re: system command returns 32512

Postby Laurenz Albe » Tue, 24 Jan 2006 17:36:32 GMT



No, what I wrote and what I meant is:

sizeof(char) is always equal to 1. You can rely on that.
So your code is correct.


In a previous post, I told you how I would debug this.
Did you try it? What is the output?

Yours,
Laurenz Albe

Re: system command returns 32512

Postby kiranhiremath » Tue, 24 Jan 2006 23:22:44 GMT

Hi,

This mail function is a small part of an application which I have
developed.
The application changes password of the user in some domain and sends
email to the email id to inform the changed password.
This mail function is executed for every user. When I execute this for
about 15 users, 12-13 emails are sent and some 2-3 emails are not sent
When I reboot the system, an run the code, then all the emails are
recieved successfully.
After 4-5 runs of my code again the missing email problem arises.
I put some logs and found out that the system command was returning
32512.
The mailx command in the system command was not invoked.
So there is no issue in mailx command. The issue is some memory
problem.
So I just pasted the code, for you to identify the issue.
Do you think, dynamic memory allocation ( malloc ) should be changed by
static memory allocation.?
Example:
                            char mailcommand[1024] = "";
If I do so, what affect will it do to my code.

I hope you understand the scenario now.

Thanks and Regards
Kiran Hiremath


Similar Threads:

1.Port 32512 DNS queries

When I monitor the UDP packets sent to my Linux box, I find it is flooded 
with replies from DNS servers to queries (inverse look-ups on the IP 
addresses of the DNS servers listed in /etc/resolv.conf) issued from port 
32512 on my machine. Does anyone know of a Linux client process that runs 
from port 32512? The flood of messages starts as soon as I log on. I don't 
have to start any client apps other than Terminal windows. Nothing is listed 
against 32512 in /etc/services and I can't find any information on Google.

Thanks in advance



2.In some cases the system command is returning with -1 even it succeded

Any One can you explanation why this is happening .
In the below program
In some cases the system command is returning with -1 even the command
in the system call had succeded

To have a look i am attaching strace out put also
to be clear u can search for XX in the strace output from that point u
can make some thing .....


you can compile with these flags

gcc -Wall -W -O2 systembug.c  -lpthread

Senario Explanation :

Actual behavior
system
thread 1
blocking of SIG_CHLD
(system())
waitpid()thread            ;
            ;            ........thread 2
            ;         childexit exit_group(0)
            ;
waitpid of system returned
 with child procees pid ...                  ;
                                                      ;
                                                      ;
                                                     thread3
                                         ------- signal handler
                                                 {
                                            while(waitpid(NOHUNG)>0)
(return with -1 and ECHILD)
                                                   {

                                                   }
                                            }
waitpid of system call returns success  with pid of the system call's
child process
After this signal handler was called and waitpid in the signal handler
returned with failure
(This is how i need but in some cases its works like below)


system
thread 1
blocking of SIG_CHLD
(system())
waitpid()thread
                        ........thread 2
                     childexit exit_group(0)            thread3
                                                         ------- signal
handler
                                                            {

while(waitpid(NOHUNG)>0)

 {
                                                                      }


}
waitpid of system call returns(with failure) because the waitpid in the
signal handler was returned with pid of the system call's child process

so the system calls wait pid will return with -1 and errno ECHILD





#include<signal.h>
#include <errno.h>
#include <wait.h>
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <stdlib.h>


void signalHandler(int i);
void *thread1(void *);

void *thread1(void *arg)
{

   while(1)
     sleep(1);

  return arg;
}

int main()
{
 int ret =-1;
 int res =-1;
 pthread_t th;

 res = pthread_create (&th, NULL, thread1, NULL);
 if (res)
 {
     printf ("pthread_create failed %d\n", res);
 }

 signal(SIGCHLD,signalHandler);
 ret = system("ls systembug.c");
 printf("XX the retval  %d errno %d \n",ret,errno);

 return 1;
}

void signalHandler(int signal)
{
   int stat = 0;
   int pid = 0;
   printf("Caught the signal \n");
   while ((pid = waitpid(-1, &stat, WNOHANG)) > 0)
   {
          printf("Child process exited signum  %d\n",signal);
   }
}


STRACE OUTPUT

3333  execve("./a.out", ["./a.out"], [/* 61 vars */]) = 0
3333  uname({sys="Linux", node="WS29P191", ...}) = 0
3333  brk(0)                            = 0x804a000
3333  open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or

directory)
3333  old_mmap(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40017000
3333  open("/etc/ld.so.cache", O_RDONLY) = 3
3333  fstat64(3, {st_mode=S_IFREG|0644, st_size=106111, ...}) = 0
3333  old_mmap(NULL, 106111, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40018000

3333  close(3)                          = 0
3333  open("/lib/tls/libpthread.so.0", O_RDONLY) = 3
3333  read(3,
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\360I\0"..., 512) = 512

3333  fstat64(3, {st_mode=S_IFREG|0755, st_size=88272, ...}) = 0
3333  old_mmap(NULL, 65004, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) =
0x40032000
3333  madvise(0x40032000, 65004, MADV_SEQUENTIAL|0x1) = 0
3333  old_mmap(0x4003f000, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED, 3, 0xd000) = 0x4003f000
3333  old_mmap(0x40040000, 7660, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40040000
3333  close(3)                          = 0
3333  open("/lib/tls/libc.so.6", O_RDONLY) = 3
3333  read(3,
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@S\1\000"..., 512) =
512
3333  fstat64(3, {st_mode=S_IFREG|0755, st_size=1345545, ...}) = 0
3333  old_mmap(NULL, 1128748, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) =

0x40042000
3333  madvise(0x40042000, 1128748, MADV_SEQUENTIAL|0x1) = 0
3333  old_mmap(0x4014b000, 32768, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED, 3, 0x109000) = 0x4014b000
3333  old_mmap(0x40153000, 10540, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40153000
3333  close(3)                          = 0
3333  old_mmap(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40156000
3333  set_thread_area({entry_number:-1 -> 6, base_addr:0x40156080,
limit:1048575, seg_32bit:1, contents:0, read_exec_only:0,
limit_in_pages:1, seg_not_present:0, useable:1}) = 0
3333  munmap(0x40018000, 106111)        = 0
3333  set_tid_address(0x401560c8)       = 3333
3333  rt_sigaction(SIGRTMIN, {0x40036950, [], SA_SIGINFO}, NULL, 8) = 0

3333  rt_sigprocmask(SIG_UNBLOCK, [RTMIN], NULL, 8) = 0
3333  getrlimit(RLIMIT_STACK, {rlim_cur=RLIM_INFINITY,
rlim_max=RLIM_INFINITY}) = 0
3333  _sysctl({{CTL_KERN, KERN_VERSION}, 2, 0xbfffef28, 35, (nil), 0})
= 0
3333  mmap2(NULL, 2101248, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40157000
3333  brk(0)                            = 0x804a000
3333  brk(0x806b000)                    = 0x806b000
3333  brk(0)                            = 0x806b000
3333  mprotect(0x40157000, 4096, PROT_NONE) = 0
3333  clone(child_stack=0x40357b08,
flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSE|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,

parent_tidptr=0x40357bf8, {entry_number:6, base_addr:0x40357bb0,
limit:1048575, seg_32bit:1, contents:0, read_exec_only:0,
limit_in_pages:1, seg_not_present:0, useable:1},
child_tidptr=0x40357bf8) = 3343
3333  rt_sigaction(SIGCHLD, {0x8048614, [CHLD], SA_RESTART}, {SIG_DFL},

8) = 0
3333  rt_sigaction(SIGINT, {SIG_IGN}, {SIG_IGN}, 8) = 0
3333  rt_sigaction(SIGQUIT, {SIG_IGN}, {SIG_IGN}, 8) = 0
3343  rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
3343  rt_sigaction(SIGCHLD, NULL, {0x8048614, [CHLD], SA_RESTART}, 8) =

0
3343  rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
3343  nanosleep({1, 0},  <unfinished ...>
3333  rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
3333  clone(child_stack=0, flags=CLONE_PARENT_SETTID|SIGCHLD,
parent_tidptr=0xbffff024) = 3350
3333  waitpid(3350,  <unfinished ...>
3350  rt_sigaction(SIGINT, {SIG_IGN}, NULL, 8) = 0
3350  rt_sigaction(SIGQUIT, {SIG_IGN}, NULL, 8) = 0
3350  rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
3350  execve("/bin/sh", ["sh", "-c", "ls systembug.c"], [/* 61 vars
*/]) = 0
3350  uname({sys="Linux", node="WS29P191", ...}) = 0
3350  brk(0)                            = 0x80bb000
3350  open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or

directory)
3350  old_mmap(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40017000
3350  open("/etc/ld.so.cache", O_RDONLY) = 3
3350  fstat64(3, {st_mode=S_IFREG|0644, st_size=106111, ...}) = 0
3350  old_mmap(NULL, 106111, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40018000

3350  close(3)                          = 0
3350  open("/lib/libreadline.so.4", O_RDONLY) = 3
3350  read(3,
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\200\260"..., 512) =
512
3350  fstat64(3, {st_mode=S_IFREG|0755, st_size=176736, ...}) = 0
3350  old_mmap(NULL, 178420, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) =
0x40032000
3350  madvise(0x40032000, 178420, MADV_SEQUENTIAL|0x1) = 0
3350  old_mmap(0x40059000, 16384, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED, 3, 0x27000) = 0x40059000
3350  old_mmap(0x4005d000, 2292, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4005d000
3350  close(3)                          = 0
3350  open("/lib/libhistory.so.4", O_RDONLY) = 3
3350  read(3,
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@\30\0\000"..., 512) =
512
3350  fstat64(3, {st_mode=S_IFREG|0755, st_size=24828, ...}) = 0
3350  old_mmap(NULL, 27568, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) =
0x4005e000
3350  madvise(0x4005e000, 27568, MADV_SEQUENTIAL|0x1) = 0
3350  old_mmap(0x40064000, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED, 3, 0x5000) = 0x40064000
3350  close(3)                          = 0
3350  open("/lib/libncurses.so.5", O_RDONLY) = 3
3350  read(3,
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\360\362"..., 512) =
512
3350  fstat64(3, {st_mode=S_IFREG|0755, st_size=316468, ...}) = 0
3350  old_mmap(NULL, 280780, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) =
0x40065000
3350  madvise(0x40065000, 280780, MADV_SEQUENTIAL|0x1) = 0
3350  old_mmap(0x4009e000, 45056, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED, 3, 0x38000) = 0x4009e000
3350  old_mmap(0x400a9000, 2252, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x400a9000
3350  close(3)                          = 0
3350  open("/lib/libdl.so.2", O_RDONLY) = 3
3350  read(3,
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`\33\0\000"..., 512) =
512
3350  fstat64(3, {st_mode=S_IFREG|0755, st_size=13647, ...}) = 0
3350  old_mmap(NULL, 8628, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) =
0x400aa000
3350  madvise(0x400aa000, 8628, MADV_SEQUENTIAL|0x1) = 0
3350  old_mmap(0x400ac000, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED, 3, 0x2000) = 0x400ac000
3350  close(3)                          = 0
3350  open("/lib/tls/libc.so.6", O_RDONLY) = 3
3350  read(3,
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@S\1\000"..., 512) =
512
3350  fstat64(3, {st_mode=S_IFREG|0755, st_size=1345545, ...}) = 0
3350  old_mmap(NULL, 1128748, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) =

0x400ad000
3350  madvise(0x400ad000, 1128748, MADV_SEQUENTIAL|0x1) = 0
3350  old_mmap(0x401b6000, 32768, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED, 3, 0x109000) = 0x401b6000
3350  old_mmap(0x401be000, 10540, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x401be000
3350  close(3)                          = 0
3350  old_mmap(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x401c1000
3350  set_thread_area({entry_number:-1 -> 6, base_addr:0x401c1640,
limit:1048575, seg_32bit:1, contents:0, read_exec_only:0,
limit_in_pages:1, seg_not_present:0, useable:1}) = 0
3350  munmap(0x40018000, 106111)        = 0
3350  rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
3350  open("/dev/tty", O_RDWR|O_NONBLOCK|O_LARGEFILE) = 3
3350  close(3)                          = 0
3350  brk(0)                            = 0x80bb000
3350  brk(0x80dc000)                    = 0x80dc000
3350  brk(0)                            = 0x80dc000
3350  open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE) = -1

ENOENT (No such file or directory)
3350  open("/usr/share/locale/locale.alias", O_RDONLY) = 3
3350  fstat64(3, {st_mode=S_IFREG|0644, st_size=2528, ...}) = 0
3350  mmap2(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40018000
3350  read(3, "# Locale name alias data base.\n#"..., 4096) = 2528
3350  read(3, "", 4096)                 = 0
3350  close(3)                          = 0
3350  munmap(0x40018000, 4096)          = 0
3350  open("/usr/lib/locale/en_US.UTF-8/LC_IDENTIFICATION", O_RDONLY) =

-1 ENOENT (No such file or directory)
3350  open("/usr/lib/locale/en_US.utf8/LC_IDENTIFICATION", O_RDONLY) =
3
3350  fstat64(3, {st_mode=S_IFREG|0644, st_size=365, ...}) = 0
3350  mmap2(NULL, 365, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40018000
3350  close(3)                          = 0
3350  open("/usr/lib/gconv/gconv-modules.cache", O_RDONLY) = 3
3350  fstat64(3, {st_mode=S_IFREG|0644, st_size=21512, ...}) = 0
3350  mmap2(NULL, 21512, PROT_READ, MAP_SHARED, 3, 0) = 0x40019000
3350  close(3)                          =

3.Command to return system time as an integer value

2004-03-30, 15:02(-07), Andrew Falanga:
> Is there a command that will return the system time as an integral 
> value?

awk 'BEGIN{srand();print srand()}'

or with some date implementations:

date +%s

Without a subprocess (what does that mean for a shell script?!),
you'd need zsh:

zmodload zsh/datetime
echo $EPOCHSECONDS

or:

print -P '%D{%s}'
(you may need to have a strftime providing %s)

-- 
Sthane                      ["Stephane.Chazelas" at "free.fr"]

4.getprocs returns info which is different then which ps command returns

Greetings All,
If I run ps -e -o pid,vsz,args the value for vsz is different then what
getprocs returns.
More specifically, the psinfo structure references pr_size.  This
should correspond to
vsz -- process image size.  Also, is it possible to retrieve the pcpu,
and pmem attributes from getprocs as well?

Many Thanx in Advance

5.command injection in system command

Hi Everybody,  I have developed a shell to allow specific commands.
thought of using system command to execute the user input given, but
cant use system command due to command injection problem. Is there any
way out? Like by using exec or something else? How do I achieve the
same result without the injection, security issue?

Thanks  a lot,
zix

6. mail command option for return address on linux

7. How to get the return code from a Unix command in Cobol

8. Check return codes of the "-exec" option of the "find" command



Return to unix

 

Who is online

Users browsing this forum: No registered users and 37 guest