Commit Graph

20 Commits

Author SHA1 Message Date
Andreas Kling
723f4e5ee6 Meta: Scale back overly informal user-facing strings
We were getting a little overly memey in some places, so let's scale
things back to business-casual.

Informal language is fine in comments, commits and debug logs,
but let's keep the runtime nice and presentable. :^)
2020-06-17 18:35:49 +02:00
Sergey Bugaev
c39045b222 Userland: Improve cat(1)
* Port it to Core::ArgsParser - even though it doesn't support any options
  at the moment, it's nice to handle --help and reject other options;
* Accept "-" to mean stdin;
* Make sure to write out all data that we read, looping if needed;
* Detect Useless Uses of Cat and print a cute warning :^)
2020-06-17 15:02:03 +02:00
Andreas Kling
94ca55cefd Meta: Add license header to source files
As suggested by Joshua, this commit adds the 2-clause BSD license as a
comment block to the top of every source file.

For the first pass, I've just added myself for simplicity. I encourage
everyone to add themselves as copyright holders of any file they've
added or modified in some significant way. If I've added myself in
error somewhere, feel free to replace it with the appropriate copyright
holder instead.

Going forward, all new source files should include a license header.
2020-01-18 09:45:54 +01:00
Andreas Kling
e131a401e8 cat: Use pledge() 2020-01-11 21:33:12 +01:00
Andreas Kling
ddd8332015 cat: Use a 32 KB I/O buffer here to improve "cat a > b" scenario
This is roughly twice as fast as the old 4 KB buffer size. We still
don't go nearly as fast as "cp", since we don't ftruncate() up front
like "cp" does.
2019-11-03 00:09:17 +01:00
balatt
b583f21e27 Userland: cat no longer tries to open "cat"
I made the mistake of starting the initial for loop at i=0 when it
should have started at 1. argv[0] is the program name, argv[1] is an
argument.
2019-10-31 06:57:41 +01:00
balatt
5442e365c9 cat: Updated to handle multiple input files (#694)
Now concatenates multiple files at once with a for loop iterating
through a vector of file arguments.
2019-10-29 16:08:09 +01:00
Andreas Kling
b07bbf383d Userland: Run clang-format on everything. 2019-06-07 11:49:31 +02:00
Andreas Kling
6fa727a88e cat: Fix some oversights in error handling.
Error messages should go to stderr so they don't get mixed in with the
program's output. Also added a check for the return value of write().
2019-06-06 11:00:48 +02:00
Andreas Kling
df8e76a67c cat: Just use fd 0 when no arguments are passed.
I'm not sure why it seemed necessary at some point to open /dev/stdin rather
than simply using the already-open fd 0.
2019-04-25 16:01:28 +02:00
Andreas Kling
31f44481f3 Add /dev/{stdin,stdout,stderr} as symlinks to /proc/self/fd/{0,1,2}
Also change /bin/cat to open /dev/stdin if no arguments are provided.
2019-02-03 12:38:03 +01:00
Andreas Kling
303577df16 Various stubs while trying to get an old coreutils to build. 2018-11-17 15:56:09 +01:00
Andreas Kling
da3857b0c2 Add some simple write buffering to LibC's stdio.
Plumb it all the way to the VirtualConsole. Also fix /bin/cat to write()
the whole chunks we get from read() directly to stdout.
2018-11-08 01:23:47 +01:00
Andreas Kling
153ea704af Add some basic signal support.
It only works for sending a signal to a process that's in userspace code.

We implement reception by synthesizing a PUSHA+PUSHF in the receiving process
(operating on values in the TSS.)
The TSS CS:EIP is then rerouted to the signal handler and a tiny return
trampoline is constructed in a dedicated region in the receiving process.

Also hacked up /bin/kill to be able to send arbitrary signals (kill -N PID)
2018-11-06 10:56:41 +01:00
Andreas Kling
20fb1fc377 Fix some bugs in execve() and make sh use it for process launching.
Interrupting children of sh now always works with ^C :^)
2018-11-03 02:08:06 +01:00
Andreas Kling
10b666f69a Basic ^C interrupt implementation.
For testing, I made cat put itself into a new process group.
This should eventually be done by sh between fork() and exec().
2018-11-02 14:06:48 +01:00
Andreas Kling
97726862dd Add basic symlink support.
- sys$readlink + readlink()
- Add a /proc/PID/exe symlink to the process's executable.
- Print symlink contents in ls output.
- Some work on plumbing options into VFS::open().
2018-10-28 14:11:51 +01:00
Andreas Kling
2716a9e2d7 Greatly improve /proc/PID/stack by tracing the ebp frame chain.
I also added a generator cache to FileHandle. This way, multiple
reads to a generated file (i.e in a synthfs) can transparently
handle multiple calls to read() without the contents changing
between calls.

The cache is discarded at EOF (or when the FileHandle is destroyed.)
2018-10-27 00:14:24 +02:00
Andreas Kling
c928b06218 Add a very hackish /proc/PID/stack.
It walks the stack and identifies anything that looks like a kernel symbol.
This could be a lot more sophisticated.
2018-10-26 22:33:15 +02:00
Andreas Kling
df87dda63c Implement argc/argv support for spawned tasks.
Celebrate the new functionality with a simple /bin/cat implementation. :^)
2018-10-26 11:16:56 +02:00