Commit 15f8fdf9 authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Minor changes due to merge

parents 0162ebf0 c6d9ee47
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -34,7 +34,12 @@ src_urd_SOURCES = \

src_urd_CXXFLAGS = 				\
	@TBB_CFLAGS@ 				\
	@LIBEV_CFLAGS@				\
	-std=gnu++11 -Wall -Wextra

src_urd_CPPFLAGS = 				\
	-I$(top_srcdir)/include

src_urd_LDFLAGS = \
	@TBB_LIBS@
	@LIBEV_LIBS@
+9 −0
Original line number Diff line number Diff line
@@ -47,6 +47,15 @@ AX_CHECK_COMPILE_FLAG([-std=c++11], [CXXFLAGS+=" -std=c++11"], [

# check that Intel's TBB
PKG_CHECK_MODULES([TBB], [tbb])
# check libev
PKG_CHECK_MODULES([LIBEV], [libev],
                  [], # action if found
                  [AC_SEARCH_LIBS([ev_version_major], [ev], [], [
                       AC_MSG_ERROR([Unable to find the libev library])
                   ])
                  ])



# Checks for header files.

+5 −3
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@

int main() {
    printf("Hello, World! I'm the app \n");
   norns_init();
    if( push_job() < 0 ){
    	printf("Error with push job \n");
    }
    return 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ enum {
    NORNS_MOVE
};

void norns_init() __THROW __nonnull ((1));
void norns_init() __THROW;

/* Enqueue an asynchronous I/O task */
int norns_transfer(struct norns_iotd* iotdp) __THROW __nonnull((1));
+42 −46
Original line number Diff line number Diff line
@@ -31,70 +31,66 @@

#include <norns.h>

#define SOCKET_NAME "urd_socket" 
const char* SOCKET_FILE = "/tmp/urd.socket";

struct task{
	pid_t pid;
	uint64_t taskId;
	const char *filePath;
};

void norns_init(){
/* Global variables */
int sock;
char buff[10] = "hola";

/* Function declaration */

/* Specify init and finit function as constructor and destructor */

__attribute__((constructor)) static void __norns_init(void);
__attribute__((destructor)) static void __norns_finit(void); 


void __norns_init(){

	struct sockaddr_un server;
	char buff[1024] = "hola";
	struct task t;
	t.pid = 3;
	t.taskId = 4;

	sock = socket(AF_UNIX, SOCK_STREAM, 0);
	if (sock < 0) {
		perror("opening stream socket");
		exit(1);
		exit(EXIT_FAILURE);
	}

	server.sun_family = AF_UNIX;
	strcpy(server.sun_path, SOCKET_NAME);
	strncpy(server.sun_path, SOCKET_FILE, sizeof(server.sun_path));
	/*if (strncpy(server.sun_path, SOCKET_FILE, sizeof(server.sun_path)) < 0){
		perror("strncpy");
		exit(EXIT_FAILURE);
	}*/

	if (connect(sock, (struct sockaddr *) &server, sizeof(struct sockaddr_un)) < 0) {
        if (close(sock) < 0)
        	exit(1);
        perror("connecting stream socket");
        exit(1);
        if (close(sock) < 0){
        	exit(EXIT_FAILURE);
        }
    if (write(sock, &t, sizeof(t)) < 0)
        perror("writing on stream socket");
    close(sock);
        perror("connecting stream socket");
        exit(EXIT_FAILURE);
    }

/* Enqueue an asynchronous I/O task */
int norns_transfer(struct norns_iotd *iotdp) {
    (void) iotdp;
    return 0;
}

/* Try to cancel an asynchronous I/O task associated with iotdp */
ssize_t norns_cancel(struct norns_iotd *iotdp) { 
    (void) iotdp;
    return 0;
void __norns_finit(void){
	/*
	 * 
	 */
	printf("Executing this when the library is unloaded\n");
	close(sock);
}

/* Retrieve return status associated with iotdp */
ssize_t norns_return(struct norns_iotd *iotdp) {
    (void) iotdp;
    return 0;
}
int push_job(){
	/*
	 * return -1 on error
	 */
	
/* Retrieve current status associated with iotdp */
ssize_t norns_progress(struct norns_iotd *iotdp) {
    (void) iotdp;
    return 0;
}
	struct norns_iotd t;
	t.ni_tid = 1234;
	t.ni_ibid = 4321;

/* Retrieve error status associated with iotdp */
int norns_error(struct norns_iotd *iotdp) {
    (void) iotdp;
    return 0;
	if (write(sock, &t, sizeof(t)) < 0){
        perror("writing on stream socket");
    }
    close(sock);
}

Loading