Previous | Table of Contents | Next

Page 879

CONFORMS TO

SVID, AT&T, POSIX, X/OPEN, BSD 4.3

SEE ALSO

time(1), getrusage(2), wait(2)

Linux 0.99.11, 24 July 1993

truncate, ftruncate

truncate, ftruncate—Truncate a file to a specified length

SYPNOSIS

#include <unistd.h>
int truncate(const char *path, size_t length);
int ftruncate(int fd, size_t length);

DESCRIPTION

truncate causes the file named by path or referenced by fd to be truncated to at most length bytes in size. If the file previously was larger than this size, the extra data is lost. With ftruncate, the file must be open for writing.

RETURN VALUE

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

ERRORS

The errors for truncate are

ENOTDIR A component of the path prefix is not a directory.
EINVAL The pathname contains a character with the high-order bit set.
ENAMETOOLONG A component of a pathname exceeded 255 characters, or an entire pathname exceeded 1,023 characters.
ENOENT The named file does not exist.
EACCES Search permission is denied for a component of the path prefix.
EACCES The named file is not writeable by the user.
ELOOP Too many symbolic links were encountered in translating the pathname.
EISDIR The named file is a directory.
EROFS The named file resides on a read-only filesystem.
ETXTBSY The file is a pure procedure (shared text) file that is being executed.
EIO An I/O error occurred updating the inode.
EFAULT path points outside the process's allocated address space. The errors for ftruncate are
EBADF fd is not a valid descriptor.
EINVAL fd references a socket, not a file.
EINVAL fd is not open for writing.

HISTORY

These function calls appeared in BSD 4.2.

Page 880

BUGS

These calls should be generalized to allow ranges of bytes in a file to be discarded.

SEE ALSO

open(2)

BSD Man Page, 24 July 1993

umask

umask—Sets a file-creation mask

SYPNOSIS

#include <sys/stat.h>
int umask(int mask);

DESCRIPTION

umask sets the umask to mask & 0777.

RETURN VALUE

The previous value of the mask is returned.

CONFORMS TO

SVID, AT&T, POSIX, X/OPEN, BSD 4.3

SEE ALSO

creat(2), open(2)

Linux 24 July 93

uname

uname—Gets name and information about the current kernel

SYPNOSIS

#include <sys/utsname.h>
int uname(struct utsname *buf);

DESCRIPTION

uname returns system information in buf. The utsname struct is as defined in /usr/include/sys/utsname.h:

struct utsname {
               char sysname[65];
               char nodename[65];
               char release[65];
               char version[65];
               char machine[65];
               char domainname[65];
               };

RETURN VALUE

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

Page 881

ERRORS

EFAULT buf is not valid.

CONFORMS TO

SVID, AT&T, POSIX, X/OPEN

SEE ALSO

uname(1), getdomainname(2), gethostname(2)

Linux 0.99.11 24 July 93

none

none—Undocumented system calls

SYPNOSIS

Undocumented system calls.

DESCRIPTION

As of Linux 1.3.88, there are 163 system calls listed in /usr/include/asm/unistd.h. This man page mentions those calls that are implemented in the kernel but not yet documented in man pages. Some of these calls do not yet have prototypes in the libc include files.

SOLICITATION

If you have information about these system calls, please look in the kernel source code, write a man page (using a style similar to that of the other Linux section 2 man pages), and send it to aeb@cwi.nl for inclusion in the next man page release from the Linux Documentation Project.

STATUS

Undocumented are msync, readv, writev, getsid, fdatasync, sysctl, sched_setparam, sched_getparam, sched_setscheduler, sched_getscheduler, sched_yield, sched_get_priority_max, sched_get_priority_min, sched_rr_get_interval.

SEE ALSO

obsolete(2), unimplemented(2)

Linux 1.3.86 12 April 1996

afs_syscall, break, gtty, lock, mpx, prof, quotactl, stty, ustat

afs_syscall, break, gtty, lock, mpx, prof, quotactl, stty, ustat—Unimplemented system calls

SYPNOSIS

Unimplemented system calls.

DESCRIPTION

These system calls are not implemented in the Linux 1.2.4 kernel.

RETURN VALUE

These system calls always return _1 and set errno to ENOSYS.

Page 882

SEE ALSO

obsolete(2), undocumented(2)

Linux 1.2.4, 15 April 1995

unlink

unlink—Deletes a name and possibly the file it refers to

SYPNOSIS

#include <unistd.h>
int unlink(const char *pathname);

