Commit Graph

650 Commits

Author SHA1 Message Date
Andreas Kling
d1c16944ce gron: Implement a simplified variant of @tomnomnom's "gron"
This program takes JSON input and turns it into JavaScript statements
that construct the same data step by step. This format is much more
greppable than what "jp" gives us. :^)
2019-12-27 03:27:37 +01:00
Andreas Kling
23591f2a95 munch: Add a simple userland program for chewing up lots of memory 2019-12-26 11:48:34 +01:00
Andreas Kling
33efeaf71a crash: Add "-X" option for attempting to execute non-executable memory 2019-12-25 13:35:57 +01:00
joshua stein
c127d16326 Build: support library and generator dependencies
Instead of directly manipulating LDFLAGS, set LIB_DEPS in each
subdirectory Makefile listing the libraries needed for
building/linking such as "LIB_DEPS = Core GUI Draw IPC Core".

This adds each library as an -L and -l argument in LDFLAGS, but
also adds the library.a file as a link dependency on the current
$(PROGRAM).  This causes the given library to be (re)built before
linking the current $(PROGRAM), but will also re-link any binaries
depending on that library when it is modified, when running make
from the root directory.

Also turn generator tools like IPCCompiler into dependencies on the
files they generate, so they are built on-demand when a particular
directory needs them.

This all allows the root Makefile to just list directories and not
care about the order, as all of the dependency tracking will figure
it out.
2019-12-25 10:11:09 +01:00
Mauri de Souza Nunes
cb4e51a7a5 Userland: Add syscall -l option and man page 2019-12-24 20:23:37 +01:00
Andrés Vieira
5f9c408a08 Userland: Add support for printing multiple columns to the cal command
Now cal is able to print the entire year when only that is passed
as an argument. For example: `cal 1992`.

However this meant breaking the highlighted day escape sequence
as it messed up the layout and the character count for each of the
rows :(

Now the current day is specified like 17* (for example for day 17).
2019-12-24 11:48:16 +01:00
joshua stein
ac25438d54 Build: clean up build system, use one shared Makefile
Allow everything to be built from the top level directory with just
'make', cleaned with 'make clean', and installed with 'make
install'.  Also support these in any particular subdirectory.

Specifying 'make VERBOSE=1' will print each ld/g++/etc. command as
it runs.

Kernel and early host tools (IPCCompiler, etc.) are built as
object.host.o so that they don't conflict with other things built
with the cross-compiler.
2019-12-20 20:20:54 +01:00
Andreas Kling
b32e961a84 Kernel: Implement a simple process time profiler
The kernel now supports basic profiling of all the threads in a process
by calling profiling_enable(pid_t). You finish the profiling by calling
profiling_disable(pid_t).

This all works by recording thread stacks when the timer interrupt
fires and the current thread is in a process being profiled.
Note that symbolication is deferred until profiling_disable() to avoid
adding more noise than necessary to the profile.

A simple "/bin/profile" command is included here that can be used to
start/stop profiling like so:

    $ profile 10 on
    ... wait ...
    $ profile 10 off

After a profile has been recorded, it can be fetched in /proc/profile

There are various limits (or "bugs") on this mechanism at the moment:

- Only one process can be profiled at a time.
- We allocate 8MB for the samples, if you use more space, things will
  not work, and probably break a bit.
- Things will probably fall apart if the profiled process dies during
  profiling, or while extracing /proc/profile
2019-12-11 20:36:56 +01:00
Andreas Kling
fd5eb79d19 LibGUI: Make GMenu inherit from CObject
This is primarily to make it possible to pass a GMenu* where a CObject*
is expected.
2019-12-09 21:05:44 +01:00
Andreas Kling
dfc5eb2b6d purge: Add a small command-line utility for purging all volatile memory 2019-12-09 19:16:45 +01:00
Andreas Kling
6f4c380d95 AK: Use size_t for the length of strings
Using int was a mistake. This patch changes String, StringImpl,
StringView and StringBuilder to use size_t instead of int for lengths.
Obviously a lot of code needs to change as a result of this.
2019-12-09 17:51:21 +01:00
Andreas Kling
f41ae755ec Kernel: Crash on memory access in non-readable regions
This patch makes it possible to make memory regions non-readable.
This is enforced using the "present" bit in the page tables.
A process that hits an not-present page fault in a non-readable
region will be crashed.
2019-12-02 19:18:52 +01:00
Andrés Vieira
f8a0eb616c Userland: Add the cal command (#838)
This is a very simple implementation of the cal command to display
a calendar into the command line.

For now this only prints the current month highlighting the current
day.
2019-12-02 15:22:55 +01:00
Andreas Kling
e2b88f66d3 modunload: Take the module-to-unload as a command-line argument 2019-11-29 21:35:10 +01:00
Andreas Kling
f60c40ab2e jp: Print double-quotes around string values in output 2019-11-29 21:35:01 +01:00
Andreas Kling
86c61218a7 modload: Take the module-to-load as a command-line argument
Instead of hard-coding /mod/TestModule.o :^)
2019-11-29 21:19:23 +01:00
Andreas Kling
e56daf547c Kernel: Disallow syscalls from writeable memory
Processes will now crash with SIGSEGV if they attempt making a syscall
from PROT_WRITE memory.

This neat idea comes from OpenBSD. :^)
2019-11-29 16:30:05 +01:00
Andreas Kling
a43b115a6c Kernel: Implement basic module unloading :^)
Kernel modules can now be unloaded via a syscall. They get a chance to
run some code of course. Before deallocating them, we call their
"module_fini" symbol.
2019-11-28 21:07:22 +01:00
Andreas Kling
6b150c794a Kernel: Implement very simple kernel module loading
It's now possible to load a .o file into the kernel via a syscall.
The kernel will perform all the necessary ELF relocations, and then
call the "module_init" symbol in the loaded module.
2019-11-28 20:59:11 +01:00
Andreas Kling
75ed262fe5 Kernel+ifconfig: Add an MTU value to NetworkAdapter
This defaults to 1500 for all adapters, but LoopbackAdapter increases
it to 65536 on construction.

If an IPv4 packet is larger than the MTU, we'll need to break it into
smaller fragments before transmitting it. This part is a FIXME. :^)
2019-11-28 14:14:26 +01:00
Andreas Kling
5b8cf2ee23 Kernel: Make syscall counters and page fault counters per-thread
Now that we show individual threads in SystemMonitor and "top",
it's also very nice to have individual counters for the threads. :^)
2019-11-26 21:37:38 +01:00
Andreas Kling
712ae73581 Kernel: Expose per-thread information in /proc/all
Previously it was not possible to see what each thread in a process was
up to, or how much CPU it was consuming. This patch fixes that.

SystemMonitor and "top" now show threads instead of just processes.
"ps" is gonna need some more fixing, but it at least builds for now.

Fixes #66.
2019-11-26 21:37:30 +01:00
Andreas Kling
9a6d506ac8 ps: Show "/dev/pts/0" as "pts/0" instead of "0"
Also tweak the alignment of the output a bit.
2019-11-26 15:01:46 +01:00
Hüseyin ASLITÜRK
28ada30783 Userland: Add keymap program. 2019-11-25 11:53:02 +01:00
Andreas Kling
653e61d9cf LibProtocol: Add a Download object so users don't have to manage ID's
LibProtocol::Client::start_download() now gives you a Download object
with convenient hooks (on_finish & on_progress).

