/*
- * Copyright (c) 2003-2017 Apple Inc. All rights reserved.
+ * Copyright (c) 2003-2020 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
/* see comments in sock_setupcall() */
if (callback != NULL) {
-#if CONFIG_EMBEDDED
+#if (defined(__arm__) || defined(__arm64__))
sock_setupcalls_locked(new_so, callback, cookie, callback, cookie, 0);
-#else
+#else /* (defined(__arm__) || defined(__arm64__)) */
sock_setupcalls_locked(new_so, callback, cookie, NULL, NULL, 0);
-#endif /* !CONFIG_EMBEDDED */
+#endif /* (defined(__arm__) || defined(__arm64__)) */
}
if (sa != NULL && from != NULL) {
sopt.sopt_p = kernproc;
error = sogetoptlock(sock, &sopt, 1); /* will lock socket */
if (error == 0) {
- *optlen = sopt.sopt_valsize;
+ *optlen = (uint32_t)sopt.sopt_valsize;
}
return error;
}
* This follows the recommended mappings between DSCP code points
* and WMM access classes.
*/
-static u_int32_t so_tc_from_dscp(u_int8_t dscp);
-static u_int32_t
-so_tc_from_dscp(u_int8_t dscp)
+static uint32_t
+so_tc_from_dscp(uint8_t dscp)
{
- u_int32_t tc;
+ uint32_t tc;
if (dscp >= 0x30 && dscp <= 0x3f) {
tc = SO_TC_VO;
* Set the socket traffic class based on the passed DSCP code point
* regardless of the scope of the destination
*/
- sotc = so_tc_from_dscp((*(const int *)optval) >> 2);
+ sotc = so_tc_from_dscp((uint8_t)((*(const int *)optval) >> 2));
sopt.sopt_dir = SOPT_SET;
sopt.sopt_val = CAST_USER_ADDR_T(&sotc);
uio_t auio;
struct mbuf *control = NULL;
int error = 0;
- int length = 0;
+ user_ssize_t length = 0;
struct sockaddr *fromsa = NULL;
char uio_buf[UIO_SIZEOF((msg != NULL) ? msg->msg_iovlen : 0)];
m = m->m_next;
}
msg->msg_controllen =
- (uintptr_t)ctlbuf - (uintptr_t)msg->msg_control;
+ (socklen_t)((uintptr_t)ctlbuf - (uintptr_t)msg->msg_control);
}
}
uio_t auio = NULL;
struct mbuf *control = NULL;
int error = 0;
- int datalen = 0;
+ user_ssize_t datalen = 0;
char uio_buf[UIO_SIZEOF((msg != NULL ? msg->msg_iovlen : 1))];
if (sock == NULL) {
* the read and write callbacks and their respective parameters.
*/
socket_lock(sock, 1);
-#if CONFIG_EMBEDDED
+#if (defined(__arm__) || defined(__arm64__))
sock_setupcalls_locked(sock, callback, context, callback, context, 0);
-#else
+#else /* (defined(__arm__) || defined(__arm64__)) */
sock_setupcalls_locked(sock, callback, context, NULL, NULL, 0);
-#endif /* !CONFIG_EMBEDDED */
+#endif /* (defined(__arm__) || defined(__arm64__)) */
socket_unlock(sock, 1);
return 0;
void
sock_catchevents_locked(socket_t sock, sock_evupcall ecallback, void *econtext,
- u_int32_t emask)
+ long emask)
{
socket_lock_assert_owned(sock);
if (ecallback != NULL) {
sock->so_event = ecallback;
sock->so_eventarg = econtext;
- sock->so_eventmask = emask;
+ sock->so_eventmask = (uint32_t)emask;
} else {
sock->so_event = sonullevent;
sock->so_eventarg = NULL;
errno_t
sock_catchevents(socket_t sock, sock_evupcall ecallback, void *econtext,
- u_int32_t emask)
+ long emask)
{
if (sock == NULL) {
return EINVAL;