Bug #22429 forkpty does not exist on Solaris 10 - configure problem
Submitted: 18 Sep 2006 4:36 Modified: 9 Apr 2009 12:58
Reporter: Mark Detrick Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Administrator Severity:S3 (Non-critical)
Version:5.0r2 OS:Solaris (Solaris 10)
Assigned to: CPU Architecture:Any

[18 Sep 2006 4:36] Mark Detrick
Description:
Solaris 10 does not have forkpty.
Build failure in source/linux.

Platform
SunOS hassium 5.10 Generic_118833-22 sun4u sparc SUNW,Ultra-60
gcc-4.1.1
GNU libtool, make, autoconf

How to repeat:
Build mysql-gui-tools-5.0r2/mysql-gui-common on a Solaris platform.

Suggested fix:
Use this (or similar) when compiling Solaris:

#include <stdlib.h> 
#include <unistd.h> 
#include <fcntl.h> 
#include <sys/ioctl.h> 
#include <sys/stream.h> 
#include <sys/stropts.h> 
#include <sys/syscall.h>
#include <stdio.h>
#include <errno.h>

#define forkpty my_forkpty

/* fork_pty() remplacement for Solarisk 
 * This ignore the last two arguments 
 * for the moment 
 */ 

int 
my_forkpty (int *amaster, 
            char *name, 
            void *unused1, 
            void *unused2) 
{ 
  int master, slave; 
  char *slave_name; 
  pid_t pid; 
   
  master = open("/dev/ptmx", O_RDWR); 
  if (master < 0) 
    return -1; 

  if (grantpt (master) < 0) 
    { 
      close (master); 
      return -1; 
    } 

  if (unlockpt (master) < 0) 
    { 
      close (master); 
      return -1; 
    } 

  slave_name = ptsname (master); 
  if (slave_name == NULL) 
    { 
      close (master); 
      return -1; 
    } 

  slave = open (slave_name, O_RDWR); 
  if (slave < 0) 
    { 
      close (master); 
      return -1; 
    } 

  if (ioctl (slave, I_PUSH, "ptem") < 0 
      || ioctl (slave, I_PUSH, "ldterm") < 0) 
    { 
      close (slave); 
      close (master); 
      return -1; 
    } 

  if (amaster) 
    *amaster = master; 

  if (name) 
    strcpy (name, slave_name); 
   
  pid = fork (); 
  switch (pid) 
    { 
    case -1: /* Error */ 
      return -1; 
    case 0: /* Child */ 
      close (master); 
      dup2 (slave, STDIN_FILENO); 
      dup2 (slave, STDOUT_FILENO); 
      dup2 (slave, STDERR_FILENO); 
      return 0; 
    default: /* Parent */ 
      close (slave); 
      return pid; 
    } 

  return -1; 
}
[18 Sep 2006 8:18] Sveta Smirnova
Thank you for the report.

Could you please try using current 5.0-r3 sources accessible from http://dev.mysql.com/downloads/gui-tools/5.0.html?
[3 Oct 2006 3:37] Mark Detrick
This bug has NOT been resolved as of 5.0r4.
[9 Apr 2009 12:58] Axel Schwenke
Many thanks for writing a bug report. We are on the way to implement full functionality of MySQL Administrator into MySQL Workbench. Unfortunately you are using an unsupported platform. More informations about supported platforms you will find here:

http://www.mysql.com/support/supportedplatforms/tools.html

More informations about MySQL Workbench you will find here:

http://dev.mysql.com/workbench/