Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
a457be31
Commit
a457be31
authored
Feb 16, 2012
by
Chuck Remes
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #246 from pieterh/arguments
Return EFAULT if required arguments are null
parents
9321dfb8
8a497e2f
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
61 additions
and
23 deletions
+61
-23
zmq_msg_size.txt
doc/zmq_msg_size.txt
+12
-4
zmq.h
include/zmq.h
+2
-2
inproc_lat.cpp
perf/inproc_lat.cpp
+2
-2
inproc_thr.cpp
perf/inproc_thr.cpp
+2
-2
local_lat.cpp
perf/local_lat.cpp
+2
-2
local_thr.cpp
perf/local_thr.cpp
+2
-2
remote_lat.cpp
perf/remote_lat.cpp
+2
-2
zmq.cpp
src/zmq.cpp
+37
-7
No files found.
doc/zmq_msg_size.txt
View file @
a457be31
...
...
@@ -9,7 +9,7 @@ zmq_msg_size - retrieve message content size in bytes
SYNOPSIS
--------
*size_t zmq_msg_size (zmq_msg_t '*msg');*
*s
s
ize_t zmq_msg_size (zmq_msg_t '*msg');*
DESCRIPTION
...
...
@@ -29,7 +29,15 @@ message content in bytes.
ERRORS
------
No errors are defined.
The _zmq_msg_size()_ function shall return a positive integer (0 or higher)
if successful. Otherwise it shall return `-1` and set 'errno' to one of the
values defined below.
ERRORS
------
*EFAULT*::
The provided 'msg' was NULL.
SEE ALSO
...
...
@@ -44,5 +52,5 @@ linkzmq:zmq[7]
AUTHORS
-------
This 0MQ manual page was written by Martin Sustrik <sustrik@250bpm.com>
and
Martin Lucina <mato@kotelna.sk>.
This 0MQ manual page was written by Martin Sustrik <sustrik@250bpm.com>
,
Martin Lucina <mato@kotelna.sk>
, and Pieter Hintjens <ph@imatix.com>
.
include/zmq.h
View file @
a457be31
...
...
@@ -29,6 +29,7 @@ extern "C" {
#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#if defined _WIN32
#include <winsock2.h>
#endif
...
...
@@ -167,14 +168,13 @@ ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg);
ZMQ_EXPORT
int
zmq_msg_move
(
zmq_msg_t
*
dest
,
zmq_msg_t
*
src
);
ZMQ_EXPORT
int
zmq_msg_copy
(
zmq_msg_t
*
dest
,
zmq_msg_t
*
src
);
ZMQ_EXPORT
void
*
zmq_msg_data
(
zmq_msg_t
*
msg
);
ZMQ_EXPORT
size_t
zmq_msg_size
(
zmq_msg_t
*
msg
);
ZMQ_EXPORT
s
s
ize_t
zmq_msg_size
(
zmq_msg_t
*
msg
);
ZMQ_EXPORT
int
zmq_msg_more
(
zmq_msg_t
*
msg
);
ZMQ_EXPORT
int
zmq_msg_get
(
zmq_msg_t
*
msg
,
int
option
,
void
*
optval
,
size_t
*
optvallen
);
ZMQ_EXPORT
int
zmq_msg_set
(
zmq_msg_t
*
msg
,
int
option
,
const
void
*
optval
,
size_t
*
optvallen
);
/******************************************************************************/
/* 0MQ infrastructure (a.k.a. context) initialisation & termination. */
/******************************************************************************/
...
...
perf/inproc_lat.cpp
View file @
a457be31
/*
Copyright (c) 2007-2012 iMatix Corporation
Copyright (c) 2009-2011 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
This file is part of 0MQ.
...
...
@@ -35,7 +35,7 @@
#include <pthread.h>
#endif
static
size_t
message_size
;
static
s
s
ize_t
message_size
;
static
int
roundtrip_count
;
#if defined ZMQ_HAVE_WINDOWS
...
...
perf/inproc_thr.cpp
View file @
a457be31
/*
Copyright (c) 2007-2012 iMatix Corporation
Copyright (c) 2009-2011 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
This file is part of 0MQ.
...
...
@@ -36,7 +36,7 @@
#endif
static
int
message_count
;
static
size_t
message_size
;
static
s
s
ize_t
message_size
;
#if defined ZMQ_HAVE_WINDOWS
static
unsigned
int
__stdcall
worker
(
void
*
ctx_
)
...
...
perf/local_lat.cpp
View file @
a457be31
/*
Copyright (c) 2007-2012 iMatix Corporation
Copyright (c) 2009-2011 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
This file is part of 0MQ.
...
...
@@ -28,7 +28,7 @@ int main (int argc, char *argv [])
{
const
char
*
bind_to
;
int
roundtrip_count
;
size_t
message_size
;
s
s
ize_t
message_size
;
void
*
ctx
;
void
*
s
;
int
rc
;
...
...
perf/local_thr.cpp
View file @
a457be31
/*
Copyright (c) 2007-2012 iMatix Corporation
Copyright (c) 2009-2011 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
This file is part of 0MQ.
...
...
@@ -28,7 +28,7 @@ int main (int argc, char *argv [])
{
const
char
*
bind_to
;
int
message_count
;
size_t
message_size
;
s
s
ize_t
message_size
;
void
*
ctx
;
void
*
s
;
int
rc
;
...
...
perf/remote_lat.cpp
View file @
a457be31
/*
Copyright (c) 2007-2012 iMatix Corporation
Copyright (c) 2009-2011 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
This file is part of 0MQ.
...
...
@@ -29,7 +29,7 @@ int main (int argc, char *argv [])
{
const
char
*
connect_to
;
int
roundtrip_count
;
size_t
message_size
;
s
s
ize_t
message_size
;
void
*
ctx
;
void
*
s
;
int
rc
;
...
...
src/zmq.cpp
View file @
a457be31
...
...
@@ -502,17 +502,29 @@ int zmq_recviov (void *s_, iovec *a_, size_t *count_, int flags_)
int
zmq_msg_init
(
zmq_msg_t
*
msg_
)
{
if
(
!
msg_
)
{
errno
=
EFAULT
;
return
-
1
;
}
return
((
zmq
::
msg_t
*
)
msg_
)
->
init
();
}
int
zmq_msg_init_size
(
zmq_msg_t
*
msg_
,
size_t
size_
)
{
if
(
!
msg_
)
{
errno
=
EFAULT
;
return
-
1
;
}
return
((
zmq
::
msg_t
*
)
msg_
)
->
init_size
(
size_
);
}
int
zmq_msg_init_data
(
zmq_msg_t
*
msg_
,
void
*
data_
,
size_t
size_
,
zmq_free_fn
*
ffn_
,
void
*
hint_
)
{
if
(
!
msg_
)
{
errno
=
EFAULT
;
return
-
1
;
}
return
((
zmq
::
msg_t
*
)
msg_
)
->
init_data
(
data_
,
size_
,
ffn_
,
hint_
);
}
...
...
@@ -544,26 +556,46 @@ int zmq_msg_recv (zmq_msg_t *msg_, void *s_, int flags_)
int
zmq_msg_close
(
zmq_msg_t
*
msg_
)
{
if
(
!
msg_
)
{
errno
=
EFAULT
;
return
-
1
;
}
return
((
zmq
::
msg_t
*
)
msg_
)
->
close
();
}
int
zmq_msg_move
(
zmq_msg_t
*
dest_
,
zmq_msg_t
*
src_
)
{
if
(
!
dest_
||
!
src_
)
{
errno
=
EFAULT
;
return
-
1
;
}
return
((
zmq
::
msg_t
*
)
dest_
)
->
move
(
*
(
zmq
::
msg_t
*
)
src_
);
}
int
zmq_msg_copy
(
zmq_msg_t
*
dest_
,
zmq_msg_t
*
src_
)
{
if
(
!
dest_
||
!
src_
)
{
errno
=
EFAULT
;
return
-
1
;
}
return
((
zmq
::
msg_t
*
)
dest_
)
->
copy
(
*
(
zmq
::
msg_t
*
)
src_
);
}
void
*
zmq_msg_data
(
zmq_msg_t
*
msg_
)
{
if
(
!
msg_
)
{
errno
=
EFAULT
;
return
NULL
;
}
return
((
zmq
::
msg_t
*
)
msg_
)
->
data
();
}
size_t
zmq_msg_size
(
zmq_msg_t
*
msg_
)
s
s
ize_t
zmq_msg_size
(
zmq_msg_t
*
msg_
)
{
if
(
!
msg_
)
{
errno
=
EFAULT
;
return
-
1
;
}
return
((
zmq
::
msg_t
*
)
msg_
)
->
size
();
}
...
...
@@ -615,6 +647,10 @@ int zmq_msg_set (zmq_msg_t *msg_, int option_, const void *optval_,
int
zmq_poll
(
zmq_pollitem_t
*
items_
,
int
nitems_
,
long
timeout_
)
{
if
(
!
items_
)
{
errno
=
EFAULT
;
return
-
1
;
}
#if defined ZMQ_POLL_BASED_ON_POLL
if
(
unlikely
(
nitems_
<
0
))
{
errno
=
EINVAL
;
...
...
@@ -633,12 +669,6 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
return
usleep
(
timeout_
*
1000
);
#endif
}
if
(
!
items_
)
{
errno
=
EFAULT
;
return
-
1
;
}
zmq
::
clock_t
clock
;
uint64_t
now
=
0
;
uint64_t
end
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment