Changeset 24
- 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
| r21 |
r24 |
|
| 18 | 18 | between processes, as is shown with the SIPC library. |
|---|
| 19 | 19 | |
|---|
| 20 | | %define JAVA_HOME /usr/java/jdk1.5.0_15 |
|---|
| | 20 | %define JAVA_HOME /usr/java/default |
|---|
| | 21 | %define JFLAGS -target 1.5 |
|---|
| 21 | 22 | |
|---|
| 22 | 23 | %prep |
|---|
| … | … | |
| 25 | 26 | %build |
|---|
| 26 | 27 | make %{?_smp_mflags} |
|---|
| 27 | | make JAVA_HOME=%{JAVA_HOME} JAVAC=%{JAVA_HOME}/bin/javac JAR=%{JAVA_HOME}/bin/jar binding |
|---|
| | 28 | make JAVA_HOME="%{JAVA_HOME}" JFLAGS="%{JFLAGS}" binding |
|---|
| 28 | 29 | |
|---|
| 29 | 30 | %install |
|---|
| … | … | |
| 57 | 58 | |
|---|
| 58 | 59 | %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 |
|---|
| 60 | 61 | - Initial release. |
|---|
| r20 |
r24 |
|
| 14 | 14 | |
|---|
| 15 | 15 | override 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 |
|---|
| 16 | 17 | INCLUDEDIRS := -I$(shell pwd)/include |
|---|
| 17 | 18 | LIBDIRS := -L$(shell pwd)/src |
|---|
| r21 |
r24 |
|
| 10 | 10 | |
|---|
| 11 | 11 | CLASSES = $(patsubst %.java,%.class,$(SRC)) |
|---|
| 12 | | JAVAC ?= javac |
|---|
| 13 | | JAR ?= jar |
|---|
| | 12 | JAVA_HOME ?= /usr/java/default |
|---|
| | 13 | JAVAC ?= $(JAVA_HOME)/bin/javac |
|---|
| | 14 | JAR ?= $(JAVA_HOME)/bin/jar |
|---|
| 14 | 15 | |
|---|
| 15 | | # Change the following values to be appropriate for your system: |
|---|
| | 16 | # Change the following to be appropriate for your system: |
|---|
| 16 | 17 | # |
|---|
| 17 | 18 | # JNI_CFLAGS: Location of JNI include files. |
|---|
| r23 |
r24 |
|
| 84 | 84 | |
|---|
| 85 | 85 | /** |
|---|
| 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. |
|---|
| 88 | 89 | */ |
|---|
| 89 | 90 | private void DestroyHandle() { |
|---|
| r21 |
r24 |
|
| 239 | 239 | (void)jenv; |
|---|
| 240 | 240 | (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 | * |
|---|
| 242 | 246 | sipc_close(arg1); |
|---|
| | 247 | */ |
|---|
| 243 | 248 | } |
|---|
| 244 | 249 | |
|---|
| r21 |
r24 |
|
| 31 | 31 | #define SIPC_KEY "sipc_mq_test" |
|---|
| 32 | 32 | |
|---|
| 33 | | int main() |
|---|
| | 33 | int main(void) |
|---|
| 34 | 34 | { |
|---|
| 35 | 35 | sipc_t *sipc; |
|---|
| r21 |
r24 |
|
| 34 | 34 | #define SIPC_KEY "sipc_mq_test" |
|---|
| 35 | 35 | |
|---|
| 36 | | int main() |
|---|
| | 36 | int main(void) |
|---|
| 37 | 37 | { |
|---|
| 38 | 38 | sipc_unlink(SIPC_KEY, SIPC_SYSV_MQUEUES); |
|---|
| r21 |
r24 |
|
| 41 | 41 | static int END_XMIT(char *); |
|---|
| 42 | 42 | |
|---|
| 43 | | int main() |
|---|
| | 43 | int main(void) |
|---|
| 44 | 44 | { |
|---|
| 45 | 45 | int msglen = 0; |
|---|
| r21 |
r24 |
|
| 49 | 49 | static int send_end_xmit(sipc_t *ipc); |
|---|
| 50 | 50 | |
|---|
| 51 | | int main() |
|---|
| | 51 | int main(void) |
|---|
| 52 | 52 | { |
|---|
| 53 | 53 | int retv = -1; |
|---|
| r21 |
r24 |
|
| 37 | 37 | #define READ_LEN 4096 |
|---|
| 38 | 38 | |
|---|
| 39 | | int main() |
|---|
| | 39 | int main(void) |
|---|
| 40 | 40 | { |
|---|
| 41 | 41 | sipc_t *sipc; |
|---|
| r21 |
r24 |
|
| 34 | 34 | #define SIPC_KEY "sipc_shm_test" |
|---|
| 35 | 35 | |
|---|
| 36 | | int main() |
|---|
| | 36 | int main(void) |
|---|
| 37 | 37 | { |
|---|
| 38 | 38 | sipc_unlink(SIPC_KEY, SIPC_SYSV_SHM); |
|---|
| r21 |
r24 |
|
| 41 | 41 | static int is_end_xmit(char *data); |
|---|
| 42 | 42 | |
|---|
| 43 | | int main() |
|---|
| | 43 | int main(void) |
|---|
| 44 | 44 | { |
|---|
| 45 | 45 | char *data = NULL; |
|---|
| r21 |
r24 |
|
| 45 | 45 | static void send_end_xmit(sipc_t *sipc); |
|---|
| 46 | 46 | |
|---|
| 47 | | int main() |
|---|
| | 47 | int main(void) |
|---|
| 48 | 48 | { |
|---|
| 49 | 49 | int rbytes = 0; |
|---|
| r21 |
r24 |
|
| 53 | 53 | * the sipc_t struct. Caller must call sipc_close to free the memory. |
|---|
| 54 | 54 | */ |
|---|
| 55 | | sipc_t *sipc_open(char *key, int role, int ipc_type, size_t size); |
|---|
| | 55 | sipc_t *sipc_open(const char *key, int role, int ipc_type, size_t size); |
|---|
| 56 | 56 | |
|---|
| 57 | 57 | /* Free the sipc struct and its contents */ |
|---|
| … | … | |
| 60 | 60 | /* Called by a helper application to destroy an IPC resource. |
|---|
| 61 | 61 | * This function should *NOT* be called by normal users of the library. */ |
|---|
| 62 | | void sipc_unlink(char *key, int ipc_type); |
|---|
| | 62 | void sipc_unlink(const char *key, int ipc_type); |
|---|
| 63 | 63 | |
|---|
| 64 | 64 | /* Blocking call to send msglen bytes of data. |
|---|
| r21 |
r24 |
|
| 27 | 27 | #include <errno.h> |
|---|
| 28 | 28 | #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"))) |
|---|
| 31 | 32 | |
|---|
| 32 | 33 | /* Everyone can r/w this queue, SELinux will protect it */ |
|---|
| r21 |
r24 |
|
| 34 | 34 | }; |
|---|
| 35 | 35 | |
|---|
| 36 | | sipc_t *sipc_open(char *key, int role, int ipc_type, size_t len) |
|---|
| | 36 | sipc_t *sipc_open(const char *key, int role, int ipc_type, size_t len) |
|---|
| 37 | 37 | { |
|---|
| 38 | 38 | sipc_t *new_sipc = NULL; |
|---|
| … | … | |
| 95 | 95 | } |
|---|
| 96 | 96 | |
|---|
| 97 | | void sipc_unlink(char *key, int ipc_type) |
|---|
| | 97 | void sipc_unlink(const char *key, int ipc_type) |
|---|
| 98 | 98 | { |
|---|
| 99 | 99 | key_t sipc_key; |
|---|
Download in other formats:
* Generating other formats may take time.