Skip to content

Fix warnings #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/biter/biterd.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ typedef struct biterd_session {
int s2c_fd;
char *c2s_path;
char *s2c_path;
int num_clients;
int clients_accepted;
uint32_t num_clients;
uint32_t clients_accepted;
void *proc_messages;
msg_header_t polled_data;
int has_polled_data;
Expand All @@ -55,7 +55,7 @@ typedef struct biterd_session {
} biterd_session_t;

static biterd_session_t sessions[BITER_MAX_SESSIONS];
static int max_session = 0;
static uint32_t max_session = 0;

extern void init_queue(int num_procs, void *session);

Expand Down Expand Up @@ -117,7 +117,7 @@ int biterd_newsession(const char *tmpdir, int cn_id)
char *c2s_path = NULL, *s2c_path = NULL;
int result, c2s_fd = -1, s2c_fd = -1;
int path_len = strlen(tmpdir) + 32;
int session_id, i, unique_number, num_clients;
uint32_t session_id, i, unique_number, num_clients;

assert(sizeof(int) == sizeof(uint32_t)); //Fix FD_* macros if this fails on new platform

Expand Down Expand Up @@ -393,7 +393,7 @@ int biterd_has_data_avail(int session_id, fd_set *readset)
int client_id;
int fd = sessions[session_id].c2s_fd;
int aux_fd = get_aux_fd();
int i, orig;
uint32_t i, orig;

session = sessions + session_id;

Expand Down Expand Up @@ -422,8 +422,8 @@ int biterd_has_data_avail(int session_id, fd_set *readset)

