<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://homeostasis.scs.carleton.ca/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Windowpane</id>
	<title>Soma-notes - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://homeostasis.scs.carleton.ca/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Windowpane"/>
	<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php/Special:Contributions/Windowpane"/>
	<updated>2026-04-22T11:14:02Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_2012_Midterm_Material&amp;diff=17521</id>
		<title>Talk:COMP 3000 2012 Midterm Material</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_2012_Midterm_Material&amp;diff=17521"/>
		<updated>2012-10-26T01:30:27Z</updated>

		<summary type="html">&lt;p&gt;Windowpane: /* ls -l */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
= Discussion =&lt;br /&gt;
&lt;br /&gt;
= Only the facts =&lt;br /&gt;
I&#039;ll be putting up my notes of notes up here. Hopefully people can benefit from these. I&#039;ll be summing up the answers from the lab and adding a few more details here and there.&lt;br /&gt;
&lt;br /&gt;
== Lab 1 ==&lt;br /&gt;
=== Types of shell commands ===&lt;br /&gt;
  Built ins&lt;br /&gt;
  Shell functions&lt;br /&gt;
  binaries (scripts and binaries&lt;br /&gt;
  alias &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Shell builtins vs binaries ===&lt;br /&gt;
  binaries exist elsewhere&lt;br /&gt;
  faster, no forking needed&lt;br /&gt;
  Kernel functions (IO redirection)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ls -l ===&lt;br /&gt;
&lt;br /&gt;
  1          2  3     4   5     6             7&lt;br /&gt;
  -rwxr-xr-x 1 root root 104508 Mar 31  2012 /bin/ls&lt;br /&gt;
&lt;br /&gt;
    U  G  O&lt;br /&gt;
  -rwxrwxrwx&lt;br /&gt;
&lt;br /&gt;
  To change user permission, use command: &amp;quot;chmod &amp;lt;UGO&amp;gt; &amp;lt;file/dir name&amp;gt;&amp;quot;&lt;br /&gt;
    ex: chmod 777 file&lt;br /&gt;
  The three digits represent User, Group or Others permissions. Represented as the sum of their permission values (read = 4, write = 2, execute = 1)&lt;br /&gt;
&lt;br /&gt;
    eg. 754     U = 7 = 4 + 2 + 1 = read, write and execute&lt;br /&gt;
                G = 5 = 4 + 1     = read and execute&lt;br /&gt;
                O = 4             = read only&lt;br /&gt;
&lt;br /&gt;
    eg. 623     U = 6 = 4 + 2     = read and write&lt;br /&gt;
                G = 2             = write only&lt;br /&gt;
                O = 3 = 2 + 1     = read and execute&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Memnonic: &#039;You go hugo!&#039;&lt;br /&gt;
&lt;br /&gt;
  - denotes a regular file&lt;br /&gt;
  d denotes a directory&lt;br /&gt;
  b denotes a block special file&lt;br /&gt;
  c denotes a character special file&lt;br /&gt;
  l denotes a symbolic link&lt;br /&gt;
  p denotes a named pipe&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  2) 1 link to /bin/ls&lt;br /&gt;
  3) user root&lt;br /&gt;
  4) group root&lt;br /&gt;
  5) size in bytes&lt;br /&gt;
  6) date last modified&lt;br /&gt;
  7) path/filename&lt;br /&gt;
&lt;br /&gt;
=== I/O redirection ===&lt;br /&gt;
  &amp;lt;&amp;lt; keyword    HEREDOC. Input until program reads specified keyword&lt;br /&gt;
  &amp;gt;&amp;gt; append&lt;br /&gt;
  &amp;lt; read from path&lt;br /&gt;
  &amp;gt; write to path, blow away anything there&lt;br /&gt;
  | pipes&lt;br /&gt;
&lt;br /&gt;
=== file descriptors ===&lt;br /&gt;
  0 stdin&lt;br /&gt;
  1 stdout&lt;br /&gt;
  2 stderr&lt;br /&gt;
  3-9 other&lt;br /&gt;
&lt;br /&gt;
fd redirection&lt;br /&gt;
  #&amp;gt; where # is a file descriptor&lt;br /&gt;
  a&amp;gt;&amp;amp;b redirects file descriptor a to b.&lt;br /&gt;
