summaryrefslogtreecommitdiff
path: root/libps
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-04-07 19:53:55 +0000
committerMiles Bader <miles@gnu.org>1995-04-07 19:53:55 +0000
commit9324d172e36299308083acd89595f5afbd92bacd (patch)
tree4f91a9f21a55e6d7170438b79ce5105643f19d73 /libps
parent7e4142fb0a375c29aee7224cbccbf734fdefbcd5 (diff)
Tighten up types used (i.e., don't use int for everything).
Diffstat (limited to 'libps')
-rw-r--r--libps/context.c8
-rw-r--r--libps/fmt.c7
-rw-r--r--libps/procstat.c12
-rw-r--r--libps/user.c2
-rw-r--r--libps/write.c10
5 files changed, 20 insertions, 19 deletions
diff --git a/libps/context.c b/libps/context.c
index 6d3c25b4..c7ec87f8 100644
--- a/libps/context.c
+++ b/libps/context.c
@@ -102,7 +102,7 @@ lookup(int id, ihash_t ht, error_t (*create)(int id, void **), void **value)
/* Find a proc_stat_t for the process referred to by PID, and return it in
PS. If an error occurs, it is returned, otherwise 0. */
error_t
-ps_context_find_proc_stat(ps_context_t pc, int pid, proc_stat_t *ps)
+ps_context_find_proc_stat(ps_context_t pc, pid_t pid, proc_stat_t *ps)
{
error_t create(int pid, void **value)
{
@@ -114,7 +114,7 @@ ps_context_find_proc_stat(ps_context_t pc, int pid, proc_stat_t *ps)
/* Find a ps_tty_t for the terminal referred to by the port TTY_PORT, and
return it in TTY. If an error occurs, it is returned, otherwise 0. */
error_t
-ps_context_find_tty(ps_context_t pc, int tty_port, ps_tty_t *tty)
+ps_context_find_tty(ps_context_t pc, mach_port_t tty_port, ps_tty_t *tty)
{
return lookup(tty_port,
pc->ttys,
@@ -126,7 +126,7 @@ ps_context_find_tty(ps_context_t pc, int tty_port, ps_tty_t *tty)
CTTYID_PORT, and return it in TTY. If an error occurs, it is returned,
otherwise 0. */
error_t
-ps_context_find_tty_by_cttyid(ps_context_t pc, int cttyid_port, ps_tty_t *tty)
+ps_context_find_tty_by_cttyid(ps_context_t pc, mach_port_t cttyid_port, ps_tty_t *tty)
{
error_t create(int cttyid_port, void **value)
{
@@ -151,7 +151,7 @@ ps_context_find_tty_by_cttyid(ps_context_t pc, int cttyid_port, ps_tty_t *tty)
/* Find a ps_user_t for the user referred to by UID, and return it in U. */
error_t
-ps_context_find_user(ps_context_t pc, int uid, ps_user_t *u)
+ps_context_find_user(ps_context_t pc, uid_t uid, ps_user_t *u)
{
return lookup(uid,
pc->users,
diff --git a/libps/fmt.c b/libps/fmt.c
index e45509d3..8f3d63ae 100644
--- a/libps/fmt.c
+++ b/libps/fmt.c
@@ -226,7 +226,7 @@ ps_fmt_free(ps_fmt_t fmt)
number number of characters output is added to the integer it points to.
If any fatal error occurs, the error code is returned, otherwise 0. */
error_t
-ps_fmt_write_titles(ps_fmt_t fmt, FILE *stream, int *count)
+ps_fmt_write_titles(ps_fmt_t fmt, FILE *stream, unsigned *count)
{
error_t err = 0;
ps_fmt_field_t field = ps_fmt_fields(fmt);
@@ -262,7 +262,8 @@ ps_fmt_write_titles(ps_fmt_t fmt, FILE *stream, int *count)
number number of characters output is added to the integer it points to.
If any fatal error occurs, the error code is returned, otherwise 0. */
error_t
-ps_fmt_write_proc_stat(ps_fmt_t fmt, proc_stat_t ps, FILE *stream, int *count)
+ps_fmt_write_proc_stat(ps_fmt_t fmt, proc_stat_t ps,
+ FILE *stream, unsigned *count)
{
error_t err = 0;
ps_fmt_field_t field = ps_fmt_fields(fmt);
@@ -309,7 +310,7 @@ ps_fmt_write_proc_stat(ps_fmt_t fmt, proc_stat_t ps, FILE *stream, int *count)
deleted fields at the beginning of the fmt, and those *preceeding* deleted
fields *not* at the beginning. */
void
-ps_fmt_squash(ps_fmt_t fmt, int flags)
+ps_fmt_squash(ps_fmt_t fmt, ps_flags_t flags)
{
int nfields = fmt->num_fields;
ps_fmt_field_t fields = fmt->fields, field = fields;
diff --git a/libps/procstat.c b/libps/procstat.c
index 591be53c..138612a1 100644
--- a/libps/procstat.c
+++ b/libps/procstat.c
@@ -81,11 +81,11 @@ thread_state(thread_basic_info_t bi)
field before using new fields, as something might have failed. Returns
a system error code if a fatal error occurred, or 0 if none. */
error_t
-proc_stat_set_flags(proc_stat_t ps, int flags)
+proc_stat_set_flags(proc_stat_t ps, ps_flags_t flags)
{
error_t err;
- int have = ps->flags; /* flags set in ps */
- int need; /* flags not set in ps, but desired to be */
+ ps_flags_t have = ps->flags; /* flags set in ps */
+ ps_flags_t need; /* flags not set in ps, but desired to be */
process_t server = ps_context_server(ps->context);
if (flags & PSTAT_NO_MSGPORT)
@@ -346,7 +346,7 @@ _proc_stat_free(ps)
CONTEXT. If a memory allocation error occurs, ENOMEM is returned,
otherwise 0. */
error_t
-_proc_stat_create(int pid, ps_context_t context, proc_stat_t *ps)
+_proc_stat_create(pid_t pid, ps_context_t context, proc_stat_t *ps)
{
*ps = NEW(struct proc_stat);
if (*ps == NULL)
@@ -369,12 +369,12 @@ _proc_stat_create(int pid, ps_context_t context, proc_stat_t *ps)
memory allocation error occured, ENOMEM is returned. Otherwise, 0 is
returned. */
error_t
-proc_stat_thread_create(proc_stat_t ps, int index, proc_stat_t *thread_ps)
+proc_stat_thread_create(proc_stat_t ps, unsigned index, proc_stat_t *thread_ps)
{
error_t err = proc_stat_set_flags(ps, PSTAT_THREAD_INFO);
if (err)
return err;
- else if (index < 0 || index >= ps->info->nthreads)
+ else if (index >= ps->info->nthreads)
return EINVAL;
else
{
diff --git a/libps/user.c b/libps/user.c
index b970b89e..2a4f7057 100644
--- a/libps/user.c
+++ b/libps/user.c
@@ -31,7 +31,7 @@
/* Create a ps_user_t for the user referred to by UID, returning it in U.
If a memory allocation error occurs, ENOMEM is returned, otherwise 0. */
error_t
-ps_user_create(int uid, ps_user_t *u)
+ps_user_create(uid_t uid, ps_user_t *u)
{
*u = NEW(struct ps_user);
if (*u == NULL)
diff --git a/libps/write.c b/libps/write.c
index b28ccca6..486352d2 100644
--- a/libps/write.c
+++ b/libps/write.c
@@ -33,7 +33,7 @@
written is added to the integer it points to. If an error occurs, the
error code is returned, otherwise 0. */
error_t
-ps_write_string(char *string, int max_len, FILE *stream, int *count)
+ps_write_string(char *string, int max_len, FILE *stream, unsigned *count)
{
int len = strlen(string);
@@ -56,7 +56,7 @@ ps_write_string(char *string, int max_len, FILE *stream, int *count)
written is added to the integer it points to. If an error occurs, the
error code is returned, otherwise 0. */
error_t
-ps_write_spaces(int num, FILE *stream, int *count)
+ps_write_spaces(int num, FILE *stream, unsigned *count)
{
static char spaces[] = " ";
#define spaces_len (sizeof(spaces) - 1)
@@ -81,7 +81,7 @@ ps_write_spaces(int num, FILE *stream, int *count)
it points to. If an error occurs, the error code is returned, otherwise
0. */
error_t
-ps_write_padding(int sofar, int width, FILE *stream, int *count)
+ps_write_padding(int sofar, int width, FILE *stream, unsigned *count)
{
width = ABS(width);
if (sofar < width)
@@ -96,7 +96,7 @@ ps_write_padding(int sofar, int width, FILE *stream, int *count)
characters written is added to the integer it points to. If an error
occurs, the error code is returned, otherwise 0. */
error_t
-ps_write_field(char *buf, int width, FILE *stream, int *count)
+ps_write_field(char *buf, int width, FILE *stream, unsigned *count)
{
error_t err;
int len = strlen(buf);
@@ -125,7 +125,7 @@ ps_write_field(char *buf, int width, FILE *stream, int *count)
non-NULL, the number of characters written is added to the integer it
points to. If an error occurs, the error code is returned, otherwise 0. */
error_t
-ps_write_int_field(int value, int width, FILE *stream, int *count)
+ps_write_int_field(int value, int width, FILE *stream, unsigned *count)
{
char buf[20];
sprintf(buf, "%d", value);