summaryrefslogtreecommitdiff
path: root/labs
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2019-07-25 06:50:12 -0400
committerFrans Kaashoek <[email protected]>2019-07-25 06:50:12 -0400
commit8c12928cc59b5a0b1d9aa6aada2772d0d2320542 (patch)
treefedf09eae2f03fee13c391fe987d7a6fb1f3a7d8 /labs
parent4e62de64cd3b8b67bdb2c3d8edab1ca353427a84 (diff)
downloadxv6-labs-8c12928cc59b5a0b1d9aa6aada2772d0d2320542.tar.gz
xv6-labs-8c12928cc59b5a0b1d9aa6aada2772d0d2320542.tar.bz2
xv6-labs-8c12928cc59b5a0b1d9aa6aada2772d0d2320542.zip
First draft of first lab assignment?
Diffstat (limited to 'labs')
-rw-r--r--labs/xv6.html38
1 files changed, 38 insertions, 0 deletions
diff --git a/labs/xv6.html b/labs/xv6.html
index fcbb234..2f6a4ae 100644
--- a/labs/xv6.html
+++ b/labs/xv6.html
@@ -178,6 +178,44 @@ initial file system. You just ran one of them: <tt>ls</tt>.
<li>Don't recurse into "." and "..".
</ul>
+<p>Optional: support regular expressions in name matching. Grep has some
+ primitive support for regular expressions.
+
+<h2>xargs</h2>
+
+<p>Write a simple version of the UNIX xargs program: read lines from
+ standard in and run a command for each line, supplying the line as
+ arguments to the command. The following example illustrates xarg's
+ behavior:
+ <pre>
+ $ xargs echo bye
+ hello too
+ bye hello too
+ <ctrl-d>
+ $
+ </pre>
+ Note that the command here is "echo bye" and the additional
+ arguments are "hello too", making the command "echo bye hello too",
+ which outputs "bye hello too".
+
+<p>xargs and find combine well:
+ <pre>
+ find . b | xargs grep hello
+ </pre>
+ will run "grep hello" on each file named b in the directories below ".".
+
+<p>Some hints:
+ <ul>
+ <li>Use <tt>fork</tt> and <tt>exec</tt> system call to invoke the
+ command on each line of input. Use <tt>wait</tt> in the parent
+ to wait for the child to complete running the command.
+ <li>Read from stdin a character at the time until the newline
+ character ('\n').
+ <li>kernel/param.h declares MAXARG, which may be useful if you need
+ to declare an argv.
+ </ul>
+
+
<h2>Optional: modify the shell</h2>
<p>Modify the shell to support wait.