&lt;br /&gt;
  COMMAND &amp;amp;&amp;gt;&amp;gt; file.txt&lt;br /&gt;
  Appends BOTH STDERR and STDOUT to file.txt&lt;br /&gt;
&lt;br /&gt;
=== For loops ===&lt;br /&gt;
&lt;br /&gt;
  //For all files in fold that start with l, echo the title&lt;br /&gt;
  for i in l*; do&lt;br /&gt;
    echo $i&lt;br /&gt;
  done&lt;br /&gt;
&lt;br /&gt;
=== Bg vs fg ===&lt;br /&gt;
  Bash waits or doesn&#039;t for return&lt;br /&gt;
  Both write to stdout as normal&lt;br /&gt;
&lt;br /&gt;
=== Shell vars ===&lt;br /&gt;
  shell vars only apply to shell. Live in shell&lt;br /&gt;
  environment is more global, but typically a COPY is passed on to child processes&lt;br /&gt;
  envp is a series of keyvalue strings passed in with exec*&lt;br /&gt;
&lt;br /&gt;
== Lab2 ==&lt;br /&gt;
&lt;br /&gt;
=== Processes ===&lt;br /&gt;
&lt;br /&gt;
  ps aux&lt;br /&gt;
  ps -e&lt;br /&gt;
  top&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  run pstree.&lt;br /&gt;
  notice that cron, upstart-socket, and others are owned by init. These are daemons.&lt;br /&gt;
&lt;br /&gt;
  notice that gnome display manager is a child of lightdm. Killing lightdm kills&lt;br /&gt;
  gnome. That&#039;s why we had to log into a virtual console&lt;br /&gt;
&lt;br /&gt;
=== Upstart ===&lt;br /&gt;
  &lt;br /&gt;
  init is upstart&lt;br /&gt;
  started by kernel. It&#039;s the only think the kernel runs in userspace&lt;br /&gt;
&lt;br /&gt;
  shutdown -r now&lt;br /&gt;
  switches to run level 6&lt;br /&gt;
&lt;br /&gt;
  shutdown -h now&lt;br /&gt;
  switches to run level zero&lt;br /&gt;
&lt;br /&gt;
  symlinks in /etc/init.d point to /lib/init/upstart-job&lt;br /&gt;
  successful sysV to upstart transition&lt;br /&gt;
&lt;br /&gt;
  Upstart&#039;s entire deal is revamp the ol&#039; sysV boot seq&lt;br /&gt;
&lt;br /&gt;
  traditional init process is strictly synchronous, blocking future tasks until the&lt;br /&gt;
  current one has completed. &lt;br /&gt;
&lt;br /&gt;
  upstart is async. and allows more parralleissimsimsmmmsm&lt;br /&gt;
&lt;br /&gt;
=== Logs ===&lt;br /&gt;
&lt;br /&gt;
  /var/log &lt;br /&gt;
&lt;br /&gt;
  use lsof to check who&#039;s accessing a file.&lt;br /&gt;
&lt;br /&gt;
  Rule of thumb.&lt;br /&gt;
    if logfile is generic, then written to by rsyslog (udev, auth, etc)&lt;br /&gt;
    if logfile has program name, written to by that program (apache)&lt;br /&gt;
&lt;br /&gt;
  rsyslog&lt;br /&gt;
    daemon that handles syslog protocol&lt;br /&gt;
    handles generic logging for system&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Lab 3 ==&lt;br /&gt;
&lt;br /&gt;
=== Tracing ===&lt;br /&gt;
&lt;br /&gt;
  ltrace, strace&lt;br /&gt;
  Statically linking will make ltrace output nothing.&lt;br /&gt;
&lt;br /&gt;
=== writing to files ===&lt;br /&gt;
&lt;br /&gt;
  File * f = fopen(path, &amp;quot;w&amp;quot;)&lt;br /&gt;
  fprintf(f,&amp;quot;blah&amp;quot;)&lt;br /&gt;
  fclose(f)&lt;br /&gt;
&lt;br /&gt;
=== exec* ===&lt;br /&gt;
&lt;br /&gt;
  the exec family of functions replace the current process image with that of&lt;br /&gt;
  another file/binary.&lt;br /&gt;
  Does not return value if successful, -1 on failure&lt;br /&gt;
  Process keeps same PID&lt;br /&gt;
  &lt;br /&gt;
  execvp() inherits the current process&#039;s environment variables&lt;br /&gt;
  execve() needs to have the environment variables passed in as an array of pointers&lt;br /&gt;
  to null terminated strings.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
