Sponsored Content
Top Forums UNIX for Dummies Questions & Answers 'memory corruption' error when using Awk Post 302332525 by kooyee on Thursday 9th of July 2009 10:43:57 AM
Old 07-09-2009
Sorry for late to put code

Code:
BEGIN {
        highest_packet_id = 0;      
}
{
	event = $1;
	time = $2;
	node = $3;
	trace_level = $4;
	packet_type = $7;
	packet_id = $6;

	# record AGT and cbr flow
        if ( trace_level == "AGT"&& packet_type == "cbr"  ) {
		if ( packet_id >=highest_packet_id ) 
			highest_packet_id = packet_id;    
		
		if (event=="s")
		{ 
			if ( start_time[packet_id] == 0 )  
               			start_time[packet_id] = time;
		}

		if (event=="r")
			end_time[packet_id] = time;
		else  
			end_time[packet_id] = -1; 			
         }
}
END {
      for  ( num = 0; num <= highest_packet_id; num++ ) {
        	start = start_time[num];
		end = end_time[num];
		 if ( start < end ) {
	     		delay = end - start;	
                }		             
      }
}

BTW, how can I upload my txt file here. it is about 7MB. thanks

---------- Post updated at 09:43 AM ---------- Previous update was at 09:37 AM ----------

sorted out!Smilie

The txt file can be download from : MEGAUPLOAD - The leading online storage and file delivery service

Last edited by kooyee; 07-09-2009 at 01:39 PM.. Reason: code tags, PLEASE!
 

10 More Discussions You Might Find Interesting

1. Programming

Why does this occur? *** glibc detected *** malloc(): memory corruption: 0x10013ff8 ***