Also, the IPC handshake is snuck into the Client constructor, so you
don't need to perform it after instantiating a Client.

This makes using LibProtocol much more pleasant. :^)
2019-11-24 13:22:01 +01:00
Andreas Kling
600c15aa3a pro: Take the URL to download as a command-line argument
Also, don't print anything other than the download payload to stdout.
This gives us a very simple HTTP download utility :^)
2019-11-23 22:16:23 +01:00
Andreas Kling
eb85103271 ProtocolServer: Send the download payload to clients as a shared buffer
The DownloadFinished message from the server now includes a buffer ID
that can be mapped into the client program.

To avoid prematurely destroying the buffer, the server will hang on to
it until the client lets it know that they're all good. That's what the
ProtocolServer::DisownSharedBuffer message is about.

In the future it would be nice if the kernel had a mechanism to allow
passing ownership of a shared buffer along with an IPC message somehow.
2019-11-23 22:11:44 +01:00
Andreas Kling
88c5126fa7 pro: Add a little userland utility for testing ProtocolServer 2019-11-23 21:50:36 +01:00
Andreas Kling
107011f119 AudioServer: Allow muting the system audio
This patch adds muting to ASMixer, which works by substituting what we
would normally send to the sound card with zero-filled memory instead.
We do it this way to ensure that the queued sample buffers keep getting
played (silently.)

This is obviously not the perfect way of doing this, and in the future
we should improve on this, and also find a way to utilize any hardware
mixing functions in the sound card.
2019-11-22 21:44:02 +01:00
Andrew Kaster
618aebdd8a Kernel+LibPthread: pthread_create handles pthread_attr_t
Add an initial implementation of pthread attributes for:
  * detach state (joinable, detached)
  * schedule params (just priority)
  * guard page size (as skeleton) (requires kernel support maybe?)
  * stack size and user-provided stack location (4 or 8 MB only, must be aligned)

Add some tests too, to the thread test program.

Also, LibC: Move pthread declarations to sys/types.h, where they belong.
2019-11-18 09:04:32 +01:00
Andreas Kling
3da6d89d1f Kernel+LibC: Remove the isatty() syscall
This can be implemented entirely in userspace by calling tcgetattr().
To avoid screwing up the syscall indexes, this patch also adds a
mechanism for removing a syscall without shifting the index of other
syscalls.

Note that ports will still have to be rebuilt after this change,
as their LibC code will try to make the isatty() syscall on startup.
2019-11-17 20:03:42 +01:00
Andreas Kling
794758df3a Kernel: Implement some basic stack pointer validation
VM regions can now be marked as stack regions, which is then validated
on syscall, and on page fault.

If a thread is caught with its stack pointer pointing into anything
that's *not* a Region with its stack bit set, we'll crash the whole
process with SIGSTKFLT.

Userspace must now allocate custom stacks by using mmap() with the new
MAP_STACK flag. This mechanism was first introduced in OpenBSD, and now
we have it too, yay! :^)
2019-11-17 12:15:43 +01:00
Andreas Kling
66a2b582c3 LibPthread: Implement a basic first pthread mutex
This patch adds these API's:

- pthread_mutex_init()
- pthread_mutex_lock()
- pthread_mutex_unlock()

No mutex attributes are supported yet, so we only do the simplest mutex
wihout recursive locking.
2019-11-16 12:23:36 +01:00
Andreas Kling
69efa3f630 Kernel+LibPthread: Implement pthread_join()
It's now possible to block until another thread in the same process has
exited. We can also retrieve its exit value, which is whatever value it
passed to pthread_exit(). :^)
2019-11-14 20:58:23 +01:00
Andreas Kling
794f2d5645 LibHTML: Rename parse_html() => parse_html_document() 2019-11-06 20:52:18 +01:00
Andreas Kling
f5cf8d4ad8 Revert "LibHTML: Rename parse_html() => parse_html_document()"
This reverts commit f6439789db.
Oops, I committed unrelated changes here, let me clean that up..
2019-11-06 20:51:07 +01:00
Andreas Kling
f6439789db LibHTML: Rename parse_html() => parse_html_document() 2019-11-06 20:31:56 +01:00
Andreas Kling
173ae370db disk_benchmark: Add a -c flag to enable use of disk caches
By default, disk_benchmark will now use the O_DIRECT flag, causing it
to bypass the kernel's disk caches. This gives you "disk performance"
numbers rather than "disk cache performance" numbers.

You can use "disk_benchmark -c" to enable the caches.

Fixes #703.
2019-11-05 19:37:23 +01:00
Mauri de Souza Nunes
b61414fb96 Userland: Add syscall program
The Plan9 OS has this  program that can test a system call with the
given arguments. For the most basic system calls it can be very
helpful and aid with testing or just to play with a given syscall
without writing a dedicated program.

Some examples:
    syscall write 1 hello 5
    syscall -o read 0 buf 5
    syscall mkdir /tmp/my-dir
    syscall exit 2
    ...
