Bug 51811 - compiler can't find ptsname function
compiler can't find ptsname function
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
i386 Linux
high Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2001-08-15 10:28 EDT by Keith Ansell
Modified: 2007-03-26 23:48 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-08-22 10:51:49 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Keith Ansell 2001-08-15 10:28:06 EDT
Description of Problem:
gcc 2.96 shipped with RedHat 7.1 does not recognize the "ptsname" function that worked OK on RedHat 7.0 & 6.2.

Version-Release number of selected component (if applicable):
gcc 2.96 on RedHat 7.1

How Reproducible:
Every time with sample program below.

Steps to Reproduce:
1. Compile the program called "t" with "g++ -w -O0 t.C -o $1 -ldl -lcrypt -lcurses"

Actual Results:
t.C: In function `int main ()':
t.C:10: `ptsname' undeclared (first use this function)
t.C:10: (Each undeclared identifier is reported only once for each
function it appears in.)  

Expected Results:

Additional Information:

Sample program "t":
#include <stdio.h>
#include <string.h>
#include <iostream.h>
#include <stdlib.h>

int main (void) {
   char *SlaveDevice;
   int MasterPseudoFid = 0;
   cerr << "Hello - World " << endl;
   SlaveDevice = (char *)ptsname(MasterPseudoFid);
   return 0;
Comment 1 Jakub Jelinek 2001-08-17 09:50:15 EDT
You get ptsname prototype only if you request some standard which has this
function. Particularly, you can use -D_XOPEN_SOURCE or -D_GNU_SOURCE.
Comment 2 Keith Ansell 2001-08-22 09:58:48 EDT
This works well in the test software, but when it is added to my applications
main makefile the program now shows errors on the following software.

     With -D_GNU_SOURCE and -D_XOPEN_SOURCE signal.h:36: declaration of `void
(*sigset (int,void(*) int()))  (int) throw()' throws different exceptions
      problems with sigignore, and stdlib.h grantpt and unlockpt.

Can You Help?

         Keith Ansell

Comment 3 Jakub Jelinek 2001-08-22 10:04:34 EDT
Generally you should not prototype things which are prototyped in system headers.
Comment 4 Keith Ansell 2001-08-22 10:13:54 EDT
Agreed, then why can't I compile my source on this version of REDHAT and GNU
where as the same program compiles on RH5.x RH6.x and RH7.0. I can supply you 
with a copy of the program, if you wish? but the answer to the BUG is NOT 

Keith Ansell
Comment 5 Jakub Jelinek 2001-08-22 10:51:45 EDT
It is enough if you just supply preprocessed source of the file which fails
(e.g. use -save-temps option of g++ which will create an .ii file), I can
tell you what's wrong.
But having ptsname protected with _XOPEN_SOURCE or _GNU_SOURCE is nothing new,
e.g. glibc in 6.2 had it too.
Comment 6 Jakub Jelinek 2001-08-22 11:22:06 EDT
I'd suggest using -D_GNU_SOURCE, removing grantpt and unlockpt prototypes
from Communications.h and at least kill sigrelse, sigignore, sighold
and sigset in your signal.h. Portable applications cannot do what these
headers do.

Note You need to log in before you can comment on or make changes to this bug.