Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a7754697 authored by Yida Wang's avatar Yida Wang Committed by Gerrit - the friendly Code Review server
Browse files

seemp: clean up stale code and add proper headers



Remove stale code in seemp_instrumentation.h. The functions are not
used anymore. Add proper headers to seemp_param_id.h to ensure
successful compilation.

Change-Id: Ic6860bd3dea6adf1f8b8a90504246700e3c0e207
Signed-off-by: default avatarYida Wang <yidaw@codeaurora.org>
parent 13ce0881
Loading
Loading
Loading
Loading
+0 −80
Original line number Diff line number Diff line
@@ -66,91 +66,11 @@ static inline void seemp_logk_sendto(int fd, void __user *buff, size_t len,

	seemp_logk_kernel_end(blck);
}

/*
 * NOTE: only recvfrom is going to be instrumented
 * since recv sys call internally calls recvfrom
 * with 2 extra parameters
 */
static inline void seemp_logk_recvfrom(int fd, void __user *ubuf,
		size_t size, unsigned int flags, struct sockaddr __user *addr,
		int __user *addr_len)
{
	char *buf = NULL;
	void *blck = NULL;

	/*sets up buf and blck correctly*/
	blck = seemp_setup_buf(&buf);
	if (!blck)
		return;

	/*fill the buf*/
	SEEMP_LOGK_RECORD(SEEMP_API_kernel__recvfrom, "size=%u,fd=%d",
			(unsigned int)size, fd);

	seemp_logk_kernel_end(blck);
}

static inline void seemp_logk_oom_adjust_write(pid_t pid,
					kuid_t uid, int oom_adj)
{
	char *buf = NULL;
	void *blck = NULL;

	/*sets up buf and blck correctly*/
	blck = seemp_setup_buf(&buf);
	if (!blck)
		return;

	/*fill the buf*/
	SEEMP_LOGK_RECORD(SEEMP_API_kernel__oom_adjust_write,
			 "app_uid=%d,app_pid=%d,oom_adj=%d",
			uid.val, pid, oom_adj);

	seemp_logk_kernel_end(blck);
}

static inline void seemp_logk_oom_score_adj_write(pid_t pid, kuid_t uid,
					int oom_adj_score)
{
	char *buf = NULL;
	void *blck = NULL;

	/*sets up buf and blck correctly*/
	blck = seemp_setup_buf(&buf);
	if (!blck)
		return;

	/*fill the buf*/
	snprintf(buf, MAX_BUF_SIZE,
		"-1|kernel|oom_score_adj_write|app_uid=%d,app_pid=%d,oom_adj=%d|--end",
		uid.val, pid, oom_adj_score);

	seemp_logk_kernel_end(blck);
}

#else
static inline void seemp_logk_sendto(int fd, void __user *buff,
		size_t len, unsigned int flags, struct sockaddr __user *addr,
		int addr_len)
{
}

static inline void seemp_logk_recvfrom
		(int fd, void __user *ubuf, size_t size,
		unsigned int flags, struct sockaddr __user *addr,
		int __user *addr_len)
{
}

static inline void seemp_logk_oom_adjust_write
		(pid_t pid, kuid_t uid, int oom_adj)
{
}

static inline void seemp_logk_oom_score_adj_write
		(pid_t pid, kuid_t uid, int oom_adj_score)
{
}
#endif
#endif
+3 −0
Original line number Diff line number Diff line
#ifndef _PARAM_ID_H_
#define _PARAM_ID_H_

#include <linux/string.h>
#include <linux/types.h>

#define PARAM_ID_LEN 0
#define PARAM_ID_OOM_ADJ 1
#define PARAM_ID_APP_UID 2