int biterd_get_session_proc_w_aux_data(int *session_result, int *proc_result)
{
static int last_session = 0;
int cur_session, start_session, j;
static uint32_t last_session = 0;
uint32_t cur_session, start_session, j;
biterd_session_t *session;
cur_session = start_session = last_session;

Expand Down
3 changes: 3 additions & 0 deletions src/biter/client_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ int init_message(int num_procs, void *header_ptr, void *session)

void get_message(int for_proc, void **msg_data, size_t *msg_size, size_t *bytes_read, void *session)
{
session = session;
message_t *msg;
sheep_ptr_t *msgp = proc_messages + for_proc;
assert(!IS_SHEEP_NULL(msgp));
Expand All @@ -103,6 +104,7 @@ void get_message(int for_proc, void **msg_data, size_t *msg_size, size_t *bytes_

int has_message(int for_proc, void *session)
{
session=session;
sheep_ptr_t *msgp = proc_messages + for_proc;
return !IS_SHEEP_NULL(msgp);
}
Expand Down Expand Up @@ -209,6 +211,7 @@ int get_message_space(size_t msg_size, unsigned char **msg_space, void **header_

void update_bytes_read(int for_proc, size_t newval, void *session)
{
session=session;
message_t *msg;
sheep_ptr_t *msgp = proc_messages + for_proc;
assert(!IS_SHEEP_NULL(msgp));
Expand Down
2 changes: 1 addition & 1 deletion src/biter/demultiplex.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA

typedef struct msg_header_t {
uint32_t msg_size;
uint32_t msg_target;
int32_t msg_target;
} msg_header_t;

extern int test_pipe_lock(void *session);
Expand Down
7 changes: 7 additions & 0 deletions src/biter/linux_daemon_ids.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ int biterd_num_compute_nodes()

int biterd_ranks_in_cn(int cn_id)
{
cn_id=cn_id;
char *proc_s = getenv("PROCS");
if (proc_s)
return atoi(proc_s);
Expand All @@ -34,20 +35,26 @@ int biterd_ranks_in_cn(int cn_id)

int biterd_unique_num_for_cn(int cn_id)
{
cn_id=cn_id;
return 0;
}

int biterd_get_rank(int compute_node_id, int client_id)
{
compute_node_id=compute_node_id;
return client_id;
}

int biterd_register_rank(int session_id, uint32_t client_id, uint32_t rank)
{
session_id=session_id;
client_id=client_id;
rank=rank;
return 0;
}

int biterd_init_comms(const char *tmpdir)
{
tmpdir=tmpdir;
return 0;
}
10 changes: 10 additions & 0 deletions src/biter/server_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,41 +45,49 @@ void init_queue(int num_procs, void *session)

int test_pipe_lock(void *session)
{
session=session;
return 1;
}

int release_pipe_lock(void *session)
{
session=session;
return 0;
}

int take_queue_lock(void *session)
{
session=session;
return 0;
}

int release_queue_lock(void *session)
{
session=session;
return 0;
}

int take_write_lock(void *session)
{
session=session;
return 0;
}

int release_write_lock(void *session)
{
session=session;
return 0;
}

int take_pipe_lock(void *session)
{
session=session;
return 0;
}

void get_message(int for_proc, void **msg_data, size_t *msg_size, size_t *bytes_read, void *session)
{
session=session;
message_t *msg = PROC_MESSAGES[for_proc];
assert(msg);

Expand All @@ -90,6 +98,7 @@ void get_message(int for_proc, void **msg_data, size_t *msg_size, size_t *bytes_

int has_message(int for_proc, void *session)
{
session=session;
return PROC_MESSAGES[for_proc] != NULL;
}

Expand Down Expand Up @@ -124,6 +133,7 @@ int enqueue_message(int for_proc, void *msg_data, size_t msg_size, void *header_

int get_message_space(size_t msg_size, unsigned char **msg_space, void **header_space, void *session)
{
session=session;
*msg_space = (unsigned char *) malloc(msg_size);
*header_space = malloc(sizeof(message_t));
return 0;
Expand Down
11 changes: 6 additions & 5 deletions src/biter/shmutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#if !defined(SHMUTIL_H_)
#define SHMUTIL_H_

#include <sys/types.h>
#include "sheep.h"
#include "spindle_launch.h"

typedef struct {
volatile unsigned long *lock;
volatile unsigned long *held_by;
volatile pid_t *lock;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave 'lock' an unsigned long (or a uint64_t). Same with the other 'lock' variables below.

held_by can remain a pid_t

volatile pid_t *held_by;
int ref_count;
} lock_t;

typedef struct {
volatile int cur_id;
unsigned long locks[2];
pid_t locks[2];
} base_header_t;

#include "demultiplex.h"
Expand All @@ -43,11 +44,11 @@ typedef struct {
int num_ranks;
int read_file;
int num_started;
unsigned long locks[6];
pid_t locks[6];
} biter_header_t;

typedef struct {
unsigned long locks[2];
pid_t locks[2];
sheep_ptr_t hash;
sheep_ptr_t lru_head;
sheep_ptr_t lru_end;
Expand Down
4 changes: 4 additions & 0 deletions src/client/auditclient/auditclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern void restore_pathpatch();

unsigned int spindle_la_version(unsigned int version)
{
version=version;
patchDTV_init();
return 1;
}
Expand All @@ -51,6 +52,8 @@ void spindle_la_activity (uintptr_t *cookie, unsigned int flag)

unsigned int spindle_la_objopen(struct link_map *map, Lmid_t lmid, uintptr_t *cookie)
{
lmid=lmid;
cookie=cookie;
char buffer[4096];
char *exe_name, *exe_name2;

Expand All @@ -73,5 +76,6 @@ unsigned int spindle_la_objopen(struct link_map *map, Lmid_t lmid, uintptr_t *co

unsigned int spindle_la_objclose(uintptr_t *cookie)
{
cookie=cookie;
return 0;
}
7 changes: 7 additions & 0 deletions src/client/auditclient/auditclient_x86_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ Elf64_Addr la_x86_64_gnu_pltenter(Elf64_Sym *sym,
const char *symname,
long int *framesizep)
{
ndx=ndx;
defcook=defcook;
flags=flags;
framesizep=framesizep;
struct link_map *map = get_linkmap_from_cookie(refcook);
unsigned long reloc_index = *((unsigned long *) (regs->lr_rsp-8));
Elf64_Addr target = client_call_binding(symname, sym->st_value);
Expand All @@ -53,6 +57,9 @@ uintptr_t la_symbind64(Elf64_Sym *sym, unsigned int ndx,
{
// struct link_map *rmap = get_linkmap_from_cookie(refcook);
// struct link_map *dmap = get_linkmap_from_cookie(defcook);
ndx=ndx;
refcook=refcook;
defcook=defcook;
updateDataBindingQueue(0);
Elf64_Addr target = client_call_binding(symname, sym->st_value);
*flags = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/client/auditclient/bindgot.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ Elf64_Addr doPermanentBinding_noidx(uintptr_t *refcook, uintptr_t *defcook,
Elf64_Addr target, const char *symname,
void *stack_begin, void *stack_end)
{
defcook=defcook;
int plt_reloc_idx;
Elf64_Rela *rels = NULL, *rel;
Elf64_Xword relsize = 0;
Expand Down Expand Up @@ -247,6 +248,7 @@ Elf64_Addr doPermanentBinding_idx(struct link_map *map,
Elf64_Addr target,
const char *symname)
{
symname=symname;
Elf64_Dyn *dynamic_section = map->l_ld;
Elf64_Addr *got_entry;
Elf64_Rela *rel = NULL;
Expand Down
7 changes: 4 additions & 3 deletions src/client/auditclient/writablegot.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ int add_wgot_library(struct link_map *map)
unsigned long rel_size = 0, relent_size = 0, relcount = 0, plt_gotsize = 0, start, end;
unsigned long datarels_size = 0, largest_datarel_target = 0, smallest_datarel_target = 0;
signed int i;
unsigned long j;
struct got_range_t *tmprange;


Expand Down Expand Up @@ -118,9 +119,9 @@ int add_wgot_library(struct link_map *map)
plt_gotsize = (relcount + EXTRA_GOT_ENTRIES + 1) * sizeof(void*);

if (datarels) {
for (i = 0; i < datarels_size / relent_size; i++) {
unsigned long target = datarels[i].r_offset + map->l_addr;
if (ELF64_R_TYPE(datarels[i].r_info) != DATA_GOT_TYPE)
for (j = 0; j < datarels_size / relent_size; j++) {
unsigned long target = datarels[j].r_offset + map->l_addr;
if (ELF64_R_TYPE(datarels[j].r_info) != DATA_GOT_TYPE)
continue;
largest_datarel_target = MAX(target, largest_datarel_target);
if (!smallest_datarel_target) smallest_datarel_target = target;
Expand Down
1 change: 1 addition & 0 deletions src/client/beboot/spindle_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ static void get_clientlib()

void test_log(const char *name)
{
name=name;
}

static int handle_exec_failure(char **cmdline, int errno_val)
Expand Down
2 changes: 2 additions & 0 deletions src/client/client/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ static char *concatStrings(const char *str1, const char *str2)
static int find_libs_iterator(struct dl_phdr_info *lib,
size_t size, void *data)
{
size=size;
data=data;
if (!libc_name && (strstr(lib->dlpi_name, "libc.") || strstr(lib->dlpi_name, "libc-"))) {
libc_name = lib->dlpi_name;
libc_phdrs = lib->dlpi_phdr;
Expand Down
10 changes: 6 additions & 4 deletions src/client/client/intercept_readlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ static int fix_local_readlink(char *buf, size_t bufsiz)
ssize_t readlink_wrapper(const char *path, char *buf, size_t bufsiz)
{
char resultpath[MAX_PATH_LEN+1];
int intercept_result, result, len, readlink_errcode;
int intercept_result, result, readlink_errcode;
size_t len;
ssize_t rl_result;

check_for_fork();
Expand Down Expand Up @@ -117,15 +118,16 @@ ssize_t readlink_wrapper(const char *path, char *buf, size_t bufsiz)
if (len > bufsiz)
len = bufsiz;
memcpy(buf, resultpath, len);
debug_printf2("spindle readlink translated %s to %.*s with len %d\n", path, len, buf, len);
debug_printf2("spindle readlink translated %s to %.*s with len %zu\n", path, (int)len, buf, len);
return len;
}

ssize_t readlinkat_wrapper(int dirfd, const char *path, char *buf, size_t bufsiz)
{
char newbuf[MAX_PATH_LEN+1];
ssize_t rl_result;
int result, len;
size_t len;
int result;

debug_printf2("Intercepted readlinkat on %s\n", path);

Expand All @@ -147,6 +149,6 @@ ssize_t readlinkat_wrapper(int dirfd, const char *path, char *buf, size_t bufsiz
if (len > bufsiz)
len = bufsiz;
memcpy(buf, newbuf, len);
debug_printf2("spindle readlink translated %s to %.*s with len %d\n", path, len, newbuf, len);
debug_printf2("spindle readlink translated %s to %.*s with len %zu\n", path, (int)len, newbuf, len);
return (ssize_t) len;
}
2 changes: 2 additions & 0 deletions src/client/client/intercept_stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ int rtcache_fxstat64(int vers, int fd, struct stat *buf)
static int *ldso_errno;
int ldso_xstat(int ver, const char *filename, struct stat *buf)
{
ver=ver;
int result;
result = handle_stat(filename, buf, FROM_LDSO);
if (result != 0) {
Expand All @@ -273,6 +274,7 @@ int ldso_xstat(int ver, const char *filename, struct stat *buf)

int ldso_lxstat(int ver, const char *filename, struct stat *buf)
{
ver=ver;
int result;
result = handle_stat(filename, buf, FROM_LDSO | IS_LSTAT);
if (result != 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/client/client/realpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ realpath_stk (const char *name, char *resolved, struct realpath_bufs *bufs)

/* Length of this file name component; it can be zero if a file
name ends in '/'. */
long startlen = end - start;
size_t startlen = end - start;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is copied from the libc implementation of realpath (we're both LGPL, so that's okay). Would rather leave the body of libc's realpath as unmodified as possible.


if (startlen == 0)
break;
Expand All @@ -365,7 +365,7 @@ realpath_stk (const char *name, char *resolved, struct realpath_bufs *bufs)
if (!ISSLASH (dest[-1]))
*dest++ = '/';

while (rname + bufs->rname.length - dest
while ( (size_t)(rname + bufs->rname.length - dest)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above for not modifying realpath if not necessary

< startlen + sizeof dir_suffix)
{
long dest_offset = dest - rname;
Expand Down
Loading