=== Other  ===&lt;br /&gt;
&lt;br /&gt;
  kill sends signals.&lt;br /&gt;
&lt;br /&gt;
  used as follows: &lt;br /&gt;
    &amp;quot;kill &amp;lt;-command&amp;gt; &amp;lt;PID of program&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  Important kill signals:&lt;br /&gt;
    -SIGINT or -2   -&amp;gt; (crtl-C) sends a kill signal to program, can be ignored. SIGINT is also the default signal used by kill. (ie. kill &amp;lt;PID&amp;gt; = kill -2 &amp;lt;PID&amp;gt;)&lt;br /&gt;
    -SIGSTP         -&amp;gt; (crtl-Z) sends suspend program signal, to resume it use fg &amp;lt;pid or jobnumber&amp;gt; or bg &amp;lt;pid or jobnumber&amp;gt; or send SIGCONT&lt;br /&gt;
    -SIGSTOP        -&amp;gt; same as SIGSTP, except no shortcut keys and it is unblockable.&lt;br /&gt;
    -SIGCONT        -&amp;gt; Continue signal, resumes a stopped program&lt;br /&gt;
    -SIGFPE         -&amp;gt; floating point exception (dividing by zero)&lt;br /&gt;
    -SIGEGV         -&amp;gt; Segmentation fault signal.&lt;br /&gt;
    -SIGCHLD        -&amp;gt; Signal sent to parent when child terminates.&lt;br /&gt;
    -SIGKILL or -9  -&amp;gt; Unblockable kill signal&lt;/div&gt;</summary>
		<author><name>Windowpane</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_2012_Midterm_Material&amp;diff=17520</id>
		<title>Talk:COMP 3000 2012 Midterm Material</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_2012_Midterm_Material&amp;diff=17520"/>
		<updated>2012-10-26T00:32:46Z</updated>

		<summary type="html">&lt;p&gt;Windowpane: /* Other */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
= Discussion =&lt;br /&gt;
&lt;br /&gt;
= Only the facts =&lt;br /&gt;
I&#039;ll be putting up my notes of notes up here. Hopefully people can benefit from these. I&#039;ll be summing up the answers from the lab and adding a few more details here and there.&lt;br /&gt;
&lt;br /&gt;
== Lab 1 ==&lt;br /&gt;
=== Types of shell commands ===&lt;br /&gt;
  Built ins&lt;br /&gt;
  Shell functions&lt;br /&gt;
  binaries (scripts and binaries&lt;br /&gt;
  alias &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Shell builtins vs binaries ===&lt;br /&gt;
  binaries exist elsewhere&lt;br /&gt;
  faster, no forking needed&lt;br /&gt;
  Kernel functions (IO redirection)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ls -l ===&lt;br /&gt;
&lt;br /&gt;
  1          2  3     4   5     6             7&lt;br /&gt;
  -rwxr-xr-x 1 root root 104508 Mar 31  2012 /bin/ls&lt;br /&gt;
&lt;br /&gt;
    U  G  O&lt;br /&gt;
  -rwxrwxrwx&lt;br /&gt;
&lt;br /&gt;
  Memnonic: &#039;You go hugo!&#039;&lt;br /&gt;
&lt;br /&gt;
  - denotes a regular file&lt;br /&gt;
  d denotes a directory&lt;br /&gt;
  b denotes a block special file&lt;br /&gt;
  c denotes a character special file&lt;br /&gt;
  l denotes a symbolic link&lt;br /&gt;
  p denotes a named pipe&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  2) 1 link to /bin/ls&lt;br /&gt;
  3) user root&lt;br /&gt;
  4) group root&lt;br /&gt;
  5) size in bytes&lt;br /&gt;
  6) date last modified&lt;br /&gt;
  7) path/filename&lt;br /&gt;
&lt;br /&gt;
=== I/O redirection ===&lt;br /&gt;
  &amp;lt;&amp;lt; keyword    HEREDOC. Input until program reads specified keyword&lt;br /&gt;
  &amp;gt;&amp;gt; append&lt;br /&gt;
  &amp;lt; read from path&lt;br /&gt;
  &amp;gt; write to path, blow away anything there&lt;br /&gt;
  | pipes&lt;br /&gt;
