Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
1bdd154b
Commit
1bdd154b
authored
25 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
Added optional debugging code in object management.
parent
54a39e25
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
server/main.c
+5
-0
5 additions, 0 deletions
server/main.c
server/object.c
+34
-0
34 additions, 0 deletions
server/object.c
server/object.h
+10
-0
10 additions, 0 deletions
server/object.h
with
49 additions
and
0 deletions
server/main.c
+
5
−
0
View file @
1bdd154b
...
...
@@ -29,6 +29,11 @@ int main( int argc, char *argv[] )
if
(
debug_level
)
fprintf
(
stderr
,
"Server: starting (pid=%d)
\n
"
,
getpid
()
);
create_initial_thread
(
fd
);
if
(
debug_level
)
fprintf
(
stderr
,
"Server: exiting (pid=%d)
\n
"
,
getpid
()
);
#ifdef DEBUG_OBJECTS
dump_objects
();
/* dump any remaining objects */
#endif
exit
(
0
);
error:
...
...
This diff is collapsed.
Click to expand it.
server/object.c
+
34
−
0
View file @
1bdd154b
...
...
@@ -8,6 +8,7 @@
#include
<assert.h>
#include
<limits.h>
#include
<stdlib.h>
#include
<stdio.h>
#include
<string.h>
#include
"winerror.h"
...
...
@@ -27,6 +28,21 @@ struct object_name
static
struct
object_name
*
names
[
NAME_HASH_SIZE
];
#ifdef DEBUG_OBJECTS
static
struct
object
*
first
;
void
dump_objects
(
void
)
{
struct
object
*
ptr
=
first
;
while
(
ptr
)
{
fprintf
(
stderr
,
"%p:%d: "
,
ptr
,
ptr
->
refcount
);
ptr
->
ops
->
dump
(
ptr
,
1
);
ptr
=
ptr
->
next
;
}
}
#endif
/*****************************************************************/
void
*
mem_alloc
(
size_t
size
)
...
...
@@ -83,9 +99,22 @@ int init_object( struct object *obj, const struct object_ops *ops,
obj
->
tail
=
NULL
;
if
(
!
name
)
obj
->
name
=
NULL
;
else
if
(
!
(
obj
->
name
=
add_name
(
obj
,
name
)))
return
0
;
#ifdef DEBUG_OBJECTS
obj
->
prev
=
NULL
;
if
((
obj
->
next
=
first
)
!=
NULL
)
obj
->
next
->
prev
=
obj
;
first
=
obj
;
#endif
return
1
;
}
/* allocate and initialize an object */
void
*
alloc_object
(
size_t
size
,
const
struct
object_ops
*
ops
,
const
char
*
name
)
{
struct
object
*
obj
=
mem_alloc
(
size
);
if
(
obj
)
init_object
(
obj
,
ops
,
name
);
return
obj
;
}
struct
object
*
create_named_object
(
const
char
*
name
,
const
struct
object_ops
*
ops
,
size_t
size
)
{
struct
object
*
obj
;
...
...
@@ -136,6 +165,11 @@ void release_object( void *ptr )
assert
(
!
obj
->
head
);
assert
(
!
obj
->
tail
);
if
(
obj
->
name
)
free_name
(
obj
);
#ifdef DEBUG_OBJECTS
if
(
obj
->
next
)
obj
->
next
->
prev
=
obj
->
prev
;
if
(
obj
->
prev
)
obj
->
prev
->
next
=
obj
->
next
;
else
first
=
obj
->
next
;
#endif
obj
->
ops
->
destroy
(
obj
);
}
}
...
...
This diff is collapsed.
Click to expand it.
server/object.h
+
10
−
0
View file @
1bdd154b
...
...
@@ -15,6 +15,8 @@
#include
"server.h"
#include
"server/request.h"
#define DEBUG_OBJECTS
/* kernel objects */
struct
object
;
...
...
@@ -56,9 +58,14 @@ struct object
struct
wait_queue_entry
*
head
;
struct
wait_queue_entry
*
tail
;
struct
object_name
*
name
;
#ifdef DEBUG_OBJECTS
struct
object
*
prev
;
struct
object
*
next
;
#endif
};
extern
void
*
mem_alloc
(
size_t
size
);
/* malloc wrapper */
extern
void
*
alloc_object
(
size_t
size
,
const
struct
object_ops
*
ops
,
const
char
*
name
);
extern
struct
object
*
create_named_object
(
const
char
*
name
,
const
struct
object_ops
*
ops
,
size_t
size
);
extern
int
init_object
(
struct
object
*
obj
,
const
struct
object_ops
*
ops
,
const
char
*
name
);
...
...
@@ -75,6 +82,9 @@ extern int no_write_fd( struct object *obj );
extern
int
no_flush
(
struct
object
*
obj
);
extern
int
no_get_file_info
(
struct
object
*
obj
,
struct
get_file_info_reply
*
info
);
extern
void
default_select_event
(
int
event
,
void
*
private
);
#ifdef DEBUG_OBJECTS
extern
void
dump_objects
(
void
);
#endif
/* request handlers */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment