Re: advanced programming unix environment
Hi Mel, Thanks for your reply - very insightful - i have beendelving into the c library files - which is after all why i am readingthis book, though still at the beginning 8). On the pracct.c source file I have found it sufficient just to change line 31 from struct acctacdata; to struct acctv1acdata; this leaves me with only 1 error which I have side stepped but not fixed. error: + bsdexit2.c: In function 'thr_fn2'; bsdexit2.c:31: Warning format '%d' expects type 'int', but argument 2 has type 'pthread_t' + line 31of threads/bsdexit2.c reads: printf("thread 2: ID is %d\n", pthread_self which I have commented this line and Make finishes building. however which "% ?" operater would I use to display pthread_self. In the c library pthread.h it says it is of "pthread_t" type. I appreciate your help and I am grateful that you have inspired me. Kindest regards, Seamus - Original Message ---- From: Mel <[EMAIL PROTECTED]> To: freebsd-questions@freebsd.org Cc: Brother Seamus <[EMAIL PROTECTED]> Sent: Monday, 14 April, 2008 7:51:05 PM Subject: Re: advanced programming unix environment On Monday 14 April 2008 18:48:58 Brother Seamus wrote: > I am trying to build the neccesary files for the stevens/rago APUE.2e book > on FreeBSD 7.0 > I get the following error: > + > pracct.c ../lib/libapue.a > pracct.c: In function 'main': > pracct.c:31: error: storage size of 'acdata' isn't known > pracct.c:31: warning: unused variable 'acdata' The legacy struct acct has been renamed to acctv1 and a new one is named acctv2. If you add: typedef struct acctv1 acct_t; After the #include then change the type of acdata to 'acct_t', you'll probably have solved it. But depends a bit on the rest of the library. -- Mel Problem with today's modular software: they start with the modules and never get to the software part. - Original Message From: Mel <[EMAIL PROTECTED]> To: freebsd-questions@freebsd.org Cc: Brother Seamus <[EMAIL PROTECTED]> Sent: Monday, 14 April, 2008 7:51:05 PM Subject: Re: advanced programming unix environment On Monday 14 April 2008 18:48:58 Brother Seamus wrote: > I am trying to build the neccesary files for the stevens/rago APUE.2e book > on FreeBSD 7.0 > I get the following error: > + > pracct.c ../lib/libapue.a > pracct.c: In function 'main': > pracct.c:31: error: storage size of 'acdata' isn't known > pracct.c:31: warning: unused variable 'acdata' The legacy struct acct has been renamed to acctv1 and a new one is named acctv2. If you add: typedef struct acctv1 acct_t; After the #include then change the type of acdata to 'acct_t', you'll probably have solved it. But depends a bit on the rest of the library. -- Mel Problem with today's modular software: they start with the modules and never get to the software part. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: advanced programming unix environment
just a note: same source code makes fine on solaris installation. I would appreciate if somebody else running freebsd 7.0 could download source and see if it makes fine on their installation. Steven's "Advance Programming in the Unix Environment" Source code: http://www.apuebook.com/src.tar.gz thanks Date: Mon, 14 Apr 2008 16:48:58 +0000 (GMT) From: Brother Seamus <[EMAIL PROTECTED]> Subject: advanced programming unix environment To: freebsd-questions@freebsd.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=utf-8 I am trying to build the neccesary files for the stevens/rago APUE.2e book on FreeBSD 7.0 as instructed i get the source from here: http://www.apuebook.com/src.tar.gz unzip & untar to: /home/seamus/apue.2e cd /home/seamus/apue.2e amend "Make.defines.freebsd" as instructed so: "WKDIR=/home/seamus/apue.2e" and then run "make" from this directory. I get the following error: + pracct.c ../lib/libapue.a pracct.c: In function 'main': pracct.c:31: error: storage size of 'acdata' isn't known pracct.c:31: warning: unused variable 'acdata' *** Error code 1 Stop in /usr/home/seamus/apue.2e/proc. *** Error code 1 Stop in /usr/home/seamus/apue.2e. *** Error code 1 Stop in /usr/home/seamus/apue.2e. + I would appreciate any help. + Make.defines.freebsd + # Common make definitions, customized for each platform # Definitions required in all program directories to compile and link # C programs using gcc. WKDIR=/home/seamus/apue.2e CC=gcc COMPILE.c=$(CC) $(CFLAGS) $(CPPFLAGS) -c LINK.c=$(CC) $(CFLAGS) $(CPPFLAGS) $(LDDIR) $(LDFLAGS) LDDIR=-L../lib LDLIBS=../lib/libapue.a $(EXTRALIBS) CFLAGS=-ansi -I$(WKDIR)/include -Wall -DBSD $(EXTRA) # Our library that almost every program needs. LIB=../libapue.a # Common temp files to delete from each directory. TEMPFILES=core core.* *.o temp.* *.out typescript* + pracct.c + #include "apue.h" #include #ifdef HAS_SA_STAT #define FMT "%-*.*s e = %6ld, chars = %7ld, stat = %3u: %c %c %c %c\n" #else #define FMT "%-*.*s e = %6ld, chars = %7ld, %c %c %c %c\n" #endif #ifndef HAS_ACORE #define ACORE 0 #endif #ifndef HAS_AXSIG #define AXSIG 0 #endif static unsigned long compt2ulong(comp_t comptime)/* convert comp_t to unsigned long */ { unsigned longval; intexp; val = comptime & 0x1fff;/* 13-bit fraction */ exp = (comptime >> 13) & 7;/* 3-bit exponent (0-7) */ while (exp-- > 0) val *= 8; return(val); } int main(int argc, char *argv[]) { struct acctacdata; FILE*fp; if (argc != 2) err_quit("usage: pracct filename"); if ((fp = fopen(argv[1], "r")) == NULL) err_sys("can't open %s", argv[1]); while (fread(&acdata, sizeof(acdata), 1, fp) == 1) { printf(FMT, (int)sizeof(acdata.ac_comm), (int)sizeof(acdata.ac_comm), acdata.ac_comm, compt2ulong(acdata.ac_etime), compt2ulong(acdata.ac_io), #ifdef HAS_SA_STAT (unsigned char) acdata.ac_stat, #endif acdata.ac_flag & ACORE ? 'D' : ' ', acdata.ac_flag & AXSIG ? 'X' : ' ', acdata.ac_flag & AFORK ? 'F' : ' ', acdata.ac_flag & ASU ? 'S' : ' '); } if (ferror(fp)) err_sys("read error"); exit(0); } -- Message: 23 Date: Mon, 14 Apr 2008 13:16:45 -0400 From: Jerry McAllister <[EMAIL PROTECTED]> Subject: Re: Can't log in as root on new 7.0 install To: Jesse Sheidlower <[EMAIL PROTECTED]> Cc: freebsd-questions@freebsd.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=us-ascii On Mon, Apr 14, 2008 at 10:35:03AM -0400, Jesse Sheidlower wrote: > > I've recently installed FreeBSD 7.0 on a new server. I seem to > be unable to log in as root in any way, and I'm not sure why. > Furthermore I'm now physically separate from the machine, and > have been relying on a (non-computer-literate) colleague with > access to its console server to try and help. > > After the initial install I (am pretty sure I) was able to log > in as root over ssh. However, after a week when the machine > was inaccessible for other reasons, I cannot log in as root, > only as a normal user. > > I thought that I had perhaps mis-remembered the root password, > so I directed the colleague to log in in single user mode and > reset the root password; she wa
advanced programming unix environment
I am trying to build the neccesary files for the stevens/rago APUE.2e book on FreeBSD 7.0 as instructed i get the source from here: http://www.apuebook.com/src.tar.gz unzip & untar to: /home/seamus/apue.2e cd /home/seamus/apue.2e amend "Make.defines.freebsd" as instructed so: "WKDIR=/home/seamus/apue.2e" and then run "make" from this directory. I get the following error: + pracct.c ../lib/libapue.a pracct.c: In function 'main': pracct.c:31: error: storage size of 'acdata' isn't known pracct.c:31: warning: unused variable 'acdata' *** Error code 1 Stop in /usr/home/seamus/apue.2e/proc. *** Error code 1 Stop in /usr/home/seamus/apue.2e. *** Error code 1 Stop in /usr/home/seamus/apue.2e. + I would appreciate any help. + Make.defines.freebsd + # Common make definitions, customized for each platform # Definitions required in all program directories to compile and link # C programs using gcc. WKDIR=/home/seamus/apue.2e CC=gcc COMPILE.c=$(CC) $(CFLAGS) $(CPPFLAGS) -c LINK.c=$(CC) $(CFLAGS) $(CPPFLAGS) $(LDDIR) $(LDFLAGS) LDDIR=-L../lib LDLIBS=../lib/libapue.a $(EXTRALIBS) CFLAGS=-ansi -I$(WKDIR)/include -Wall -DBSD $(EXTRA) # Our library that almost every program needs. LIB=../libapue.a # Common temp files to delete from each directory. TEMPFILES=core core.* *.o temp.* *.out typescript* + pracct.c + #include "apue.h" #include #ifdef HAS_SA_STAT #define FMT "%-*.*s e = %6ld, chars = %7ld, stat = %3u: %c %c %c %c\n" #else #define FMT "%-*.*s e = %6ld, chars = %7ld, %c %c %c %c\n" #endif #ifndef HAS_ACORE #define ACORE 0 #endif #ifndef HAS_AXSIG #define AXSIG 0 #endif static unsigned long compt2ulong(comp_t comptime)/* convert comp_t to unsigned long */ { unsigned longval; intexp; val = comptime & 0x1fff;/* 13-bit fraction */ exp = (comptime >> 13) & 7;/* 3-bit exponent (0-7) */ while (exp-- > 0) val *= 8; return(val); } int main(int argc, char *argv[]) { struct acctacdata; FILE*fp; if (argc != 2) err_quit("usage: pracct filename"); if ((fp = fopen(argv[1], "r")) == NULL) err_sys("can't open %s", argv[1]); while (fread(&acdata, sizeof(acdata), 1, fp) == 1) { printf(FMT, (int)sizeof(acdata.ac_comm), (int)sizeof(acdata.ac_comm), acdata.ac_comm, compt2ulong(acdata.ac_etime), compt2ulong(acdata.ac_io), #ifdef HAS_SA_STAT (unsigned char) acdata.ac_stat, #endif acdata.ac_flag & ACORE ? 'D' : ' ', acdata.ac_flag & AXSIG ? 'X' : ' ', acdata.ac_flag & AFORK ? 'F' : ' ', acdata.ac_flag & ASU ? 'S' : ' '); } if (ferror(fp)) err_sys("read error"); exit(0); } ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"