Changeset 24

Show
Ignore:
Timestamp:
04/29/08 12:27:59 (7 months ago)
Author:
jtang
Message:

Fixed compile warnings; fixed double free within Java finalizer for Sipc.class.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libsipc.spec

    r21 r24  
    1818between processes, as is shown with the SIPC library. 
    1919 
    20 %define JAVA_HOME /usr/java/jdk1.5.0_15 
     20%define JAVA_HOME /usr/java/default 
     21%define JFLAGS -target 1.5 
    2122 
    2223%prep 
     
    2526%build 
    2627make %{?_smp_mflags} 
    27 make JAVA_HOME=%{JAVA_HOME} JAVAC=%{JAVA_HOME}/bin/javac JAR=%{JAVA_HOME}/bin/jar binding 
     28make JAVA_HOME="%{JAVA_HOME}" JFLAGS="%{JFLAGS}" binding 
    2829 
    2930%install 
     
    5758 
    5859%changelog 
    59 * Fri Apr 11 2008 Jason Tang <selinux@tresys.com> 1.0-0 
     60* Tue Apr 29 2008 Jason Tang <selinux@tresys.com> 1.0-0 
    6061- Initial release. 
  • trunk/libsipc/Makefile

    r20 r24  
    1414 
    1515override CFLAGS += -Wall -Wundef -Wmissing-noreturn -D_GNU_SOURCE -fpic 
     16# -Werror -Wwrite-strings  -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wswitch -Wshadow -Wcast-align 
    1617INCLUDEDIRS := -I$(shell pwd)/include 
    1718LIBDIRS := -L$(shell pwd)/src 
  • trunk/libsipc/bindings/java/Makefile

    r21 r24  
    1010 
    1111CLASSES = $(patsubst %.java,%.class,$(SRC)) 
    12 JAVAC ?= javac 
    13 JAR ?= jar 
     12JAVA_HOME ?= /usr/java/default 
     13JAVAC ?= $(JAVA_HOME)/bin/javac 
     14JAR ?= $(JAVA_HOME)/bin/jar 
    1415 
    15 # Change the following values to be appropriate for your system: 
     16# Change the following to be appropriate for your system: 
    1617# 
    1718# JNI_CFLAGS:   Location of JNI include files. 
  • trunk/libsipc/bindings/java/com/tresys/sipc/Sipc.java

    r23 r24  
    8484 
    8585        /** 
    86          * Destroy an IPC handle. This function only destroys the resources 
    87          * associated with the handle itself; call  
     86         * Destroy an IPC handle. This function only destroys the 
     87         * resources associated with the handle itself; call 
     88         * Disconnect() to first disconnect. 
    8889         */ 
    8990        private void DestroyHandle() { 
  • trunk/libsipc/bindings/java/sipc_wrap.c

    r21 r24  
    239239  (void)jenv; 
    240240  (void)jcls; 
    241   arg1 = *(sipc_t **)&jarg1;  
     241  arg1 = *(sipc_t **)&jarg1; 
     242  /* Note that sipc_close() is also called by the JNI function 
     243   * sipc_disconnect(), so to prevent a double free don't do that 
     244   * here. 
     245   * 
    242246  sipc_close(arg1); 
     247   */ 
    243248} 
    244249 
  • trunk/libsipc/examples/mq_creator.c

    r21 r24  
    3131#define SIPC_KEY "sipc_mq_test" 
    3232 
    33 int main(
     33int main(void
    3434{ 
    3535        sipc_t *sipc; 
  • trunk/libsipc/examples/mq_destroyer.c

    r21 r24  
    3434#define SIPC_KEY "sipc_mq_test"   
    3535 
    36 int main(
     36int main(void
    3737{ 
    3838        sipc_unlink(SIPC_KEY, SIPC_SYSV_MQUEUES); 
  • trunk/libsipc/examples/mq_reader.c

    r21 r24  
    4141static int END_XMIT(char *); 
    4242 
    43 int main(
     43int main(void
    4444{ 
    4545        int msglen = 0; 
  • trunk/libsipc/examples/mq_sender.c

    r21 r24  
    4949static int send_end_xmit(sipc_t *ipc);   
    5050 
    51 int main(
     51int main(void
    5252{ 
    5353        int retv = -1; 
  • trunk/libsipc/examples/shm_creator.c

    r21 r24  
    3737#define READ_LEN 4096         
    3838                                            
    39 int main(
     39int main(void
    4040{ 
    4141        sipc_t *sipc; 
  • trunk/libsipc/examples/shm_destroyer.c

    r21 r24  
    3434#define SIPC_KEY "sipc_shm_test"   
    3535 
    36 int main(
     36int main(void
    3737{ 
    3838        sipc_unlink(SIPC_KEY, SIPC_SYSV_SHM); 
  • trunk/libsipc/examples/shm_reader.c

    r21 r24  
    4141static int is_end_xmit(char *data); 
    4242 
    43 int main(
     43int main(void
    4444{ 
    4545        char *data = NULL; 
  • trunk/libsipc/examples/shm_sender.c

    r21 r24  
    4545static void send_end_xmit(sipc_t *sipc); 
    4646 
    47 int main(
     47int main(void
    4848{ 
    4949        int rbytes = 0; 
  • trunk/libsipc/include/sipc/sipc.h

    r21 r24  
    5353 *      the sipc_t struct.  Caller must call sipc_close to free the memory. 
    5454 */ 
    55 sipc_t *sipc_open(char *key, int role, int ipc_type, size_t size);  
     55sipc_t *sipc_open(const char *key, int role, int ipc_type, size_t size);  
    5656 
    5757/* Free the sipc struct and its contents */ 
     
    6060/* Called by a helper application to destroy an IPC resource. 
    6161 * This function should *NOT* be called by normal users of the library. */ 
    62 void sipc_unlink(char *key, int ipc_type); 
     62void sipc_unlink(const char *key, int ipc_type); 
    6363 
    6464/* Blocking call to send msglen bytes of data.  
  • trunk/libsipc/src/mqueue_internal.c

    r21 r24  
    2727#include <errno.h> 
    2828#include <fcntl.h> 
    29 #include "sipc_internal.h" 
    30 #include "sipc_mqueue.h" 
     29#include "mqueue_internal.h" 
     30 
     31#define hidden __attribute__ ((visibility ("hidden"))) 
    3132 
    3233/* Everyone can r/w this queue, SELinux will protect it */ 
  • trunk/libsipc/src/sipc.c

    r21 r24  
    3434}; 
    3535 
    36 sipc_t *sipc_open(char *key, int role, int ipc_type, size_t len) 
     36sipc_t *sipc_open(const char *key, int role, int ipc_type, size_t len) 
    3737{ 
    3838        sipc_t *new_sipc = NULL; 
     
    9595} 
    9696 
    97 void sipc_unlink(char *key, int ipc_type) 
     97void sipc_unlink(const char *key, int ipc_type) 
    9898{ 
    9999        key_t sipc_key;