Commit Graph

236 Commits

Author SHA1 Message Date
Andreas Kling
31871557e4 LibC: Add ftruncate() stub. 2019-03-24 00:53:39 +01:00
Andreas Kling
e561ab1b0b Kernel+LibC: Add a simple create_thread() syscall.
It takes two parameters, a function pointer for the entry function,
and a void* argument to be passed to that function on the new thread.
2019-03-23 22:59:08 +01:00
Andreas Kling
9dfcd95cd7 Use 64-bit integers inside Stopwatch to enable longer timings. 2019-03-21 13:41:36 +01:00
Andreas Kling
5708c12e24 LibC: Add PAGE_SIZE to limits.h 2019-03-21 13:31:27 +01:00
Andreas Kling
93a6681388 LibC: malloc() should use mmap() directly for allocations >= PAGE_SIZE.
This is a solid speedup on PNG loading, and basically everything else.
Once again I find a way to defer writing a better allocator for now. :^)
2019-03-21 13:29:20 +01:00
Andreas Kling
86e2348b74 Kernel+LibC: Don't crash upon traversal of large directories. 2019-03-20 18:31:12 +01:00
Andreas Kling
cdb82f6fbb LibC: Fix bug in scanf() family where we'd capture invalid data. 2019-03-20 15:29:04 +01:00
Andreas Kling
9120b05a40 Rename DNSLookupServer => LookupServer. 2019-03-20 04:26:30 +01:00
Andreas Kling
696f9c5bc0 LibC: Let gethostbyname() handle IPv4 address as input.
It would be neat to do a reverse lookup too, but for now we just parse
the IPv4 address into a dword.
2019-03-20 03:37:05 +01:00
Andreas Kling
0e4a1936ca LibC: Implement gethostbyname() by talking to the DNSLookupServer.
We now talk to the lookup server over a local socket and it does the lookup
on our behalf. Including some retry logic, which is nice, because it seems
like DNS requests disappear in the ether pretty damn often where I am.
2019-03-20 01:15:22 +01:00
Andreas Kling
b7ad35d040 Terminal: Enough compat work for Lynx to actually load web pages. 2019-03-14 18:33:21 +01:00
Andreas Kling
2c3cf22bc9 LibC: A whole bunch of compat work towards porting Lynx. 2019-03-14 15:18:15 +01:00
Andreas Kling
48590a0e51 LibC: Oops, rename getgrname() -> getgrnam(). 2019-03-14 15:16:11 +01:00
Andreas Kling
68f3771e4f LibC: Minor socket-related compat fixes. 2019-03-14 13:03:32 +01:00
Andreas Kling
7aba68d51c Userland+LibC: Add a new little "tc" program for testing TCP.
Also added send() and recv() to LibC in support of this. They are just
wrappers around sendto() and recvfrom().
2019-03-13 17:33:40 +01:00
Andreas Kling
48431b3535 LibC: Add netinet/in.h 2019-03-13 15:09:54 +01:00
Andreas Kling
19a51132f5 Kernel: recvfrom() should treat the address arguments as outparams. 2019-03-13 14:47:21 +01:00
Andreas Kling
b59d588c04 Kernel: Start fleshing out an UDP implementation. 2019-03-13 14:22:27 +01:00
Andreas Kling
562663df7c Add support for socket send/receive timeouts.
Only the receive timeout is hooked up yet. You can change the timeout by
calling setsockopt(..., SOL_SOCKET, SO_RCVTIMEO, ...).

Use this mechanism to make /bin/ping report timeouts.
2019-03-13 13:15:05 +01:00
Andreas Kling
cf250e1245 More work on IPv4 sockets and /bin/ping.
It's now actually possible to ping other hosts on the network! :^)
I've switched the "run" script over to starting QEMU with user networking
since that works better for my testing needs right now.
2019-03-13 03:26:01 +01:00
Andreas Kling
a7d5e9781a Kernel+LibC+Userland: Yet more networking bringup hacking.
All ICMP sockets now receive all ICMP packets. All this buffering is gonna
need some limits and such.
2019-03-12 17:27:07 +01:00
Andreas Kling
a017a77442 Kernel+LibC+Userland: Start working on an IPv4 socket backend.
The first userland networking program will be "ping" :^)
2019-03-12 15:51:42 +01:00
Andreas Kling
8175d75432 LibC: Implement getlogin(). 2019-03-10 03:15:36 +01:00
Andreas Kling
7d1142c7d9 Make it possible to sort a GTableModel by column+order.
This is accomplished by putting a GSortingProxyTableModel between the model
and the view. It's pretty simplistic but it works for this use case. :^)
2019-03-09 13:33:52 +01:00
Andreas Kling
eda0866992 Add a C++ helper class for working with shared buffers.
This is a bit more comfortable than passing the shared buffer ID manually
everywhere and keeping track of size etc.
2019-03-08 12:24:05 +01:00
Andreas Kling
2c5a378ccc Kernel+Userland: Add symlink() syscall and add "-s" flag to /bin/ln.
It's now possible to create symbolic links! :^)

