The hcu_build_patch.sh patch generator is invoked to produce a dynamic software update patch in source code format. Figure 5-4 shows an example of running the patch generator to produce a dynamic software update patch that can update vsFTPd version 2.0.4 to version 2.0.5. The patch generator requires five parameters. It requires the whole-program merged source code of the original version (vsftpd-2.0.4/vsftpd_comb.c from Section 5.1), the name of the original version (204), the whole-program merged source code of the new version (vsftpd-2.0.5/vsftpd_comb.c from Section 5.2), the name of the new version (205), and the file describing the update (2.0.4_to_2.0.5_mappings.c from Section 5.3.2).
Figure 5-4. Preparing a dynamic software update patch for vsFTPd from 2.0.4 to 2.0.5.
bash$ hcu_build_patch.sh vsftpd-2.0.4/vsftpd_comb.c 204 \ vsftpd-2.0.5/vsftpd_comb.c 205 \ 2.0.4_to_2.0.5_mappings.c
Figure 5-5. Patch generator report to update vsFTPd from 2.0.4 to 2.0.5.
... variable 's_p_statbuf___6' not found in file 'vsftpd-2.0.4/vsftpd_comb.c.hcudiff.c'. It is an added variable. variable 'tunable_delay_successful_login' not found in file 'vsftpd-2.0.4/vsftpd_comb.c.hcudiff.c'. It is an added variable. variable 'envtz' not found in file 'vsftpd-2.0.4/vsftpd_comb.c.hcudiff.c'. It is an added variable. variable 'tunable_max_login_fails' not found in file 'vsftpd-2.0.4/vsftpd_comb.c.hcudiff.c'. It is an added variable. variable 'tunable_delay_failed_login' not found in file 'vsftpd-2.0.4/vsftpd_comb.c.hcudiff.c'. It is an added variable. ... variable 'parseconf_uint_array' has HAD its definition updated. It is an updated variable. ... function 'str_locate_text_reverse' has HAD its definition updated. It is an updated function. function 'emit_greeting' has HAD its definition updated. It is an updated function. function 'handle_login' has HAD its definition updated. It is an updated function. function 'str_locate_chars' has HAD its definition updated. It is an updated function. function 'vsf_privop_do_login' has HAD its definition updated. It is an updated function. function 'vsf_remove_uwtmp' has HAD its definition updated. It is an updated function. function 'handle_retr' has HAD its definition updated. It is an updated function. function 'vsf_sysutil_connect_timeout' has HAD its definition updated. It is an updated function. function 'handle_upload_common' has HAD its definition updated. It is an updated function. function 'handle_user_command' has HAD its definition updated. It is an updated function. function 'main' has HAD its definition updated. It is an updated function. function 'handle_mdtm' has HAD its definition updated. It is an updated function. function 'handle_size' has HAD its definition updated. It is an updated function. function 'vsf_insert_uwtmp' has HAD its definition updated. It is an updated function. function 'handle_feat' has HAD its definition updated. It is an updated function. function 'str_locate_text' has HAD its definition updated. It is an updated function. function 'get_unique_filename' has HAD its definition updated. It is an updated function. function 'vsf_sysutil_chroot' has HAD its definition updated. It is an updated function. function 'vsf_sysdep_check_auth' has HAD its definition updated. It is an updated function. function 'vsf_sysutil_tzset' has HAD its definition updated. It is an updated function. function 'handle_pass_command' has HAD its definition updated. It is an updated function. function 'vsf_ls_populate_dir_list' has HAD its definition updated. It is an updated function. function 'calc_num_send' has HAD its definition updated. It is an updated function. function 'handle_stat' has HAD its definition updated. It is an updated function. function 'vsf_privop_do_file_chown' has HAD its definition updated. It is an updated function. Diff Report: ============ Type definitions: ----------------- Added: 0 0.00 Deleted: 0 0.00 Updated: 1 0.14 Same: 693 99.86 Total: 694 100.00 Variable definitions: ----------------- Added: 5 2.14 Deleted: 0 0.00 Updated: 1 0.43 Same: 228 97.44 Total: 234 100.00 Function definitions: --------------------- Added: 0 0.00 Deleted: 0 0.00 Updated: 25 4.82 Same: 494 95.18 Total: 519 100.00
Function updates. For each function that will be updated, code that will enable updated functions to take control over the program execution is produced.
Stack-state updates. Additionally, the patch generator incorporates in the patch produced stack-state transformers that were manually provided by a user in the execution continuation mappings file.
Patch format. The dynamic software update runtime requires that patches contain three special functions. These functions are invoked by the runtime at special points during an update to coordinate its successful application. They are:
int HCU_update_description_function()
Invoked before the update is attempted to describe to the runtime possible execution continuations and which threads will be updated.
int HCU_datatype_transformations_function()
Invoked after unwinding the old stack and before reconstructing the new stack to transform the datatypes of global variables.
int HCU_function_updates_function()
Invoked after unwinding the old stack and before reconstructing the new stack to update functions to use their new versions.