Validate || LAMP

Validated HTML 4.0


System Calls

For the most part, Lamp draws the same boundary between kernel and library calls as other Unix and Unix-like systems, but some divergence was either necessary or convenient. The distinction really isn't important anyway.

The routines to manipulate environment variables are kernel calls, because the kernel manages environment variables. This avoids the 'unavoidable' memory leaks associated with userspace modification of environ. Userspace programs are of course welcome to iterate environ to enumerate the environment variables.

dirent.h

opendir()
Works more or less as expected. Opening /Volumes gives you an iterator of mounted volumes, not the contents of /Volumes.
closedir()
Works more or less as expected.
readdir()
Works more or less as expected. Fabricates imaginary . and .. directories.
rewinddir()
Works more or less as expected.
seekdir()
Works more or less as expected.
telldir()
Works more or less as expected.

fcntl.h

fcntl()
Supports F_DUPFD, F_GETFD, F_SETFD.
open()
Opens regular files and simple devices (like /dev/null), but not TTY devices.

signal.h

kill()
Works more or less as expected.
signal()
Works more or less as expected.

stdlib.h

getenv()
Works more or less as expected.
setenv()
Works more or less as expected.
putenv()
Works more or less as expected.
unsetenv()
Works more or less as expected.
clearenv()
Works more or less as expected.

sys/ioctl.h

ioctl()
Supports FIONBIO (non-blocking I/O) and TIOCSCTTY (set controlling terminal).

sys/select.h

select()
Works more or less as expected.

sys/socket.h

socket()
Ignores its parameters and creates a TCP socket.
bind()
Works more or less as expected.
listen()
Works more or less as expected.
accept()
Works more or less as expected.
connect()
Works more or less as expected.
getsockname()
Works more or less as expected.
getpeername()
Works more or less as expected.

sys/stat.h

There is not yet support for symbolic links, and there are other limitations of the stat() functions.

chmod()
Sets or clears the write bit of any file and the execute bit of a text file.
fstat()
Works as well as stat() does.
lstat()
Fails to recognize symlinks.
mkdir()
Works more or less as expected.
rmdir()
Works more or less as expected.
stat()
Fails to traverse symlinks.

sys/wait.h

waitpid()
Works more or less as expected.

unistd.h

chdir()
Works more or less as expected.
close()
Works more or less as expected.
copyfile()
There needs to be a kernel function for copying a file, so I added one. It uses MoreFiles to do all the right things, but only works on regular files.
dup()
Works more or less as expected.
dup2()
Works more or less as expected.
execve()
Works more or less as expected. To safely interact with vfork(), execve() is partially implemented in the library.
_exit()
Works more or less as expected.
getcwd()
Works more or less as expected.
getpgid()
Works more or less as expected.
getpgrp()
Works more or less as expected.
getpid()
Works more or less as expected.
getppid()
Works more or less as expected.
lseek()
Works more or less as expected.
pause()
Works more or less as expected.
int peek( int fd, const char** buffer, size_t minBytes )
peek() allows you to read ahead on any stream without advancing the file pointer, at system level. There are three main advantages over other approaches to this problem: If there aren't minBytes bytes of data available, peek() will either block or indicate EAGAIN depending on whether the stream is blocking, just like read().
pipe()
Works more or less as expected.
read()
Works more or less as expected.
rename()
Can't merely change case of a filename.
setpgid()
Works more or less as expected.
setsid()
Works more or less as expected.
sleep()
Works more or less as expected. sleep(0) is guaranteed to yield once.
ttyname()
Works more or less as expected. Returns the actual device name, not just /dev/tty.
unlink()
Only works on regular files, which are deleted immediately. Fails if the file is open.
write()
Works more or less as expected.

vfork.h

vfork()
Works more or less as expected.


[SourceForge Logo] Last updated April 5, 2002 by jax with mml2html
LAMP is developed by Metamage Software Creations