&lt;br /&gt;
=== file descriptors ===&lt;br /&gt;
  0 stdin&lt;br /&gt;
  1 stdout&lt;br /&gt;
  2 stderr&lt;br /&gt;
  3-9 other&lt;br /&gt;
&lt;br /&gt;
fd redirection&lt;br /&gt;
  #&amp;gt; where # is a file descriptor&lt;br /&gt;
  a&amp;gt;&amp;amp;b redirects file descriptor a to b.&lt;br /&gt;
&lt;br /&gt;
  COMMAND &amp;amp;&amp;gt;&amp;gt; file.txt&lt;br /&gt;
  Appends BOTH STDERR and STDOUT to file.txt&lt;br /&gt;
&lt;br /&gt;
=== For loops ===&lt;br /&gt;
&lt;br /&gt;
  //For all files in fold that start with l, echo the title&lt;br /&gt;
  for i in l*; do&lt;br /&gt;
    echo $i&lt;br /&gt;
  done&lt;br /&gt;
&lt;br /&gt;
=== Bg vs fg ===&lt;br /&gt;
  Bash waits or doesn&#039;t for return&lt;br /&gt;
  Both write to stdout as normal&lt;br /&gt;
&lt;br /&gt;
=== Shell vars ===&lt;br /&gt;
  shell vars only apply to shell. Live in shell&lt;br /&gt;
  environment is more global, but typically a COPY is passed on to child processes&lt;br /&gt;
  envp is a series of keyvalue strings passed in with exec*&lt;br /&gt;
&lt;br /&gt;
== Lab2 ==&lt;br /&gt;
&lt;br /&gt;
=== Processes ===&lt;br /&gt;
&lt;br /&gt;
  ps aux&lt;br /&gt;
  ps -e&lt;br /&gt;
  top&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  run pstree.&lt;br /&gt;
  notice that cron, upstart-socket, and others are owned by init. These are daemons.&lt;br /&gt;
&lt;br /&gt;
  notice that gnome display manager is a child of lightdm. Killing lightdm kills&lt;br /&gt;
  gnome. That&#039;s why we had to log into a virtual console&lt;br /&gt;
&lt;br /&gt;
=== Upstart ===&lt;br /&gt;
  &lt;br /&gt;
  init is upstart&lt;br /&gt;
  started by kernel. It&#039;s the only think the kernel runs in userspace&lt;br /&gt;
&lt;br /&gt;
  shutdown -r now&lt;br /&gt;
  switches to run level 6&lt;br /&gt;
&lt;br /&gt;
  shutdown -h now&lt;br /&gt;
  switches to run level zero&lt;br /&gt;
&lt;br /&gt;
  symlinks in /etc/init.d point to /lib/init/upstart-job&lt;br /&gt;
  successful sysV to upstart transition&lt;br /&gt;
&lt;br /&gt;
  Upstart&#039;s entire deal is revamp the ol&#039; sysV boot seq&lt;br /&gt;
&lt;br /&gt;
  traditional init process is strictly synchronous, blocking future tasks until the&lt;br /&gt;
  current one has completed. &lt;br /&gt;
&lt;br /&gt;
  upstart is async. and allows more parralleissimsimsmmmsm&lt;br /&gt;
&lt;br /&gt;
=== Logs ===&lt;br /&gt;
&lt;br /&gt;
  /var/log &lt;br /&gt;
&lt;br /&gt;
  use lsof to check who&#039;s accessing a file.&lt;br /&gt;
&lt;br /&gt;
  Rule of thumb.&lt;br /&gt;
    if logfile is generic, then written to by rsyslog (udev, auth, etc)&lt;br /&gt;
    if logfile has program name, written to by that program (apache)&lt;br /&gt;
&lt;br /&gt;
  rsyslog&lt;br /&gt;
    daemon that handles syslog protocol&lt;br /&gt;
    handles generic logging for system&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Lab 3 ==&lt;br /&gt;
&lt;br /&gt;
=== Tracing ===&lt;br /&gt;
&lt;br /&gt;
  ltrace, strace&lt;br /&gt;
  Statically linking will make ltrace output nothing.&lt;br /&gt;
&lt;br /&gt;
=== writing to files ===&lt;br /&gt;
&lt;br /&gt;
  File * f = fopen(path, &amp;quot;w&amp;quot;)&lt;br /&gt;
  fprintf(f,&amp;quot;blah&amp;quot;)&lt;br /&gt;
  fclose(f)&lt;br /&gt;
