First, i know java well and i have used C++ on occasion so i thought i would be able to deal with a class where they program in C. unfortunately i have hit some speed bumps that i am having problems.
Here is my problem:
I have a structure cache_t in the sample program we are supposed to use. In one of my functions i am supposed to use a pointer to an instance of this cache_t struct to perform some operations and return a value.
Code:
struct cache_t
{
int nsets;
....
}
cache_access(struct cache_t *cp,....)
How do i get the value of nsets? i have tried &cp.nsets but that just gives me an error:
error: request for member 'nsets' in something not a structure or union
---------- Post updated at 02:32 AM ---------- Previous update was at 01:10 AM ----------
ah, nevermind. As i guessed it was my inexperience with C causing problems. I was looking for cp->nsets.
Hello,
The system reboots in single user mode
what command to use to bring the system up regularly??
I get
INIT: cannot create /var/adm/utmpx
Type control -d to proceede with a normal startup
or give root passwd for system maintaince.
either way i don't have a change and ... (1 Reply)
Welcome to "The trouble with...." with your host, ZazzyBob.
Todays offering - "The trouble with letting other people host your website"
I use a certain web hosting service, who shall of course remain nameless here.
They are running PHP 4.3.10
I decide to write a script to test their PHP... (6 Replies)
Hi all,
having read lots of posts about SU I don't quiet understand this :
I'm doing regular backups of my database (u betta do) and therefore use su - username -c "sqlscript special data_base" in a unixscript which is even using cron. (yep!)
Now I need some other script, still with this... (4 Replies)
Hi,
we currently use a valisys licence :
it is based on a server (serv1)
it is reached only by one workstation (cam1)
In all licence files there is line with cam1 et serv1
We want to use cam22 (new workstation) instead of cam1
I made a copy the licences files with remplacing cam1 by cam22... (0 Replies)
I'm not sure where to post this but it's happening on a SunOS 5.8 server so I'll try here.
I've discovered some unexpected behavior when using tr.
For example:
echo a | tr
Z
echo b | tr
a
echo a | tr
B
echo a | tr
B
echo a | tr
A (8 Replies)
Hi folks,
there are windows device names in the sixth column of a comma separated file. A example device name is:
\\.\Tape0
I don't get the all string in to a variable, because of the preceding backslash. The first backslash is just cut off and my attempts to manipulate the string afterward... (0 Replies)
What is the possible cause for the mount command to take ages? im trying to mount remotely : "mount -t nfs xx.x.x.x:/export/xyz/cdrom-4.0 /mnt/cdrom" on a system using bash. Im able to ping the remote server, but the system hangs or takes about half an hour to carry out this mount command.... (4 Replies)
Hi there, I'm new to unix-environments.
I'm richard, and i'm mostly a web-developer, under php. I've done work in unix env before, but never had my own.
Today, I've got debian 3.1 r4 from the official site, and i've attempted to install it twice.
I installed it initially as "Desktop... (0 Replies)
I am trying to figure awk.
I have a file in my home directory called testawk.sh, have made it executable, and have run it... But don't see any output.
This is the contents of the file:
#!/usr/bin/awk -f
{ print " - HI -" }I enter ./testawk.sh in the prompt, press enter, and watch as the... (2 Replies)
I am having a bit of trouble plotting a histogram in gnuplot. I am trying to use it to draw bars side by side. The first bar is from column five in my data file. The second bar is actually three bars stacked on top of each other and should be as tall as the first bar. The data is from the 2nd,... (0 Replies)
Discussion started by: kingnothing
0 Replies
LEARN ABOUT OSX
cache_destroy
cache_create(3) BSD Library Functions Manual cache_create(3)NAME
cache_create -- Creates an in memory cache
SYNOPSIS
#include <cache.h>
int
cache_create(const char *name, cache_attributes_t *attrs, cache_t **cache_out);
int
cache_destroy(cache_t *cache);
DESCRIPTION
cache_create() Creates a cache using attributes attrs (see below) and name name and if successful stores it in cache_out. name is a NULL-
terminated cstring in reverse-DNS form (e.g. "com.mycompany.imagecache") and is used for debugging and performance tools. It must not be
NULL.
cache_destroy() Removes all unreferenced values in cache and deallocates it.
CACHE ATTRIBUTES
Cache attributes are callbacks passed to cache_create() to support different types of keys and values and to configure cache behavior. The
cache framework provides preexisting cache_callbacks(3) functions that can be used for these callbacks to support common key and value types
typedef struct cache_attributes_s {
uint32_t version;
cache_key_hash_cb_t key_hash_cb;
cache_key_is_equal_cb_t key_is_equal_cb;
cache_key_retain_cb_t key_retain_cb;
cache_release_cb_t key_release_cb;
cache_release_cb_t value_release_cb;
cache_value_make_nonpurgeable_cb_t value_make_nonpurgeable_cb;
cache_value_make_purgeable_cb_t value_make_purgeable_cb;
void *user_data;
cache_value_retain_cb_t value_retain_cb;
} cache_attributes_t;
#define CACHE_ATTRIBUTES_VERSION_2 2
key_hash_cb Calculates a hash value using key
key_is_equal_cb Determines if two keys are equal
key_retain_cb Called when a key is added to a cache using cache_set_and_retain() to allow key to be copied, or retained if
it is a reference-counted object.
key_release_cb Called when a key is removed or evicted from a cache to allow the key to be deallocated, or released if it is
a reference-counted object.
value_retain_cb Called when a value is added to a cache using cache_set_and_retain() to allow value to be retained if it is a
reference-counted object.
value_release_cb Called when a value is removed or evicted from a cache to allow the key to be deallocated, or released if it
is a reference-counted object.
value_make_nonpurgeable_cb Called when a value is referenced using cache_get_and_retain() to allow it to be made nonpurgeable or uncom-
pressed.
value_make_purgeable_cb Called when a value is unreferenced to allow it to be made purgeable or compressed.
version Attributes version number used for binary compatibility.
user_data This value will be passed to all other callbacks for this cache. May be NULL.
RETURN VALUES
All functions return 0 for success and non-zero for failure.
EXAMPLE
The following example uses pre-existing cache_callbacks(3) to create a cache with cstring keys and malloc(3) allocated values. The
#include <cache.h>
#include <cache_callbcaks.h>
cache_t *im_cache;
cache_attributes_t attrs = {
.version = CACHE_ATTRIBUTES_VERSION_2,
.key_hash_cb = cache_key_hash_cb_cstring,
.key_is_equal_cb = cache_key_is_equal_cb_cstring,
.key_retain_cb = my_copy_string,
.key_release_cb = cache_release_cb_free,
.value_release_cb = cache_release_cb_free,
};
cache_create("com.acme.im_cache", &attrs, &im_cache);
SEE ALSO cache(3)cache_set_and_retain(3)cache_callbacks(3)Darwin May 7, 2009 Darwin