Commit Graph

2709 Commits

Author SHA1 Message Date
Andreas Kling
bf905225e7 Kernel: Tidy up sys$select() to make it more readable. 2019-06-06 17:49:01 +02:00
Andreas Kling
6e4f0b3cc5 Terminal: Reallocate kept lines when resizing the terminal.
Otherwise we end up with garbage text when making the window bigger.
2019-06-06 14:59:18 +02:00
Andreas Kling
e8f35ef311 Terminal: Store horizontal tabs in a Vector.
There's no need to muck around with manual malloc()/free() here.
2019-06-06 11:42:05 +02:00
Andreas Kling
ecb72dd991 Shell: Print the name of each process whose exit status we're reporting. 2019-06-06 11:00:48 +02:00
Andreas Kling
036d808e96 Shell: Check the exit status of all spawned child processes. 2019-06-06 11:00:48 +02:00
Andreas Kling
e4cfa9a686 FIFO: Raise SIGPIPE in processes that write() to a broken pipe. 2019-06-06 11:00:48 +02:00
Andreas Kling
abb3643d88 tail: Shell programs should return 1 to indicate failure. 2019-06-06 11:00:48 +02:00
Andreas Kling
1f17b40d00 FIFO: Let write() fail with EPIPE if there's no reader. 2019-06-06 11:00:48 +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
Conrad Pankoff
fe380d8f49 Documentation: Describe compatible QEMU versions 2019-06-06 09:42:14 +02:00
Andreas Kling
01f1333856 LookupServer+LibC: Add support for reverse DNS lookups via gethostbyaddr().
LookupServer can now take two types of requests:

* L: Lookup
* R: Reverse lookup

The /bin/host program now does a reverse lookup if the input string is a
valid IPv4 address. :^)
2019-06-06 05:35:03 +02:00
Andreas Kling
d03505bc29 LibC: inet_pton() should return 1 on success, 0 or -1 on failure. 2019-06-06 05:25:18 +02:00
Larkin Nickle
d080f6e8dd Ports: Remove bashisms and switch all scripts to /bin/sh. 2019-06-05 14:00:01 +02:00
Andreas Kling
800242ed4e CEventLoop: Don't bother looking through fds when select() returns 0.
If it returns 0 that just means we hit the timeout. I suppose we could skip
the timer checks if there are a non-zero number of fds marked as well, but
I'm not sure that's a great idea since it will add some latency.
2019-06-05 01:57:28 -07:00
Andreas Kling
848044b74c Shell: Separate fd rewirings from redirections.
This was unnecessarily confusing. When we build up a chain of commands
connected by pipes, we now store the file descriptors of each end of
these pipes as rewirings in a vector. The rewirings are then put into
effect by calls to dup2().
2019-06-04 20:36:08 +02:00
Andreas Kling
59dae9a766 Make sure the CI has qemu-utils installed. 2019-06-04 16:38:14 +02:00
Conrad Pankoff
e1c982e4db Build: Remove grub from default build process
This removes grub and all the loopback device business from the default
build process. Running grub takes about a second, and it turns out it's
inconsistently packaged in different distributions, which has led to
at least one confusing issue so far (grub-install vs grub2-install).
Removing it from the basic path will make it easier for people to try
Serenity out.

There are now two scripts that can be used to build a disk image:

1. `build-image-grub.sh` - this will build an image suitable for writing
   to the IDE hard drive of a physical machine, complete with a partition
   table and bootloader. This can be run in qemu with the `qgrub` target
   for the `run` script.
2. `build-image-qemu.sh` - this is a simpler script which creates a bare
   filesystem image rather than a full MBR disk.

Both of these call out to `build-root-filesystem.sh` to do most of the
work setting up... the root filesystem.

For completeness' sake, I've retained the `sync.sh` script as a simple
forwarding to `build-image-qemu.sh`.

This relies on the functionality from #194 and #195. #195 allows us to
use `/dev/hda` as the root device when nothing else is specified, and #194
works around a strange feature of qemu that appends a space to the kernel
command line.
2019-06-04 07:15:44 -07:00
Conrad Pankoff
0aa1f1c2d6 Kernel: Parse cmdline for root filesystem e.g. root=/dev/hda1
This introduces very basic handling of the kernel command line to choose
the root filesystem at startup. Given that we currently only support a
single IDE hard drive, it's hard-coded to look for `/dev/hda` at the start
of the argument.

If there is nothing following this, or if the parameter is empty,
init_stage2 will try to load the ext2 filesystem from the start of the
device. This is intended to be the default behaviour when running
development builds, as it is faster to set up and doesn't require a
working grub installation.

If `/dev/hda` is followed by a number, init_stage2 will try to read an MBR
partition header from the drive, then load the requested partition. It
will reject non-numeric trailing data, and anything outside of partitions
one through four.
2019-06-04 07:14:40 -07:00
Conrad Pankoff
d7734bf232 Kernel: Fix KParams parsing with trailing space in kernel cmdline
When there's a trailing space in the cmdline from the boot loader, this
results in an empty string being emitted from `String::split` after
splitting apart the argument list. This empty string resulted in a
zero-length Vector from the subsequent call to split the key=value pairs,
which was unexpected. This ultimately caused a crash when we tried to
access `[0]` of that zero-length vector.

