/* * exit. without it the user program cannot terminate correctly. */ void zrt_zcall_enhanced_exit(int status){ ZRT_LOG(L_SHORT, "status %d exiting...", status); get_fstab_observer()->mount_export(HANDLE_ONLY_FSTAB_SECTION); zvm_exit(status); /*get controls into zerovm*/ /* unreachable code*/ return; }
int zfork(){ ZRT_LOG(L_INFO, P_TEXT, "call zvm_fork"); /*zvm fork syscall here ...*/ int res = zvm_fork(); ZRT_LOG(L_INFO, "zvm_fork res=%d", res); /*update state for removable mounts, all removable mounts needs to be refreshed*/ get_fstab_observer()->reset_removable(HANDLE_ONLY_FSTAB_SECTION); /*re-read nvram file because after fork his content can be changed. */ /*Folowing nvram handlers using only stack and nor heap*/ struct NvramLoaderPublicInterface* nvram = INSTANCE_L(NVRAM_LOADER)(); /*if nvram config file not empty then do parsing*/ if ( nvram->read(nvram, DEV_NVRAM) > 0 ){ nvram->parse(nvram); /*handle debug section - verbosity*/ if ( NULL != nvram->section_by_name( nvram, DEBUG_SECTION_NAME ) ){ ZRT_LOG(L_INFO, "%s", "nvram handle debug"); nvram->handle(nvram, HANDLE_ONLY_DEBUG_SECTION, NULL, NULL, NULL ); } /*handle time section*/ if ( NULL != nvram->section_by_name( nvram, TIME_SECTION_NAME ) ){ nvram->handle(nvram, HANDLE_ONLY_TIME_SECTION, static_timeval(), NULL, NULL); } } ZRT_LOG(L_SHORT, "zfork() res=%d ", res); return res; }
/*Try to mount postponed mount, in case if sub path matched. @return 0 if success, -1 if we don't need to mount*/ static int lazy_mount(const char* path){ /*lazy mount is not supported under modern file system*/ #ifndef FUSEGLUE_EXT /*if it's time to do mount, then do all waiting mounts*/ struct FstabObserver* observer = get_fstab_observer(); struct FstabRecordContainer* record; while( NULL != (record = observer->locate_postpone_mount( observer, path, EFstabMountWaiting)) ){ observer->mount_import(observer, record); return 0; } #endif //FUSEGLUE_EXT return -1; }