2019-11-04 12:47:54 +01:00
balatt
d5b66a02c4 Userland: Add the utility "nl" (number line) (#693)
I wrote a version of nl for Serenity with a lot but not all of the 
options in POSIX nl. It includes line count type (-b), increment (-i),
delimiter (-s), start number (-v), and width (-w).
2019-11-04 12:44:32 +01:00
balatt
0d471266ce wc: Rewritten with added features (#690)
Now gets a true byte count by using the file size.

* When giving a single-line string without a trailing newline, the line
  count should not go up ('printf "test" | wc -l' should output '0')

* Doesn't hang up when using two or more switch options in a row.
  (It would hang if I did 'wc -lw test.frm').

  While mine works with multiple args like that, they don't switch
  anything, you have to do wc -l -w etc but I think that is an issue
  with CArgsParser.

* It can now take standard input without needing a "-".

* When encountering a file that doesn't exist, it doesn't exit.

  It prints the counts for each file that does, and prints an error to
  stderr for each file that doesn't. 

* Has slight buffering between counts to be closer to GNU and BSD wc.
2019-11-04 12:42:30 +01:00
Andreas Kling
ddd8332015 cat: Use a 32 KB I/O buffer here to improve "cat a > b" scenario
This is roughly twice as fast as the old 4 KB buffer size. We still
don't go nearly as fast as "cp", since we don't ftruncate() up front
like "cp" does.
2019-11-03 00:09:17 +01:00
Andreas Kling
be19606501 cp: Fail immediately if there's not enough space for the destination
Instead of writing until we run out of space, just fail immediately.
2019-11-02 23:47:22 +01:00
Andreas Kling
73b2cb9ed8 cp: Read/write 32 KB at a time to go faster :^)
This is a huge speed-up (3x) when copying large files. Ideally this
would be optimized by the kernel somehow, but we're not there yet.
2019-11-02 16:39:26 +01:00
Andreas Kling
f2a9bbe96e disk_benchmark: Use 64-bit values for bytes-per-second values
Let's dress for the job we want, and prepare for faster speeds. :^)
2019-11-02 10:42:41 +01:00
Andreas Kling
f9d679ae37 cp: Try to pre-size the destination file to the final size up front
Since we usually know how many bytes we're going to write, we can be
nice to the kernel and ftruncate() the destination to the expected size
up front, reducing the amount of FS churn.
2019-11-02 10:00:18 +01:00
balatt
b583f21e27 Userland: cat no longer tries to open "cat"
I made the mistake of starting the initial for loop at i=0 when it
should have started at 1. argv[0] is the program name, argv[1] is an
argument.
2019-10-31 06:57:41 +01:00
balatt
5442e365c9 cat: Updated to handle multiple input files (#694)
Now concatenates multiple files at once with a for loop iterating
through a vector of file arguments.
2019-10-29 16:08:09 +01:00
Andreas Kling
7b0f3b19df ls: Fix alignment of device files in long mode (ls -l) 2019-10-19 20:54:47 +02:00
Andreas Kling
8a3fabffb3 ls: Add -t and -r flags
-t: Sort by modification time (default is to sort by name)
-r: Reverse sort order

Note that these only apply when used together with -l (long mode.)
2019-10-19 20:54:47 +02:00
Till Mayer
02e787f8a4 aplay: Fixed incomplete playback of files
aplay used to quit as soon as the last enqueue of new buffer data
was sucessful. Because the connection closes as soon as the
application quits, samples were still in the buffer of the
ASBufferQueue as playback was halted.
2019-10-19 20:05:13 +02:00
Andreas Kling
850955053f LibHTML: Rename Document::normalize() to fixup() and always do it
Node.normalize() is a standard DOM API that coalesces Text nodes.
To avoid clashing with that, rename it to fixup().

This patch also makes it happen automagically as part of parsing.
2019-10-09 18:54:34 +02:00
Andreas Kling
ee64d99a96 LibHTML: Make StyleResolver responsible for loading the default style
Instead of HtmlView clients having to worry about parsing and loading
the default CSS, just take care of it inside StyleResolver.

The default style is automatically inserted into the stylesheet list,
at the very start, so everyone else gets a chance to override it.
2019-10-05 09:02:29 +02:00
Andreas Kling
8f45a259fc ByteBuffer: Remove pointer() in favor of data()
We had two ways to get the data inside a ByteBuffer. That was silly.
2019-09-30 08:57:01 +02:00
Andreas Kling
3900eebf15 FileManager+LibGUI+html: Add an icon to represent HTML files
This also becomes the app icon for the little "html" program. :^)
2019-09-29 21:00:41 +02:00
Andreas Kling
8d822ff82b html: Set the window title based on the HTML document's title
If the loaded document has a <title>, we now show that in the app's
window title bar! :^)
2019-09-29 16:26:28 +02:00
Sergey Bugaev
6ec625d6f3 Userland+LibHTML: Add the html command
This is a simple command that can be used to display HTML from a given
file, or from the standard input, in an HtmlView. It replaces the `tho`
(test HTML output) command.
2019-09-28 18:29:42 +02:00
Sergey Bugaev
36eea6c04b Userland: Add a man command 2019-09-28 18:29:42 +02:00
Sergey Bugaev
3089b539f0 Userland: Add an md command
This command uses LibMarkdown to parse and render Markdown documents
either for the terminal using escape sequences, or to HTML. For example,
you can now do:

$ md ReadMe.md

to read the Serenity ReadMe file ^)
2019-09-28 18:29:42 +02:00
Sergey Bugaev
2e80b2b32f Libraries: Add LibMarkdown 2019-09-28 18:29:42 +02:00
Conrad Pankoff
b03a0534e0 Userland: Add disk_benchmark program to test read/write speeds 2019-09-28 09:29:10 +02:00
Andreas Kling
797e132d0c ifconfig: Allow setting an adapter's IPv4 address
You can now do things like "ifconfig e1k0 192.168.1.2" to set the
IPv4 address of e1k0. Pretty neat!
2019-09-23 19:06:53 +02:00
Andreas Kling
87e768f0e3 Userland: Unbreak "copy" and "paste" after GEventLoop removal
Have these programs instantiate a GApplication to ensure they get a
connection to the WindowServer, otherwise the clipboard will not work.

Sorry Sergey! :^)
2019-09-23 09:36:25 +02:00
Andreas Kling
34d0e96aec LibCore+LibGUI: Remove GEventLoop and use CEventLoop everywhere
GEventLoop was just a dummy subclass of CEventLoop anyway. The only
thing it actually did was make sure a GWindowServerConnectionw was
instantiated. We now take care of that in GApplication instead.

CEventLoop is now non-virtual and a little less confusing. :^)
2019-09-22 20:50:39 +02:00
Andreas Kling
bc319d9e88 LibCore: Make CObject reference-counted
Okay, I've spent a whole day on this now, and it finally kinda works!
With this patch, CObject and all of its derived classes are reference
counted instead of tree-owned.

The previous, Qt-like model was nice and familiar, but ultimately also
outdated and difficult to reason about.

CObject-derived types should now be stored in RefPtr/NonnullRefPtr and
each class can be constructed using the forwarding construct() helper:

    auto widget = GWidget::construct(parent_widget);

Note that construct() simply forwards all arguments to an existing
constructor. It is inserted into each class by the C_OBJECT macro,
see CObject.h to understand how that works.

CObject::delete_later() disappears in this patch, as there is no longer
a single logical owner of a CObject.
2019-09-22 00:25:25 +02:00
Andreas Kling
8d550c174e LibCore: Convert CFile to ObjectPtr 2019-09-21 20:50:06 +02:00
Andreas Kling
c83da29a9d LibCore: Convert CLocalSocket to ObjectPtr 2019-09-21 15:25:08 +02:00
Sergey Bugaev
72acccb051 Userland: Add copy and paste commands
You can now copy into the system clipboard like this:
  $ copy hello friends
or like this:
  $ copy < ReadMe.md
or like this:
  $ copy --type png < /res/wallpapers/sunset-retro.png

And paste just with
  $ paste
or to view the copied type:
  $ paste --print-type
2019-09-17 21:56:42 +02:00
Tim Morgan
bc23db2c71 Add stdin support to wc program 2019-09-12 07:47:19 +02:00
Andreas Kling
f89944e804 Inspector+LibCore+rpcdump: Rework the RPC stuff to be request/response
RPC clients now send JSON-encoded requests to the RPC server.
The connection also stays alive instead of disconnecting automatically
after the initial CObject graph dump.

JSON payloads are preceded by a single host-order encoded 32-bit int
containing the length of the payload.

So far, we have three RPC commands:

    - Identify
    - GetAllObjects
    - Disconnect