&lt;br /&gt;
=== exec* ===&lt;br /&gt;
&lt;br /&gt;
  the exec family of functions replace the current process image with that of&lt;br /&gt;
  another file/binary.&lt;br /&gt;
  Does not return value if successful, -1 on failure&lt;br /&gt;
  Process keeps same PID&lt;br /&gt;
  &lt;br /&gt;
  execvp() inherits the current process&#039;s environment variables&lt;br /&gt;
  execve() needs to have the environment variables passed in as an array of pointers&lt;br /&gt;
  to null terminated strings.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
=== Other  ===&lt;br /&gt;
&lt;br /&gt;
  kill sends signals.&lt;br /&gt;
&lt;br /&gt;
  used as follows: &lt;br /&gt;
    &amp;quot;kill &amp;lt;-command&amp;gt; &amp;lt;PID of program&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  Important kill signals:&lt;br /&gt;
    -SIGINT or -2   -&amp;gt; (crtl-C) sends a kill signal to program, can be ignored. SIGINT is also the default signal used by kill. (ie. kill &amp;lt;PID&amp;gt; = kill -2 &amp;lt;PID&amp;gt;)&lt;br /&gt;
    -SIGSTP         -&amp;gt; (crtl-Z) sends suspend program signal, to resume it use fg &amp;lt;pid or jobnumber&amp;gt; or bg &amp;lt;pid or jobnumber&amp;gt; or send SIGCONT&lt;br /&gt;
    -SIGSTOP        -&amp;gt; same as SIGSTP, except no shortcut keys and it is unblockable.&lt;br /&gt;
    -SIGCONT        -&amp;gt; Continue signal, resumes a stopped program&lt;br /&gt;
    -SIGFPE         -&amp;gt; floating point exception (dividing by zero)&lt;br /&gt;
    -SIGEGV         -&amp;gt; Segmentation fault signal.&lt;br /&gt;
    -SIGCHLD        -&amp;gt; Signal sent to parent when child terminates.&lt;br /&gt;
    -SIGKILL or -9  -&amp;gt; Unblockable kill signal&lt;/div&gt;</summary>
		<author><name>Windowpane</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_2012_Midterm_Material&amp;diff=17519</id>
		<title>Talk:COMP 3000 2012 Midterm Material</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_2012_Midterm_Material&amp;diff=17519"/>
		<updated>2012-10-26T00:10:24Z</updated>

		<summary type="html">&lt;p&gt;Windowpane: /* Other */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
= Discussion =&lt;br /&gt;
&lt;br /&gt;
= Only the facts =&lt;br /&gt;
I&#039;ll be putting up my notes of notes up here. Hopefully people can benefit from these. I&#039;ll be summing up the answers from the lab and adding a few more details here and there.&lt;br /&gt;
&lt;br /&gt;
== Lab 1 ==&lt;br /&gt;
=== Types of shell commands ===&lt;br /&gt;
  Built ins&lt;br /&gt;
  Shell functions&lt;br /&gt;
  binaries (scripts and binaries&lt;br /&gt;
  alias &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Shell builtins vs binaries ===&lt;br /&gt;
  binaries exist elsewhere&lt;br /&gt;
  faster, no forking needed&lt;br /&gt;
  Kernel functions (IO redirection)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ls -l ===&lt;br /&gt;
&lt;br /&gt;
  1          2  3     4   5     6             7&lt;br /&gt;
  -rwxr-xr-x 1 root root 104508 Mar 31  2012 /bin/ls&lt;br /&gt;
&lt;br /&gt;
    U  G  O&lt;br /&gt;
  -rwxrwxrwx&lt;br /&gt;
&lt;br /&gt;
  Memnonic: &#039;You go hugo!&#039;&lt;br /&gt;
&lt;br /&gt;
  - denotes a regular file&lt;br /&gt;
  d denotes a directory&lt;br /&gt;
  b denotes a block special file&lt;br /&gt;
  c denotes a character special file&lt;br /&gt;
  l denotes a symbolic link&lt;br /&gt;
  p denotes a named pipe&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  2) 1 link to /bin/ls&lt;br /&gt;
  3) user root&lt;br /&gt;
  4) group root&lt;br /&gt;
  5) size in bytes&lt;br /&gt;
  6) date last modified&lt;br /&gt;
  7) path/filename&lt;br /&gt;
