1 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
3 // Copyright (c) 2001-2003, OpenBeOS
5 // This software is part of the OpenBeOS distribution and is covered
10 // Author: Daniel Reinhold (danielre@users.sf.net)
11 // Description: lists all open ports in the system, organized by team
13 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
20 void list_team_ports (team_id id
);
21 void show_port_totals (void);
26 main(int argc
, char **argv
)
35 while (get_next_team_info(&cookie
, &info
) >= B_OK
)
36 list_team_ports(info
.team
);
39 // list for each team_id on the command line
41 list_team_ports(atoi(*++argv
));
50 int32 max
= 0, used
= 0, left
;
53 if (get_system_info(&sys
) == B_OK
) {
55 used
= sys
.used_ports
;
60 printf("port: total: %5ld, used: %5ld, left: %5ld\n", max
, used
, left
);
65 list_team_ports(team_id id
)
71 if (get_team_info(id
, &this_team
) == B_BAD_TEAM_ID
) {
72 printf("\nteam %ld unknown\n", id
);
76 printf("\nTEAM %4ld (%s):\n", id
, this_team
.args
);
77 printf(" ID name capacity queued\n");
78 printf("----------------------------------------------------\n");
80 while (get_next_port_info(id
, &cookie
, &this_port
) == B_OK
) {
81 printf("%5ld %28s %8ld %6ld\n",
85 this_port
.queue_count
);