Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > G


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


getsid() — get session ID


#include <sys/types.h>

pid_t getsid (pid_t pid);


The getsid() function returns the session ID of the specified process. If pid is 0, the call applies to the current process. For this to be allowed, the current process and the referenced process must be in the same session.

Security Restrictions

The actions associated with this system call are subject to compartmental restrictions. See compartments(5) for more information about compartmentalization on systems that support that feature.

Compartmental restrictions can be overridden if the process possesses the COMMALLOWED privilege (PRIV_COMMALLOWED). Processes owned by the superuser may not have this privilege. Processes owned by any user may have this privilege, depending on system configuration.

See privileges(5) for more information about privileged access on systems that support fine-grained privileges.


Upon successful completion, getsid() returns the session ID of the specified process. Otherwise, it returns a value of -l and sets errno to indicate the error.


If the getsid() function fails, it sets errno (see errno(2)) to one of the following values:


The current process and the specified process are not in the same session.


No process can be found corresponding to that specified by pid.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.