| 1 |
// Copyright (C) 2013 Red Hat Inc., |
| 2 |
// |
| 3 |
// This file is part of systemtap, and is free software. You can |
| 4 |
// redistribute it and/or modify it under the terms of the GNU General |
| 5 |
// Public License (GPL); either version 2, or (at your option) any |
| 6 |
// later version. |
| 7 |
// |
| 8 |
|
| 9 |
// <tapsetdescription> |
| 10 |
// Functions in the guru-signal tapset allow a probe handler to queue |
| 11 |
// a user-space signals. Such operations may only be safe from some |
| 12 |
// kinds of probe points, therefore are guru-mode only. |
| 13 |
// </tapsetdescription> |
| 14 |
|
| 15 |
|
| 16 |
/** |
| 17 |
* sfunction raise - raise a signal in the current thread |
| 18 |
* @signo: signal number |
| 19 |
* |
| 20 |
* Description: This function calls the kernel send_sig routine on |
| 21 |
* the current thread, with the given raw unchecked signal number. |
| 22 |
* It may raise an error if send_sig() failed. |
| 23 |
* It requires guru mode. |
| 24 |
*/ |
| 25 |
function raise(signo:long) %{ |
| 26 |
/* guru */ |
| 27 |
int rc = send_sig ((int) STAP_ARG_signo, current, 1); |
| 28 |
if (rc) { |
| 29 |
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer), |
| 30 |
"raise/send_sig error %d", rc); |
| 31 |
CONTEXT->last_error = CONTEXT->error_buffer; |
| 32 |
} |
| 33 |
%} |