&lt;br /&gt;
=== I/O redirection ===&lt;br /&gt;
  &amp;lt;&amp;lt; keyword    HEREDOC. Input until program reads specified keyword&lt;br /&gt;
  &amp;gt;&amp;gt; append&lt;br /&gt;
  &amp;lt; read from path&lt;br /&gt;
  &amp;gt; write to path, blow away anything there&lt;br /&gt;
  | pipes&lt;br /&gt;
&lt;br /&gt;
=== file descriptors ===&lt;br /&gt;
  0 stdin&lt;br /&gt;
  1 stdout&lt;br /&gt;
  2 stderr&lt;br /&gt;
  3-9 other&lt;br /&gt;
&lt;br /&gt;
fd redirection&lt;br /&gt;
  #&amp;gt; where # is a file descriptor&lt;br /&gt;
  a&amp;gt;&amp;amp;b redirects file descriptor a to b.&lt;br /&gt;
&lt;br /&gt;
  COMMAND &amp;amp;&amp;gt;&amp;gt; file.txt&lt;br /&gt;
  Appends BOTH STDERR and STDOUT to file.txt&lt;br /&gt;
&lt;br /&gt;
=== For loops ===&lt;br /&gt;
&lt;br /&gt;
  //For all files in fold that start with l, echo the title&lt;br /&gt;
  for i in l*; do&lt;br /&gt;
    echo $i&lt;br /&gt;
  done&lt;br /&gt;
&lt;br /&gt;
=== Bg vs fg ===&lt;br /&gt;
  Bash waits or doesn&#039;t for return&lt;br /&gt;
  Both write to stdout as normal&lt;br /&gt;
&lt;br /&gt;
=== Shell vars ===&lt;br /&gt;
  shell vars only apply to shell. Live in shell&lt;br /&gt;
  environment is more global, but typically a COPY is passed on to child processes&lt;br /&gt;
  envp is a series of keyvalue strings passed in with exec*&lt;br /&gt;
&lt;br /&gt;
== Lab2 ==&lt;br /&gt;
&lt;br /&gt;
=== Processes ===&lt;br /&gt;
&lt;br /&gt;
  ps aux&lt;br /&gt;
  ps -e&lt;br /&gt;
  top&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  run pstree.&lt;br /&gt;
  notice that cron, upstart-socket, and others are owned by init. These are daemons.&lt;br /&gt;
&lt;br /&gt;
  notice that gnome display manager is a child of lightdm. Killing lightdm kills&lt;br /&gt;
  gnome. That&#039;s why we had to log into a virtual console&lt;br /&gt;
&lt;br /&gt;
=== Upstart ===&lt;br /&gt;
  &lt;br /&gt;
  init is upstart&lt;br /&gt;
  started by kernel. It&#039;s the only think the kernel runs in userspace&lt;br /&gt;
&lt;br /&gt;
  shutdown -r now&lt;br /&gt;
  switches to run level 6&lt;br /&gt;
&lt;br /&gt;
  shutdown -h now&lt;br /&gt;
  switches to run level zero&lt;br /&gt;
&lt;br /&gt;
  symlinks in /etc/init.d point to /lib/init/upstart-job&lt;br /&gt;
  successful sysV to upstart transition&lt;br /&gt;
&lt;br /&gt;
  Upstart&#039;s entire deal is revamp the ol&#039; sysV boot seq&lt;br /&gt;
&lt;br /&gt;
  traditional init process is strictly synchronous, blocking future tasks until the&lt;br /&gt;
  current one has completed. &lt;br /&gt;
&lt;br /&gt;
  upstart is async. and allows more parralleissimsimsmmmsm&lt;br /&gt;
&lt;br /&gt;
=== Logs ===&lt;br /&gt;
&lt;br /&gt;
  /var/log &lt;br /&gt;
&lt;br /&gt;
  use lsof to check who&#039;s accessing a file.&lt;br /&gt;
&lt;br /&gt;
  Rule of thumb.&lt;br /&gt;
    if logfile is generic, then written to by rsyslog (udev, auth, etc)&lt;br /&gt;
    if logfile has program name, written to by that program (apache)&lt;br /&gt;
&lt;br /&gt;
  rsyslog&lt;br /&gt;
    daemon that handles syslog protocol&lt;br /&gt;
    handles generic logging for system&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Lab 3 ==&lt;br /&gt;
