summaryrefslogtreecommitdiff
path: root/Userland
AgeCommit message (Collapse)Author
2020-10-01Userland: Fix buffer overflow in unzipTibor Nagy
It's not a great idea reading file names into a 4 byte sized buffer.
2020-09-29LibJS: Move Console from Interpreter to GlobalObjectAndreas Kling
Each JS global object has its own "console", so it makes more sense to store it in GlobalObject. We'll need some smartness later to bundle up console messages from all the different frames that make up a page later, but this works for now.
2020-09-28ProtocolServer+LibWeb: Support more detailed HTTP requestsAndreas Kling
This patch adds the ability for ProtocolServer clients to specify which HTTP method to use, and also to include an optional HTTP request body.
2020-09-27AK: Remove the ctype adapters and use the actual ctype functions insteadBenoît Lormeau
This finally takes care of the kind-of excessive boilerplate code that were the ctype adapters. On the other hand, I had to link `LibC/ctype.cpp` to the Kernel (for `AK/JsonParser.cpp` and `AK/Format.cpp`). The previous commit actually makes sense now: the `string.h` includes in `ctype.{h,cpp}` would require to link more LibC stuff to the Kernel when it only needs the `_ctype_` array of `ctype.cpp`, and there wasn't any string stuff used in ctype. Instead of all this I could have put static derivatives of `is_any_of()` in the concerned AK files, however that would have meant more boilerplate and workarounds; so I went for the Kernel approach.
2020-09-27LibC: Remove an unneeded string.h include in ctype.h/cppBenoit Lormeau
And include string.h in the files that actually needed it
2020-09-27LibMarkdown: Take a 'view_width' argument for render_for_terminal()AnotherTest
Some constructs will require the width of the terminal (or a general 'width') to be rendered correctly, such as tables.
2020-09-27LibJS: Remove use of Interpreter& in JSONObject codeAndreas Kling
2020-09-27LibJS: Make native function/property callbacks take VM, not InterpreterAndreas Kling
More work on decoupling the general runtime from Interpreter. The goal is becoming clearer. Interpreter should be one possible way to execute code inside a VM. In the future we might have other ways :^)
2020-09-27LibJS: Move most of Interpreter into VMAndreas Kling
This patch moves the exception state, call stack and scope stack from Interpreter to VM. I'm doing this to help myself discover what the split between Interpreter and VM should be, by shuffling things around and seeing what falls where. With these changes, we no longer have a persistent lexical environment for the current global object on the Interpreter's call stack. Instead, we push/pop that environment on Interpreter::run() enter/exit. Since it should only be used to find the global "this", and not for variable storage (that goes directly into the global object instead!), I had to insert some short-circuiting when walking the environment parent chain during variable lookup. Note that this is a "stepping stone" commit, not a final design.
2020-09-26lsof: Separate file name componentsMaciej Zygmanowski
In /proc/PID/fds we get not only file name, but also additional information about file type, state etc. This commit makes `lsof' command separate these components. When you are filtering files by file name, only actual file name is checked (not additional data).
2020-09-26lsof: Allow selecting files by file nameMaciej Zygmanowski
2020-09-25LibJS+LibGUI+js: Handle UnterminatedRegexLiteral in syntax highlightersLinus Groh
2020-09-25Meta+Userland: Make clang-format-10 cleanBen Wiederhake
2020-09-23js: Use VM::exception() instead of Interpreter::exception()Andreas Kling
The VM is always there, but we only have an Interpreter while we are running code.
2020-09-22LibJS: Move the current exception from Interpreter to VMAndreas Kling
This will allow us to throw exceptions even when there is no active interpreter in the VM.
2020-09-21Userland: Convert passwd(1) to use Core::AccountPeter Elliott
this fixes the passwd issues discovered in #3296
2020-09-21Userland: Switch su over to Core::AccountPeter Elliott
2020-09-21LibJS: Rename InterpreterScope => InterpreterExecutionScopeAndreas Kling
To make it a little clearer what this is for. (This is an RAII helper class for adding and removing an Interpreter to a VM's list of the currently active (executing code) Interpreters.)
2020-09-21test-web: Keep the Interpreter on the VM interpreter stack during testAndreas Kling
2020-09-20LibJS+Clients: Add JS::VM object, separate Heap from InterpreterAndreas Kling
Taking a big step towards a world of multiple global object, this patch adds a new JS::VM object that houses the JS::Heap. This means that the Heap moves out of Interpreter, and the same Heap can now be used by multiple Interpreters, and can also outlive them. The VM keeps a stack of Interpreter pointers. We push/pop on this stack when entering/exiting execution with a given Interpreter. This allows us to make this change without disturbing too much of the existing code. There is still a 1-to-1 relationship between Interpreter and the global object. This will change in the future. Ultimately, the goal here is to make Interpreter a transient object that only needs to exist while you execute some code. Getting there will take a lot more work though. :^) Note that in LibWeb, the global JS::VM is called main_thread_vm(), to distinguish it from future worker VM's.
2020-09-17ntpquery: Use SO_TIMESTAMP to get a more accurate destination_timestampNico Weber
We can now see at which time a packet was received by the network adapter, instead of having to measure user time after receiving the packet in user space. This means the destination timestamp is no longer affected by in-kernel queuing delays, which can be tens of milliseconds when the system is under load. It also means that if ntpquery grows a message queue that waits on replies from several requests, the time used processing one response won't be incorrectly included in the destination timestamp of the next response (in case two responses arrive at the network adapter at roughly the same time). NTP's calculations work better if send and receive latency are about equal, and this only removes in-kernel queue delays and context switch delays for the receiving packet. But the two latencies aren't very equal anyways because $network. Also, maybe we can add another API for setting the send time in the outgoing packet in kernel space right before (or when) hitting the network adapter and use that here too. So this still seems like progress.
2020-09-16Userland: Allow executing binaries from PATH with env.asynts
This is useful for shebangs: #!/bin/env Shell echo "Hello, World!"
2020-09-16Userland: Use find_executable_in_path in which.asynts
2020-09-14AK: Lower the requirements for InputStream::eof and rename it.asynts
Consider the following snippet: void foo(InputStream& stream) { if(!stream.eof()) { u8 byte; stream >> byte; } } There is a very subtle bug in this snippet, for some input streams eof() might return false even if no more data can be read. In this case an error flag would be set on the stream. Until now I've always ensured that this is not the case, but this made the implementation of eof() unnecessarily complicated. InputFileStream::eof had to keep a ByteBuffer around just to make this possible. That meant a ton of unnecessary copies just to get a reliable eof(). In most cases it isn't actually necessary to have a reliable eof() implementation. In most other cases a reliable eof() is avaliable anyways because in some cases like InputMemoryStream it is very easy to implement.
2020-09-13Userland: Add {md5,sha1,sha256,sha512}sumLinus Groh
2020-09-11Userland: Add an implementation of printfAnotherTest
2020-09-11LibCompress: Add unit tests for CanonicalCode.asynts
2020-09-11LibCompress: Return Optional from decompress_all method.asynts
2020-09-11Userland: gunzip if filename doesn't end in .gz append it.asynts
This is the behaviour of gzip on my Linux system.
2020-09-10Userland: Fix a signal race conditionSergey Bugaev
It has been possible for a signal to arrive in between us checking g_interrupted and exiting - sucessfully, even though we were interrupted. This way, if a signal arrives before we reset the disposition, we will reliably check for it later; if it arrives afterwards, it'll kill us automatically.
2020-09-09test-js: Catch SIGINFO and dump the current test name + pass/fail/skipAndreas Kling
This is pretty handy if the JS tests take a long time to run and you wonder what they're doing. :^)
2020-09-09test-js: Add -g option to run a garbage collection on each allocationAndreas Kling
This is very slow, but very good at flushing out GC bugs. :^)
2020-09-09sleep: Make variable written in signal handler volatileNico Weber
No difference in practice, but it's tidier and protects us if we ever use g_interrupted earlier in main -- in that case, the compiler might chose to keep the variable in a register without the volatile. Found by @bugaevc, thanks!
2020-09-09sleep: On SIGINT, call default SIGINT handler after printing remaining timeNico Weber
With this, hitting ctrl-c twice in `for i in $(seq 10) { sleep 1 }` terminates the loop as expected (...well, I'd expect it to quit after just one ctrl-c, but serenity's shell makes a single ctrl-c only quit the current loop iteration). Part of #3419.
2020-09-08Refactor: Replace usages of FixedArray with Array.asynts
2020-09-07ntpquery: Compute and print delay and offsetNico Weber
2020-09-06ntpquery: Add a -s flag to make it adjust the timeNico Weber
2020-09-06ntpquery: Use time.google.com as default NTP server for nowNico Weber
Using a pool.ntp.org server seems nicer and more open-source-y, but until our pool use is approved, let's put in a default value that works. (time.google.com serves smeared time instead of doing leap seconds. pool.ntp.org doesn't serve smeared time. I intend to implement client-side leap second smearing since nobody likes jumpy timestamps. For now, we get this for free.)
2020-09-06ntpquery: Record destination timestamp as wellNico Weber
2020-09-06Userland: Add missing license headers to "w" and "utmpupdate"Andreas Kling
2020-09-06Userland: Shorten "w" idle time formatAndreas Kling
Let's just say "123s" for now (instead of "123 sec")
2020-09-06Userland: Bring back improved "LOGIN@" column in "w"Andreas Kling
This actually looks a lot nicer if we slim down the datetime format. Also remove the "FROM" column which was the one I actually didn't want.
2020-09-06utmpupdate: Store the login time in /var/run/utmp as a Unix timestampAndreas Kling
This is obviously nicer and makes it easy for other programs to do what they want with the timestamp.
2020-09-06Userland: Show the current foreground process name in "w" outputAndreas Kling
Add a "WHAT" column that shows which command is currently executing in each active session. Very neat :^)
2020-09-06LibCore+top: Use pid_t for pgid/pgrp/sid numbersAndreas Kling
2020-09-06Userland: Remove "LOGIN@" column from "w" since it's not really usefulAndreas Kling
Maybe we can bring this back once we have remote logins, or at least make it optional then. At the moment, it's not very interesting.
2020-09-06Userland: Show idle times in "w" outputAndreas Kling
The idle time is based on the mtime of the session's TTY :^)
2020-09-06Userland: Tweak "w" output just slightlyAndreas Kling
2020-09-06Userland: Add a simple 'w' program that shows current terminal sessionsAndreas Kling
This fetches information from /var/run/utmp and shows the interactive sessions in a little list. More things can be added here to make it more interesting. :^)
2020-09-06utmpupdate: Use pledge() and unveil()Andreas Kling