PERFORCE change 85644 for review
soc-bushman
soc-bushman at FreeBSD.org
Fri Oct 21 06:51:36 PDT 2005
http://perforce.freebsd.org/chv.cgi?CH=85644
Change 85644 by soc-bushman at soc-bushman_stinger on 2005/10/21 13:51:21
man upgraded, serveral log issues fixed
Affected files ...
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/Makefile#3 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/Makefile#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agent.c#1 add
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agent.h#1 add
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/Makefile.inc#4 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/group.c#1 add
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/group.h#1 add
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/hosts.c#4 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/hosts.h#4 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/passwd.c#4 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/passwd.h#4 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/services.c#4 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/services.h#4 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cached.8#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cached.c#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cached.conf#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cached.conf.5#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cachelib.c#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cachelib.h#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cacheplcs.c#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cacheplcs.h#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/config.c#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/config.h#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/debug.c#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/debug.h#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/hashtable.h#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/log.c#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/log.h#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/mp_rs_query.c#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/mp_rs_query.h#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/mp_ws_query.c#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/mp_ws_query.h#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/parser.c#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/parser.h#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/protocol.c#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/protocol.h#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/query.c#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/query.h#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/singletons.c#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/singletons.h#8 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/startup/cached#3 edit
Differences ...
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/Makefile#3 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/Makefile#8 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/Makefile.inc#4 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/hosts.c#4 (text+ko) ====
@@ -281,7 +281,6 @@
size = key + key_size - p;
if (size != len) {
- TRACE_POINT();
TRACE_OUT(hosts_lookup_func);
return (NS_UNAVAIL);
}
@@ -347,13 +346,8 @@
case GETIPNODEBYXXX_LOOKUP:
switch (lookup_type) {
case nss_lt_name:
- TRACE_STR(hostname);
- TRACE_INT(type);
ht_result = getipnodebyname(hostname, type,
AI_ADDRCONFIG | AI_V4MAPPED, &res);
- TRACE_INT(res);
- TRACE_STR(hstrerror(res));
- TRACE_PTR(ht_result);
break;
case nss_lt_id:
ht_result = getipnodebyaddr(addr, len, type, &res);
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/hosts.h#4 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/passwd.c#4 (text+ko) ====
@@ -136,16 +136,14 @@
assert(buffer != NULL);
assert(buffer_size != NULL);
- TRACE_INT(key_size);
if (key_size < sizeof(enum nss_lookup_type)) {
TRACE_OUT(passwd_lookup_func);
return (NS_UNAVAIL);
}
memcpy(&lookup_type, key, sizeof(enum nss_lookup_type));
- TRACE_INT(lookup_type);
+
switch (lookup_type) {
case nss_lt_name:
- TRACE_POINT();
size = key_size - sizeof(enum nss_lookup_type) + 1;
login = (char *)malloc(size);
assert(login != NULL);
@@ -153,30 +151,25 @@
memcpy(login, key + sizeof(enum nss_lookup_type), size - 1);
break;
case nss_lt_id:
- TRACE_POINT();
if (key_size < sizeof(enum nss_lookup_type) +
sizeof(uid_t)) {
TRACE_OUT(passwd_lookup_func);
return (NS_UNAVAIL);
}
- TRACE_POINT();
memcpy(&uid, key + sizeof(enum nss_lookup_type), sizeof(uid_t));
break;
default:
- TRACE_POINT();
TRACE_OUT(passwd_lookup_func);
return (NS_UNAVAIL);
}
switch (lookup_type) {
case nss_lt_name:
- TRACE_STR(login);
result = getpwnam(login);
free(login);
break;
case nss_lt_id:
- TRACE_INT(uid);
result = getpwuid(uid);
break;
default:
@@ -185,7 +178,6 @@
}
if (result != NULL) {
- TRACE_POINT();
passwd_marshal_func(result, NULL, buffer_size);
*buffer = (char *)malloc(*buffer_size);
assert(*buffer != NULL);
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/passwd.h#4 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/services.c#4 (text+ko) ====
@@ -133,16 +133,14 @@
assert(buffer != NULL);
assert(buffer_size != NULL);
- TRACE_INT(key_size);
if (key_size < sizeof(enum nss_lookup_type)) {
TRACE_OUT(passwd_lookup_func);
return (NS_UNAVAIL);
}
memcpy(&lookup_type, key, sizeof(enum nss_lookup_type));
- TRACE_INT(lookup_type);
+
switch (lookup_type) {
case nss_lt_name:
- TRACE_POINT();
size = key_size - sizeof(enum nss_lookup_type) + 1;
name = (char *)malloc(size);
assert(name != NULL);
@@ -159,14 +157,12 @@
}
break;
case nss_lt_id:
- TRACE_POINT();
if (key_size < sizeof(enum nss_lookup_type) +
sizeof(int)) {
TRACE_OUT(passwd_lookup_func);
return (NS_UNAVAIL);
}
- TRACE_POINT();
memcpy(&port, key + sizeof(enum nss_lookup_type),
sizeof(int));
@@ -180,23 +176,16 @@
}
break;
default:
- TRACE_POINT();
TRACE_OUT(passwd_lookup_func);
return (NS_UNAVAIL);
}
switch (lookup_type) {
case nss_lt_name:
- TRACE_STR(name);
- if (proto != NULL)
- TRACE_STR(proto);
result = getservbyname(name, proto);
free(name);
break;
case nss_lt_id:
- TRACE_INT(port);
- if (proto != NULL)
- TRACE_STR(proto);
result = getservbyport(port, proto);
free(proto);
break;
@@ -206,7 +195,6 @@
}
if (result != NULL) {
- TRACE_POINT();
services_marshal_func(result, NULL, buffer_size);
*buffer = (char *)malloc(*buffer_size);
assert(*buffer != NULL);
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/services.h#4 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cached.8#8 (text+ko) ====
@@ -23,7 +23,7 @@
.\" SUCH DAMAGE.
.\"
-.Dd August 29, 2005
+.Dd October 20, 2005
.Dt CACHED 8
.Os
.Sh NAME
@@ -68,6 +68,13 @@
.El
.Pp
.Nm
+is able not only to cache elements, but to perform the actual nsswitch
+lookups by itself. To enable this feature use
+.Pa perform-actual-lookups
+parameter in the
+.Xr cached.conf 5
+.Pp
+.Nm
recognizes the following runtime options:
.Bl -tag -width indent
.It Fl n
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cached.c#8 (text+ko) ====
@@ -147,7 +147,7 @@
print_version_info(void)
{
TRACE_IN(print_version_info);
- printf("cached v0.2 (19 Aug 2005)\nwas developed during SoC 2005\n");
+ printf("cached v0.2 (20 Oct 2005)\nwas developed during SoC 2005\n");
TRACE_OUT(print_version_info);
}
@@ -216,7 +216,6 @@
memset(retval, 0, sizeof(struct runtime_env));
retval->sockfd = socket(PF_LOCAL, SOCK_STREAM, 0);
- TRACE_INT(retval->sockfd);
if (config->force_unlink == 1)
unlink(config->socket_path);
@@ -230,7 +229,6 @@
if (bind(retval->sockfd, (struct sockaddr *)&serv_addr,
serv_addr_len) == -1) {
- TRACE_INT(errno);
close(retval->sockfd);
free(retval);
@@ -288,20 +286,22 @@
addr_len = sizeof(struct sockaddr);
fd = accept(event_data->ident, &addr, &addr_len);
if (fd == -1) {
- /* TODO: do something */
+ LOG_ERR_2("accept_connection", "error %d during accept()",
+ errno);
TRACE_OUT(accept_connection);
return;
}
if (getpeereid(fd, &euid, &egid) != 0) {
- /* TODO: do something */
+ LOG_ERR_2("accept_connection", "error %d during getpeereid()",
+ errno);
TRACE_OUT(accept_connection);
return;
}
qstate = init_query_state(fd, sizeof(int), euid, egid);
if (qstate == NULL) {
- /* TODO: do something */
+ LOG_ERR_2("accept_connection", "can't init query_state");
TRACE_OUT(accept_connection);
return;
}
@@ -312,8 +312,6 @@
EV_SET(&eventlist[1], fd, EVFILT_READ, EV_ADD | EV_ONESHOT,
NOTE_LOWAT, qstate->kevent_watermark, qstate);
res = kevent(env->queue, eventlist, 2, NULL, 0, &timeout);
- TRACE_INT(res);
- TRACE_INT(fd);
TRACE_OUT(accept_connection);
}
@@ -335,19 +333,16 @@
res = 0;
memset(&kevent_timeout, 0, sizeof(struct timespec));
- TRACE_INT(event_data->ident);
EV_SET(&eventlist[0], event_data->ident, EVFILT_TIMER, EV_DELETE,
0, 0, NULL);
nevents = kevent(env->queue, eventlist, 1, NULL, 0, &kevent_timeout);
if (nevents == -1) {
if (errno == ENOENT) {
/* the timer is already handling this event */
- TRACE_POINT();
TRACE_OUT(process_socket_event);
return;
} else {
/* some other error happened */
- TRACE_POINT();
TRACE_OUT(process_socket_event);
return;
}
@@ -359,7 +354,6 @@
((qstate->use_alternate_io != 0) &&
(qstate->io_buffer_watermark <= event_data->data))) {
if (qstate->use_alternate_io != 0) {
- TRACE_INT(qstate->use_alternate_io);
switch (qstate->io_buffer_filter) {
case EVFILT_READ:
io_res = query_socket_read(qstate,
@@ -370,13 +364,6 @@
qstate->process_func = NULL;
} else {
qstate->io_buffer_p += io_res;
- TRACE_INT(qstate->kevent_watermark);
- TRACE_INT(qstate->io_buffer +
- qstate->io_buffer_size -
- qstate->io_buffer_p);
- TRACE_INT(io_res);
- TRACE_INT(event_data->data);
- TRACE_INT(qstate->io_buffer_size);
if (qstate->io_buffer_p ==
qstate->io_buffer +
qstate->io_buffer_size) {
@@ -402,10 +389,8 @@
qstate->process_func = NULL;
}
- TRACE_INT(qstate->use_alternate_io);
if ((qstate->use_alternate_io != 0) &&
(qstate->io_buffer_filter == EVFILT_WRITE)) {
- TRACE_POINT();
io_res = query_socket_write(qstate, qstate->io_buffer_p,
qstate->io_buffer_watermark);
if (io_res < 0) {
@@ -420,15 +405,11 @@
qstate->use_alternate_io = 0;
}
- TRACE_INT(event_data->data);
- TRACE_INT(qstate->kevent_watermark);
- TRACE_PTR(qstate->process_func);
if (((qstate->process_func == NULL) &&
(qstate->use_alternate_io == 0)) ||
(eof_res != 0) || (res != 0)) {
destroy_query_state(qstate);
close(event_data->ident);
- TRACE_POINT();
TRACE_OUT(process_socket_event);
return;
}
@@ -462,7 +443,7 @@
qstate->write_func = query_io_buffer_write;
qstate->read_func = query_io_buffer_read;
- TRACE_POINT();
+
if (qstate->kevent_filter == EVFILT_READ)
qstate->use_alternate_io = 1;
@@ -476,7 +457,6 @@
NOTE_LOWAT, qstate->kevent_watermark, qstate);
}
} else {
- TRACE_POINT();
if (qstate->io_buffer + qstate->io_buffer_size -
qstate->io_buffer_p <
MAX_SOCKET_IO_SIZE) {
@@ -488,7 +468,6 @@
qstate->io_buffer_watermark,
qstate);
} else {
- TRACE_POINT();
qstate->io_buffer_watermark = MAX_SOCKET_IO_SIZE;
EV_SET(&eventlist[1], event_data->ident,
qstate->io_buffer_filter, EV_ADD | EV_ONESHOT,
@@ -687,16 +666,13 @@
error_str = NULL;
error_line = 0;
config_file = CONFIG_PATH;
-// res = read_configuration(config_file, s_configuration, &error_str,
-// &error_line);
+
res = parse_config_file(s_configuration, config_file, &error_str,
&error_line);
if ((res != 0) && (error_str == NULL)) {
config_file = DEFAULT_CONFIG_PATH;
res = parse_config_file(s_configuration, config_file,
&error_str, &error_line);
-// res = read_configuration(config_file, s_configuration,
-// &error_str, &error_line);
}
if (res != 0) {
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cached.conf#8 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cached.conf.5#8 (text+ko) ====
@@ -31,160 +31,62 @@
.Nd "caching daemon configuration file manual page"
.Sh "DESCRIPTION"
.Nm
-has 2 types of elements:
-.Pa key=value pairs
-and
-.Pa groups of such pairs.
-Groups are used to specify needed cache entries, and "global" key=value
-pairs allow to change some global
+is used by the
.Xr cached 8
-parameters.
-.Ss Gobal pairs
-Global pairs are usually specified in the beginning of the
-.Nm
-file.
-They have the following form: key=value.
+daemon and is read on its startup. Its syntax is mostly similar to the
+nscd.conf syntax in Linux and Solaris. It has some differences, though -
+see them below.
+.Pp
+Each line specifies either an attribute and a value, or an attribute,
+a cachename and a value. Valid cachenames are passwd, groups, hosts,
+services, protocols and rpc. If you need to use some other cachename for
+your own needs (for example, if some third-party application uses nsswitch),
+you can simply use it without any restrictions.
.Pp
.Bl -tag -width Pair
-.It Sy Pair
-.Sy Description
-.It socket_path = [string]
-Defines the path to the unix socket, which
+.It Sy threads [value]
+Number of threads, which would listen for connections and process requests. The
+minimum is 1.
+.It Sy enable-cache [cachename] [yes|no]
+Enables or disables the cache for specified cachename.
+.It Sy positive-time-to-live [cachename] [value]
+Sets the TTL (time-to-live) for the specified cache in seconds. Larger values
+can increase system's performance, but they also can affect the cache
+coherence.
+.It Sy positive-policy [cachename] [fifo|lru|lfu]
+The policy that is applied to erase some of the cache elements, when the
+size limit of the given cachename is exceeded. Possible policies are:
+fifo (first-in-first-out), lru (least-recently-used),
+lfu (least-frequently-used).
+.It Sy negative-time-to-live [cachename] [value]
+The TTL of the negative cached elements in seconds. The larger values can
+significantly increase system performance in some environments
+(when dealing with files with UIDs, which are not in system databases,
+for example). This number should be kept low to avoid the cache
+coherence problems.
+.It Sy negative-policy [cachename] [fifo|lru|lfu]
+The same as the positive-policy, but this one is applied to the negative
+elements of the given cachename.
+.It Sy suggested-size [cachename] [value]
+This is the internal hash table size. The value should be a prime number
+for optimum performance. You should only change this value when the number
+of cached elements is significantly (in 5-10 times) greater then the usual
+hash table size (255).
+.It Sy keep-hot-count [cachename] [value]
+The size limit of the cache with the given cachename. When it is exceeded,
+the policy will be applied.
+.It Sy perform-actual-lookups [cachename] [yes|no]
+If enabled, the
.Xr cached 8
-will use to
-communicate with client applications.
-The default is
-.Pa /var/run/cached .
-.It pidfile_path= [string]
-Defines the path to the pid file, which will be used by the startup script
-to control
+doesn't simply receive and cache the NSS-requests results, but performs
+all the lookups by itself and only returns the responses. If this feature is
+enabled, then for the given cachename
.Xr cached 8
-execution.
-The default is
-.Pa /var/run/cached.pid .
-.It query_timeout = [positive_integer]
-Specifies the query timeout in seconds.
-When this time is expired, the
-.Xr cached 8
-will close the connection with the client.
-This parameter can be overriden for each cache entry.
-The default is
-.Pa 8 .
-.It threads = [positive_integer_between_1_and_32]
-Defines the number of threads, which
-.Xr cached 8
-will use to process the requests.
-The default is
-.Pa 8 .
-.El
-.Ss Groups
-Each group describes one cache entry.
-Groups are defined using the following form:
+will act similarly to the NSCD.
.Pp
-entry "\fIentry_name\fP" {
-.br
- type = [\fIcommon\fP | \fImultipart\fP]
-.br
- ...
-.br
-}
-.Pp
-Entry names are unique entry identifiers.
-Duplicate entries are allowed only if they have different
-.Pa euid
-parameters.
-The first pair in the group is always a
-.Pa type
-pair.
-It defines the entry type.
-After the
-.Pa type
-pair you can specify other key=value pairs,
-that describe the cache entry.
-.Ss Pairs for 'common' entries
-.Bl -tag -width Pair
-.It Sy Pair
-.Sy Description
-.It policy = fifo | lru | lfu
-Defines the policy, which will be applied to this entry's elements when
-maximum entry size is exceeded.
-.Pa fifo
-- first in - first out.
-.Pa lru
-- least recently used.
-.Pa lfu
-- least frequently used.
-The default is
-.Pa fifo .
-.It max_elemsize = [positive_integer]
-Defines the maximums entry size in elements.
-When this size is exceeded, the policy is applied and some elements are
-eliminated.
-.Pa 0
-means that entry size is infinite.
-The default is
-.Pa 0 .
-.It max_lifetime = [positive_integer]
-Defines the maximum entry element lifetime in seconds.
-When this time is exceeded, the element is eliminated.
-.Pa 0
-means infinite lifetime.
-The default is
-.Pa 0 .
-.It timeout = [positive_integer]
-Specified the entry's processing-timeout time in seconds.
-If this parameter is specified, it overrides the global
-.Pa query_timeout
-value.
-.It euid = [positive_integer]
-Defines the allowed euid to use this entry.
-If the euid is pecified then
-.Pa only
-users with this euid can work with
-this entry. Other users won't be able to read or write to that entry.
-If this parameter is omitted, than the entry is considered to
-be
-.Pa public
-- any user, who doesn't have his own specified entry
-will be able to use the public entry.
-.El
-.Ss Pairs for 'multipart' entries
-.Bl -tag -width Pair
-.It Sy Pair
-.Sy Description
-.It max_session = [positive_integer]
-Defines the maximum number of write sessions, allowed to be synchronously
-used with this entry.
-As each session accumulates data, lowering the maximum allowed number of
-sessions can reduce the memory usage.
-.Pa 0
-means infinite number.
-The default is
-.Pa 0 .
-.It max_elemsize = [positive_integer]
-Defines the maximum capacity of the entry.
-If one tries to write an element, when max_elemsize is exceeded, he'll get an
-error.
-.Pa 0
-means infinite number.
-The default is
-.Pa 0.
-.It timeout = [positive_integer]
-Specified the entry's processing-timeout time in seconds.
-If this parameter is specified, it overrides the global
-.Pa query_timeout
-value.
-.It euid = [positive_integer]
-Defines the allowed euid to use this entry.
-If the euid is specified then
-.Pa only
-users with this euid can work with this entry.
-Other users won't be able to read or write to that entry.
-If this parameter is omitted, than the entry is considered to be
-.Pa public
-- any user, who doesn't have his own specified entry will be able to use the
-public entry.
-.El
+.Pa NOTE:
+this feature is currently experimental - it supports only passwd, groups and
+services cachenames.
.Sh "NOTES"
You can use
.Sq #
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cachelib.c#8 (text+ko) ====
@@ -96,7 +96,6 @@
retval = (127 * retval + (unsigned char)hp->key[i]) %
cache_entries_size;
- TRACE_INT(retval);
return retval;
}
@@ -511,13 +510,10 @@
params->entry_name, entry_name_size);
new_common_entry->name =
new_common_entry->common_params.entry_name;
- TRACE_STR(new_common_entry->name);
- TRACE_POINT();
HASHTABLE_INIT(&(new_common_entry->items),
struct cache_ht_item_data_, data,
new_common_entry->common_params.cache_entries_size);
- TRACE_POINT();
if (new_common_entry->common_params.policy == CPT_FIFO)
policies_size = 1;
@@ -621,7 +617,6 @@
struct cache_entry_ **result;
TRACE_IN(find_cache_entry);
- TRACE_STR((char *)entry_name);
result = find_cache_entry_p(the_cache, entry_name);
if (result == NULL) {
@@ -652,7 +647,7 @@
common_entry = (struct cache_common_entry_ *)entry;
memset(&item_data, 0, sizeof(struct cache_ht_item_data_));
- /* TODO: can't avoid the cast here */
+ /* can't avoid the cast here */
item_data.key = (char *)key;
item_data.key_size = key_size;
@@ -752,7 +747,7 @@
common_entry = (struct cache_common_entry_ *)entry;
memset(&item_data, 0, sizeof(struct cache_ht_item_data_));
- /* TODO: can't avoid the cast here */
+ /* can't avoid the cast here */
item_data.key = (char *)key;
item_data.key_size = key_size;
@@ -770,13 +765,10 @@
item_data.key = (char *)malloc(key_size);
memcpy(item_data.key, key, key_size);
-// memset(item_data.key, 0, strlen(key)+1);
-// strncpy(item_data.key, key, strlen(key));
item_data.value = (char *)malloc(value_size);
assert(item_data.value != NULL);
- /* TODO: check types */
memcpy(item_data.value, value, value_size);
item_data.value_size = value_size;
@@ -786,7 +778,6 @@
common_entry->get_time_func(&policy_item->creation_time);
if (common_entry->policies_size > 1) {
- TRACE_POINT();
connected_policy_item =
common_entry->policies[1]->create_item_func();
memcpy(&connected_policy_item->creation_time,
@@ -801,14 +792,12 @@
item_data.fifo_policy_item = policy_item;
- TRACE_POINT();
common_entry->policies[0]->add_item_func(common_entry->policies[0],
policy_item);
if (common_entry->policies_size > 1)
common_entry->policies[1]->add_item_func(
common_entry->policies[1], connected_policy_item);
- TRACE_POINT();
HASHTABLE_ENTRY_STORE(cache_ht_, item, &item_data);
++common_entry->items_size;
@@ -844,7 +833,6 @@
if ((mp_entry->mp_params.max_sessions > 0) &&
(mp_entry->ws_size == mp_entry->mp_params.max_sessions)) {
- TRACE_POINT();
TRACE_OUT(open_cache_mp_write_session);
return (NULL);
}
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cachelib.h#8 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cacheplcs.c#8 (text+ko) ====
@@ -363,8 +363,6 @@
} else
index = CACHELIB_MAX_FREQUENCY - 1;
- TRACE_INT(lfu_item->frequency);
- TRACE_INT(index);
TAILQ_REMOVE(&(lfu_policy->groups[lfu_item->frequency]), lfu_item,
entries);
lfu_item->frequency = index;
@@ -439,13 +437,10 @@
int i;
TRACE_IN(cache_lfu_policy_get_next_item);
- TRACE_PTR(&(lfu_policy->groups[
- ((struct cache_lfu_policy_item_ *)item)->frequency]));
lfu_policy = (struct cache_lfu_policy_ *)policy;
lfu_item = TAILQ_NEXT((struct cache_lfu_policy_item_ *)item, entries);
if (lfu_item == NULL)
{
- TRACE_INT(((struct cache_lfu_policy_item_ *)item)->frequency);
for (i = ((struct cache_lfu_policy_item_ *)item)->frequency + 1;
i < CACHELIB_MAX_FREQUENCY; ++i) {
if (!TAILQ_EMPTY(&(lfu_policy->groups[i]))) {
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cacheplcs.h#8 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/config.c#8 (text+ko) ====
@@ -92,7 +92,6 @@
res = pthread_mutexattr_init(&attr);
if (res != 0) {
- TRACE_INT(res);
TRACE_OUT(create_configuration_entry);
return (NULL);
}
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/config.h#8 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/debug.c#8 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/debug.h#8 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/hashtable.h#8 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/log.c#8 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/log.h#8 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/mp_rs_query.c#8 (text+ko) ====
@@ -89,7 +89,6 @@
&c_mp_rs_request->entry_length, sizeof(size_t));
if (result != sizeof(size_t)) {
- TRACE_INT(result);
TRACE_OUT(on_mp_read_session_request_read1);
return (-1);
}
@@ -125,7 +124,6 @@
c_mp_rs_request->entry_length);
if (result != qstate->kevent_watermark) {
- TRACE_INT(result);
TRACE_OUT(on_mp_read_session_request_read2);
return (-1);
}
@@ -162,14 +160,17 @@
qstate->config_entry = configuration_find_entry(
s_configuration, c_mp_rs_request->entry);
if (qstate->config_entry == NULL) {
- TRACE_MSG("can't find corresponding configuration entry."
- " aborting request");
+ LOG_ERR_2("read_session_request",
+ "can't find configuration entry '%s'."
+ " aborting request", c_mp_rs_request->entry);
TRACE_OUT(on_write_request_process);
return (-1);
}
if (qstate->config_entry->enabled == 0) {
- TRACE_MSG("corresponding configuration entry is disabled");
+ LOG_ERR_2("read_session_request",
+ "configuration entry '%s' is disabled",
+ c_mp_rs_request->entry);
TRACE_OUT(on_read_request_process);
return (-1);
}
@@ -202,7 +203,6 @@
if ((rs == INVALID_CACHE_MP_READ_SESSION) &&
(qstate->config_entry->perform_actual_lookups != 0)) {
- TRACE_STR(c_mp_rs_request->entry);
lookup_agent = find_agent(s_agent_table,
c_mp_rs_request->entry, MULTIPART_AGENT);
@@ -256,7 +256,8 @@
(ws != NULL));
}
- configuration_lock_entry(qstate->config_entry, CELT_MULTIPART);
+ configuration_lock_entry(qstate->config_entry,
+ CELT_MULTIPART);
rs = open_cache_mp_read_session(c_entry);
configuration_unlock_entry(qstate->config_entry,
CELT_MULTIPART);
@@ -329,12 +330,10 @@
} else {
result = qstate->read_func(qstate, &elem_type, sizeof(int));
if (result != sizeof(int)) {
- TRACE_INT(result);
TRACE_OUT(on_mp_read_session_mapper);
return (-1);
}
- TRACE_PTR(qstate->mdata);
switch (elem_type) {
case CET_MP_READ_SESSION_READ_REQUEST:
qstate->kevent_watermark = 0;
@@ -372,7 +371,6 @@
(cache_mp_read_session)qstate->mdata, NULL,
&read_response->data_size);
- TRACE_INT(read_response->error_code);
if (read_response->error_code == 0) {
read_response->data = (char *)malloc(read_response->data_size);
assert(read_response != NULL);
@@ -410,25 +408,20 @@
result += qstate->write_func(qstate, &read_response->data_size,
sizeof(size_t));
if (result != qstate->kevent_watermark) {
- TRACE_INT(result);
- TRACE_INT(qstate->kevent_watermark);
TRACE_OUT(on_mp_read_session_read_response_write1);
return (-1);
}
qstate->kevent_watermark = read_response->data_size;
qstate->process_func = on_mp_read_session_read_response_write2;
- TRACE_POINT();
} else {
if (result != qstate->kevent_watermark) {
- TRACE_POINT();
TRACE_OUT(on_mp_read_session_read_response_write1);
return (-1);
}
qstate->kevent_watermark = 0;
qstate->process_func = NULL;
- TRACE_POINT();
}
TRACE_OUT(on_mp_read_session_read_response_write1);
@@ -444,13 +437,9 @@
TRACE_IN(on_mp_read_session_read_response_write2);
read_response = get_cache_mp_read_session_read_response(
&qstate->response);
- TRACE_PTR(read_response->data);
- TRACE_INT(read_response->data_size);
result = qstate->write_func(qstate, read_response->data,
read_response->data_size);
if (result != qstate->kevent_watermark) {
- TRACE_INT(result);
- TRACE_INT(qstate->kevent_watermark);
TRACE_OUT(on_mp_read_session_read_response_write2);
return (-1);
}
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/mp_rs_query.h#8 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/mp_ws_query.c#8 (text+ko) ====
@@ -90,7 +90,6 @@
&c_mp_ws_request->entry_length, sizeof(size_t));
if (result != sizeof(size_t)) {
- TRACE_INT(result);
TRACE_OUT(on_mp_write_session_request_read1);
return (-1);
}
@@ -126,7 +125,6 @@
c_mp_ws_request->entry_length);
if (result != qstate->kevent_watermark) {
- TRACE_INT(result);
TRACE_OUT(on_mp_write_session_request_read2);
return (-1);
}
@@ -156,21 +154,25 @@
qstate->config_entry = configuration_find_entry(
s_configuration, c_mp_ws_request->entry);
if (qstate->config_entry == NULL) {
- TRACE_MSG("can't find corresponding configuration entry. "
- "aborting request");
+ LOG_ERR_2("write_session_request",
+ "can't find configuration entry '%s'. "
+ "aborting request", c_mp_ws_request->entry);
TRACE_OUT(on_write_request_process);
return (-1);
}
if (qstate->config_entry->enabled == 0) {
- TRACE_MSG("corresponding configuration entry is disabled");
+ LOG_ERR_2("write_session_request",
+ "configuration entry '%s' is disabled",
+ c_mp_ws_request->entry);
TRACE_OUT(on_read_request_process);
return (-1);
}
if (qstate->config_entry->perform_actual_lookups != 0) {
- TRACE_MSG(
- "entry performs lookups by itself: can't write to it");
+ LOG_ERR_2("write_session_request",
+ "entry '%s' performs lookups by itself: "
+ "can't write to it", c_mp_ws_request->entry);
TRACE_OUT(on_write_request_process);
return (-1);
}
@@ -254,7 +256,6 @@
} else {
result = qstate->read_func(qstate, &elem_type, sizeof(int));
if (result != sizeof(int)) {
- TRACE_INT(result);
TRACE_OUT(on_mp_write_session_mapper);
return (-1);
}
@@ -302,7 +303,6 @@
sizeof(size_t));
if (result != sizeof(size_t)) {
- TRACE_INT(result);
TRACE_OUT(on_mp_write_session_write_request_read1);
return (-1);
}
@@ -336,7 +336,6 @@
write_request->data_size);
if (result != qstate->kevent_watermark) {
- TRACE_INT(result);
TRACE_OUT(on_mp_write_session_write_request_read2);
return (-1);
}
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/mp_ws_query.h#8 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/parser.c#8 (text+ko) ====
@@ -54,6 +54,7 @@
const char *, int);
static void set_suggested_size(struct configuration *, const char *,
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list