2012-03-26 19:38:26 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2008 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _DUMPSTATE_H_
|
|
|
|
#define _DUMPSTATE_H_
|
|
|
|
|
|
|
|
#include <time.h>
|
|
|
|
#include <unistd.h>
|
2012-11-02 22:46:56 +00:00
|
|
|
#include <stdbool.h>
|
2012-03-26 19:38:26 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define SU_PATH "/system/xbin/su"
|
|
|
|
|
2012-11-02 22:46:56 +00:00
|
|
|
typedef void (for_each_pid_func)(int, const char *);
|
|
|
|
typedef void (for_each_tid_func)(int, int, const char *);
|
|
|
|
|
2012-03-26 19:38:26 +00:00
|
|
|
/* prints the contents of a file */
|
2014-07-22 23:08:19 +00:00
|
|
|
int dump_file(const char *title, const char *path);
|
|
|
|
|
2015-02-10 20:15:01 +00:00
|
|
|
/* prints the contents of the fd
|
|
|
|
* fd must have been opened with the flag O_NONBLOCK.
|
|
|
|
*/
|
2014-07-22 23:08:19 +00:00
|
|
|
int dump_file_from_fd(const char *title, const char *path, int fd);
|
2012-03-26 19:38:26 +00:00
|
|
|
|
|
|
|
/* forks a command and waits for it to finish -- terminate args with NULL */
|
|
|
|
int run_command(const char *title, int timeout_seconds, const char *command, ...);
|
|
|
|
|
|
|
|
/* prints all the system properties */
|
|
|
|
void print_properties();
|
|
|
|
|
|
|
|
/* redirect output to a service control socket */
|
|
|
|
void redirect_to_socket(FILE *redirect, const char *service);
|
|
|
|
|
2015-02-10 00:24:47 +00:00
|
|
|
/* redirect output to a file */
|
|
|
|
void redirect_to_file(FILE *redirect, char *path);
|
2012-03-26 19:38:26 +00:00
|
|
|
|
2012-06-07 23:40:01 +00:00
|
|
|
/* dump Dalvik and native stack traces, return the trace file location (NULL if none) */
|
|
|
|
const char *dump_traces();
|
2012-03-26 19:38:26 +00:00
|
|
|
|
|
|
|
/* for each process in the system, run the specified function */
|
2012-11-02 22:46:56 +00:00
|
|
|
void for_each_pid(for_each_pid_func func, const char *header);
|
|
|
|
|
|
|
|
/* for each thread in the system, run the specified function */
|
|
|
|
void for_each_tid(for_each_tid_func func, const char *header);
|
2012-03-26 19:38:26 +00:00
|
|
|
|
|
|
|
/* Displays a blocked processes in-kernel wait channel */
|
2012-11-02 22:46:56 +00:00
|
|
|
void show_wchan(int pid, int tid, const char *name);
|
2012-03-26 19:38:26 +00:00
|
|
|
|
|
|
|
/* Runs "showmap" for a process */
|
|
|
|
void do_showmap(int pid, const char *name);
|
|
|
|
|
|
|
|
/* Gets the dmesg output for the kernel */
|
|
|
|
void do_dmesg();
|
|
|
|
|
2014-07-08 22:40:55 +00:00
|
|
|
/* Prints the contents of all the routing tables, both IPv4 and IPv6. */
|
|
|
|
void dump_route_tables();
|
|
|
|
|
2012-03-26 19:38:26 +00:00
|
|
|
/* Play a sound via Stagefright */
|
2014-07-22 23:08:19 +00:00
|
|
|
void play_sound(const char *path);
|
2012-03-26 19:38:26 +00:00
|
|
|
|
|
|
|
/* Implemented by libdumpstate_board to dump board-specific info */
|
|
|
|
void dumpstate_board();
|
|
|
|
|
|
|
|
#endif /* _DUMPSTATE_H_ */
|