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
Kirill Smelkov
linux
Commits
a632875f
Commit
a632875f
authored
Dec 29, 2003
by
Arnaldo Carvalho de Melo
Committed by
David S. Miller
Dec 29, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Uninline {lock,release}_sock().
parent
19774a6d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
17 deletions
+27
-17
include/net/sock.h
include/net/sock.h
+2
-17
net/core/sock.c
net/core/sock.c
+25
-0
No files found.
include/net/sock.h
View file @
a632875f
...
...
@@ -542,24 +542,9 @@ static inline struct inode *SOCK_INODE(struct socket *socket)
extern
void
__lock_sock
(
struct
sock
*
sk
);
extern
void
__release_sock
(
struct
sock
*
sk
);
#define sock_owned_by_user(sk) ((sk)->sk_lock.owner)
#define lock_sock(__sk) \
do { might_sleep(); \
spin_lock_bh(&((__sk)->sk_lock.slock)); \
if ((__sk)->sk_lock.owner) \
__lock_sock(__sk); \
(__sk)->sk_lock.owner = (void *)1; \
spin_unlock_bh(&((__sk)->sk_lock.slock)); \
} while(0)
#define release_sock(__sk) \
do { spin_lock_bh(&((__sk)->sk_lock.slock)); \
if ((__sk)->sk_backlog.tail) \
__release_sock(__sk); \
(__sk)->sk_lock.owner = NULL; \
if (waitqueue_active(&((__sk)->sk_lock.wq))) \
wake_up(&((__sk)->sk_lock.wq)); \
spin_unlock_bh(&((__sk)->sk_lock.slock)); \
} while(0)
extern
void
lock_sock
(
struct
sock
*
sk
);
extern
void
release_sock
(
struct
sock
*
sk
);
/* BH context may only use the following locking interface. */
#define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock))
...
...
net/core/sock.c
View file @
a632875f
...
...
@@ -1119,6 +1119,31 @@ void sock_init_data(struct socket *sock, struct sock *sk)
atomic_set
(
&
sk
->
sk_refcnt
,
1
);
}
void
lock_sock
(
struct
sock
*
sk
)
{
might_sleep
();
spin_lock_bh
(
&
(
sk
->
sk_lock
.
slock
));
if
(
sk
->
sk_lock
.
owner
)
__lock_sock
(
sk
);
sk
->
sk_lock
.
owner
=
(
void
*
)
1
;
spin_unlock_bh
(
&
(
sk
->
sk_lock
.
slock
));
}
EXPORT_SYMBOL
(
lock_sock
);
void
release_sock
(
struct
sock
*
sk
)
{
spin_lock_bh
(
&
(
sk
->
sk_lock
.
slock
));
if
(
sk
->
sk_backlog
.
tail
)
__release_sock
(
sk
);
sk
->
sk_lock
.
owner
=
NULL
;
if
(
waitqueue_active
(
&
(
sk
->
sk_lock
.
wq
)))
wake_up
(
&
(
sk
->
sk_lock
.
wq
));
spin_unlock_bh
(
&
(
sk
->
sk_lock
.
slock
));
}
EXPORT_SYMBOL
(
release_sock
);
EXPORT_SYMBOL
(
__lock_sock
);
EXPORT_SYMBOL
(
__release_sock
);
EXPORT_SYMBOL
(
sk_alloc
);
...
...
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