Commit Graph

81 Commits

Author SHA1 Message Date
Jonas 'Sortie' Termansen be4858f82c Rename libmaxsi to sortix libc. 2012-12-14 14:13:36 +01:00
Jonas 'Sortie' Termansen 63b1c50cd2 Split libmaxsi integer.cpp into multiple files. 2012-12-14 14:13:36 +01:00
Jonas 'Sortie' Termansen 9306c8f645 Split libmaxsi signal.cpp into multiple files. 2012-12-14 14:13:36 +01:00
Jonas 'Sortie' Termansen 8290f8979c Split libmaxsi time.cpp into multiple files. 2012-12-14 14:13:36 +01:00
Jonas 'Sortie' Termansen 0e7518915e Split libmaxsi random.o into multiple files. 2012-12-14 14:13:36 +01:00
Jonas 'Sortie' Termansen 4556036e08 Split libmaxsi memory.cpp into multiple files. 2012-12-14 14:13:36 +01:00
Jonas 'Sortie' Termansen 297b7259af Move calloc(3) to its own file. 2012-12-14 14:13:36 +01:00
Jonas 'Sortie' Termansen d81cdc09e9 Move operator new to its own file. 2012-12-14 14:13:36 +01:00
Jonas 'Sortie' Termansen 60214a9dfb Put getdelim(3) and getline(3) in their own files. 2012-12-14 14:13:35 +01:00
Jonas 'Sortie' Termansen 97deb8bb8a Split libmaxsi error.o. 2012-12-14 14:13:35 +01:00
Jonas 'Sortie' Termansen fb91fbbc5c Split libmaxsi process.o into multiple files. 2012-12-14 14:13:35 +01:00
Jonas 'Sortie' Termansen 838992c3d8 Don't build libmaxsi.a.
This should just about remove most of the old and deprecated (and now
obsolete) Maxsi:: API. Of course, large parts of libc still suffer from
its poor design, but I'll get around to fix that eventually.
2012-12-14 14:13:35 +01:00
Jonas 'Sortie' Termansen c0fabc2e8d Move remainder of Maxsi::String into kernel tree. 2012-12-14 14:13:35 +01:00
Jonas 'Sortie' Termansen 1b26d1bacf Make sprintf family freestanding.
And use them in the kernel.
2012-12-14 14:13:35 +01:00
Jonas 'Sortie' Termansen df7d8ca335 Move crc32 checksum code into kernel. 2012-12-14 14:13:34 +01:00
Jonas 'Sortie' Termansen 1435937dd4 Remove <libmaxsi/sortix-sound.h>. 2012-12-14 14:13:34 +01:00
Jonas 'Sortie' Termansen 42754f1728 Replace ASSERT with assert of <assert.h>. 2012-12-14 14:13:34 +01:00
Jonas 'Sortie' Termansen 8b7eef9fe4 Removed <libmaxsi/thread.h> header. 2012-12-14 14:13:34 +01:00
Jonas 'Sortie' Termansen a1ed9144bc Sort libmaxsi objects into freestanding and hosted. 2012-12-14 14:13:33 +01:00
Jonas 'Sortie' Termansen 9cf092d32e Use cross compiler in build system. 2012-12-14 14:13:33 +01:00
Jonas 'Sortie' Termansen 82035e87da Add makefile targets for installing sysroot base headers. 2012-09-10 21:45:38 +02:00
Jonas 'Sortie' Termansen bde41a37ec Implement crt1.o, crti.o, and crtn.o.
This helps running cross compiled programs as well as compiling programs
under Sortix with gcc. There is also support for global constructors.

Currently, cross-compiled executables uses these startup files. The current
build system continues to use start.o, which does not offer global
constructors and other useful features.

Note that these using the crtX.o files requires the crtbegin.o and crtend.o
files that ship with the cross compiler, but that should be no problem.
2012-09-08 18:45:53 +02:00
Jonas 'Sortie' Termansen 2158a16904 Add setlocale(3) and localeconv(3).
Ok, these are kinda hacky but they do implement a skeleton that a real
implementation can be based upon.
2012-09-08 18:45:53 +02:00
Jonas 'Sortie' Termansen bb3e590915 Add proper implementation of scanf family.
There are still a few non-standard quirks and things that needs to be
properly implemented but that shouldn't be too hard and the most important
features are now implemented.
2012-09-08 18:45:53 +02:00
Jonas 'Sortie' Termansen cd728c9af9 Add fabs{,f,l}(3). 2012-09-08 18:45:53 +02:00
Jonas 'Sortie' Termansen 6755318919 Add bsearch(3).
This is a rather stupid implementation as it does the search in linear
time. More importantly, it is correct and helps porting gcc. Besides, it
can easily be fixed in due time.
2012-09-08 18:45:53 +02:00
Jonas 'Sortie' Termansen b4192c10e9 Refactor libc process exit and abortion.
Removed Maxsi::Process:: functions as they suck and are barely used. Gave
the functions standard names and put them in their own source files.

