Commit graph

2774 commits

Author SHA1 Message Date
Andreas Kling
0f3b5e1f02 Kernel: The stat() syscall should follow symlinks. 2019-05-30 23:21:01 +02:00
Andreas Kling
709d168807 FileSystem: Get rid of VFS::resolve_path().
The only remaining client was resolve_symbolic_link() which now deals in
custodies instead.
2019-05-30 22:30:29 +02:00
Andreas Kling
874bffc729 FileSystem: Get rid of VFS::absolute_path() and teach Mount about custodies. 2019-05-30 22:30:29 +02:00
Andreas Kling
8e83aac8a3 FileSystem: Get rid of VFS::resolve_path_to_inode() and old_resolve_path(). 2019-05-30 22:30:29 +02:00
Andreas Kling
55821c91f8 Kernel: Rename Process::cwd_custody() to Process::current_directory().
...and executable_custody() to just executable().
2019-05-30 22:30:25 +02:00
Andreas Kling
393851418b FileSystem: Port most of the code over to using custodies.
The current working directory is now stored as a custody. Likewise for a
process executable file. This unbreaks /proc/PID/fd which has not been
working since we made the filesystem bigger.

This still needs a bunch of work, for instance when renaming or removing
a file somewhere, we have to update the relevant custody links.
2019-05-30 18:58:59 +02:00
Andreas Kling
4cb87b1753 FileSystem: Add a Custody class that represents a parent/child guardianship.
A custody is kind of a directory entry abstraction that represents a single
entry in a parent directory that tells us the name of a child inode.

The idea here is for path resolution to produce a chain of custody objects.
2019-05-30 17:46:08 +02:00
Andreas Kling
3a1d5fa112 ELFLoader: Fix typo in segment naming.
Executable segments now get an "x" character in their region name.
2019-05-30 16:23:48 +02:00
Andreas Kling
baaede1bf9 Kernel: Make the Process allocate_region* API's understand "int prot".
Instead of having to inspect 'prot' at every call site, make the Process
API's take care of that so we can just pass it through.
2019-05-30 16:14:37 +02:00
Andreas Kling
8fe72d7b3c Kernel: Make fcntl(F_SETFL) actually update the append/blocking flags. 2019-05-30 15:37:51 +02:00
Andreas Kling
7710863e3c Ports: Add gcc-8.3.0 port :^) 2019-05-30 15:27:56 +02:00
Andreas Kling
07c3cc01ec LibC: Move wait-related stuff to <sys/wait.h>. #POSIX 2019-05-30 15:12:09 +02:00
Andreas Kling
ed58abb911 Ports: Build binutils from tarball instead of git. 2019-05-30 13:59:24 +02:00
Andreas Kling
08926e59b3 Kernel: Add InodeFile, a File subclass for regular files.
Finally everything that can be held by a FileDescriptor actually inherits
from the File class.
2019-05-30 13:39:17 +02:00
Andreas Kling
66c1a9be3b Kernel: Pass 'prot' argument to File::mmap() and act on it.
Nothing crazy, this just means that PROT_READ allocates readable regions,
and that PROT_WRITE allocates writable ones.
2019-05-30 12:38:35 +02:00
Robin Burchell
004a630bfe Terminal: Fix some missing text attributes
Probably doesn't actually change much yet since we don't support many
text rendering options, but it's at least good to have the options, and
to record things we don't yet support too.
2019-05-30 10:35:36 +02:00
Andreas Kling
96db775ac1 LibC: Add setenv().
If I'm understanding the standard C library correctly, setenv() copies while
putenv() does not. That's really confusing and putenv() basically sucks.
To know which environment variables to free on replacement and which ones to
leave alone, we keep track of the ones malloced by setenv in a side table.

This patch also moves Shell to using setenv() instead of putenv().

