MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /usr/share/systemtap/tapset/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/systemtap/tapset/inet_sock.stp
// inet_sock information tapset 
// Copyright (C) 2006 IBM Corp.
// Copyright (C) 2006 Intel Corporation.
//
// This file is part of systemtap, and is free software.  You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.

%{
#include <linux/version.h>
#include <net/sock.h>
#include <net/tcp.h>
#include <net/ip.h>

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
#define LPORT   (inet->inet.num)
#define DADDR   (&inet->inet.daddr)
#else
#define LPORT   (inet->num)
#define DADDR   (&inet->daddr)
#endif
%}

// Get local port number
function inet_get_local_port:long(sock:long)
%{
	unsigned long ptr = (unsigned long) THIS->sock;
	struct inet_sock *inet = (struct inet_sock *) ptr;
        THIS->__retvalue = deref(sizeof(LPORT), &(LPORT));
        if (0) {
deref_fault:
            CONTEXT->last_error = "pointer dereference fault";
        }
%}

// Get IP source address string
function inet_get_ip_source:string(sock:long)
%{
	unsigned long ptr = (unsigned long) THIS->sock;
	struct inet_sock *inet = (struct inet_sock *) ptr;
	unsigned char addr[4];

	memcpy(addr, DADDR, sizeof(addr));
	sprintf(THIS->__retvalue, "%d.%d.%d.%d",
           addr[0], addr[1],  addr[2], addr[3]);
%}

Anon7 - 2021