Re: cast pid_t to int when using *printf - Mailing list pgsql-patches

From Oliver Jowett
Subject Re: cast pid_t to int when using *printf
Date
Msg-id 416799F7.6020500@opencloud.com
Whole thread Raw
In response to Re: cast pid_t to int when using *printf  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
Bruce Momjian wrote:

> I see in include/sys/types.h on Solaris 9:
>
>     #if defined(_LP64) || defined(_I32LPx)
>     typedef uint_t nlink_t;                 /* file link type       */
>     typedef int     pid_t;                  /* process id type      */
>     #else
>     typedef ulong_t nlink_t;                /* (historical version) */
>     typedef long    pid_t;                  /* (historical version) */
>     #endif

> I am confused why you are seeing long for pid_t?  What is your Solaris
> system information?  If Solaris needs adjustments, there are a lot of
> place we print getpid().

This is also what is on the Solaris system I was using. gcc -E showed
that the #else branch was being taken. The #if branch is taken when
compiling in 64-bit mode (gcc -m64).

We're fine so long as everything casts to either int or long. I only saw
warnings from a couple of places that did not do a cast at all.

-O

pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: cast pid_t to int when using *printf
Next
From: Devrim GUNDUZ
Date:
Subject: (Turkish) New translation: pg_resetxlog, Updated translation: pg_ctl