diff options
author | Tim Moore <timoore@redhat.com> | 2009-12-23 09:14:02 +0100 |
---|---|---|
committer | Tim Moore <timoore@redhat.com> | 2009-12-23 09:14:02 +0100 |
commit | 69ce6c79dbcb2cec2d1245935ef20bf832ffe70a (patch) | |
tree | 0b6aea71ef4f3ca5c797494d062819bfba63e7f7 /tapset | |
parent | 72195f6b17c0ed2e508c58bf3cadd5b9dc4e28ac (diff) | |
parent | 0ee3adb42f2f6d8bffe177e77a415b3a74f3a777 (diff) | |
download | systemtap-steved-69ce6c79dbcb2cec2d1245935ef20bf832ffe70a.tar.gz systemtap-steved-69ce6c79dbcb2cec2d1245935ef20bf832ffe70a.tar.xz systemtap-steved-69ce6c79dbcb2cec2d1245935ef20bf832ffe70a.zip |
Merge remote branch 'origin/master'
Diffstat (limited to 'tapset')
-rw-r--r-- | tapset/inet_sock.stp | 8 | ||||
-rw-r--r-- | tapset/ip.stp | 8 | ||||
-rw-r--r-- | tapset/memory.stp | 266 | ||||
-rw-r--r-- | tapset/scsi.stp | 133 | ||||
-rw-r--r-- | tapset/tcp.stp | 8 | ||||
-rw-r--r-- | tapset/tcpmib.stp | 16 |
6 files changed, 421 insertions, 18 deletions
diff --git a/tapset/inet_sock.stp b/tapset/inet_sock.stp index 33de9775..3962f5a1 100644 --- a/tapset/inet_sock.stp +++ b/tapset/inet_sock.stp @@ -16,7 +16,11 @@ function inet_get_local_port:long(sock:long) %(kernel_v < "2.6.11" %? port = @cast(sock, "inet_sock", "kernel")->inet->num; %: +%(kernel_v < "2.6.33" %? port = @cast(sock, "inet_sock", "kernel")->num; +%: + port = @cast(sock, "inet_sock", "kernel")->inet_num; +%) %) return port; } @@ -27,7 +31,11 @@ function inet_get_ip_source:string(sock:long) %(kernel_v < "2.6.11" %? daddr = @cast(sock, "inet_sock", "kernel")->inet->daddr; %: +%(kernel_v < "2.6.33" %? daddr = @cast(sock, "inet_sock", "kernel")->daddr; +%: + daddr = @cast(sock, "inet_sock", "kernel")->inet_daddr; +%) %) return daddr_to_string(daddr); } diff --git a/tapset/ip.stp b/tapset/ip.stp index 299d88d2..ec17b7c0 100644 --- a/tapset/ip.stp +++ b/tapset/ip.stp @@ -26,13 +26,21 @@ function ip_ntop:string (addr:long) /* return the source IP address for a given sock */ function __ip_sock_saddr:long (sock:long) { +%(kernel_v < "2.6.33" %? return @cast(sock, "inet_sock")->saddr +%: + return @cast(sock, "inet_sock")->inet_saddr +%) } /* return the destination IP address for a given sock */ function __ip_sock_daddr:long (sock:long) { +%(kernel_v < "2.6.33" %? return @cast(sock, "inet_sock")->daddr +%: + return @cast(sock, "inet_sock")->inet_daddr +%) } /* Get the IP header for recent (> 2.6.21) kernels */ diff --git a/tapset/memory.stp b/tapset/memory.stp index c6d3ec8f..3f44f9df 100644 --- a/tapset/memory.stp +++ b/tapset/memory.stp @@ -195,3 +195,269 @@ probe vm.brk = kernel.function("do_brk") { probe vm.oom_kill = kernel.function("__oom_kill_task") { task = $p } + +function __gfp_flag_str:string(gfp_flag:long) %{ + long gfp_flag = THIS->gfp_flag; + THIS->__retvalue[0] = '\0'; + + +/* Macro for GFP Bitmasks. */ +/* The resulted GFP_FLAGS may be either single or concatenation of the multiple bitmasks. */ + + +#define __GFP_BITMASKS(FLAG) if(gfp_flag & FLAG) { if(THIS->__retvalue[0] != '\0') \ + strlcat(THIS->__retvalue, " | "#FLAG, MAXSTRINGLEN); \ + else strlcat(THIS->__retvalue, #FLAG, MAXSTRINGLEN); } + + +/* Macro for Composite Flags. */ +/* Each Composite GFP_FLAG is the combination of multiple bitmasks. */ + + +#define __GFP_COMPOSITE_FLAG(FLAG) if(gfp_flag == FLAG) { \ + strlcat(THIS->__retvalue, #FLAG, MAXSTRINGLEN); return; } + + +/* Composite GFP FLAGS of the BitMasks. */ + + __GFP_COMPOSITE_FLAG(GFP_ZONEMASK) + __GFP_COMPOSITE_FLAG(GFP_ATOMIC) + __GFP_COMPOSITE_FLAG(GFP_NOIO) + __GFP_COMPOSITE_FLAG(GFP_NOFS) + __GFP_COMPOSITE_FLAG(GFP_KERNEL) + __GFP_COMPOSITE_FLAG(GFP_TEMPORARY) + __GFP_COMPOSITE_FLAG(GFP_USER) + __GFP_COMPOSITE_FLAG(GFP_HIGHUSER) + __GFP_COMPOSITE_FLAG(GFP_HIGHUSER_MOVABLE) + __GFP_COMPOSITE_FLAG(GFP_THISNODE) + __GFP_COMPOSITE_FLAG(GFP_DMA) + __GFP_COMPOSITE_FLAG(GFP_DMA32) + +/* GFP BitMasks */ + + __GFP_BITMASKS(__GFP_DMA) + __GFP_BITMASKS(__GFP_HIGHMEM) + __GFP_BITMASKS(__GFP_MOVABLE) + __GFP_BITMASKS(__GFP_WAIT) + __GFP_BITMASKS(__GFP_HIGH) + __GFP_BITMASKS(__GFP_IO) + __GFP_BITMASKS(__GFP_FS) + __GFP_BITMASKS(__GFP_COLD) + __GFP_BITMASKS(__GFP_NOWARN) + __GFP_BITMASKS(__GFP_REPEAT) + __GFP_BITMASKS(__GFP_NOFAIL) + __GFP_BITMASKS(__GFP_COMP) + __GFP_BITMASKS(__GFP_ZERO) + __GFP_BITMASKS(__GFP_NOMEMALLOC) + __GFP_BITMASKS(__GFP_HARDWALL) + __GFP_BITMASKS(__GFP_THISNODE) + __GFP_BITMASKS(__GFP_RECLAIMABLE) + __GFP_BITMASKS(__GFP_NOTRACK) + + +#undef __GFP_BITMASKS +#undef __GFP_COMPOSITE_FLAG +%} + +/* The Formal Parameters will be displayed if available, otherwise \ + "0" or "unknown" will be displayed */ + +probe __vm.kmalloc.tp = kernel.trace("kmalloc") { + name = "kmalloc" + call_site = $call_site + caller_function = symname(call_site) + bytes_req = $bytes_req + bytes_alloc = $bytes_alloc + gfp_flags = $gfp_flags + gfp_flag_name = __gfp_flag_str($gfp_flags) + ptr = $ptr +} + +/* It is unsafe to invoke __builtin_return_address() \ +presently(to get call_site for kprobe based probes) \ +and that it can be improved later when fix for bugs bz#6961 and bz#6580 is available. */ + +probe __vm.kmalloc.kp = kernel.function("kmalloc").return { + name = "kmalloc" + call_site = 0 + caller_function = "unknown" + bytes_req = $size + bytes_alloc = "unknown" + gfp_flags = $gfp_flags + gfp_flag_name = __gfp_flag_str($gfp_flags) + ptr = $return +} + +/** + * probe vm.kmalloc - Fires when kmalloc is requested. + * @call_site: Address of the kmemory function. + * @caller_function: Name of the caller function. + * @bytes_req: Requested Bytes + * @bytes_alloc: Allocated Bytes + * @gfp_flags: type of kmemory to allocate + * @gfp_flag_name: type of kmemory to allocate (in String format) + * @ptr: Pointer to the kmemory allocated + */ +probe vm.kmalloc = __vm.kmalloc.tp !, + __vm.kmalloc.kp +{} + + +probe __vm.kmem_cache_alloc.tp = kernel.trace("kmem_cache_alloc") { + name = "kmem_cache_alloc" + call_site = $call_site + caller_function = symname(call_site) + bytes_req = $bytes_req + bytes_alloc = $bytes_alloc + gfp_flags = $gfp_flags + gfp_flag_name = __gfp_flag_str($gfp_flags) + ptr = $ptr +} + +probe __vm.kmem_cache_alloc.kp = kernel.function("kmem_cache_alloc").return { + name = "kmem_cache_alloc" + call_site = 0 + caller_function = "unknown" + bytes_req = $size + bytes_alloc = "unknown" + gfp_flags = $gfp_flags + gfp_flag_name = __gfp_flag_str($gfp_flags) + ptr = $return +} + +/** + * probe vm.kmem_cache_alloc - Fires when \ + * kmem_cache_alloc is requested. + * @call_site: Address of the function calling this kmemory function. + * @caller_function: Name of the caller function. + * @bytes_req: Requested Bytes + * @bytes_alloc: Allocated Bytes + * @gfp_flags: type of kmemory to allocate + * @gfp_flag_name: Type of kmemory to allocate(in string format) + * @ptr: Pointer to the kmemory allocated + */ + +probe vm.kmem_cache_alloc = __vm.kmem_cache_alloc.tp !, + __vm.kmem_cache_alloc.kp +{} + +probe __vm.kmalloc_node.tp = kernel.trace("kmalloc_node")? { + name = "kmalloc_node" + call_site = $call_site + caller_function = symname(call_site) + bytes_req = $bytes_req + bytes_alloc = $bytes_alloc + gfp_flags = $gfp_flags + gfp_flag_name = __gfp_flag_str($gfp_flags) + ptr = $ptr +} + +probe __vm.kmalloc_node.kp = kernel.function("kmalloc_node").return? { + name = "kmalloc_node" + call_site = 0 + caller_function = "unknown" + bytes_req = $size + bytes_alloc = "unknown" + gfp_flags = $gfp_flags + gfp_flag_name = __gfp_flag_str($gfp_flags) + ptr = $return +} + +/** + * probe vm.kmalloc_node - Fires when kmalloc_node is requested. + * @call_site: Address of the function caling this kmemory function. + * @caller_function: Name of the caller function. + * @bytes_req: Requested Bytes + * @bytes_alloc: Allocated Bytes + * @gfp_flags: type of kmemory to allocate + * @gfp_flag_name: Type of kmemory to allocate(in string format) + * @ptr: Pointer to the kmemory allocated + */ +probe vm.kmalloc_node = __vm.kmalloc_node.tp !, + __vm.kmalloc_node.kp +{} + +probe __vm.kmem_cache_alloc_node.tp = kernel.trace("kmem_cache_alloc_node")? { + name = "kmem_cache_alloc_node" + call_site = $call_site + caller_function = symname(call_site) + bytes_req = $bytes_req + bytes_alloc = $bytes_alloc + gfp_flags = $gfp_flags + gfp_flag_name = __gfp_flag_str($gfp_flags) + ptr = $ptr +} + +probe __vm.kmem_cache_alloc_node.kp = kernel.function("kmem_cache_alloc_node").return? { + name = "kmem_cache_alloc_node" + call_site = 0 + caller_function = "unknown" + bytes_req = $size + bytes_alloc = "unknown" + gfp_flags = $gfp_flags + gfp_flag_name = __gfp_flag_str($gfp_flags) + ptr = $return +} + +/** + * probe vm.kmem_cache_alloc_node - Fires when \ + * kmem_cache_alloc_node is requested. + * @call_site: Address of the function calling this kmemory function. + * @caller_function: Name of the caller function. + * @bytes_req: Requested Bytes + * @bytes_alloc: Allocated Bytes + * @gfp_flags: type of kmemory to allocate + * @gfp_flag_name: Type of kmemory to allocate(in string format) + * @ptr: Pointer to the kmemory allocated + */ +probe vm.kmem_cache_alloc_node = __vm.kmem_cache_alloc_node.tp !, + __vm.kmem_cache_alloc_node.kp +{} + + +probe __vm.kfree.tp = kernel.trace("kfree") { + name = "kfree" + call_site = $call_site + caller_function = symname(call_site) + ptr = $ptr +} + +probe __vm.kfree.kp = kernel.function("kfree").return { + name = "kfree" + call_site = 0 + caller_function = "unknown" + ptr = $return +} + +/** + * probe vm.kfree - Fires when kfree is requested. + * @call_site: Address of the function calling this kmemory function. + * @caller_function: Name of the caller function. + * @ptr: Pointer to the kmemory allocated which is returned by kmalloc + */ +probe vm.kfree = __vm.kfree.tp !, + __vm.kfree.kp +{} + +probe __vm.kmem_cache_free.tp = kernel.trace("kmem_cache_free") { + name = "kmem_cache_free" + call_site = $call_site + caller_function = symname(call_site) + ptr = $ptr +} +probe __vm.kmem_cache_free.kp = kernel.function("kmem_cache_free").return { + name = "kmem_cache_free" + call_site = 0 + caller_function = "unknown" + ptr = $return +} +/** + * probe vm.kmem_cache_free - Fires when \ + * kmem_cache_free is requested. + * @call_site: Address of the function calling this kmemory function. + * @caller_function: Name of the caller function. + * @ptr: Pointer to the kmemory allocated which is returned by kmem_cache + */ +probe vm.kmem_cache_free = __vm.kmem_cache_free.tp !, + __vm.kmem_cache_free.kp +{} diff --git a/tapset/scsi.stp b/tapset/scsi.stp index f1090231..0b2d94a0 100644 --- a/tapset/scsi.stp +++ b/tapset/scsi.stp @@ -1,12 +1,12 @@ // scsi tapset -// Copyright (C) 2005, 2006 IBM Corp. +// Copyright (C) 2005, 2006, 2009 IBM Corp. // // 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. // <tapsetdescription> -// This family of probe points is used to probe SCSI activities. +// This family of probe points is used to probe SCSI activities. // </tapsetdescription> %{ #include <linux/types.h> @@ -17,13 +17,38 @@ #include <linux/blkdev.h> %} +function describe_data_direction:string(state:long) +%{ /* pure */ + switch ((long)THIS->state) { + case DMA_BIDIRECTIONAL: strlcpy(THIS->__retvalue, "BIDIRECTIONAL", MAXSTRINGLEN); break; + case DMA_TO_DEVICE: strlcpy(THIS->__retvalue, "TO_DEVICE", MAXSTRINGLEN); break; + case DMA_FROM_DEVICE: strlcpy(THIS->__retvalue, "FROM_DEVICE", MAXSTRINGLEN); break; + case DMA_NONE: strlcpy(THIS->__retvalue, "NONE", MAXSTRINGLEN); break; + default: strlcpy(THIS->__retvalue, "[INVALID]", MAXSTRINGLEN); + } +%} + +function describe_device_state:string(state:long) +%{ /* pure */ + switch ((long)THIS->state) { + case SDEV_CREATED: strlcpy(THIS->__retvalue, "CREATED", MAXSTRINGLEN); break; + case SDEV_RUNNING: strlcpy(THIS->__retvalue, "RUNNING", MAXSTRINGLEN); break; + case SDEV_CANCEL: strlcpy(THIS->__retvalue, "CANCEL", MAXSTRINGLEN); break; + case SDEV_DEL: strlcpy(THIS->__retvalue, "DEL", MAXSTRINGLEN); break; + case SDEV_QUIESCE: strlcpy(THIS->__retvalue, "QUIESCE", MAXSTRINGLEN); break; + case SDEV_OFFLINE: strlcpy(THIS->__retvalue, "OFFLINE", MAXSTRINGLEN); break; + case SDEV_BLOCK: strlcpy(THIS->__retvalue, "BLOCK", MAXSTRINGLEN); break; + case SDEV_CREATED_BLOCK: strlcpy(THIS->__retvalue, "CREATED_BLOCK", MAXSTRINGLEN); break; + default: strlcpy(THIS->__retvalue, "[INVALID]", MAXSTRINGLEN); + } +%} /** * probe scsi.ioentry - Prepares a SCSI mid-layer request * @disk_major: The major number of the disk (-1 if no information) * @disk_minor: The minor number of the disk (-1 if no information) - * @device_state: The current state of the device. + * @device_state: The current state of the device + * @device_state_str: The current state of the device, as a string */ -// FIXME describe the device_state probe scsi.ioentry = module("scsi_mod").function("scsi_prep_fn@drivers/scsi/scsi_lib.c")!, kernel.function("scsi_prep_fn@drivers/scsi/scsi_lib.c")? @@ -36,6 +61,7 @@ probe scsi.ioentry disk_minor = $req->rq_disk->first_minor } device_state = get_devstate_from_req($q) + device_state_str = describe_device_state(device_state) req_addr = $req } @@ -45,24 +71,27 @@ probe scsi.ioentry * @channel: The channel number * @lun: The lun number * @dev_id: The scsi device id - * @device_state: The current state of the device. - * @data_direction: The data_direction specifies whether this command is from/to the device. + * @device_state: The current state of the device + * @device_state_str: The current state of the device, as a string + * @data_direction: The data_direction specifies whether this command is from/to the device * 0 (DMA_BIDIRECTIONAL), 1 (DMA_TO_DEVICE), * 2 (DMA_FROM_DEVICE), 3 (DMA_NONE) + * @data_direction_str: Data direction, as a string * @request_buffer: The request buffer address - * @req_bufflen: The request buffer length + * @request_bufflen: The request buffer length */ probe scsi.iodispatching = module("scsi_mod").function("scsi_dispatch_cmd@drivers/scsi/scsi.c")!, kernel.function("scsi_dispatch_cmd@drivers/scsi/scsi.c")? { - host_no = $cmd->device->host->host_no channel = $cmd->device->channel lun = $cmd->device->lun dev_id = $cmd->device->id device_state = $cmd->device->sdev_state + device_state_str = describe_device_state(device_state) data_direction = $cmd->sc_data_direction + data_direction_str = describe_data_direction(data_direction) %( kernel_v >= "2.6.25" %? request_buffer = $cmd->sdb->table->sgl request_bufflen = $cmd->sdb->length @@ -74,14 +103,16 @@ probe scsi.iodispatching } /** - * probe scsi.iodone - SCSI command completed by low level driver and enqueued into the done queue. + * probe scsi.iodone - SCSI command completed by low level driver and enqueued into the done queue. * @host_no: The host number * @channel: The channel number * @lun: The lun number * @dev_id: The scsi device id * @device_state: The current state of the device + * @device_state_str: The current state of the device, as a string * @data_direction: The data_direction specifies whether this command is * from/to the device. + * @data_direction_str: Data direction, as a string */ probe scsi.iodone = module("scsi_mod").function("scsi_done@drivers/scsi/scsi.c")!, @@ -93,7 +124,9 @@ probe scsi.iodone lun = $cmd->device->lun dev_id = $cmd->device->id device_state = $cmd->device->sdev_state + device_state_str = describe_device_state(device_state) data_direction = $cmd->sc_data_direction + data_direction_str = describe_data_direction(data_direction) req_addr = $cmd->request scsi_timer_pending = scsi_timer_pending($cmd); } @@ -105,9 +138,11 @@ probe scsi.iodone * @lun: The lun number * @dev_id: The scsi device id * @device_state: The current state of the device + * @device_state_str: The current state of the device, as a string * @data_direction: The data_direction specifies whether this command is from/to * the device - * @goodbytes: The bytes completed. + * @data_direction_str: Data direction, as a string + * @goodbytes: The bytes completed */ // mid-layer processes the completed IO probe scsi.iocompleted @@ -119,23 +154,25 @@ probe scsi.iocompleted lun = $cmd->device->lun dev_id = $cmd->device->id device_state = $cmd->device->sdev_state + device_state_str = describe_device_state(device_state) data_direction = $cmd->sc_data_direction + data_direction_str = describe_data_direction(data_direction) req_addr = $cmd->request goodbytes = $good_bytes } function scsi_timer_pending:long(var:long) %{ /* pure */ - struct scsi_cmnd *cmd = (struct scsi_cmnd *)((long)THIS->var); + struct scsi_cmnd *cmd = (struct scsi_cmnd *)((long)THIS->var); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) - THIS->__retvalue = timer_pending(&cmd->eh_timeout); /* FIXME: deref hazard! */ + THIS->__retvalue = timer_pending(&cmd->eh_timeout); /* FIXME: deref hazard! */ #else - struct request *req; - struct request_queue *rq; - req = (struct request *)kread(&cmd->request); - rq = (struct request_queue *)kread(&req->q); - THIS->__retvalue = timer_pending(&rq->timeout); /* FIXME: deref hazard! */ - CATCH_DEREF_FAULT(); + struct request *req; + struct request_queue *rq; + req = (struct request *)kread(&cmd->request); + rq = (struct request_queue *)kread(&req->q); + THIS->__retvalue = timer_pending(&rq->timeout); /* FIXME: deref hazard! */ + CATCH_DEREF_FAULT(); #endif %} @@ -144,3 +181,63 @@ function get_devstate_from_req:long(var:long) sdev = @cast(var, "request_queue", "kernel:scsi_mod")->queuedata return @cast(sdev, "scsi_device", "kernel:scsi_mod")->sdev_state } + +/** + * probe scsi.ioexecute - Create mid-layer SCSI request and wait for the result + * @host_no: The host number + * @channel: The channel number + * @lun: The lun number + * @dev_id: The scsi device id + * @device_state: The current state of the device + * @device_state_str: The current state of the device, as a string + * @data_direction: The data_direction specifies whether this command is + * from/to the device. + * @data_direction_str: Data direction, as a string + * @request_buffer: The data buffer address + * @request_bufflen: The data buffer buffer length + * @timeout: Request timeout in seconds + * @retries: Number of times to retry request + */ +probe scsi.ioexecute + = module("scsi_mod").function("scsi_execute@drivers/scsi/scsi_lib.c")!, + kernel.function("scsi_execute@drivers/scsi/scsi_lib.c")? +{ + host_no = $sdev->host->host_no + channel = $sdev->channel + lun = $sdev->lun + dev_id = $sdev->id + device_state = $sdev->sdev_state + device_state_str = describe_device_state(device_state) + data_direction = $data_direction + data_direction_str = describe_data_direction(data_direction) + request_buffer = $buffer + request_bufflen = $bufflen + timeout = $timeout + retries = $retries +} + +/** + * probe scsi.set_state - Order SCSI device state change + * @host_no: The host number + * @channel: The channel number + * @lun: The lun number + * @dev_id: The scsi device id + * @old_state: The current state of the device + * @old_state_str: The current state of the device, as a string + * @state: The new state of the device + * @state_str: The new state of the device, as a string + */ +probe scsi.set_state + = module("scsi_mod").function("scsi_device_set_state@drivers/scsi/scsi_lib.c")!, + kernel.function("scsi_device_set_state@drivers/scsi/scsi_lib.c")? +{ + state = $state + state_str = describe_device_state(state) + + host_no = $sdev->host->host_no + channel = $sdev->channel + lun = $sdev->lun + dev_id = $sdev->id + old_state = $sdev->sdev_state + old_state_str = describe_device_state(old_state) +} diff --git a/tapset/tcp.stp b/tapset/tcp.stp index 2c5dce7e..094161c9 100644 --- a/tapset/tcp.stp +++ b/tapset/tcp.stp @@ -76,7 +76,11 @@ function tcp_ts_get_info_state:long(sock:long) /* return the TCP destination port for a given sock */ function __tcp_sock_dport:long (sock:long){ +%(kernel_v < "2.6.33" %? return @cast(sock, "inet_sock")->dport +%: + return @cast(sock, "inet_sock")->inet_dport +%) } /* returns the TCP header for recent (<2.6.21) kernel */ @@ -145,7 +149,11 @@ function __tcp_skb_dport:long (tcphdr){ /* return the TCP source port for a given sock */ function __tcp_sock_sport:long (sock:long){ +%(kernel_v < "2.6.33" %? return @cast(sock, "inet_sock")->sport +%: + return @cast(sock, "inet_sock")->inet_sport +%) } global sockstate[13], sockstate_init_p diff --git a/tapset/tcpmib.stp b/tapset/tcpmib.stp index aba7837b..cfaaf9c7 100644 --- a/tapset/tcpmib.stp +++ b/tapset/tcpmib.stp @@ -53,7 +53,11 @@ function tcpmib_get_state:long (sk:long) function tcpmib_local_addr:long(sk:long) %{ /* pure */ struct inet_sock *inet = (struct inet_sock *) (long) THIS->sk; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) + THIS->__retvalue = ntohl(kread(&(inet->inet_saddr))); +#else THIS->__retvalue = ntohl(kread(&(inet->saddr))); +#endif CATCH_DEREF_FAULT(); %} @@ -67,7 +71,11 @@ function tcpmib_local_addr:long(sk:long) function tcpmib_remote_addr:long(sk:long) %{ /* pure */ struct inet_sock *inet = (struct inet_sock *) (long) THIS->sk; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) + THIS->__retvalue = ntohl(kread(&(inet->inet_daddr))); +#else THIS->__retvalue = ntohl(kread(&(inet->daddr))); +#endif CATCH_DEREF_FAULT(); %} @@ -81,7 +89,11 @@ function tcpmib_remote_addr:long(sk:long) function tcpmib_local_port:long(sk:long) %{ /* pure */ struct inet_sock *inet = (struct inet_sock *) (long) THIS->sk; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) + THIS->__retvalue = ntohs(kread(&(inet->inet_sport))); +#else THIS->__retvalue = ntohs(kread(&(inet->sport))); +#endif CATCH_DEREF_FAULT(); %} @@ -95,7 +107,11 @@ function tcpmib_local_port:long(sk:long) function tcpmib_remote_port:long(sk:long) %{ /* pure */ struct inet_sock *inet = (struct inet_sock *) (long) THIS->sk; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) + THIS->__retvalue = ntohs(kread(&(inet->inet_dport))); +#else THIS->__retvalue = ntohs(kread(&(inet->dport))); +#endif CATCH_DEREF_FAULT(); %} |