hrevr1alpha4-44680 adds 3 changesets to branch 'r1alpha4' old head: af0e489733ad428b87a83199d460d176bdb29724 new head: 7790759b15897a342232fbb62490776f7f90156e ---------------------------------------------------------------------------- 876a418: vm_page_allocate_page_run: fix for aligned page allocations * don't enforce a zero boundary or a zero alignment * when going to the next range, takes alignment into account. It could previously just be enforced again through alignment and loop infinite. * it should help with some FreeBSD based drivers [ JÃrÃme Duval <jerome.duval@xxxxxxxxx> ] 7a4969d: listsem didn't actually support the -s option its help listed. Minor cleanups. [ Rene Gollent <anevilyak@xxxxxxxxx> ] 7790759: Fix gcc2 build along with some (minor) style issues [ John Scipione <jscipione@xxxxxxxxx> ] ---------------------------------------------------------------------------- 2 files changed, 65 insertions(+), 29 deletions(-) src/bin/listsem.c | 83 +++++++++++++++++++++++++----------- src/system/kernel/vm/vm_page.cpp | 11 +++-- ############################################################################ Commit: 876a418254ee612ebfd865599a632050cb74e0a0 URL: http://cgit.haiku-os.org/haiku/commit/?id=876a418 Author: JÃrÃme Duval <jerome.duval@xxxxxxxxx> Date: Mon Nov 5 23:29:57 2012 UTC Committer: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> Commit-Date: Tue Nov 6 14:00:21 2012 UTC vm_page_allocate_page_run: fix for aligned page allocations * don't enforce a zero boundary or a zero alignment * when going to the next range, takes alignment into account. It could previously just be enforced again through alignment and loop infinite. * it should help with some FreeBSD based drivers ---------------------------------------------------------------------------- diff --git a/src/system/kernel/vm/vm_page.cpp b/src/system/kernel/vm/vm_page.cpp index 9e4c591..29df4e1 100644 --- a/src/system/kernel/vm/vm_page.cpp +++ b/src/system/kernel/vm/vm_page.cpp @@ -3862,13 +3862,13 @@ vm_page_allocate_page_run(uint32 flags, page_num_t length, page_num_t offsetStart = start + sPhysicalPageOffset; // enforce alignment - if ((offsetStart & alignmentMask) != 0) { + if (alignmentMask != 0 && (offsetStart & alignmentMask) != 0) { offsetStart = ((offsetStart + alignmentMask) & ~alignmentMask) - sPhysicalPageOffset; } // enforce boundary - if (offsetStart << boundaryShift + if (boundaryShift != 0 && offsetStart << boundaryShift != (offsetStart + length - 1) << boundaryShift) { offsetStart = (offsetStart + length - 1) << boundaryShift >> boundaryShift; @@ -3887,7 +3887,10 @@ vm_page_allocate_page_run(uint32 flags, page_num_t length, } dprintf("vm_page_allocate_page_run(): Failed to allocate run of " - "length %" B_PRIuPHYSADDR " in second iteration!", length); + "length %" B_PRIuPHYSADDR " (%" B_PRIuPHYSADDR " %" + B_PRIuPHYSADDR ") in second iteration (align: %" B_PRIuPHYSADDR + " boundary: %" B_PRIuPHYSADDR ") !", length, requestedStart, + end, restrictions->alignment, restrictions->boundary); freeClearQueueLocker.Unlock(); vm_page_unreserve_pages(&reservation); @@ -3916,7 +3919,7 @@ vm_page_allocate_page_run(uint32 flags, page_num_t length, freeClearQueueLocker.Lock(); } - start += i + 1; + start += max_c(i, alignmentMask) + 1; } } ############################################################################ Commit: 7a4969d017da37de4b1ff170a2bbba1e99d9885c URL: http://cgit.haiku-os.org/haiku/commit/?id=7a4969d Author: Rene Gollent <anevilyak@xxxxxxxxx> Date: Tue Nov 6 00:03:49 2012 UTC Committer: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> Commit-Date: Tue Nov 6 14:02:32 2012 UTC listsem didn't actually support the -s option its help listed. Minor cleanups. ---------------------------------------------------------------------------- diff --git a/src/bin/listsem.c b/src/bin/listsem.c index 6fdb102..8440eb3 100644 --- a/src/bin/listsem.c +++ b/src/bin/listsem.c @@ -1,14 +1,14 @@ /* * listsem.c * - * Lists all semaphores in all Teams. + * Lists all semaphores in all Teams. * by O.Siebenmarck. - * + * * 04-27-2002 - mmu_man * added command line args - * - * Legal stuff follows: - + * + * Legal stuff follows: + Copyright (c) 2002 Oliver Siebenmarck <olli@xxxxxxxxx>, OpenBeOS project Permission is hereby granted, free of charge, to any person obtaining a copy of @@ -33,29 +33,44 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <OS.h> + +static void print_sem_info(sem_info *info) +{ + printf("%7ld%31s%7ld\n", info->sem ,info->name , info->count); +} + + +static void print_header(team_info *tinfo) +{ + if (tinfo != NULL) + printf("TEAM %ld (%s):\n", tinfo->team, tinfo->args ); + + printf(" ID name count\n"); + printf("---------------------------------------------\n"); +} + + static void list_sems(team_info *tinfo) { sem_info info; int32 cookie = 0; - printf("TEAM %ld (%s):\n", tinfo->team, tinfo->args ); - printf(" ID name count\n"); - printf("---------------------------------------------\n"); - + print_header(tinfo); + while (get_next_sem_info(tinfo->team, &cookie, &info) == B_OK) - { - printf("%7ld%31s%7ld\n", info.sem ,info.name , info.count ); - } + print_sem_info(&info); + printf("\n"); } int main(int argc, char **argv) { team_info tinfo; - int32 cook = 0; - int i; + int32 cookie = 0; + int32 i; system_info sysinfo; // show up some stats first... @@ -63,12 +78,12 @@ int main(int argc, char **argv) printf("sem: total: %5li, used: %5li, left: %5li\n\n", sysinfo.max_sems, sysinfo.used_sems, sysinfo.max_sems - sysinfo.used_sems); if (argc == 1) { - while (get_next_team_info( &cook, &tinfo) == B_OK) - { + while (get_next_team_info( &cookie, &tinfo) == B_OK) list_sems(&tinfo); - } + return 0; } + for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) { fprintf(stderr, "Usage: %s [-s semid] [teamid]\n", argv[0]); @@ -78,15 +93,31 @@ int main(int argc, char **argv) fputs(" The -s option displays the sem_info data for a\n", stderr); fputs(" specified semaphore.\n", stderr); return 0; + } else if (!strcmp(argv[i], "-s")) { + if (argc < i + 2) + printf("-s used without associated sem id\n"); + else { + sem_id sem = atoi(argv[i+1]); + + } + int semID = atoi(argv[i+1]); + sem_info info; + if (get_sem_info(semID, &info) == B_OK) { + print_header(NULL); + print_sem_info(&info); + } else + printf("semaphore %ld unknown\n\n", semID); + i++; } else { - int t; - t = atoi(argv[i]); - if (get_team_info(t, &tinfo) == B_OK) + team_id team; + team = atoi(argv[i]); + if (get_team_info(team, &tinfo) == B_OK) list_sems(&tinfo); else - printf("team %i unknown\n\n", t); + printf("team %ld unknown\n\n", team); } } + return 0; } ############################################################################ Revision: hrevr1alpha4-44680 Commit: 7790759b15897a342232fbb62490776f7f90156e URL: http://cgit.haiku-os.org/haiku/commit/?id=7790759 Author: John Scipione <jscipione@xxxxxxxxx> Date: Tue Nov 6 05:45:53 2012 UTC Committer: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> Commit-Date: Tue Nov 6 14:02:49 2012 UTC Fix gcc2 build along with some (minor) style issues ---------------------------------------------------------------------------- diff --git a/src/bin/listsem.c b/src/bin/listsem.c index 8440eb3..d066fcb 100644 --- a/src/bin/listsem.c +++ b/src/bin/listsem.c @@ -85,29 +85,31 @@ int main(int argc, char **argv) } for (i = 1; i < argc; i++) { - if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) { + if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0) { fprintf(stderr, "Usage: %s [-s semid] [teamid]\n", argv[0]); - fputs(" List the semaphores allocated by the specified\n", stderr); - fputs(" team, or all teams if none is specified.\n", stderr); + fputs(" List the semaphores allocated by the specified\n", + stderr); + fputs(" team, or all teams if none is specified.\n", + stderr); fputs("\n", stderr); - fputs(" The -s option displays the sem_info data for a\n", stderr); + fputs(" The -s option displays the sem_info data for a\n", + stderr); fputs(" specified semaphore.\n", stderr); return 0; - } else if (!strcmp(argv[i], "-s")) { + } else if (strcmp(argv[i], "-s") == 0) { if (argc < i + 2) printf("-s used without associated sem id\n"); else { - sem_id sem = atoi(argv[i+1]); - + sem_id id = atoi(argv[i + 1]); + sem_info info; + if (get_sem_info(id, &info) == B_OK) { + print_header(NULL); + print_sem_info(&info); + } else + printf("semaphore %ld unknown\n\n", id); + + i++; } - int semID = atoi(argv[i+1]); - sem_info info; - if (get_sem_info(semID, &info) == B_OK) { - print_header(NULL); - print_sem_info(&info); - } else - printf("semaphore %ld unknown\n\n", semID); - i++; } else { team_id team; team = atoi(argv[i]);