Print this page
10100 Illumos is confused about calloc() arguments

*** 21,33 **** /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ ! #pragma ident "%Z%%M% %I% %E% SMI" - #include <stdlib.h> #include <stdio.h> #include <string.h> #include <proc_service.h> #include <link.h> --- 21,34 ---- /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ ! /* ! * Copyright (c) 2018, Joyent, Inc. ! */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <proc_service.h> #include <link.h>
*** 160,170 **** rd_new(struct ps_prochandle *php) { rd_agent_t *rap; LOG(ps_plog(MSG_ORIG(MSG_DB_RDNEW), php)); ! if ((rap = (rd_agent_t *)calloc(sizeof (rd_agent_t), 1)) == NULL) return (0); rap->rd_psp = php; (void) mutex_init(&rap->rd_mutex, USYNC_THREAD, 0); if (rd_reset(rap) != RD_OK) { --- 161,171 ---- rd_new(struct ps_prochandle *php) { rd_agent_t *rap; LOG(ps_plog(MSG_ORIG(MSG_DB_RDNEW), php)); ! if ((rap = (rd_agent_t *)calloc(1, sizeof (rd_agent_t))) == NULL) return (0); rap->rd_psp = php; (void) mutex_init(&rap->rd_mutex, USYNC_THREAD, 0); if (rd_reset(rap) != RD_OK) {