We'll be adding more of these as we go along. :^)
2019-09-11 21:19:23 +02:00
Andreas Kling
8c8fecd6bf rpcdump: Don't call CSocket::connect() before setting up hooks 2019-09-11 19:56:04 +02:00
Andreas Kling
825fa3463c ls: Add -h (human readable) output switch
Fixes #543.
2019-09-11 18:59:13 +02:00
Aaron Malpas
fe1ab7989f cp: Implement directory copying
Recursive copying is only allowed if cp is called with the -r switch, ala POSIX.
2019-09-07 16:54:49 +02:00
Aaron Malpas
86415acd6a cp: Refactor copying into copy_file function 2019-09-07 16:54:49 +02:00
Aaron Malpas
4bc6c20091 cp: Use LibCore/CArgsParser for command-line arg parsing 2019-09-07 16:54:49 +02:00
Andreas Kling
73fdbba59c AK: Rename <AK/AKString.h> to <AK/String.h>
This was a workaround to be able to build on case-insensitive file
systems where it might get confused about <string.h> vs <String.h>.

Let's just not support building that way, so String.h can have an
objectively nicer name. :^)
2019-09-06 15:36:54 +02:00
Andreas Kling
127e1e0077 wc: Add missing newlines to some error messages 2019-09-01 15:32:09 +02:00
Brandon Scott
23e8715022 Userland: Add 'which' command (#497)
This mimics the shell's path resolution to locate the executable that
would execute if typing it as a command.
2019-08-29 06:23:22 +02:00
Sergey Bugaev
e1a6f8a27d LibThread: Introduce a new threading library
This library is meant to provide C++-style wrappers over lower
level APIs such as syscalls and pthread_* functions, as well as
utilities for easily running pieces of logic on different
threads.
2019-08-26 11:31:14 +02:00
Rok Povsic
e36b9635df Userland: Add realpath 2019-08-25 19:47:37 +02:00
Andreas Kling
11f88a78ad Userland: Remove unnecessary output from "rm" 2019-08-24 13:34:52 +02:00
Conrad Pankoff
bcd214c29d Userland: Fix ifconfig use of /proc/net/adapters 2019-08-21 16:57:31 +02:00
Andreas Kling
de87258b4f Userland: Remove immature "tc" and "uc" programs in favor of "nc"
The netcat-lite "nc" utility is where we should put all of the various
"lightweight" TCP/UDP client features.
2019-08-21 16:49:11 +02:00
Andreas Kling
9731bff44c ls: Sort the output alphabetically
Also use StringBuilder to construct the full relative paths, to get rid
of an unnecessary and suspicious-looking buffer.
2019-08-20 21:39:01 +02:00
Andreas Kling
029786e6b5 ls: Don't layout or colorize output if stdout is not a TTY 2019-08-20 21:06:44 +02:00
marprok
d4b7b92492 Userland: ls division by zero.
When the terminal app window became smaller than the longest filename,
a division by zero occured while calculating the offset.
2019-08-20 20:17:10 +02:00
Marios Prokopakis
91c79440a1 Userland: Improved the printing of the ls command. (#468)
The ls command takes into consideration the length of the largest
filename when it prints a line.

Fixes #432.
2019-08-19 16:37:21 +02:00
marprok
338ba238ca Userland: Implemented a simple cut command.
The current version supports only the -b list option for a single file.
Ranges are also supported.
2019-08-18 17:17:06 +02:00
Sergey Bugaev
9dfcbc58ec Userland: Reimplement the mount command
This new version can do three things:

* When invoked as `mount`, it will print out a list of mounted filesystem,
* When invoked as `mount -a`, it will try to mount filesystems
  listed in /etc/fstab,
* When invoked as `mount device mountpoint -t fstype`, it will mount that
  device on that mountpoint. If not specified, fstype defaults to ext2.
2019-08-17 12:07:55 +02:00
Sergey Bugaev
425c356288 Kernel+LibC+Userland: Support mounting other kinds of filesystems 2019-08-17 12:07:55 +02:00
Andreas Kling
1febd59f83 LibCore+rpcdump: Publish CObject graph to on-demand RPC socket
All programs that have a CEventLoop now allow local socket connections
via /tmp/rpc.PID and will dump a serialized JSON array of all the live
CObjects in the program onto connecting sockets.

Also added a small /bin/rpcdump tool that connects to an RPC socket and
produces a raw dump of the JSON that comes out.
2019-08-17 11:39:26 +02:00
Jesse Buhagiar
bc22456f89 Kernel: Added unmount ability to VFS
It is now possible to unmount file systems from the VFS via `umount`.
It works via looking up the `fsid` of the filesystem from the `Inode`'s
metatdata so I'm not sure how fragile it is. It seems to work for now
though as something to get us going.
2019-08-17 09:29:54 +02:00
Conrad Pankoff
c7040cee62 Userland: Use LibPCIDB in lspci to print device names 2019-08-14 13:12:54 +02:00
Conrad Pankoff
ecde025375 Libraries: Add LibPCIDB for reading PCI device information from pci.ids 2019-08-14 13:12:54 +02:00
Conrad Pankoff
99ed4ce30c Userland: Implement simple lspci command 2019-08-14 06:28:53 +02:00
Andreas Kling
7d6689055f Kernel+LibC+crash: Add mprotect() syscall
This patch adds the mprotect() syscall to allow changing the protection
flags for memory regions. We don't do any region splitting/merging yet,
so this only works on whole mmap() regions.

Added a "crash -r" flag to verify that we crash when you attempt to
write to read-only memory. :^)
2019-08-12 19:33:24 +02:00
Conrad Pankoff
e978e7543f Userland: Make sure sockaddr_len is initialised correctly in nc 2019-08-10 08:51:20 +02:00
Conrad Pankoff
fffd3a67ad Userland: Implement -l, -v, -N, -s, and -p for netcat 2019-08-08 10:32:01 +02:00
Conrad Pankoff
fbcf51f81b Userland: Implement nc command
This is a very simple version of the nc (netcat) command. It only
supports outgoing TCP connections, and has no options aside from the
target host and port.
2019-08-08 06:47:30 +02:00
Conrad Pankoff
7ed54d86d5 Kernel: Record network statistics and expose as JSON
This is comprised of five small changes:

* Keep a counter for tx/rx packets/bytes per TCP socket
* Keep a counter for tx/rx packets/bytes per network adapter
* Expose that data in /proc/net_tcp and /proc/netadapters
* Convert /proc/netadapters to JSON
* Fix up ifconfig to read the JSON from netadapters
2019-08-08 06:44:49 +02:00
Andreas Kling
f6998b1817 JSON: Templatize the JSON serialization code
This makes it possible to use something other than a StringBuilder for
serialization (and to produce something other than a String.) :^)
2019-08-07 21:29:32 +02:00
Conrad Pankoff
9111d3626a Userland: Implement truncate command
This has a known bug in that you can't specify a negative size value.
This bug stems from the argument parser, and once it's fixed there,
everything should work here.
2019-08-05 08:36:28 +02:00
Andreas Kling
8e684f0959 AudioServer: Port to the new generated IPC mechanism
Fork the IPC Connection classes into Server:: and Client::ConnectionNG.
The new IPC messages are serialized very snugly instead of using the
same generic data structure for all messages.

