[an error occurred while processing this directive]

HP OpenVMS Systems

ask the wizard
Content starts here

C programming information on OpenVMS?

» close window

The Question is:

 
Im compiling a C routine on a vax. In you r documnetation, a routine getppid
 exists which returns a type 'pid_t' defined in header file 'unistd.h'.
 
I cannot find in the docs anywhere where it defines what pid_t is and I cannot
 find the location of the header files.
 
question 1: where in the docs are all the types defined.
 
question 2: where are header files located on a standard vax, what is the
 logical pointing to the header files location?
 


The Answer is :

 
  The C documentation is available at the Compaq OpenVMS website, the URL
  for the language documentation is included in the OpenVMS FAQ.  Additional
  information on C programming and particularly on some common C programming
  mistakes is included (no pun intended) in the OpenVMS FAQ.
 
  Information on the location of and the specification of and the processing
  of the C header files is included in the Compaq C User's Guide, in the
  section of the "Preprocessor Directives" chapter entitled "File Inclusion
  (#include)".
 
  Also, from the C installation procedure: "The C Runtime Library headers
  and Starlet headers are installed as a Text Library (.TLB).  The
  traditional text form  of the headers (.H files) are also provided for
  reference purposes only) in the directories:
 
             SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF] and
             SYS$COMMON:[DECC$LIB.REFERENCE.SYS$STARLET_C].
 
  "Please note that the compiler does not search the reference areas
 
             SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF] and
             SYS$COMMON:[DECC$LIB.REFERENCE.SYS$STARLET_C]
 
  during compilation.  Instead headers are taken from the text library."
 
  The following is from the C on-line help text:
 
CC
 
  Run-time_functions
 
    getppid
 
       Returns the parent process ID of the calling process.
 
       Syntax:
 
            #include <unistd.h>
 
            pid_t getppid (void);
 
 
$ cc/vers
Compaq C V6.4-004 on OpenVMS Alpha V7.2-1
$ type x.c
#include <unistd.h>
#include <stdio.h>
main()
  {
  pid_t pid = getpid();  /* this example uses getpid, not getppid */
  printf("0x0%08.8x\n", pid );
  return 1;
  }
$ cc x
$ link x
$ run x
0x0000008cb
$ show process
 
 ... Process ID:   000008CB ...
 
$ search sys$sysroot:[decc$lib...]unistd.h pid_t
 
******************************
SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]UNISTD.H;1
 
#   ifndef __PID_T
#      define __PID_T 1
       typedef __pid_t pid_t;
__pid_t getpid  (void);
__pid_t getppid (void);
       __pid_t getpgid (__pid_t);
       __pid_t getpgrp (void);
       __pid_t getsid (__pid_t);
       int setpgid (__pid_t, __pid_t);
       __pid_t setpgrp (void);
       __pid_t setsid (void);
           __pid_t vfork(void);
 

answer written or last revised on ( 1-FEB-2001 )

» close window