JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Solaris Trusted Extensions Reference Manual
search filter icon
search icon

Document Information

Preface

Introduction

User Commands

System Administration Commands

System Calls

Trusted Extensions Library

bcleartoh(3TSOL)

bcleartoh_r(3TSOL)

bcleartos(3TSOL)

blcompare(3TSOL)

bldominates(3TSOL)

blequal(3TSOL)

blinrange(3TSOL)

blmaximum(3TSOL)

blminimum(3TSOL)

blminmax(3TSOL)

blstrictdom(3TSOL)

bltocolor(3TSOL)

bltocolor_r(3TSOL)

bltos(3TSOL)

bsltoh(3TSOL)

bsltoh_r(3TSOL)

bsltos(3TSOL)

btohex(3TSOL)

getdevicerange(3TSOL)

getpathbylabel(3TSOL)

getplabel(3TSOL)

getuserrange(3TSOL)

getzoneidbylabel(3TSOL)

getzonelabelbyid(3TSOL)

getzonelabelbyname(3TSOL)

getzonerootbyid(3TSOL)

getzonerootbylabel(3TSOL)

getzonerootbyname(3TSOL)

h_alloc(3TSOL)

hextob(3TSOL)

h_free(3TSOL)

htobclear(3TSOL)

htobsl(3TSOL)

labelbuilder(3TSOL)

labelclipping(3TSOL)

label_to_str(3TSOL)

m_label(3TSOL)

m_label_alloc(3TSOL)

m_label_dup(3TSOL)

m_label_free(3TSOL)

sbcleartos(3TSOL)

sbltos(3TSOL)

sbsltos(3TSOL)

setflabel(3TSOL)

stobclear(3TSOL)

stobl(3TSOL)

stobsl(3TSOL)

str_to_label(3TSOL)

tsol_getrhtype(3TSOL)

tsol_lbuild_create(3TSOL)

tsol_lbuild_destroy(3TSOL)

tsol_lbuild_get(3TSOL)

tsol_lbuild_set(3TSOL)

Xbcleartos(3TSOL)

Xbsltos(3TSOL)

X Library Extensions

File Formats

Standards, Environments, and Macros

Index

getpathbylabel

- return the zone pathname

Synopsis

cc [flags...] file... -ltsol
#include <tsol/label.h>

char *getpathbylabel(const char *path, char *resolved_path, size_t bufsize,
     const m_label_t *sl);

Description

getpathbylabel() expands all symbolic links and resolves references to '/./', '/../', extra '/' characters, and stores the zone pathname in the buffer named by resolved_path. The bufsize argument specifies the size in bytes of this buffer. The resulting path will have no symbolic links components, nor any '/./', '/. ./'. This function can only be called from the global zone.

The zone pathname is relative to the sensitivity label sl. To specify a sensitivity label for a zone name which does not exist, the process must assert either the PRIV_FILE_UPGRADE_SL or PRIV_FILE_DOWNGRADE_SL privilege depending on whether the specified sensitivity label dominates or does not dominate the process sensitivity label.

Return Values

getpathbylabel() returns a pointer to the resolved_path on success. On failure, it returns NULL and sets errno to indicate the error.

Errors

EACCES

Search permission is denied for a component of the path prefix of path.

EFAULT

resolved_path extends outside the process's allocated address space or beyond bufsize bytes.

ELOOP

Too many symbolic links were encountered in translating path.

EINVAL

path or resolved_path was NULL, current zone is not the global zone, or sl is invalid.

EIO

An I/O error occurred while reading from or writing to the file system.

ENOENT

The named file does not exist.

ENAMETOOLONG

The length of the path argument exceeds PATH_MAX. A pathname component is longer than NAME_MAX (see sysconf(3C)) while _POSIX_NO_TRUNC is in effect (see pathconf(2)).

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
SUNWcslr
MT-Level
MT-Safe
Interface Stability
Stable

See Also

readlink(2), getzonerootbyid(3TSOL), attributes(5), labels(5)

Warnings

getpathbylabel() indirectly invokes the readlink(2) system call, and hence inherits the possibility of hanging due to inaccessible file system resources.