A healthy portion of DevOps with a side of Linux. Site currently under construction..

64-bit-GCC Runtime Stack Usage

CPU registers in 64-bit mode 1 2 3 4 5 6 7 8 9 10 11 12 13 * rax * rbx * rbp * rsp first * rdi <--+ * rsi | in 64-bit mode the first 6 parameters are placed in * rdx | these registers from rdi to r9 when calling a function, * rcx | any extra params are passed through the stack like in * r8 | 32-bit mode * r9 <--+ last * r10-r15 Simple C program in assembly 1 2 3 4 5 6 7 #include <stdio.

C function calls (32-bit)

Each CPU has the following registers (64-bit in parantheses): PC (IP): Instruction pointer - Points to next instruction for the CPU to execute SP (SP): Stack pointer - Points to the top of the stack FP (BP): Base pointer - Points to the stack frame of the current active function RVR (AX): Return value - Points to the function return value 1 2 3 4 5 6 7 main() | int sub(int x, int y) { | { int a, b, c; | int u, v; a = 1; b = 2; c = 3; | u = 4; v = 5; c = sub(a, b); | return x+y+u+v; printf("c=%d\n", c); | } } | When a C program is envoked, the return address (current PC) is pushed onto the stack and then the value stored in the PC register is replaced with the function we wish the CPU to execute.

FUSE

FUSE (filesystem in user space) [1] What is FUSE, and why use it? FUSE is an open source framework which allows you to build filesystems in user space, compared to the conventional kernel space route. Building in user space is said by many to not be suitable for production, and also that the overhead is too substantial to be of use. But this allows the programmer to work in a ‘friendlier’ environment, gives a much larger toolset to work with and probably most importantly, it doesn’t crash the system on a bug like kernel programming does.

Hugo basics

Create a new site in a directory <site_name> 1 hugo new site <site_name> Running the server locally (-D flag is to render pages marked as drafts) 1 hugo server -D Github This repo has the alternate stream set to ‘development’. So pushing master to here will not effect the site itself. Deploying 1 ./deploy.sh This script deploys the website to the repo georgesims21.github.io as a proper site. It will not render files marked as drafts, so it should look exactly the same as locally if you run:

Networking basics

TCP (Transmission Control Protocol)/IP (Internet Protocol) is the backbone of the internet. There are 2 versions: IPv4 (32-bit addresses) and IPv6 (64-bit). The figure below shows the TCP/IP layers: The top layer shows applications which use networking to transfer/collect data. They either use TCP or UDP (mentioned later). Data transfer at this level is only logical, the real transferring takes place at the bottom two layers (Internet and Link layers). This is where the data packets are divided into data frames for transmission over physical networks.

procfs/sysfs

procfs and sysfs are both pseudo filesystems located in the root directory of the Unix FS heirarchy. They contain files which act as a window to the kernel and allows user-land processes to see and change important system information. Upon inspection (if you wrote the command $ ls -al /proc on a Unix system) you would notice that all files are 0 in size. This is due to the window aspect, one a user-land process reads/opens one of these files, it is at that moment the kernel writes that information to the file, hence the analogy.