Remove ASAPI.h since we now generate all of it from AudioServer.ipc :^)
2019-08-03 19:49:19 +02:00
Jesse
401c87a0cc Kernel: mount system call (#396)
It is now possible to mount ext2 `DiskDevice` devices under Serenity on
any folder in the root filesystem. Currently any user can do this with
any permissions. There's a fair amount of assumptions made here too,
that might not be too good, but can be worked on in the future. This is
a good start to allow more dynamic operation under the OS itself.

It is also currently impossible to unmount and such, and devices will
fail to mount in Linux as the FS 'needs to be cleaned'. I'll work on
getting `umount` done ASAP to rectify this (as well as working on less
assumption-making in the mount syscall. We don't want to just be able
to mount DiskDevices!). This could probably be fixed with some `-t`
flag or something similar.
2019-08-02 15:18:47 +02:00
Andreas Kling
4271bebbef more: Don't printf(string), printf("%s", string)!
Found by PVS-Studio.
2019-08-01 11:39:41 +02:00
Andreas Kling
488d57750d pidof: Remove redundant bool check.
Found by PVS-Studio.
2019-08-01 11:07:44 +02:00
Andreas Kling
15afc88ffe AudioServer: Add a "main mix volume" and a simple program to get/set it
Give the mixer a main volume value (percent) that we scale all the
outgoing samples by (before clipping.)

Also add a simple "avol" program for querying and setting the volume:

- "avol" prints the current volume.
- "avol 200" sets the main mix volume to 200%
2019-07-29 19:06:58 +02:00
Andreas Kling
7356fd389f aplay: s/Sample/Progress/ in the output. It's all in the details! 2019-07-28 21:56:19 +02:00
Andreas Kling
ae4a9e017a LibAudio+aplay: Make the aplay output look a little funner.
Show some information about the file we're playing, and display how many
samples we've played out of how many total.

This might be a bit buggy as I haven't tested it with many different files,
but it's a start. :^)
2019-07-28 21:52:30 +02:00
Andreas Kling
7cabe6433e AudioServer: Add a buffer queue so we can buffer some sound.
The idea here is to keep a small number of sample buffers queued in the
AudioServer so we don't get caught without something to play.
2019-07-28 18:27:32 +02:00
Andreas Kling
5e01dde7b1 Audio: Make ABuffer sit on top of a SharedBuffer.
This allows us to carry the same buffer all the way from the WAV loader
to the AudioServer mixer.

This alleviates some of the stutter, but there's still a noticeable
skip when switching buffers. We're gonna need to do better. :^)
2019-07-27 18:17:17 +02:00
Andreas Kling
426248098c Audio: Make basic streaming WAV playback work.
I had to solve a bunch of things simultaneously to make this work.
Refactor AWavLoader to be a streaming loader rather than a one-shot one.
The constructor parses the header, and if everything looks good, you can
repeatedly ask the AWavLoader for sample buffers until it runs out.

Also send a message from AudioServer when a buffer has finished playing.
That allows us to implement a blocking variant of play().

Use all of this in aplay to play WAV files chunk-at-a-time.
This is definitely not perfect and it's a little glitchy and skippy,
but I think it's a step in the right direction.
2019-07-27 17:27:05 +02:00
Andreas Kling
c8e2bb5605 Kernel: Add a mechanism for listening for changes to an inode.
The syscall is quite simple:

    int watch_file(const char* path, int path_length);

It returns a file descriptor referring to a "InodeWatcher" object in the
kernel. It becomes readable whenever something changes about the inode.

Currently this is implemented by hooking the "metadata dirty bit" in
Inode which isn't perfect, but it's a start. :^)
2019-07-22 20:01:11 +02:00
Andreas Kling
3965fcc484 ls: Don't print an empty line if there were no files to show.
Fixes #352.
2019-07-21 09:26:47 +02:00
Jesse
a5d80f7e3b Kernel: Only allow superuser to halt() the system (#342)
Following the discussion in #334, shutdown must also have root-only
run permissions.
2019-07-19 13:08:26 +02:00
Jesse
a27c9e3e01 Kernel+Userland: Addd reboot syscall (#334)
Rolling with the theme of adding a dialog to shutdown the machine, it is
probably nice to have a way to reboot the machine without performing a full
system powerdown.

A reboot program has been added to `/bin/` as well as a corresponding
`syscall` (SC_reboot). This syscall works by attempting to pulse the 8042
keyboard controller. Note that this is NOT supported on  new machines, and
should only be a fallback until we have proper ACPI support.

The implementation causes a triple fault in QEMU, which then restarts the
system. The filesystems are locked and synchronized before this occurs,
so there shouldn't be any corruption etctera.
2019-07-19 09:58:12 +02:00
Andreas Kling
1498a3be32 Userland: Remove some no-longer-needed test utilities. 2019-07-18 11:26:50 +02:00
Andreas Kling
1c0669f010 LibDraw: Introduce (formerly known as SharedGraphics.)
Instead of LibGUI and WindowServer building their own copies of the drawing
and graphics code, let's it in a separate LibDraw library.

This avoids building the code twice, and will encourage better separation
of concerns. :^)
2019-07-18 10:18:16 +02:00
Robin Burchell
b12d1fbb81 ps: Widen state field to fit "Condition" and other fields
Similar to ab20c91cfb.
2019-07-18 07:23:26 +02:00
Robin Burchell
57da716be0 ps: Port to using CProcessStatisticsReader and /proc/all
Drop /proc/summary in the process.
We only needed one new field here, thankfully, so this was quite straightforward.
2019-07-18 07:23:26 +02:00
Robin Burchell
a9d1a86e6e CProcessStatisticsReader: Be consistent about terminology from the kernel down 2019-07-18 07:23:26 +02:00
Robin Burchell
2177594c96 Port LibGUI to use CIPCClientSideConnection
As a consequence, move to use an explicit handshake() method rather than
calling virtuals from the constructor. This seemed to not bother
AClientConnection, but LibGUI crashes (rightfully) because of it.
2019-07-17 20:16:44 +02:00
Andreas Kling
ab20c91cfb top: Widen "state" field slightly to accomodate "Condition". 2019-07-17 11:23:31 +02:00
Robin Burchell
2df6f0e87f Work on AudioServer
The center of this is now an ABuffer class in LibAudio.
ABuffer contains ASample, which has two channels (left/right) in
floating point for mixing purposes, in 44100hz.

This means that the loaders (AWavLoader in this case) needs to do some
manipulation to get things in the right format, but that we don't need
to care after format loading is done.

While we're at it, do some correctness fixes. PCM data is unsigned if
it's 8 bit, but 16 bit is signed. And /dev/audio also wants signed 16
bit audio, so give it what it wants.

On top of this, AudioServer now accepts requests to play a buffer.
The IPC mechanism here is pretty much a 1:1 copy-paste from
LibGUI/WindowServer. It can be generalized more in the future, but for
now I want to get AudioServer working decently first :)

Additionally, add a little "aplay" tool to load and play a WAV file. It
will break with large WAVs (run out of memory, heh...) but it's a start.