there seems not to be error in this segment. In some computers, it can work well. But in others, it will give a failure. why it ocurrs and how to deal with it? in a function: if( *ver == NULL ) { *ver = (vertex *) malloc(sizeof(vertex)); //this line ... (17 Replies)
Discussion started by: cdbug
17 Replies

2. UNIX for Advanced & Expert Users

Out of Memory error when free memory size is large

I was running a program and it stopped and showed "Out of Memory!". at that time, the RAM used by this process is around 4G and the free memory size of the machine is around 30G. Does anybody know what maybe the reason? this program is written with Perl. the OS of the machine is Solaris U8. And I... (1 Reply)
Discussion started by: lilili07
1 Replies

3. Programming

readdir and dynamic array memory corruption

Hi everyone I am developing an utility. At some part of it I read directory entries to a dynamic array: struct list It stores pointers to items: list.entries, which are structures: struct entry If a number of files in a directory is greater then number of elements an array was initially... (11 Replies)
Discussion started by: torbium
11 Replies

4. Programming

./match_pattern.out: malloc(): memory corruption: 0x0000000013a11600 ***

Hi All, I have a simple code which does some computation by matching string patterns. In brief: 1. The code reads .dat and .txt files. 2. .dat files are huge text files and .txt files contain some important words. 3. I am just doing strstr to find the patterns. 4. The function returns the... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies

5. Programming

*** glibc detected *** ./a.out: malloc(): memory corruption (fast):

*** glibc detected *** ./a.out: malloc(): memory corruption (fast): Posted A minute ago M trying to make multiway tree and dont know what happend when this part of code get executed: 01void ins(NODE *ptr) 02{ 03 //working 04 if(ptr!=NULL) 05 { 06 SNODE *var=NULL; 07 var=(SNODE... (3 Replies)
Discussion started by: exgenome
3 Replies

6. Programming

*** glibc detected *** : malloc(): memory corruption (fast)

Hi Friends, while executing the below code, am getting *** glibc detected *** ./ok: malloc(): memory corruption (fast) error, please suggest how to solve this issue. #include <stdio.h> #include <string.h> #include <sqlca.h> #include <alloca.h> /* Define constants for VARCHAR... (2 Replies)
Discussion started by: mpjobsrch
2 Replies

7. Programming

*** glibc detected *** ./a.out malloc() memory corruption

I am facing a problem of memory corruption. The loop runs for the first time but does not go through the second time. What could be the problem? for(int z=0;z<2;z++) { fp=fopen("poly.dat","r"); /*do something which reads this file into a 2D array*/ fclose(fp); ... (10 Replies)
Discussion started by: dare
10 Replies

8. Solaris

Solaris 10 Shared Memory Corruption with X11

I am having a problem with shared memory corruption. I have two 86 servers running Solaris 10 (150400-06). One of the servers is accessed by a Sun Ray thin client Version 11.1.3.0.2.6. I login into server one from the thin client. I then ssh -X to server two. When a process that contains a... (2 Replies)
Discussion started by: salerno
2 Replies

9. Programming

Memory corruption in dynamic array of strings

I put together a C function to add strings to a dynamic array of strings (mostly for educational purpose to explain pointers to my kid). It works, but sometimes one or two strings in the array becomes corrupted. Running example on 64 bit Ubuntu, gcc ver. 4.8.4 Hope my code is self-explanatory: ... (2 Replies)
Discussion started by: migurus
2 Replies

10. Solaris

Solaris 11.2 x86 Local Zones for Oracle RAC database, intermittent Memory corruption of db

Hi, I was wondering if any Solaris fellow out there has dealt with running Solaris 11 x86 on Local Zones for Oracle RAC (which may or may not be relevant to issue), running on HP gen h/w. Every so often could be weeks between issues or some times days, there will be a memory corruption and db... (2 Replies)
Discussion started by: crossmypath
2 Replies
IPQ_MESSAGE_TYPE(3)					     Linux Programmer's Manual					       IPQ_MESSAGE_TYPE(3)

NAME
ipq_message_type, ipq_get_packet, ipq_getmsgerr -- query queue messages SYNOPSIS
#include <linux/netfilter.h> #include <libipq.h> int ipq_message_type(const unsigned char *buf); ipq_packet_msg_t *ipq_get_packet(const unsigned char *buf); int ipq_get_msgerr(const unsigned char *buf); DESCRIPTION
The ipq_message_type function returns the type of queue message returned to userspace via ipq_read. ipq_message_type should always be called following a successful call to ipq_read to determine whether the message is a packet message or an error message. The buf parameter should be the same data obtained from the previous call to ipq_read. ipq_message_type will return one of the following values: NLMSG_ERROR An error message generated by the Netlink transport. IPQM_PACKET A packet message containing packet metadata and optional packet payload data. The ipq_get_packet function should be called if ipq_message_type returns IPQM_PACKET. The buf parameter should point to the same data used for the call to ipq_message_type. The pointer returned by ipq_get_packet points to a packet message, which is declared as follows: typedef struct ipq_packet_msg { unsigned long packet_id; /* ID of queued packet */ unsigned long mark; /* Netfilter mark value */ long timestamp_sec; /* Packet arrival time (seconds) */ long timestamp_usec; /* Packet arrvial time (+useconds) */ unsigned int hook; /* Netfilter hook we rode in on */ char indev_name[IFNAMSIZ]; /* Name of incoming interface */ char outdev_name[IFNAMSIZ]; /* Name of outgoing interface */ unsigned short hw_protocol; /* Hardware protocol (network order) */ unsigned short hw_type; /* Hardware type */ unsigned char hw_addrlen; /* Hardware address length */ unsigned char hw_addr[8]; /* Hardware address */ size_t data_len; /* Length of packet data */ unsigned char payload[0]; /* Optional packet data */ } ipq_packet_msg_t; Each of these fields may be read by the application. If the queue mode is IPQ_COPY_PACKET and the data_len value is greater than zero, the packet payload contents may be accessed in the memory following the ipq_packet_msg_t structure to a range of data_len. The packet_id field contains a packet identifier to be used when calling ipq_set_verdict. The ipq_get_msgerr function should be called if ipq_message_type returns NLMSG_ERROR. The buf parameter should point to the same data used for the call to ipq_message_type. The value returned by ipq_get_msgerr is set by higher level kernel code and corresponds to standard errno values. BUGS
None known. AUTHOR
James Morris <jmorris@intercode.com.au> COPYRIGHT
Copyright (c) 2000-2001 Netfilter Core Team. Distributed under the GNU General Public License. SEE ALSO
iptables(8), libipq(3). Linux iptables 1.2 16 October 2001 IPQ_MESSAGE_TYPE(3)
All times are GMT -4. The time now is 12:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy