Commit graph

25570 commits

Author SHA1 Message Date
Ali Mohammad Pur
0f1425c895 AK: Avoid OOB access in UniformBumpAllocator::destroy_all()
Otherwise we would end up calling T::~T() on some random memory right
after our mapped block, which is most likely a pretty bad thing to do :P
2021-08-13 04:42:34 +04:30
sin-ack
0e5e6f2e08 Base: Convert postcreate scripts to use heredoc 2021-08-13 01:20:35 +04:30
sin-ack
4c6a97e757 Shell: Make caller specify the string parsing end condition
Heredocs have a different parse end condition than double-quoted
strings. parse_doublequoted_string_inner would assume that a string
would always end in a double quote, so let's generalize it to
parse_string_inner and have it take a StringEndCondition enum which
specifies how the string terminates.
2021-08-13 01:20:35 +04:30
sin-ack
c419b1ade6 Shell: Remove dbgln related to process group IDs
This is insignificant debugging information and will print out during
runs with Lagom.
2021-08-12 22:42:50 +02:00
Liav A
65730f459d SystemServer: Generalize chown_all_framebuffer_devices function
Instead of neatly searching for all framebuffer device nodes and
changing ownership of them, let's generalize this function so we can
apply the same pattern on tty nodes.
2021-08-12 21:10:55 +02:00
Daniel Bertalan
49d795b985 Meta: Enable nonnull-compare warnings
Previously, this was disabled because GCC flagged seemingly correct and
well-defined code. This was however not the case because GCC implicitly
marked some pointers non-null, even if we wanted to handle them
ourselves, and deleted null checks on them. By re-introducing this
warning, we will know if the compiler tries to discard our code again.
2021-08-12 21:10:44 +02:00
Daniel Bertalan
c2c12e9dc5 LibC+DynamicLoader: Prevent GCC from removing null checks
GCC implements `fputc`, `fputs` and `fwrite` as builtin functions, whose
`FILE*` argument is implicitly marked `__attribute__((nonnull))`. This
causes our `VERIFY(stream)` statements to be removed. This does not
happen with Clang, as they do not use the `nonnull` attribute in this
way.
2021-08-12 21:10:44 +02:00
Daniel Bertalan
b19fe744ab LibWeb: Remove pointless type casts
In these cases, the parameters' static type matched the desired dynamic
type, so these calls were discarded.
2021-08-12 21:10:44 +02:00
Daniel Bertalan
f95a11a7da LibC: Don't delete null check in gettimeofday
The `nonnull` attribute may delete null checks in the generated code, as
per the [GCC documentation]:

> The compiler may also perform optimizations based on the knowledge
> that nonnul parameters cannot be null. This can currently not be
> disabled other than by removing the nonnull attribute.

Disassembling the function as compiled by GCC, we can see that there is
no branch based on if `tv` is null.  This means that `gettimeofday`
would produce UB if passed a null parameter, even if we wanted to
predictably return an error.  Clang refuses to compile this due to a
`pointer-bool-conversion` warning.

In this commit, `settimeofday` is changed as well to match
`gettimeofday`'s null argument handling.

[GCC documentation]:
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-nonnull-function-attribute
2021-08-12 21:10:44 +02:00
Ali Mohammad Pur
8b6397446e LibWasm: Move some Values and Vector<Value>s instead of copying them 2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
fa2ae02564 LibWasm: Avoid calculating stack bounds on each wasm call
We only need to know the initial bounds, which we calculate by default
when the interpreter is constructed.
This cuts down on syscalls and makes wasm calls a lot cheaper.
2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
2b35e9f9be LibWasm: Generate Value::type() on the fly instead of storing it
The variant member already contains enough information to give us the
type when needed, so remove the type member and synthesize it when
needed, this allows lots of optimisation opportunaties when copying and
moving Values around.
2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
f0e7e5bbe8 Meta: Un-escape escaped strings when generating Wasm tests 2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
4060f18d7e LibWasm: Replace memory write macros with templated functions 2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
b6381f785d LibWasm: Make memory operation address calculation match the spec
...or rather, match what the spec _means_ to say, not what it actually
says.
2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
ad3de4648a LibWasm: Replace memory read macros with templated functions 2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
563b402f04 LibWasm: Replace the numeric operation macros with templated functions
This should make debugging and profiling much better, at little to no
runtime cost.
Also moves off the operator definitions to a separate header, so it
should also improve the editing experience quite a bit.
2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
799471d16f Meta: Don't roundtrip floats for i64/i32 hex literals in wasm tests 2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
c6a137dbac AK: Add a IsSpecializationOf<T, Template> type trait 2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
dcf795085b AK: Don't zero Variant data in the move constructor
There's no reason to zero the data that will be immediately overwritten.
2021-08-12 21:03:53 +02:00
Liav A
7ba991dc37 Kernel: Steer away from heap allocations for ProcFS process data
Instead, use more static patterns to acquire that sort of data.
2021-08-12 20:57:32 +02:00
Liav A
bf1adc2d5d Kernel+LibC: Use 64 bit values for ino_t
Since the InodeIndex encapsulates a 64 bit value, it is correct to
ensure that the Kernel is exposing the entire value and the LibC is
aware of it.

This commit requires an entire re-compile because it's essentially a
change in the Kernel ABI, together with a corresponding change in LibC.
2021-08-12 20:57:32 +02:00
Liav A
04c2addaa8 Kernel: Fail process creating earlier if can't create AddressSpace
It makes more sense to fail the Process creation earlier if we can't
create an AddressSpace for the new Process.
2021-08-12 20:57:32 +02:00
Liav A
01b79910b3 Kernel/Process: Move protected values to the end of the object
The compiler can re-order the structure (class) members if that's
necessary, so if we make Process to inherit from ProcFSExposedComponent,
even if the declaration is to inherit first from ProcessBase, then from
ProcFSExposedComponent and last from Weakable<Process>, the members of
class ProcFSExposedComponent (including the Ref-counted parts) are the
first members of the Process class.

This problem made it impossible to safely use the current toggling
method with the write-protection bit on the ProcessBase members, so
instead of inheriting from it, we make its members the last ones in the
Process class so we can safely locate and modify the corresponding page
write protection bit of these values.

We make sure that the Process class doesn't expand beyond 8192 bytes and
the protected values are always aligned on a page boundary.
2021-08-12 20:57:32 +02:00
Stephan Unverwerth
e405f436b6 3DFileViewer: Allow zooming via mouse wheel 2021-08-12 20:57:19 +02:00
Stephan Unverwerth
3c509cf2f7 3DFileViewer: Add magnification filters to texture menu 2021-08-12 20:57:19 +02:00
Stephan Unverwerth
00d527bc25 LibGL: Implement GL_LINEAR texture filter 2021-08-12 20:57:19 +02:00
Andreas Kling
00603d9fd0 Revert "HackStudio: Remove noop code when opening the project"
This reverts commit 012fc3f923.
2021-08-12 20:56:54 +02:00
Stephan Unverwerth
75bc7be622 3DFileViewer: Add texture menu
This allows setting different texture wrap modes
and setting different texture coordinate scale factors.
2021-08-12 18:58:41 +02:00
Stephan Unverwerth
b9523e15df LibGL: Implement glTexParameter{i,f}
This currently only implements a subset of this function.
Namely setting wrap, mag and min modes for the GL_TETXURE_2D target.
2021-08-12 18:58:41 +02:00
Stephan Unverwerth
e0fef60241 LibGL: Implement "mirrored repeat" wrap mode 2021-08-12 18:58:41 +02:00
Stephan Unverwerth
8902efa52d LibGL: Implement "clamp" wrap mode 2021-08-12 18:58:41 +02:00
Stephan Unverwerth
12785849aa LibGL: Turn Sampler2D into an actual class
This extracts the sampler functionality into its own class.
Beginning with OpenGL 3 samplers are actual objects, separate
from textures. It makes sense to do this already as it also
cleans up code organization quite a bit.
2021-08-12 18:58:41 +02:00
TheFightingCatfish
fdde19d616 Utilities: Add option to control when to use colored output for grep
Fixes #9351.
2021-08-12 18:57:21 +02:00
Jean-Baptiste Boric
072961090f Ports: Add cc symlink to gcc port 2021-08-12 18:56:30 +02:00
Jean-Baptiste Boric
c9d287b226 Ports: Add awk symlink to mawk port 2021-08-12 18:56:30 +02:00
Jean-Baptiste Boric
2084289162 Userland: Fix PATH environment variable ordering 2021-08-12 18:56:30 +02:00
Jean-Baptiste Boric
b1add5860b Base: Make /bin/Shell the login shell by default 2021-08-12 18:56:30 +02:00
Jean-Baptiste Boric
62cd3af5a0 LibC: Add stub forwarders to LibRegex C API
The POSIX C regex functions are expected to live in the C standard
library, but Serenity split off its regex library into LibRegex. Make a
compromise by implementing stub forwarders for the C regex library that
load libregex.so and call the real implementation.

This is needed for ports that expect these C functions to be available
inside the standard C library without introducing a strong coupling
between LibC and LibDl or LibRegex. The non-standard Serenity C++ regex
API still lives inside LibRegex as before.
2021-08-12 18:56:30 +02:00
Karol Kosek
012fc3f923 HackStudio: Remove noop code when opening the project
28b1e66b51 made that
the m_all_editor_wrappers vector is cleared everytime a project path
is changed (the m_project if check is just for the app launch --
the vector is empty there anyway), making the code never execute.
2021-08-12 18:55:58 +02:00
Karol Kosek
a2cb5c862d HackStudio: Show the 'Save as...' dialog when saving uncreated file
Previously when user wanted to save an uncreated file, the program
would just quietly ignore the save request, without giving any message.
This can be seen when creating a new editor in split view mode.
2021-08-12 18:54:57 +02:00
Karol Kosek
8516b9532e HackStudio: Add 'Save as...' action
Not adding it to the toolbar, because it has the same icon as
a typical 'Save' action.
2021-08-12 18:54:57 +02:00
Karol Kosek
8a4bb581a2 HackStudio: Show text editor after starting the application
The user can now start typing text instead of creating a file first.

This also enables drag-and-dropping a file as soon as the application
starts.
2021-08-12 18:54:25 +02:00
Gunnar Beutner
e4f0795ae4 LibELF+LibTest: Fix incorrect #ifdef 2021-08-12 08:16:07 +02:00
sin-ack
a871a2040b Meta: Properly quote some CMake variables in serenity_component
This probably isn't all of them, because I'm no CMake expert. :^)
It does however allow "/bin/false" to build now.
2021-08-12 07:48:50 +02:00
Jean-Baptiste Boric
9b2cc9580b Userland: Add partial support for complex specifications to tr 2021-08-12 00:41:13 +02:00
Jean-Baptiste Boric
310eb72f72 Userland: Add support for --delete flag as alias of -d to tr 2021-08-12 00:41:13 +02:00
Jean-Baptiste Boric
89ba022ede Userland: Add support for -c/--complement flag to tr 2021-08-12 00:41:13 +02:00
Jean-Baptiste Boric
7f2d3df906 Userland: Add support for multiple character translations to tr 2021-08-12 00:41:13 +02:00
Jean-Baptiste Boric
7a9d05c24c AK: Add contains(char) method to String 2021-08-12 00:41:13 +02:00