예제 #1
0
파일: misc.c 프로젝트: Joe-xXx/postgres
/*
 * Signal to terminate a backend process.  Only allowed by superuser.
 */
Datum
pg_terminate_backend(PG_FUNCTION_ARGS)
{
	if (!superuser())
		ereport(ERROR,
				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
			 errmsg("must be superuser to terminate other server processes"),
				 errhint("You can cancel your own processes with pg_cancel_backend().")));

	PG_RETURN_BOOL(pg_signal_backend(PG_GETARG_INT32(0), SIGTERM) == SIGNAL_BACKEND_SUCCESS);
}
예제 #2
0
파일: misc.c 프로젝트: Joe-xXx/postgres
/*
 * Signal to cancel a backend process.	This is allowed if you are superuser or
 * have the same role as the process being canceled.
 */
Datum
pg_cancel_backend(PG_FUNCTION_ARGS)
{
	int			r = pg_signal_backend(PG_GETARG_INT32(0), SIGINT);

	if (r == SIGNAL_BACKEND_NOPERMISSION)
		ereport(ERROR,
				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
				 (errmsg("must be superuser or have the same role to cancel queries running in other server processes"))));

	PG_RETURN_BOOL(r == SIGNAL_BACKEND_SUCCESS);
}
예제 #3
0
파일: misc.c 프로젝트: adam8157/gpdb
Datum
pg_cancel_backend_msg(PG_FUNCTION_ARGS)
{
	pid_t		pid = PG_GETARG_INT32(0);
	char 	   *msg = text_to_cstring(PG_GETARG_TEXT_PP(1));

	int			r = pg_signal_backend(pid, SIGINT, msg);

	if (r == SIGNAL_BACKEND_NOPERMISSION)
		ereport(ERROR,
				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
				 (errmsg("must be superuser or have the same role to cancel queries running in other server processes"))));

	PG_RETURN_BOOL(r == SIGNAL_BACKEND_SUCCESS);
}
예제 #4
0
/*
 * Signal to terminate a backend process.  This is allowed if you are a member
 * of the role whose process is being terminated.
 *
 * Note that only superusers can signal superuser-owned processes.
 */
Datum
pg_terminate_backend(PG_FUNCTION_ARGS)
{
	int			r = pg_signal_backend(PG_GETARG_INT32(0), SIGTERM);

	if (r == SIGNAL_BACKEND_NOSUPERUSER)
		ereport(ERROR,
				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
			(errmsg("must be a superuser to terminate superuser process"))));

	if (r == SIGNAL_BACKEND_NOPERMISSION)
		ereport(ERROR,
				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
				 (errmsg("must be a member of the role whose process is being terminated or member of pg_signal_backend"))));

	PG_RETURN_BOOL(r == SIGNAL_BACKEND_SUCCESS);
}
예제 #5
0
/*
 * Signal to cancel a backend process.  This is allowed if you are a member of
 * the role whose process is being canceled.
 *
 * Note that only superusers can signal superuser-owned processes.
 */
Datum
pg_cancel_backend(PG_FUNCTION_ARGS)
{
	int			r = pg_signal_backend(PG_GETARG_INT32(0), SIGINT);

	if (r == SIGNAL_BACKEND_NOSUPERUSER)
		ereport(ERROR,
				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
				 (errmsg("must be a superuser to cancel superuser query"))));

	if (r == SIGNAL_BACKEND_NOPERMISSION)
		ereport(ERROR,
				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
				 (errmsg("must be a member of the role whose query is being canceled or member of pg_signal_backend"))));

	PG_RETURN_BOOL(r == SIGNAL_BACKEND_SUCCESS);
}
예제 #6
0
파일: misc.c 프로젝트: 50wu/gpdb
Datum
pg_terminate_backend(PG_FUNCTION_ARGS)
{
	PG_RETURN_BOOL(pg_signal_backend(PG_GETARG_INT32(0), SIGTERM));
}
예제 #7
0
파일: misc.c 프로젝트: 50wu/gpdb
Datum
pg_cancel_backend(PG_FUNCTION_ARGS)
{
	PG_RETURN_BOOL(pg_signal_backend(PG_GETARG_INT32(0), SIGINT));
}
예제 #8
0
파일: misc.c 프로젝트: colinet/sqlix
datum_t pg_cancel_backend(PG_FUNC_ARGS)
{
	RET_BOOL(pg_signal_backend(ARG_INT32(0), SIGINT));
}
예제 #9
0
파일: misc.c 프로젝트: colinet/sqlix
datum_t pg_terminate_backend(PG_FUNC_ARGS)
{
	RET_BOOL(pg_signal_backend(ARG_INT32(0), SIGTERM));
}