Next: , Previous: , Up: Libc   [Contents]


3.4.3 Misc support routines

These are called by newlib but don’t apply to the embedded environment. isatty() is self explanatory. kill() doesn’t apply either in an environment withno process control, so it justs exits, which is a similar enough behavior. getpid() can safely return any value greater than 1. The value doesn’t effect anything in newlib because once again there is no process control.

/*
 * isatty -- returns 1 if connected to a terminal device,
 *           returns 0 if not. Since we're hooked up to a
 *           serial port, we'll say yes and return a 1.
 */
int
isatty(fd)
     int fd;
{
  return (1);
}

/*
 * getpid -- only one process, so just return 1.
 */
#define __MYPID 1
int
getpid()
{
  return __MYPID;
}

/*
 * kill -- go out via exit...
 */
int
kill(pid, sig)
     int pid;
     int sig;
{
  if(pid == __MYPID)
    _exit(sig);
  return 0;
}