A new builder describes a complete Linux void. Methods allow you to make it less of a void as you see fit. This aligns well with the structure in the write up. Creating a void first then adding only precisely what is needed to it. It’s also a much higher level API that’s object oriented."><metaname=authorcontent="Jake Hillion"><linkrel=canonicalhref=https://blog.hillion.co.uk/posts/weekly-2022-03-28/><linkcrossorigin=anonymoushref=/assets/css/stylesheet.min.48a18943c2fc15c38a372b8dde1f5e5dc0bc64fa6cb90f5a817d2f8c76b7f3ae.cssintegrity="sha256-SKGJQ8L8FcOKNyuN3h9eXcC8ZPpsuQ9agX0vjHa3864="rel="preload stylesheet"as=style><scriptdefercrossorigin=anonymoussrc=/assets/js/highlight.min.b95bacdc39e37a332a9f883b1e78be4abc1fdca2bc1f2641f55e3cd3dabd4d61.jsintegrity="sha256-uVus3DnjejMqn4g7Hni+Srwf3KK8HyZB9V4809q9TWE="onload=hljs.initHighlightingOnLoad()></script>
<script>vardoNotTrack=!1;if(!doNotTrack){window.dataLayer=window.dataLayer||[];functiongtag(){dataLayer.push(arguments)}gtag("js",newDate),gtag("config","G-4CXXF49E7M",{anonymize_ip:!1})}</script><metaproperty="og:title"content="Jake's Weekly - 28th March 2022"><metaproperty="og:description"content="ResearchProjectProgrammingBuiltanewVoidBuilderstructtobetteralignwithhowcreatingavoidisdescribedinthewriting(void.rs).
A new builder describes a complete Linux void. Methods allow you to make it less of a void as you see fit. This aligns well with the structure in the write up. Creating a void first then adding only precisely what is needed to it. It’s also a much higher level API that’s object oriented."><metaproperty="og:type"content="article"><metaproperty="og:url"content="https://blog.hillion.co.uk/posts/weekly-2022-03-28/"><metaproperty="article:section"content="posts"><metaproperty="article:published_time"content="2022-03-28T11:00:00+00:00"><metaproperty="article:modified_time"content="2022-03-28T11:00:00+00:00"><metaproperty="og:site_name"content="Jake Hillion"><metaname=twitter:cardcontent="summary"><metaname=twitter:titlecontent="Jake's Weekly - 28th March 2022"><metaname=twitter:descriptioncontent="ResearchProjectProgrammingBuiltanewVoidBuilderstructtobetteralignwithhowcreatingavoidisdescribedinthewriting(void.rs).
A new builder describes a complete Linux void. Methods allow you to make it less of a void as you see fit. This aligns well with the structure in the write up. Creating a void first then adding only precisely what is needed to it. It’s also a much higher level API that’s object oriented."><scripttype=application/ld+json>{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Posts","item":"https://blog.hillion.co.uk/posts/"},{"@type":"ListItem","position":2,"name":"Jake's Weekly - 28th March 2022","item":"https://blog.hillion.co.uk/posts/weekly-2022-03-28/"}]}</script><scripttype=application/ld+json>{"@context":"https://schema.org","@type":"BlogPosting","headline":"Jake'sWeekly-28thMarch2022","name":"Jake\u0027sWeekly-28thMarch2022","description":"ResearchProjectProgrammingBuiltanewVoidBuilderstructtobetteralignwithhowcreatingavoidisdescribedinthewriting(void.rs).\nAnewbuilderdescribesacompleteLinuxvoid.Methodsallowyoutomakeitlessofavoidasyouseefit.Thisalignswellwiththestructureinthewriteup.Creatingavoidfirstthenaddingonlypreciselywhatisneededtoit.It\u0026rsquo;salsoamuchhigherlevelAPIthat\u0026rsquo;sobjectoriented.","keywords":[],"articleBody":"ResearchProjectProgrammingBuiltanewVoidBuilderstructtobetteralignwithhowcreatingavoidisdescribedinthewriting(void.rs).\nAnewbuilderdescribesacompleteLinuxvoid.Methodsallowyoutomakeitlessofavoidasyouseefit.Thisalignswellwiththestructureinthewriteup.Creatingavoidfirstthenaddingonlypreciselywhatisneededtoit.It’salsoamuchhigherlevelAPIthat’sobjectoriented.Takesaclosureandiseasiertoreasonaboutthanthepreviousimperativecode.Leavesroomforoptimisationssuchassharinganemptynamespaceinthefuture.Cleanedupclone3tobetterusestackarguments(clone.rs).\nPreviouslythereweresomehiddenfieldsintheinputargument.Inhindsighttheseshouldclearlybeonthefunction’sstack.Solvedthefiledroppingproblem.\nCombinedthiswiththenewVoidBuilder.Asittakesaclosureratherthancontrolflow,theclosurecansimplynotbedroppedintheparent(void.rs#L55-L60).Anythingthathasbeenmovedintotheclosurewillnowonlybedroppedinthespawnedprocess-probablytheintendedbehaviour.Kindofmessyifyou’veallocatedmemorytobemovedintotheclosure,butanicesolutionforthingslikeFileswhichonlyliveonthestackbutholdaresource.AddedCI(Drone).\nBenchmarkedcreatingnamespaces(benches/clone3.rs).Thiswasinitiallyworkingquitewellbutseemstobehittingsomelimitsnow.Willneedabitofdebugging.I’mstilldecidingwhethertoswitchtoaJupyterNotebookforthissortofthing,orleaveitinRust/scripts.\nDissertationdraftLessobviousprogressthistime.I’vebeenwritingaboutthefeaturesasI’vebeenwritingthecode,sosectionslikehowtocreateavoidhavegrownquitenicely.Iwon’tattachanewcopyherebuttheOverleaflinkisstillvalid.\nUpNextThecodeisinamuchbetterspotnowthanitwaslasttime.Thegoalforthenextweekistogettheexampleapplicationscompletedunderthisneartofinalshim.\nAddtheneededhandlingtogziptorunundertheshim.\nEditthesource.Writeaspecification.Writeaboutitinthewriteup.Createadecentexplanatoryfigure.BuildaTLSserverinRustundertheshim.\nWritetheserver.Writeaspecification.Writeaboutitinthewriteup.Createadecentexplanatoryfigure.Extension:finishthemacrosforbetterintegrationwithRust.\nWritethehelperfunctionsalongsidetheTLSserver.DesignthemacrosalongsidetheTLSserver.Writethemacrosonceit’salreadyworkingwithout.","wordCount":"432","inLanguage":"en","datePublished":"2022-03-28T11:00:00Z","dateModified":"2022-03-28T11:00:00Z","author":{"@type":"Person","name":"JakeHillion"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://blog.hillion.co.uk/
<spanclass=logo-switches><buttonid=theme-toggleaccesskey=ttitle="(Alt + T)"><svgid="moon"xmlns="http://www.w3.org/2000/svg"width="24"height="24"viewBox="0 0 24 24"fill="none"stroke="currentcolor"stroke-width="2"stroke-linecap="round"stroke-linejoin="round"><pathd="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"/></svg><svgid="sun"xmlns="http://www.w3.org/2000/svg"width="24"height="24"viewBox="0 0 24 24"fill="none"stroke="currentcolor"stroke-width="2"stroke-linecap="round"stroke-linejoin="round"><circlecx="12"cy="12"r="5"/><linex1="12"y1="1"x2="12"y2="3"/><linex1="12"y1="21"x2="12"y2="23"/><linex1="4.22"y1="4.22"x2="5.64"y2="5.64"/><linex1="18.36"y1="18.36"x2="19.78"y2="19.78"/><linex1="1"y1="12"x2="3"y2="12"/><linex1="21"y1="12"x2="23"y2="12"/><linex1="4.22"y1="19.78"x2="5.64"y2="18.36"/><linex1="18.36"y1="5.64"x2="19.78"y2="4.22"/></svg></button></span></div><ulid=menu><li><ahref=https://blog.hillion.co.uk/categories/title=categories><span>categories</span></a></li><li><ahref=https://blog.hillion.co.uk/tags/title=tags><span>tags</span></a></li></ul></nav></header><mainclass=main><articleclass=post-single><headerclass=post-header><divclass=breadcrumbs><ahref=https://blog.hillion.co.uk/>Home</a> » <ahref=https://blog.hillion.co.uk/posts/>Posts</a></div><h1class=post-title>Jake's Weekly - 28th March 2022</h1><divclass=post-meta><spantitle='2022-03-28 11:00:00 +0000 UTC'>March 28, 2022</span> · 3 min · Jake Hillion</div></header><divclass=post-content><h2id=research-project>Research Project<ahiddenclass=anchoraria-hidden=truehref=#research-project>#</a></h2><h3id=programming>Programming<ahiddenclass=anchoraria-hidden=truehref=#programming>#</a></h3><ul><li><p>Built a new <code>VoidBuilder</code> struct to better align with how creating a void is described in the writing (<ahref=https://gitea.hillion.co.uk/JakeHillion/clone-shim/src/commit/23f5761d05f65cc4d6f8d0388ea72cec30ea5ed2/src/void.rs>void.rs</a>).</p><ul><li>A new builder describes a complete Linux void. Methods allow you to make it less of a void as you see fit.</li><li>This aligns well with the structure in the write up. Creating a void first then adding only precisely what is needed to it.</li><li>It’s also a much higher level API that’s object oriented. Takes a closure and is easier to reason about than the previous imperative code.</li><li>Leaves room for optimisations such as sharing an empty namespace in the future.</li></ul></li><li><p>Cleaned up <code>clone3</code> to better use stack arguments (<ahref=https://gitea.hillion.co.uk/JakeHillion/clone-shim/commit/fe05cf1fef8c4fd2d1fc0f4a1126fa74f9eda6bf>clone.rs</a>).</p><ul><li>Previously there were some hidden fields in the input argument. In hindsight these should clearly be on the function’s stack.</li></ul></li><li><p>Solved the file dropping problem.</p><ul><li>Combined this with the new <code>VoidBuilder</code>. As it takes a closure rather than control flow, the closure can simply not be dropped in the parent (<ahref=https://gitea.hillion.co.uk/JakeHillion/clone-shim/src/commit/23f5761d05f65cc4d6f8d0388ea72cec30ea5ed2/src/void.rs#L55-L60>void.rs#L55-L60</a>).</li><li>Anything that has been moved into the closure will now only be dropped in the spawned process - probably the intended behaviour. Kind of messy if you’ve allocated memory to be moved into the closure, but a nice solution for things like <code>File</code>s which only live on the stack but hold a resource.</li></ul></li><li><p>Added CI (<ahref=https://drone.hillion.co.uk/JakeHillion/clone-shim>Drone</a>).</p></li><li><p>Benchmarked creating namespaces (<ahref=https://gitea.hillion.co.uk/JakeHillion/clone-shim/src/commit/23f5761d05f65cc4d6f8d0388ea72cec30ea5ed2/benches/clone3.rs>benches/clone3.rs</a>). This was initially working quite well but seems to be hitting some limits now. Will need a bit of debugging. I’m still deciding whether to switch to a Jupyter Notebook for this sort of thing, or lea
<ahref=https://git.io/hugopapermodrel=noopenertarget=_blank>PaperMod</a></span></footer><ahref=#toparia-label="go to top"title="Go to Top (Alt + G)"class=top-linkid=top-linkaccesskey=g><svgxmlns="http://www.w3.org/2000/svg"viewBox="0 0 12 6"fill="currentcolor"><pathd="M12 6H0l6-6z"/></svg></a><script>letmenu=document.getElementById("menu");menu&&(menu.scrollLeft=localStorage.getItem("menu-scroll-position"),menu.onscroll=function(){localStorage.setItem("menu-scroll-position",menu.scrollLeft)}),document.querySelectorAll('a[href^="#"]').forEach(e=>{e.addEventListener("click",function(e){e.preventDefault();vart=this.getAttribute("href").substr(1);window.matchMedia("(prefers-reduced-motion: reduce)").matches?document.querySelector(`[id='${decodeURIComponent(t)}']`).scrollIntoView():document.querySelector(`[id='${decodeURIComponent(t)}']`).scrollIntoView({behavior:"smooth"}),t==="top"?history.replaceState(null,null," "):history.pushState(null,null,`#${t}`)})})</script><script>varmybutton=document.getElementById("top-link");window.onscroll=function(){document.body.scrollTop>800||document.documentElement.scrollTop>800?(mybutton.style.visibility="visible",mybutton.style.opacity="1"):(mybutton.style.visibility="hidden",mybutton.style.opacity="0")}</script><script>document.getElementById("theme-toggle").addEventListener("click",()=>{document.body.className.includes("dark")?(document.body.classList.remove("dark"),localStorage.setItem("pref-theme","light")):(document.body.classList.add("dark"),localStorage.setItem("pref-theme","dark"))})</script></body></html>