[ProgClub list] Memory management in C
jj5 at progclub.org
Sat Oct 1 09:44:46 AEST 2011
On 1/10/2011 8:56 AM, jedd wrote:
> Bit of a cross (thread) posting .. soz.
> I was going to observe that K&R is all you really need, since you're
> a Real Programmer .. but then pondered on the fact that's all I
> used when I was at college, and twenty years later I can barely
> remember any C at all. I recall that I really had a good handle on
> pointers, and vaguely recall being chuffed (at the time) with this.
It's easy to be self-congratulatory when you get a handle on things that
everyone says are hard. The thing is, pointers aren't hard!
> Having said that - I'd expect that K&R would in fact give you about
> 90% of what you need to know .. until you get into the second stage
> (analysing other people's code).
90% of what who needs to know for what? I haven't followed you man.
I think that K&R C is the term they use to describe the version of C
before it got standardised by ANSI. So there's K&R C (the older version
of C) and the new(er) ANSI C. AIUI K&R C has some anachronisms such as
the way function parameter types are defined.
> For your daemon project .. are you sure netcat can't do what you
Haven't heard of netcat... one moment please... ah:
I'm not sure how that would help me. For the administration daemon..?
The admin daemon listens on a port for commands and then executes them
as a privileged user. Can netcat do that?
> upstart (apt-cache show it) might be a good way of maintaining
> its presence.
I think I'm just going to use the built in 'init' feature. Why wouldn't
I use init and its 'respawn' facility?
> And I echo the earlier observation - run it as a dedicated, non-root
> user, mosdef. This introduces two things that are going to prolong
> the development process - learning how to drop privs, and working out
> what uid/gid you should be using so you don't step on toes, present
> and future, in the Debian world.
Yeah, that's cool. I'll setup a pcad user and add it to the sudo group,
which will give it the permission it needs to read the particular files
I need it to (i.e. the file that contains the password for the MySQL
root user). Still, don't you need to supply your password when you
invoke sudo? I didn't want to create a user that had to know its password.
I have a section on allocating user IDs in the administrative reference:
Basically user accounts start at 1000, and utility accounts start at
500. That should keep out of the way of the Debian standard users/groups
More information about the list