* returns a signed value.
*/
int64_t val;
- int ret = para_atoi64(arg, &val);
+ int ret = atoi64(arg, &val);
if (ret < 0)
return ret;
static int parse_uid_range(const char *orig_arg, struct uid_range *ur)
{
int ret;
- char *arg = para_strdup(orig_arg), *p = strchr(arg, '-');
+ char *arg = adu_strdup(orig_arg), *p = strchr(arg, '-');
if (!p || p == arg) { /* -42 or 42 */
ret = check_uid_arg(p? p + 1 : arg, &ur->high);
{
int ret;
- ui->desc = para_malloc(sizeof(*ui->desc));
+ ui->desc = adu_malloc(sizeof(*ui->desc));
ui->desc->num_columns = NUM_UT_COLUMNS;
ui->desc->flags = 0;
ui->desc->column_descriptions = user_table_cols;
- ui->desc->dir = para_strdup(conf.database_dir_arg);
+ ui->desc->dir = adu_strdup(conf.database_dir_arg);
ui->desc->name = make_message("%u", (unsigned)ui->uid);
INFO_LOG(".............................uid #%u: %u\n",
(unsigned)num_uids, (unsigned)ui->uid);
static void create_hash_table(void)
{
- uid_hash_table = para_calloc(uid_hash_table_size
+ uid_hash_table = adu_calloc(uid_hash_table_size
* sizeof(struct user_info));
}
{
int ret;
- dir_table_desc.dir = para_strdup(conf.database_dir_arg);
+ dir_table_desc.dir = adu_strdup(conf.database_dir_arg);
ret = osl(osl_create_table(&dir_table_desc));
if (ret < 0)
return ret;
static uint64_t num_files;
static uint64_t num_bytes;
-int scan_dir(char *dirname, uint64_t *parent_dir_num)
+static int scan_dir(char *dirname, uint64_t *parent_dir_num)
{
DIR *dir;
struct dirent *entry;
check_signals();
DEBUG_LOG("----------------- %llu: %s\n", (long long unsigned)num_dirs, dirname);
- ret = para_opendir(dirname, &dir, &cwd_fd);
+ ret = adu_opendir(dirname, &dir, &cwd_fd);
if (ret < 0) {
if (ret != -ERRNO_TO_ERROR(EACCES))
return ret;
&dir_size, &dir_files);
out:
closedir(dir);
- ret2 = para_fchdir(cwd_fd);
+ ret2 = adu_fchdir(cwd_fd);
if (ret2 < 0 && ret >= 0)
ret = ret2;
close(cwd_fd);
free(result);
result = tmp;
} else
- result = para_strdup((char *)obj.data);
+ result = adu_strdup((char *)obj.data);
ret = osl(osl_get_object(dir_table, row, DT_PARENT_NUM, &obj));
if (ret < 0)
goto out;
ret = osl(osl_get_object(dir_table, dir_table_row, DT_NAME, &obj));
if (ret < 0)
return ret;
- this_dir = para_strdup((char *)obj.data);
+ this_dir = adu_strdup((char *)obj.data);
ret = osl(osl_get_object(dir_table, dir_table_row, DT_PARENT_NUM, &obj));
if (ret < 0)
goto out;
if (!num_uids)
return 0;
- buf = para_malloc(size);
+ buf = adu_malloc(size);
FOR_EACH_USER(ui) {
if (!ui_used(ui) || !ui_admissible(ui))
continue;
write_u32(buf + count++ * sizeof(uint32_t), ui->uid);
}
filename = get_uid_list_name();
- ret = para_write_file(filename, buf, size);
+ ret = adu_write_file(filename, buf, size);
free(filename);
free(buf);
return ret;
static int open_dir_table(void)
{
if (!dir_table_desc.dir) /* we did not create the table */
- dir_table_desc.dir = para_strdup(conf.database_dir_arg);
+ dir_table_desc.dir = adu_strdup(conf.database_dir_arg);
return osl(osl_open_table(&dir_table_desc, &dir_table));
}
static int com_create()
goto out;
}
out:
- para_munmap(map, size);
+ adu_munmap(map, size);
return ret;
}
}
if (!conf.uid_given)
return 0;
- admissible_uids = para_malloc(conf.uid_given * sizeof(*admissible_uids));
+ admissible_uids = adu_malloc(conf.uid_given * sizeof(*admissible_uids));
for (i = 0; i < conf.uid_given; i++) {
ret = parse_uid_range(conf.uid_arg[i], admissible_uids + i);
if (ret < 0)
*
* \return Standard.
*/
-int para_write_file(const char *filename, const void *buf, size_t size)
+int adu_write_file(const char *filename, const void *buf, size_t size)
{
int ret, fd;
* \sa getcwd(3).
*
*/
-int para_opendir(const char *dirname, DIR **dir, int *cwd)
+int adu_opendir(const char *dirname, DIR **dir, int *cwd)
{
int ret;
*
* \return Standard.
*/
-int para_fchdir(int fd)
+int adu_fchdir(int fd)
{
if (fchdir(fd) < 0)
return -ERRNO_TO_ERROR(errno);
*
* \sa munmap(2), mmap_full_file().
*/
-int para_munmap(void *start, size_t length)
+int adu_munmap(void *start, size_t length)
{
int err;
if (munmap(start, length) >= 0)
/** \file fd.h exported symbols from fd.c */
-int para_opendir(const char *dirname, DIR **dir, int *cwd);
-int para_fchdir(int fd);
+int adu_opendir(const char *dirname, DIR **dir, int *cwd);
+int adu_fchdir(int fd);
int mmap_full_file(const char *filename, int open_mode, void **map,
size_t *size, int *fd_ptr);
-int para_munmap(void *start, size_t length);
-int para_write_file(const char *filename, const void *buf, size_t size);
+int adu_munmap(void *start, size_t length);
+int adu_write_file(const char *filename, const void *buf, size_t size);
*
* \sa realloc(3).
*/
-__must_check __malloc void *para_realloc(void *p, size_t size)
+__must_check __malloc void *adu_realloc(void *p, size_t size)
{
/*
* No need to check for NULL pointers: If p is NULL, the call
*
* \sa malloc(3).
*/
-__must_check __malloc void *para_malloc(size_t size)
+__must_check __malloc void *adu_malloc(size_t size)
{
assert(size);
void *p = malloc(size);
*
* \sa calloc(3)
*/
-__must_check __malloc void *para_calloc(size_t size)
+__must_check __malloc void *adu_calloc(size_t size)
{
- void *ret = para_malloc(size);
+ void *ret = adu_malloc(size);
memset(ret, 0, size);
return ret;
*
* \sa strdup(3)
*/
-__must_check __malloc char *para_strdup(const char *s)
+__must_check __malloc char *adu_strdup(const char *s)
{
char *ret;
*
* \sa strtol(3), atoi(3).
*/
-int para_atoi64(const char *str, int64_t *value)
+__must_check int atoi64(const char *str, int64_t *result)
{
char *endptr;
long long tmp;
return -E_ATOI_NO_DIGITS;
if (*endptr != '\0') /* Further characters after number */
return -E_ATOI_JUNK_AT_END;
- *value = tmp;
+ *result = tmp;
return 1;
}
/** \file string.h exported sybmols from string.c */
-__must_check __malloc void *para_realloc(void *p, size_t size);
-__must_check __malloc void *para_malloc(size_t size);
-__must_check __malloc void *para_calloc(size_t size);
-__must_check __malloc char *para_strdup(const char *s);
+__must_check __malloc void *adu_realloc(void *p, size_t size);
+__must_check __malloc void *adu_malloc(size_t size);
+__must_check __malloc void *adu_calloc(size_t size);
+__must_check __malloc char *adu_strdup(const char *s);
__must_check __malloc __printf_1_2 char *make_message(const char *fmt, ...);
-int para_atoi64(const char *str, int64_t *result);
+__must_check int atoi64(const char *str, int64_t *result);