From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 15:10:19 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DAA0106566C; Wed, 11 Jan 2012 15:10:19 +0000 (UTC) (envelope-from guy.helmer@palisadesystems.com) Received: from ps-1-a.compliancesafe.com (ps-1-a.compliancesafe.com [216.81.161.161]) by mx1.freebsd.org (Postfix) with ESMTP id EFB918FC0C; Wed, 11 Jan 2012 15:10:16 +0000 (UTC) Received: from mail.palisadesystems.com (localhost [127.0.0.1]) by ps-1-a.compliancesafe.com (8.14.4/8.14.3) with ESMTP id q0BF9x73078862; Wed, 11 Jan 2012 09:10:00 -0600 (CST) (envelope-from guy.helmer@palisadesystems.com) Received: from guysmbp.dyn.palisadesys.com (GuysMBP.dyn.palisadesys.com [172.16.2.90]) (authenticated bits=0) by mail.palisadesystems.com (8.14.3/8.14.3) with ESMTP id q0BF9mcM039415 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 11 Jan 2012 09:09:48 -0600 (CST) (envelope-from guy.helmer@palisadesystems.com) X-DKIM: Sendmail DKIM Filter v2.8.3 mail.palisadesystems.com q0BF9mcM039415 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=palisadesystems.com; s=mail; t=1326294589; bh=Zp6FbHlcomOFzQin4pDrMb9pCYqrJ5k8vB0b+5+mCvM=; l=128; h=Subject:Mime-Version:Content-Type:From:In-Reply-To:Date:Cc: Content-Transfer-Encoding:Message-Id:References:To; b=Wzog3aS+3y7KlFO6cU+EDWEZbDXpbB6CcwifE1hkNA6DekFrRyUUYRExx5z5SrH+D glARaA7mJMQAqbwoTuHoAAN8ti+THOST8nXpFRCrQ/0YF2qCGGvo1JxBKKNKf62LkW NgSUpCN4bADaZVzz0xWI9n5qsdbZKee1iPNetIYY= Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=us-ascii From: Guy Helmer In-Reply-To: <20120111214848.K1813@besplex.bde.org> Date: Wed, 11 Jan 2012 09:09:47 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <26EF49B4-1B8E-43BC-AC7B-FD24BB94C961@palisadesystems.com> References: <201201101953.q0AJrPao025097@svn.freebsd.org> <20120110221323.GE1694@garage.freebsd.pl> <20120111214848.K1813@besplex.bde.org> To: Bruce Evans X-Mailer: Apple Mail (2.1251.1) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.5 (mail.palisadesystems.com [172.16.1.5]); Wed, 11 Jan 2012 09:09:49 -0600 (CST) X-Palisade-MailScanner-Information: Please contact the ISP for more information X-Palisade-MailScanner-ID: q0BF9mcM039415 X-Palisade-MailScanner: Found to be clean X-Palisade-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (score=0.172, required 5, ALL_TRUSTED -1.00, BAYES_00 -1.90, J_CHICKENPOX_65 0.60, J_CHICKENPOX_73 0.60, J_CHICKENPOX_75 0.60, RP_8BIT 1.27) X-Palisade-MailScanner-From: guy.helmer@palisadesystems.com X-Spam-Status: No X-PacketSure-Scanned: Yes Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Pawel Jakub Dawidek Subject: Re: svn commit: r229937 - in head/lib: libc/gen libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 15:10:19 -0000 On Jan 11, 2012, at 6:25 AM, Bruce Evans wrote: > On Tue, 10 Jan 2012, Pawel Jakub Dawidek wrote: >=20 >> On Tue, Jan 10, 2012 at 07:53:25PM +0000, Guy Helmer wrote: >> [...] >>> Modified: head/lib/libutil/libutil.h >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libutil/libutil.h Tue Jan 10 18:43:27 2012 = (r229936) >>> +++ head/lib/libutil/libutil.h Tue Jan 10 19:53:25 2012 = (r229937) >>> @@ -170,6 +170,7 @@ struct pidfh *pidfile_open(const char *p >>> int pidfile_write(struct pidfh *pfh); >>> int pidfile_close(struct pidfh *pfh); >>> int pidfile_remove(struct pidfh *pfh); >>> +int pidfile_fileno(struct pidfh *pfh); >>> #endif >>>=20 >>> #ifdef _UFS_UFS_QUOTA_H_ >>=20 >> One more thing. You also need to add link in Makefile, so that >> 'man pidfile_fileno' will work. >=20 > Is there any chance of keeping sorted lists sorted? >=20 > This file used to be mostly sorted and mostly in KNF (tab before > function names) and mostly without namespace pollution in parameter > names). Newer code in it violates all of these style and header > implementation rules. The pidfile code was already especially bad, > and adding to the end of the unsorted list in it doesn't help. >=20 > The pidfile man page is also unsorted. It was in "operations" order > "open/write/close/remove". That is hard to maintain and hard to = search > for long lists. Adding pidfile_fileno() to the end of the list in the > same disorder as above makes the list not even in "operations" order > (since pidfile_fileno() is only valid betwen pidfile_open() and > pidfile_close()). >=20 > Old disorder and nearby bugs in libutil.h (old :=3D before 2005): > - the forward declarations of structs are totally disordered > - the following prototypes are disordered (mostly by adding them to > the end of a orginally-almost-sorted list: > trimdomain(), forkpty(), humanize_number(), uu_lockerr(), = uu_unlock(), > _secure_path(), properties_read(), properties_free(), = properties_find(), > auth_getval(), realhostname(), > - the forward declaration of struct sockaddr is disorderd (not = unsorted > at the beginning with the others) > - surprisingly, realhostname_sa() is not unsorted relative to = realhostname() > - the following prototypes have namespace pollution in parameter names > (their parameter names are in the implementation namespace, unlike = for > all of the older prototypes in the file): > properties read(), properties free(), properties free(), = auth_getval(), > realhostname(), realhostname_sa(). The properties code used to be = the > only really ugly code in this file. > - formatting errors for openpty() (premature line splitting and wrong > continuation indent). The very first prototype in this file gives > an example of normal splitting and continuation indent > - formatting errors for forkpty() (same as for openpty()) > - line too long for realhostname_sa(), pw_copy() > - consider fparseln() as being in a new section so it isn't unsorted. > The start of this section should be delimited by a blank line (this = is > done in -current). The new section isn't really justified. It is > just 1 function ifdefed to avoid a namespace problem. > - no namespace pollution for fparseln()'s parameters, but that it = because > it is in a style different from all older prototypes in the file -- = it > doesn't name its parameters. >=20 > Newer disorder and nearby bugs: > - further unsorting of the forward declarations by adding kinfo* to = the > end of the unsorted list. At least the new declarations are sorted > internally. > - the following protypes in the early sections are disordered: > expand_number(), kld*(), kinfo* (no need for a new section for the > last 2. At least they are each sorted internally), gr_scan() > - the following prototypes have namespace pollution in parameter = names: > hexdump(), kld*(), gr_dup(), gr_equal(), gr_make(), gr_scan(). = Only > about half of the gr*() prototypes have this bug > - better indentation for kinfo*() than for older or newer entries! > - line too long for gr_entry() > - pidfile*() have all of the above bugs, plus they are the only = prototypes > up to this point in the file that don't put a tab before the function > name when the return type is int > - quota*() are slightly worse than pidfile*(). They add the = additional > style bug of not using parameter names at all, except for 1 of 2 > parameters in 1 of 12 prototypes. That parameter is namespace = pollution. >=20 > Bruce Does this patch improve the situation? I have not found guidance for line lengths in style(9) -- am I looking = in the wrong place? Guy Index: libutil.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libutil.h (revision 229961) +++ libutil.h (working copy) @@ -84,110 +84,117 @@ #endif =20 /* Avoid pulling in all the include files for no need */ -struct termios; -struct winsize; struct in_addr; struct kinfo_file; struct kinfo_proc; struct kinfo_vmentry; +struct sockaddr; +struct termios; +struct winsize; =20 __BEGIN_DECLS -void clean_environment(const char * const *_white, +char *auth_getval(const char *_name); +void clean_environment(const char * const *_white, const char * const *_more_white); -int extattr_namespace_to_string(int _attrnamespace, char **_string); -int extattr_string_to_namespace(const char *_string, int = *_attrnamespace); -int flopen(const char *_path, int _flags, ...); -void hexdump(const void *ptr, int length, const char *hdr, int = flags); -int login_tty(int _fd); -void trimdomain(char *_fullhost, int _hostsize); -int openpty(int *_amaster, int *_aslave, char *_name, - struct termios *_termp, struct winsize *_winp); -int forkpty(int *_amaster, char *_name, - struct termios *_termp, struct winsize *_winp); -int humanize_number(char *_buf, size_t _len, int64_t _number, +int expand_number(const char *_buf, uint64_t *_num); +int extattr_namespace_to_string(int _attrnamespace, char = **_string); +int extattr_string_to_namespace(const char *_string, int = *_attrnamespace); +int flopen(const char *_path, int _flags, ...); +int forkpty(int *_amaster, char *_name, + struct termios *_termp, struct winsize *_winp); +void hexdump(const void *_ptr, int _length, const char *_hdr, int = _flags); +int humanize_number(char *_buf, size_t _len, int64_t _number, const char *_suffix, int _scale, int _flags); -int expand_number(const char *_buf, uint64_t *_num); -const char *uu_lockerr(int _uu_lockresult); -int uu_lock(const char *_ttyname); -int uu_unlock(const char *_ttyname); -int uu_lock_txfr(const char *_ttyname, pid_t _pid); -int _secure_path(const char *_path, uid_t _uid, gid_t _gid); -properties properties_read(int fd); -void properties_free(properties list); -char *property_find(properties list, const char *name); -char *auth_getval(const char *name); -int realhostname(char *host, size_t hsize, const struct in_addr = *ip); -struct sockaddr; -int realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, - int addrlen); - -int kld_isloaded(const char *name); -int kld_load(const char *name); struct kinfo_file * - kinfo_getfile(pid_t _pid, int *_cntp); + kinfo_getfile(pid_t _pid, int *_cntp); struct kinfo_vmentry * - kinfo_getvmmap(pid_t _pid, int *_cntp); + kinfo_getvmmap(pid_t _pid, int *_cntp); struct kinfo_proc * - kinfo_getallproc(int *_cntp); + kinfo_getallproc(int *_cntp); struct kinfo_proc * - kinfo_getproc(pid_t _pid); + kinfo_getproc(pid_t _pid); +int kld_isloaded(const char *_name); +int kld_load(const char *_name); +int login_tty(int _fd); +int openpty(int *_amaster, int *_aslave, char *_name, + struct termios *_termp, struct winsize *_winp); +void properties_free(properties _list); +properties + properties_read(int fd); +char *property_find(properties _list, const char *_name); +int realhostname(char *_host, size_t _hsize, const struct in_addr = *_ip); +int realhostname_sa(char *_host, size_t _hsize, struct sockaddr = *_addr, + int _addrlen); +void trimdomain(char *_fullhost, int _hostsize); +const char * + uu_lockerr(int _uu_lockresult); +int uu_lock(const char *_ttyname); +int uu_unlock(const char *_ttyname); +int uu_lock_txfr(const char *_ttyname, pid_t _pid); +int _secure_path(const char *_path, uid_t _uid, gid_t _gid); =20 + #ifdef _STDIO_H_ /* avoid adding new includes */ -char *fparseln(FILE *, size_t *, size_t *, const char[3], int); +char *fparseln(FILE *_fp, size_t *_len, size_t *_lineno, + const char _delim[3], int _flags); #endif =20 #ifdef _PWD_H_ -int pw_copy(int _ffd, int _tfd, const struct passwd *_pw, struct = passwd *_old_pw); +int pw_copy(int _ffd, int _tfd, const struct passwd *_pw, struct = passwd *_old_pw); struct passwd *pw_dup(const struct passwd *_pw); -int pw_edit(int _notsetuid); -int pw_equal(const struct passwd *_pw1, const struct passwd *_pw2); -void pw_fini(void); -int pw_init(const char *_dir, const char *_master); +int pw_edit(int _notsetuid); +int pw_equal(const struct passwd *_pw1, const struct passwd *_pw2); +void pw_fini(void); +int pw_init(const char *_dir, const char *_master); char *pw_make(const struct passwd *_pw); char *pw_make_v7(const struct passwd *_pw); -int pw_mkdb(const char *_user); -int pw_lock(void); +int pw_mkdb(const char *_user); +int pw_lock(void); struct passwd *pw_scan(const char *_line, int _flags); const char *pw_tempname(void); -int pw_tmp(int _mfd); +int pw_tmp(int _mfd); #endif =20 #ifdef _GRP_H_ -int gr_copy(int __ffd, int _tfd, const struct group *_gr, struct = group *_old_gr); -struct group *gr_dup(const struct group *gr); -int gr_equal(const struct group *gr1, const struct group *gr2); -void gr_fini(void); -int gr_init(const char *_dir, const char *_master); -int gr_lock(void); -char *gr_make(const struct group *gr); -int gr_mkdb(void); -int gr_tmp(int _mdf); -struct group *gr_scan(const char *line); +int gr_copy(int __ffd, int _tfd, const struct group *_gr, struct = group *_old_gr); +struct group *gr_dup(const struct group *_gr); +int gr_equal(const struct group *_gr1, const struct group *_gr2); +void gr_fini(void); +int gr_init(const char *_dir, const char *_master); +int gr_lock(void); +char *gr_make(const struct group *_gr); +int gr_mkdb(void); +struct group *gr_scan(const char *_line); +int gr_tmp(int _mdf); #endif =20 #ifdef _SYS_PARAM_H_ -struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t = *pidptr); -int pidfile_write(struct pidfh *pfh); -int pidfile_close(struct pidfh *pfh); -int pidfile_remove(struct pidfh *pfh); -int pidfile_fileno(const struct pidfh *pfh); +int pidfile_close(struct pidfh *_pfh); +int pidfile_fileno(const struct pidfh *_pfh); +struct pidfh * + pidfile_open(const char *_path, mode_t _mode, pid_t *_pidptr); +int pidfile_remove(struct pidfh *_pfh); +int pidfile_write(struct pidfh *_pfh); #endif =20 #ifdef _UFS_UFS_QUOTA_H_ struct quotafile; struct fstab; -struct quotafile *quota_open(struct fstab *, int, int); -void quota_close(struct quotafile *); -int quota_on(struct quotafile *); -int quota_off(struct quotafile *); -const char *quota_fsname(const struct quotafile *); -const char *quota_qfname(const struct quotafile *); -int quota_maxid(struct quotafile *); -int quota_check_path(const struct quotafile *, const char *path); -int quota_read(struct quotafile *, struct dqblk *, int); -int quota_write_limits(struct quotafile *, struct dqblk *, int); -int quota_write_usage(struct quotafile *, struct dqblk *, int); -int quota_convert(struct quotafile *, int); +int quota_check_path(const struct quotafile *_qf, const char = *_path); +void quota_close(struct quotafile *_qf); +int quota_convert(struct quotafile *_qf, int _wordsize); +const char * + quota_fsname(const struct quotafile *_qf); +int quota_maxid(struct quotafile *_qf); +int quota_off(struct quotafile *_qf); +int quota_on(struct quotafile *_qf); +struct quotafile * + quota_open(struct fstab *_fs, int _quotatype, int _openflags); +const char * + quota_qfname(const struct quotafile *_qf); +int quota_read(struct quotafile *_qf, struct dqblk *_dqb, int _id); +int quota_write_limits(struct quotafile *_qf, struct dqblk *_dqb, = int _id); +int quota_write_usage(struct quotafile *_qf, struct dqblk *_dqb, = int _id); #endif =20 __END_DECLS -------- This message has been scanned by ComplianceSafe, powered by Palisade's PacketSure.