The declarations now have nice noreturn attributes attached.
2012-09-08 18:45:52 +02:00
Jonas 'Sortie' Termansen 34970e63f3 Implement assert(3) properly. 2012-09-08 18:45:52 +02:00
Jonas 'Sortie' Termansen 8bac113573 Split libmaxsi/terminal.cpp into multiple files. 2012-09-08 18:45:52 +02:00
Jonas 'Sortie' Termansen 261c063f4f Refactored libmaxsi/file.c into a multiple files. 2012-07-31 14:35:54 +02:00
Jonas 'Sortie' Termansen 87c8120b95 Refactored libmaxsi/string.cpp into multiple files.
However, parts libmaxsi/string.cpp remains as the kernel and parts of the
standard library still rely on <libmaxsi/string.h>.
2012-07-26 14:17:56 +02:00
Jonas 'Sortie' Termansen 01df97080e Refactored libmaxsi/io.cpp into multiple files.
This creates more object files in the static library which reduces the size
of statically linked files as only the relevant object files are included.
In my experience, it reduced the size of the system initrd from 1.9 MiB to
1.6 MiB which is valuable.
2012-07-25 23:05:05 +02:00
Jonas 'Sortie' Termansen db5d216cbe Added ReadParamString to libmaxsi as a hack. 2012-07-24 21:26:09 +02:00
Jonas 'Sortie' Termansen 143120d160 Added tcgetwinsize(2) for determining terminal resolution.
Unfortunately this area is not standardized by POSIX. Linux uses an ioctl
which is not that bad, but I'd like to have a designated function. I'm not
sure if this facility is powerful enough and whether it should be improved.
Also note that I use a struct winsize as on Linux, but I use size_ts instead
for the heck of it. Perhaps I should use another name for the struct.
2012-07-24 18:43:34 +02:00
Jonas 'Sortie' Termansen 887abdfe87 Added a CRC32 function to libmaxsi. 2012-07-02 17:16:23 +02:00
Jonas 'Sortie' Termansen 0ab2bbbd1b Finally fixed the loaderbug!
Programs were crashing randomly at startup on the kthread branch. After some
investigation, it turned out that the programs weren't correctly loaded by
the program loader in rare cases. Although, all investigation showed that
the program loader was correct and so was the interrupt routines (well,
almost, but nothing that could really trigger this). Yada yada, a few months
later I discovered that memcpy(3) was being corrupted by an interrupt handler
(which was correct). Turns out memcpy used stack space it hadn't allocated.
This is a Linux optimization that I had forgotten to disable with
-mno-red-zone in libmaxsi and thus interrupts just overwrote the stack of
optimized functions. Eek!
2012-07-02 16:09:13 +02:00
Jonas 'Sortie' Termansen aac12add54 Added stubs for functions in dlfcn.h. 2012-05-30 23:58:04 +02:00
Jonas 'Sortie' Termansen 45981431de Added atexit(3) and on_exit(3). 2012-05-29 22:17:27 +02:00
Jonas 'Sortie' Termansen a75b215fe3 Added fpipe(3) providing pipe(2) through the FILE interface. 2012-05-21 12:52:27 +02:00
Jonas 'Sortie' Termansen 6367a2352e Added sforkr(2) that controls the child registers as well.
sfork(2) now calls sforkr(2) with the current registers.

This will prove useful in creating threads, where user-space now can fully
control what state the child will start in. This is unlike the Linux clone
system call that accepts a pointer to the child stack; this is more powerful
and somehow simpler. Note that this will create a rather raw thread; no
thread initization has been done by the standard thread API (when it is
implemented), so this feature shouldn't be used by programmers unless they
know what they are doing.

fork(2) now calls sfork(2) directly. Also removed fork(2) and sfork(2) from
the kernel as they are done using sforkr(2) now. So technically they aren't
system calls right now, but that could always change.
2012-04-05 23:00:47 +02:00
Jonas 'Sortie' Termansen dd5157da6a Implemented setenv(3), putenv(3), getenv(3), clearenv(3), sortix_getenv(3),
unsetenv(3), envlength(3), getenvindexed(3), and environ(7).

This provides the user-space foundation for environmental variables.

Note that this works over fork(2), but not execve(2) yet.
2012-04-03 20:23:28 +02:00
Jonas 'Sortie' Termansen cd0e402bbb Added {,l,ll,imax}abs(3). 2012-03-27 16:36:55 +02:00
Jonas 'Sortie' Termansen 9ab0bc5474 Added {,p}{read,write}{all,least}(3). 2012-03-24 15:34:30 +01:00
Jonas 'Sortie' Termansen db79994e64 Refactored all the sortix headers into a include directory.
Also got rid of trailing white space. That corrupted .git/.

Big ass-commit because of recovered .git directory.
2012-03-22 00:52:29 +01:00
Jonas 'Sortie' Termansen 8a9a0c58ea Added kernelinfo(2), which reads a kernel information string.
Currently it lets you query the name of the kernel, its version, and the
build timestamp of the kernelinfo.cpp file.
2012-03-07 18:04:59 +01:00
Jonas 'Sortie' Termansen 422d2fd579 Added qsort(3).
This is a rather slow implementation. Will be fixed soon.
2012-03-05 12:37:59 +01:00
Jonas 'Sortie' Termansen be98120b49 Added stubs for setjmp(3) and longjmp(3). 2012-03-04 23:15:32 +01:00
Jonas 'Sortie' Termansen 4804e60a8b Fixed race condition when building libmaxsi with -j.
The headers could end up being made before their dirs were ready.
2012-02-12 13:54:07 +01:00
Jonas 'Sortie' Termansen fec176fa15 Refactored the libmaxsi/ directory.
C and C++ files are now kept together and so are the mxmpp declarations.

Header files are now stored in include/ and mxmpp'd into preproc/.

All other code now -I ../libmaxsi/preproc.

And other stuff to make this happen, including refactoring Makefile.
2012-02-12 13:20:53 +01:00
Jonas 'Sortie' Termansen ed68db03fb Replaced SORTIX_EXTENSIONS macro with _SORTIX_SOURCE macro.
<features.h> declares _SORTIX_SOURCE if no conflicting macros are
declared, such as _GNU_SOURCE.

Fixed g++ automatically declaring _GNU_SOURCE, but Sortix isn't GNU.

Replaced SORTIX_UNIMPLEMENTED macro with __SORTIX_SHOW_UNIMPLEMENTED.
2012-02-11 18:51:55 +01:00