Skip to content

Instantly share code, notes, and snippets.

View kinichiro's full-sized avatar

Kinichiro Inoguchi kinichiro

View GitHub Profile
@kinichiro
kinichiro / 1 test_dl_iterate_phdr.c
Last active August 29, 2015 14:05
sample code for dl_iterate_phdr()
/* test_dl_iterate_phdr.c */
#define _GNU_SOURCE
#include <stdio.h>
#include <link.h>
static int
test_phdr(struct dl_phdr_info *i, size_t size, void *data) {
printf("0x%8.8x %-30.30s 0x%8.8x %d %d %d %d 0x%8.8x\n",
i->dlpi_addr, i->dlpi_name, i->dlpi_phdr, i->dlpi_phnum,
i->dlpi_adds, i->dlpi_subs, i->dlpi_tls_modid,
@kinichiro
kinichiro / 1 test_shl_get_r.c
Last active August 29, 2015 14:05
sample code for shl_get_r()
/* test_shl_get_r.c */
#include <stdio.h>
#include <dl.h>
int main() {
int idx;
struct shl_descriptor desc;
for(idx = -2; shl_get_r(idx, &desc) == 0; ++ idx) {
printf("[%03d] %8.8x %8.8x %8.8x %8.8x %8.8x %8.8x %s\n",
@kinichiro
kinichiro / 1 test_pstat_getdynamic.c
Created August 13, 2014 08:04
sample code for pstat_getdynamic()
/* test_pstat_getdynamic.c */
#include <stdio.h>
#include <sys/pstat.h>
int main() {
struct pst_dynamic buf;
if(pstat_getdynamic(&buf, sizeof(buf), 1, 0) != 1) {
perror("pstat_getdynamic()");
return -1;
@kinichiro
kinichiro / 1 test_pstat_getvminfo.c
Created August 13, 2014 08:05
sample code for pstat_getvminfo()
/* test_pstat_getvminfo.c */
#include <stdio.h>
#include <sys/pstat.h>
int main() {
struct pst_vminfo buf;
if(pstat_getvminfo(&buf, sizeof(buf), 1, 0) != 1) {
perror("pstat_getvminfo()");
return -1;
@kinichiro
kinichiro / 1 test_pstat_getprocvm.c
Created August 13, 2014 08:33
sample code for pstat_getprocvm()
/* test_pstat_getprocvm.c */
#include <stdio.h>
#include <sys/pstat.h>
int main() {
struct pst_vm_status buf;
if(pstat_getprocvm(&buf, sizeof(buf), 0, 0) != 1) {
perror("pstat_getprocvm()");
return -1;
@kinichiro
kinichiro / 1 test_pstat_getprocessor.c
Created August 14, 2014 02:09
sample code for pstat_getprocessor()
/* test_pstat_getprocessor.c */
#include <stdio.h>
#include <sys/pstat.h>
int main() {
int i;
for(i = 0; i < PST_MAX_PROCS; ++ i) {
struct pst_processor buf;
@kinichiro
kinichiro / 1 test_pstat_getproc.c
Created August 14, 2014 04:30
sample code for pstat_getproc()
/* test_pstat_getproc.c */
#include <stdio.h>
#include <unistd.h>
#include <sys/pstat.h>
int main() {
struct pst_status buf;
if(pstat_getproc(&buf, sizeof(buf), 0, getpid()) != 1) {
perror("pstat_getproc()");
@kinichiro
kinichiro / enctest.sh
Created April 15, 2015 15:56
libressl enc test script
#!/bin/sh
# enctest.sh
openssl_bin=../apps/openssl
if [ -e ../apps/openssl.exe ]; then
openssl_bin=../apps/openssl.exe
fi
export OPENSSL_CONF=../apps/openssl.cnf
@kinichiro
kinichiro / renametest.sh
Created May 11, 2015 11:31
renametest.sh
#!/bin/sh
#
# renametest.sh
#
# input : none
# output : all files generated by this script go under $ssldir
#
openssl_bin=../apps/openssl
if [ -e ../apps/openssl.exe ]; then
@kinichiro
kinichiro / ca-spkac.sh
Last active August 29, 2015 14:21
ca-spkac.sh
#!/bin/sh
#
# ca-spkac.sh
#
openssl_bin=../apps/openssl
if [ -e ../apps/openssl.exe ]; then
openssl_bin=../apps/openssl.exe
fi