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/conversions.stp
// conversions tapset
// Copyright (C) 2005, 2006 Red Hat Inc.
//
// 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.

function kernel_string:string (addr:long) %{ /* pure */
  char *destination = THIS->__retvalue;
  deref_string (destination, THIS->addr, MAXSTRINGLEN);
  goto success;
deref_fault: /* branched to from deref() */
  {
    static char errmsg[40];
    snprintf (errmsg, 40, "kernel string copy fault at 0x%p",
	 (void *) (uintptr_t) THIS->addr);
    CONTEXT->last_error = errmsg;
  }
success: ;
%}


// On rare cases when userspace data is not accessible, 
// this function returns "<unknown>"

function user_string:string (addr:long) %{ /* pure */
  if (_stp_strncpy_from_user (THIS->__retvalue, 
		(const char __user*) (uintptr_t) THIS->addr,
		MAXSTRINGLEN) < 0)
	strlcpy (THIS->__retvalue, "<unknown>", MAXSTRINGLEN);
%}

function user_string2:string (addr:long, err_msg:string) %{ /* pure */
  if (_stp_strncpy_from_user (THIS->__retvalue, 
		(const char __user*) (uintptr_t) THIS->addr,
		MAXSTRINGLEN) < 0)
    strlcpy (THIS->__retvalue, THIS->err_msg, MAXSTRINGLEN);
%}

function user_string_warn:string (addr:long) %{ /* pure */
  long rc = _stp_strncpy_from_user (THIS->__retvalue,
		(const char __user*) (uintptr_t) THIS->addr, MAXSTRINGLEN);
  if (rc < 0) {
	static char errmsg[40];
	snprintf (errmsg, 40, "user string copy fault %ld at %p", rc,
		(void *) (uintptr_t) THIS->addr);
	_stp_warn(errmsg);
	strlcpy (THIS->__retvalue, "<unknown>", MAXSTRINGLEN);
  }
%}

function user_string_quoted:string (addr:long) %{ /* pure */
  if (THIS->addr == 0)	
	strlcpy (THIS->__retvalue, "NULL", MAXSTRINGLEN);
  else
	_stp_text_str(THIS->__retvalue, (char *)(uintptr_t)THIS->addr, MAXSTRINGLEN, 1, 1);
%}

Anon7 - 2021