Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
d6538729
Commit
d6538729
authored
May 01, 2003
by
Sridhar Samudrala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SCTP] Use prepare_to_wait()/finish_wait() interfaces.
parent
0c336e6d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
26 deletions
+18
-26
net/sctp/socket.c
net/sctp/socket.c
+18
-26
No files found.
net/sctp/socket.c
View file @
d6538729
...
@@ -3295,10 +3295,9 @@ SCTP_STATIC int sctp_msghdr_parse(const struct msghdr *msg,
...
@@ -3295,10 +3295,9 @@ SCTP_STATIC int sctp_msghdr_parse(const struct msghdr *msg,
static
int
sctp_wait_for_packet
(
struct
sock
*
sk
,
int
*
err
,
long
*
timeo_p
)
static
int
sctp_wait_for_packet
(
struct
sock
*
sk
,
int
*
err
,
long
*
timeo_p
)
{
{
int
error
;
int
error
;
DE
CLARE_WAITQUEUE
(
wait
,
curren
t
);
DE
FINE_WAIT
(
wai
t
);
__set_current_state
(
TASK_INTERRUPTIBLE
);
prepare_to_wait_exclusive
(
sk
->
sleep
,
&
wait
,
TASK_INTERRUPTIBLE
);
add_wait_queue_exclusive
(
sk
->
sleep
,
&
wait
);
/* Socket errors? */
/* Socket errors? */
error
=
sock_error
(
sk
);
error
=
sock_error
(
sk
);
...
@@ -3335,16 +3334,14 @@ static int sctp_wait_for_packet(struct sock * sk, int *err, long *timeo_p)
...
@@ -3335,16 +3334,14 @@ static int sctp_wait_for_packet(struct sock * sk, int *err, long *timeo_p)
sctp_lock_sock
(
sk
);
sctp_lock_sock
(
sk
);
ready:
ready:
remove_wait_queue
(
sk
->
sleep
,
&
wait
);
finish_wait
(
sk
->
sleep
,
&
wait
);
__set_current_state
(
TASK_RUNNING
);
return
0
;
return
0
;
interrupted:
interrupted:
error
=
sock_intr_errno
(
*
timeo_p
);
error
=
sock_intr_errno
(
*
timeo_p
);
out:
out:
remove_wait_queue
(
sk
->
sleep
,
&
wait
);
finish_wait
(
sk
->
sleep
,
&
wait
);
__set_current_state
(
TASK_RUNNING
);
*
err
=
error
;
*
err
=
error
;
return
error
;
return
error
;
}
}
...
@@ -3522,18 +3519,18 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p,
...
@@ -3522,18 +3519,18 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p,
struct
sock
*
sk
=
asoc
->
base
.
sk
;
struct
sock
*
sk
=
asoc
->
base
.
sk
;
int
err
=
0
;
int
err
=
0
;
long
current_timeo
=
*
timeo_p
;
long
current_timeo
=
*
timeo_p
;
DE
CLARE_WAITQUEUE
(
wait
,
curren
t
);
DE
FINE_WAIT
(
wai
t
);
SCTP_DEBUG_PRINTK
(
"wait_for_sndbuf: asoc=%p, timeo=%ld, msg_len=%d
\n
"
,
SCTP_DEBUG_PRINTK
(
"wait_for_sndbuf: asoc=%p, timeo=%ld, msg_len=%d
\n
"
,
asoc
,
(
long
)(
*
timeo_p
),
msg_len
);
asoc
,
(
long
)(
*
timeo_p
),
msg_len
);
/* Wait on the association specific sndbuf space. */
add_wait_queue_exclusive
(
&
asoc
->
wait
,
&
wait
);
/* Increment the association's refcnt. */
/* Increment the association's refcnt. */
sctp_association_hold
(
asoc
);
sctp_association_hold
(
asoc
);
/* Wait on the association specific sndbuf space. */
for
(;;)
{
for
(;;)
{
set_current_state
(
TASK_INTERRUPTIBLE
);
prepare_to_wait_exclusive
(
&
asoc
->
wait
,
&
wait
,
TASK_INTERRUPTIBLE
);
if
(
!*
timeo_p
)
if
(
!*
timeo_p
)
goto
do_nonblock
;
goto
do_nonblock
;
if
(
sk
->
err
||
asoc
->
state
>=
SCTP_STATE_SHUTDOWN_PENDING
||
if
(
sk
->
err
||
asoc
->
state
>=
SCTP_STATE_SHUTDOWN_PENDING
||
...
@@ -3555,12 +3552,11 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p,
...
@@ -3555,12 +3552,11 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p,
}
}
out:
out:
remove_wait_queue
(
&
asoc
->
wait
,
&
wait
);
finish_wait
(
&
asoc
->
wait
,
&
wait
);
/* Release the association's refcnt. */
/* Release the association's refcnt. */
sctp_association_put
(
asoc
);
sctp_association_put
(
asoc
);
__set_current_state
(
TASK_RUNNING
);
return
err
;
return
err
;
do_error:
do_error:
...
@@ -3618,18 +3614,17 @@ static int sctp_wait_for_connect(struct sctp_association *asoc, long *timeo_p)
...
@@ -3618,18 +3614,17 @@ static int sctp_wait_for_connect(struct sctp_association *asoc, long *timeo_p)
struct
sock
*
sk
=
asoc
->
base
.
sk
;
struct
sock
*
sk
=
asoc
->
base
.
sk
;
int
err
=
0
;
int
err
=
0
;
long
current_timeo
=
*
timeo_p
;
long
current_timeo
=
*
timeo_p
;
DE
CLARE_WAITQUEUE
(
wait
,
curren
t
);
DE
FINE_WAIT
(
wai
t
);
SCTP_DEBUG_PRINTK
(
"%s: asoc=%p, timeo=%ld
\n
"
,
__FUNCTION__
,
asoc
,
SCTP_DEBUG_PRINTK
(
"%s: asoc=%p, timeo=%ld
\n
"
,
__FUNCTION__
,
asoc
,
(
long
)(
*
timeo_p
));
(
long
)(
*
timeo_p
));
add_wait_queue_exclusive
(
&
asoc
->
wait
,
&
wait
);
/* Increment the association's refcnt. */
/* Increment the association's refcnt. */
sctp_association_hold
(
asoc
);
sctp_association_hold
(
asoc
);
for
(;;)
{
for
(;;)
{
__set_current_state
(
TASK_INTERRUPTIBLE
);
prepare_to_wait_exclusive
(
&
asoc
->
wait
,
&
wait
,
TASK_INTERRUPTIBLE
);
if
(
!*
timeo_p
)
if
(
!*
timeo_p
)
goto
do_nonblock
;
goto
do_nonblock
;
if
(
sk
->
shutdown
&
RCV_SHUTDOWN
)
if
(
sk
->
shutdown
&
RCV_SHUTDOWN
)
...
@@ -3654,13 +3649,11 @@ static int sctp_wait_for_connect(struct sctp_association *asoc, long *timeo_p)
...
@@ -3654,13 +3649,11 @@ static int sctp_wait_for_connect(struct sctp_association *asoc, long *timeo_p)
}
}
out:
out:
remove_wait_queue
(
&
asoc
->
wait
,
&
wait
);
finish_wait
(
&
asoc
->
wait
,
&
wait
);
/* Release the association's refcnt. */
/* Release the association's refcnt. */
sctp_association_put
(
asoc
);
sctp_association_put
(
asoc
);
__set_current_state
(
TASK_RUNNING
);
return
err
;
return
err
;
do_error:
do_error:
...
@@ -3680,14 +3673,14 @@ static int sctp_wait_for_accept(struct sock *sk, long timeo)
...
@@ -3680,14 +3673,14 @@ static int sctp_wait_for_accept(struct sock *sk, long timeo)
{
{
struct
sctp_endpoint
*
ep
;
struct
sctp_endpoint
*
ep
;
int
err
=
0
;
int
err
=
0
;
DE
CLARE_WAITQUEUE
(
wait
,
curren
t
);
DE
FINE_WAIT
(
wai
t
);
ep
=
sctp_sk
(
sk
)
->
ep
;
ep
=
sctp_sk
(
sk
)
->
ep
;
add_wait_queue_exclusive
(
sk
->
sleep
,
&
wait
);
for
(;;)
{
for
(;;)
{
__set_current_state
(
TASK_INTERRUPTIBLE
);
prepare_to_wait_exclusive
(
sk
->
sleep
,
&
wait
,
TASK_INTERRUPTIBLE
);
if
(
list_empty
(
&
ep
->
asocs
))
{
if
(
list_empty
(
&
ep
->
asocs
))
{
sctp_release_sock
(
sk
);
sctp_release_sock
(
sk
);
timeo
=
schedule_timeout
(
timeo
);
timeo
=
schedule_timeout
(
timeo
);
...
@@ -3711,8 +3704,7 @@ static int sctp_wait_for_accept(struct sock *sk, long timeo)
...
@@ -3711,8 +3704,7 @@ static int sctp_wait_for_accept(struct sock *sk, long timeo)
break
;
break
;
}
}
remove_wait_queue
(
sk
->
sleep
,
&
wait
);
finish_wait
(
sk
->
sleep
,
&
wait
);
__set_current_state
(
TASK_RUNNING
);
return
err
;
return
err
;
}
}
...
...
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