Previous | Table of Contents | Next

Page 885

ERRORS

Other errors may occur.
EACCESS Permission to write the file is denied.
ENOENT filename does not exist.

CONFORMS TO

utime: SVID, POSIX utimes:BSD4.3

SEE ALSO

stat(2)

Linux, 10 June 1995

vhangup

vhangup—Virtually hangs up the current tty

SYPNOSIS

#include <unistd.h>
int vhangup(void);

DESCRIPTION

vhangup simulates a hangup on the current terminal. This call arranges for other users to have a clean tty at login time.

RETURN VALUE

On success, 0 is returned. On error, _1 is returned, and errno is set appropriately.

ERRORS

EPERM The user is not the superuser.

SEE ALSO

init(8)

Linux 0.99.11, 24 July 1993

vm86

vm86—Enters virtual 8086 mode

SYPNOSIS

#include <sys/vm86.h>
int vm86(struct vm86_struct * info);

DESCRIPTION

Enter VM86 mode with information as specified in info:

struct vm86_struct {
        struct vm86_regs regs;
        unsigned long flags;


Page 886




        unsigned long screen_bitmap;
};

waistruct vm86_regs {
/*
 * normal regs, with special meaning for the segment descriptors..
 */
        long ebx;
        long ecx;
        long edx;
        long esi;
        long edi;
        long ebp;
        long eax;
        long __null_ds;
        long __null_es;
        long __null_fs;
        long __null_gs;
        long orig_eax;
        long eip;
        long cs;
        long eflags;
        long esp;
        long ss;
/*
 * these are specific to v86 mode:
 */
        long es;
        long ds;
        long fs;
        long gs;
};

these are specific to v86 mode:

/
long es;
long ds;
long fs;
long gs;
};

RETURN VALUE

On success, 0 is returned. On error, _1 is returned, and errno is set appropriately.

ERRORS

EPERM Saved kernel stack exists.

Linux 0.99.11, 24 July 1993

wait, waitpid

wait, waitpid—Wait for process termination

SYPNOSIS

#include <sys/types.h>
#include <sys/wait.h>

Page 887


pid_t wait(int *status)
pid_t waitpid(pid_t pid,int*status,int options);

DESCRIPTION

The wait function suspends execution of the current process until a child has exited, or until a signal is delivered whose action is to terminate the current process or to call a signal-handling function. If a child has already exited by the time of the call (a so_called zombie process), the function returns immediately. Any system resources used by the child are freed.

The waitpid function suspends execution of the current process until a child as specified by the pid argument has exited, or until a signal is delivered whose action is to terminate the current process or to call a signal-handling function. Just as with wait, if a child requested by pid has already exited by the time of the call, the function returns immediately. Any system resources used by the child are freed.

The value of pid can be one of the following:

< _1 Wait for any child process whose process group ID is equal to the absolute value of pid.
_1 Wait for any child process; this is the same behavior that wait exhibits.
0 Wait for any child process whose process group ID is equal to that of the calling process.
> 0 Wait for the child whose process ID is equal to the value of pid.

The value of options is an OR of zero or more of the following constants:
WNOHANG Return immediately if no child has exited.
WUNTRACED Also return for children that are stopped and whose status has not been reported.

If status is not NULL, wait or waitpid stores status information in the location pointed to by statloc.

This status can be evaluated with the following macros (these macros take the stat buffer as an argument—not a pointer to the buffer!):

WIFEXITED(status) Is nonzero if the child exited normally.
WEXITSTATUS(status) Evaluates to the least significant eight bits of the return code of the child that terminated, which may have been set as the argument to a call to exit() or as the argument for a return statement in the main program. This macro can only be evaluated if WIFEXITED returned nonzero.
WIFSIGNALED(status) Returns true if the child process exited because of a signal that was not caught.
WTERMSIG(status) Returns the number of the signal that caused the child process to terminate. This macro can only be evaluated if WIFSIGNALED returned nonzero.
WIFSTOPPED(status) Returns true if the child process that caused the return is currently stopped; this is only possible if the call was done using WUNTRACED.
WSTOPSIG(status) Returns the number of the signal that caused the child to stop. This macro can only be evaluated if WIFSTOPPED returned nonzero.

RETURN VALUE

The process ID of the child that exited returns _1 on error or 0 if WNOHANG was used and no child was available (in which case errno is set to an appropriate value).

ERRORS

ECHILD If the child process specified in pid does not exist.
EPERM If the effective user ID of the calling process does not match that of the process being waited for, and the effective user ID of the calling process is not that of the superuser.
ERESTARTSYS If WNOHANG was not set and an unblocked signal or a SIGCHLD was caught; this is an extension to the POSIX.1 standard.

Previous | Table of Contents | Next

1