&lt;br /&gt;
=== Tracing ===&lt;br /&gt;
&lt;br /&gt;
  ltrace, strace&lt;br /&gt;
  Statically linking will make ltrace output nothing.&lt;br /&gt;
&lt;br /&gt;
=== writing to files ===&lt;br /&gt;
&lt;br /&gt;
  File * f = fopen(path, &amp;quot;w&amp;quot;)&lt;br /&gt;
  fprintf(f,&amp;quot;blah&amp;quot;)&lt;br /&gt;
  fclose(f)&lt;br /&gt;
&lt;br /&gt;
=== exec* ===&lt;br /&gt;
&lt;br /&gt;
  the exec family of functions replace the current process image with that of&lt;br /&gt;
  another file/binary.&lt;br /&gt;
  Does not return value if successful, -1 on failure&lt;br /&gt;
  Process keeps same PID&lt;br /&gt;
  &lt;br /&gt;
  execvp() inherits the current process&#039;s environment variables&lt;br /&gt;
  execve() needs to have the environment variables passed in as an array of pointers&lt;br /&gt;
  to null terminated strings.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
=== Other  ===&lt;br /&gt;
&lt;br /&gt;
  kill sends signals.&lt;br /&gt;
&lt;br /&gt;
  used as follows: &lt;br /&gt;
    &amp;quot;kill &amp;lt;-command&amp;gt; &amp;lt;PID of program&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  Important kill signals:&lt;br /&gt;
    -SIGINT or -2   -&amp;gt; (crtl-C) sends a kill signal to program, can be ignored.&lt;br /&gt;
    -SIGSTP         -&amp;gt; (crtl-Z) sends suspend program signal, to resume it use fg &amp;lt;pid or jobnumber&amp;gt; or bg &amp;lt;pid or jobnumber&amp;gt; or send SIGCONT&lt;br /&gt;
    -SIGSTOP        -&amp;gt; same as SIGSTP, except no shortcut keys and it is unblockable.&lt;br /&gt;
    -SIGCONT        -&amp;gt; Continue signal, resumes a stopped program&lt;br /&gt;
    -SIGFPE         -&amp;gt; floating point exception (dividing by zero)&lt;br /&gt;
    -SIGEGV         -&amp;gt; Segmentation fault signal.&lt;br /&gt;
    -SIGCHLD        -&amp;gt; Signal sent to parent when child terminates.&lt;br /&gt;
    -SIGKILL or -9  -&amp;gt; Unblockable kill signal&lt;/div&gt;</summary>
		<author><name>Windowpane</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Lab_4_2012&amp;diff=17442</id>
		<title>Talk:COMP 3000 Lab 4 2012</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Lab_4_2012&amp;diff=17442"/>
		<updated>2012-10-17T21:27:19Z</updated>

		<summary type="html">&lt;p&gt;Windowpane: Created page with &amp;quot;    Question aAbout padding from Part B - question 2:   Does padding only occur at the end of the file? For example, if our file A is 256 bytes, the padding in file B will make i…&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Question aAbout padding from Part B - question 2:&lt;br /&gt;
  Does padding only occur at the end of the file? For example, if our file A is 256 bytes, the padding in file B will make it 512 bytes?&lt;br /&gt;
  Also, does a space character count as padding, or should we use null characters? (or are they the same)&lt;/div&gt;</summary>
		<author><name>Windowpane</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Lab_1_2012&amp;diff=17282</id>
		<title>Talk:COMP 3000 Lab 1 2012</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Lab_1_2012&amp;diff=17282"/>
		<updated>2012-09-24T15:34:32Z</updated>

		<summary type="html">&lt;p&gt;Windowpane: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Most useless piece of information I&#039;ve ever received from a unix command:&lt;br /&gt;
&lt;br /&gt;
  spratt@lambda03:~$ type `which pwd`&lt;br /&gt;
  /bin/pwd is /bin/pwd&lt;br /&gt;
&lt;br /&gt;
- [[User:Sdp|sdp]]&lt;br /&gt;
&lt;br /&gt;
Not true, it could be a symbolic link in some cases.&lt;br /&gt;
&lt;br /&gt;
-windowpane&lt;/div&gt;</summary>
		<author><name>Windowpane</name></author>
	</entry>
</feed>