This exposed an issue in Ext2FS where we'd write uninitialized data past
the end of an inode's content. Fix this by zeroing out the tail end of
the last block in a file.
2019-03-02 01:52:24 +01:00
Andreas Kling
1b16a29044 Kernel+Userland: Implement fchmod() syscall and use it to improve /bin/cp.
/bin/cp will now copy the permission bits from source to destination. :^)
2019-03-01 10:39:19 +01:00
Andreas Kling
1d2529b4a1 Add chown() syscall and a simple /bin/chown program. 2019-02-27 12:32:53 +01:00
Andreas Kling
e421c10735 More compat work towards porting vim.
It now builds and runs in the small-featureset configuration. :^)
2019-02-27 00:02:01 +01:00
Andreas Kling
424368034b LibC: Make errno codes be #defines instead of enum values.
It turns out that a lot of 3rd party software does things like:

    #ifdef EINTR
        ...
    #endif

This won't work if EINTR is an enum. So much for that nice idea.
2019-02-26 22:40:35 +01:00
Andreas Kling
83e78648e4 LibC: fgets() should return null on 0-length EOF reads. 2019-02-26 22:32:51 +01:00
Andreas Kling
a356746d04 Compat work towards porting vim. 2019-02-26 15:57:59 +01:00
Andreas Kling
e0c1541847 Compat work towards making bash-5.0 build with less patches.
Hacked implementations of sigsetjmp() and siglongjmp(). I didn't know about
these APIs until just now, but I hope I got them right.
2019-02-26 14:05:28 +01:00
Andreas Kling
4a5b474f1d LibC: Install crt0.o into /usr/lib 2019-02-26 13:36:26 +01:00
Andreas Kling
3f29a12d90 More compat work. Rename libraries from LibFoo.a => libfoo.a
This makes it more straightforward to build a cross-compiler toolchain.
Also move math stuff from LibC to LibM.
2019-02-26 13:30:57 +01:00
Andreas Kling
cccc8d8aeb More compat work.
Move syscall to int 0x82 since using int 0x80 was kinda prone to fork bombs
when building things on Linux. :^)
2019-02-26 12:57:02 +01:00
Andreas Kling
9624b54703 More moving towards using signed types.
I'm still feeling this out, but I am starting to like the general idea.
2019-02-25 22:06:55 +01:00
Andreas Kling
5af4e622b9 Kernel: Add KResult and KResultOr<T> classes.
The idea here is to combine a potential syscall error code with an arbitrary
type in the case of success. I feel like this will end up much less error
prone than returning some arbitrary type that kinda sorta has bool semantics
(but sometimes not really) and passing the error through an out-param.

This patch only converts a few syscalls to using it. More to come.
2019-02-25 20:50:22 +01:00
Andreas Kling
901b7d5d91 Fix a bunch of compiler warnings. Not all, but a lot. 2019-02-25 19:05:51 +01:00
Andreas Kling
0b957ed2b1 Some compat work towards making GCC's libstdc++ build. 2019-02-25 10:05:32 +01:00
Andreas Kling
93c0dfd1d7 LibC: A bunch of compat work towards porting GCC. 2019-02-24 15:20:07 +01:00
Andreas Kling
a7a456002e LibC: Enough compat work to make binutils-2.32 build and run. 2019-02-23 17:24:50 +01:00
Andreas Kling
d7753c7c8d Move over to building all of userspace with i686-pc-serenity-g++. 2019-02-22 14:45:14 +01:00
Andreas Kling
75b100673f Switch over to building everything with i686-elf-g++. 2019-02-22 10:45:32 +01:00
Andreas Kling
42342d2337 LibC: Tidy up _start a bit and rename compilation unit to "crt0" 2019-02-22 09:21:54 +01:00
Andreas Kling
6d3e12899b Kernel: Pass process arguments directly on the stack.
Get rid of the convoluted get_arguments and get_environment syscalls.
This patch also adds a simple /bin/env that just prints its environment.
2019-02-22 01:55:22 +01:00
Andreas Kling
920e8e58ed Kernel+Userland: Implement setuid() and setgid() and add /bin/su
Also show setuid and setgid bits in "ls -l" output. :^)
2019-02-21 23:38:10 +01:00
Andreas Kling
7d288aafb2 Kernel: Add link() syscall to create hard links.
This accidentally grew into a little bit of VFS cleanup as well.

Also add a simple /bin/ln implementation to exercise it.
2019-02-21 13:26:40 +01:00
Andreas Kling
0aaec6b19a Support resizing the Terminal app.
I set it up so that TIOCSWINSZ on a master PTY gets forwarded to the slave.
This feels intuitively right. Terminal can then use that to inform the shell
or whoever is inside the slave that the window size has changed.

TIOCSWINSZ also triggers the generation of a SIGWINCH signal. :^)
2019-02-20 23:38:20 +01:00
Andreas Kling
8eedbbc9ca Prune compiler flags a bit. Let's go with -march=i686 for now. 2019-02-17 15:17:21 +01:00