Lines Matching refs:context

179 static int fix_xattr(int fd, const char *context[_CONTEXT_MAX]) {
202 if (isempty(context[i]) || !xattrs[i])
205 k = fsetxattr(fd, xattrs[i], context[i], strlen(context[i]), XATTR_CREATE);
219 const char *context[_CONTEXT_MAX],
225 assert(context);
230 (void) fix_xattr(fd, context);
258 static int make_filename(const char *context[_CONTEXT_MAX], char **ret) {
263 assert(context);
265 c = filename_escape(context[CONTEXT_COMM]);
269 u = filename_escape(context[CONTEXT_UID]);
277 p = filename_escape(context[CONTEXT_PID]);
281 t = filename_escape(context[CONTEXT_TIMESTAMP]);
298 const char *context[_CONTEXT_MAX],
312 assert(context);
318 r = parse_uid(context[CONTEXT_UID], &uid);
322 r = safe_atou64(context[CONTEXT_RLIMIT], &rlimit);
324 return log_error_errno(r, "Failed to parse resource limit: %s", context[CONTEXT_RLIMIT]);
327 log_info("Core Dumping has been disabled for process %s (%s).", context[CONTEXT_PID], context[CONTEXT_COMM]);
334 r = make_filename(context, &fn);
350 log_error("Coredump of %s (%s) is larger than configured processing limit, refusing.", context[CONTEXT_PID], context[CONTEXT_COMM]);
353 log_error("Not enough disk space for coredump of %s (%s), refusing.", context[CONTEXT_PID], context[CONTEXT_COMM]);
402 r = fix_permissions(fd_compressed, tmp_compressed, fn_compressed, context, uid);
426 r = fix_permissions(fd, tmp, fn, context, uid);
563 static int change_uid_gid(const char *context[]) {
568 r = parse_uid(context[CONTEXT_UID], &uid);
581 r = parse_gid(context[CONTEXT_GID], &gid);
590 const char *context[_CONTEXT_MAX],
601 assert(context);
610 r = save_external_coredump(context, input_fd, &filename, &coredump_node_fd, &coredump_fd, &coredump_size);
634 r = change_uid_gid(context);
643 r = coredump_make_stack_trace(coredump_fd, context[CONTEXT_EXE], &stacktrace);
645 core_message = strjoin("MESSAGE=Process ", context[CONTEXT_PID], " (", context[CONTEXT_COMM], ") of user ", context[CONTEXT_UID], " dumped core.\n\n", stacktrace, NULL);
655 core_message = strjoin("MESSAGE=Process ", context[CONTEXT_PID], " (", context[CONTEXT_COMM], ") of user ", context[CONTEXT_UID], " dumped core.", NULL);
683 static void map_context_fields(const struct iovec *iovec, const char *context[]) {
699 assert(context);
713 context[i] = (char*) iovec->iov_base + l;
722 const char *context[_CONTEXT_MAX] = {};
804 map_context_fields(iovec + n_iovec, context);
814 assert(context[CONTEXT_PID]);
815 assert(context[CONTEXT_UID]);
816 assert(context[CONTEXT_GID]);
817 assert(context[CONTEXT_SIGNAL]);
818 assert(context[CONTEXT_TIMESTAMP]);
819 assert(context[CONTEXT_RLIMIT]);
820 assert(context[CONTEXT_COMM]);
823 r = submit_coredump(context, iovec, n_iovec_allocated, n_iovec, coredump_fd);
869 static int process_journald_crash(const char *context[], int input_fd) {
875 assert(context);
883 r = save_external_coredump(context, input_fd, &filename, &coredump_node_fd, &coredump_fd, &coredump_size);
910 const char *context[_CONTEXT_MAX];
940 context[CONTEXT_PID] = argv[CONTEXT_PID + 1];
941 context[CONTEXT_UID] = argv[CONTEXT_UID + 1];
942 context[CONTEXT_GID] = argv[CONTEXT_GID + 1];
943 context[CONTEXT_SIGNAL] = argv[CONTEXT_SIGNAL + 1];
944 context[CONTEXT_TIMESTAMP] = argv[CONTEXT_TIMESTAMP + 1];
945 context[CONTEXT_RLIMIT] = argv[CONTEXT_RLIMIT + 1];
946 context[CONTEXT_COMM] = comm;
947 context[CONTEXT_EXE] = exe;
953 return process_journald_crash(context, STDIN_FILENO);
973 core_pid = strjoina("COREDUMP_PID=", context[CONTEXT_PID]);
976 core_uid = strjoina("COREDUMP_UID=", context[CONTEXT_UID]);
979 core_gid = strjoina("COREDUMP_GID=", context[CONTEXT_GID]);
982 core_signal = strjoina("COREDUMP_SIGNAL=", context[CONTEXT_SIGNAL]);
985 core_rlimit = strjoina("COREDUMP_RLIMIT=", context[CONTEXT_RLIMIT]);
1098 core_timestamp = strjoina("COREDUMP_TIMESTAMP=", context[CONTEXT_TIMESTAMP], "000000", NULL);