Future work needs to make AudioServer block buffer submission from
clients until it has played the buffer they are requesting to play.
2019-07-17 09:39:31 +02:00
Albert Gafiyatullin
f5a9b27f3f chmod: Add understanding of simple permission strings. (#295)
Fixes #162.
2019-07-13 19:36:02 +02:00
Andreas Kling
ea6363c540 top: Remove some unused code. 2019-07-10 15:22:42 +02:00
Andreas Kling
01216f3c3f Userland+LibCore: Use CProcessStatisticsReader to implement top.
Also tweaked CProcessStatisticsReader a bit to simplify the API.
2019-07-10 13:56:28 +02:00
Andreas Kling
27f699ef0c AK: Rename the common integer typedefs to make it obvious what they are.
These types can be picked up by including <AK/Types.h>:

* u8, u16, u32, u64 (unsigned)
* i8, i16, i32, i64 (signed)
2019-07-03 21:20:13 +02:00
Dan MacDonald
0b1ff2d0eb Userland: Don't return an error when jp is run without arguments 2019-07-02 10:32:49 +02:00
Andreas Kling
54d7670fc3 Kernel+Userland: Convert /proc/df to JSON. 2019-07-01 18:54:02 +02:00
VAN BOSSUYT Nicolas
802d4dcb6b Meta: Removed all gitignore in the source tree only keeping the root one 2019-06-30 10:41:26 +02:00
Andreas Kling
73d0e7cd8f Userland: Add a simple JSON pretty-printing utility called /bin/jp 2019-06-30 09:11:04 +02:00
Rhin
ce0b615bef Userland: Fixed "id" usage error typo (#254) 2019-06-30 07:36:14 +02:00
Rhin
1d39310d01 Userland: Added flags to id command (#253)
Fixes #158.
2019-06-29 21:47:38 +02:00
Andreas Kling
2bd8118843 Kernel: Change the format of /proc/all to JSON.
Update ProcessManager, top and WSCPUMonitor to handle the new format.

Since the kernel is not allowed to use floating-point math, we now compile
the JSON classes in AK without JsonValue::Type::Double support.
To accomodate large unsigned ints, I added a JsonValue::Type::UnsignedInt.
2019-06-29 09:04:45 +02:00
Andreas Kling
eedb4f6b2f QuickShow: Allow panning and zooming the image instead of stretching it.
This needs more work and polish, but it's a step in a more pleasant and
useful direction.

Also turn QuickShow into a fully-fledged "application". (By that, I really
just mean giving it its own Applications/ subdirectory.)
2019-06-23 16:35:43 +02:00
Andreas Kling
3ed17b0792 printf: Support %zu (the 'z' is really just ignored.) 2019-06-22 16:30:32 +02:00
Andreas Kling
3b01d7fdff Userland: Fix more compiler warnings. 2019-06-22 16:13:47 +02:00
Andreas Kling
1277d583ef printf: Oops, '-' is the left padding modifier, not ' '.
It's kinda funny how I can make a mistake like this in Serenity and then
get so used to it by spending lots of time using this API that I start to
believe that this is how printf() always worked..
2019-06-22 15:53:52 +02:00
Andreas Kling
5980007e44 Userland: Fix many compiler warnings. 2019-06-22 15:47:08 +02:00
Andreas Kling
8c0ae711d8 Kernel+LibC: Make page fault crashes a bit more readable.
We'll now try to detect crashes that were due to dereferencing nullptr,
uninitialized malloc() memory, or recently free()'d memory.
It's not perfect but I think it's pretty good. :^)

Also added some color to the most important parts of the crash log,
and added some more modes to /bin/crash for exercising this code.

Fixes #243.
2019-06-19 20:52:12 +02:00
Callum Attryde
267672efee Userland: Add wc program (#228)
Fixes #159.
2019-06-16 14:13:57 +02:00
Robin Burchell
952382b413 Kernel/Userland: Add a halt syscall, and a shutdown binary to invoke it 2019-06-16 12:25:30 +02:00
Andreas Kling
9e0f7acfe5 Kernel+Userland: Expose list of network adapters through /proc/netadapters.
Added a simple /bin/ifconfig program that just pretty-prints that file. :^)
2019-06-16 07:06:49 +02:00
Conrad Pankoff
f0ce0910ab Userland: Add test program for stressing memory allocation 2019-06-12 15:38:17 +02:00
Conrad Pankoff
7b04c7dc48 Userland: Implement -c [characters] option for head 2019-06-08 18:01:06 +02:00
Andreas Kling
39d1a9ae66 Meta: Tweak .clang-format to not wrap braces after enums. 2019-06-07 17:13:23 +02:00
Andreas Kling
0ed89440f1 ProcessManager+top: Rename "linear" size to "virtual" size.
I originally called it "linear" because that's how the Intel manual names
virtual addresses in many cases. I'm ready to accept that most people know
this as "virtual" so let's just call it that.
2019-06-07 12:44:29 +02:00
Andreas Kling
b07bbf383d Userland: Run clang-format on everything. 2019-06-07 11:49:31 +02:00
Andreas Kling
1d5a3507b2 Userland: Add a little test program for the alarm() syscall. 2019-06-07 11:30:22 +02:00
Ben Sloane
9687f1801b tail: Default tail behavior with no arguments (#209)
Make tail assume you wanted 10 lines of output if no -n option was provided.
2019-06-06 20:28:58 +02:00
Andreas Kling
abb3643d88 tail: Shell programs should return 1 to indicate failure. 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
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
Christopher Dumas
8fecc0eaee Userland: Implement recursive rm 2019-06-03 20:16:00 +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
vger92
1876606973 Userland: Add tee command (#166) 2019-06-02 12:45:17 +02:00
Conrad Pankoff
6cabd34b93 Userland: Improve head program
* allow specifying files as arguments, e.g. `head a b c`
* support multiple files
* print a filename header when multiple files are being printed
* allow suppression or forcing of filename header via flags

This change drops support for the legacy `-123` syntax in favour of the
more widely-supported `-n 123` form.

fixes #105
2019-06-01 14:48:03 +02:00
Mustafa
a4726b846c ls: Show user name and group name if available. (#151)
Fixes #150
2019-06-01 13:23:35 +02:00
Conrad Pankoff
51a74fb3bb Userland: Add a /bin/yes program (fixes #110) 2019-06-01 12:16:55 +02:00
Andreas Kling
cbd858544d LibC: Move struct timeval to sys/time.h. #POSIX 2019-05-28 13:48:06 +02:00
Robin Burchell
9d2b08e06e LibCore: Add CDirIterator, and use it in everything rather than readdir 2019-05-27 15:27:23 +02:00
Andreas Kling
f352a5094d ls: Fix build and tidy up coding style. 2019-05-27 15:04:23 +02:00
faissaloo
f28cc2e2e0 Ls: Cleanup 2019-05-27 14:53:16 +02:00
faissaloo
4c410f3de6 Ls: Support multiple files 2019-05-27 14:53:16 +02:00
faissaloo
776a359a17 Ls: Support single files in long mode 2019-05-27 14:53:16 +02:00
faissaloo
fee686e2cd Ls: Refactor long directory listings 2019-05-27 14:53:16 +02:00
faissaloo
07c356ce64 Ls: Add single file support in short mode 2019-05-27 14:53:16 +02:00
Andreas Kling
9308ce071f Userland: Add a helpful little program for provoking different crashes.
Currently supported crash types:

    -s : Segmentation violation
    -d : Division by zero
    -i : Illegal instruction
    -a : Abort
2019-05-26 02:35:25 +02:00
Andreas Kling
677794f30d LibGUI: Make GCheckBox inherit from GAbstractButton. 2019-05-24 17:11:42 +02:00
Andreas Kling
21c56477b0 LibGUI: Add a GAbstractButton base class for button widgets.
This patch moves GButton and GRadioButton to inherit from it. This allows
them to share code for mouse event handling, etc.
2019-05-24 16:32:20 +02:00
Robin Burchell
77dfd419e9 LibCore: Move AK/ArgsParser to LibCore/CArgsParser
Also rename the classes to match LibCore naming style.
This means that it's no longer incorrectly linked into LibC and Kernel.
2019-05-17 15:49:37 +02:00
Robin Burchell
190111e21a Userland: Port ln to use ArgsParser 2019-05-17 15:49:37 +02:00
Robin Burchell
bffed9e3cb ArgsParser: Expand to be able to handle multiple single arguments
This is needed for e.g. ln
2019-05-17 15:49:37 +02:00
Robin Burchell
b92fa59832 Userland: Port pape to use ArgsParser, and minor cleanups 2019-05-17 15:49:37 +02:00
Robin Burchell
56aad835ad Userland: Port sysctl to use ArgsParser, and minor cleanups 2019-05-17 15:49:37 +02:00
Robin Burchell
6dd7ee53ea AK/Userland: Add single value to ArgsParser usage, and port tail to use ArgsParser 2019-05-17 15:49:37 +02:00
Robin Burchell
c478503581 ArgsParser: Remove prefix from constructor
It makes sense to keep this consistent between applications, and the
purpose of the string is not immediately obvious from an API perspective.

If we need to make it configurable later, that can come from a setter.
2019-05-17 15:49:37 +02:00
Robin Burchell
729507f2bd ArgsParser: Remove boolean trap on add_arg
Rather than requiring a boolean for whether or not the argument is
required, add some new methods to make the purpose of the bool explicit.
2019-05-17 15:49:37 +02:00
Robin Burchell
c8fda23a03 LibCore/Userland: Introduce a simple tail implementation
Also introduce more seek modes on CIODevice, and an out param to find
the current position inside the file -- this means less syscalls (and
less potential races) than requesting it through a separate pos()
accessor or something.
2019-05-17 14:28:13 +02:00
Andreas Kling
c597c2332b Userland: Add /bin/whoami 2019-05-16 20:18:17 +02:00
GuillaumeGas
0ba4ceb2cd Added CProcessStatisticsReader to avoid having to parse /proc/all (#35)
* Added CProcessStatisticsReader to avoid having to parse /proc/all

* Took @awesomekling's feedbacks into account

* Fixed indentation and replaced tabs by spaces
2019-05-16 18:47:47 +02:00
GuillaumeGas
801d6f572a Feature/pidof (#31)
* Added killall command

* Fixed feedbacks of awesomekling

* Implemented pidof program and helper to parse arguments called ArgsParser.

* Fixed feedbacks in pidof implem.

Fixes #26
2019-05-13 14:31:23 +02:00
Andreas Kling
b5b44a29bb Replace various copies of parse_uint(String) with String::to_uint(). 2019-05-08 19:21:51 +02:00
GuillaumeGas
cea631d90c Added killall command (#30)
* Added killall command

* Fixed feedbacks of awesomekling
2019-05-08 18:52:37 +02:00
Andreas Kling
fe73543d41 Shell: Move the Shell to a separate directory and let's call it "Shell" :^) 2019-05-07 01:12:08 +02:00
Andreas Kling
e63cc38861 Shell: Use a Vector<char> for the main input buffer. 2019-05-07 01:01:50 +02:00
Andreas Kling
3ae75e04ec date: Add "-u" argument for printing current Unix timestamp. 2019-05-04 16:50:36 +02:00
Andreas Kling
8b249bd09b Kernel+Userland: Implement mknod() syscall and add a /bin/mknod program. 2019-05-03 22:59:58 +02:00
Andreas Kling
2a65f0ee4f strace: Allow "strace command" to trace a process from start to finish.
Tracing a specific pid is now done via "strace -p PID".
To ensure we don't miss any syscalls, we fork and have the child immediately
SIGSTOP itself. Then when the parent has set up the systrace() fd, we send
SIGCONT to the child which then execs the command. :^)
2019-05-02 15:51:39 +02:00
Andreas Kling
d3bd4fdcfe sh: Log to debugger how long command took. 2019-05-02 02:22:28 +02:00
Andreas Kling
b204b77b29 sh: Remove debug spam during command launch. 2019-04-26 17:33:06 +02:00
Andreas Kling
d4a8e2930e sh: Add a simple "export" command for setting environment variables. 2019-04-26 03:23:27 +02:00
Andreas Kling
c392c0d799 Userland: Add a simple /bin/tr program. 2019-04-26 00:57:37 +02:00
Andreas Kling
671dee9afa Userland: Add a simple /bin/sort program. 2019-04-26 00:53:57 +02:00
Andreas Kling
b5a1ee1d3e Userland: Add a simple /bin/head program. 2019-04-26 00:47:30 +02:00
Andreas Kling
96d4b701e6 sh: Make "cd" jump to the home directory. And also let's set $HOME.
Nobody else is setting $HOME right now, so we might as well do it here.
This should eventually be done by some sort of "login" program.
2019-04-25 23:09:21 +02:00
Andreas Kling
89e9aafbb5 sh: Support erasing a whole word with WERASE (^W). 2019-04-25 23:05:10 +02:00
Andreas Kling
04b7def6ab sh: Add support for redirecting stdin and stdout with < and >.
This is certainly about time. The kernel has had all the necessary support
in place for months, and I just kept postponing working on the shell. :^)
2019-04-25 16:10:16 +02:00
Andreas Kling
df8e76a67c cat: Just use fd 0 when no arguments are passed.
I'm not sure why it seemed necessary at some point to open /dev/stdin rather
than simply using the already-open fd 0.
2019-04-25 16:01:28 +02:00
Andreas Kling
e84faadb63 sh: Refactor command parsing into a separate class. 2019-04-25 14:34:25 +02:00
Andreas Kling
07de1147ad sh: Add basic command piping support. 2019-04-25 14:13:36 +02:00
Andreas Kling
aa84e2fc64 fgrep: Don't repeat old incoming data if fgets() failed. 2019-04-25 14:07:17 +02:00
Andreas Kling
eadcf720c0 Userland: Add a simple /bin/echo program. 2019-04-25 04:42:09 +02:00
Andreas Kling
0c898e3c2c Put assertions behind a DEBUG flag to make it easy to build without them. 2019-04-23 21:52:02 +02:00
Andreas Kling
91f561a417 touch: Newly created files were accidentally marked as FIFO's. 2019-04-23 17:04:12 +02:00
Andreas Kling
5c68929aa1 Kernel: Add a systrace() syscall and implement /bin/strace using it.
Calling systrace(pid) gives you a file descriptor with a stream of the
syscalls made by a peer process. The process must be owned by the same
UID who calls systrace(). :^)
2019-04-22 18:44:45 +02:00
Andreas Kling
57da00b731 Include Makefile.common in all other Makefiles. 2019-04-21 04:09:39 +02:00
Andreas Kling
5f63f8120c Kernel: Remove "restorer" field from SignalActionData.
I was originally implementing signals by looking at some man page about
sigaction() to see how it works. It seems like the restorer thingy is
system-specific and not required by POSIX, so let's get rid of it.
2019-04-20 19:32:14 +02:00
Andreas Kling
5eedb22834 Sprinkle use of AK::Vector in various places.
Some of these are less helpful than others. Avoiding a bunch of mallocs
in the event loop wakeup code is definitely nice.
2019-04-20 14:02:19 +02:00
Andreas Kling
301a269ca0 Get rid of SERENITY macro since the compiler already defines __serenity__
This makes it a bit easier to use AK templates out-of-tree.
2019-04-20 12:58:49 +02:00
Andreas Kling
87c4d2bc92 Userland: Add a /bin/basename program. 2019-04-15 13:57:09 +02:00
Nicolas Van Bossuyt
37c27e2e39 Userspace: gitignore binaries 2019-04-15 00:35:37 +02:00
Andreas Kling
adc91d92a3 Userland: Oops, that merge broke the build, just needed a few tweaks. :^) 2019-04-14 20:32:44 +02:00
Nicolas Van Bossuyt
40e710da3d
Userland: Maybe find is overkill 2019-04-14 20:15:29 +02:00
Nicolas Van Bossuyt
dfeeaff237
Userland: making the makefile smarter 2019-04-14 19:58:25 +02:00
VAN BOSSUYT Nicolas
12f2d1f2e8 Uptime: making the ouput prettier
Just like the -p option on linux
2019-04-14 19:10:24 +02:00
Andreas Kling
c0fe48635b Kernel: Add /proc/uptime file (number of seconds since boot.)
Also added a simple /bin/uptime to pretty-print this information. :^)
2019-04-14 15:19:45 +02:00
Andreas Kling
5e0577a042 Introduce LibCore and move GElapsedTimer => CElapsedTimer.
I need a layer somewhere between AK (usable both by userspace and kernel)
and LibGUI (usable by userspace except WindowServer.) So here's LibCore.
2019-04-10 16:14:44 +02:00
Andreas Kling
4ab0cd5d4c LibGUI: Move frame painting from GFrame to StylePainter.
This way it can be used by others who might not have a GFrame object.
2019-04-10 03:43:46 +02:00
Andreas Kling
313ac51832 LibGUI: Turn GTextBox into a wrapper around a single-line GTextEditor. 2019-04-10 03:08:29 +02:00
Andreas Kling
37ae00a4dd Kernel+Userland: Add the rename() syscall along with a basic /bin/mv. 2019-04-07 23:35:26 +02:00
Andreas Kling
5d72cf5a3f LibGUI: Improve GFrame's look for Container shapes.
This is now starting to look like a proper container. Very nice :^)
2019-03-28 20:15:13 +01:00
Andreas Kling
f939fb7eb7 Userland: Add a simple GFrame testing window to guitest2. 2019-03-28 18:52:03 +01:00
Andreas Kling
9fa21fa585 LibGUI: Add a GPainter class that inherits from Painter.
This gets rid of the last little piece of LibGUI knowledge in Painter.
2019-03-28 17:19:56 +01:00
Andreas Kling
0058da734e Kernel: Add Inode::truncate(size).
- Use this to implement the O_TRUNC open flag.
- Fix creat() to pass O_CREAT | O_TRUNC | O_WRONLY.
- Make sure we truncate wherever appropriate.
2019-03-27 16:42:30 +01:00
Andreas Kling
23bb276fcd LibC: Run constructors on process startup.
Cooperate with the compiler to generate and execute the _init_array list
of constructor functions on userspace program statup. This took two days
to get working, my goodness. :^)
2019-03-27 12:48:21 +01:00
Andreas Kling
aef6030a80 LibC: Time-related POSIX compliance fixes. 2019-03-27 01:31:53 +01:00
Andreas Kling
7e54fdce99 QuickShow: Fill the window with white if the opened image has alpha. 2019-03-24 03:07:00 +01:00
Andreas Kling
d563dc0565 LibGUI: Add a setting to make GLabel stretch its icon.
Use this in QuickShow to allow arbitrarily scaling the opened image.
2019-03-22 04:20:48 +01:00
Andreas Kling
c3b0c1ba68 LibGUI: Add a GProgressBar widget. 2019-03-22 02:49:45 +01:00
Andreas Kling
e4dfd5a3a4 WindowServer: Support PNG wallpapers.
Fix up /bin/pape so it tells the WindowServer which wallpaper file to use.
2019-03-21 15:54:19 +01:00
Andreas Kling
0114c61cf1 Userland: Turn off double buffering in QuickShow.
Since this program is primarily used to display potentially huge but still
static images, let's not put extra strain on the system by double buffering.
2019-03-21 13:31:47 +01:00
Andreas Kling
65348e7dc1 PNGLoader: Support for color type 2 (RGB triplets) and multiple IDAT chunks. 2019-03-21 05:25:54 +01:00
Andreas Kling
42755e98cf SharedGraphics: Implement a simple PNG decoder.
This is extremely unoptimized, but it does successfully load "folder32.png"
so it must be at least somewhat correct. :^)
2019-03-21 03:57:42 +01:00
Andreas Kling
4ea625e08b Userland: Allow ping <hostname> :^) 2019-03-20 03:38:09 +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
57ff293a51 LibGUI: Implement nested event loops to support dialog boxes.
This patch adds a simple GMessageBox that can run in a nested event loop.
Here's how you use it:

    GMessageBox box("Message text here", "Message window title");
    int result = box.exec();

The next step is to make the WindowServer respect the modality flag of
these windows and prevent interaction with other windows in the same
process until the modal window has been closed.
2019-03-19 00:01:02 +01:00
Andreas Kling
4629272135 Userland: Turn the tc test util into a simple dumb HTTP client. 2019-03-14 15:19:20 +01:00
Andreas Kling
3d5296a901 IPv4: Last burst of TCP hacking for today.
Connecting to a test server and exchanging data back and forth works.
2019-03-14 01:44:42 +01:00
Andreas Kling
be46f1bb1f IPv4: More work on the TCP implementation.
Reading from the peer now kinda works. Something still going wrong with
sending packets but it's getting closer.
2019-03-14 01:00:10 +01:00
Andreas Kling
032d9d7065 IPv4: More hacking on bringing up TCP support.
This was a bit more complicated than I expected, but it's moving forward.
2019-03-13 23:14:30 +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
4dddf949c8 IPv4: More work on UDP support.
I'm now able to connect to a simple UDP server on my host machine and
exchange some data. Very cool! :^)
2019-03-13 15:40:30 +01:00
Andreas Kling
ea6a537b70 Userland: Add a simple utility for UDP testing. 2019-03-13 15:00:02 +01:00