Skip to content

Commit

Permalink
Update man page, remove unnecessary kernel message
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaerr committed Sep 17, 2024
1 parent 1d05b2f commit e1e7acd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
8 changes: 3 additions & 5 deletions elks/arch/i86/mm/malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ static segment_s * seg_split (segment_s * s1, segext_t size0)

// TODO: use pool_alloc
segment_s * s2 = (segment_s *) heap_alloc (sizeof (segment_s), HEAP_TAG_SEG);
if (!s2) {
printk ("seg:cannot split:heap full\n");
return 0;
}
if (!s2)
return 0; // heap_alloc gives heap full message

s2->base = s1->base + size0;
s2->size = size2;
Expand Down Expand Up @@ -323,7 +321,7 @@ void INITPROC seg_add(seg_t start, seg_t end)
seg->ref_count = 0;
seg->pid = 0;

list_insert_before (&_seg_all, &(seg->all)); // add tail
list_insert_before (&_seg_all, &(seg->all)); // add tail
list_insert_before (&_seg_free, &(seg->free)); // add tail
}
}
Expand Down
15 changes: 12 additions & 3 deletions elkscmd/man/man1/meminfo.1
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@ meminfo \- list system memory usage
.SH SYNOPSIS
.B meminfo
.RB [ \-a ]
.RB [ \-m ]
.RB [ \-f ]
.RB [ \-t ]
.RB [ \-b ]
.RB [ \-s ]
.RB [ \-h ]
.br
.SS OPTIONS
Defaults to showing all memory.
Defaults to showing all memory (equivalent to -aftbs).
.TP 5
.B -a
Show application memory
Show memory in use by applications
.TP 5
.B -m
Show main memory sorted by segment
.TP 5
.B -f
Show free memory
Expand All @@ -24,7 +30,10 @@ Show tty and driver memory
Show system buffer and pipe memory
.TP 5
.B -s
Show system task, inode and file memory.
Show system task, inode and file memory
.TP 5
.B -h
Show help
.SH DESCRIPTION
.B meminfo
traverses the kernel local heap and displays a line for each in-use or free entry.
Expand Down
10 changes: 5 additions & 5 deletions elkscmd/sys_utils/meminfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void dump_heap(int fd)

void usage(void)
{
printf("usage: meminfo [-maftbsh]\n");
printf("usage: meminfo [-amftbsh]\n");
}

int main(int argc, char **argv)
Expand All @@ -201,11 +201,14 @@ int main(int argc, char **argv)

if (argc < 2)
allflag = 1;
else while ((c = getopt(argc, argv, "aftbsmh")) != -1) {
else while ((c = getopt(argc, argv, "amftbsh")) != -1) {
switch (c) {
case 'a':
aflag = 1;
break;
case 'm':
mflag = 1;
break;
case 'f':
fflag = 1;
break;
Expand All @@ -218,9 +221,6 @@ int main(int argc, char **argv)
case 's':
sflag = 1;
break;
case 'm':
mflag = 1;
break;
case 'h':
usage();
return 0;
Expand Down

0 comments on commit e1e7acd

Please sign in to comment.