DESCRIPTION

unlink deletes a name from the filesystem. If that name was the last link to a file and no processes have the file open, the file is deleted, and the space it was using is made available for reuse.

If the name was the last link to a file but any processes still have the file open, the file will remain in existence until the last file descriptor referring to it is closed.

If the name referred to a symbolic link, the link is removed.

If the name referred to a socket, fifo, or device, the name for it is removed but processes that have the object open can continue to use it.

RETURN VALUE

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

ERRORS

EFAULT pathname points outside your accessible address space.
EACCES Write access to the directory containing pathname is not allowed for the process's effective UID, or one of the directories in pathname did not allow search (execute) permission.
EPERM The directory containing pathname has the sticky bit (S_ISVTX) set, and the process's effective UID is neither the UID of the file to be deleted nor that of the directory containing it, or pathname is a directory.
ENAMETOOLONG pathname was too long.
ENOENT A directory component in pathname does not exist or is a dangling symbolic link.
ENOTDIR A component used as a directory in pathname is not, in fact, a directory.
EISDIR pathname refers to a directory.
ENOMEM Insufficient kernel memory was available.
EROFS pathname refers to a file on a read-only filesystem.

CONFORMS TO

SVID, AT&T, POSIX, X/OPEN, BSD 4.3

BUGS

Infelicities in the protocol underlying NFS can cause the unexpected disappearance of files that are still being used.

SEE ALSO

link(2), rename(2), open(2), rmdir(2), mknod(2), mkfifo(3), remove(3), rm(1), unlink(8).

Linux, 24 July 1993

Page 883

uselib

uselib—Selects shared library

SYPNOSIS

#include <unistd.h>
int uselib(const char *library);

DESCRIPTION

uselib selects the shared library binary that will be used by this process.

RETURN VALUE

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

ERRORS

In addition to all the error codes returned by open(2) and mmap(2), the following may also be returned:
ENOEXEC The file specified by library is not executable, or does not have the correct magic numbers.
EACCES The library specified by library is not readable.

CONFORMS TO

uselib() is Linux specific.

SEE ALSO

open(2), mmap(2), ldd(1), gcc(1), ar(1), ld(1)

Linux 0.99.11, 24 July 1993

ustat

ustat—Gets filesystem statistics

SYPNOSIS

#include <sys/types.h>
int ustat(dev_t dev, struct ustat * ubuf);

DESCRIPTION

ustat returns information about a mounted filesystem. dev is a device number identifying a device containing a mounted filesystem. ubuf is a pointer to a ustat structure that contains the following members:

daddr_t f_tfree; /* Total free blocks */
ino_t f_tinode;  /* Number of free inodes */
char f_fname[6]; /* Filsys name */
char f_fpack[6]; /* Filsys pack name */

The last two fields, f_fname and f_fpack, are not implemented and will always be filled with null characters.

RETURN VALUE

On success, 0 is returned, and the ustat structure pointed to by ubuf will be filled in. On error, _1 is returned, and errno is set appropriately.

Page 884

ERRORS

EINVAL dev does not refer to a device containing a mounted filesystem.
EFAULT ubuf points outside of your accessible address space.
ENOSYS The mounted filesystem referenced by dev does not support this operation, or any version of Linux before 1.3.16.

NOTES

ustat has been provided for compatibility only. All new programs should use statfs(2) instead.

HISTORY

ustat was first implemented in Linux 1.3.16. All versions of Linux before 1.3.16 will return ENOSYS.

CONFORMS TO

System V

SEE ALSO

statfs(2), stat(2)

Linux 1.3.16, 9 August 1995

utime, utimes

utime, utimes—Change access and/or modification times of an inode

SYPNOSIS

#include <sys/types.h>
#include <utime.h>
int utime(const char *filename, struct utimbuf *buf);
#include <sys/time.h>
int utimes(char *filename, struct timeval *tvp);

DESCRIPTION

utime changes the access and modification times of the inode specified by filename to the actime and modtime fields of buf, respectively. If buf is NULL, the access and modification times of the file are set to the current time. The utimbuf structure is

struct utimbuf {
time_t actime; /* access time */
time_t modtime; /* modification time */
};

In the Linux DLL 4.4.1 libraries, utimes is just a wrapper for utime, tvp[0].tv_sec is actime, and tvp[1].tv_sec is modtime. The timeval structure is

struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* microseconds */
};

RETURN VALUE

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

Previous | Table of Contents | Next

1