12SYSTEM AND PROCESS INFORMATION

In this chapter, we look at ways of accessing a variety of system and process information. The primary focus of the chapter is a discussion of the /proc file system. We also describe the uname() system call, which is used to retrieve various system identifiers.

12.1 The /proc File System

In older UNIX implementations, there was typically no easy way to introspectively analyze (or change) attributes of the kernel, to answer questions such as the following:

• How many processes are running on the system and who owns them?

• What files does a process have open?

• What files are currently locked, and which processes hold the locks?

• What sockets are being used on the system?

Some older UNIX implementations solved ...

Get The Linux Programming Interface now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.