diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-10-01 15:39:49 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-10-01 15:59:22 +0200 |
commit | e64697e4abda6c7ef512f4a2948c0d777d668be9 (patch) | |
tree | c9307d06b177dbf6da5e8acb92eeab4bd86118ed /ipc/mach_msg.c | |
parent | 922e514ad93bf21985659ad10a96019a20ad4c10 (diff) | |
download | gnumach-e64697e4abda6c7ef512f4a2948c0d777d668be9.tar.gz gnumach-e64697e4abda6c7ef512f4a2948c0d777d668be9.tar.bz2 gnumach-e64697e4abda6c7ef512f4a2948c0d777d668be9.zip |
Add and use ikm_cache_alloc/free/_try
Diffstat (limited to 'ipc/mach_msg.c')
-rw-r--r-- | ipc/mach_msg.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/ipc/mach_msg.c b/ipc/mach_msg.c index 46218bb6..482c85a5 100644 --- a/ipc/mach_msg.c +++ b/ipc/mach_msg.c @@ -452,12 +452,12 @@ mach_msg_trap( if ((send_size > IKM_SAVED_MSG_SIZE) || (send_size < sizeof(mach_msg_user_header_t)) || - (send_size & 3) || - ((kmsg = ikm_cache()) == IKM_NULL)) + (send_size & 3)) goto slow_get; - ikm_cache() = IKM_NULL; - ikm_check_initialized(kmsg, IKM_SAVED_KMSG_SIZE); + kmsg = ikm_cache_alloc_try(); + if (kmsg == IKM_NULL) + goto slow_get; if (copyinmsg(msg, &kmsg->ikm_header, send_size)) { @@ -1176,11 +1176,12 @@ mach_msg_trap( if ((kmsg->ikm_size != IKM_SAVED_KMSG_SIZE) || copyoutmsg(&kmsg->ikm_header, msg, - reply_size) || - (ikm_cache() != IKM_NULL)) + reply_size)) + goto slow_put; + + if (!ikm_cache_free_try(kmsg)) goto slow_put; - ikm_cache() = kmsg; thread_syscall_return(MACH_MSG_SUCCESS); /*NOTREACHED*/ return MACH_MSG_SUCCESS; /* help for the compiler */ |