| 1 |
// File switching tapset |
| 2 |
// Copyright (C) 2015 Red Hat Inc. |
| 3 |
// |
| 4 |
// This file is part of systemtap, and is free software. You can |
| 5 |
// redistribute it and/or modify it under the terms of the GNU General |
| 6 |
// Public License (GPL); either version 2, or (at your option) any |
| 7 |
// later version. |
| 8 |
|
| 9 |
/** |
| 10 |
* sfunction switch_file - switch to the next output file |
| 11 |
* |
| 12 |
* Description: This function sends a signal to the stapio process, |
| 13 |
* commanding it to rotate to the next output file when output is |
| 14 |
* sent to file(s). |
| 15 |
* |
| 16 |
* The mechanism of switching files was changed by upstream commit |
| 17 |
* 5b39471380a238469c8fc18136f12600e5e9aec7 . With this commit, the |
| 18 |
* rotation only works if there is some actual systemtap output. |
| 19 |
*/ |
| 20 |
function switch_file() { |
| 21 |
if (stp_pid() != 0) { |
| 22 |
system(sprintf("kill -USR2 %d", stp_pid())) |
| 23 |
} |
| 24 |
} |