Rizin
unix-like reverse engineering framework and cli tools
aix-common.c File Reference
#include "uv.h"
#include "internal.h"
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
#include <procinfo.h>
#include <ctype.h>

Go to the source code of this file.

Functions

void init_process_title_mutex_once (void)
 
uint64_t uv__hrtime (uv_clocktype_t type)
 
int uv_exepath (char *buffer, size_t *size)
 

Variables

char * original_exepath
 
uv_mutex_t process_title_mutex
 
uv_once_t process_title_mutex_once
 

Function Documentation

◆ init_process_title_mutex_once()

void init_process_title_mutex_once ( void  )

Definition at line 76 of file aix.c.

76  {
78 }
uv_mutex_t process_title_mutex
Definition: aix.c:69
UV_EXTERN int uv_mutex_init(uv_mutex_t *handle)
Definition: thread.c:282

References process_title_mutex, and uv_mutex_init().

Referenced by uv_exepath(), uv_get_process_title(), uv_set_process_title(), and uv_setup_args().

◆ uv__hrtime()

uint64_t uv__hrtime ( uv_clocktype_t  type)

Definition at line 43 of file aix-common.c.

43  {
44  uint64_t G = 1000000000;
45  timebasestruct_t t;
46  read_wall_time(&t, TIMEBASE_SZ);
47  time_base_to_time(&t, TIMEBASE_SZ);
48  return (uint64_t) t.tb_high * G + t.tb_low;
49 }
unsigned long uint64_t
Definition: sftypes.h:28
#define G
Definition: zip_err_str.c:13

References G.

Referenced by uv_cond_timedwait(), uv_hrtime(), and uv_update_time().

◆ uv_exepath()

int uv_exepath ( char *  buffer,
size_t size 
)

Definition at line 60 of file aix-common.c.

60  {
61  int res;
62  char args[UV__PATH_MAX];
63  size_t cached_len;
64  struct procsinfo pi;
65 
66  if (buffer == NULL || size == NULL || *size == 0)
67  return UV_EINVAL;
68 
71  if (original_exepath != NULL) {
72  cached_len = strlen(original_exepath);
73  *size -= 1;
74  if (*size > cached_len)
75  *size = cached_len;
77  buffer[*size] = '\0';
79  return 0;
80  }
82  pi.pi_pid = getpid();
83  res = getargs(&pi, sizeof(pi), args, sizeof(args));
84 
85  if (res < 0)
86  return UV_EINVAL;
87 
88  return uv__search_path(args, buffer, size);
89 }
uv_once_t process_title_mutex_once
Definition: aix.c:70
void init_process_title_mutex_once(void)
Definition: aix.c:76
char * original_exepath
Definition: aix.c:68
uv_mutex_t process_title_mutex
Definition: aix.c:69
#define NULL
Definition: cris-opc.c:27
voidpf void uLong size
Definition: ioapi.h:138
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
int args
Definition: mipsasm.c:18
Definition: buffer.h:15
int uv__search_path(const char *prog, char *buf, size_t *buflen)
Definition: core.c:1540
#define UV__PATH_MAX
Definition: internal.h:68
UV_EXTERN void uv_mutex_lock(uv_mutex_t *handle)
Definition: thread.c:330
UV_EXTERN void uv_once(uv_once_t *guard, void(*callback)(void))
Definition: thread.c:419
UV_EXTERN void uv_mutex_unlock(uv_mutex_t *handle)
Definition: thread.c:350

Variable Documentation

◆ original_exepath

char* original_exepath
extern

Definition at line 68 of file aix.c.

Referenced by uv_exepath(), and uv_setup_args().

◆ process_title_mutex

uv_mutex_t process_title_mutex
extern

◆ process_title_mutex_once

uv_once_t process_title_mutex_once
extern

Definition at line 70 of file aix.c.

Referenced by uv_exepath(), uv_get_process_title(), uv_set_process_title(), and uv_setup_args().