Fixes #29.
2019-05-30 03:22:18 +02:00
Robin Burchell
d31ce9eccd Misc: Add a simple init process
This doesn't do much right now, just fork off a bunch of stuff and set priorities.
2019-05-30 02:57:15 +02:00
Robin Burchell
9cd0f6ffac Kernel/LibC: Implement sched_* functionality to set/get process priority
Right now, we allow anything inside a user to raise or lower any other process's
priority. This feels simple enough to me. Linux disallows raising, but
that's annoying in practice.
2019-05-30 02:57:15 +02:00
Andreas Kling
b160677e9e LibC: Add malloc_size() to tell you how big an allocation might be.
It can't be 100% precise but it doesn't really matter. Use this to implement
realloc() nicely. This also fixes a bug in realloc() where we didn't take
the size of the allocation metadata into account when computing the size of
an allocation backed by a BigAllocationBlock.
2019-05-30 02:37:40 +02:00
Robin Burchell
a906098579 Kernel: Fix a bad printf, and stub out SO_ERROR a bit more fully
links requests SO_ERROR, so in not supporting it, things were unhappy.
Supporting this properly looks a little messy. I guess Socket will need
an m_error member it sets everywhere it returns an error. Or Syscall
could set it, perhaps, but I don't know if that's the right thing to
do, so let's just stub this for now and file a bug.
2019-05-30 02:02:30 +02:00
Mustafa Ali CAN
3ffb2ad4e0 LibM LibC: add fixes for Lua port. 2019-05-29 16:03:51 +02:00
Mustafa Ali CAN
5fa8858dfb Port:Add Lua 2019-05-29 16:03:51 +02:00
Andreas Kling
1361721053 Terminal: Add /usr/local/bin to the default PATH.
Now that we're building all these ports, let's have them in the PATH. :^)
2019-05-29 06:34:54 +02:00
Andreas Kling
6785250f8c LibC: realloc() should reuse the existing allocation more often.
We were only reusing the existing allocation if the new requested size
was exactly the same as the fudged size of the block. This meant that
realloc() could allocate a new block even though the new block would be
identical to the old block.
2019-05-29 06:31:28 +02:00
Christopher Dumas
1c4882892c Port: less 2019-05-29 05:39:03 +02:00
Andreas Kling
c1f8df5f86 LibC: Don't define ALWAYS_INLINE if it's already defined.
This makes building GCC a bit quieter.
2019-05-28 21:04:47 +02:00
Andreas Kling
f6680d58db LibC: fcntl.h should define F_RDLCK. 2019-05-28 21:02:31 +02:00
Robin Burchell
b7d315319d Ports: Add links
Doesn't actually run yet. in_term's read() fails with EFAULT for reasons that
are presently beyond me, points to a bug in Serenity.
2019-05-28 20:06:47 +02:00
Christopher Dumas
674be46afd Ports: Vim and ncurses 2019-05-28 20:05:22 +02:00
Robin Burchell
faafaf9b43 Documentation: RIP the short-lived coding style
Let's just use clang-format. It's easier than explaining the rules.
2019-05-28 17:31:20 +02:00
Robin Burchell
0dc9af5f7e Add clang-format file
Also run it across the whole tree to get everything using the One True Style.
We don't yet run this in an automated fashion as it's a little slow, but
there is a snippet to do so in makeall.sh.
2019-05-28 17:31:20 +02:00
Robin Burchell
c11351ac50 Fix badge hopefully. 2019-05-28 17:15:44 +02:00
Robin Burchell
a942fa2ed3 Add .travis.yml 2019-05-28 17:04:09 +02:00
Andreas Kling
246dd93fe9 Ports: Add GNU binutils. 2019-05-28 16:26:39 +02:00
Andreas Kling
631894279b LibC: Make dlfcn stubs extern "C" like the outside world expects. 2019-05-28 14:30:55 +02:00
Andreas Kling
ab9db3a717 LibC: Move size_t, ptrdiff_t and NULL to stddef.h. #POSIX 2019-05-28 14:29:51 +02:00
Andreas Kling
cbd858544d LibC: Move struct timeval to sys/time.h. #POSIX 2019-05-28 13:48:06 +02:00
Andreas Kling
16ea34fc12 Kernel: Remove accidentally committer .orig file. 2019-05-28 13:17:27 +02:00
Andreas Kling
854598bc46 Documentation: Remove some irrelevant things from the coding style.
This was adapted from the WebKit coding style docs, but some parts of it
don't make sense for Serenity.
2019-05-28 11:43:28 +02:00
Andreas Kling
fc3732759d Documentation: Import an attempt at describing the project coding style. 2019-05-28 11:40:44 +02:00
Robin Burchell
335d0e52a4 Ports: Replace run_command use in bash with a run_replace_in_file helper
This way, we don't (in the ports themselves) depend on perl as a public
interface, which means if we ever have to, we can port to something else easier.
2019-05-28 11:03:18 +02:00
Robin Burchell
2b1a52745e Ports: Remove MAKEOPTS hacks from bash
This doesn't seem to go wrong anymore.
2019-05-28 11:03:18 +02:00
Robin Burchell
9a284ad3f7 Move everything to a subdirectory
Also don't run cd for the initial git clone (DERP!), and other bash port fixes.
2019-05-28 03:07:18 +02:00
Robin Burchell
b12a096437 Add WIP bash port 2019-05-28 02:45:54 +02:00
Robin Burchell
19afcfe03c port_include: Various updates
* Prints what is run, which is useful for trace purposes.
* Fix autotools configure to respect arguments
* Add run_patch for applying patches
2019-05-28 02:45:54 +02:00
Robin Burchell
5c82d14128 Add the start of a simple ports infrastructure 2019-05-28 00:21:14 +02:00
Robin Burchell
9947ee9566 Shell: Allow * and ? wildcard expansion in arguments
Should also presumably allow for escaping and such, but this is a start.
Fixes #112.
2019-05-28 00:17:39 +02:00
Andreas Kling
4040c6137d TextEditor: Fix window title when starting with an empty document. 2019-05-27 23:33:47 +02:00
Andreas Kling
ca4d65ba59 LibGUI: Add a GListView widget.
GListView displays a single column of data from a GModel.
2019-05-27 21:44:39 +02:00