libalpm
Arch Linux Package Manager Library
Miscellaneous Functions

Various libalpm functions More...

Collaboration diagram for Miscellaneous Functions:

Typedefs

typedef int64_t alpm_time_t
 The time type used by libalpm.
 

Enumerations

enum  alpm_caps { ALPM_CAPABILITY_NLS = (1 << 0) , ALPM_CAPABILITY_DOWNLOADER = (1 << 1) , ALPM_CAPABILITY_SIGNATURES = (1 << 2) }
 Enum of possible compile time features. More...
 

Functions

alpm_pkg_t * alpm_sync_get_new_version (alpm_pkg_t *pkg, alpm_list_t *dbs_sync)
 Check for new version of pkg in syncdbs.
 
char * alpm_compute_md5sum (const char *filename)
 Get the md5 sum of file.
 
char * alpm_compute_sha256sum (const char *filename)
 Get the sha256 sum of file.
 
int alpm_unlock (alpm_handle_t *handle)
 Remove the database lock file.
 
const char * alpm_version (void)
 Get the version of library.
 
int alpm_capabilities (void)
 Get the capabilities of the library.
 
int alpm_sandbox_setup_child (alpm_handle_t *handle, const char *sandboxuser, const char *sandbox_path)
 Drop privileges by switching to a different user.
 

Detailed Description

Various libalpm functions

Typedef Documentation

◆ alpm_time_t

typedef int64_t alpm_time_t

The time type used by libalpm.

Represents a unix time stamp

Enumeration Type Documentation

◆ alpm_caps

enum alpm_caps

Enum of possible compile time features.

Enumerator
ALPM_CAPABILITY_NLS 

localization

ALPM_CAPABILITY_DOWNLOADER 

Ability to download.

ALPM_CAPABILITY_SIGNATURES 

Signature checking.

Function Documentation

◆ alpm_capabilities()

int alpm_capabilities ( void )

Get the capabilities of the library.

Returns
a bitmask of the capabilities

References ALPM_CAPABILITY_DOWNLOADER, ALPM_CAPABILITY_NLS, and ALPM_CAPABILITY_SIGNATURES.

◆ alpm_compute_md5sum()

char * alpm_compute_md5sum ( const char * filename)

Get the md5 sum of file.

Parameters
filenamename of the file
Returns
the checksum on success, NULL on error

References ASSERT.

Referenced by extract_single_file(), and unlink_file().

◆ alpm_compute_sha256sum()

char * alpm_compute_sha256sum ( const char * filename)

Get the sha256 sum of file.

Parameters
filenamename of the file
Returns
the checksum on success, NULL on error

References ASSERT.

◆ alpm_sandbox_setup_child()

int alpm_sandbox_setup_child ( alpm_handle_t * handle,
const char * sandboxuser,
const char * sandbox_path )

Drop privileges by switching to a different user.

Parameters
handlethe context handle
sandboxuserthe user to switch to
sandbox_pathif non-NULL, restrict writes to this filesystem path
Returns
0 on success, -1 on failure

References ASSERT.

Referenced by curl_download_internal_sandboxed().

◆ alpm_sync_get_new_version()

alpm_pkg_t * alpm_sync_get_new_version ( alpm_pkg_t * pkg,
alpm_list_t * dbs_sync )

Check for new version of pkg in syncdbs.

If the same package appears multiple dbs only the first will be checked

This only checks the syncdb for a newer version. It does not access the network at all. See alpm_db_update to update a database.

References ALPM_ERR_OK, ALPM_LOG_DEBUG, ASSERT, alpm_list_t::data, and alpm_list_t::next.

◆ alpm_unlock()

int alpm_unlock ( alpm_handle_t * handle)

Remove the database lock file.

Parameters
handlethe context handle
Returns
0 on success, -1 on error
Note
Safe to call from inside signal handlers.

References ALPM_ERR_SYSTEM, ASSERT, and RET_ERR_ASYNC_SAFE.

◆ alpm_version()

const char * alpm_version ( void )

Get the version of library.

Returns
the library version, e.g. "6.0.4"