On Sun, Jun 30, 2013 at 11:53 PM, Roland Mainz <[email protected]> wrote: > 2013/6/28 Glenn Fowler <[email protected]>: >> >> the AT&T Software Technology ast alpha 2013-06-28 source release >> has been posted to the download site >> http://www.research.att.com/sw/download/alpha/ >> the package names and md5 checksums are >> INIT eddbf89d061348519d86f2618b708a94 >> ast-base a745a7d4ce6f53c2e4134af4cc835ff7 >> ast-open fdb74839ff041e34c800c333188a050e >> ast-ksh 8f22428cf30af7146bd210664c2fd166 >> the md5 sums should match the ones listed on the download page >> >> NOTE NOTE NOTE NOTE NOTE NOTE >> >> (*) *at() emulations for systems that need it >> (*) O_CLOEXEC F_DUPFD_CLOEXEC SOCK_CLOEXEC >> (*) accept4 pipe2 >> (*) syscall restart on EINTR controlled by astserial(AST_SERIAL_RESTART,op) >> (*) REALLY IMPORTANT: works on modern linux, some problems on solaris >> REASON: one of the ast team will not be logging on for 16 days and >> didn't have time left to figure out the solaris problems >> most likely in one of these >> src/lib/libast/comp/at.c >> src/lib/libast/port/intercept.c >> figuring that out left as a summer homework assignment > > Homework more or less done for Solaris (including |O_XATTR|/|O_SEARCH| > support) and fixing Linux's |O_PATH| support... the prototype patch is > attached as "astksh20130628_solaris_fixes001.diff.txt". > > > **Notes: > * Please please leave the comments about |O_PATH| and |#define > __USE_GNU 1| in src/lib/libast/features/fcntl.c intact. They are there > for a very good reason (mostly to bypass bugs in the Linux #includes). > I really don't want to hunt for ghost bugs over and over again. > The core part is this one: > -- snip -- > - printf("#define O_SEARCH O_PATH\n"); > + /* > + * O_PATH is a Linux's variation of O_SEARCH. Since this is treated > + * as extension it may not be available without _GNU_SOURCE. > + * Even even with _GNU_SOURCE some Linux platforms have bugs in their > + * headers which prevents the definition of O_PATH in some hideous > + * cases. To prevent all this mess we just grab the octal value and > + * define it as O_SEARCH. > + * Do not change this. You'll end-up in hell, together with the Linux > + * headers. Quickly. > + */ > + printf("#define O_SEARCH 0%o\n", (int)O_PATH); > -- snip -- > Please please don't change that... otherwise |O_PATH| is *NOT* > available in libast&&co. This is the 4th time I'm fixing this. Again. > ;-(( > > > * Solaris didn't work because... > 1. ... newer versions have many more |O_*|-flags for |open()|, > including |O_EXEC| and |O_SEARCH|. The same issue applied to the |F_*| > flags (I only added the |F_*| flags with the highest numbers in > Solaris 9/10/11/11.1 like |F_BADFD| ... maybe other platforms require > more "love" in this area...) ... > > 2. ... -lgen was missing when |eaccess()| is used... but... > > 3. ... why do we have to use |eaccess()| when |faccess()| is available ? > Remember that modern platforms (like Solaris >= 11) revamped their > syscalls and now map the "old" filesystem calls all to their |*at()| > version, e.g. ... > -- snip -- > /* |open()| argument |flags| is part of |__VA_ARGS__| since > |__VA_ARGS__| must never be empty */ > #define open(path, ...) openat(AST_AT_GET_FDCWD, (path), > __VA_ARGS__) > #define creat(path, ...) openat(AST_AT_GET_FDCWD, (path), > O_WRONLY|O_CREAT|O_TRUNC, __VA_ARGS__) > #define unlink(path) unlinkat(AST_AT_GET_FDCWD, (path), 0) > #define rmdir(path) unlinkat(AST_AT_GET_FDCWD, (path), > AT_REMOVEDIR) > #define chown(path, uid, gid) fchownat(AST_AT_GET_FDCWD, (path), > (uid), (gid), 0) > #define lchown(path, uid, gid) fchownat(AST_AT_GET_FDCWD, (path), > (uid), (gid), AT_SYMLINK_NOFOLLOW) > #define fchown(fd, uid, gid) fchownat((fd), NULL, (uid), (gid), 0) > #define stat(path, sb) fstatat(AST_AT_GET_FDCWD, (path), > (sb), 0) > #define lstat(path, sb) fstatat(AST_AT_GET_FDCWD, (path), > (sb), > AT_SYMLINK_NOFOLLOW) > #define fstat(fd, sb) fstatat((fd), NULL, (sb), 0) > #define rename(oldname, newname) renameat(AST_AT_GET_FDCWD, (oldname), > AST_AT_GET_FDCWD, (newname)) > #define access(path, amode) faccessat(AST_AT_GET_FDCWD, (path), > (amode), 0) > #define eaccess(path, amode) faccessat(AST_AT_GET_FDCWD, (path), > (amode), AT_EACCESS) > #define mkdir(path, amode) mkdirat(AST_AT_GET_FDCWD, (path), > (amode)) > #define mkfifo(path, amode) mkfifoat(AST_AT_GET_FDCWD, (path), > (amode)) > #define mknod(path, amode, adev) mknodat(AST_AT_GET_FDCWD, (path), > (amode), (adev)) > #define readlink(path, buf, bufsize) readlinkat(AST_AT_GET_FDCWD, > (path), (buf), (bufsize)) > #define symlink(oldpath, newpath) symlinkat((oldpath), > AST_AT_GET_FDCWD, (newpath)) > -- snip -- > > > * I still have to warm-up with the new syscall restart API. Some > things with trouble me: > - The restart option (as all other signal-related stuff) must be > per-thread. But headaches will occur if a single Shell_t object is > created by one thread and then passed over to another one (possible > fix: Add APIs like |sh_thread_attach()| and |sh_thread_detach()| > > - Why does it require an atomic counter (which is _very_ expensive > from the CPU pipeline point of view... basically it can count > (depending on CPU/architecture) as an equivalent of adding a full > pipeline flush+sync... which itself can take 500 or more ticks to > complete) ? > > - IMO it would be nice to add |ioctl()| calls per ioctl type with > proper prototypes, e.g. replace something like > |ioctl(JOBTTY,TIOCSETD,&linedisc)| with > |ioctl_TIOCSETD(JOBTTY,&linedisc)|. The point is to get stronger C > type checks and properly pass the types to the real |ioctl()|. Right > now the code assumes a specific layout and padding of the varargs data > which is *NOT* true and *NOT* portable (maybe we should just wait > until something like IA64 breaks and comes back with more teeth&&slime > to bite you... :-) ). > Another nice side-effect would be that we can do per-|ioctl()|-type > breakpoints... :-)
FYI Solaris 7 still doesn't build. Irek _______________________________________________ ast-developers mailing list [email protected] http://lists.research.att.com/mailman/listinfo/ast-developers
