From owner-svn-src-user@FreeBSD.ORG Fri Jan 8 23:57:31 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00FEB106566C; Fri, 8 Jan 2010 23:57:31 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E435A8FC0A; Fri, 8 Jan 2010 23:57:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o08NvUPl030998; Fri, 8 Jan 2010 23:57:30 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o08NvUoA030995; Fri, 8 Jan 2010 23:57:30 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201001082357.o08NvUoA030995@svn.freebsd.org> From: Ed Schouten Date: Fri, 8 Jan 2010 23:57:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201857 - in user/ed/utmpx: include lib/libc/gen X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2010 23:57:31 -0000 Author: ed Date: Fri Jan 8 23:57:30 2010 New Revision: 201857 URL: http://svn.freebsd.org/changeset/base/201857 Log: Last-minute ABI change. I was thinking: if we use the same layout for struct utmpx as we do for the futx, it is a lot easier to retain ABI compatibility. ut_type is just stored at the beginning of the structure, which means we can always first read the value of ut_type and cast it to an entirely different structure. Modified: user/ed/utmpx/include/utmpx.h user/ed/utmpx/lib/libc/gen/getutxent.3 Modified: user/ed/utmpx/include/utmpx.h ============================================================================== --- user/ed/utmpx/include/utmpx.h Fri Jan 8 23:50:39 2010 (r201856) +++ user/ed/utmpx/include/utmpx.h Fri Jan 8 23:57:30 2010 (r201857) @@ -39,17 +39,17 @@ typedef __pid_t pid_t; #endif struct utmpx { + short ut_type; /* Type of entry. */ + struct timeval ut_tv; /* Time entry was made. */ + char ut_id[8]; /* Record identifier. */ + pid_t ut_pid; /* Process ID. */ char ut_user[32]; /* User login name. */ - char ut_id[8]; /* Process identifier. */ char ut_line[32]; /* Device name. */ #if __BSD_VISIBLE char ut_host[128]; /* Remote hostname. */ #else char __ut_host[128]; #endif - pid_t ut_pid; /* Process ID. */ - short ut_type; /* Type of entry. */ - struct timeval ut_tv; /* Time entry was made. */ }; #define EMPTY 0 /* No valid user accounting information. */ Modified: user/ed/utmpx/lib/libc/gen/getutxent.3 ============================================================================== --- user/ed/utmpx/lib/libc/gen/getutxent.3 Fri Jan 8 23:50:39 2010 (r201856) +++ user/ed/utmpx/lib/libc/gen/getutxent.3 Fri Jan 8 23:57:30 2010 (r201857) @@ -93,13 +93,13 @@ found in the include file .In utmpx.h : .Bd -literal -offset indent struct utmpx { + short ut_type; /* Type of entry. */ + struct timeval ut_tv; /* Time entry was made. */ + char ut_id[]; /* Record identifier. */ + pid_t ut_pid; /* Process ID. */ char ut_user[]; /* User login name. */ - char ut_id[]; /* Process identifier. */ char ut_line[]; /* Device name. */ char ut_host[]; /* Remote hostname. */ - pid_t ut_pid; /* Process ID. */ - short ut_type; /* Type of entry. */ - struct timeval ut_tv; /* Time entry was made. */ }; .Ed .Pp @@ -136,15 +136,9 @@ are not processed by this implementation .Pp Other fields inside the structure are: .Bl -tag -width ut_user -.It Fa ut_user -The user login name corresponding with the login session. -This field is only applicable to entries of type -.Dv USER_PROCESS -and -.Dv INIT_PROCESS . -For -.Dv INIT_PROCESS -entries this entry typically contains the name of the login process. +.It Fa ut_tv +The time the event occured. +This field is used for all types of entries. .It Fa ut_id An identifier that is used to refer to the entry. This identifier can be used to remove or replace a login entry by @@ -156,6 +150,23 @@ This field is only applicable to entries .Dv LOGIN_PROCESS and .Dv DEAD_PROCESS . +.It Fa ut_pid +The process identifier of the session leader of the login session. +This field is only applicable to entries of type +.Dv USER_PROCESS , +.Dv INIT_PROCESS , +.Dv LOGIN_PROCESS +and +.Dv DEAD_PROCESS . +.It Fa ut_user +The user login name corresponding with the login session. +This field is only applicable to entries of type +.Dv USER_PROCESS +and +.Dv INIT_PROCESS . +For +.Dv INIT_PROCESS +entries this entry typically contains the name of the login process. .It Fa ut_line The name of the TTY character device, without the leading .Pa /dev/ @@ -171,17 +182,6 @@ If the user login session is not perform is left blank. This field is only applicable to entries of type .Dv USER_PROCESS . -.It Fa ut_pid -The process identifier of the session leader of the login session. -This field is only applicable to entries of type -.Dv USER_PROCESS , -.Dv INIT_PROCESS , -.Dv LOGIN_PROCESS -and -.Dv DEAD_PROCESS . -.It Fa ut_tv -The time the event occured. -This field is used for all types of entries. .El .Pp This implementation guarantees all inapplicable fields to be discarded.