Usermode/libposix - Updates to get curl and netsurf compiled
[tpg/acess2.git] / Usermode / Libraries / libposix.so_src / unistd.c
index a2f4eb7..dca2963 100644 (file)
@@ -50,6 +50,12 @@ int open(const char *path, int openmode, ...)
        return ret;
 }
 
+int access(const char *path, int openmode)
+{
+       errno = EINVAL;
+       return -1;
+}
+
 int creat(const char *path, mode_t mode)
 {
        // TODO: Make native call to do this cheaper
@@ -183,6 +189,17 @@ int usleep(useconds_t usec)
        return 0;
 }
 
+unsigned int alarm(unsigned int seconds)
+{
+       static int64_t  alarm_time;
+       if( seconds > 0 )
+       {
+               alarm_time = _SysTimestamp() + seconds * 1000;
+               // TODO: Schedule SIGALRM
+       }
+       return (alarm_time - _SysTimestamp()) / 1000;
+}
+
 int kill(pid_t pid, int signal)
 {
        // TODO: Need special handling?
@@ -275,3 +292,21 @@ int ttyname_r(int fd, char *buf, size_t buflen)
 
        return ENOTIMPL;
 }
+
+int isatty(int fd)
+{
+       if( fd < 0 ) {
+               errno = EBADF;
+               return 0;
+       }
+       
+        int    type = _SysIOCtl(fd, DRV_IOCTL_TYPE, NULL);
+       if( type == -1 )
+               return 0;
+       if( type != DRV_TYPE_TERMINAL ) {
+               errno = ENOTTY;
+               // NOTE: Pre POSIX 2001, EINVAL was returned
+               return 0;
+       }
+       return 1;
+}

UCC git Repository :: git.ucc.asn.au