Merged revisions 77869 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r77869 | file | 2007-08-01 14:56:59 -0300 (Wed, 01 Aug 2007) | 2 lines

Add some fixes for building on Solaris.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77870 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Joshua Colp 18 years ago
parent 28fec17d59
commit d9aee5e353

@ -2082,7 +2082,7 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in
fprintf(p, "Subject: New message %d in mailbox %s" ENDL, msgnum + 1, mailbox); fprintf(p, "Subject: New message %d in mailbox %s" ENDL, msgnum + 1, mailbox);
else else
fprintf(p, "Subject: [PBX]: New message %d in mailbox %s" ENDL, msgnum + 1, mailbox); fprintf(p, "Subject: [PBX]: New message %d in mailbox %s" ENDL, msgnum + 1, mailbox);
fprintf(p, "Message-ID: <Asterisk-%d-%d-%s-%d@%s>" ENDL, msgnum + 1, (unsigned int)ast_random(), mailbox, getpid(), host); fprintf(p, "Message-ID: <Asterisk-%d-%d-%s-%d@%s>" ENDL, msgnum + 1, (unsigned int)ast_random(), mailbox, (int)getpid(), host);
if(imap) { if(imap) {
/* additional information needed for IMAP searching */ /* additional information needed for IMAP searching */
fprintf(p, "X-Asterisk-VM-Message-Num: %d" ENDL, msgnum + 1); fprintf(p, "X-Asterisk-VM-Message-Num: %d" ENDL, msgnum + 1);
@ -2108,7 +2108,7 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in
fprintf(p, "MIME-Version: 1.0" ENDL); fprintf(p, "MIME-Version: 1.0" ENDL);
if (attach_user_voicemail) { if (attach_user_voicemail) {
/* Something unique. */ /* Something unique. */
snprintf(bound, sizeof(bound), "----voicemail_%d%s%d%d", msgnum + 1, mailbox, getpid(), (unsigned int)ast_random()); snprintf(bound, sizeof(bound), "----voicemail_%d%s%d%d", msgnum + 1, mailbox, (int)getpid(), (unsigned int)ast_random());
fprintf(p, "Content-Type: multipart/mixed; boundary=\"%s\"" ENDL, bound); fprintf(p, "Content-Type: multipart/mixed; boundary=\"%s\"" ENDL, bound);
fprintf(p, ENDL ENDL "This is a multi-part message in MIME format." ENDL ENDL); fprintf(p, ENDL ENDL "This is a multi-part message in MIME format." ENDL ENDL);

@ -1511,7 +1511,7 @@ static void destroy_firmware(struct iax_firmware *cur)
{ {
/* Close firmware */ /* Close firmware */
if (cur->fwh) { if (cur->fwh) {
munmap(cur->fwh, ntohl(cur->fwh->datalen) + sizeof(*(cur->fwh))); munmap((void*)cur->fwh, ntohl(cur->fwh->datalen) + sizeof(*(cur->fwh)));
} }
close(cur->fd); close(cur->fd);
ast_free(cur); ast_free(cur);
@ -1607,7 +1607,7 @@ static int try_firmware(char *s)
close(fd); close(fd);
return -1; return -1;
} }
fwh = mmap(NULL, stbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0); fwh = (struct ast_iax2_firmware_header*)mmap(NULL, stbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if (fwh == (void *) -1) { if (fwh == (void *) -1) {
ast_log(LOG_WARNING, "mmap failed: %s\n", strerror(errno)); ast_log(LOG_WARNING, "mmap failed: %s\n", strerror(errno));
close(fd); close(fd);
@ -1618,7 +1618,7 @@ static int try_firmware(char *s)
MD5Final(sum, &md5); MD5Final(sum, &md5);
if (memcmp(sum, fwh->chksum, sizeof(sum))) { if (memcmp(sum, fwh->chksum, sizeof(sum))) {
ast_log(LOG_WARNING, "Firmware file '%s' fails checksum\n", s); ast_log(LOG_WARNING, "Firmware file '%s' fails checksum\n", s);
munmap(fwh, stbuf.st_size); munmap((void*)fwh, stbuf.st_size);
close(fd); close(fd);
return -1; return -1;
} }
@ -1631,7 +1631,7 @@ static int try_firmware(char *s)
break; break;
/* This version is no newer than what we have. Don't worry about it. /* This version is no newer than what we have. Don't worry about it.
We'll consider it a proper load anyhow though */ We'll consider it a proper load anyhow though */
munmap(fwh, stbuf.st_size); munmap((void*)fwh, stbuf.st_size);
close(fd); close(fd);
return 0; return 0;
} }
@ -1644,7 +1644,7 @@ static int try_firmware(char *s)
if (cur) { if (cur) {
if (cur->fwh) if (cur->fwh)
munmap(cur->fwh, cur->mmaplen); munmap((void*)cur->fwh, cur->mmaplen);
if (cur->fd > -1) if (cur->fd > -1)
close(cur->fd); close(cur->fd);
cur->fwh = fwh; cur->fwh = fwh;

@ -2061,7 +2061,7 @@ static int add_sdp(struct mgcp_request *resp, struct mgcp_subchannel *sub, struc
ast_verbose("We're at %s port %d\n", ast_inet_ntoa(p->parent->ourip), ntohs(sin.sin_port)); ast_verbose("We're at %s port %d\n", ast_inet_ntoa(p->parent->ourip), ntohs(sin.sin_port));
} }
snprintf(v, sizeof(v), "v=0\r\n"); snprintf(v, sizeof(v), "v=0\r\n");
snprintf(o, sizeof(o), "o=root %d %d IN IP4 %s\r\n", getpid(), getpid(), ast_inet_ntoa(dest.sin_addr)); snprintf(o, sizeof(o), "o=root %d %d IN IP4 %s\r\n", (int)getpid(), (int)getpid(), ast_inet_ntoa(dest.sin_addr));
snprintf(s, sizeof(s), "s=session\r\n"); snprintf(s, sizeof(s), "s=session\r\n");
snprintf(c, sizeof(c), "c=IN IP4 %s\r\n", ast_inet_ntoa(dest.sin_addr)); snprintf(c, sizeof(c), "c=IN IP4 %s\r\n", ast_inet_ntoa(dest.sin_addr));
snprintf(t, sizeof(t), "t=0 0\r\n"); snprintf(t, sizeof(t), "t=0 0\r\n");

@ -62,6 +62,12 @@ struct ast_threadstorage {
int (*custom_init)(void *); /*!< Custom initialization function specific to the object */ int (*custom_init)(void *); /*!< Custom initialization function specific to the object */
}; };
#ifdef SOLARIS
#define THREADSTORAGE_ONCE_INIT {PTHREAD_ONCE_INIT}
#else
#define THREADSTORAGE_ONCE_INIT PTHREAD_ONCE_INIT
#endif
#if defined(DEBUG_THREADLOCALS) #if defined(DEBUG_THREADLOCALS)
void __ast_threadstorage_object_add(void *key, size_t len, const char *file, const char *function, unsigned int line); void __ast_threadstorage_object_add(void *key, size_t len, const char *file, const char *function, unsigned int line);
void __ast_threadstorage_object_remove(void *key); void __ast_threadstorage_object_remove(void *key);
@ -103,7 +109,7 @@ void __ast_threadstorage_object_replace(void *key_old, void *key_new, size_t len
#define AST_THREADSTORAGE_CUSTOM(name, c_init, c_cleanup) \ #define AST_THREADSTORAGE_CUSTOM(name, c_init, c_cleanup) \
static void __init_##name(void); \ static void __init_##name(void); \
static struct ast_threadstorage name = { \ static struct ast_threadstorage name = { \
.once = PTHREAD_ONCE_INIT, \ .once = THREADSTORAGE_ONCE_INIT, \
.key_init = __init_##name, \ .key_init = __init_##name, \
.custom_init = c_init, \ .custom_init = c_init, \
}; \ }; \
@ -115,7 +121,7 @@ static void __init_##name(void) \
#define AST_THREADSTORAGE_CUSTOM(name, c_init, c_cleanup) \ #define AST_THREADSTORAGE_CUSTOM(name, c_init, c_cleanup) \
static void __init_##name(void); \ static void __init_##name(void); \
static struct ast_threadstorage name = { \ static struct ast_threadstorage name = { \
.once = PTHREAD_ONCE_INIT, \ .once = THREADSTORAGE_ONCE_INIT, \
.key_init = __init_##name, \ .key_init = __init_##name, \
.custom_init = c_init, \ .custom_init = c_init, \
}; \ }; \

@ -125,7 +125,7 @@ static char txqcheck (char *dir, char *queue, char subaddress, char *channel, ch
ql = p - queue; ql = p - queue;
subaddress = p[1]; subaddress = p[1];
} }
snprintf (temp, sizeof(temp), "sms/.smsq-%d", getpid ()); snprintf (temp, sizeof(temp), "sms/.smsq-%d", (int)getpid ());
f = fopen (temp, "w"); f = fopen (temp, "w");
if (!f) if (!f)
{ {
@ -196,7 +196,7 @@ static void rxqcheck (char *dir, char *queue, char *process)
DIR *d; DIR *d;
int ql = strlen (queue); int ql = strlen (queue);
struct dirent *fn; struct dirent *fn;
snprintf(temp, sizeof(temp), "sms/.smsq-%d", getpid ()); snprintf(temp, sizeof(temp), "sms/.smsq-%d", (int)getpid ());
snprintf(dirname, sizeof(dirname), "sms/%s", dir); snprintf(dirname, sizeof(dirname), "sms/%s", dir);
d = opendir (dirname); d = opendir (dirname);
if (!d) if (!d)
@ -673,10 +673,10 @@ main (int argc, const char *argv[])
queuename[100], queuename[100],
*dir = (mo ? rx ? "sms/morx" : "sms/motx" : rx ? "sms/mtrx" : "sms/mttx"); *dir = (mo ? rx ? "sms/morx" : "sms/motx" : rx ? "sms/mtrx" : "sms/mttx");
FILE *f; FILE *f;
snprintf (temp, sizeof(temp), "sms/.smsq-%d", getpid ()); snprintf (temp, sizeof(temp), "sms/.smsq-%d", (int)getpid ());
mkdir ("sms", 0777); /* ensure directory exists */ mkdir ("sms", 0777); /* ensure directory exists */
mkdir (dir, 0777); /* ensure directory exists */ mkdir (dir, 0777); /* ensure directory exists */
snprintf (queuename, sizeof(queuename), "%s/%s.%ld-%d", dir, *queue ? queue : "0", (long)time (0), getpid ()); snprintf (queuename, sizeof(queuename), "%s/%s.%ld-%d", dir, *queue ? queue : "0", (long)time (0), (int)getpid ());
f = fopen (temp, "w"); f = fopen (temp, "w");
if (!f) if (!f)
{ {

Loading…
Cancel
Save