Commit Graph

63375 Commits

Author SHA1 Message Date
Augustin Cavalier 2532a28785 Avoid using unions for LongDirEntry.
GCC still assumes that the dirent has no data past the end for some
scenarios here and still mis-optimizes things. Therefore, drop the
usages of unions altogether, and instead use a casted character array.

Additionally, use B_FILE_NAME_LENGTH for the array, not B_PATH_NAME_LENGTH,
and make sure to add 1 for the NULL terminator.
2021-11-23 16:36:18 -05:00
Augustin Cavalier 8be37ed439 kernel/smp: Avoid casting spinlocks, which are structures.
The lock entry is the first thing in the struct, so this is a no-op
change, but it is safer to do in case of changes, of course.

Spinlocks have been structures for quite a long time, so this was
probably just missed in the conversion.
2021-11-23 13:52:44 -05:00
Augustin Cavalier ba3ee26af0 WindowInfo: Use char[0] for FLA instead of char[1].
This is a private structure, so despite being an ABI break,
it should not cause any problems.
2021-11-23 13:50:45 -05:00
Augustin Cavalier 3d34a937af Package Kit: Build FetchUtils outside HAIKU_TARGET_PLATFORM_HAIKU. 2021-11-23 13:49:14 -05:00
Augustin Cavalier 1998232e12 libpackage_build: Add FetchUtils.
Change-Id: I2394d35c520c6cdde6e7cb09039d0d8f5689f19f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4731
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-11-23 18:41:20 +00:00
Augustin Cavalier 2be10edfb9 Package Kit: Improvements to partial download handling.
* Move IsDownloadComplete call into DownloadFileRequest; this way
   we will always revalidate checksums even if the file is fully
   downloaded instead of skipping that.

 * Treat ERANGE as a "bad data" error in PackageManager (it usually means
   we have a size mismatch between the local and the server's file)

 * If we fail checksum validation or get ERANGE, and we reused a download,
   immediately try again without reusing the download. This fixes most
   problems that previously required you to delete old transaction
   directories.

Change-Id: Ia3079655691b871e0b206e366b59fca0f832c63d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4730
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-11-23 18:32:28 +00:00
Augustin Cavalier 001e157a7b libroot_build: Add better error checking to _kern_dup.
This way, we will get a more coherent crash instead of
an unceremonious one. Follow-up to #17389.

Change-Id: Iffbf421ce85d638628243d5785ba61ff6b9a8043
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4729
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-11-23 17:24:46 +00:00
Augustin Cavalier 23888052c9 ntfs: Fix off-by-one error in d_name copy.
Should fix incorrect directory contents after the dirent refactor.

Change-Id: Ic2b5024b62c9d9f9485c4695b59d0e971109f09d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4728
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-11-22 21:13:36 +00:00
Rudolf Cornelissen e8e267b4c1 intel_extreme: fix 64-bit build, use 2021-11-22 12:56:07 +00:00
Rudolf Cornelissen efde34c2fc intel_extreme: add haswell/skylake PLL calcs, no functional change yet. 2021-11-22 11:14:36 +00:00
Jérôme Duval 4106e3f146 kernel/x86: rework get_frequency_for
we don't sample if the last sample is too recent and use the cached result.

Change-Id: I17ed29bda7fe7276f1a4148b3e1985c9d32ae032
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4101
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-11-22 07:21:04 +00:00
Jérôme Duval 7c2c355f17 kernel: add frequency in cpu_info
use this in sysinfo.

Change-Id: I270ef1ab18c27c4804cb0cca2cb5088a17162636
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3214
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-11-22 07:20:25 +00:00
David Karoly f265ecf8f7 Update gcc_bootstrap package for ARM
Change-Id: Iadef37c218f46b1f809a7c6405ebfc6a73cda20b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4726
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-11-20 12:59:28 +00:00
Rudolf Cornelissen 18bb9a28a6 intel_extreme: testing skylake mobile ticket #15516 2021-11-20 14:31:07 +00:00
Augustin Cavalier 10e35b7aae RTFTranslator: Free run_array using FreeRunArray.
This is more correct.
2021-11-19 19:38:11 -05:00
Augustin Cavalier 1cb5cfb244 libroot_build: Use a union for dirent structures.
Same fixe as applied to the rest of the Storage Kit a few commits ago.
2021-11-18 16:43:57 -05:00
Augustin Cavalier d9df256704 FUSEVolume: Add a ROUNDUP() macro and use it.
No functional change intended, but this should make the code
easier to read.
2021-11-18 16:35:31 -05:00
Augustin Cavalier afcfd3c5d5 BeBuild: Remove B_ALWAYS_INLINE.
This file should ideally contain only those things needed
across all system headers, even POSIX ones, and all other
declarations (B_* ones especially) should go in SupportDefs.h.
However, as nothing but riscv64 uses this right now, I've just
moved it to there.
2021-11-18 16:35:05 -05:00
Augustin Cavalier 7db2616c44 dirent: Use an actual flexible-length array for d_name.
GCC 11 treats [1] as a fixed-length array and not a flexible-length
array, and so some things that used direct strcmp("..", ent->d_name),
for instance, would be optimized out as being always unequal,
which was the cause of #17389. Using a real FLA informs GCC that
there is going to be more than one byte of data, and thus this
fixes that bug.

BeOS used [1] and not [0], possibly because it had to deal with
compilers (MetroWerks? Early GCC2?) that did not support FLAs.
GCC 2.95 does, using [0], and GCC 4 does, using [], so we can go
with that here.

(I did try using [0] for both, which seems to be OK with GCC 11,
but GCC 8 throws errors when d_name is dereferenced directly
as being-out-of-bounds. So, we have to use the #if here and give
newer GCC the [] syntax and not [0] to avoid that problem.)

The real question probably is whether or not we should backport
some variant of these changes to R1/beta3, as software at HaikuPorts
very well may run in to the same issue. (The alternative workaround
is to compile with -O1 and not -O2 for any affected software.) But
maybe this is an argument for keeping with the beta4 schedule of
this coming January...
2021-11-18 16:34:03 -05:00
Augustin Cavalier 9d242fb955 file_systems & Tracker: Do not assume sizeof(dirent) contains 1 byte for the name.
At present, it does, but that is an oddity we have preserved from BeOS
that the next commit is going to remove. (This commit thus wastes 1 byte
without the following one.)

Most changes are pretty straightforward: only a +1 is needed,
and a few removed from sizing calculations. Some filesystems like UDF
originally passed back the length with the \0 included, so they have
been adjusted further. UFS2 had some other sizing problems which are also
corrected in this commit.
2021-11-18 16:24:04 -05:00
Augustin Cavalier 8f03af00f8 Storage: Rework LongDirEntry to be a union.
Our dirent structure is "slim": it has a flexible-length array at the
end which must be allocated to whatever size the consumer wants. However,
we use [1] there and not [0] or [], which meant GCC thought it was not
a flexible-length array, and so it optimized various string accesses
that it assumed must be always false. Among these was BDirectory's
check for "." and "..", and so that resulted in infinite loops.

When changing our dirent structure to a proper FLA instead of [1],
GCC then throws errors on LongDirEntry as it has data "after" the
FLA; which is what we want, but there is no way to tell GCC that.
So now we use a union instead, which is the proper way to statically
allocate a FLA.

This is part of #17389, but the real fix requires changing our dirent
structure, which is coming in a separate commit.
2021-11-18 16:00:23 -05:00
Augustin Cavalier 9cc1718212 libbe_build: Fix build on non-Haiku platforms.
Probably should have tested that before pushing.
2021-11-18 15:42:17 -05:00
Augustin Cavalier ec21dc91b1 libbe_build: Synchronize Directory.cpp with the main one.
The set_dir_fd code appears to be libbe_build specific, so that
and accompanying logic is preserved.
2021-11-18 12:13:47 -05:00
Augustin Cavalier 28c8a16a5a libbe_build: Synchronize Node.cpp with the main one.
Mostly formatting changes with a few minor bugfixes it appears.
2021-11-18 11:18:49 -05:00
Augustin Cavalier a7639d2389 libroot_debug: Add aligned_alloc implementation.
Fixes #17407.
2021-11-18 11:14:53 -05:00
Augustin Cavalier cf5edc8448 accelerants: Add default case for xy_command initialization.
Silences a GCC 11 warning.
2021-11-17 21:10:30 -05:00
Augustin Cavalier 52f87edca5 Time: operator() on the comparator structure must be const.
The STL seems to require it, but before GCC 11 that may not
have been properly enforced.
2021-11-17 21:10:05 -05:00
Augustin Cavalier 91a0b53040 HaikuDepot: Do not inadvertently modify the real errno.
Found by GCC 11 warnings.
2021-11-17 21:09:31 -05:00
Augustin Cavalier eeddcfffbe accelerants: Fix mismatched prototypes.
Found by GCC 11.
2021-11-17 21:09:10 -05:00
Augustin Cavalier f35fc7ebda Remove some dynamic exception specifiers.
GCC 11 does not like them, and GCC 2 does not seem to care.
2021-11-17 21:08:49 -05:00
Augustin Cavalier e4f18add74 Game & Print Kits: Fix GCC 11 warnings. 2021-11-17 18:45:58 -05:00
Augustin Cavalier f7338bb6a0 Media Kit: Fix/appease various GCC 11 warnings. 2021-11-17 18:45:35 -05:00
Augustin Cavalier 181529ce0c bsd/err.c: Upgrade to a newer version from FreeBSD.
* 3-clause BSD instead of 4-clause BSD
 * C89 compliance instead of K&R C, needed for GCC 11
2021-11-17 14:01:20 -05:00
Augustin Cavalier afc04c50e5 kernel/debug: Add initialization to appease -Wmaybe-uninitialized. 2021-11-17 14:00:48 -05:00
Augustin Cavalier 44e3766be5 app_server: Add casts to appease GCC 11 -Wclass-memaccess. 2021-11-17 14:00:10 -05:00
Augustin Cavalier 46c49135a0 kernel: Add aligned_alloc implementation.
Needed by default with GCC 11.
2021-11-17 13:58:43 -05:00
Augustin Cavalier 7ec1bedeed features.h: Define _DEFAULT_SOURCE when _GNU_SOURCE is defined.
As suggested by PulkoMandy. This was done before my commits yesterday,
but those just reverted patches that had only been in since May,
so it's not clear how much this is actually needed. Nonetheless
it seems like the more correct thing to do.
2021-11-17 13:55:50 -05:00
Augustin Cavalier 573b7b1f21 ArchitectureRules: Temporarily disable -Wno-error that GCC 8 does not like. 2021-11-16 22:48:40 -05:00
Augustin Cavalier e7952d44d5 BColumnListView: Add initializations to silence -Wmaybe-uninitialized. 2021-11-16 19:05:52 -05:00
Augustin Cavalier d1035d48e6 ColorConversion: Add cast to silence -Wclass-memaccess. 2021-11-16 19:05:14 -05:00
Augustin Cavalier 1e541d3127 stdlib.h: Remove guards around aligned_alloc.
While FreeBSD and glibc feature-guard it, they also feature-guard
a lot of other things that we don't, and musl does not guard it,
so it seems more than safe enough to leave it unguarded.

Fixes compilation errors with GCC 11. (The other possible solution
was including features.h in more places, but this seems simpler.)
2021-11-16 15:13:29 -05:00
Augustin Cavalier 3bdd837e4e BeBuild: Expand compatibility to GCC 12.
Since we are currently in the process of upgrading to GCC 11, it makes
sense to change this header before we actually need to.
2021-11-16 15:12:58 -05:00
Augustin Cavalier 68a13ed5c3 features.h: Clean up ISOC11 definitions.
* Do not define it merely when _GNU_SOURCE is defined, that is not needed.
 * Scale back __cplusplus check to 201103L, just like the BSDs do.
2021-11-16 15:11:44 -05:00
Augustin Cavalier 38dc3bf2c5 ArchitectureRules: Add two new -Wno-error flags.
The use of the "register" keyword is harmless, though we should eventually
remove it.

Taking addresses of packed members is "mostly harmless" on x86 where
unaligned accesses are OK. It's less harmless on other architectures,
but we sometimes use packed structures when manually aligning things.
Unfortunately GCC throws this warning even when the actual pointer would
be aligned, not merely when it's unaligned, making the warning far too
noisy and not really that useful.

"Found" by GCC 11.
2021-11-16 15:10:05 -05:00
Rudolf Cornelissen ae7d733d42 intel_extreme: skylake/DDI. all displays can set resolution now, no refresh on digital panels yet (DPLL still missing) 2021-11-16 00:39:49 +00:00
Augustin Cavalier f11e13144d ntfs: Set abs_mnt_point to a non-NULL string.
It seems lowntfs and libntfs-3g kind of assume there is something in here.
This may result in broken links, but that's better than crashing.

Should fix #17400.
2021-11-14 19:13:42 -05:00
Rudolf Cornelissen 0eb2bf0e66 intel_extreme: skylake/DDI improvements. no resolution changing possible yet (missing DPLL code yet) 2021-11-14 23:16:44 +00:00
Augustin Cavalier a82616528d ntfs: Return better errors and handle volumes without names.
Should fix #17390.

Change-Id: I8db797b29c70b452e98ebadc6825dba7626ad2ab
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4724
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-11-13 17:29:23 +00:00
Adrien Destugues d4e4909c6a Jamfile engine: move to a separate repository
It is now at https://review.haiku-os.org/admin/repos/jamfile-engine

This was added in the Haiku repository in the intent of adding it to
release images, a long time ago. Now with the packaging system in place,
there is no reason to host it in the main repo anymore (and it was never
actually packaged anyway).

I also added a recipe at haikuports for it.

Fixes #5360.

Change-Id: I4f2a1529cbadf7af8a16025c30a1332108475807
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4720
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-11-11 14:18:04 +00:00
Jérôme Duval cdd2ed5a77 kernel/x86: CPUID leaf 0x1f is a preferred superset to leaf 0x0b
Intel recommends first checking for the existence of CPUID leaf 1FH before using leaf 0BH.

Change-Id: Iba677186521e086fa06bcc4fe42eaed4ba030e6d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4719
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-11-11 07:53:23 +00:00