We now detect and handle an empty string coming from `String::split`
correctly.
2019-06-04 07:08:07 -07:00
Conrad Pankoff
419e886497 AK: Add String::starts_with to match String::ends_with 2019-06-04 04:58:35 -07:00
Conrad Pankoff
738f9de9a9 Kernel: Add KParams class for accessing kernel cmdline parameters (#188) 2019-06-04 03:54:27 -07:00
Conrad Pankoff
042895317d AK: Add AKString::split_limit to split strings with a limit
This is a small change to the existing split() functionality to support
the case of splitting a string and stopping at a certain number of
tokens. This is useful for parsing e.g. key/value pairs, where the value
may contain the delimiter you're splitting on.
2019-06-04 10:16:45 +02:00
Andreas Kling
ccc6e69a29 LibC: Implement popen() and pclose().
I feel reasonably confident that I might have gotten these right. :^)
2019-06-03 21:17:58 +02:00
Christopher Dumas
e92fe52031 Terminal: Use Vectors and OwnPtrs for Terminal lines. Adjust scroll
region behavior
2019-06-03 20:48:34 +02:00
Christopher Dumas
ce15a4021d Terminal: Implement scroll region termcodes 2019-06-03 20:48:34 +02:00
Robin Burchell
ab004f73bf Painter: Reduce the number of draw_text overloads to only involve StringView
No more char + int sequences, as that's literally what StringView is for.
2019-06-03 20:27:05 +02:00
Robin Burchell
1024dfa81a StringViewize a bunch of things -- mostly LibGUI 2019-06-03 20:27:05 +02:00
Robin Burchell
f9ba7adae2 StringView: Make construction of String from a StringView containing a String cheaper
... at the cost of an additional pointer per view.
2019-06-03 20:27:05 +02:00
Christopher Dumas
8fecc0eaee Userland: Implement recursive rm 2019-06-03 20:16:00 +02:00
Andreas Kling
8af495495b LibC: Implement dirfd(). 2019-06-03 18:42:40 +02:00
Andreas Kling
3fa0b6cd92 WindowServer: Always update the maximize button icon when we should.
We were only updating it in the WSButton callback, not when changing the
maximized state by calling WSWindow::set_maximized().

Fixes #119.
2019-06-02 15:35:00 +02:00
Andreas Kling
ae4ac524ad CIODevice: Update m_error if a write() fails. 2019-06-02 15:18:27 +02:00
Conrad Pankoff
c02b8b715d Kernel: Implement MBR partition loader (#168)
This implements a basic MBR partition loader, which removes the reliance
on a hard-coded filesystem offset in the stage2 init.
2019-06-02 14:57:44 +02:00
Robin Burchell
466a817950 sync: Make this work for Fedora
Fedora has grub2-install (rather than grub-install), and it expects
grub.cfg to be placed in boot/grub2/ rather than boot/grub/.
2019-06-02 14:46:59 +02:00
Robin Burchell
7bce096afd Take StringView in more places
We should work towards a pattern where we take StringView as function
arguments, and store String as member, to push the String construction
to the last possible moment.
2019-06-02 12:55:51 +02:00
Robin Burchell
b55b6cd7fc AK: Add implicit String -> StringView conversion
And tidy up existing view() users.
2019-06-02 12:55:51 +02:00
Robin Burchell
decf1afbaa Userland: Use CFile in dmesg 2019-06-02 12:55:51 +02:00
Robin Burchell
7de861bdd9 Userland: Use CFile in mm 2019-06-02 12:55:51 +02:00
Robin Burchell
9a4ec2e92a Userland: Use CFile in ps 2019-06-02 12:55:51 +02:00
Robin Burchell
e74b5975e4 Userland: Use CFile inside sysctl
Also add a StringView overload to CIODevice::write
2019-06-02 12:55:51 +02:00
Andreas Kling
092f06a719 Boot: Let's start GRUB with no timeout. 2019-06-02 12:52:40 +02:00
Andreas Kling
a53c922f8a FileSystem: Rename VFS::fchmod() -> chmod(). 2019-06-02 12:52:21 +02:00
Andreas Kling
e67bfdb7f6 FileSystem: Route chown() and fchown() through VFS for access control. 2019-06-02 12:52:21 +02:00
Andreas Kling
aa35c08633 FileSystem: Only retrieve inode metadata once in VFS::chown(). 2019-06-02 12:52:21 +02:00
vger92
1876606973 Userland: Add tee command (#166) 2019-06-02 12:45:17 +02:00
Conrad Pankoff
32d78a8526 Kernel: Rename OffsetDiskDevice to DiskPartition 2019-06-02 12:37:29 +02:00
Conrad Pankoff
8eb492aa11 Kernel: Rename offset parameter of OffsetDiskDevice to block_offset 2019-06-02 12:37:29 +02:00
Conrad Pankoff
b094fe3f2f Kernel: Add DISK_SIZE option to sync.sh 2019-06-02 12:37:29 +02:00
Conrad Pankoff
6f43f81fb4 Kernel: Implement OffsetDiskDevice to prepare for partition support
This implements a passthrough disk driver that translates the read/write
block addresses by a fixed offset. This could form the basis of MBR
partition support if we were to parse the MBR table at boot and create that
OffsetDiskDevice dynamically, rather than seeking to a fixed offset.

This also introduces a dependency in the form of grub. You'll need to have
32-bit grub binaries installed to build the project now.

As a bonus, divorcing Serenity from qemu's kernel loading means we can now
*technically* boot on real hardware. It just... doesn't get very far yet.
If you write the `_disk_image` file to an IDE hard drive and boot it in a
machine that supports all the basic PC hardware, it *will* start loading
the kernel.
2019-06-02 12:37:29 +02:00
Andreas Kling
5e1c7cb32c Kernel: Memory-mapped files now have the absolute path as their name.
It's generated when the mapping is first created, so it won't update if
the file moves. Maybe that's something we should support, too.
2019-06-02 10:14:28 +02:00