From: Alan T. DeKok Date: Tue, 5 Sep 2017 14:30:23 +0000 (-0400) Subject: rename "fork" to "create" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a4be65fe6a8ca75d2c80ee9a69f4a3eb7516077;p=thirdparty%2Ffreeradius-server.git rename "fork" to "create" It's clearer for normal humans --- diff --git a/src/include/interpreter.h b/src/include/interpreter.h index 1a4a9fce17b..2c922822ce0 100644 --- a/src/include/interpreter.h +++ b/src/include/interpreter.h @@ -67,7 +67,7 @@ typedef enum { UNLANG_TYPE_RETURN, //!< Return statement. UNLANG_TYPE_MAP, //!< Mapping section (like #UNLANG_TYPE_UPDATE, but uses //!< values from a #map_proc_t call). - UNLANG_TYPE_FORK, //!< fork a child + UNLANG_TYPE_CREATE, //!< create a child #endif UNLANG_TYPE_POLICY, //!< Policy section. UNLANG_TYPE_XLAT_INLINE, //!< xlat statement, inline in "unlang" diff --git a/src/main/unlang_compile.c b/src/main/unlang_compile.c index 845bf6053eb..e8e348e134d 100644 --- a/src/main/unlang_compile.c +++ b/src/main/unlang_compile.c @@ -2487,8 +2487,8 @@ static unlang_t *compile_parallel(unlang_t *parent, unlang_compile_t *unlang_ctx } -static unlang_t *compile_fork(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs, - unlang_group_type_t group_type, unlang_group_type_t parentgroup_type, unlang_type_t mod_type) +static unlang_t *compile_create(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs, + unlang_group_type_t group_type, unlang_group_type_t parentgroup_type, unlang_type_t mod_type) { char const *name2; unlang_t *c; @@ -2518,6 +2518,11 @@ static unlang_t *compile_fork(unlang_t *parent, unlang_compile_t *unlang_ctx, CO return NULL; } + /* + * @todo - figure out how to tell protocol at + * compile time? Packet-Type is RADIUS-specific, + * and we want this to be protocol-specific. + */ da = fr_dict_attr_by_name(NULL, "Packet-Type"); if (!da) { cf_log_err(cs, "Failed finding Packet-Type attribute for 'fork'"); @@ -2737,7 +2742,7 @@ static modcall_compile_t compile_table[] = { { "map", compile_map, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_MAP }, { "switch", compile_switch, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_SWITCH }, { "parallel", compile_parallel, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_PARALLEL }, - { "fork", compile_fork, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_FORK }, + { "create", compile_create, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_CREATE }, { NULL, NULL, 0, UNLANG_TYPE_NULL } }; diff --git a/src/main/unlang_interpret.c b/src/main/unlang_interpret.c index f357c10f599..55e54943b0f 100644 --- a/src/main/unlang_interpret.c +++ b/src/main/unlang_interpret.c @@ -580,9 +580,8 @@ static REQUEST *unlang_child_alloc(REQUEST *request, unlang_t *instruction, rlm_ FR_DLIST_INIT(child->async->time_order); /* - * fork() is a copy??? + * create {...} creates an empty copy. */ - child->packet->vps = fr_pair_list_copy(child->packet, request->packet->vps); return child; } @@ -591,7 +590,7 @@ static REQUEST *unlang_child_alloc(REQUEST *request, unlang_t *instruction, rlm_ /** Send a signal from parent request to child * */ -static void unlang_fork_signal(UNUSED REQUEST *request, UNUSED void *instance, UNUSED void *thread, void *ctx, +static void unlang_create_signal(UNUSED REQUEST *request, UNUSED void *instance, UNUSED void *thread, void *ctx, fr_state_action_t action) { REQUEST *child = talloc_get_type_abort(ctx, REQUEST); @@ -600,10 +599,10 @@ static void unlang_fork_signal(UNUSED REQUEST *request, UNUSED void *instance, U } -/** Resume a forked request +/** Resume a created child request * */ -static rlm_rcode_t unlang_fork_resume(UNUSED REQUEST *request, unlang_stack_t *stack, +static rlm_rcode_t unlang_create_resume(UNUSED REQUEST *request, unlang_stack_t *stack, UNUSED const void *instance, UNUSED void *thread, void *resume_ctx) { REQUEST *child = talloc_get_type_abort(resume_ctx, REQUEST); @@ -622,7 +621,7 @@ static rlm_rcode_t unlang_fork_resume(UNUSED REQUEST *request, unlang_stack_t *s frame = &stack->frame[stack->depth]; rad_assert(frame->instruction->type == UNLANG_TYPE_RESUME); - frame->instruction->type = UNLANG_TYPE_FORK; /* for debug purposes */ + frame->instruction->type = UNLANG_TYPE_CREATE; /* for debug purposes */ talloc_free(child); return rcode; } @@ -635,7 +634,7 @@ static rlm_rcode_t unlang_fork_resume(UNUSED REQUEST *request, unlang_stack_t *s (void) talloc_get_type_abort(mr, unlang_resume_t); rad_assert(mr->callback == NULL); - rad_assert(mr->signal_callback == unlang_fork_signal); + rad_assert(mr->signal_callback == unlang_create_signal); rad_assert(mr->resume_ctx == child); #endif @@ -646,8 +645,8 @@ static rlm_rcode_t unlang_fork_resume(UNUSED REQUEST *request, unlang_stack_t *s return RLM_MODULE_YIELD; } -static unlang_action_t unlang_fork(REQUEST *request, unlang_stack_t *stack, - rlm_rcode_t *presult, int *priority) +static unlang_action_t unlang_create(REQUEST *request, unlang_stack_t *stack, + rlm_rcode_t *presult, int *priority) { unlang_stack_frame_t *frame = &stack->frame[stack->depth]; unlang_t *instruction = frame->instruction; @@ -742,7 +741,7 @@ static unlang_action_t unlang_fork(REQUEST *request, unlang_stack_t *stack, /* * Create the "resume" stack frame, and have it replace our stack frame. */ - mr = unlang_resume_alloc(request, NULL, unlang_fork_signal, child); + mr = unlang_resume_alloc(request, NULL, unlang_create_signal, child); if (!mr) { *presult = RLM_MODULE_FAIL; *priority = instruction->actions[*presult]; @@ -1588,7 +1587,7 @@ static unlang_action_t unlang_if(REQUEST *request, unlang_stack_t *stack, } static unlang_op_resume_func_t unlang_ops_resume[] = { - [UNLANG_TYPE_FORK] = unlang_fork_resume, + [UNLANG_TYPE_CREATE] = unlang_create_resume, [UNLANG_TYPE_PARALLEL] = unlang_parallel_resume, }; @@ -1745,9 +1744,9 @@ unlang_op_t unlang_ops[] = { .func = unlang_policy, .debug_braces = true }, - [UNLANG_TYPE_FORK] = { - .name = "fork", - .func = unlang_fork, + [UNLANG_TYPE_CREATE] = { + .name = "create", + .func = unlang_create, .debug_braces = true }, #endif @@ -1819,7 +1818,7 @@ resume_subsection: VERIFY_REQUEST(request); /* - * We may be multiple layers deep in fork{} or + * We may be multiple layers deep in create{} or * parallel{}. Only the top-level request is * tracked && marked "stop processing". */