473,396 Members | 2,151 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

need to be enlightened on pid_t

I know size_t (used for size of objects) is a 32-bit value on a 32-bit
system and 64-bit on a 64 bit system. This is explained on Page 29 of
Unix Network Programming: The Sockets Networking API. Can someone
please explain to me the reasoning behind pid_t?
Nov 14 '05 #1
4 3791
On 2 Oct 2004 19:15:52 -0700, cd*****@yahoo.com (Grocery Clerk) wrote
in comp.lang.c:
I know size_t (used for size of objects) is a 32-bit value on a 32-bit
system and 64-bit on a 64 bit system.
That may be true on some particular implementations that interest you,
but no such guarantee or requirement exists in the C language. size_t
is a typedef for an unsigned integer type, and C specifies that it is
large enough to hold the size of any object in bytes.
This is explained on Page 29 of
Unix Network Programming: The Sockets Networking API. Can someone
please explain to me the reasoning behind pid_t?


Nobody here can, because there is no 'pid_t' type defined by the
standard C language. If this is some extension provided on UNIX, you
need to ask about it in news:comp.unix.programmer.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #2

"Grocery Clerk" <cd*****@yahoo.com> wrote

I know size_t (used for size of objects) is a 32-bit value on a 32-bit
system and 64-bit on a 64 bit system. This is explained on Page 29 of
Unix Network Programming: The Sockets Networking API. Can someone
please explain to me the reasoning behind pid_t?

A size_t is the type yielded by the sizeof() operator, and also some
functions such as strlen(). This means that it must be big enough to hold
the largest object that the compiler can deal with. Normally this means that
it will be the same size as the address space of the processor, however
there is no guarantee (for instance an implementation might choose to
restrict objects to 64K for efficiency reasons on some architectures).

A pid_t is a separate type not in the C standard but defined by your Unix
library. It will hold something that is not a basic type (a number or
character on which it makes sense to do calculations), and not a memory size
either. The two reasons for defining a type are to make this clear, so that
all programmers know that variable x is a p_id and not just an arbitrary
integer, and so that the underlying system can be changed wthout breaking
underlying code, for instance we could move to a system where p_ids are
pointers rather than integer handles in the next release.
Nov 14 '05 #3
"Malcolm" <ma*****@55bank.freeserve.co.uk> writes:
[...]
A pid_t is a separate type not in the C standard but defined by your Unix
library. It will hold something that is not a basic type (a number or
character on which it makes sense to do calculations), and not a memory size
either. The two reasons for defining a type are to make this clear, so that
all programmers know that variable x is a p_id and not just an arbitrary
integer, and so that the underlying system can be changed wthout breaking
underlying code, for instance we could move to a system where p_ids are
pointers rather than integer handles in the next release.


<OT>
As it happens, POSIX requires pid_t to be a signed integer type.
</OT>

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #4
On Sat, 2004-10-02 at 19:15 -0700, Grocery Clerk wrote:
I know size_t (used for size of objects) is a 32-bit value on a 32-bit
system and 64-bit on a 64 bit system. This is explained on Page 29 of
Unix Network Programming: The Sockets Networking API. Can someone
please explain to me the reasoning behind pid_t?


This isn't C, of course, but POSIX, so it's really off-topic here.

The thing is that POSIX likes to define a lot of typedefs to hold
datatypes that are supposed to be opaque to the programmer, like pid_t,
uid_t, gid_t, regex_t, socklen_t. These types, while usually defined as
different primitive integer types, are meant to be opaque, and thus only
certain operations are defined to work on them -- Usually things like
comparing to zero of below zero. The programmer may not assume anything
about their size either (except that returned by sizeof). That way,
implementors can deal with it in different ways while not breaking
programs that are compliant with the specified guidelines. For example,
32-bit Solaris may define a socklen_t to be 32 bits, while 64-bit
Solaris may define it to be 64 bits. Furthermore, some systems may have
16-bit UIDs, others 32-bit UIDs, and so on. Some may not even implement
it as integers, although that's probably rare, if it exists at all.

Fredrik Tolf
Nov 14 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Glenn Hagele - Council for Refractive Surgery Qual | last post by:
I am a novice to java, but see how useful it can be. I need a software that would assist me in creating multi-layered menus without needing to write a lot of code. I have tried AllWebMenus and...
1
by: news.tdl.com | last post by:
Im passing values between SELECT boxs. Once submitted I want to pass the value to the opening page. It works ok but I only get a single value (last one) , I need them all. How can I do this.????...
5
by: Glenn | last post by:
Need text/javascript 98se - Netscape - Navigator 3.04 I go online to a site and window pop up - download - text/javascript ?????? Netscape - not responding on net ???? I can still access the...
11
by: Laiverd.COM | last post by:
Hi, In the following function I keep getting a 'Object expected at line 75 char 5' but for the life of me I cannot find the error. Maybe someone would be so kin to have a look? I indicated the...
9
by: CW | last post by:
I wrote an HTML based chat application. The front end is built entirely on HTML + javascript. Essentially, I have a hidden frame that's refreshed frequently and any new messages are displayed in...
4
by: nsr93 | last post by:
I am not sure if this was the proper group to post this, but here is my question: I am a Java consultant. I have new client I am working for to make a web based application similar to an...
7
by: Tasha's Dad | last post by:
A description of the problem: 1) Go to a page with various settings and a timeout (forces re-login if over 10 minutes) 2) Before the timeout, make some changes to settings. 3) Press a "reset to...
12
by: puzzlecracker | last post by:
let's say have a string: string str="arg1 arg2 arg3"; I need to convert it to char **s where s={arg1, arg2,arg3, NULL}; has anyone encountered this problem and has fast solution? Thanks
5
by: Jon Bowlas | last post by:
Hi listers, I wrote this script in Zope some time ago and it worked for a while, but now I'm getting the following error: TypeError: coercing to Unicode: need string or buffer, NoneType found ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.